private function renderException(\Exception $e) { if ($e instanceof RedirectException) { return response()->withRedirect($e->url, $e->statusCode); } alert($e->getMessage(), 'danger'); $response = response(document()); if ($e instanceof ForbiddenHttpException) { $response->withStatus(403); } elseif ($e instanceof NotFoundHttpException) { $response->withStatus(404); } return $response; }
public function addForm() { $themes = glob(DIR_THEME . '/*'); $themeNames = []; foreach ($themes as $theme) { $themeData = parse_json_file($theme . '/composer.json'); $theme = str_replace(DIR_THEME . '/', '', $theme); $themeNames[$theme] = $themeData['extra']['name']; } $data = []; $data['content'] = view('sites/form', ['title' => t('new_site'), 'name' => '', 'locales' => substr(app('request')->getPreferredLanguage(app('translator')->installedPackages), 0, 2), 'domains' => app('request')->server['HTTP_HOST'], 'use_alias_as_path' => 0, 'maintenance_mode' => 0, 'need_cache' => 0, 'template' => HTML::select('theme', '', $themeNames, 'class="form-control"'), 'site' => 'new', 'sites' => str_replace(DIR_SITE, '', glob(DIR_SITE . 's*'))]); $data['sidebar_right'] = HTML::saveButton() . HTML::mastercodeInput(); $data['sidebar_left'] = ''; $data['form_url'] = 'admin/sites/add'; $data['meta_title'] = t('site_creation'); $data['breadcrumbs'] = [['url' => '?route=config', 'title' => t('settings')], ['url' => '?route=config/sites', 'title' => t('site_list')], ['title' => t('site_creation')]]; $d = document($data); return $d; }
include_once dirname(__FILE__) . "/../classes/Json.class.php"; $userinfo = array(); $userinfo['uid'] = 10086; $userinfo['name'] = "大帅"; $userinfo['age'] = 18; $userinfo['sex'] = 1; $grade = array(1, 2, 3, 4, 5, 6); $info = array(); $info['up'] = 1; $info['down'] = 1; $comment_data = array(); $comment_data['uid'] = 10086; $comment_data['name'] = "大帅"; $comments = array($comment_data, $comment_data); $pinfo = array(); $pinfo['id'] = 2; $pinfo['uid'] = '10086'; $pinfo['rid'] = '10086'; $pinfo['money'] = 100.25; $pinfo['key'] = 'tokendddsxsedfs115'; $pinfo['alias'] = 'techer'; $pinfo['aliastype'] = 'yousi.com'; $pinfo['date'] = '2015-11-12 15:17:23'; $pinfo['clientdate'] = 1446450068; $pinfo['info'] = $info; $pinfo['grade'] = $grade; $pinfo['comments'] = $comments; $pinfo['userinfo'] = $userinfo; /**测试地址 Example.php?document=truxish2114558de*/ document($pinfo, 'PushInfoData'); Json::echoJson($pinfo);
function adm($rs) { global $iCMS; $rs->code = stripslashes_deep(unserialize($rs->code)); $file = FS::path(iPATH . $iCMS->config['htmldir'] . '/!adm') . '/'; FS::mkdir($file); switch ($rs->load) { case "js": $file .= "{$rs->style}-{$rs->id}.js"; $html = "/*\n广告:{$rs->varname}\n标签:<!--{iCMS:advertise name=\"{$rs->varname}\"}-->\n*/\n"; if ($rs->status) { $html .= "var timestamp = Date.parse(new Date());\n"; $html .= "var startime = Date.parse(new Date(\"" . get_date($rs->starttime, 'Y/m/d') . "\"));\n"; $rs->endtime && ($html .= "var endtime = Date.parse(new Date(\"" . get_date($rs->endtime, 'Y/m/d') . "\"));\n"); $html .= "if(timestamp>=startime"; $rs->endtime && ($html .= "||timestamp<endtime"); $html .= "){\n"; $html .= document(getadvhtml($rs->style, $rs->code)); $html .= "}"; } break; case "iframe": $file .= "{$rs->style}-{$rs->id}.html"; $html = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title><script type="text/javascript">function resizeFrame(){try{ var frames=parent.document.documentElement.getElementsByTagName("iframe"); for(var i=0;i<frames.length;i++){ frames[i].style.height=document.body.scrollHeight+"px"; var topPos=location.href.indexOf("#top");if(topPos>0){location.href=location.href.substring(0,topPos)+"#top1"}break;}}}catch(e){return;}}</script></head><body>' . getadvhtml($rs->style, $rs->code) . '</body><script type="text/javascript">resizeFrame();</scrip</html>'; break; case "shtml": $file .= "{$rs->style}-{$rs->id}.shtml"; $html = getadvhtml($rs->style, $rs->code); break; } $rs->src = $file; $iCMS->setCache('system/adm/' . md5($rs->varname), $rs, 0); if ($fn) { return $file; } $rs->load && FS::write($file, $html); }
$view->with('sidebar', document('contents')); }); /** * Handle the documentation homepage. * * This page contains the "introduction" to Laravel. */ Route::get('(:bundle)', function () { return View::make('docs::page')->with('content', document('home')); }); /** * Handle documentation routes for sections and pages. * * @param string $section * @param string $page * @return mixed */ Route::get('(:bundle)/(:any)/(:any?)', function ($section, $page = null) { $file = rtrim(implode('/', func_get_args()), '/'); // If no page was specified, but a "home" page exists for the section, // we'll set the file to the home page so that the proper page is // displayed back out to the client for the requested doc page. if (is_null($page) and document_exists($file . '/home')) { $file .= '/home'; } if (document_exists($file)) { return View::make('docs::page')->with('content', document($file)); } else { return Response::error('404'); } });
function document_list() { return document("", "kd_doc"); }
public function edit() { $d = document(['content' => view('user/form', ['autologin' => app('user')->autologin]), 'sidebar_left' => '', 'sidebar_right' => HTML::saveButton(DIR_APP . '/config.php') . HTML::mastercodeInput(), 'form_url' => 'admin/user/update', 'meta_title' => t('module_profile'), 'breadcrumbs' => [['url' => 'admin/config', 'title' => t('settings')], ['title' => t('module_profile')]]]); return $d; }
public function adminPages() { $d = document(['content' => '<p>Pages list</p> <p><a href="admin">Dashboard</a></p>']); return $d; }
}); /** * Handle the documentation homepage. * * This page contains the "introduction" to Laravel. */ Route::get('(:bundle)', function () { return View::make('rest_service_api::page')->with('content', document('home')); }); /** * Handle documentation routes for sections and pages. * * @param string $section * @param string $page * @return mixed */ Route::get('(:bundle)/(:any)/(:any?)', function ($section, $page = null) { $file = rtrim(implode('/', func_get_args()), '/'); // If no page was specified, but a "home" page exists for the section, // we'll set the file to the home page so that the proper page is // display back out to the client for the requested doc page. if (is_null($page) and document_exists($file . '/home')) { $file .= '/home'; } if (document_exists($file)) { return View::make('rest_service_api::page')->with('content', document($file)); } else { return Response::error('404'); } }); }
<?php include_once dirname(__FILE__) . "/data.api.php"; include_once dirname(__FILE__) . "/../classes/Json.class.php"; $city1 = array(); $city1['id'] = 1; $city1['name'] = "泉州市"; $city2 = array(); $city2['id'] = 2; $city2['name'] = "上海市"; $citylist[] = $city1; $citylist[] = $city2; /**测试地址 Example.php?document=truxish2114558de*/ document('GetCityList', $citylist); Json::echoJson($citylist);
<?php include_once dirname(__FILE__) . "/data.api.php"; include_once dirname(__FILE__) . "/../classes/Json.class.php"; $city1 = array(); $city1['id'] = 1; $city1['name'] = "泉州市"; $city2 = array(); $city2['id'] = 2; $city2['name'] = "上海市"; $citylist[] = $city1; $citylist[] = $city2; /**测试地址 Example.php?document=truxish2114558de*/ document($citylist, 'GetCityList'); Json::echoJson($citylist);
include_once dirname(__FILE__) . "/../classes/Json.class.php"; $userinfo = array(); $userinfo['uid'] = 10086; $userinfo['name'] = "大帅"; $userinfo['age'] = 18; $userinfo['sex'] = 1; $grade = array(1, 2, 3, 4, 5, 6); $info = array(); $info['up'] = 1; $info['down'] = 1; $comment_data = array(); $comment_data['uid'] = 10086; $comment_data['name'] = "大帅"; $comments = array($comment_data, $comment_data); $pinfo = array(); $pinfo['id'] = 2; $pinfo['uid'] = '10086'; $pinfo['rid'] = '10086'; $pinfo['money'] = 100.25; $pinfo['key'] = 'tokendddsxsedfs115'; $pinfo['alias'] = 'techer'; $pinfo['aliastype'] = 'yousi.com'; $pinfo['date'] = '2015-11-12 15:17:23'; $pinfo['clientdate'] = 1446450068; $pinfo['info'] = $info; $pinfo['grade'] = $grade; $pinfo['comments'] = $comments; $pinfo['userinfo'] = $userinfo; /**测试地址 Example.php?document=truxish2114558de*/ document('PushInfoData', $pinfo); Json::echoJson($pinfo);
function CreateAdvJs($id) { global $iCMS; $rs = $iCMS->db->getRow("SELECT * FROM `#iCMS@__advertise` WHERE `id`='{$id}'"); $file = "cache/{$rs->style}-id-{$rs->id}.js"; $rs->code = stripslashes_deep(unserialize($rs->code)); $html = "/*\n{$rs->varname}\n标签:<!--{iCMS:advertise name=\"{$rs->varname}\"}-->\n*/\n"; if ($rs->status) { $html .= "var timestamp = Date.parse(new Date());\n"; $html .= "var startime = Date.parse(new Date(\"" . get_date($rs->starttime, 'Y/m/d') . "\"));\n"; $rs->endtime && ($html .= "var endtime = Date.parse(new Date(\"" . get_date($rs->endtime, 'Y/m/d') . "\"));\n"); $html .= "if(timestamp>=startime"; $rs->endtime && ($html .= "||timestamp<endtime"); $html .= "){\n"; $html .= document(getadvhtml($rs->style, $rs->code)); $html .= "}"; } writefile(iPATH . $file, $html); }