Example #1
0
 public static function deleteAll()
 {
     $result = array();
     $deleted = lC_Administrators_log_Admin::deleteAll();
     if ($deleted) {
         $result['rpcStatus'] = RPC_STATUS_SUCCESS;
     }
     echo json_encode($result);
 }
Example #2
0
 public function execute()
 {
     global $lC_Cache;
     if ($lC_Cache->isEnabled() && isset($this->cache_key)) {
         if ($lC_Cache->read($this->cache_key, $this->cache_expire)) {
             $this->cache_data = $lC_Cache->getCache();
             $this->cache_read = true;
         }
     }
     if ($this->cache_read === false) {
         if ($this->logging === true) {
             $this->logging_action = substr($this->sql_query, 0, strpos($this->sql_query, ' '));
             if ($this->logging_action == 'update') {
                 $db = preg_split('/ /', $this->sql_query, 3);
                 $this->logging_database = $db[1];
                 $test = $this->db_class->simpleQuery('select ' . implode(', ', array_keys($this->logging_fields)) . ' from ' . $this->logging_database . substr($this->sql_query, lc_strrpos_string($this->sql_query, ' where ')));
                 while ($result = $this->db_class->next($test)) {
                     foreach ($this->logging_fields as $key => $value) {
                         if ($result[$key] != $value) {
                             $this->logging_changed[] = array('key' => $this->logging_database . '.' . $key, 'old' => $result[$key], 'new' => $value);
                         }
                     }
                 }
             } elseif ($this->logging_action == 'insert') {
                 $db = preg_split('/ /', $this->sql_query, 4);
                 $this->logging_database = $db[2];
                 foreach ($this->logging_fields as $key => $value) {
                     $this->logging_changed[] = array('key' => $this->logging_database . '.' . $key, 'old' => '', 'new' => $value);
                 }
             } elseif ($this->logging_action == 'delete') {
                 $db = preg_split('/ /', $this->sql_query, 4);
                 $this->logging_database = $db[2];
                 $del = $this->db_class->simpleQuery('select * from ' . $this->logging_database . ' ' . $db[3]);
                 while ($result = $this->db_class->next($del)) {
                     foreach ($result as $key => $value) {
                         $this->logging_changed[] = array('key' => $this->logging_database . '.' . $key, 'old' => $value, 'new' => '');
                     }
                 }
             }
         }
         $this->query_handler = $this->db_class->simpleQuery($this->sql_query, $this->debug);
         if ($this->logging === true) {
             if ($this->db_class->logging_transaction_action === false) {
                 $this->db_class->logging_transaction_action = $this->logging_action;
             }
             if ($this->affectedRows($this->query_handler) > 0) {
                 if (!empty($this->logging_changed)) {
                     if ($this->logging_action == 'insert' && !is_numeric($this->logging_module_id)) {
                         $this->logging_module_id = $this->db_class->nextID();
                         $this->setNextID($this->logging_module_id);
                     }
                     if (class_exists('lC_Administrators_log_Admin')) {
                         lC_Administrators_log_Admin::insert($this->logging_module, $this->db_class->logging_transaction_action, $this->logging_module_id, $this->logging_action, $this->logging_changed, $this->db_class->logging_transaction);
                     }
                 }
             }
         }
         if ($this->batch_query === true) {
             $this->batch_size = $this->db_class->getBatchSize($this->sql_query, $this->batch_select_field);
             $this->batch_to = $this->batch_rows * $this->batch_number;
             if ($this->batch_to > $this->batch_size) {
                 $this->batch_to = $this->batch_size;
             }
             $this->batch_from = $this->batch_rows * ($this->batch_number - 1);
             if ($this->batch_to == 0) {
                 $this->batch_from = 0;
             } else {
                 $this->batch_from++;
             }
         }
         return $this->query_handler;
     }
 }
 public static function batchDelete($batch)
 {
     foreach ($batch as $id) {
         lC_Administrators_log_Admin::delete($id);
     }
     return true;
 }
Example #4
0
 public static function getAdminLogData()
 {
     $result = lC_Administrators_log_Admin::getAdminLogData($_GET['lid']);
     $result['rpcStatus'] = RPC_STATUS_SUCCESS;
     echo json_encode($result);
 }