Esempio n. 1
0
 public static function log($origin_component, $level, $message, $data_label = "", $data = null)
 {
     if (defined('NO_DEBUG') || !BitMask::contains(self::$logLevel, $level)) {
         return;
     }
     $parts = array(0, $_SERVER['REMOTE_ADDR'], session_id(), time(), $origin_component, $level, $message, $data_label, serialize($data), serialize(isset($_SESSION) ? $_SESSION : null), serialize(debug_backtrace()));
     if (!isset($GLOBALS['request_key'])) {
         $GLOBALS['request_key'] = uniqid("", true);
         // only log this stuff once, keeps log filesize a lot smaller
         $parts = array_merge($parts, array(serialize($_GET), serialize($_POST), serialize(isset($_COOKIE) ? $_COOKIE : null), serialize($_SERVER)));
     }
     $parts[0] = $GLOBALS['request_key'];
     $handle = fopen(ROOT_PATH . '/debug_log.psv', 'a');
     fputcsv($handle, $parts, '|');
     fclose($handle);
 }
Esempio n. 2
0
 /**
  * Convert the permissions to am integer bit mask.
  *
  * {@internal Keep in mind that the bit positions named in the PDF reference are counted from 1, while in here they
  * are counted from 0.}}
  *
  * @param  int $revision
  * @return int
  */
 public function toInt($revision)
 {
     $bitMask = new BitMask();
     $bitMask->set(2, $this->mayPrint);
     $bitMask->set(3, $this->mayModify);
     $bitMask->set(4, $this->mayCopy);
     $bitMask->set(5, $this->mayAnnotate);
     if ($revision >= 3) {
         $bitMask->set(8, $this->mayFillInForms);
         $bitMask->set(9, $this->mayExtractForAccessibility);
         $bitMask->set(10, $this->mayAssemble);
         $bitMask->set(11, $this->mayPrintHighResolution);
     }
     return $bitMask->toInt();
 }