Пример #1
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');
 }
Пример #2
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);
 }
Пример #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');
 }
Пример #4
0
 private function __import($model_id, $lastid, $table, $path, $id = 0, $new_id = 0, $subid = '', $subval = array())
 {
     foreach ($table as $t) {
         if ($t['upid'] == $id) {
             $old_id = $t['id'];
             unset($t['id']);
             $t['upid'] = $new_id;
             $t['createtime'] = time();
             $t['model_id'] = $lastid;
             $table_id = Lua::insert('lua_model_table', $t);
             // 第五步 导入数据表结构
             $file = $path . 'field.' . $model_id . '.' . $old_id . '.php';
             include $file;
             $data = $data[1];
             foreach ($data as $v) {
                 unset($v['id']);
                 $v['updatetime'] = time();
                 $v['model_id'] = $lastid;
                 $v['table_id'] = $table_id;
                 Lua::insert('lua_model_field', $v);
             }
             unset($data);
             // 第六步 导入数据
             $file = $path . 'data.' . $old_id . '.php';
             include $file;
             $data = $data[1];
             $out = array();
             if ($data) {
                 foreach ($data as $v) {
                     $vid = $v['id'];
                     unset($v['id']);
                     if (isset($v[$subid])) {
                         $v[$subid] = $subval[$v[$subid]];
                     }
                     $nid = Lua::insert($t['tablename'], $v);
                     $out[$vid] = $nid;
                 }
             }
             unset($data);
             $this->__import($model_id, $lastid, $table, $path, $old_id, $table_id, $t['subid'], $out);
         }
     }
 }
Пример #5
0
 private function save()
 {
     $name = Lua::post('name');
     $kindof = Lua::post('kindof');
     $tplfile = Lua::post('tplfile');
     if (empty($name)) {
         Lua::ajaxmessage('error', '模板名称');
     }
     if (empty($kindof)) {
         Lua::ajaxmessage('error', '模板类型');
     }
     if (empty($tplfile)) {
         Lua::ajaxmessage('error', '模板文件名');
     }
     if (file_exists($this->tpl_path . $tplfile)) {
         Lua::ajaxmessage('error', $tplfile . ' 已存在');
     }
     $query = array('systemname' => SYSNAME, 'name' => $name, 'kindof' => $kindof, 'dateline' => TIMESTAMP, 'lasttime' => TIMESTAMP, 'uid' => $this->user['uid'], 'username' => $this->user['username'], 'tplfile' => $tplfile);
     Lua::insert('lua_tpls', $query);
     Lua::ajaxmessage('success', '操作成功', $this->_url($kindof));
 }
Пример #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');
 }
Пример #7
0
 private function save_any_edit()
 {
     $tableid = Lua::get('tableid');
     $db = $this->_table($tableid);
     $fields = $this->_fields($db['tablename']);
     $pri = $this->_pri($fields);
     $var = Lua::get($pri);
     $post = Lua::post('post');
     $lastid = Lua::insert($db['tablename'], $post, 1);
     Lua::write_log($this->user, '修改任意数据', "table=" . $db['tablename'] . "<br />id={$lastid}<br />title=" . $post['subject'], SYSNAME);
     Lua::ajaxmessage('success', '操作成功', "./piece.htm?action=any&tableid={$tableid}");
 }
Пример #8
0
 private function save_add()
 {
     $username = Lua::post('username');
     if (empty($username)) {
         Lua::ajaxmessage('error', '用户名');
     }
     $password = Lua::post('password');
     $confirm_password = Lua::post('confirm_password');
     if (empty($password)) {
         Lua::ajaxmessage('error', '密码');
     }
     if ($password != $confirm_password) {
         Lua::ajaxmessage('error', '二次密码不相同');
     }
     $perm = Lua::post('perm');
     if (empty($perm)) {
         Lua::ajaxmessage('error', '用户组');
     }
     $channel = Lua::post('channel');
     if (empty($channel)) {
         Lua::ajaxmessage('error', '所属频道');
     }
     $sqlarr = array('gid' => Lua::post('gid'), 'loginip' => $this->clientIP(), 'password' => md5($password), 'perm' => $perm, 'username' => $username, 'logintime' => time(), 'channel' => $channel);
     $lastid = Lua::insert('lua_admin', $sqlarr);
     Lua::write_log($this->user, '增加管理员', "uid={$lastid}<br />title={$username}", SYSNAME);
     Lua::ajaxmessage('success', '操作成功', './admin.htm');
 }