public function __construct() { if (!zotop::user()) { zotop::redirect('zotop/login'); } $this->__init(); }
public function __construct() { if (!is_object($this->_db)) { $this->_db = zotop::db(); } $this->_user = zotop::user(); }
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(); }
public function changeInfoAction() { $user = zotop::model('zotop.user'); $user->id = (int) zotop::user('id'); if (form::isPostBack()) { $post = form::post(); $update = $user->update($post, $user->id); if ($update) { msg::success('资料设置成功,正在刷新页面,请稍后……', url::current()); } msg::error(); } $data = $user->read(); $page = new page(); $page->title = '修改我的基本信息'; $page->set('navbar', $this->navbar()); $page->set('data', $data); $page->display(); }
public function actionInfo() { $user = zotop::model('system.user'); $user->id = (int) zotop::user('id'); if (form::isPostBack()) { $post = form::post(); $update = $user->update($post, $user->id); if ($update) { msg::success('资料设置成功,正在刷新页面,请稍后……', url::location()); } msg::error(); } $data = $user->read(); $page = new page(); $page->title = zotop::t('个人中心'); $page->set('navbar', $this->navbar()); $page->set('globalid', $user->globalid()); $page->set('data', $data); $page->display(); }
public function onDefault() { $header['title'] = '控制中心'; $header['js'] = url::module() . '/admin/js/index.js'; $header['body']['class'] = 'frame'; page::header($header); $html[] = ''; $html[] = '<script type="text/javascript">'; $html[] = ' zotop.url.frame.side="' . zotop::url('zotop/side') . '"'; $html[] = ' zotop.url.frame.main="' . zotop::url('zotop/main') . '"'; $html[] = ' zotop.url.msg.unread="' . zotop::url('zotop/msg/unread') . '"'; $html[] = '</script>'; $html[] = ' <div id="header">'; $html[] = ' <div id="top">'; $html[] = ' <div id="logo"><a href="' . zotop::url('zotop/main') . '" target="mainIframe" onfocus="this.blur();" title="首页"></a></div>'; $html[] = ' <div id="action">'; $html[] = ' <div id="topbar">'; $html[] = ' <a href="javascript:notepad()">记事本</a><b>|</b>'; $html[] = ' <a href="' . zotop::url('zotop/setting') . '" target="mainIframe">系统设置</a><b>|</b>'; $html[] = ' <a href="' . zotop::url('zotop/about') . '" target="mainIframe" class="dialog {width:450,height:160}">关于</a>'; $html[] = ' </div>'; $html[] = ' <div id="user">'; $html[] = ' <span id="user-info"><b>' . zotop::user('username') . '</b>(administrator)</span>'; $html[] = ' <span id="user-action">'; $html[] = ' <span id="msg"><a href="' . zotop::url('zotop/msg') . '" target="mainIframe">短消息</a><span id="msg-unread"><a href="' . zotop::url('zotop/msg/default/0') . '" target="mainIframe"><span id="msg-unread-num">0</span>条未读</a></span><b>|</b></span>'; $html[] = ' <a href="' . zotop::url('zotop/user/changepassword') . '" target="mainIframe">修改我的密码</a><b>|</b>'; $html[] = ' <a href="' . zotop::url('zotop/login/logout') . '" id="logout" class="confirm {content:\'<h1>您确定要退出登录?</h1>退出登陆后将默认将返回系统登录页面\',yes:\'安全退出\'}">安全退出</a>'; $html[] = ' </span>'; $html[] = ' </div>'; $html[] = ' <div id="navbar">'; $html[] = ' <ul>'; $html[] = ' <li><a href="' . zotop::url('zotop/main') . '" target="mainIframe"><span>控制中心</span></a></li>'; $html[] = ' <li><a href="' . zotop::url('content') . '" target="mainIframe"><span>内容管理</span></a></li>'; $html[] = ' <li><a href="' . zotop::url('member') . '" target="mainIframe"><span>会员管理</span></a></li>'; $html[] = ' <li><a href="' . zotop::url('zotop/test') . '" target="mainIframe"><span>系统管理</span></a></li>'; $html[] = ' </ul>'; $html[] = ' </div>'; $html[] = ' </div>'; $html[] = ' </div>'; $html[] = ' <div id="position">'; $html[] = ' </div>'; $html[] = ' </div>'; $html[] = ' <div id="body">'; $html[] = ' <div id="side">'; $html[] = ' <div id="side-inner">'; $html[] = ' <div id="side-header">'; $html[] = ' <div class="side-block-header">'; $html[] = ' <div class="side-block-title">应用列表</div>'; $html[] = ' <div class="side-block-action"><a href="#">管理</a></div>'; $html[] = ' </div>'; $html[] = ' <div class="side-block-body">'; $html[] = ' <ul id="applications">'; $html[] = ' <li><a href="' . zotop::url('zotop/main') . '" target="mainIframe">控制中心</a></li>'; $html[] = ' <li><a href="' . zotop::url('zotop/test') . '" target="mainIframe">表单测试</a></li>'; $html[] = ' <li><a href="' . zotop::url('database') . '" target="mainIframe">数据库管理</a></li>'; $html[] = ' <li><a href="' . zotop::url('zotop/io') . '" target="mainIframe">文件管理</a></li>'; $html[] = ' </ul>'; $html[] = ' </div>'; $html[] = ' <div class="side-block-footer">'; $html[] = ' </div>'; $html[] = ' </div>'; $html[] = ' <div id="side-body">'; $html[] = ' <div class="side-block-header">'; $html[] = ' <div class="side-block-title">内容管理</div>'; $html[] = ' <div class="side-block-action"><a href="javascript:zotop.frame.side().location.reload();">刷新</a> <a href="#" title="栏目管理">管理</a></div>'; $html[] = ' </div>'; $html[] = ' </div>'; $html[] = ' <div id="side-extra">'; $html[] = ' <div class="inner">'; $html[] = ' ' . html::iframe('sideIframe', 'about:blank', array('frameborder' => 'no', 'scrolling' => 'auto', 'width' => '100%', 'height' => '100%')); $html[] = ' </div>'; $html[] = ' </div>'; $html[] = ' <div id="side-footer">'; $html[] = ' <div>Powered by <a href="' . zotop::config('zotop.homepage') . '" target="_blank">' . zotop::config('zotop.name') . ' ' . zotop::config('zotop.version') . '</a></div>'; $html[] = ' </div>'; $html[] = ' </div>'; $html[] = ' </div>'; $html[] = ' <div id="main">'; $html[] = ' ' . html::iframe('mainIframe', 'about:blank', array('frameborder' => 'no', 'scrolling' => 'auto', 'width' => '100%', 'height' => '100%')); $html[] = ' </div>'; $html[] = ' </div>'; $html[] = ' <div id="footer">'; $html[] = ' </div>'; echo implode("\n", $html); page::footer(); }
/** * 清除登陆信息 * */ public function logout() { //记录用户数据 zotop::user(null); return true; }
public function onLogout() { zotop::user(null); msg::success('登出成功', '登出成功,系统正在关闭中', 'reload', 2); }
public static function log($type = '', $data = array()) { if (empty($type)) { return zotop::$logs; } if (is_array($type)) { $log = $type; } if (is_string($data)) { $log = array('type' => $type, 'content' => $data); } if (is_array($data)) { $log = array('type' => $type, 'content' => $data); } if (!empty($log) && is_array($log)) { $log = array('type' => $log['type'], 'title' => $log['title'], 'content' => $log['content'], 'description' => $log['description'], 'userid' => zotop::user('id'), 'url' => url::location(), 'createip' => ip::location(), 'createtime' => TIME); zotop::$logs[] = $log; } return zotop::$logs; }
public function __init() { $this->user = zotop::user(); }
public function __construct() { if (zotop::user() == null) { zotop::redirect('zotop/login'); } }
<?php $this->header(); $this->top(); $this->navbar(); zotop::dump(zotop::user()); $this->bottom(); $this->footer();
/** * 获取当前的user cookie 数据 * * @param string $key 字段名称,如:id,username * @return mixed */ public function user($key = '') { static $user = array(); if (empty($user)) { $user = zotop::user(); } if (empty($key)) { return $user; } return $user[$key]; }
public function onChangeInfo() { $user = zotop::model('zotop.user'); $user->id = (int) zotop::user('id'); if (form::isPostBack()) { $post = form::post(); $update = $user->update($post, $user->id); if ($update) { msg::success('保存成功', '资料设置成功,正在刷新页面,请稍后……', 'reload'); } } $data = $user->read(); $data['updatetime'] = TIME; $page['title'] = '修改我的资料'; page::header($page); page::top(); page::navbar($this->navbar()); form::header(); block::header('账户信息'); form::field(array('type' => 'label', 'label' => zotop::t('账户名称'), 'name' => 'username', 'value' => $data['username'], 'valid' => '', 'description' => zotop::t(''))); form::field(array('type' => 'text', 'label' => zotop::t('安全问题'), 'name' => 'question', 'value' => $data['question'], 'valid' => '', 'description' => zotop::t(''))); form::field(array('type' => 'text', 'label' => zotop::t('安全答案'), 'name' => 'answer', 'value' => $data['answer'], 'valid' => '', 'description' => zotop::t(''))); block::footer(); block::header('个人信息'); form::field(array('type' => 'text', 'label' => zotop::t('真实姓名'), 'name' => 'name', 'value' => $data['name'], 'valid' => 'required:true', 'description' => zotop::t(''))); form::field(array('type' => 'radio', 'options' => array('男' => '男', '女' => '女'), 'label' => zotop::t('性别'), 'name' => 'gender', 'value' => $data['gender'], 'valid' => '', 'description' => zotop::t(''))); form::field(array('type' => 'image', 'label' => zotop::t('头像'), 'name' => 'image', 'value' => $data['image'], 'valid' => '', 'description' => zotop::t(''))); form::field(array('type' => 'text', 'label' => zotop::t('电子邮件'), 'name' => 'email', 'value' => $data['email'], 'valid' => 'required:true,email:true', 'description' => zotop::t(''))); form::field(array('type' => 'textarea', 'label' => zotop::t('个人签名'), 'name' => 'sign', 'value' => $data['sign'], 'valid' => '', 'description' => zotop::t(''))); form::field(array('type' => 'hidden', 'label' => zotop::t('更新时间'), 'name' => 'updatetime', 'value' => $data['updatetime'], 'valid' => '', 'description' => zotop::t(''))); block::footer(); form::buttons(array('type' => 'submit'), array('type' => 'back')); form::footer(); page::bottom(); page::footer(); }