예제 #1
0
파일: login.php 프로젝트: dalinhuang/zotop
 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();
 }
예제 #2
0
파일: file.php 프로젝트: dalinhuang/zotop
 public function actionDelete($id)
 {
     $file = zotop::model('zotop.file');
     $delete = $file->delete($id);
     if ($delete) {
         msg::success('删除成功', request::referer());
     }
 }
예제 #3
0
파일: blog.php 프로젝트: dalinhuang/zotop
 public function author($userid = '')
 {
     $userid = empty($userid) ? $this->userid : $userid;
     $author = empty($author) ? $this->author : $author;
     if (empty($author) && !empty($userid)) {
         $author = zotop::model('system.user')->getName($userid);
     }
     return empty($author) ? '' : $author;
 }
예제 #4
0
파일: detail.php 프로젝트: dalinhuang/zotop
 public function actionDetail($id)
 {
     $content = zotop::model('content.content');
     $content->read($id);
     $page = new page();
     $page->set('content', $content);
     $page->set('body', array('class' => 'detail'));
     $page->display($content->template);
 }
예제 #5
0
파일: index.php 프로젝트: dalinhuang/zotop
 public function actionSide()
 {
     $category = zotop::model('content.category');
     $tree = $category->getTree(0, '<span class="zotop-icon zotop-icon-$icon"></span><a href="' . zotop::url('content/content/index/$id') . '" target="mainIframe">$title</a>');
     $page = new side();
     $page->set('title', zotop::t('文件管理'));
     $page->set('tree', $tree);
     $page->display();
 }
예제 #6
0
 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());
 }
예제 #7
0
 public function table()
 {
     if (empty($this->_table)) {
         $model = zotop::model('content.model');
         $models = $model->cache();
         $this->_table = $models[$this->modelid]['tablename'];
         if (empty($this->_table)) {
             $this->error(zotop::t('未找到模型数据表'));
             return false;
         }
     }
     return $this->_table;
 }
예제 #8
0
파일: folder.php 프로젝트: dalinhuang/zotop
 public function actionDelete($id)
 {
     $folder = zotop::model('system.folder');
     $folder->id = $id;
     $folder->read();
     if ($folder->count('parentid', $folder->id) > 0) {
         msg::error('删除失败,请先删除子类别');
     }
     $folder->delete();
     if (!$folder->error()) {
         msg::success('删除成功', zotop::url('system/folder/index/' . $folder->parentid));
     }
     msg::error($folder->msg());
 }
예제 #9
0
파일: module.php 프로젝트: dalinhuang/zotop
 public function actionStatus($id, $status = -1)
 {
     $module = zotop::model('system.module');
     $module->id = $id;
     $module->read();
     if ($module->type == 'core') {
         msg::error('系统模块不允许被禁用!');
     }
     $update = $module->update(array('status' => (int) $status), $id);
     if (!$module->error()) {
         $module->cache(true);
         msg::success('操作成功', zotop::url('system/module'));
     }
     msg::error($module->msg());
 }
예제 #10
0
파일: manage.php 프로젝트: dalinhuang/zotop
 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();
 }
예제 #11
0
 public function actionShow($id)
 {
     $blog = zotop::model('blog.blog');
     $blog->category = zotop::model('blog.category');
     $blog->read($id);
     $blog->category->read($blog->categoryid);
     $categorys = $blog->category->getAll();
     //渲染页面
     $page = new page();
     $page->set('title', $blog->title . ' ' . $blog->category->title);
     $page->set('keywords', $blog->keywords . ' ' . $blog->category->keywords);
     $page->set('description', $blog->description . ' ' . $blog->category->description);
     $page->set('body', array('class' => 'detail'));
     $page->set('id', $id);
     $page->set('blog', $blog);
     $page->set('categorys', $categorys);
     $page->display('blog.show');
 }
예제 #12
0
 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();
 }
예제 #13
0
 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();
 }
예제 #14
0
파일: mine.php 프로젝트: dalinhuang/zotop
 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();
 }
예제 #15
0
파일: mine.php 프로젝트: dalinhuang/zotop
 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();
 }
예제 #16
0
 public function delete($where = array())
 {
     $modelcontent = zotop::model('content.modelcontent');
     if (empty($where)) {
         $where = array('id', '=', $this->id);
     }
     $data = $this->db()->select('id', 'modelid', 'globalid')->where($where)->getAll();
     foreach ($data as $item) {
         //删除模型内容数据
         if ($item['modelid']) {
             $modelcontent->modelid = $item['modelid'];
             $modelcontent->delete();
         }
         //删除内容数据
         parent::delete(array('id', '=', $item['id']));
         //删除附件
         //删除钩子,可以调用该钩子删除其他模块的相关数据
         zotop::run('content.delete', $item['id']);
     }
     return true;
 }
예제 #17
0
파일: upload.php 프로젝트: dalinhuang/zotop
 public function actionImageFromLocal($globalid, $field, $image)
 {
     $upload = zotop::model('zotop.upload');
     $upload->alowexts = array('jpg', 'jpeg', 'gif', 'png', 'bmp');
     if (form::isPostBack()) {
         $upload->bind('globalid', request::post('globalid'));
         $upload->bind('field', request::post('field'));
         $upload->bind('description', request::post('description'));
         $files = $upload->save();
         $image = $files[0];
         if ($upload->error() == 0 && $image) {
             msg::success($upload->msg(), zotop::url('zotop/upload/imagePreview', array('globalid' => $globalid, 'field' => $field, 'image' => url::encode($image['path']))));
         }
         msg::error($upload->msg());
     }
     $page = new dialog();
     $page->set('title', '本地上传');
     $page->set('navbar', $this->navbar($globalid, $field, $image));
     $page->set('alowexts', $upload->alowexts);
     $page->set('maxsize', $upload->maxsize);
     $page->display();
 }
예제 #18
0
파일: index.php 프로젝트: dalinhuang/zotop
 public function actionIndex($categoryid = 0, $page = 1)
 {
     $blog = zotop::model('blog.blog');
     $blog->category = zotop::model('blog.category');
     $blogs = $blog->getPage($categoryid, 100, $page, 15);
     if (!empty($categoryid)) {
         $blog->category->read($categoryid);
     }
     $categorys = $blog->category->getAll();
     $pagination = pagination::output($blogs['total'], $blogs['page'], $blogs['pagesize'], zotop::url("blog/list/{$categoryid}/{#page}"));
     //渲染页面
     $page = new page();
     $page->set('title', $blog->category->title);
     $page->set('keywords', $blog->category->keywords);
     $page->set('description', $blog->category->description);
     $page->set('body', array('class' => 'list'));
     $page->set('categoryid', $categoryid);
     $page->set('blog', $blog);
     $page->set('blogs', $blogs);
     $page->set('categorys', $categorys);
     $page->set('pagination', $pagination);
     $page->display('blog.list');
 }
예제 #19
0
파일: mine.php 프로젝트: dalinhuang/zotop
 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();
 }
예제 #20
0
파일: module.php 프로젝트: dalinhuang/zotop
 public function actionLock($id, $status = -1)
 {
     $module = zotop::model('zotop.module');
     $module->id = $id;
     $module->read();
     if ($module->type == 'system') {
         msg::error('系统模块不允许被禁用!');
     }
     $post = array('status' => (int) $status);
     $update = $module->update($post, $id);
     if ($update) {
         $module->cache(true);
         msg::success('操作成功,正在刷新页面,请稍后……', zotop::url('zotop/module'));
     }
 }
예제 #21
0
파일: login.php 프로젝트: dalinhuang/zotop
 public function actionLogout()
 {
     $user = zotop::model('zotop.user');
     $user->logout();
     msg::success('登出成功,系统正在关闭中', zotop::url('zotop/login'), 2);
 }
예제 #22
0
파일: user.php 프로젝트: dalinhuang/zotop
 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'));
     }
 }
예제 #23
0
파일: index.php 프로젝트: dalinhuang/zotop
 public function actionOperation()
 {
     $blog = zotop::model('blog.blog');
     $id = (array) $_POST['id'];
     $operation = $_POST['operation'];
     foreach ($id as $i) {
         switch ($operation) {
             case 'delete':
                 $blog->delete($i);
                 break;
             case 'status100':
                 $blog->update(array('status' => 100), $i);
                 break;
             case 'status-50':
                 $blog->update(array('status' => -50), $i);
                 break;
             case 'status-1':
                 $blog->update(array('status' => -1), $i);
                 break;
             case 'status0':
                 $blog->update(array('status' => 0), $i);
                 break;
             case 'order':
                 if (!is_numeric($_POST['order'])) {
                     $blog->error(1, '权重必须是数字');
                 } else {
                     $blog->update(array('order' => $_POST['order']), $i);
                 }
                 break;
             case 'move':
                 $blog->update(array('categoryid' => $_POST['categoryid']), $i);
                 break;
             default:
                 break;
         }
     }
     if (!$blog->error()) {
         msg::success('操作成功', url::referer());
     }
     msg::error($blog->msg());
 }
예제 #24
0
파일: module.php 프로젝트: dalinhuang/zotop
 public function onLock($id, $status = -1)
 {
     $module = zotop::model('zotop.module');
     $post = array('id' => $id, 'status' => $status);
     $update = $module->update($post);
     if ($update) {
         msg::success('操作成功', '正在刷新页面,请稍后……', zotop::url('zotop/module'));
     }
 }
예제 #25
0
파일: model.php 프로젝트: dalinhuang/zotop
 public function actionJson($id)
 {
     $model = zotop::model('content.model');
     $model->id = $id;
     $model->read();
     $json = json_encode($model->bind());
     //输出json格式
     exit($json);
 }
예제 #26
0
파일: image.php 프로젝트: dalinhuang/zotop
 public function actionDelete($image, $referer)
 {
     $file = zotop::model('zotop.image');
     $delete = $file->delete(array('path', '=', $image));
     if ($delete) {
         msg::success('图片删除成功', $referer);
     }
 }
예제 #27
0
파일: config.php 프로젝트: dalinhuang/zotop
 public function deleteAction($id)
 {
     $config = zotop::model('zotop.config');
     $config->id = $id;
     $config->read();
     if ($config->childNum($id) > 0) {
         msg::error('该项下面尚有子项,无法被删除!');
     }
     $config->delete();
     msg::success('删除成功,重新加载中,请稍后……', zotop::url('zotop/config/index', array('parentid' => $config->parentid)));
 }
예제 #28
0
파일: field.php 프로젝트: dalinhuang/zotop
 public function cache($modelid, $flush = false)
 {
     $name = $this->table() . '-' . $modelid;
     //获取缓存
     $cache = zotop::cache($name);
     if (empty($cache) or $flush) {
         //更新表字段数据
         $modelcontent = zotop::model('content.modelcontent');
         $modelcontent->modelid = $modelid;
         $modelcontent->field(true);
         //更新缓存数据
         $cache = $this->getAll($modelid);
         if (is_array($cache)) {
             zotop::cache($name, $cache);
         }
     }
     return $cache;
 }
예제 #29
0
파일: config.php 프로젝트: dalinhuang/zotop
 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));
     }
 }
예제 #30
0
 public function statusAction($id, $status = -1)
 {
     $usergroup = zotop::model('zotop.usergroup');
     $post = array('id' => (int) $id, 'status' => $status);
     $update = $usergroup->update($post);
     if ($update) {
         $usergroup->cache();
         msg::success('操作成功,正在刷新页面,请稍后……', zotop::url('zotop/usergroup'));
     }
 }