Exemplo n.º 1
0
 /**
  * Logging actions from TCEmain
  *
  * @param string $table Table name the log entry is concerned with. Blank if NA
  * @param int $recuid Record UID. Zero if NA
  * @param int $action Action number: 0=No category, 1=new record, 2=update record, 3= delete record, 4= move record, 5= Check/evaluate
  * @param int $recpid Normally 0 (zero). If set, it indicates that this log-entry is used to notify the backend of a record which is moved to another location
  * @param int $error The severity: 0 = message, 1 = error, 2 = System Error, 3 = security notice (admin)
  * @param string $details Default error message in english
  * @param int $details_nr This number is unique for every combination of $type and $action. This is the error-message number, which can later be used to translate error messages. 0 if not categorized, -1 if temporary
  * @param array $data Array with special information that may go into $details by '%s' marks / sprintf() when the log is shown
  * @param int $event_pid The page_uid (pid) where the event occurred. Used to select log-content for specific pages.
  * @param string $NEWid NEW id for new records
  * @return int Log entry UID (0 if no log entry was written or logging is disabled)
  */
 public function log($table, $recuid, $action, $recpid, $error, $details, $details_nr = -1, $data = array(), $event_pid = -1, $NEWid = '')
 {
     if (!$this->enableLogging) {
         return 0;
     }
     // Type value for tce_db.php
     $type = 1;
     if (!$this->storeLogMessages) {
         $details = '';
     }
     if ($error > 0) {
         $detailMessage = $details;
         if (is_array($data)) {
             $detailMessage = vsprintf($details, $data);
         }
         $this->errorLog[] = '[' . $type . '.' . $action . '.' . $details_nr . ']: ' . $detailMessage;
     }
     return $this->BE_USER->writelog($type, $action, $error, $details_nr, $details, $data, $table, $recuid, $recpid, $event_pid, $NEWid);
 }