<main>
  <div class="container-fluid">
    <div class="row align-items-center justify-content-between pt-2">
        <div class="col-12 text-end mb-2">
          <?php 
          $sql1 = "select * from t1_css where del=0 order by slug";
          $res1 = mysqli_query($db, $sql1);
          while($r1 = mysqli_fetch_assoc($res1)) {
            ?>
            <a href="?op=t1_css&op2=edit&id=<?=$r1['id'];?>" class="btn btn-xs cl-dp7"><?=$r1['slug'];?></a>
            <?php
          }  
          ?>
        </div>
    </div>           

          
  <?php
  switch($op2) {

      case "css";
          $sql = "select * from `t1_css` where id=".$_GET['id'];
          $res = mysqli_query($db, $sql);
          //echo $sql;
          $rw = mysqli_fetch_assoc($res);

          //$path='https://fin4.azkapersada.com/framework7/framework7.bundle.min.css';
          $php_file=$ar['path_core'].''.$rw['folder'].''.$rw['slug'].'.css';
          $css = file_get_contents($php_file);
          echo $path."<br>";
          $ar=arCss($css);

          foreach ($ar as $k => $v) {
            //echo $k."<br>";
            foreach ($v as $k1 => $v1) {
              foreach ($v1 as $k2 => $v2) {
                
                $idt=array(
                  'group'=>gpc($k),
                  'name'=>gpc($k1),
                  'k'=>gpc($k2),
                  'v'=>gpc($v2),
                  'src'=>8,
                );
                //Insert($db,"css",$idt,0);
              }
            }
          }
          echo "<pre>"; print_r($ar); echo "</pre>";      
        break;

      case "php_save";          
        file_put_contents($_POST['file_name'], $_POST['content']);
        edit($_POST['id']);
        break;
      case "edit";
        edit($_GET['id']);
        break;
      case "copy";
        $sql4 = "select id from `t1_css` order by id desc limit 1";
        $res4 = mysqli_query($db, $sql4);
        $rw4 = mysqli_fetch_assoc($res4);
        $id2=$rw4['id']+1;

        $sql3 = "select * from `t1_css` where id=".$_GET['id'];
        $res3 = mysqli_query($db, $sql3);
        $r3 = mysqli_fetch_assoc($res3);
        $idt=array(
          'id'=>$id2,
          //'modul'=>trim($r3['modul']),
          'slug'=>$r3['slug']."-",
          'folder'=>trim($r3['folder']),
          'php'=>gpc(trim($r3['php'])),
          'php_update_at'=>time(),
          'body'=>gpc(trim($r3['body'])),
        );
        Insert($db,"t1_css",$idt,0);
        edit($id2);
        break;
      case "edit2";
        //echo "<pre>"; print_r($_POST); echo "</pre>";
        $udt=array(
          //'modul'=>trim($_POST['modul']),
          'slug'=>$_POST['slug'],
          //'name'=>$_POST['name'],
          //'param'=>trim($_POST['param']),
          //'method'=>trim($_POST['method']),
          'folder'=>$_POST['folder'],
          //'file_jsapi'=>$_POST['file_jsapi'],
          'remark'=>trim($_POST['remark']),
          'php'=>gpc(trim($_POST['php'])),
          //'js'=>gpc(trim($_POST['js'])),
          //'js_api'=>gpc(trim($_POST['js_api'])),
          //'body'=>gpc(trim($_POST['body'])),
          'php_update_at'=>time(),
          //'js_update_at'=>time(),
          //'jsapi_update_at'=>time(),
        );
        Update($db,"t1_css",$udt,"id=".$_POST['id'],0);
        edit($_POST['id']);
        break;
      case "list";
        list_filecss($q,$col,$q2,$col2,$q3,$col3);
      default;
    }          
          
  ?>
          
  </div>
</main>



<?php

function list_filecss($q,$col,$q2,$col2,$q3,$col3) {
  global $db,$ar;
  
  //print_r($ar);
  ?>
  
  <table class="table table-bordered" id="dataTable_5d" width="100%" cellspacing="0">
      <thead>
          <tr>
              <th>ID</th>
              <th>Folder</th>
              <th>Slug</th>
              <th>is_api</th>
              <th>remark</th>
              <th>PhpAt</th>
              <th>Menu</th>
          </tr>
      </thead>

      <tbody>
      <?php
      $sql = "select * from t1_css where id>0 ";

      if($col!='') {
        $sql .= " and ".$col."='".$q."' ";
      }
      
      if($col2!='') {
        $sql .= " and ".$col2."='".$q2."' ";
      }

      if($col3!='') {
        $sql .= " and ".$col3."='".$q3."' ";
      }      
      
      //$sql .= " and st=1";
      $res = mysqli_query($db, $sql);
      //echo $sql;

      while($rw = mysqli_fetch_assoc($res)) {  
      ?>
      
          <tr>
              <td><?=$rw['id'];?></td>
              <td contenteditable="true" onBlur="colUpdate(this,'folder',<?=$rw['id'];?>,'t1_css')" onClick="editRow(this);"><?=$rw['folder'];?></td>
              <td><?=$rw['slug'];?></td>
              <td><?=$rw['type'];?></td>              
              <td><?=$rw['remark'];?></td>
              <td class="text-right"><?=date("Y-m-d H:i",$rw['php_update_at']);?></td>
              <td>
              
                <a class="btn btn-xs btn-primary" href="?op=t1_css&op2=edit&id=<?=$rw['id'];?>">edit</a> 
                <a href="#" onClick="uCol(<?=$rw['id'];?>,'del',1,'t1_css');" class="btn btn-xs btn-color-red">del</a>
                <a class="btn btn-xs btn-info" href="?op=t1_css&op2=css&id=<?=$rw['id'];?>">css array</a> 
                              
              </td>
          </tr>
        <?php
        }
        ?>  
          
      </tbody>
  </table>
  <br><?=$sql;?><br>
   

  <?php   
}

function edit($id) {
   global $db,$ar;    
  $sql = "select * from `t1_css` where id=".$id;
  $res = mysqli_query($db, $sql);
  //echo $sql;
  $rw = mysqli_fetch_assoc($res);
  $php_file=$ar['path_core'].''.$rw['folder'].''.$rw['slug'].'.css';
  if (file_exists($php_file)) {
    $filecontent=file_get_contents($php_file);
  } else {
    $filecontent="";      
  }
  //echo $php_file."<br>";  
  ?>
<div class="row">
  <div class="col-8">

  <form action="index.php?op=t1_css&op2=edit2" method="post">
    <input type="hidden" name="id" value="<?=$id;?>">
    <div class="row">
      <div class="col-6">        
      </div>
      <div class="col-6 text-end">
        <?php if($rw['type']==1) { ?>
        <a href="tes_curl.php?id=<?=$id;?>&c=1" target="_blank" class="btn btn-xs btn-info">Tes cURL [1]</a>
      <?php } ?>
        <a class="btn btn-sm cl-dp5 mr-2" href="?op=t1_css&op2=copy&id=<?=$id;?>">Copy This</a>
        <button type="submit" name="submit" class="btn btn-sm btn-primary">Save</button>
        
      </div>
    </div>

    <div class="row">
      <div class="col-2">
        <label for="folder" class="label">folder</label>
        <input type="text" class="form-control" name="folder" value="<?=$rw['folder'];?>">
        <label for="slug" class="label">slug</label>
        <input type="text" class="form-control" name="slug" value="<?=$rw['slug'];?>">
        <label for="remark" class="label">remark</label>
        <textarea rows="4" id="body" class="form-control" name="remark"><?=ugpc($rw['remark']);?></textarea>
      </div>
      <div class="col-4">
        <label for="php" class="label">php</label> 
        <textarea rows="20" id="php" class="form-control" name="php"><?=$rw['php'];?></textarea>
        <div id="editor-container-1" style="height:300px;"></div>
      </div>
      <div class="col-6"><pre class="line-numbers" data-start="1" style="white-space:pre-wrap;"><code contenteditable class="language-css"><?=htmlspecialchars($filecontent);?></code></pre>
      </div>
    </div>
  </form>
  </div>
  <div class="col-4">
    <?php 
    ?>    
    <div class="card">
      <div class="card-body">
<?=$ar['path_core'];?>
        <h5 class="card-title"><?=$rw['folder'];?><?=$rw['slug'];?>.css</h5>
        <form method="post" action="index.php?op=t1_css&op2=php_save">
          <input type="hidden" name="file_name" value="<?=$php_file;?>">
          <input type="hidden" name="id" value="<?=$rw['id'];?>">
          <textarea class="form-control" rows="16" name="content"><?=htmlspecialchars($filecontent);?></textarea>
          <input type="submit" name="submit" class="btn btn-success mt-2">
        </form>
      </div>
    </div>
  </div>
</div>
  <?php
  //echo "<pre>"; print_r($rw); echo "</pre>";
}
?>

/home/u902783705/domains/azkapersada.com/public_html/sub/
rs2/inc/inc.t1_css.php
si/common.function
si/dom/get.img
si/api/post_location
si/api/post_loc_v3
si/api/post_tag_v2
si/api/post_tag_v3
common.function
common.function-
footer
header
inc.app.function
inc.ar.app
index
tes_curl
ucol
api/v2/api.function
api/v2/inc.mail
api/v2/index
api/v2/php/agen
api/v2/php/armada_jalan_byday
api/v2/php/armada_perpal_byday
api/v2/php/armada_perpal_byday-
api/v2/php/beda_byday
api/v2/php/cek_rute_baru
api/v2/php/cek_rute_time
api/v2/php/cek_rute_time_v1
api/v2/php/cek_rute_time_v2
api/v2/php/city
api/v2/php/dr_time_byday
api/v2/php/dr_time_jalan_byday
api/v2/php/email_cek
api/v2/php/get_nl_byday
api/v2/php/get_nl_kelas_armada
api/v2/php/js_armada_tax_expire
api/v2/php/js_blue_armada
api/v2/php/js_blue_expire
api/v2/php/js_car_srut_blank
api/v2/php/js_img_todl
api/v2/php/js_jalurnew
api/v2/php/js_kebid
api/v2/php/js_nl_latest
api/v2/php/js_nl_min
api/v2/php/js_noken
api/v2/php/js_noken_mesin_blank
api/v2/php/js_noken_no_lambung
api/v2/php/js_noken_spionam_cek
api/v2/php/js_noken_tax_cek
api/v2/php/js_rute
api/v2/php/js_rute_bycity
api/v2/php/js_rute_min
api/v2/php/js_spionam_id
api/v2/php/js_spionam_kps
api/v2/php/kd_armada
api/v2/php/kd_armada_dr_time
api/v2/php/kd_armada_to_time
api/v2/php/naik_byday
api/v2/php/nk_pilih
api/v2/php/nl_noken_bytgl
api/v2/php/nl_pilih
api/v2/php/nl_reset
api/v2/php/noken_koreksi
api/v2/php/otw
api/v2/php/otw_not_full
api/v2/php/password_forgot
api/v2/php/post_1naik
api/v2/php/post_1turun
api/v2/php/post_blue
api/v2/php/post_dr_time_byday_local
api/v2/php/post_kebid_byday
api/v2/php/post_noken_mesin
api/v2/php/post_noken_no_lambung
api/v2/php/post_sakpol
api/v2/php/post_spionam
api/v2/php/post_spionam_cek
api/v2/php/post_spionam_update
api/v2/php/post_spnm_noken
api/v2/php/ricar
api/v2/php/rute_price
api/v2/php/selisih_bagasi
api/v2/php/signin
api/v2/php/tool
api/v2/php/tool_armada
api/v2/php/tool_lambung
api/v2/php/tool_noken
api/v2/php/turun_byday
api/v2/php/ucol
api/v2/php/uji_no
api/v2/php/update_agen
api/v2/php/update_armada_byday
api/v2/php/update_armada_v2_byday
api/v2/php/update_bagasi_byday
api/v2/php/update_bagasi_city
api/v2/php/update_jalan_byday
api/v2/php/update_penumpang_byday
api/v2/php/update_trayek_dr_time
api/v2/php/update_trayek_to_time
daily/10_tool_seq
daily/14_update_kd_armada
daily/15_update_rute_dr_to_ccd
daily/16_kdagen_to_id
daily/16_kdagen_to_id-
daily/17_update_dr_to_time
inc/inc.cp_sphp
inc/inc.filephp
inc/inc.job_kebid
inc/inc.js_pergi
inc/inc.rs4_css
inc/inc.rs4_html
inc/inc.rs4_h_page
inc/inc.rs4_h_tab
inc/inc.rs4_js
inc/inc.rs4_jsf
inc/inc.t1_css
inc/inc.t1_html
inc/inc.t1_h_page
inc/inc.t1_h_tab
inc/inc.t1_js
inc/inc.t1_jsf
xhr/inc.xhr