Example #1
0
 public function errorCustom($exception)
 {
     $module = method_exists($exception, 'getModuleName') ? $exception->getModuleName() : null;
     $action = method_exists($exception, 'getActionName') ? $exception->getActionName() : null;
     $controller = method_exists($exception, 'getControllerName') ? $exception->getControllerName() : null;
     $this->getView()->assign("module", $module);
     $this->getView()->assign("controller", $controller);
     $this->getView()->assign("action", $action);
     $this->getView()->assign("message", $exception->getMessage());
     $this->getView()->assign("code", $exception->getCode());
     $this->getView()->assign("line", $exception->getLine());
     $this->getView()->assign("file", $exception->getFile());
     $callback = $this->getRequest()->getQuery("callback");
     if ($callback) {
         $callback = htmlentities($_GET['callback'], ENT_QUOTES, "UTF-8");
         $callback = Util_Xss::RemoveXSS($callback);
     }
     $this->getView()->assign("callback", $callback);
     if (YafDebug::isOpen()) {
         YafDebug::$debugbar['exceptions']->addException($exception);
     }
     if ($module) {
         $error_file = APPLICATION_VIEWS . 'error/error_' . strtolower($module) . '.html';
     } else {
         $error_file = APPLICATION_VIEWS . 'error/error.html';
     }
     $this->getView()->display($error_file);
 }
Example #2
0
 public function __construct($config)
 {
     $port = isset($config['port']) ? $config['port'] : 3306;
     $dsn = sprintf('mysql:host=%s;dbname=%s;port=%d', $config['host'], $config['dbname'], $port);
     YafDebug::log($dsn);
     try {
         $this->dbh = new PDO($dsn, $config['user'], $config['pass'], array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'utf8\'', PDO::ATTR_PERSISTENT => false, PDO::ATTR_EMULATE_PREPARES => true, PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING));
     } catch (Exception $e) {
         if ($this) {
             $this->error = $e->getMessage();
         }
     }
 }
Example #3
0
 protected function inputRefererErrorResult()
 {
     //        echo json_encode(array('code'=>-101,'desc'=>'referer error'));
     //        haloDie();
     YafDebug::log(sprintf("Illegal referer: uid is %s, referer is %s, params is %s ", WZhaopinEnv::getWid(), $_SERVER['HTTP_REFERER'], json_encode($_SERVER)), "refer_error");
     $this->inputErrorResult(WrmErrorCodeManager::CLIENT_ERR_ILLEGAL_REFER);
 }
Example #4
0
 protected function inputResult($data = null)
 {
     $login = 0;
     $status = 0;
     $role = 1;
     $statusArray = array();
     if ($this->uid) {
         $login = 1;
         YafDebug::log("get user status start .uid is" . $this->uid);
         YafDebug::log("client boject is");
         YafDebug::log($this->client);
         if (is_object($this->client)) {
             #warning TODO
             //获取不到对象
             $this->client = HaloClient::singleton();
             $result = $this->client->getUserStatus($this->uid);
         }
         YafDebug::log($result);
         $role = intval($result['user_role']);
         if ($result['user_role'] == 1) {
             $status = $result['resume_status'];
         } else {
             if ($result['mem_status'] !== null) {
                 $statusArray['mem_status'] = $result['mem_status'];
             }
         }
     }
     $statusArray['login'] = $login;
     $statusArray['status'] = $status;
     $statusArray['role'] = $role;
     if ($data !== null) {
         echo json_encode(array('data' => $data, 'code' => 0, 'status' => $statusArray));
     } else {
         echo json_encode(array('code' => 0, 'status' => array('login' => $login, 'status' => $status)));
     }
     // 		}
     haloDie();
 }