Exemplo n.º 1
0
 public static function getProxyItemByValidToken(Database $db, $token)
 {
     $query = "SELECT id, token, valid_from, valid_to, data, route, action, only_authenticated, only_uid, only_gid FROM proxy WHERE (token=:token AND valid_from<=NOW() AND (valid_to IS NULL OR valid_to>NOW()))";
     $queryArgs = array(":token" => $token);
     $fetchArgs = array("type" => PDO::FETCH_CLASS, "className" => "ProxyEntity");
     return $db->selectQuery($query, $queryArgs, $fetchArgs);
 }
Exemplo n.º 2
0
 /**
  * Frontcontroller constructor.
  * It performs dispatching user request and runs the controller action.
  *
  * @param Phoenix\Core\Database $db            
  * @param Phoenix\Http\Request $request            
  * @return void
  */
 public function __construct(Database $db, Request $request)
 {
     $this->response = null;
     try {
         if ($db->getStatus() !== true) {
             throw new FailureException(FrameworkExceptions::F_DB_UNABLE_CONNECT);
         }
         $this->db = $db;
         $this->request = $request;
         $this->response_format = $this->request->getUrl()->getQueryParameter(self::URL_GET_FORMAT);
         $this->router = RouterFactory::createRouter(Config::get(Config::KEY_APP_USE_ROUTER));
         $this->dispatch();
         $this->performControllerAction();
     } catch (NoticeException $e) {
         $this->response = ResponseFactory::createResponse($this->response_format);
         $this->response->setException($e);
     } catch (WarningException $e) {
         Logger::log($e, $this->db);
         $this->response = ResponseFactory::createResponse($this->response_format);
         $this->response->setException($e);
     } catch (FailureException $e) {
         Logger::log($e);
         $this->response = ResponseFactory::createResponse($this->response_format);
         $this->response->setException($e);
     } catch (Exception $e) {
         Logger::log($e);
         $this->response = ResponseFactory::createResponse($this->response_format);
         $this->response->setException($e);
     }
 }
Exemplo n.º 3
0
 public static function insertRecord(Database $db, $user_uid, $message)
 {
     $query = "INSERT INTO log_activity (id, ts_insert, user_uid, message) VALUES (default, NOW(), :user_uid, :message)";
     $queryArgs = array(":user_uid" => $user_uid, ":message" => $message);
     return $db->actionQuery($query, $queryArgs);
 }
Exemplo n.º 4
0
 public static function insertRecord(Database $db, $class, $code, $stack, $message = null)
 {
     $query = "INSERT INTO log_internal (id, ts_insert, class, code, stack, message) VALUES (default, default, :class, :code, :stack, :message)";
     $queryArgs = array(":class" => $class, ":code" => $code, ":stack" => $stack, ":message" => $message);
     return $db->actionQuery($query, $queryArgs);
 }