Example #1
0
         default:
             $api->error(400);
     }
     break;
 case 'documentation':
     $auth = new Authentification();
     if (!(new Setting('api_display_doc'))->getValue() && !$auth->isLogged()) {
         break;
     }
     $this->page('api/documentation');
     $this->fakePage('api');
     $this->assign('api_path', API::API_PATH);
     $this->assign('api_request', (new Setting('api_requests'))->getValue());
     if (!Cookie::Exists('notice_apidoc')) {
         $this->assign('displayNotice', TRUE);
         $this->assign('cookie_display_name', Cookie::Name('notice_apidoc'));
         $this->register('script_file', 'cookie.min.js');
     }
     break;
 case 'request':
     if (!(new Setting('api_requests'))->getValue()) {
         break;
     }
     $this->fakePage('api');
     switch ($this->request(2)) {
         case 'sent':
             $this->page('api/request_sent');
             break;
         case NULL:
             if (!empty($_POST)) {
                 $this->acceptToken();