Example #1
0
 public static function call()
 {
     require_once $GLOBALS['rootpath'] . 'okapi/service_runner.php';
     require_once $GLOBALS['rootpath'] . 'okapi/views/menu.inc.php';
     $vars = array('menu' => OkapiMenu::get_menu_html("examples.html"), 'okapi_base_url' => Settings::get('SITE_URL') . "okapi/", 'site_url' => Settings::get('SITE_URL'), 'installations' => OkapiMenu::get_installations(), 'okapi_rev' => Okapi::$version_number, 'site_name' => Okapi::get_normalized_site_name());
     $response = new OkapiHttpResponse();
     $response->content_type = "text/html; charset=utf-8";
     ob_start();
     include 'examples.tpl.php';
     $response->body = ob_get_clean();
     return $response;
 }
Example #2
0
 public static function call()
 {
     require_once 'menu.inc.php';
     $vars = array('okapi_base_url' => Settings::get('SITE_URL') . "okapi/", 'menu' => OkapiMenu::get_menu_html(), 'installations' => OkapiMenu::get_installations(), 'okapi_rev' => Okapi::$revision);
     $response = new OkapiHttpResponse();
     $response->status = "404 Not Found";
     $response->content_type = "text/html; charset=utf-8";
     ob_start();
     include 'http404.tpl.php';
     $response->body = ob_get_clean();
     return $response;
 }
 public static function call()
 {
     require_once $GLOBALS['rootpath'] . 'okapi/service_runner.php';
     require_once $GLOBALS['rootpath'] . 'okapi/views/menu.inc.php';
     $vars = array('menu' => OkapiMenu::get_menu_html("introduction.html"), 'okapi_base_url' => Settings::get('SITE_URL') . "okapi/", 'site_url' => Settings::get('SITE_URL'), 'method_index' => OkapiServiceRunner::call('services/apiref/method_index', new OkapiInternalRequest(new OkapiInternalConsumer(), null, array())), 'installations' => OkapiMenu::get_installations(), 'okapi_rev' => Okapi::$version_number);
     $response = new OkapiHttpResponse();
     $response->content_type = "text/html; charset=utf-8";
     ob_start();
     include 'introduction.tpl.php';
     $response->body = ob_get_clean();
     return $response;
 }
Example #4
0
 public static function call()
 {
     require_once $GLOBALS['rootpath'] . 'okapi/views/menu.inc.php';
     require_once $GLOBALS['rootpath'] . 'okapi/views/changelog_helper.inc.php';
     $changelog = new Changelog();
     $vars = array('menu' => OkapiMenu::get_menu_html("changelog.html"), 'okapi_base_url' => Settings::get('SITE_URL') . "okapi/", 'site_url' => Settings::get('SITE_URL'), 'installations' => OkapiMenu::get_installations(), 'okapi_rev' => Okapi::$version_number, 'site_name' => Okapi::get_normalized_site_name(), 'changes' => array('unavailable' => $changelog->unavailable_changes, 'available' => $changelog->available_changes));
     $response = new OkapiHttpResponse();
     $response->content_type = "text/html; charset=utf-8";
     ob_start();
     include 'changelog.tpl.php';
     $response->body = ob_get_clean();
     return $response;
 }
Example #5
0
 public static function call($methodname)
 {
     require_once $GLOBALS['rootpath'] . 'okapi/service_runner.php';
     require_once $GLOBALS['rootpath'] . 'okapi/views/menu.inc.php';
     try {
         $method = OkapiServiceRunner::call('services/apiref/method', new OkapiInternalRequest(null, null, array('name' => $methodname)));
     } catch (BadRequest $e) {
         throw new Http404();
     }
     $vars = array('method' => $method, 'menu' => OkapiMenu::get_menu_html($methodname . ".html"), 'okapi_base_url' => Settings::get('SITE_URL') . "okapi/", 'installations' => OkapiMenu::get_installations(), 'okapi_rev' => Okapi::$revision);
     $response = new OkapiHttpResponse();
     $response->content_type = "text/html; charset=utf-8";
     ob_start();
     include 'method_doc.tpl.php';
     $response->body = ob_get_clean();
     return $response;
 }
Example #6
0
 public static function call()
 {
     if (isset($_REQUEST['posted'])) {
         $appname = isset($_REQUEST['appname']) ? $_REQUEST['appname'] : "";
         $appname = trim($appname);
         $appurl = isset($_REQUEST['appurl']) ? $_REQUEST['appurl'] : "";
         $email = isset($_REQUEST['email']) ? $_REQUEST['email'] : "";
         $accepted_terms = isset($_REQUEST['terms']) ? $_REQUEST['terms'] : "";
         $ok = false;
         if (!$appname) {
             $notice = "Please provide a valid application name.";
         } elseif (mb_strlen($appname) > 100) {
             $notice = "Application name should be less than 100 characters long.";
         } elseif (mb_strlen($appurl) > 250) {
             $notice = "Application URL should be less than 250 characters long.";
         } elseif ($appurl && substr($appurl, 0, 7) != "http://" && substr($appurl, 0, 8) != "https://") {
             $notice = "Application homepage URL should start with http(s)://. (Note: this URL is OPTIONAL and it is NOT for OAuth callback.)";
         } elseif (!$email) {
             $notice = "Please provide a valid email address.";
         } elseif (mb_strlen($email) > 70) {
             $notice = "Email address should be less than 70 characters long.";
         } elseif (!$accepted_terms) {
             $notice = "You have to read and accept OKAPI Terms of Use.";
         } else {
             $ok = true;
             Okapi::register_new_consumer($appname, $appurl, $email);
             $notice = "Consumer Key generated successfully.\nCheck your email!";
         }
         $response = new OkapiHttpResponse();
         $response->content_type = "application/json; charset=utf-8";
         $response->body = json_encode(array('ok' => $ok, 'notice' => $notice));
         return $response;
     }
     require_once $GLOBALS['rootpath'] . 'okapi/service_runner.php';
     require_once $GLOBALS['rootpath'] . 'okapi/views/menu.inc.php';
     $vars = array('menu' => OkapiMenu::get_menu_html("signup.html"), 'okapi_base_url' => Settings::get('SITE_URL') . "okapi/", 'site_url' => Settings::get('SITE_URL'), 'site_name' => Okapi::get_normalized_site_name(), 'installations' => OkapiMenu::get_installations(), 'okapi_rev' => Okapi::$version_number, 'data_license_html' => Settings::get('DATA_LICENSE_URL') ? "<a href='" . Settings::get('DATA_LICENSE_URL') . "'>Data License</a>" : "Data License");
     $response = new OkapiHttpResponse();
     $response->content_type = "text/html; charset=utf-8";
     ob_start();
     include 'signup.tpl.php';
     $response->body = ob_get_clean();
     return $response;
 }