public static function routes_zphp() { if (strtolower(env('APP_ENV', '')) == 'local') { \Route::group(['prefix' => self::URLS_PREFIX], function () { \Route::get('/', ['as' => self::URL_INDEX, 'uses' => function () { return self::page_index(); }]); \Route::get('/entities', ['as' => self::URL_ENTITIES, 'uses' => function () { return self::page_entities(); }]); \Route::post('/entities', ['as' => self::URL_ENTITIES, 'uses' => function () { $message = 'There was an error'; if (isset($_POST['action']) && $_POST['action'] == 'create') { self::_entities_create(); $message = 'Entities where created'; $message .= "<br /><br />"; $message .= "<p style='font-weight: normal; text-align: left;'>Binding Code:</p>"; $message .= "<div style=' background: #fff none repeat scroll 0 0;border: 1px solid #555;border-radius: 5px;box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2);font-size: 14px;font-weight: normal;line-height: 25px;padding: 15px;text-align: left;'>"; foreach (self::$_bind_codes as $code) { $message .= "{$code}<br />"; } $message .= "</div>"; $message .= "<p style='font-weight: normal; text-align: left; padding-top: 10px; color: #F00'>Don't forget to use them in routes.php or other init script</p>"; } if (isset($_POST['action']) && $_POST['action'] == 'delete') { $message = 'Entities where delete'; self::_entities_delete(); } $block = new HTML\HTMLLongTag('div', $message); $block->add_style('text-align', 'center'); $block->add_style('font-weight', 'bold'); $block->add_style('font-size', '14pt'); $block->add_style('padding', '30px 0 0 0'); return self::_prepare_page_html($block, 'Database Tables', \URL::route(self::URL_ENTITIES)); }]); \Route::get('/static/{file}', ['as' => self::URL_STATIC, 'uses' => function ($file) { if (preg_match('#(?i).*\\.css#', $file)) { Navigation::header_content_type('text/css'); } if (preg_match('#(?i).*\\.js#', $file)) { Navigation::header_content_type('text/css'); } $file = str_replace('..', '', $file); $path = dirname(__FILE__) . '/../../_resources/static/' . $file; @($f = fopen($path, 'rb')); if ($f) { @fpassthru($f); @fclose($f); } }]); }); } }
/** * * @return Response * */ public static function render_exception(Exception $ex) { if (trim(env('SHOW_ERRORS', '')) != '1') { $error_url = env('ERROR_URL', ''); if ($error_url == $_SERVER['REQUEST_URI']) { die('Error'); } Navigation::location_go($error_url); } else { if ($ex && $ex instanceof \Symfony\Component\HttpKernel\Exception\HttpException) { $code = $ex->getStatusCode(); } else { $code = 200; } $content = self::_get_exception_html($ex); $content = "<html><head></head><body>{$content}</body></html>"; return Response::create($content, $code); } }
public static function logout($redirect = null) { @session_start(); $_SESSION[self::$_SESSION_VARNAME] = false; Navigation::location_go($redirect ? $redirect : Navigation::get_site_url()); }
protected static function _parse_action($url) { if ($url) { return $url; } if ($url === false) { return 'javascript:void(0)'; } return Navigation::get_current_url(); }