Exemple #1
0
 public function beforeRun($resource, $action)
 {
     $this->dir = ADMIN_ROOT . '/moban/';
     $this->img = '/' . ADMIN_ROOT . '/static/';
     $session = Doo::session('Lua');
     $auth = $session->get('auth');
     if (empty($auth)) {
         $sets = Doo::cache('php')->get('loginset');
         if ($sets && $sets['cardit'] == 1) {
             $xxxx = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J');
             $nums = range(1, 9);
             shuffle($xxxx);
             shuffle($nums);
             $aaaa = $xxxx[0] . $nums[0];
             $bbbb = $xxxx[1] . $nums[1];
             $session->cardcode = $aaaa . '@' . $bbbb;
         }
         include Lua::display('login', $this->dir);
         exit;
     }
     $auth = empty($auth) ? array(0, '') : Lua::clean(explode("\t", Lua::authcode($auth, 'DECODE')), 1);
     $user = Lua::get_one("select * from lua_admin where uid='" . intval($auth[0]) . "' and password='******' and gid='1'");
     if (empty($user) || $user && $this->clientIP() != $user['loginip']) {
         $session->auth = '';
         Lua::admin_msg('操作提示', '请先登录', '/' . ADMIN_ROOT);
     }
     $rs = $this->acl()->process($user['perm'], $resource, $action);
     if ($rs) {
         return $rs;
     }
     $this->user = $user;
     $this->page = Lua::get_post('p') ? intval(Lua::get_post('p')) : 1;
     // 图片识别码, 借鉴自 supesite
     define('FILE_HASH', substr(md5($user['uid'] . '/' . time() . Lua::random(6)), 8, 16));
 }
Exemple #2
0
 public function _del()
 {
     $dir = Lua::get('dir');
     Doo::loadHelper('DooFile');
     $fileManager = new DooFile(0777);
     if (file_exists($this->cache . $dir . '/')) {
         $fileManager->delete($this->cache . $dir . '/');
     }
     Lua::admin_msg('提示信息', '成功删除', './plugin.htm?action=ebak');
 }
Exemple #3
0
 private function del()
 {
     $id = Lua::get('id');
     $count = Doo::db()->count("select count(*) from lua_category where systemname='" . SYSNAME . "' and upid='{$id}'");
     if ($count > 0) {
         Lua::admin_msg('提示信息', '有下级栏目');
     }
     $db = Lua::get_one("select * from lua_category where id='{$id}' and systemname='" . SYSNAME . "'");
     if ($db) {
         $models = $this->_models_tree($db['model_id']);
         if ($models) {
             foreach ($models as $row) {
                 Doo::db()->query("delete from " . $row['tablename'] . " where catid='{$id}'");
             }
         }
     }
     Lua::delete('lua_category', array('systemname' => SYSNAME, 'id' => $id));
     $this->_cache();
     Lua::write_log($this->user, '删除栏目', "catid={$id}<br />title=" . $db['name'], SYSNAME);
     Lua::admin_msg('操作提示', '成功删除', './category.htm');
 }
Exemple #4
0
 public function index()
 {
     $this->plugin_dir = PROJECT_ROOT . Doo::conf()->PROTECTED_FOLDER . 'plugin/';
     $action = Lua::get_post('action');
     $action = $action ? $action : 'home';
     if (method_exists($this, $action)) {
         $this->{$action}();
     } else {
         $file = $this->plugin_dir . $action . '/admin.php';
         if (!file_exists($file)) {
             Lua::admin_msg('提示信息', '你访问的插件不存在');
         }
         require_once $file;
         $oo = new $action();
         $oo->_set($this->plugin_dir, $this->dir, $this->img, $this->user);
         $c = Lua::get_post('c');
         $c = $c ? '_' . $c : '_home';
         if (method_exists($oo, $c)) {
             $oo->{$c}();
         } else {
             Lua::e404();
         }
     }
 }
Exemple #5
0
 private function _get($id, $ajax = 0)
 {
     $db = Lua::get_one("select * from lua_model where id='{$id}'");
     if (empty($db)) {
         if ($ajax == 1) {
             Lua::ajaxmessage('error', '你访问的模型不存在');
         } else {
             Lua::admin_msg('提示信息', '你访问的模型不存在');
         }
     }
     return $db;
 }
Exemple #6
0
 private function _table($id, $ajax = 0)
 {
     $db = Lua::get_one("select * from lua_model_table where model_id='{$id}' and upid='0'");
     if (empty($db)) {
         if ($ajax == 1) {
             Lua::ajaxmessage('error', '栏目没数据表');
         } else {
             Lua::admin_msg('提示信息', '栏目没数据表');
         }
     }
     return $db;
 }
Exemple #7
0
 private function import()
 {
     set_time_limit(0);
     $path = Lua::get('path');
     $path = LUA_ROOT . $path . '/cache/update/';
     if (!file_exists($path)) {
         Lua::admin_msg('错误提示', '安装目录不存在');
     }
     // 第一步 频道数据
     $file = $path . 'channel.php';
     include $file;
     $data = $data[1];
     unset($data['id']);
     $data['createtime'] = time();
     $data['isdefault'] = 0;
     $channel_id = Lua::insert('lua_channel', $data);
     // 第二步 导入数据结构
     $file = $path . 'create.php';
     include $file;
     // 第三步 模型数据
     unset($data);
     $file = $path . 'model.php';
     include $file;
     $models = $data[1];
     $new_models = array();
     $new_tables_1 = array();
     // 栏目
     $new_tables_2 = array();
     // 碎片
     $new_tables_3 = array();
     // 插件
     unset($data);
     foreach ($models as $v) {
         $model_id = $v['id'];
         unset($v['id']);
         $v['createtime'] = time();
         $v['cid'] = $channel_id;
         $lastid = Lua::insert('lua_model', $v);
         $new_models[$model_id] = $lastid;
         // 第四步 数据表数据
         $file = $path . 'model.' . $model_id . '.php';
         include $file;
         $table = $data[1];
         switch ($v['mtype']) {
             case 1:
                 $new_tables_1 = array_merge($new_tables_1, $table);
                 break;
             case 2:
                 $new_tables_2 = array_merge($new_tables_2, $table);
                 break;
             case 3:
                 $new_tables_3 = array_merge($new_tables_3, $table);
                 break;
         }
         $this->__import($model_id, $lastid, $table, $path);
     }
     // 第七步 栏目数据
     $file = $path . 'cate.php';
     include $file;
     $cate = $data[1];
     $this->__cate(1, $new_models, $cate, $new_tables_1);
     unset($data);
     $file = $path . 'piece.php';
     include $file;
     $cate = $data[1];
     $this->__cate(2, $new_models, $cate, $new_tables_2);
     Doo::loadHelper('DooFile');
     $fileManager = new DooFile(0777);
     $fileManager->delete($path);
     Lua::admin_msg('信息提示', '导入成功', './channel.htm');
 }
Exemple #8
0
 public function E401()
 {
     Lua::admin_msg('权限提示', '你无权操作');
 }
Exemple #9
0
 private function del()
 {
     $id = intval(Lua::get('id'));
     $rs = Lua::get_one("select id from lua_category where tpl_id='{$id}'");
     if ($rs) {
         Lua::admin_msg('信息提示', '此模板已关联至某栏目下,不可删除');
     }
     $db = Lua::get_one("select * from lua_tpls where id='{$id}'");
     $file = $db['tplfile'];
     list($tpl, ) = explode('.', $file);
     if (file_exists($this->tpl_path . $file)) {
         unlink($this->tpl_path . $file);
     }
     if (file_exists($this->tpl_path . 'cache/' . $tpl . '.tpl.php')) {
         unlink($this->tpl_path . 'cache/' . $tpl . '.tpl.php');
     }
     Lua::delete('lua_tpls', array('id' => $id));
     Lua::admin_msg('信息提示', '操作成功', $this->_list($db['kindof']));
 }
Exemple #10
0
 private function del()
 {
     $uid = Lua::get('uid');
     $udb = Lua::get_one("select username from lua_member where uid='{$uid}'");
     Doo::db()->query("delete from lua_member where uid='{$uid}'");
     Lua::write_log($this->user, '删除注册会员', "uid={$uid}<br />username=" . $udb['username'], SYSNAME);
     Lua::admin_msg('提示信息', '成功删除', './member.htm');
 }
Exemple #11
0
 private function _pri($fields)
 {
     $pri = '';
     foreach ($fields as $v) {
         if ($v['Key'] == 'PRI') {
             $pri = $v['Field'];
             break;
         }
     }
     if (empty($pri)) {
         Lua::admin_msg('提示信息', '此数据表没有主键');
     }
     return $pri;
 }
Exemple #12
0
 private function del()
 {
     $uid = Lua::get('uid');
     $mdb = Lua::get_one("select * from lua_admin where uid='{$uid}'");
     Doo::db()->query("delete from lua_admin where uid='{$uid}'");
     $list = Lua::get_more("select * from lua_admin");
     $perms = array();
     foreach ($list as $v) {
         $perms[] = $v['perm'];
     }
     $perms = array_unique($perms);
     $aclfile = PROJECT_ROOT . 'config/acl.php';
     include $aclfile;
     foreach ($acl as $k => $v) {
         if (!in_array($k, $perms)) {
             unset($acl[$k]);
         }
     }
     $data = $this->_acl($acl);
     file_put_contents($aclfile, $data);
     Lua::write_log($this->user, '删除管理员', "uid={$uid}<br />title=" . $mdb['username'], SYSNAME);
     Lua::admin_msg('提示信息', '成功删除', './admin.htm');
 }