public function __construct() { if (!is_object($this->_db)) { $this->_db = zotop::db(); } $this->_user = zotop::user(); }
public function editAction($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); } $this->success('数据表设置成功,正在刷新页面,请稍后……', zotop::url('database/table')); } $db = zotop::db(); $database = $db->config(); $tables = $db->tables(true); $table = $tables[$tablename]; if (!isset($table)) { $this->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 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 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 __construct() { $this->db = zotop::db(); //数据库 if (!user::isLogin()) { //url::redirect('system/login'); } }
public function onDefault() { $header['title'] = '控制中心'; page::header($header); page::top(); page::navbar(array(array('id' => 'main', 'title' => '首页', 'href' => url::build('zotop/index/main')), array('id' => 'info', 'title' => '系统信息', 'href' => url::build('zotop/index/info'))), 'main'); $db = zotop::db(); $user = $db->select('*')->from('user')->orderby('id', 'asc')->limit(1)->getAll(); zotop::dump($db->lastSql()); zotop::dump($user); page::bottom('<span class="zotop-tip">最后一次登录时间:2009-8-9 14:17:54</span>'); page::footer(); }
public function __construct() { if (!is_object($this->db)) { $this->db = zotop::db(); } }
public function __construct() { $this->db = zotop::db(); }
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 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'); }
</tr> <tr> <td class="w80">空间占用:</td><td><?php echo zotop::config('site.size'); ?> </td> </tr> <tr> <td class="w80">已上传文件:</td><td><?php echo zotop::config('upload.size'); ?> </td> </tr> <tr> <td class="w80">数据库大小:</td><td><?php echo zotop::db()->size(); ?> </td> </tr> </table> </div> <div class="block-footer"></div> </div> <div class="block clearfix "> <div class="block-header"> <h2>系统信息</h2> <h3><a class="more" href="<?php echo zotop::url('zotop/system/info'); ?> ">详细</a></h3> </div>
public function onDelete($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('操作成功', '<h2>字段删除成功</h2>正在刷新页面,请稍后……', 'reload'); }
public function onSystem() { $header['title'] = '控制中心'; $phpinfo = array(); $server = $_SERVER['SERVER_ADDR'] . ' / ' . PHP_OS; $php = $_SERVER['SERVER_SOFTWARE']; $safemode = @ini_get('safe_mode') ? ' 开启' : '关闭'; if (@ini_get('file_uploads')) { $upload_max_filesize = ini_get('upload_max_filesize'); } else { $upload_max_filesize = '<b class="red">---</b>'; } $upload_filesize = format::byte(dir::size(ZOTOP_UPLOAD)); $database = zotop::db()->config(); $database['size'] = zotop::db()->size(); $database['version'] = zotop::db()->version(); $database['db'] = $database['hostname'] . ':' . $database['hostport'] . '/' . $database['database']; page::header($header); page::top(); page::navbar($this->navbar()); block::header('服务器信息'); table::header(); table::row(array('side 1 w60' => '服务器', 'main w300 1' => $server, 'side 2 w60 ' => 'WEB服务器', 'main 2' => $php)); table::row(array('side 1 w60' => '安全模式', 'main 1' => $safemode, 'side 2 w60 ' => 'PHP版本', 'main 2' => PHP_VERSION)); table::row(array('side 1 w60' => '程序版本', 'main 1' => zotop::config('zotop.version'), 'side 2 w60 ' => '程序根目录', 'main 2' => ROOT)); table::footer(); block::footer(); block::header('文件夹权限<span>如果某个文件或目录被检查到“无法写入”(以红色列出),请即刻通过 FTP 或其他工具修改其属性(例如设置为 777),以确保程序功能的正常使用</span>'); table::header(); table::row(array('side 1 w60' => '配置目录', 'main w300 1' => '', 'side 2 w60 ' => '备份目录', 'main 2' => '')); table::row(array('side 1 w60' => '运行目录', 'main w300 1' => '', 'side 2 w60 ' => '模块目录', 'main 2' => '')); table::footer(); block::footer(); block::header('数据库信息'); table::header(); table::row(array('side 1 w60' => '驱动名称', 'main w300 1' => $database['driver'], 'side 2 w60 ' => '数据库', 'main 2' => $database['db'])); table::row(array('side 1 w60' => '数据库版本', 'main 1' => $database['version'], 'side 2 w60 ' => '占用空间', 'main 2' => $database['size'])); table::footer(); block::footer(); block::header('文件上传'); table::header(); table::row(array('side 1 w60' => '上传许可', 'main w300 1' => $upload_max_filesize, 'side 2 w60 ' => '已上传文件', 'main 2' => '<span class="loading">' . $upload_filesize . '</span>')); table::footer(); block::footer(); page::bottom(); page::footer(); }