public function actionEdit($tablename) { if (form::isPostBack()) { $tablename = request::post('tablename'); $name = request::post('name'); $comment = request::post('comment'); $primary = request::post('primary'); if (strtolower($tablename) !== strtolower($name)) { $rename = zotop::db()->table($tablename)->rename($name); } if ($comment !== NULL) { $comment = zotop::db()->table($name)->comment($comment); } if ($primary) { $primary = zotop::db()->table($name)->primary($primary); } msg::success('数据表设置成功,正在刷新页面,请稍后……', zotop::url('database/table')); } $db = zotop::db(); $database = $db->config(); $tables = $db->tables(true); $table = $tables[$tablename]; if (!isset($table)) { msg::error(zotop::t('数据表{$tablename}不存在', array('tablename' => $tablename))); } $page = new dialog(); $page->title = '数据库管理:' . $database['database'] . ' @ ' . $database['hostname'] . '<i>></i> 编辑:' . $tablename; $page->set('database', $database); $page->set('table', $table); $page->display(); }
public function actionDelete($tablename) { $delete = zotop::db()->table($tablename)->drop(); if (!$delete) { msg::error(zotop::t('删除数据表{$tablename}失败', array('tablename' => $tablename))); } msg::success('删除成功', zotop::url('database/table')); }
public function actionDelete($id) { $file = zotop::model('zotop.file'); $delete = $file->delete($id); if ($delete) { msg::success('删除成功', request::referer()); } }
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 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 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 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 onEdit($file) { if (form::isPostBack()) { $content = request::post('source'); msg::success('保存测试', '测试,继续编辑或者返回' . zotop::dump($content, true), 'reload'); } $source = file::read(ROOT . $file); $page['title'] = '文件编辑器'; page::header($page); page::top(); page::navbar($this->navbar()); form::header(array('class' => 'sourceEditor')); form::field(array('type' => 'label', 'label' => zotop::t('文件名称'), 'name' => 'filename', 'value' => $file, 'valid' => '', 'description' => zotop::t(''))); form::field(array('type' => 'source', 'label' => zotop::t('文件内容'), 'name' => 'source', 'value' => $source, 'valid' => 'required:true', 'description' => zotop::t(''))); form::buttons(array('type' => 'submit', 'value' => '保存文件'), array('type' => 'back')); form::footer(); page::bottom(); page::footer(); }
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 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(); }
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(); }
public function actionStatus($id, $status = -1) { $usergroup = zotop::model('system.usergroup'); $post = array('status' => $status); $update = $usergroup->update($post, $id); if ($update) { $usergroup->cache(true); msg::success('操作成功,正在刷新页面,请稍后……', zotop::url('system/usergroup')); } }
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')); } }
public function actionFulltext($tablename, $fieldname) { $indexes = zotop::db()->table($tablename)->index(); if (isset($indexes[$fieldname])) { zotop::db()->table($tablename)->index($fieldname, 'DROP'); } $result = zotop::db()->table($tablename)->index($fieldname, 'FULLTEXT'); if ($result) { msg::success('操作成功,已经成功的将该字段设置为全文索引', zotop::url('database/field/index', array('tablename' => $tablename))); } }
public function actionDelete($file) { $file = empty($file) ? zotop::get('file') : $file; $file = trim(url::decode($file), '/'); $filepath = site::template($file); if (file::delete($filepath)) { msg::success('删除成功', url::referer()); } msg::error('删除失败'); }
public function onDelete($tablename) { $tables = zotop::db()->tables(true); $table = $tables[$tablename]; if (!isset($table)) { msg::error('参数错误', zotop::t('数据表{$tablename}不存在', array('tablename' => $tablename))); } $delete = zotop::db()->table($tablename)->drop(); msg::success('操作成功', '<h2>数据表删除成功</h2>正在刷新页面,请稍后……', 'reload'); }
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')); } }
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()); }
public function actionDelete($id) { $category = zotop::model('content.category'); $category->id = $id; $category->delete(); if (!$category->error()) { msg::success('删除成功', url::referer()); } msg::error($category->msg()); }
public function actionDelete($id) { $model = zotop::model('content.model'); $model->id = $id; $model->drop(); if (!$model->error()) { msg::success('删除成功', zotop::url('content/model')); } msg::error($model->msg()); }
public function onLock($id, $status = -1) { $user = zotop::model('zotop.user'); $post = array('id' => (int) $id, 'status' => $status); $update = $user->update($post); if ($update) { msg::success('操作成功', '正在刷新页面,请稍后……', zotop::url('zotop/user')); } }
public function onLogout() { zotop::user(null); msg::success('登出成功', '登出成功,系统正在关闭中', 'reload', 2); }
public function success($content = '', $url = '', $life = 5, $extra = '') { msg::success($content, $url, $life, $extra); }
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')); } }
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')); } }
public function actionLogout() { $user = zotop::model('zotop.user'); $user->logout(); msg::success('登出成功,系统正在关闭中', zotop::url('zotop/login'), 2); }
public function actionDelete($image, $referer) { $file = zotop::model('zotop.image'); $delete = $file->delete(array('path', '=', $image)); if ($delete) { msg::success('图片删除成功', $referer); } }
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) { $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))); }