/** * 启动系统,完成系统的一些初始化设置 * * @return bool */ public static function boot() { static $boot = false; //boot函数只能运行一次 if ($boot) { return true; } //mark zotop::start('zotop'); //缓存开始 ob_start(); //注册加载函数 spl_autoload_register(array('zotop', 'autoload')); //设置系统事件 zotop::add('system.boot', array('application', 'init')); //运行时 zotop::add('system.route', array('router', 'init')); zotop::add('system.route', array('router', 'execute')); zotop::add('system.404', array('application', 'show404')); zotop::add('system.run', array('application', 'run')); zotop::add('system.render', array('application', 'render')); zotop::add('system.shutdown', array('zotop', 'shutdown')); zotop::add('system.reboot', array('runtime', 'reboot')); zotop::add('system.reboot', array('application', 'reboot')); // Sanitize all request variables $_GET = zotop::sanitize($_GET); $_POST = zotop::sanitize($_POST); $_COOKIE = zotop::sanitize($_COOKIE); //boot $boot = true; }
public function onDefault() { $site = array(); $site['name'] = zotop::config('zotop.site.name'); $site['totalsize'] = zotop::config('zotop.ftp.size'); $site['totalsize'] = (int) $site['totalsize'] == 0 ? '--' : format::byte($site['totalsize']); $database = array(); $database['size'] = zotop::db()->size(); $database['size'] = format::byte($database['size']); $page['title'] = '控制中心'; $page['css'][] = url::module() . '/admin/css/main.css'; zotop::add('zotop.main.main', array(&$this, 'notepad')); zotop::add('zotop.main.main', array(&$this, 'mylog')); page::header($page); page::top(); page::navbar($this->navbar(), 'main'); page::add(''); page::add('<div id="user" class="clearfix">'); page::add(' <div id="userface"><span class="image">' . html::image(zotop::user('image')) . '</span></div>'); page::add(' <div id="userinfo">'); page::add(' <h2 id="welcome">欢迎您,' . zotop::user('name') . ' <span id="sign">' . zotop::user('sign') . '</span></h2>'); page::add(' <div id="login">登录时间:' . time::format(zotop::user('logintime')) . ' 登录次数:' . zotop::user('loginnum') . ' 登录IP:' . zotop::user('loginip') . '</div>'); //加载hook zotop::run('zotop.main.action'); page::add(''); page::add('</div>'); page::add('<div class="grid-m-s">'); page::add('<div class="col-main">'); page::add('<div class="col-main-inner">'); zotop::run('zotop.main.main'); page::add('</div>'); page::add('</div>'); page::add('<div class="col-sub">'); zotop::run('zotop.main.sub'); block::header(array('title' => '网站信息', 'action' => '<a class="more" href="' . zotop::url('zotop/info/site') . '">详细</a>')); echo '<table class="table">'; echo '<tr><td class="w80">网站名称:</td><td>' . $site['name'] . '</td></tr>'; echo '<tr><td class="w80">空间占用:</td><td>' . $site['totalsize'] . '</td></tr>'; echo '<tr><td class="w80">已上传文件:</td><td></td></tr>'; echo '<tr><td class="w80">数据库大小:</td><td>' . $database['size'] . '</td></tr>'; echo '</table>'; block::footer(); block::header(array('title' => '系统信息', 'action' => '<a class="more" href="' . zotop::url('zotop/main/system') . '">详细</a>')); echo '<table class="table">'; echo '<tr><td class="w80">程序版本:</td><td>' . zotop::config('zotop.version') . '</td></tr>'; echo '<tr><td class="w80">程序设计:</td><td>' . zotop::config('zotop.author') . '</td></tr>'; echo '<tr><td class="w80">程序开发:</td><td>' . zotop::config('zotop.authors') . '</td></tr>'; echo '<tr><td class="w80">官方网站:</td><td><a href="' . zotop::config('zotop.homepage') . '" target="_blank">' . zotop::config('zotop.homepage') . '</a></td></tr>'; echo '<tr><td class="w80">安装时间:</td><td>' . zotop::config('zotop.install') . '</td></tr>'; echo '</table>'; block::footer(); page::add('</div>'); page::add('</div>'); page::bottom('<span class="zotop-tip">上次登录时间:' . time::format(zotop::user('logintime')) . '</span>'); page::footer(); }
/** * 启动系统,完成系统的一些初始化设置 * * @return bool */ public static function boot() { static $boot = false; //boot函数只能运行一次 if ($boot) { return true; } zotop::mark('system.begin'); //缓存开始 ob_start(); //注册加载函数 spl_autoload_register(array('zotop', 'autoload')); //设置系统事件 zotop::add('system.boot', array('application', 'boot')); zotop::add('system.route', array('router', 'init')); zotop::add('system.route', array('router', 'execute')); zotop::add('system.404', array('application', 'show404')); zotop::add('system.run', array('application', 'run')); zotop::add('system.render', array('application', 'render')); zotop::add('system.shutdown', array('zotop', 'shutdown')); }
$html[] = '$(function(){'; $html[] = ' $("form").submit(function(){'; $html[] = ' $("textarea[name=+' . $attrs['name'] . '+]").val(editor.getCode());'; $html[] = ' });'; $html[] = '})'; $html[] = '</script>'; return implode("\n", $html); } field::set('templateeditor', templateeditor); function templateeditor($attrs) { return codemirror($attrs); } } zotop::add('system.main.action', 'msg_unread'); zotop::add('system.useraction', 'msg_useraction'); function msg_unread() { echo '<div>短消息:<a href="#">未读 3条</a> <a href="#">待处理 5条</a></div>'; } function msg_useraction() { ?> <span id="msg"> <a href="<?php echo zotop::url('msg/list'); ?> " target="mainIframe">短消息</a> <span id="msg-unread"> <a href="<?php echo zotop::url('msg/list/unread');
<?php //����Ĭ�ϵ�uri zotop::add('zotop.uri', 'site_default_uri'); function site_default_uri($uri) { if (empty($uri)) { return 'site'; } }
<?php zotop::add('zotop.index.navbar', 'member_nav'); function member_nav() { echo '<li><a href="' . zotop::url('member') . '" target="mainIframe"><span>会员管理</span></a></li>'; }
<?php zotop::add('blog.side', 'blog_side'); function blog_side($blog = '') { box::header(array('title' => '精彩评论', 'action' => '<a class="dialog" href="' . zotop::url('comment/add/blog/' . $blog->id) . '">发表评论</a>|<a class="more" href="' . zotop::url('comment/list') . '">更多</a>')); echo '<div style="height:200px;"></div>'; box::footer(); }
<?php //为主导航增加内容管理功能 zotop::add('system.navbar', 'system_navabr_content'); function system_navabr_content() { ?> <li><a href="javascript:void(0);" onclick="top.go('<?php echo zotop::url('content/index/side'); ?> ','<?php echo zotop::url('content/index/index'); ?> ')"><span>内容管理</span></a></li> <?php } //link 字段 /* zotop::add('system.ready','field_linkurl'); function field_linkurl() { field::set('link','linkurl'); function linkurl($attrs) { return field::text($attrs).' <span style="white-space:nowrap;"><input type="checkbox" name="link" id="linkurl" value=""/> <label for="linkurl">'.zotop::t('使用转向链接').'</label></span>'; } } */
<?php zotop::add('system.ready', 'field_codemirror'); function field_codemirror() { field::set('code', 'codemirror'); function codemirror($attrs) { $url = zotop::module('codemirror', 'url'); $options = new stdClass(); $options->path = $url . '/codemirror/js/'; $options->parserfile = array('parsexml.js'); $options->stylesheet = array($url . '/codemirror/css/xmlcolors.css'); $options->height = is_numeric($attrs['height']) ? $attrs['height'] . 'px' : $attrs['height']; $options->width = is_numeric($attrs['width']) ? $width . 'px' : $attrs['width']; $options->continuousScanning = 500; $options->autoMatchParens = true; if ($attrs['linenumbers'] !== false) { $options->lineNumbers = true; $options->textWrapping = false; } if ($attrs['tabmode'] == '') { $options->tabMode = 'shift'; } $html = array(); $html[] = html::script($url . '/codemirror/js/codemirror.js'); $html[] = html::stylesheet($url . '/codemirror/css/codemirror.css'); $html[] = ' ' . field::textarea($attrs); $html[] = '<script type="text/javascript">'; $html[] = ' var editor = CodeMirror.fromTextArea("' . $attrs['name'] . '", ' . json_encode($options) . ');'; $html[] = '$(function(){';
<?php zotop::add('system.ready', 'field_keywords'); function field_keywords() { field::set('keyword', 'site_keywords'); function site_keywords($attrs) { //$html[] = html::script('$common/js/zotop.keywords.js'); $html[] = '<div class="field-wrapper clearfix">'; $html[] = ' ' . field::text($attrs); $html[] = ' <span class="field-handle">'; $html[] = ' <a class="setkeywords" style="display:inline-block;" valueto="' . $attrs['name'] . '" title="' . zotop::t('常用关键词') . '"><span class="zotop-icon zotop-icon-keywords"></span></a>'; $html[] = ' </span>'; $html[] = '</div>'; return implode("\n", $html); } }
<?php zotop::add('zotop.main.side', 'notepad'); function notepad() { block::header(array('title' => '记事本', 'action' => '<a class="dialog" href="' . zotop::url('zotop/notepad/add') . '">新建记事</a>|<a class="more" href="' . zotop::url('zotop/notepad') . '">更多</a>')); echo '<div style="height:200px;"></div>'; block::footer(); }
<?php zotop::add('system.ready', 'field_xheditor'); function field_xheditor() { field::set('editor', 'xheditor_rc1'); function xheditor_rc1($attrs) { $attrs['class'] = isset($attrs['class']) ? 'editor ' . $attrs['class'] : 'editor'; $tools = array('image' => '<a href="' . zotop::url('system/image/upload') . '" class="button editor-insert" name="' . $attrs['name'] . '"><span class="zotop-icon zotop-icon-imageuploader button-icon"></span><span class="button-text">插入图片</span></a>', 'file' => '<a href="' . zotop::url('system/file/upload') . '" class="button editor-insert" name="' . $attrs['name'] . '"><span class="zotop-icon zotop-icon-fileuploader button-icon"></span><span class="button-text">插入文件</span></a>', 'template' => '<a href="' . zotop::url('system/file/upload') . '" class="button editor-insert" name="' . $attrs['name'] . '"><span class="zotop-icon zotop-icon-template button-icon"></span><span class="button-text">插入模板</span></a>'); $tools = zotop::filter('editor.tools', $tools); $tools = arr::take('tools', $attrs) === false ? array() : $tools; $url = zotop::module('xheditor', 'url'); $html[] = html::script($url . '/editor/xheditor-zh-cn.min.js'); $html[] = html::script($url . '/common/global.js'); if (is_array($tools) && !empty($tools)) { $html[] = '<div class="field-toolbar">'; foreach ($tools as $tool) { $html[] = ' ' . $tool; } $html[] = '</div>'; } $html[] = ' ' . field::textarea($attrs); return implode("\n", $html); } }
<?php zotop::add('zotop.main.action', 'content'); zotop::add('zotop.index.navbar', 'navbar_content'); function content() { echo '<div>内容:<a href="#">待审核 3条</a> <a href="#">垃圾箱 5条</a></div>'; } function navbar_content() { echo '<li><a href="' . zotop::url('content') . '" target="mainIframe"><span>内容管理</span></a></li>'; }
function system_side_tool_database() { echo '<li><a href="' . zotop::url('database/manage/bakup') . '" target="mainIframe">数据库备份及还原</a></li>'; } zotop::add('zotop.main.action', 'content'); zotop::add('zotop.index.navbar', 'navbar_content'); function content() { echo '<div>内容:<a href="#">待审核 3条</a> <a href="#">垃圾箱 5条</a></div>'; } function navbar_content() { echo '<li><a href="' . zotop::url('content') . '" target="mainIframe"><span>内容管理</span></a></li>'; } zotop::add('zotop.main.action', 'msg_unread'); zotop::add('zotop.index.useraction', 'msg_useraction'); function msg_unread() { echo '<div>短消息:<a href="#">未读 3条</a> <a href="#">待处理 5条</a></div>'; } function msg_useraction() { ?> <span id="msg"> <a href="<?php echo zotop::url('msg/list'); ?> " target="mainIframe">短消息</a> <span id="msg-unread"> <a href="<?php echo zotop::url('msg/list/unread');
{ box::header(array('title' => '记事本', 'action' => '<a class="dialog" href="' . zotop::url('system/notepad/add') . '">新建记事</a>|<a class="more" href="' . zotop::url('system/notepad') . '">更多</a>')); echo '<div style="height:200px;"></div>'; box::footer(); } //为控制中心增加个人收藏夹功能 zotop::add('system.main.main', 'favorite_box'); function favorite_box() { box::header(array('title' => '我的收藏夹', 'action' => '<a class="dialog" href="' . zotop::url('system/quick/add') . '">管理</a>|<a class="more" href="' . zotop::url('system/notepad') . '">更多</a>')); echo '<div style="height:200px;"></div>'; box::footer(); } //为主框架增加系统设置快捷功能 zotop::add('system.quickbar', 'system_quickbar_settings'); function system_quickbar_settings() { echo '<a href="' . zotop::url('system/setting') . '" target="mainIframe">系统设置</a> <b>|</b> '; } //增加template字段,用于选择模板 zotop::add('system.ready', 'system_field_template'); function system_field_template() { field::set('template', 'field_template'); function field_template($attrs) { $html[] = field::text($attrs); $html[] = '<a class="dialog" href="' . zotop::url('system/template/select/' . $attrs['name']) . '" title="选择模板"><span class="zotop-icon zotop-icon-template"></span></a>'; return implode("\n", $html); } }
<?php zotop::add('zotop.system.side.tools', 'system_side_tool_database'); function system_side_tool_database() { echo '<li><a href="' . zotop::url('database/manage/bakup') . '" target="mainIframe">数据库备份及还原</a></li>'; }
<?php zotop::add('zotop.main.action', 'msgtip'); zotop::add('zotop.main.action', 'weather'); zotop::add('zotop.main.action', 'msgtip2'); function msgtip() { echo '<div>未读短消息:<a href="#">5条</a> This\'s a hook</div>'; } function msgtip2() { echo '<div>待处理文档:<a href="#">5条</a> HOOK,暂时写在~hook文件中</div>'; } function weather() { echo '<div style="position:absolute;top:10px;right:0px;">'; echo '<iframe src="http://m.weather.com.cn/m/pn6/weather.htm " width="160" height="20" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no" allowtransparency="true" ></iframe>'; echo '</div>'; }
<?php zotop::add('zotop.main.side', 'zotop_notepad'); zotop::add('zotop.main.main', 'zotop_favorite_main'); zotop::add('zotop.index.quickbar', 'zotop_index_quickbar'); zotop::add('zotop.main.main', 'zotop_log'); zotop::add('system.shutdown', 'zotop_logsave'); function zotop_notepad() { block::header(array('title' => '记事本', 'action' => '<a class="dialog" href="' . zotop::url('zotop/notepad/add') . '">新建记事</a>|<a class="more" href="' . zotop::url('zotop/notepad') . '">更多</a>')); echo '<div style="height:200px;"></div>'; block::footer(); } function zotop_favorite_main() { block::header(array('title' => '我的收藏夹', 'action' => '<a class="dialog" href="' . zotop::url('zotop/quick/add') . '">管理</a>|<a class="more" href="' . zotop::url('zotop/notepad') . '">更多</a>')); echo '<div style="height:200px;"></div>'; block::footer(); } function zotop_index_quickbar() { echo '<a href="' . zotop::url('zotop/setting') . '" target="mainIframe">系统设置</a> <b>|</b> '; } function zotop_log() { block::header(array('title' => '日志记录', 'action' => '<a class="more" href="' . zotop::url('zotop/log') . '">更多</a>')); echo '<div style="height:200px;"></div>'; block::footer(); } function zotop_logsave() {
<?php zotop::add('zotop.main.main', 'favorite'); function favorite() { block::header(array('title' => '我的收藏夹', 'action' => '<a class="dialog" href="' . zotop::url('zotop/quick/add') . '">管理</a>|<a class="more" href="' . zotop::url('zotop/notepad') . '">更多</a>')); echo '<div style="height:200px;"></div>'; block::footer(); }
zotop::add('zotop.main.side', 'notepad'); function notepad() { block::header(array('title' => '记事本', 'action' => '<a class="dialog" href="' . zotop::url('zotop/notepad/add') . '">新建记事</a>|<a class="more" href="' . zotop::url('zotop/notepad') . '">更多</a>')); echo '<div style="height:200px;"></div>'; block::footer(); } zotop::add('zotop.main.main', 'favorite'); function favorite() { block::header(array('title' => '我的收藏夹', 'action' => '<a class="dialog" href="' . zotop::url('zotop/quick/add') . '">管理</a>|<a class="more" href="' . zotop::url('zotop/notepad') . '">更多</a>')); echo '<div style="height:200px;"></div>'; block::footer(); } zotop::add('zotop.main.main', 'mylog'); function mylog() { block::header(array('title' => '日志记录', 'action' => '<a class="more" href="' . zotop::url('zotop/log') . '">更多</a>')); echo '<div style="height:200px;"></div>'; block::footer(); } zotop::add('zotop.main.action', 'mymsg'); function mymsg() { echo '<div>短消息:<a href="#">未读 3条</a> <a href="#">待处理 5条</a></div>'; } zotop::add('zotop.main.action', 'content'); function content() { echo '<div>内容:<a href="#">待审核 3条</a> <a href="#">垃圾箱 5条</a></div>'; }
<?php zotop::add('zotop.main.main', 'mylog'); function mylog() { block::header(array('title' => '日志记录', 'action' => '<a class="more" href="' . zotop::url('zotop/log') . '">更多</a>')); echo '<div style="height:200px;"></div>'; block::footer(); }
<?php zotop::add('zotop.main.action', 'mymsg'); function mymsg() { echo '<div>短消息:<a href="#">未读 3条</a> <a href="#">待处理 5条</a></div>'; }