public function __construct() { if (!zotop::user()) { zotop::redirect('zotop/login'); } $this->__init(); }
public function onDefault() { if (form::isPostBack()) { $post = array(); $post['username'] = request::post('username'); $post['password'] = request::post('password'); $post['logintime'] = time(); $user = zotop::model('zotop.user'); $data = $user->read($post['username'], 'username'); //zotop::dump($data); if ($data == false) { msg::error('登陆失败', zotop::t('账户名称`{$username}`不存在,请检查!', array('username' => $post['username']))); } zotop::user($data); msg::success('登陆成功', '登陆成功,系统正在加载中', 'reload', 2); } if (zotop::user() != null) { zotop::redirect('zotop/index'); } $header['title'] = '用户登录'; $header['js'] = url::module() . '/admin/js/login.js'; $header['body']['class'] = "login"; page::header($header); block::header(array('id' => 'LoginWindow', 'title' => '用户登录')); form::header(array('title' => '', 'description' => '请输入用户名和密码', 'class' => 'small')); form::field(array('type' => 'text', 'label' => zotop::t('帐 户(U)'), 'name' => 'username', 'value' => zotop::user('username'), 'valid' => 'required:true')); form::field(array('type' => 'password', 'label' => zotop::t('密 码(P)'), 'name' => 'password', 'value' => '')); form::buttons(array('type' => 'submit', 'value' => '登 陆'), array('type' => 'button', 'name' => 'options', 'value' => '选 项')); form::footer(); block::footer(); page::footer(); }
public function onDefault() { $db = zotop::db(); if ($db->connect()) { zotop::redirect('database/table'); } msg::error('连接数据库失败', '请检查数据库配置是否正确'); }
public function actionIndex() { $db = zotop::db(); if ($db->connect()) { zotop::redirect(zotop::url('database/table')); } msg::error('连接数据库失败,请检查数据库配置是否正确'); }
public function actionImage($globalid = '', $field = '', $image = '') { if (empty($image)) { zotop::redirect('zotop/upload/imageFromLocal', array('globalid' => $globalid, 'field' => $field, 'image' => '')); } else { zotop::redirect('zotop/upload/imagePreview', array('globalid' => $globalid, 'field' => $field, 'image' => url::encode($image))); } }
public function actionPreview($id) { $content = zotop::model('content.content'); $content->read($id); if ($content->link) { zotop::redirect($content->url); } else { zotop::redirect(zotop::url('site://content/detail/' . $id)); } }
public function actionPreview($globalid, $field, $image) { if (!file_exists(ZOTOP_PATH_ROOT . DS . $image)) { zotop::redirect('zotop/image/upload', array('globalid' => $globalid, 'field' => $field, 'image' => url::encode($image))); } $file = zotop::model('zotop.image'); if ($file->isExist('path', $image)) { $image = $file->read(array('path', '=', $image)); } else { $image = array('path' => $image); } $page = new dialog(); $page->set('title', '图片预览'); $page->set('navbar', $this->navbar($globalid, $field, $image['path'])); $page->set('image', $image); $page->display(); }
public function actionIndex() { $user = zotop::model('zotop.user'); if (form::isPostBack()) { $post = array(); $post['username'] = request::post('username'); $post['password'] = request::post('password'); $post['logintime'] = time(); zotop::cookie('admin.username', $post['username'], 3600); if (empty($post['username'])) { msg::error(zotop::t('登陆失败,请输入登陆账户名称')); } if (empty($post['password'])) { msg::error(zotop::t('登陆失败,请输入登陆账户密码')); } if (!$user->isValidUserName($post['username'])) { msg::error(zotop::t('登陆失败,请输入有效的账户名称')); } if (!$user->isValidPassword($post['password'])) { msg::error(zotop::t('登陆失败,请输入有效的账户密码')); } //读取用户 $data = $user->read(array('username', '=', $post['username'])); //验证 if ($data == false) { msg::error(zotop::t('账户名称`{$username}`不存在,请检查是否输入有误!', array('username' => $post['username']))); } if ($user->password($post['password']) != $data['password']) { msg::error(zotop::t('账户密码`{$password}`错误,请检查是否输入有误!', array('password' => $post['password']))); } //用户登入 $user->login(); //跳转 msg::success('登陆成功,系统正在加载中', zotop::url('zotop/index'), 2); } if (!empty($this->user)) { zotop::redirect('zotop/index'); } $page = new page(); $page->set('title', zotop::t('系统管理登陆')); $page->set('body', array('class' => 'login')); $page->display('login'); }
public function actionLicense($path) { $module = zotop::model('zotop.module'); $modules = $module->getUnInstalled(); if (empty($path) || !dir::exists($path)) { msg::error(array('content' => zotop::t('模块不存在,请确认是否已经上传该模块?'), 'description' => zotop::t("路径:{$path}"))); } $licenseFile = $path . DS . 'license.txt'; if (!file::exists($licenseFile)) { zotop::redirect('zotop/module/install', array('path' => url::encode($path))); exit; } $license = file::read($licenseFile); $page = new dialog(); $page->set('title', '许可协议'); $page->set('license', html::decode($license)); $page->set('next', zotop::url('zotop/module/install', array('path' => url::encode($path)))); $page->display(); }
public function licenseAction($id) { $module = zotop::model('zotop.module'); $modules = $module->getUnInstalled(); if (empty($id) || !isset($modules[$id])) { msg::error(zotop::t('ID为<b>{$id}</b>的模块不存在,请确认是否已经上传该模块?')); } $licenseFile = $modules[$id]['path'] . DS . 'license.txt'; if (!file::exists($licenseFile)) { zotop::redirect('zotop/module/install', array('id' => $id)); exit; } $license = file::read($licenseFile); $page = new dialog(); $page->set('title', '许可协议'); $page->set('license', html::decode($license)); $page->set('next', zotop::url('zotop/module/install', array('id' => $id))); $page->display(); }
public function __check() { if (empty($this->user)) { zotop::redirect('zotop/login'); } }
public function __construct() { if (zotop::user() == null) { zotop::redirect('zotop/login'); } }
public function __check() { if (empty($this->user)) { zotop::redirect(zotop::url('system/login')); } }