Ejemplo n.º 1
0
 public function index()
 {
     if ($this->user['perm'] != SUPER_MAN && SYSNAME != $this->user['channel']) {
         header("Location:/" . $this->user['channel'] . '/admin/');
         exit;
     }
     $list = Lua::get_more("select * from lua_channel where status='1'");
     $cssname = 'nav_list';
     if (SYSNAME != ADMIN_ROOT) {
         $session = Doo::session('Lua');
         $change_id = $session->get('change_id');
         $set = Lua::get('set');
         if ($set) {
             $session->change_id = empty($change_id) || $change_id == 0 ? 1 : 0;
             header("Location:/" . SYSNAME . "/" . ADMIN_ROOT . "/");
             exit;
         }
         $set_id = $change_id || $change_id == 1 ? 1 : 0;
         if ($set_id == 0) {
             Doo::cache('php')->hashing = false;
             $tree = Doo::cache('php')->get('category');
             $cssname = 'tree_list';
             $html = '';
             if ($tree) {
                 $html = $this->_tree($tree, 0);
             }
         }
     }
     include Lua::display('frame', $this->dir);
 }
Ejemplo n.º 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');
 }
Ejemplo n.º 3
0
 private function save_edit()
 {
     $name = Lua::post('name');
     if (empty($name)) {
         Lua::ajaxmessage('error', '栏目名称');
     }
     $model_id = Lua::post('model_id');
     if (empty($model_id)) {
         Lua::ajaxmessage('error', '请选择模型');
     }
     $filename = Lua::post('filename');
     if (empty($filename)) {
         Lua::ajaxmessage('error', '静态名称');
     }
     $id = Lua::get('id');
     $upid = Lua::post('upid');
     if ($id == $upid) {
         Lua::ajaxmessage('error', '父级栏目不能是自己');
     }
     $sqlarr = array('filename' => $filename, 'model_id' => $model_id, 'name' => $name, 'upid' => $upid, 'add_perm' => Lua::post('add_perm'), 'seoinfo' => Lua::post('seoinfo'), 'seokey' => Lua::post('seokey'), 'title' => Lua::post('title'), 'vieworder' => Lua::post('vieworder'));
     Lua::update('lua_category', $sqlarr, array('id' => $id));
     $this->_cache();
     Lua::write_log($this->user, '修改栏目', "catid={$id}<br />title=" . $name, SYSNAME);
     Lua::ajaxmessage('success', '操作成功', './category.htm');
 }
Ejemplo n.º 4
0
 private function save_edit()
 {
     $modelname = Lua::post('modelname');
     if (empty($modelname)) {
         Lua::ajaxmessage('error', '模型名称');
     }
     $developer = Lua::post('developer');
     if (empty($developer)) {
         Lua::ajaxmessage('error', '开发者');
     }
     $contact = Lua::post('contact');
     if (empty($contact)) {
         Lua::ajaxmessage('error', '联系方式');
     }
     $intro = Lua::post('intro');
     if (empty($intro)) {
         Lua::ajaxmessage('error', '模型描述');
     }
     $sqlarr = array('contact' => $contact, 'developer' => $developer, 'modelname' => $modelname, 'intro' => $intro);
     $id = Lua::get('id');
     $where = array('id' => $id);
     Lua::update('lua_model', $sqlarr, $where);
     $db = $this->_get($id, 1);
     Lua::write_log($this->user, '修改模型', "model_id={$id}<br />modelname=" . $db['modelname'], SYSNAME);
     Lua::ajaxmessage('success', '操作成功', './model.htm');
 }
Ejemplo n.º 5
0
 private function save()
 {
     $catid = Lua::get('catid');
     $this->_condition($catid, 1);
     // 数据模型处理
     $tableid = Lua::get('tableid');
     $tid = Lua::get('tid');
     $table_db = $this->_table_db($tableid);
     $suffix = "";
     if ($table_db) {
         $this->mode_db = $table_db;
         $suffix = "&tableid={$tableid}&tid={$tid}";
     }
     // end
     $query = $this->_query($this->mode_db);
     if (!is_array($query)) {
         Lua::ajaxmessage('error', $query);
     }
     $hash = Lua::post('hash');
     $query['catid'] = $catid;
     $query['dateline'] = time();
     $query['ip'] = $this->clientIP();
     $query['isdel'] = 0;
     $query['uid'] = $this->user['uid'];
     $query['username'] = $this->user['username'];
     $query['hash'] = $hash;
     $query['color'] = Lua::post('color');
     $id = Lua::insert($this->mode_db['tablename'], $query);
     Doo::db()->query("update lua_files set used='1' where hash='{$hash}'");
     Lua::write_log($this->user, '增加信息', "catid={$catid}<br />id={$id}<br />title=" . $query['subject'], SYSNAME);
     Lua::ajaxmessage('success', '操作成功', "./content.htm?catid={$catid}" . $suffix . $this->lua_url);
 }
Ejemplo n.º 6
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');
 }
Ejemplo n.º 7
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']));
 }
Ejemplo n.º 8
0
 private function save_edit()
 {
     $uid = Lua::get('uid');
     $sqlarr['email'] = Lua::post('email');
     $password = Lua::post('password');
     if ($password) {
         if ($password != Lua::post('confirm_password')) {
             Lua::ajaxmessage('error', '二次密码不相同');
         }
         $sqlarr['password'] = md5($password);
     }
     Lua::update('lua_member', $sqlarr, array('uid' => $uid));
     $udb = Lua::get_one("select username from lua_member where uid='{$uid}'");
     Lua::write_log($this->user, '修改注册会员', "uid={$uid}<br />username=" . $udb['username'], SYSNAME);
     Lua::ajaxmessage('success', '操作成功', './member.htm');
 }
Ejemplo n.º 9
0
 private function any()
 {
     $tableid = Lua::get('tableid');
     $db = array();
     if ($tableid) {
         $db = $this->_table($tableid);
     }
     if ($db) {
         $url = "./piece.htm?action=any&tableid={$tableid}";
         $fields = $this->_fields($db['tablename']);
         $count = Doo::db()->count("select count(*) from " . $db['tablename']);
         $tpp = 30;
         $limit = ($this->page - 1) * $tpp . ',' . $tpp;
         $pri = $this->_pri($fields);
         $list = Lua::get_more("select * from " . $db['tablename'] . " order by {$pri} desc limit " . $limit);
         $page = Lua::page($url, $this->page, $count, $tpp);
     }
     include Lua::display('piece_any', $this->dir);
 }
Ejemplo n.º 10
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');
 }