Пример #1
0
 public function route($path)
 {
     if (!Utils::starts($path, $this->pathPrefix)) {
         return false;
     }
     $path = trim(substr($path, strlen($this->pathPrefix)), '/');
     switch (true) {
         case '' === $path:
             $this->auth();
             return true;
         case 'con' === $path:
             $this->queryAction();
             return true;
         case 'con/result' === $path:
             $this->resultAction();
             return true;
         case isset($_GET['logout']):
             $this->logoutAction();
             return true;
     }
     return false;
 }
Пример #2
0
            break;
        case 'startSession':
            $result = Api::startSession($json);
            break;
    }
    $result = array('result' => $result);
    header('Content-Type: application/json');
    echo json_encode($result);
    exit;
} else {
    switch (true) {
        case '/' === $path || Utils::starts($path, '/?'):
            Ui::index();
            break;
        case Utils::starts($path, '/suite'):
            Ui::suite();
            break;
        case Utils::starts($path, '/session'):
            Ui::session();
            break;
            /** @noinspection PhpMissingBreakStatementInspection */
        /** @noinspection PhpMissingBreakStatementInspection */
        case Utils::starts($path, '/dev'):
            if (Dev::create('/dev')->setAuth(Auth::getInstance('dev'))->route($path)) {
                break;
            }
        default:
            Ui::notFound();
            break;
    }
}