function show_action() { if (!front::get('aid')) front::$get['aid'] = front::get('id'); front::check_type(front::$get['aid']); $this->view->aid = trim(front::get('aid')); $this->view->archive = archive::getInstance()->getrow(front::get('aid')); $this->view->categorys = category::getpositionlink2($this->view->archive['catid']); if (!is_array($this->view->archive)) $this->out('message/error.html'); if ($this->view->archive['checked'] < 1) exit(lang('未审核!<a href="'.front::$from.'">返回</a>')); if (!rank::arcget(front::get('aid'), $this->view->usergroupid)) { $this->out('message/error.html'); } $this->view->catid = $this->view->archive['catid']; $this->view->topid = category::gettopparent($this->view->catid); $this->view->parentid = $this->category->getparent($this->view->catid); if (!rank::catget($this->view->catid, $this->view->usergroupid)) $this->out('message/error.html'); if (!isset($this->category->category[$this->view->catid]) || !isset($this->category->category[$this->view->topid])) { } $template = @$this->view->archive['template']; $linkword = new linkword(); $linkwords = $linkword->getrows(null, 1000, 'linkorder desc'); $content = $this->view->archive['content']; $contents = preg_split('%<div style="page-break-after(.*?)</div>%si', $content); if ($contents) { $this->view->pages = count($contents); front::$record_count = $this->view->pages * config::get('list_pagesize'); $content = $contents[$this->view->page - 1]; } //$content = preg_replace("/(<a(.*))(>)(.*)(<)(\/a>)/isU", '\\1-]-\\4-[-\\6', $content); foreach ($linkwords as $linkword) { $linkword['linktimes'] = (int) $linkword['linktimes']; if (trim($linkword['linkurl']) && !preg_match('%^http://$%', trim($linkword['linkurl']))) { $link = "<a href='$linkword[linkurl]' target='_blank'>$linkword[linkword]</a>"; } else { $link = "<a href='" . url('archive/search/keyword/' . urlencode($linkword['linkword'])) . "' target='_blank'>$linkword[linkword]</a>"; } $content = _keylinks($content,$linkword['linkword'],$link,$linkword['linktimes']); } $this->view->likenews = $this->getLike($this->view->archive['tag'], $this->view->archive['keyword']); $taghtml = ''; $tag_table = new tag(); foreach ($tag_table->urls($this->view->archive['tag']) as $tag => $url) { $taghtml.="<a href='$url' target='_blank'>$tag</a> "; } $this->view->archive['tag'] = $taghtml; $this->view->archive['special'] = null; if ($this->view->archive['spid']) { $spurl = special::url($this->view->archive['spid'],special::getishtml($this->view->archive['spid'])); $sptitle = special::gettitle($this->view->archive['spid']); $this->view->archive['special'] = "<a href='$spurl' target='_blank'>$sptitle</a> "; } $this->view->archive['type'] = null; if ($this->view->archive['typeid']) { $typeurl = type::url($this->view->archive['typeid'],1); $typetitle = type::name($this->view->archive['typeid']); $this->view->archive['type'] = "<a href='$typeurl' target='_blank'>$typetitle</a> "; } $this->view->archive['area'] = null; $this->view->archive['area'] = area::getpositonhtml($this->view->archive['province_id'], $this->view->archive['city_id'], $this->view->archive['section_id']); $this->view->archive['content'] = $content; $aid = front::$get['aid']; $catid = $this->view->catid; if(!$this->view->archive['showform']) { $this->getshowform($catid); }else if($this->view->archive['showform'] && $this->view->archive['showform'] == '1') { $this->showform = 1; }else { $this->showform = $this->view->archive['showform']; } if(preg_match('/^my_/is',$this->showform)) { $this->view->archive['showform'] = $this->showform; $o_table = new defind($this->showform); front::$get['form'] = $this->showform; $this->view->primary_key = $o_table->primary_key; $field = $o_table->getFields(); $fieldlimit = $o_table->getcols('user_modify'); helper::filterField($field,$fieldlimit); $this->view->field = $field; }else { $this->view->archive['showform'] = ''; } $str = ""; cb_data($this->view->archive); foreach( $this->view->archive as $key => $value){ if(!preg_match('/^my/',$key) || !$value) continue; $category = category::getInstance(); $sonids = $category->sons(setting::$var['archive'][$key]['catid']); if(setting::$var['archive'][$key]['catid'] != $this->view->archive['catid'] && !in_array($this->view->archive['catid'],$sonids) && (setting::$var['archive'][$key]['catid'])){ unset($this->view->field[$key]); continue; } $str .= '<p> '.setting::$var['archive'][$key]['cname'].':'. $value.'</p>'; } $this->view->archive['my_fields'] = $str; $sql1 = "SELECT aid,title,catid FROM `{$this->archive->name}` WHERE catid = '$catid' AND aid > '$aid' ORDER BY aid ASC LIMIT 0,1"; $sql2 = "SELECT aid,title,catid FROM `{$this->archive->name}` WHERE catid = '$catid' AND aid < '$aid' ORDER BY aid DESC LIMIT 0,1"; $n = $this->archive->rec_query_one($sql1); $p = $this->archive->rec_query_one($sql2); $this->view->archive['p'] = $p; $this->view->archive['n'] = $n; $this->view->archive['p']['url'] = archive::url($p); $this->view->archive['n']['url'] = archive::url($n); $this->view->archive['strgrade'] = archive::getgrade($this->view->archive['grade']); $prices = getPrices($this->view->archive['attr2']); $this->view->archive['attr2'] = $prices['price']; $this->view->archive['oldprice'] = $prices['oldprice']; $this->view->groupname = $prices['groupname']; //$this->view->archive['pics'] = unserialize($this->view->archive['pics']); if(is_array($this->view->archive['pics']) && !empty($this->view->archive['pics'])){ foreach ($this->view->archive['pics'] as $k => $v){ if(strtolower(substr($v,0,7)) == 'http://'){ $this->view->archive['pics'][$k] = $v; }else{ $this->view->archive['pics'][$k] = $v; } } } //$this->view->archive['pics'] = unserialize($this->view->archive['pics']); //var_dump($this->view->archive); if (front::get('t') == 'wap') { $tpl = category::gettemplate($this->view->catid, 'showtemplatewap'); if(!$tpl) $tpl = 'wap/show.html'; $this->out($tpl); return; } if ($template && file_exists(TEMPLATE . '/' . $this->view->_style . '/' . $template)) $this->out($template); else { $tpl = category::gettemplate($this->view->catid, 'showtemplate'); if (category::getarcishtml($this->view->archive)) { $path = ROOT . archive::url($this->view->archive); if (!preg_match('/\.[a-zA-Z]+$/', $path)) $path = rtrim(rtrim($path, '/'), '\\') . '/index.html'; $this->cache_path = $path; } $this->out($tpl); } }
function index_archive($catid) { $index_archive = new archive(); $index_category = category::getInstance(); $index_view_category = $index_category->category; if (front::get('page')) $page = front::get('page'); else $page = 1; $index_view_page = $page; front::check_type($page); $_catpage = category::categorypages($catid); if ($_catpage) { $index_pagesize = $_catpage; } else { $index_pagesize = config::get('list_pagesize'); } front::check_type($index_pagesize); $index_view_categorys = category::getpositionlink2($catid); $topid = category::gettopparent($catid); if (!isset($index_category->category[$catid]) || !isset($index_category->category[$topid])) { $this->out('message/error.html'); } $limit = (($index_view_page - 1) * $index_pagesize) . ',' . $index_pagesize; $categories = array(); if (@$index_category->category[$catid]['ispages']) $categories = $index_category->sons($catid); $categories[] = $catid; $index_view_pages = @$index_category->category[$catid]['ispages']; if (!rank::catget($catid, $index_view_usergroupid)) $this->out('message/error.html'); $order = "`listorder` asc,`adddate` DESC"; if (@$index_category->category[$catid]['includecatarchives']) $articles = $index_archive->getrows('catid in (' . implode(',', $categories) . ') and checked=1', $limit, $order); else $articles = $index_archive->getrows('catid=' . $catid . ' and checked=1', $limit, $order); if (!is_array($articles)) { $this->out('message/error.html'); } foreach ($articles as $order => $arc) { $articles[$order]['url'] = archive::url($arc); $articles[$order]['catname'] = category::name($arc['catid']); $articles[$order]['caturl'] = category::url($arc['catid']); $articles[$order]['adddate'] = sdate($arc['adddate']); $articles[$order]['stitle'] = strip_tags($arc['title']); $articles[$order]['strgrade'] = archive::getgrade($arc['grade']); } $index_view_archives = $articles; if (@$index_category->category[$catid]['includecatarchives']) $index_view_record_count = $index_archive->rec_count('catid in(' . implode(',', $categories) . ')'); else $index_view_record_count = $index_archive->rec_count('catid=' . $catid); front::$record_count = $index_view_record_count; return $index_view_archives; }