<?php include 'sets.php';?>
<?php
$superuser="1";
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Webadmin <?php echo $domain ?></title>
<?php include 'codes.php';?>
</head>
<body>

<?php include 'navbar.php';?>
    
<div class="container">
<div class="frame">
<div class="frametitles frametitles1">
<?php
if  (isset($_POST['changeeditable'.$_REQUEST['insert_id']])) {
$editable = $mysqli->real_escape_string(stripslashes($_REQUEST['editable']));
$mysqli->query("UPDATE langvars SET editable='$editable' WHERE insert_id='{$_REQUEST['insert_id']}'"); 
}?> 
<span class="icon fa-language"></span> <a href="list-langvars.php"><?php echo $adminlangvars ?> Website</a> 
<div class="floatright"><a href="add-langvar.php"><img src="img/add.png" alt="<?php echo $adminadditem ?>" title="<?php echo $adminadditem ?>"></a></div>
</div>
<div class="framein">
  <?php
$result = $mysqli->query("SELECT * FROM langvars WHERE lang_id=$lang AND name NOT LIKE ('admin%') ORDER BY priority, editable desc, name");
while($row = $result->fetch_array()) {
$id=$row['id'];
$insert_id=$row['insert_id'];
$name=$row['name'];
$details=$row['details'];
$text=$row['text'];
$text = mb_substr(strip_tags($text), 0, 100, 'UTF-8');	
$editable=$row['editable'];
?>
 <div class="framerow">
    <table>
      <tr>
         <td width="400">
        <a href="edit-langvar.php?id=<?php echo $insert_id?>" class="titles"><?php echo $name ?></a>
         <?php echo $details ?>
        </td>  
        <td>
          <?php echo $text ?> 
          </td>
  <td width="180">
  <?php if ($editable==1) { ?>
  <span class="icon fa-edit color2" title="<?php echo $adminedit ?>"></span>
  <?php } ?>
  &nbsp;
  <?php if ($main==1) { ?>
  <b><?php echo $admindefault ?></b>
  <?php } ?>
  </td>
        <td width="150">
        <form name="forma" method="post">
          <input type="hidden" name="insert_id" value="<?php echo $insert_id ?>">
          <?php if ($editable==0) { ?>
          <input type="hidden" name="editable" value="0">
          <input type="checkbox" name="editable" value="1">
          <?php }else{?>
          <input type="hidden" name="editable" value="0">
          <input type="checkbox" name="editable" value="1" checked>
          <?php } ?>
          <button type="submit" name="changeeditable<?php echo $insert_id ?>" class="button buttonsmall"><span class="icon fa-check"></span></button>
        </form>
        </td>
        
        <td class="divoption">
          <a href="edit-langvar.php?id=<?php echo $insert_id?>" class="linkoption" title="<?php echo $adminedit ?>"><span class="icon fa-edit"></span> <?php echo $adminedit ?></a>
          </td>
        <td class="divoption"> 
          
<?php
if  (isset($_POST['deleterow'])) {
$mysqli->query("DELETE FROM langvars WHERE insert_id='{$_REQUEST['insertid']}'");
?>
<meta http-equiv="refresh" content="0">  
<?php } ?>       
          <form name="formdelete" method="post">
            <input type="hidden" name="id" value="<?php echo $id ?>">
            <input type="hidden" name="insertid" value="<?php echo $insert_id ?>">
            <button type="submit" name="deleterow" class="linkoption linkdelete" title="<?php echo $admindelete ?>"><span class="icon fa-trash-o"></span> <?php echo $admindelete ?></button>
            </form>
          
          </td>
        </tr>
    </table>
  </div>
<?php } ?>

</div>
</div>
</div>

<?php include 'menudown.php';?>

</body>
</html>