Пример #1
0
 function get_list($condition = '1', $order = 'listorder DESC, itemid DESC')
 {
     global $MOD, $TYPE, $pages, $page, $pagesize, $offset, $sum;
     if ($page > 1 && $sum) {
         $items = $sum;
     } else {
         $r = $this->db->get_one("SELECT COUNT(*) AS num FROM {$this->table} WHERE {$condition}");
         $items = $r['num'];
     }
     $pages = pages($items, $page, $pagesize);
     if ($items < 1) {
         return array();
     }
     $lists = array();
     $result = $this->db->query("SELECT * FROM {$this->table} WHERE {$condition} ORDER BY {$order} LIMIT {$offset},{$pagesize}");
     while ($r = $this->db->fetch_array($result)) {
         $r['title'] = set_style($r['title'], $r['style']);
         $r['adddate'] = timetodate($r['addtime'], 5);
         $r['editdate'] = timetodate($r['edittime'], 5);
         $r['typename'] = $TYPE[$r['typeid']]['typename'];
         $r['typeurl'] = $MOD['link_url'] . list_url($r['typeid']);
         $lists[] = $r;
     }
     return $lists;
 }
Пример #2
0
/**
 * 当前路径 
 * 返回指定分类路径层级
 * @param $typeid 分类id
 * @param $symbol 分类间隔符
 */
function wap_pos($typeid, $symbol = ' > ')
{
    $type_arr = array();
    $type_arr = getcache('wap_type', 'wap');
    if (!isset($type_arr[$typeid])) {
        return '';
    }
    $pos = '';
    if ($type_arr[$typeid]['parentid'] != 0) {
        $pos = '<a href="' . list_url($type_arr[$typeid]['parentid']) . '">' . $type_arr[$type_arr[$typeid]['parentid']]['typename'] . '</a>' . $symbol;
    }
    $pos .= '<a href="' . list_url($typeid) . '">' . $type_arr[$typeid]['typename'] . '</a>' . $symbol;
    return $pos;
}
Пример #3
0
 function site_url($value, $extend = "", $format = true, $format_type_ext = "&amp;")
 {
     $app = sys_init();
     if (!$value) {
         return $app->url();
     }
     if (!$format || $app->sys_config["site_type"] != "html" && $app->sys_config["site_type"] != "rewrite") {
         return $app->url($value, $extend, $format_type_ext);
     }
     if ($app->sys_config["site_type"] == "html" && !$app->sys_config["sitehtml"]) {
         $app->sys_config["sitehtml"] = $app->sys_config["siteurl"] . "html/" . $app->langid . "/";
     }
     $format_type = $app->sys_config["site_type"];
     //切分地址
     $ext = explode(",", $value);
     $c = $ext[0];
     if (!$c) {
         return false;
     }
     if (!$c != "list" || $c != "msg") {
         return $app->url($value, $extend, $format_type_ext);
     }
     $f = $ext[1] ? $ext[1] : "";
     $d = $ext[2] ? $ext[2] : "";
     if ($extend) {
         $array = explode("&", $extend);
         foreach ($array as $k => $v) {
             $tmp_array = explode("=", $v);
             ${$tmp_array}[0] = $tmp_array[1];
         }
     }
     if ($c == "list" && $extend) {
         if ($cid || $cs) {
             if ($format_type == "rewrite") {
                 $url = $cid ? "cid-" . $cid : "cs-" . $cs;
                 if ($pageid && $pageid > 1) {
                     $url .= "-" . $pageid;
                 }
                 $url .= ".html";
                 return $url;
             } else {
                 $app->load_model("cate");
                 if (!$cid && $cs) {
                     $cid = $app->cate_m->get_cid_from_code($cs);
                 }
                 if ($cid) {
                     $rs = $app->cate_m->get_one($cid);
                     return list_url($rs);
                 }
             }
         } else {
             if ($format_type == "rewrite") {
                 $url = $mid ? "mid-" . $mid : "ms-" . $ms;
                 if ($pageid && $pageid > 1) {
                     $url .= "-" . $pageid;
                 }
                 $url .= ".html";
                 return $url;
             } else {
                 $app->load_model("module");
                 if ($ms && !$mid) {
                     $mid = $app->module_m->get_mid_from_code($ms);
                 }
                 if ($mid) {
                     $rs = $app->module_m->get_one($mid);
                     return module_url($rs);
                 }
             }
         }
     } elseif ($c == "msg" && $extend) {
         if ($format_type == "rewrite") {
             $url = $id ? "c" . $id . ".html" : $ts . ".html";
             return $url;
         } else {
             $app->load_model("msg");
             if ($id) {
                 $rs = $app->msg_m->get_one($id);
             } else {
                 $rs = $app->msg_m->get_one_fromtype($ts, $_SESSION["sys_lang_id"]);
             }
             return msg_url($rs);
         }
     }
     return $app->url($value, $extend, $format_type_ext);
 }
Пример #4
0
if (!defined('PHPOK_SET')) {
    die('<h3>Error...</h3>');
}
if ($cid) {
    $_catelist = phpok_catelist($cid);
    if ($_catelist[rslist]) {
        ?>

		<?php 
        $_i = 0;
        $_catelist[rslist] = is_array($_catelist[rslist]) ? $_catelist[rslist] : array();
        foreach ($_catelist[rslist] as $key => $value) {
            $_i++;
            ?>
<li><a href="<?php 
            echo list_url($value);
            ?>
" id="<?php 
            echo $value[id] == $cid ? 'hov' : 'parent';
            ?>
" title="<?php 
            echo $value[cate_name];
            ?>
"><?php 
            echo $value[cate_name];
            ?>
</a></li>
		
		<?php 
        }
        ?>
Пример #5
0
 function index_module($mid)
 {
     //判断权限
     $popedom = sys_user_popedom("read");
     //获取阅读权限
     if (!$popedom || !$popedom["module"]) {
         error($this->lang["not_popedom"], site_url("usercp"));
     }
     if ($popedom != "all" && !in_array($mid, $popedom["module"])) {
         error($this->lang["not_popedom"], site_url("usercp"));
     }
     $rs = $this->module_m->get_one($mid);
     $this->tpl->assign("mid", $mid);
     $this->tpl->assign("m_rs", $rs);
     $this->phpok_seo($rs);
     $this->tplfile = "list_" . $rs["identifier"];
     if (!$rs["status"]) {
         error($this->lang["module_is_close"], HOME_PAGE);
     }
     //判断是否有分类,且分类路至主题
     if (!$rs["if_list"] && $rs["if_msg"]) {
         $msg_rs = $this->module_m->get_module_sub_one($mid);
         $header_url = msg_url($msg_rs);
         sys_header($header_url);
     } else {
         $list_rs = $this->module_m->get_module_cateid($mid);
         if ($list_rs) {
             $header_url = list_url($list_rs);
             sys_header($header_url);
             exit;
         }
         $sitetitle = $rs["title"];
         $this->tpl->assign("sitetitle", $sitetitle);
         $leader[0] = array("title" => $rs["title"]);
         $this->tpl->assign("leader", $leader);
         //读取列表信息
         $pageid = $this->trans_lib->int(SYS_PAGEID);
         $pageurl = module_url($rs, 0, true, false);
         //读取列表数据
         $this->list_m->set_module($rs);
         $this->list_m->langid($_SESSION["sys_lang_id"]);
         $total = $this->list_m->get_count_from_cate();
         //取得总数量
         $this->tpl->assign("total", $total);
         $psize = $rs["psize"] ? $rs["psize"] : SYS_PSIZE;
         $offset = $pageid > 0 ? ($pageid - 1) * $psize : 0;
         $this->page_lib->set_psize($psize);
         $pagelist = $this->page_lib->page_www($pageurl, $total, true);
         //分页数组
         $this->tpl->assign("pagelist", $pagelist);
         $rslist = $this->list_m->get_list_from_cate($offset, $psize);
         $this->tpl->assign("rslist", $rslist);
         $this->tpl->display("list_" . $rs["identifier"] . "." . $this->tpl->ext);
     }
 }
Пример #6
0
 function urllist_f()
 {
     //设置语言包
     $this->cate_m->set_langid($_SESSION["sys_lang_id"]);
     $this->cate_m->get_catelist(0, "c.if_hidden='0' AND (m.if_list='1' OR m.if_msg='1') ");
     $catelist = $this->cate_m->catelist;
     $cate_count = count($catelist);
     $rslist = array();
     if ($this->sys_config['site_type'] != "html") {
         $myurl_pre = $this->sys_config["siteurl"];
     } else {
         $myurl_pre = $this->sys_config["sitehtml"] ? $this->sys_config["sitehtml"] : $this->sys_config["siteurl"] . "html/" . $_SESSION["sys_lang_id"] . "/";
     }
     if ($catelist && is_array($catelist) && $cate_count > 0) {
         foreach ($catelist as $key => $value) {
             $myurl = list_url($value);
             $chke_url = strtolower(substr($myurl, 0, 7));
             if ($chke_url != "http://" && $chke_url != "https:/") {
                 $myurl = $myurl_pre . $myurl;
             }
             $rslist[] = array("title" => $value["title"], "url" => $myurl);
         }
     }
     $max = 49999 - $cate_count;
     //取得主题列表
     $this->list_m->langid($_SESSION["sys_lang_id"]);
     $sublist = $this->list_m->getlist_for_sitemap($max);
     if ($sublist && is_array($sublist) && count($sublist) > 0) {
         foreach ($sublist as $key => $value) {
             $myurl = msg_url($value);
             $chke_url = strtolower(substr($myurl, 0, 7));
             if ($chke_url != "http://" && $chke_url != "https:/") {
                 $myurl = $myurl_pre . $myurl;
             }
             $rslist[] = array("title" => $value["title"], "url" => $myurl);
         }
     }
     foreach ($rslist as $key => $value) {
         $txt .= "" . $value["url"] . "\n";
     }
     exit($txt);
 }
Пример #7
0
 function getIndexData()
 {
     $this->emuleIndex['new'] = $this->getArticleListByCid(0, 0, 1, 15);
     sleep(2);
     $this->emuleIndex['hot'] = $this->getArticleListByCid(0, 2, 1, 15);
     sleep(2);
     $this->emuleIndex['rand'] = $this->getArticleListByCid(0, 1, 1, 15);
     sleep(2);
     $rootCate = $this->getrootCate();
     $list = array();
     foreach ($rootCate as $cate) {
         sleep(2);
         $list = $this->getArticleListByCid($cate['id'], 2, 1, 13);
         //echo '<pre>';var_dump($list);exit;
         $this->emuleIndex['catehot'][] = array('name' => $cate['name'], 'id' => $cate['id'], 'list' => $list, 'url' => list_url($cate['id']));
         //List article
         sleep(2);
         $subcate = $this->getAllSubcateByCid($cate['id'], 13);
         $list = array();
         foreach ($subcate as $val) {
             sleep(2);
             $list[] = $this->getArticleListByCid($val['id'], 0, 1, 15);
         }
         $this->emuleIndex['topiclist'][] = array('rand' => $this->getArticleListByCid($cate['id'], 1, 1, 20), 'subcate' => array('cate' => $subcate, 'list' => $list));
     }
     $this->mem->set('emutest-emuleIndexinfo', $this->emuleIndex, 691200);
 }