public function _deleteOne($table, $id)
 {
     $backup = new modelBackupRestore();
     $content = $backup->_backupData($id, $name, $table);
     $backup->_insertWebLog($name, 'delete', $table, $_SESSION['adminUser'], $content, $_SESSION['adminLang']);
     $sql = "DELETE FROM `{$table}` WHERE `id`='{$id}' LIMIT 1";
     $this->db->query($sql);
     return true;
 }
 public function _getSql($type, $table, $fields, $values, $id = NULL)
 {
     $backup = new modelBackupRestore();
     if ($type == 1) {
         $content = '';
         $action = 'create';
         $sql = $this->_create($table, $fields, $values);
     } elseif ($type == 2 && is_numeric($id)) {
         $content = $backup->_backupData($id, $name, $table);
         $action = 'update';
         $sql = $this->_update($table, $fields, $values, $id);
     } else {
         return FALSE;
     }
     if (!$this->db->query($sql)) {
         die($this->db->error);
         return FALSE;
     } else {
         if ($type == 1) {
             $id = $this->db->insert_id;
             $backup->_backupData($id, $name, $table);
         }
         $backup->_webLog($name, $action, $table, $_SESSION['adminUser'], $content, $_SESSION['adminLang']);
         return TRUE;
     }
 }
<?php

$backup = new modelBackupRestore();
$backup->_clearLogs();
echo '<div id="tableName" style="display:none">' . $table . '</div>';
echo $c->viewFormSearch();
?>
<div id="content">
	<table width="100%" border="0" cellpadding="0" cellspacing="0" id="view_select">
    	<tr bgcolor="#88C4FF">
        	<th width="50">STT</th>
            <th align="left">Mô tả</th>
            <th width="100" align="left">Action</th>
            <th width="140" align="left">Table</th>
            <th width="120" align="left">Date</th>
            <th width="80" align="left">User</th>
            <th width="80">Thao tác</th>
        </tr>
        <?php 
$i = 0;
$data = $c->selectFromAll('', $arr, $table, "`{$table}`.`action`, `{$table}`.`table`, `{$table}`.`datetime`, `{$table}`.`username`");
foreach ($data as $row) {
    $i++;
    ?>
            <tr class="row">
                <td align="center"><?php 
    echo $arr['startRow'] + $i;
    ?>
</td>
                <td><p class="height_row_hidden"><?php 
    echo $row['name'];
Exemple #4
0
 public function _getSql($type, $table, $fields, $values, $id = NULL)
 {
     $backup = new modelBackupRestore();
     if ($type == 'create') {
         $content = '';
         $sql = $this->_create($table, $fields, $values);
     } elseif ($type == 'update') {
         $content = $backup->_backupData($id, $name, $table);
         $sql = $this->_update($table, $fields, $values, $id);
     } else {
         return FALSE;
     }
     if (!$this->db->query($sql)) {
         die($this->db->error);
         return FALSE;
     } else {
         if ($type == 'create') {
             $id = $this->db->insert_id;
             $backup->_backupData($id, $name, $table);
         }
         if (isset($_SESSION['adminUser'])) {
             $user = $_SESSION['adminUser'];
         } else {
             $user = '******';
         }
         if (isset($_SESSION['adminLang'])) {
             $lang = $_SESSION['adminLang'];
         } else {
             $lang = CONS_DEFAULT_LANG;
         }
         $backup->_insertWebLog($name, $type, $table, $id, $user, $content, $lang);
         return $id;
     }
 }
Exemple #5
0
     }
 }
 if (isset($_POST['delete_one'])) {
     $table = $c->_model->_changeDauNhay($_POST['table']);
     $id = $c->_model->_changeDauNhay($_POST['delete_one']);
     settype($id, "int");
     if ($table == '' || $id == '') {
         return false;
     }
     $c->_model->_deleteOne($table, $id);
     return true;
 }
 if (isset($_POST['ajaxRestore'])) {
     $id = $_POST['ajaxRestore'];
     settype($id, "int");
     $backup = new modelBackupRestore();
     echo $backup->_restoreData($id);
     return true;
 }
 if (isset($_POST['linkDeatil'])) {
     $menu_id = $c->_model->_changeDauNhay($_POST['menu_id']);
     if ($menu_id == '') {
         return false;
     }
     echo $c->menuId($menu_id);
     return true;
 }
 if (isset($_POST['checkLinkDeatil'])) {
     $id = $c->_model->_changeDauNhay($_POST['checkLinkDeatil']);
     settype($id, 'int');
     $table = $c->_model->_changeDauNhay($_POST['table']);
/*end phan quyen role*/
/*logs*/
if (isset($_POST['ajaxRestore'])) {
    $id = $_POST['ajaxRestore'];
    settype($id, "int");
    $backup = new modelBackupRestore();
    echo $backup->_restoreData($id);
    return true;
}
if (isset($_POST['clearLogs'])) {
    $soNgayLuuLai = $_POST['clearLogs'];
    settype($soNgayLuuLai, "int");
    if ($soNgayLuuLai < 30) {
        return false;
    }
    $logs = new modelBackupRestore();
    $data = $logs->_clearLogs($soNgayLuuLai);
    return true;
}
/*end logs*/
/*clearCache*/
if (isset($_POST['clearCache'])) {
    $c->remove_dir(CONS_CACHE_URL_FILE);
    return true;
}
if (isset($_POST['ajaxNumberItem'])) {
    $table = $c->_model->_changeDauNhay($_POST['table']);
    $para = str_replace("'", "&#39;", $_POST['parameter']);
    if ($table == '') {
        return false;
    }