Ejemplo n.º 1
0
 private function home()
 {
     $mtype = Lua::get('mtype');
     $where = "";
     $url = "./model.htm";
     if ($mtype) {
         $where .= "and mtype='{$mtype}'";
         $url = "./model.htm?mtype={$mtype}";
     }
     $cid = Lua::get('cid');
     if ($cid) {
         $where .= " and cid='{$cid}' ";
         $url = $mtype ? "./model.htm?mtype={$mtype}&cid={$cid}" : "./model.htm?cid={$cid}";
     }
     $count = Doo::db()->count("select count(*) from lua_model where id>0 {$where}");
     $tpp = 20;
     $limit = ($this->page - 1) * $tpp . ',' . $tpp;
     $list = Lua::get_more("select * from lua_model where id>0 {$where} order by id desc limit " . $limit);
     $page = Lua::page($url, $this->page, $count, $tpp);
     $channels = $this->_channel();
     include Lua::display('model', $this->dir);
 }
Ejemplo n.º 2
0
 private function user()
 {
     $id = Lua::get('id');
     $db = $this->_model($id);
     $url = "./member.htm?action=user&id={$id}";
     $txt = Lua::get('txt');
     $and = "";
     if ($txt) {
         $and = " where u.username like binary '%{$txt}%' ";
         $url = "./member.htm?action=user&id={$id}&txt={$txt}";
     }
     $show = Lua::get_more("select name,fieldname from lua_member_model_field where systemname='" . SYSNAME . "' and model_id='{$id}' and status='1' order by vieworder asc,id desc");
     $count = Doo::db()->count("select count(*) from " . $db['tablename'] . " v left join lua_member u on u.uid=v.vuid {$and}");
     $tpp = 20;
     $limit = ($this->page - 1) * $tpp . ',' . $tpp;
     $list = Lua::get_more("select v.*,u.* from " . $db['tablename'] . " v left join lua_member u on u.uid=v.vuid {$and} order by u.uid desc limit " . $limit);
     $page = Lua::page($url, $this->page, $count, $tpp);
     $groups = Lua::get_more("select * from lua_member_model_group where systemname='" . SYSNAME . "' and model_id='{$id}' order by vieworder asc,id desc");
     $gps = array();
     foreach ($groups as $v) {
         $gps[$v['id']] = $v['name'];
     }
     include Lua::display('member_user', $this->dir);
 }
Ejemplo n.º 3
0
 private function home($isdel = 0)
 {
     $catid = Lua::get('catid');
     $this->_condition($catid);
     $Ftree = $this->_tree($this->cate_db['upid']);
     $Stree = $this->_tree($this->cate_db['id']);
     $and = "";
     $rec = Lua::get('rec');
     if ($rec) {
         $rec = "&rec=1";
         $isdel = 1;
     }
     // 下级模型数据处理
     $tableid = Lua::get('tableid');
     $tid = Lua::get('tid');
     $table_db = $this->_table_db($tableid);
     $db = $nav = array();
     $suffix = "";
     if ($table_db) {
         if (empty($tid)) {
             Lua::admin_msg('提示信息', '数据错误,请检查ID值');
         }
         $father_db = $this->_table_db($table_db['upid']);
         $db = $this->_db($father_db, $tid);
         $this->mode_db = $table_db;
         $nav = $this->_next_mods($this->mode_db['upid']);
         $suffix = "&tableid={$tableid}&tid={$tid}";
         $and = " and " . $father_db['subid'] . "='{$tid}' ";
     }
     $mods = $this->_next_mods($this->mode_db['id']);
     // end
     if ($this->mode_db['model_type'] == 1) {
         // 单页面模式
         if ($this->cate_db['add_perm'] == 0) {
             Lua::admin_msg('提示信息', '此栏目不允许添加内容');
         }
         $tpl = "content_single";
         $rs = Lua::get_one("select * from " . $this->mode_db['tablename'] . " where catid='{$catid}'");
         if (empty($rs)) {
             $rs = Lua::db_array($this->mode_db['tablename']);
             $hash = FILE_HASH;
         } else {
             $hash = $rs['hash'];
         }
         $fields = $this->_fields($this->mode_db);
         if (empty($father_db)) {
             $father_db['subid'] = '';
         }
         $action = "save_single&catid={$catid}" . $suffix . $this->lua_url;
     } else {
         // 列表模式
         $url = "./content.htm?catid={$catid}" . $suffix;
         $range = range(1, 9);
         $tpl = "content";
         $fields = $this->_fields($this->mode_db, 1);
         // soso
         $txt = Lua::get('txt');
         if ($txt) {
             $and .= " and subject like binary '%{$txt}%' ";
             $url .= "&txt={$txt}";
         }
         $topped = Lua::get('topped');
         if ($topped) {
             $and .= " and topped='{$topped}' ";
             $url .= "&topped={$topped}";
         }
         $commend = Lua::get('commend');
         if ($commend) {
             $and .= " and commend='{$commend}' ";
             $url .= "&commend={$commend}";
         }
         $catids = array();
         $catidb = array();
         $father = array();
         if ($Stree) {
             foreach ($Stree as $v) {
                 $catids[] = $v['id'];
                 $catidb[$v['id']] = $v;
             }
         }
         if ($this->cate_db['add_perm'] == 1) {
             $and .= " and catid='{$catid}' ";
             $father = Lua::get_one("select * from lua_" . $this->lua . " where id='" . $this->cate_db['upid'] . "'");
         } else {
             if ($catids) {
                 $and .= " and catid in (" . implode(',', $catids) . ")";
             }
         }
         // end
         $count = Doo::db()->count("select count(*) from " . $this->mode_db['tablename'] . " where isdel='{$isdel}' {$and}");
         $tpp = 20;
         $limit = ($this->page - 1) * $tpp . ',' . $tpp;
         $list = Lua::get_more("select * from " . $this->mode_db['tablename'] . " where isdel='{$isdel}' {$and} order by vieworder desc,id desc limit " . $limit);
         $page = Lua::page($url . $this->lua_url . $rec, $this->page, $count, $tpp);
         // 检查是否存在批量上传插件
         $pbu = 0;
         $plugin_batch_upload = LUA_ROOT . SYSNAME . '/plugin/batch/table/' . $tableid . '.txt';
         if (file_exists($plugin_batch_upload)) {
             $pbu = 1;
         }
         $same = $this->_same($this->cate_db['model_id']);
     }
     include Lua::display($tpl, $this->dir);
 }
Ejemplo n.º 4
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);
 }