예제 #1
0
파일: File.php 프로젝트: clancats/core
 /**
  * Check if a session with the given key already exists
  *
  * @param string		$id		The session id key.
  * @param array 		$data
  * @return bool
  */
 public function write($id, $data)
 {
     if (!\CCFile::write($this->file_path($id), serialize($data))) {
         \CCError::exception(new Exception('Could not write session file.'));
     }
     return true;
 }
예제 #2
0
파일: Database.php 프로젝트: clancats/core
 /**
  * Check if a session with the given key already exists
  *
  * @param string		$id		The session id key.
  * @param array 		$data
  * @return bool
  */
 public function write($id, $data)
 {
     $columns = array();
     foreach ($this->index_fields as $field) {
         $columns[$field] = $data[$field];
         unset($data[$field]);
     }
     $columns['content'] = serialize($data);
     // When the session id didnt change we will do an update
     if ($id == $this->inital_session_id) {
         // because the we might already be in the shutdown process we
         // have to forward sql error directly to CCError
         try {
             \DB::update($this->table, $columns)->where('id', $id)->run($this->database);
         } catch (\Exception $e) {
             \CCError::exception($e);
         }
     } else {
         // add the id to the columns
         $columns['id'] = $id;
         // because the we might already be in the shutdown process we
         // have to forward sql error directly to CCError
         try {
             \DB::insert($this->table, $columns)->run($this->database);
         } catch (\Exception $e) {
             \CCError::exception($e);
         }
     }
 }
예제 #3
0
파일: wake.php 프로젝트: clancats/core
 */
set_exception_handler(function (Exception $exception) {
    if (class_exists("\\CCError")) {
        \CCError::exception($exception);
    }
});
/*
 *---------------------------------------------------------------
 * exception handler
 *---------------------------------------------------------------
 *  
 * Register our error handler.
 */
set_error_handler(function ($level, $message, $file = null, $line = null) {
    if (class_exists("\\CCError")) {
        \CCError::error($level, $message, $file, $line);
    }
});
/*
 *---------------------------------------------------------------
 * error reporting
 *---------------------------------------------------------------
 * 
 * Because we got now our nice own error handlers we don't wont 
 * that PHP itself prints any errors directly to the user.
 */
error_reporting(-1);
/*
 *---------------------------------------------------------------
 * pass the paths and directories
 *---------------------------------------------------------------