/** * 退出 */ public function action_out() { # 销毁session $this->session()->start()->destroy(); #页面跳转到登录页 $this->redirect(\Core::url('/')); }
/** Builds the form field structure with an optionally supploed schema */ public function form($schema = null) { $form = array(); $form['name'] = $this->name; $form['id'] = $this->name; $form['class'] = $this->name; $form['method'] = 'post'; $form['action'] = Core::url($_SERVER['REQUEST_URI']); $form['enctype'] = 'multipart/form-data'; $form['fields'] = array(); /** Use the provided schema or get a copy of the default */ $s = isset($schema) ? $schema : $this->schema(); $form['fields'][] = array('<fieldset>' => 'New Comment'); $form['fields'][] = array('title' => $s['title']); $form['fields'][] = array('body' => $s['body']); $form['fields'][] = array('</fieldset>' => ''); $form['fields'][] = array('<fieldset>' => 'System Information'); $form['fields'][] = array('cid' => $s['cid']); $form['fields'][] = array('created' => $s['created']); $form['fields'][] = array('updated' => $s['updated']); $form['fields'][] = array('cuid' => $s['cuid']); $form['fields'][] = array('uuid' => $s['uuid']); $form['fields'][] = array('</fieldset>' => ''); return $form; }
protected function nodebug() { $url = Core::url('/opendebugger/logout'); $str = ''; if (isset($_GET['forward']) && $_GET['forward']) { $forward = HttpIO::GET('forward', HttpIO::PARAM_TYPE_URL); $str = '<a href="' . $forward . '">' . $forward . '</a>'; } $view = new View('opendebugger'); $view->str = $str; $view->url = $url; $view->open = false; $view->render(); }
protected function nodebug() { $url = \Core::url()->site('/opendebugger/logout'); echo <<<EOF <!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" xml:lang="zh-CN" lang="zh-CN"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>我不想调试</title> </head> <body> <form method="post" action="{$url}" name="form1"> <input type="submit" name="submit" value="我不想调试" /> </form> </body> </html> EOF; }
public function action_appcache() { \header('Content-Type: text/cache-manifest'); //\readfile(\Core::find_file('data', 'tetris','.manifest')); $list = array(); foreach (\Core::$include_puth as $path) { $dir = $path . 'statics' . \DS; if (\is_dir($dir)) { $this->get_file_list(\strlen($dir), $dir, $list); } } $path = \Core::url('statics/'); $list = \array_map(function ($t) use($path) { return $path . $t; }, $list); echo 'CACHE MANIFEST' . \CRLF; echo \implode(\CRLF, $list); }
/** Builds the form field structure with an */ public function form($schema = null) { $form = array(); $form['name'] = $this->name; $form['id'] = $this->name; $form['class'] = $this->name; $form['method'] = 'post'; $form['action'] = Core::url($_SERVER['REQUEST_URI']); $form['enctype'] = 'multipart/form-data'; $form['fields'] = array(); /** Use the provided schema or get a copy of the default */ $s = isset($schema) ? $schema : $this->schema; /** Edit flag to block the addition of fields to to form conditionally */ $edit = Core::get_args(1) == 'edit' ? true : false; $form['fields'][] = array('<fieldset>' => 'Account Information'); $form['fields'][] = array('username' => $s['username']); $form['fields'][] = array('password' => $s['password']); $form['fields'][] = array('email' => $s['email']); $form['fields'][] = array('</fieldset>' => ''); $form['fields'][] = array('<fieldset>' => 'User Information'); $form['fields'][] = array('prefix' => $s['prefix']); $form['fields'][] = array('first_name' => $s['first_name']); $form['fields'][] = array('middle_name' => $s['middle_name']); $form['fields'][] = array('last_name' => $s['last_name']); $form['fields'][] = array('suffix' => $s['suffix']); $form['fields'][] = array('birthday' => $s['birthday']); $form['fields'][] = array('timezone' => $s['timezone']); $form['fields'][] = array('</fieldset>' => ''); $form['fields'][] = array('<fieldset>' => 'Address Information'); $form['fields'][] = array('address' => $s['address']); $form['fields'][] = array('country' => $s['country']); $form['fields'][] = array('zip' => $s['zip']); $form['fields'][] = array('</fieldset>' => ''); $form['fields'][] = array('<fieldset>' => 'System Information'); $form['fields'][] = array('uid' => $s['uid']); $form['fields'][] = array('created' => $s['created']); $form['fields'][] = array('updated' => $s['updated']); $form['fields'][] = array('cuid' => $s['cuid']); $form['fields'][] = array('uuid' => $s['uuid']); $form['fields'][] = array('</fieldset>' => ''); return $form; }
echo '<font color="#5fd300"><strong>√</strong></font>不存在'; if ($type == 0) { if (is_writable($dir)) { echo ' <font color="#5fd300"><strong>√</strong></font>可写 '; } else { echo ' <font color="red"><strong>×</strong></font>不可写'; } } } echo '</td>'; echo '</tr>'; } ?> <tr> <td colspan="3" class="td1"> 注:安全起见,推荐DATA目录可写入,其它文件夹推荐不可写。若系统不具备相应文件操作权限,在安装过程中系统会提示你手工操作办法。 </td> </tr> </tbody> </table> <div style="padding:20px 0 10px 0;text-align:center;"> <input type="button" value="上一步" onclick="document.location='<?php echo Core::url('install/'); ?> ';" /> <input type="button" class="submit" value="下一步" onclick="document.location='<?php echo Core::url('install/step_2/'); ?> ';" /> </div>
public function action_out() { $this->session()->start()->destroy(); $this->redirect(Core::url('login/')); }
/** * 指定Server执行系统内部调用 * * //指定多个服务器执行 * HttpServer::exec('test/abc',array('192.168.1.11:8080','192.168.1.12:80'),array('a','b','c')); * * //指定一个服务器执行 * HttpServer::exec('test/abc','192.168.1.11:8080'array('a','b','c')); * * @param string $uri * @param array $hosts * @param array $param_arr * @return array */ public static function exec($uri, $hosts, array $param_arr = array()) { $one = false; if (is_string($hosts)) { $hosts = array($hosts); $one = true; } # 是否支持CURL static $curl_supper = null; if (null === $curl_supper) { $curl_supper = function_exists('curl_init'); } if (IS_CLI) { $project_config = Core::config('core.projects' . Core::$project); $script = $project_config['url']; if (is_array($script)) { $script = current($script); } if (isset($project_config['url_admin'])) { $script .= ltrim($project_config['url_admin'], '/'); } if (false === strpos($uri, '://')) { $url_site = Core::config('core.url.site'); if (!$url_site) { throw new Exception(__('your core config $config[\'url\'][\'site\'] is not defined.check config:ext', array(':ext' => EXT))); } $script = $url_site . ltrim($script, '/'); } } else { $script = $_SERVER["SCRIPT_URI"]; } $uri = Core::url($uri); if (false === strpos($uri, '://')) { preg_match('#^(http(?:s)?\\://[^/]+/)#', $script, $m); $uri = $m[1] . ltrim($uri, '/'); } # http://host/uri $uri_arr = explode('/', $uri); $scr_arr = explode('/', $script); $uri_arr[0] = $scr_arr[0]; $uri_arr[2] = $scr_arr[2]; $uri = implode('/', $uri_arr); $time = microtime(1); if ($curl_supper) { # 调用CURL请求 $result = HttpCall::exec_by_curl($hosts, $uri, array('data' => serialize($param_arr))); } else { # 调用socket进行连接 $result = HttpCall::exec_by_socket($hosts, $uri, array('data' => serialize($param_arr))); } # 单条记录 if ($one) { $result = current($result); } if (IS_DEBUG) { Core::debug()->log('system exec time:' . (microtime(1) - $time)); Core::debug()->info($result, 'system exec result'); } return $result; }
public function action_step_4() { # 关闭ob_start Core::close_buffers(true); $this->step = 4; View::set_global('config', self::$config); View::set_global('step', $this->step); $view = new View('admin/install/header'); $view->page_title = $this->page_title; $view->location = $this->location; $view->admin_menu = Core::config('admin/menu/install'); $view->render(true); $view = new View('admin/install/step_4'); $view->render(); $view = new View('admin/install/bottom'); $view->render(true); # 将页面内容输出 flush(); $sqlfile = Core::find_file('data', 'install', 'sql'); if ($sqlfile) { $sql = file_get_contents($sqlfile); $sql = str_replace("\r\n", "\n", $sql); $database = Core::config('admin/core.database'); if (!$database) { $database = 'default'; } $db = Database::instance($database); $this->run_query($db, $sql); } if ($this->lock_install()) { $this->show_js_message('安装成功。'); } else { $this->show_js_message('安装完毕。'); $this->show_js_message('<br><font color="red">请注意:</font>系统无法创建安装锁文件,请在data目录“<font color="blue">' . Core::$project . '/</font>”下创建<font color="red">install.lock</font>文件,以防止再次安装,请手动创建此文件。'); } $this->show_js_message('<br>安全起见,请删除本安装文件:' . __FILE__); $this->show_js_message('<br /><input type="button" value="进入后台" class="submit" onclick="document.location=\'' . Core::url('/') . '\'" /> 用户名:admin,密码:123456'); # 强制结束 exit; }
/** * 返回静态资源URL路径 * * @param string $uri */ public static function url_assets($uri = '') { $url = ltrim($uri, './ '); if (IS_DEBUG & 1) { # 本地调试环境 $url_asstes = Core::url('/assets/devmode/' . Core::$project . '/'); } else { $url_asstes = URL_ASSETS; list($file, $query) = explode('?', $uri . '?', 2); $uri = $file . '?' . (strlen($query) > 0 ? $query . '&' : '') . Core::assets_hash($file); } return $url_asstes . $url; }
/** * Creates a image link. * * echo HTML::image('media/img/logo.png', array('alt' => 'My Company')); * * @param string file name * @param array default attributes * @return string * @uses URL::base * @uses HTML::attributes */ public static function image($file, array $attributes = null, $index = false) { if (strpos($file, '://') === false) { // Add the base URL $file = Core::url()->base($index) . $file; } // Add the image link $attributes['src'] = $file; return '<img' . HTML::attributes($attributes) . ' />'; }
<?php $static_url = Core::url('/statics/skins/default/'); ?> <style type="text/css"> #calendar-div{ position:absolute; right:335px; top:50px; width:160px; height: 176px; background:url(<?php echo $static_url; ?> weather_bg_l.png); text-shadow:1px 1px 0 rgba(0,0,0,0.5); color:rgba(255,255,255,0.9); font-size:1.2em; -webkit-background-size:100% 100%; background-size:100% 100%; } #calendar-date,#calendar-date-chinese{position:absolute;width:154px;height:18px;line-height:16px;overflow:hidden;margin:10px 0 0 6px;text-align:center;white-space:nowrap;} #calendar-date-chinese{margin:148px 0 0 6px;} .calender-num{position:absolute;margin:37px 0 0 25px;} .calender-num span{background-image:url(<?php echo $static_url; ?> weather_nums.png);background-repeat:no-repeat;float:left;width:55px;height:107px;-webkit-background-size:550px 107px;background-size:550px 107px;} .calendar-num-0{background-position:0 0;} .calendar-num-1{background-position:-55px 0;} .calendar-num-2{background-position:-110px 0;}
var groups_form = group_ids.join(','); if ( now_groups_form==groups_form ) { //直接切换显示 MyQEE.$('mytag_main_1').style.display='none'; MyQEE.$('mytag_main_2').style.display=''; MyQEE.$('step_tag_1').className=''; MyQEE.$('step_tag_2').className='hover'; change_zdy_parm(); return ; } _is_run_ajax = true; var ajax = new MyQEE.ajax('<?php echo Core::url('administrator/edit_perm_form/' . $member->id); ?> '); ajax.method = 'GET'; ajax.setVar('group_ids',group_ids); ajax.onError = function() { _is_run_ajax = false; MyQEE.$('step1_loading').style.display='none'; MyQEE.Msg('数据请求失败,请重试。'); } ajax.onCompletion = function() { _is_run_ajax = false; MyQEE.$('step1_loading').style.display='none';
?> onclick="MyQEE.ask_todo('<?php echo Core::url('administrator/delete/' . $item->id); ?> ','您确认要删除此用户?')" /> </td> </tr> <?php } } ?> <tr> <td class="td1" colspan="7"> </td> <td class="td1" align="center"> <input type="button" class="submit" value="创建新用户" onclick="goto('<?php echo Core::url('administrator/add'); ?> ')" /> </td> </tr> </table> <center> <?php echo $pagehtml; ?> </center> <?php } else { ?> <table class="mainTalbe">
var myframe = window.frames['framemain_'+MyQEE.nowFrameId]; try{ if (myframe){ var dom = (myframe.document.compatMode && myframe.document.compatMode=="CSS1Compat")?myframe.document.documentElement:myframe.document.body; if (dom) { var h = Math.max(300,MyQEE.DOM().clientHeight-110,Math.min(dom.scrollHeight,(dom.offsetHeight+20))); MyQEE.$('framemain_'+MyQEE.nowFrameId).style.height = h +'px'; } } }catch(e){} setTimeout('MyQEE.renewHeight()',100); } MyQEE.renewHeight(); window.onresize(); }else{ MyQEE.$('bottomdiv').style.display='none'; MyQEE.$('maindiv').style.margin='5px 3px'; } MyQEE.iniHtml(); </script> <script type="text/javascript" src="<?php echo Core::url('statics/js/tooltip.js'); ?> "></script> </body> </html>
echo __('Password'); ?> " size="12" style="margin-top:9px;padding:6px 10px;width:240px;font-size:16px;height:26px;border-radius:6px;border:1px solid #2270a0;background:rgba(255,255,255,0.8);box-shadow:inset 1px 1px 2px #8e8e8e,0 0 10px #97f4ff;" /> <span id="login_captach_div" style="<?php if (!$show_captcha) { echo 'display:none;"'; } ?> white-space:nowrap;"> <input autocomplete="off" type="text" maxlength="4" name="captcha" placeholder="<?php echo __('Verification code'); ?> " size="4" style="margin-top:9px;padding:6px 10px;width:110px;font-size:16px;height:26px;border-radius:6px;border:1px solid #2270a0;background:rgba(255,255,255,0.8);box-shadow:inset 1px 1px 2px #8e8e8e,0 0 10px #97f4ff;" /> <img src="<?php echo Core::url('captcha/126x39.png?timeline=' . microtime(1)); ?> " style="border-radius:6px;cursor:pointer;" title="点击更换验证码" onclick="this.src=this.src.split('?')[0]+'?timeline='+new Date().getTime();" /> </span> <button type="submit" class="btn btn-large btn btn-danger"><i class="icon-check icon-white"></i> <?php echo __('Login'); ?> </button> <?php if (!$can_not_login) { ?> </form> <?php }
/** * 页面跳转 * * @param string redirect location * @param integer status code: 301, 302, etc * @return void * @uses Core_url::site * @uses Request::send_headers */ public static function redirect($url, $code = 302) { if (\strpos('://', $url) !== false) { $url = \Core::url($url); } static::$status = $code; static::$headers['Location'] = $url; static::send_headers(); exit; }
/** * Creates a image form input. * * echo Form::image(null, null, array('src' => 'media/img/login.png')); * * @param string input name * @param string input value * @param array html attributes * @return string * @uses Form::input */ public static function image($name, $value, array $attributes = null) { if (!empty($attributes['src'])) { if (strpos($attributes['src'], '://') === false) { $attributes['src'] = Core::url($attributes['src']); } } $attributes['type'] = 'image'; return Form::input($name, $value, $attributes); }
<input type="button" value="启动服务" onclick="MyQEE.run_ajax('<?php echo Core::url('websocket/start'); ?> ');" /> <input type="button" value="停止服务" onclick="MyQEE.ask_todo('<?php echo Core::url('websocket/stop'); ?> ','您确实要停止服务?')" /> <input type="button" value="重启服务" onclick="MyQEE.ask_todo('<?php echo Core::url('websocket/restart'); ?> ','您确实要重启服务?')" /> <style> #log { width: 440px; height: 200px; border: 1px solid #7F9DB9; overflow: auto; } #msg { width: 330px; } </style> <script> var socket; function init(){ var host = "ws://localhost:11101";
onclick="MyQEE.ask_todo('<?php echo Core::url('administrator/group/delete/' . $item->id); ?> ','您确认要删除此管理组?')" /> </td> </tr> <?php } } ?> <tr> <td class="td1" colspan="3"> </td> <td class="td1" align="center"> <input type="button" class="submit" value="添加管理组"<?php if ($group_manager) { echo ' disabled="disabled"'; } ?> onclick="goto('<?php echo Core::url('administrator/group/add/'); ?> ')" /> </td> </tr> </table> <center> <?php echo $pagehtml; ?> </center>
/** Builds the form field structure with an optionally supploed schema */ public function form($schema = null) { $form = array(); $form['name'] = $this->name; $form['id'] = $this->name; $form['class'] = $this->name; $form['method'] = 'post'; $form['action'] = Core::url($_SERVER['REQUEST_URI']); $form['enctype'] = 'multipart/form-data'; $form['fields'] = array(); /** Use the provided schema or get a copy of the default */ $s = isset($schema) ? $schema : $this->schema(); /** Modify the schema to include the passive support fields */ $s['groups'] = array('type' => 'text', 'label' => 'Groups', 'help' => 'The groups this content belongs to.', 'foreign' => 'group'); $s['alias'] = array('type' => 'text', 'label' => 'Alias', 'help' => 'The alias for this content.', 'foreign' => 'alias'); $s['attachments'] = array('type' => 'text', 'label' => 'Attachments', 'help' => 'The attachments that belong to this content belongs.', 'foreign' => 'file'); $s['tags'] = array('type' => 'text', 'label' => 'Tags', 'help' => 'The tags that describe this content.', 'foreign' => 'tag'); /** Structure the form */ $form['fields'][] = array('<fieldset>' => 'Content Information'); $form['fields'][] = array('title' => $s['title']); $form['fields'][] = array('teaser' => $s['teaser']); $form['fields'][] = array('body' => $s['body']); $form['fields'][] = array('start_date' => $s['start_date']); $form['fields'][] = array('end_date' => $s['end_date']); $form['fields'][] = array('status' => $s['status']); $form['fields'][] = array('sticky' => $s['sticky']); $form['fields'][] = array('</fieldset>' => ''); $form['fields'][] = array('<fieldset>' => 'Related Information'); $form['fields'][] = array('alias' => $s['alias']); $form['fields'][] = array('attachments' => $s['attachments']); $form['fields'][] = array('groups' => $s['groups']); $form['fields'][] = array('tags' => $s['tags']); $form['fields'][] = array('</fieldset>' => ''); $form['fields'][] = array('<fieldset>' => 'System Information'); $form['fields'][] = array('cid' => $s['cid']); $form['fields'][] = array('created' => $s['created']); $form['fields'][] = array('updated' => $s['updated']); $form['fields'][] = array('cuid' => $s['cuid']); $form['fields'][] = array('uuid' => $s['uuid']); $form['fields'][] = array('</fieldset>' => ''); return $form; }
/** * 返回静态资源URL路径 * * @param string $uri */ public static function url_assets($uri = '') { $url = ltrim($uri, './ '); if (IS_DEBUG & 1) { # 本地调试环境 $url_assets = Core::url('/assets-dev/'); } else { list($file, $query) = explode('?', $url, 2); $www_file = DIR_ASSETS . $file; if (is_file($www_file)) { $url_assets = Core::config('url.assets'); $asstes_path = ''; } else { $asstes_path = 'p-' . Core::$project . '/' . (IS_ADMIN_MODE ? '~admin/' : ''); $url_assets = URL_ASSETS . $asstes_path; } # 自动获取min文件 if (substr($file, -3) === '.js') { $tmp_filename = substr($file, 0, -3) . '.min.js'; $min_file = DIR_ASSETS . $asstes_path . $tmp_filename; } else { if (substr($file, -4) === '.css') { $tmp_filename = substr($file, 0, -4) . '.min.css'; $min_file = DIR_ASSETS . $asstes_path . $tmp_filename; } else { $min_file = $tmp_filename = null; } } if ($min_file && is_file($min_file)) { if (strlen($query) > 0) { $url = $tmp_filename . '?' . $query; } else { $url = $tmp_filename; } } // $uri = $file . '?' . (strlen($query)>0?$query.'&':'') . Core::assets_hash($file); } return $url_assets . $url; }
.profilerdiv table.profiler tr.profiler_mark td.profiler_current { background: #eddecc; } .profilerdiv table.profiler tr.profiler_mark td.profiler_min { background: #d2f1cb; } .profilerdiv table.profiler tr.profiler_mark td.profiler_max { background: #ead3cb; } .profilerdiv table.profiler tr.profiler_mark td.profiler_average { background: #ddd; } .profilerdiv table.profiler tr.profiler_mark td.profiler_total { background: #d0e3f0; } .profilerdiv table.profiler tr.profiler_mark td.profiler_otherdata { background: #e6e6e6; } .profilerdiv table.profiler tr.profiler_time td { border-bottom: 0; } .profilerdiv table.profiler tr.profiler_memory td { border-top: none; } .profilerdiv table.profiler tr.final th.profiler_name { float:none;background: #222; color: #fff; } .profilerdiv tbody.hover td{background:#fffacd;} </style><div style="text-align:left;z-index:100000;position:fixed;_position:absolute;width:100%;bottom:0px;left:0;height:26px;background:#000;filter:alpha(opacity=80);opacity:0.8;"><div style="padding:5px 14px;color:#fff;text-decoration:none;font-size:12px;line-height:15px;"><a href="#onlineprofiler" style="color:#fff;text-decoration:none;font-size:12px;line-height:15px;" >调试:</a><?php echo Form::checkbox(null, '1', Core::debug()->profiler('sql')->is_open(), array('id' => '_profiler_sql')), '<label for="_profiler_sql">SQL:Explain</label> ', Form::checkbox(null, '1', Core::debug()->profiler('nocached')->is_open(), array('id' => '_profiler_nocached')), '<label for="_profiler_nocached">显示无缓存内容</label> ', Form::checkbox(null, '1', Core::debug()->profiler('output')->is_open(), array('id' => '_profiler_output')), '<label for="_profiler_output">显示模板变量</label> ', Form::checkbox(null, '1', Core::debug()->profiler('filelist')->is_open(), array('id' => '_profiler_filelist')), '<label for="_profiler_filelist">显示加载文件</label> ', Form::checkbox(null, '1', Core::debug()->profiler('xhprof')->is_open(), array('id' => '_profiler_xhprof')), '<label for="_profiler_xhprof">开启Xhprof</label> '; ?> <input type="button" value="GO" onclick="profilerdiv_reload()"/> <input type="button" value="网格" onclick="if(document.body.style.backgroundImage==''){document.body.style.backgroundImage='url(<?php echo Core::url('statics/'); ?> images/tape.gif)';}else{document.body.style.backgroundImage='';}this.blur();" /></input></div></div> <script type="text/javascript"> function profilerdiv_reload(){ var s=document.location.search.substr(1); var s2=s.split('&'); var newsearch = '?'; for (var i=0 ;i< s2.length;i++){ var item = s2[i].split('='); var n=item[0]; var v=item[1]; if (n=='debug'){ v = document.getElementById('_profiler_sql').checked?'sql':''; v += document.getElementById('_profiler_nocached').checked?(v?'|':'')+'nocached':''; v += document.getElementById('_profiler_output').checked?(v?'|':'')+'output':'';
public static function url($class, $havedir = false, $haveext = false) { $url = 'api/' . DOCS_PROJECT . '/'; // . ($havedir ? '' : '/' . Docs::_class2url( $class )) . '/' ; if ($havedir) { list($dir) = explode('/', $class); } else { $dir = Docs::_class2url($class); $url .= $dir . '/'; } if ($dir == 'classes') { $ext = '.class' . EXT; $class = str_replace('_', '/', $class); } elseif ($dir == 'models') { $ext = '.model' . EXT; $class = str_replace('_', '/', $class); } elseif ($dir == 'shell') { $ext = '.shell' . EXT; $class = strtolower($class); } elseif ($dir == 'admin') { $ext = '.admin' . EXT; $class = strtolower($class); } elseif ($dir == 'controllers') { $ext = '.controller' . EXT; $class = strtolower($class); } elseif ($dir == 'config') { $ext = '.config' . EXT; } elseif ($dir == 'i18n') { $ext = '.lang'; } if ($haveext) { $url .= $class; } else { $url .= $class . $ext; } return Core::url($url); }
/** * 检查权限,将没有权限的菜单移出 * * @param array $admin_menu */ protected function header_check_perm(&$admin_menu) { $perm = $this->session()->member()->perm(); $havearr = false; foreach ($admin_menu as $k => &$v) { if (is_array($v)) { if (isset($v['perm'])) { $perm_key = $v['perm']; unset($v['perm']); if (false !== strpos($perm_key, '||')) { $perm_key = explode('||', $perm_key); $have_perm = false; foreach ($perm_key as $p) { if ($perm->is_own($p)) { $have_perm = true; continue; } } if (!$have_perm) { unset($admin_menu[$k]); continue; } } elseif (false !== strpos($perm_key, '&&')) { $perm_key = explode('&&', $perm_key); foreach ($perm_key as $p) { if (!$perm->is_own($p)) { unset($admin_menu[$k]); continue 2; } } } else { # 检查权限 if (!$perm->is_own($perm_key)) { unset($admin_menu[$k]); continue; } } } if (false === $this->header_check_perm($v)) { unset($admin_menu[$k]); } else { $havearr = true; } } elseif ($k == 'href') { if ($v != '#' && !preg_match('#^[a-z0-9]+://.*$#', $v)) { $v = (string) Core::url($v); } } } if (false == $havearr && (!isset($admin_menu['href']) || $admin_menu['href'] == '#')) { return false; } }
/** * Create a URL from the current request. This is a shortcut for: * * echo URL::site($this->request->uri($params), $protocol); * * @param array $protocol URI parameters * @param mixed $protocol protocol string or boolean, adds protocol and domain * @return string * @uses URL::site * @uses HttpIO::uri */ public static function url(array $params = null, $protocol = null) { // Create a URI with the current route and convert it to a URL return Core::url(HttpIO::uri($params), $protocol); }
?> <div style="padding:18px 0 0 0;"> <b><?php echo __('Error NO:'); ?> </b><input onclick="this.select();" style="border:none;width:180px;background:transparent;" readonly="readonly" value="<?php echo $error_no; ?> " /> <div style="color:#bbb;"><?php echo __('The error has been logged and can use this number to report the error message to the system administrator.'); ?> </div> <br /> <a href="javascript:history.go(-1);"><?php echo __('Back'); ?> </a> | <a href="<?php echo Core::url('/'); ?> "><?php echo __('Goto Home Page'); ?> </a> </div> <?php } ?> </div> </body> </html>
/** * Generates the full URL for a certain page. * * @param integer page number * @return string page URL */ public function url($page = 1) { // Clean the page number $page = \max(1, (int) $page); // No page number in URLs to first page if ($page === 1) { $page = null; } switch ($this->config['current_page']['source']) { case 'query_string': return \Core::url(\HttpIO::$uri) . \HttpIO::query(array($this->config['current_page']['key'] => $page)); case 'route': return \Core::url(Core::route_url(array($this->config['current_page']['key'] => $page))) . \HttpIO::query(); default: $tmparr = array(); if (\is_numeric($this->config['current_page']['key'])) { for ($i = 0; $i < $this->config['current_page']['key']; $i++) { $tmparr[$i] = (string) \HttpIO::$params['arguments'][$i]; } } $tmparr[$this->config['current_page']['key']] = $page; return \Core::url(\HttpIO::uri($tmparr)) . \HttpIO::query(); } return '#'; }
?> </title> <link rel="stylesheet" type="text/css" href="<?php echo Core::url('statics/css/global.css'); ?> " /> <link rel="stylesheet" type="text/css" href="<?php echo Core::url('statics/css/install.css'); ?> " /> </head> <body> <div id="headerDiv"> <div class="mainWidth"> <div id="logoDiv"><img src="<?php echo Core::url('statics/images/install_logo.png'); ?> " /></div> <div id="titleText"><?php echo $config['title']; ?> </div> <div id="topRightDiv"><?php echo $config['desc']; ?> </div> </div> </div> <div class="mainWidth" style="padding:20px 0;"> <?php