public function sqlAction() { if (form::isPostBack()) { msg::error('该功能已经被禁用,请进入设置开启'); } $page = new dialog(); $page->title = '数据库管理:' . $database['database'] . ' @ ' . $database['hostname'] . '<i>></i> 执行sql语句'; $page->display(); }
public function actionAbout($id) { $module = zotop::model('system.module'); $module->id = $id; $data = $module->read(); $page = new dialog(); $page->set('title', '模块简介'); $page->set('module', $data); $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 go() { $options = array(); foreach (data::$elements as $element) { $options[] = array("short" => $element[0], "long" => $element[1]); } $result = dialog::display("What's your problem?", "Please help and refine the problem by selecting a category.", "menu", $options); if ($result === false) { exit; } var_dump($result); }
public function selectAction($type = 'text') { $types = array('text' => '单行文本输入框', 'textarea' => '多行文本输入框', 'select' => '单选下拉选择框', 'radio' => '单项选择框', 'checkbox' => '多项选择框', 'editor' => '富文本编辑器', 'image' => '图片上传控件', 'date' => '日期选择控件'); $attrs = array('text' => 'width,style,class', 'textarea' => 'width,height,style,class', 'select' => 'options,style,width', 'editor' => 'width,height'); $controls = array('width' => array('type' => 'text', 'name' => 'width', 'label' => '控件宽度', 'value' => '', 'valid' => '', 'description' => '控件的宽度,单位为<b>px</b>'), 'height' => array('type' => 'text', 'name' => 'height', 'label' => '控件高度', 'value' => '', 'valid' => '', 'description' => '控件的高度,单位为<b>px</b>'), 'style' => array('type' => 'text', 'name' => 'style', 'label' => '控件样式', 'value' => '', 'valid' => '', 'description' => '控件的style属性'), 'class' => array('type' => 'text', 'name' => 'class', 'label' => '控件风格', 'value' => '', 'valid' => '', 'description' => '控件的class属性'), 'options' => array('type' => 'textarea', 'name' => 'options', 'label' => '控件选项', 'value' => '', 'valid' => '', 'description' => '每行一个,值和数据使用<b>::</b>隔开')); $page = new dialog(); $page->set('title', '选择控件'); $page->set('type', $type); $page->set('types', $types); $page->set('controls', $controls); $page->set('attrs', $attrs[$type]); $page->display(); }
public function actionEdit($id) { $category = zotop::model('blog.category'); if (form::isPostBack()) { $post = form::post(); $category->update($post, $id); if (!$category->error()) { msg::success('保存成功', zotop::url('blog/category/index')); } msg::error($category->msg()); } $category->id = $id; $data = $category->read(); $page = new dialog(); $page->set('title', '编辑分类'); $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(); }
public function actionEdit($id) { $folder = zotop::model('system.folder'); if (form::isPostBack()) { $post = form::post(); if ($post['id'] == $post['parentid']) { msg::error('上级分类不能和当前分类相同'); } $folder->update($post, $id); if (!$folder->error()) { msg::success('保存成功', zotop::url('system/folder/index/' . $post['parentid'])); } msg::error($folder->msg()); } $folder->id = $id; $data = $folder->read(); $folders = $folder->getAll(); $tree = new tree($folders, 0); $data['parentid_options'] = $tree->getOptionsArray(); $page = new dialog(); $page->set('title', '编辑分类'); $page->set('data', $data); $page->display(); }
public function actionEdit($id, $type = '') { $config = zotop::model('system.config'); $config->id = $id; if (form::isPostBack()) { $post = form::post(); $post['settings'] = json_encode($post['settings']); $update = $config->update($post, $id); if ($update) { $config->cache(true); msg::success('保存成功,重新加载中,请稍后……', zotop::url('system/config/index/' . $post['parentid'])); } msg::error($update); } $field = $config->read(); $field['settings'] = (array) json_decode($field['settings']); //重新选择 if (!empty($type)) { $field['type'] = $type; } else { $type = $field['type']; } $page = new dialog(); $page->set('title', '编辑'); $page->set('body', array('style' => 'min-width:600px;')); $page->set('field', $field); $page->set('type', $type); $page->set('types', $config->getControlTypes()); $page->set('attrs', $config->getControlAttrs($type, $field)); $page->display(); }
public function actionEdit($tablename, $fieldname) { if (form::isPostBack()) { $field = array(); $field['name'] = request::post('name'); $field['length'] = request::post('len'); $field['type'] = request::post('type'); $field['collation'] = request::post('collation'); $field['null'] = request::post('null'); $field['default'] = request::post('default'); $field['attribute'] = request::post('attribute'); $field['extra'] = request::post('extra'); $field['comment'] = request::post('comment'); $field['position'] = request::post('position'); $fieldname = request::post('fieldname'); if ($fieldname != $field['name']) { $result = zotop::db()->table($tablename)->field($fieldname)->rename($field['name']); } $result = zotop::db()->table($tablename)->modify($field); if ($result) { msg::success('字段修改成功', zotop::url('database/field/index', array('tablename' => $tablename))); } } $tables = zotop::db()->tables(true); $table = $tables[$tablename]; $fields = array(); if (isset($table)) { $fields = zotop::db()->table($tablename)->fields(true); } $field = $fields[$fieldname]; if (!isset($field)) { msg::error('字段不存在,请勿修改浏览器参数'); } $positions = array(); $positions[-1] = '位于表头'; if ($fields) { foreach ($fields as $key => $val) { $positions[$key] = '位于 ' . $key . ' 之后'; } } $positions[0] = ' '; $page = new dialog(); $page->title = '编辑字段'; $page->set('database', $database); $page->set('tables', $tables); $page->set('field', $field); $page->set('positions', $positions); $page->display(); }
public function actionNewfile($dir = '') { $dir = empty($dir) ? zotop::get('dir') : $dir; $dir = trim(url::decode($dir), '/'); $file = 'newfile.php'; if (form::isPostBack()) { $file = zotop::post('name'); $title = zotop::post('title'); $description = zotop::post('description'); $filepath = site::template($dir . DS . $file); $filecontent = "<?php\r\n/**\r\n * title:{$title}\r\n * description:{$description}\r\n*/\r\n?>"; if (file::exists($filepath)) { msg::error(zotop::t('新建失败,当前目录已经存在文件:{$file}', array('file' => $file))); } if (file::write($filepath, $filecontent)) { msg::success('新建文件成功'); } msg::error('新建文件失败'); } $page = new dialog(); $page->title = zotop::t('模板编辑器'); $page->set('dir', $dir); $page->set('file', $file); $page->display(); }
public function editAction($id, $type = '') { $config = zotop::model('zotop.config'); $config->id = $id; if (form::isPostBack()) { $post = form::post(); $post['settings'] = json_encode($post['settings']); $update = $config->update($post, $id); if ($update) { msg::success('保存成功,重新加载中,请稍后……', zotop::url('zotop/config/index', array('parentid' => $post['parentid']))); } msg::error(zotop::dump($post, true)); } $field = $config->read(); $field['settings'] = (array) json_decode($field['settings']); $type = empty($type) ? $field['type'] : $type; $field['type'] = $type; $page = new dialog(); $page->set('title', '编辑'); $page->set('body', array('style' => 'min-width:600px;')); $page->set('field', $field); $page->set('type', $type); $page->set('types', $config->types()); $page->set('controls', $config->controls()); $page->set('attrs', $config->attrs($type)); $page->display(); }
public function actionSelect($id = 0) { $category = zotop::model('content.category'); $tree = $category->getTree(0, '<input type="radio" name="id" id="id_$id" value="$id" $checked/> <label for="id_$id"><span class="zotop-icon zotop-icon-$icon"></span><span class="title">$title</span></label>', $id); $page = new dialog(); $page->set('title', zotop::t('选择栏目')); $page->set('id', $id); $page->set('tree', $tree); $page->display(); }
public function aboutAction() { $page = new dialog(); $page->title = 'About'; $page->display(); }
public function actionEdit($id) { $file = zotop::model('system.file'); if (form::isPostBack()) { $post = form::post(); $file->update($post, $id); if (!$file->error()) { msg::success('编辑成功'); } msg::error($file->msg()); } $folder = zotop::model('system.folder'); $image = $file->read(array('id', '=', $id)); $folders = $folder->getAll(); $tree = new tree($folders, 0); $categorys = $tree->getOptionsArray(); $page = new dialog(); $page->set('title', '图片编辑'); $page->set('image', $image); $page->set('categorys', $categorys); $page->display(); }