Exemple #1
0
 public function logout()
 {
     $session = Doo::session('Lua');
     $auth = $session->get('auth');
     $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 ($user) {
         Lua::write_log($user, '退出系统', '---', $user['channel']);
     }
     $session->auth = '';
     Lua::admin_msg('操作提示', '成功退出系统', '/' . ADMIN_ROOT);
 }
Exemple #2
0
 private function save()
 {
     $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', '静态名称');
     }
     $sqlarr = array('add_perm' => Lua::post('add_perm'), 'name' => $name, 'seoinfo' => Lua::post('seoinfo'), 'seokey' => Lua::post('seokey'), 'title' => Lua::post('title'), 'vieworder' => Lua::post('vieworder'), 'filename' => $filename, 'model_id' => $model_id, 'systemname' => SYSNAME, 'upid' => Lua::post('upid'));
     $lastid = Lua::insert('lua_category', $sqlarr);
     $this->_cache();
     Lua::write_log($this->user, '添加栏目', "catid={$lastid}<br />title=" . $name, SYSNAME);
     Lua::ajaxmessage('success', '操作成功', './category.htm');
 }
Exemple #3
0
 private function save_add()
 {
     $cid = Lua::post('cid');
     if (empty($cid)) {
         Lua::ajaxmessage('error', '请选择所属频道');
     }
     $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', '模型描述');
     }
     $prefix = Lua::post('prefix');
     if (empty($prefix)) {
         Lua::ajaxmessage('error', '模型前缀');
     }
     $sqlarr = array('contact' => $contact, 'createtime' => time(), 'developer' => $developer, 'intro' => $intro, 'modelname' => $modelname, 'status' => 1, 'prefix' => $prefix, 'mtype' => Lua::post('mtype'), 'cid' => $cid);
     $id = Lua::insert('lua_model', $sqlarr);
     Lua::write_log($this->user, '增加模型', "model_id={$id}<br />modelname={$modelname}", SYSNAME);
     Lua::ajaxmessage('success', '操作成功', './model.htm');
 }
Exemple #4
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);
 }
Exemple #5
0
 private function del()
 {
     $id = Lua::get('id');
     $db = Lua::get_one("select * from lua_channel where id='{$id}'");
     Lua::delete('lua_channel', array('id' => $id));
     Lua::delete('lua_category', array('systemname' => $db['path']));
     Lua::delete('lua_piece', array('systemname' => $db['path']));
     $list = Lua::get_more("select * from lua_model where cid='{$id}'");
     if ($list) {
         foreach ($list as $v) {
             $table = Lua::get_more("select * from lua_model_table where model_id='" . $v['id'] . "'");
             if ($table) {
                 foreach ($table as $t) {
                     Doo::db()->query("drop table `" . $t['tablename'] . "`");
                 }
             }
             Lua::delete('lua_model_table', array('model_id' => $v['id']));
             Lua::delete('lua_model_field', array('model_id' => $v['id']));
         }
     }
     Lua::delete('lua_model', array('cid' => $id));
     Lua::write_log($this->user, '删除频道', "id={$id}<br />title=" . $db['name'], SYSNAME);
     Lua::admin_msg('提示信息', '操作成功', './channel.htm');
 }
Exemple #6
0
 private function save_add()
 {
     $username = Lua::post('username');
     if (empty($username)) {
         Lua::ajaxmessage('error', '用户名');
     }
     $password = Lua::post('password');
     if (empty($password)) {
         Lua::ajaxmessage('error', '登录密码');
     }
     if ($password != Lua::post('confirm_password')) {
         Lua::ajaxmessage('error', '二次密码不相同');
     }
     $count = Doo::db()->count("select count(*) from lua_member where username='******'");
     if ($count > 0) {
         Lua::ajaxmessage('error', '此用户名已被使用');
     }
     $sqlarr = array('email' => Lua::post('email'), 'lastip' => $this->clientIP(), 'lasttime' => time(), 'password' => md5($password), 'regip' => $this->clientIP(), 'regtime' => time(), 'status' => 1, 'username' => $username);
     $uid = Lua::insert('lua_member', $sqlarr);
     Lua::write_log($this->user, '增加注册会员', "uid={$uid}<br />username={$username}", SYSNAME);
     Lua::ajaxmessage('success', '操作成功', './member.htm');
 }
Exemple #7
0
 private function del_any()
 {
     $tableid = Lua::get('tableid');
     $db = $this->_table($tableid);
     $fields = $this->_fields($db['tablename']);
     $pri = $this->_pri($fields);
     $var = Lua::get($pri);
     $sdb = Lua::get_one("select subject from " . $db['tablename'] . " where {$pri}='{$var}'");
     Doo::db()->query("delete from " . $db['tablename'] . " where {$pri}='{$var}'");
     Lua::write_log($this->user, '删除任意数据', "table=" . $db['tablename'] . "<br />{$pri}={$var}<br />title=" . $sdb['subject'], SYSNAME);
     Lua::admin_msg('提示信息', '成功删除', "./piece.htm?action=any&tableid={$tableid}");
 }
Exemple #8
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');
 }