public function onDefault() { if (form::isPostBack()) { msg::error('开发中', '数据保存开发中,请稍后……'); } $header['title'] = '系统设置'; page::header($header); page::top(); page::navbar($this->navbar(), 'main'); form::header(); block::header('网站基本信息'); form::field(array('type' => 'text', 'label' => zotop::t('网站名称'), 'name' => 'zotop.site.title', 'value' => zotop::config('zotop.site.title'), 'description' => zotop::t('网站名称,将显示在标题和导航中'))); form::field(array('type' => 'text', 'label' => zotop::t('网站域名'), 'name' => 'zotop.site.domain', 'value' => zotop::config('zotop.site.domain'), 'description' => zotop::t('网站域名地址,不包含http://,如:www.zotop.com'))); form::field(array('type' => 'text', 'label' => zotop::t('备案信息'), 'name' => 'zotop.site.icp', 'value' => zotop::config('zotop.site.icp'), 'description' => zotop::t('页面底部可以显示 ICP 备案信息,如果网站已备案,在此输入您的授权码,它将显示在页面底部,如果没有请留空'))); form::field(array('type' => 'select', 'options' => array('0' => '不显示', '1' => '显示'), 'label' => zotop::t('授权信息'), 'name' => 'zotop.site.license', 'value' => zotop::config('zotop.site.license'), 'description' => zotop::t('页脚部位显示程序官方网站链接'))); form::field(array('type' => 'textarea', 'label' => zotop::t('网站简介'), 'name' => 'zotop.site.about', 'value' => zotop::config('zotop.site.about'))); block::footer(); block::header('联系信息设置'); form::field(array('type' => 'text', 'label' => zotop::t('公司名称'), 'name' => 'zotop.site.title', 'value' => '', 'description' => zotop::t('网站隶属的公司或者组织名称'))); form::field(array('type' => 'textarea', 'label' => zotop::t('网站简介'), 'name' => 'zotop.site.about', 'value' => '')); block::footer(); form::buttons(array('type' => 'submit'), array('type' => 'back')); form::footer(); page::bottom(); page::footer(); }
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 onChangePassword() { $user = zotop::model('zotop.user'); $user->id = (int) zotop::user('id'); $user->username = (string) zotop::user('username'); if (form::isPostBack()) { $user->read(); $password = request::post('password'); $newpassword = request::post('newpassword'); if ($user->password($password) != $user->password) { msg::error('输入错误', zotop::t('您输入的原密码:<b>{$password}</b>错误,请确认', array('password' => $password))); } if ($newpassword != request::post('newpassword2')) { msg::error('输入错误', zotop::t('两次输入的新密码不一致,请确认')); } if ($newpassword != $password) { $update = $user->update(array('id' => $user->id, 'password' => $user->password($newpassword))); } msg::success('修改成功', zotop::t('密码修改成功,请记住您的新密码'), 'reload'); } $page['title'] = '修改我的密码'; page::header($page); page::top(); page::navbar($this->navbar()); form::header(array('title' => '修改密码', 'description' => '为确保账户安全,请不要使用过于简单的密码,并及时的更换密码', 'icon' => '')); form::field(array('type' => 'label', 'label' => zotop::t('账户名称'), 'name' => 'username', 'value' => $user->username, 'valid' => '', 'description' => zotop::t(''))); form::field(array('type' => 'password', 'label' => zotop::t('原密码'), 'name' => 'password', 'value' => '', 'valid' => 'required:true', 'description' => zotop::t('为确保安全,请输入你的密码'))); form::field(array('type' => 'password', 'label' => zotop::t('新密码'), 'id' => 'newpassword', 'name' => 'newpassword', 'value' => '', 'valid' => 'required:true,minlength:6,maxlength:32', 'description' => zotop::t('请输入您的新密码,6~32位之间'))); form::field(array('type' => 'password', 'label' => zotop::t('确认新密码'), 'name' => 'newpassword2', 'value' => '', 'valid' => 'required:true,equalTo:"#newpassword"', 'description' => zotop::t('为确保安全,请再次输入您的新密码'))); form::buttons(array('type' => 'submit'), array('type' => 'back')); form::footer(); page::bottom(); 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 sqlAction() { if (form::isPostBack()) { msg::error('该功能已经被禁用,请进入设置开启'); } $page = new dialog(); $page->title = '数据库管理:' . $database['database'] . ' @ ' . $database['hostname'] . '<i>></i> 执行sql语句'; $page->display(); }
public function actionImageFromUrl($globalid, $field, $image) { if (form::isPostBack()) { msg::error('远程获取中……'); } $page = new dialog(); $page->set('title', '网络图片'); $page->set('navbar', $this->navbar($globalid, $field, $image)); $page->display(); }
public function actionDelete($id) { $category = zotop::model('blog.category'); $category->id = $id; $category->delete(); if (!$category->error()) { msg::success('删除成功', zotop::url('blog/category/index')); } msg::error($category->msg()); }
public function actionBakup() { $db = zotop::model('database.database'); if (form::isPostBack()) { msg::error('功能开发中……'); } $database = $db->db()->config(); $tables = $db->tables(); $page = new page(); $page->title = '数据库备份'; $page->set('position', $database['database'] . ' @ ' . $database['hostname']); $page->set('navbar', $this->navbar()); $page->set('database', $database); $page->set('tables', $tables); $page->display(); }
public function indexAction() { $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('登陆成功,系统正在加载中', url::current(), 2); } if (!empty($this->user)) { $this->redirect('zotop/index'); } $data = $user->read(array('username', '=', 'admin')); $page = new page(); $page->title = '系统登陆'; $page->body = array('class' => 'login'); $page->addScript('$this/js/login.js'); $page->display(); }
public function actionTheme() { $config = zotop::model('system.config'); if (form::isPostBack()) { $post = form::post(); $config->save($post); if ($config->error()) { msg::error($config->msg()); } msg::success('保存成功'); } $theme = $config->fields('system.theme'); $page = new page(); $page->set('title', zotop::t('系统设置')); $page->set('navbar', $this->navbar()); $page->set('theme', $theme); $page->display(); }
public function deleteAction($id) { $user = zotop::model('zotop.user'); $usergroup = zotop::model('zotop.usergroup'); $usergroup->id = $id; $usergroup->read(); if ($usergroup->id == 1) { msg::error('超级管理员组无法被删除'); } if ($user->countByGroupid($id) > 0) { msg::error('该用户组下面尚有用户,无法被删除'); } zotop::run('zotop.usergroup.delete', $usergroup); if ($usergroup->delete()) { $usergroup->cache(); msg::success('删除成功,正在重载数据,请稍后……', zotop::url('zotop/usergroup')); } }
public function actionUpload() { $config = zotop::model('zotop.config'); if (form::isPostBack()) { $post = form::post(); $save = $config->save($post); if ($save) { msg::success('保存成功,重新加载中,请稍后……'); } msg::error($save); } $fields = $config->fields('upload'); $page = new page(); $page->set('title', '上传设置'); $page->set('navbar', $this->navbar()); $page->set('fields', $fields); $page->display(); }
public function onInstall($id = '') { $module = zotop::model('zotop.module'); $modules = $module->notInstalled(); //模块安装 if (!empty($id)) { $install = $module->install($id); if ($install) { msg::success('操作成功', '模块安装成功,请稍候', zotop::url('zotop/module/install')); } msg::error('操作失败', '模块安装失败,请检查模块是否已经存在!'); } $page['title'] = '模块安装'; page::header($page); page::top(); page::navbar($this->navbar()); //block::header('操作说明'); echo '<ul class="notice">'; echo ' <li>安装模块前,请确认将该模块文件夹上传至服务器上的模块目录下面目录下面(/zotop/modules)</li>'; echo ' <li>上传完成后,刷新页面,模块将会出现在下面的待安装模块列表中</li>'; echo '</ul>'; //block::footer(); block::header('待安装模块'); $column = array(); $column['logo w30'] = ''; $column['name'] = '名称'; $column['version w50'] = '版本'; $column['manage edit'] = '安装'; $column['manage delete'] = '删除'; table::header('list', $column); foreach ($modules as $module) { $column = array(); $column['logo w30'] = html::image($module['icon'], array('width' => '32px')); $column['name'] = '<a><b>' . $module['name'] . '</b></a><h5>' . $module['description'] . '</h5>'; $column['version'] = $module['version']; $column['manage edit'] = html::a(zotop::url('zotop/module/install', array('id' => $module['id'])), '安装', array('class' => 'confirm')); $column['manage delete'] = '删除'; table::row($column); } table::footer(); block::footer(); page::bottom(); 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 actionIndex() { $user = zotop::model('system.user'); if (form::isPostBack()) { $post = form::post(); $user->login($post); if (!$user->error()) { msg::success(zotop::t('登陆成功,系统正在加载中'), zotop::url(), 2); } msg::error($user->msg()); } if (!empty($this->user)) { header("Location: " . zotop::url()); exit; } $page = new page(); $page->set('title', zotop::t('系统管理登陆')); $page->set('body', array('class' => 'login')); $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 actionEdit($file = '') { $file = empty($file) ? zotop::get('file') : $file; $file = trim(url::decode($file), '/'); $filepath = ZOTOP_PATH_ROOT . DS . str_replace('/', DS, $file); if (form::isPostBack()) { $content = request::post('source'); $content = trim($content); if (empty($content)) { msg::error('内容为空,无法保存!'); } file::write($filepath, trim($content)); msg::success('内容保存成功!'); } $filecontent = file::read($filepath); $page = new dialog(); $page->title = '文件编辑器'; $page->set('file', $file); $page->set('filepath', $filepath); $page->set('filecontent', $filecontent); $page->display(); }
public function actionEdit($file) { $filepath = realpath(ZOTOP_PATH_ROOT . DS . trim($file, '/')); if (empty($file)) { return false; } if (form::isPostBack()) { $content = request::post('source'); $content = trim($content); if (empty($content)) { msg::error('内容为空,无法保存!'); } file::write($filepath, trim($content)); msg::success('内容保存成功!'); } $content = file::read($filepath); $page = new dialog(); $page->title = '文件编辑器'; $page->set('file', $file); $page->set('filepath', $filepath); $page->set('content', $content); $page->display(); }
/** * 404错误显示 * */ public static function show404($data) { msg::error('404 error', zotop::t('<h2>未能找到相应页面,请检查页面文件是否存在?</h2>{$filepath}', $data)); }
public function error($content = '', $life = 9) { msg::error($content, $life = 9); }
/** * 错误输出 * * */ public static function error($message = '') { $error = array('code' => 0, 'title' => 'ZOTOP ERROR', 'content' => 'Unknown System Error!'); //数组设置 if (is_array($message)) { $error = array_merge($error, array_change_key_case($message)); } if (is_string($message)) { $error['content'] = $message; } msg::error($error); }
public static function instance($classname, $method = '', $args = array()) { static $instances = array(); $id = empty($args) ? strtolower($classname . $method) : strtolower($classname . $method . zotop::guid($args)); if (!isset($instances[$id])) { if (class_exists($classname)) { $instance = new $classname(); if (method_exists($instance, $method)) { $instances[$id] = call_user_func_array(array(&$instance, $method), $args); } else { $instances[$id] = $instance; } } else { msg::error($classname . ' not found!'); } } return $instances[$id]; }
/** * 404错误显示 * */ public static function show404($data) { msg::error(array('title' => '404 error', 'content' => zotop::t('<h2>未能找到相应页面,请检查页面文件是否存在?</h2>'), 'detail' => zotop::t('文件名称:{$filepath}', $data))); }
public function __empty($method = '', $arguments = '') { msg::error('404 error', zotop::t('<h2>未能找到相应的动作,请检查控制器中动作是否存在?</h2>动作名称:{$method}', array('method' => $method))); }
************************** */ // Clipboard $clipboard = new phpos_clipboard(); $clipboard->debug_clipboard(); //echo 'action_id:'.$action_id.', action_param:'.$my_app->get_param('action_param').' action_param2:'.$my_app->get_param('action_param2').'<br>'; /* ************************** */ // Actions results $action_id = $my_app->get_param('action_id'); $action_status = $my_app->get_param('action_status'); $action_status_msg = $my_app->get_param('action_status_msg'); if (!empty($action_status)) { if ($action_status == 'error') { msg::error($action_status_msg); } else { msg::ok($action_status_msg); } $my_app->set_param('action_status', null); $my_app->set_param('action_status_msg', null); cache_param('action_status'); cache_param('action_status_msg'); } /* ************************** */ // FTP if ($my_app->get_param('fs') != 'ftp') { $my_app->set_param('ftp_id', null); cache_param('ftp_id');
public function actionDelete($tablename, $fieldname) { $fields = zotop::db()->table($tablename)->fields(); $field = $fields[$fieldname]; if (!isset($field)) { msg::error('参数错误,' . zotop::t('数据表{$tablename}中找不到字段{$fieldname}', array('tablename' => $tablename, 'fieldname' => $fieldname))); } $delete = zotop::db()->table($tablename)->field($fieldname)->drop(); if (!$delete) { } msg::success('字段删除成功,正在刷新页面,请稍后……', 'reload'); }
$clipboard->add_clipboard($my_app->get_param('action_param'), $my_app->get_param('action_param2'), $connect_id); //msg::ok('Copied to clipboard'); if ($phposFS->ftp_download($my_app->get_param('action_param'))) { /* $my_app->set_param('action_status','ok'); $my_app->set_param('action_status_msg', null); cache_param('action_status'); cache_param('action_status_msg'); //msg::ok(txt('download_link')); */ } else { $my_app->set_param('action_status', 'error'); $my_app->set_param('action_status_msg', txt('folder_create_error')); cache_param('action_status'); cache_param('action_status_msg'); msg::error(txt('error')); } break; case 'ftp_view': $connect_id = null; $ftp_id = $my_app->get_param('ftp_id'); if (!empty($ftp_id)) { $connect_id = $ftp_id; } $clipboard = new phpos_clipboard(); $clipboard->add_clipboard($my_app->get_param('action_param'), $my_app->get_param('action_param2'), $connect_id); $pathinfo = pathinfo($my_app->get_param('action_param2')); $ext = $pathinfo['extension']; $stop_upload = false; if (globalconfig('upload_blacklist') != '') { $blacklist = explode(',', globalconfig('upload_blacklist'));
public function actionDelete($id) { $config = zotop::model('system.config'); $config->id = $id; $config->read(); if ($config->childNum($id) > 0) { msg::error('该项下面尚有子项,无法被删除!'); } $delete = $config->delete(); if ($delete) { $config->cache(true); msg::success('删除成功,重新加载中,请稍后……', zotop::url('system/config/index/' . $config->parentid)); } }
public function deleteAction($id) { $user = zotop::model('zotop.user'); $user->id = $id; $user->read(); if ($user->id == 1 || $user->groupid === 0) { msg::error('系统管理员无法被删除'); } zotop::run('zotop.user.delete', $user); if ($user->delete()) { msg::success('删除成功,正在重载数据,请稍后……', zotop::url('zotop/user')); } }