function show_action() { $this->view->page=front::get('page')?front::get('page'):1; $this->pagesize=config::get('list_pagesize'); $limit=(($this->view->page-1)*$this->pagesize).','.$this->pagesize; $special=new special(); $this->view->special=$special->getrow('spid='.front::get('spid')); $this->view->archive['title'] = $this->view->special['title']; $this->view->pages=true; $archive=new archive(); $archives=$archive->getrows('spid='.front::get('spid'),$limit); foreach($archives as $order=>$arc) { $archives[$order]['url']=archive::url($arc); $archives[$order]['catname']=category::name($arc['catid']); $archives[$order]['caturl']=category::url($arc['catid']); $archives[$order]['adddate']= sdate($arc['adddate']); $archives[$order]['stitle']= strip_tags($arc['title']); } $this->view->archives=$archives; $this->view->record_count=$archive->rec_count('spid='.front::get('spid')); front::$record_count=$this->view->record_count; $this->view->spid=front::get('spid'); if (front::get('t') == 'wap') { $this->out('wap/special_show.html'); return; } }
function delete_before() { $tbname = config::get('database','prefix').'archive'; $typeid = front::$get['id']; $where = "typeid = '$typeid'"; $arc=new archive(); $arc->rec_delete($tbname,$where); }
function delete_action() { chkpw('defined_form_del'); $table=new defind(front::get('table')); $delete=archive::getInstance()->query("DROP TABLE {$table->name}"); if($delete) front::flash("删除表单成功!"); front::redirect(url::modify('act/listform/table/'.$table->name)); }
public static function check_money($id,$money) { $where=array(); $where['id']=$id; $orders=orders::getInstance()->getrow($where); $archive=archive::getInstance()->getrow($orders['aid']); $where=array(); $where['pay_code']=$_GET['code']; $pay=pay::getInstance()->getrows($where); $logisticsid = substr($_GET['subject'],15,1); $where=array(); $where['id'] = $logisticsid; $logistics=logistics::getInstance()->getrows($where); if($logistics[0]['cashondelivery']) { $logistics[0]['price'] = 0.00; }else { if($logistics[0]['insure']) { $logistics[0]['price'] = $logistics[0]['price'] +($archive['attr2'] * $orders['pnums'])*($logistics[0]['insureproportion']/100); } } $pay[0]['pay_fee'] = $pay[0]['pay_fee']/100; $total = $archive['attr2'] * $orders['pnums'] +$logistics[0]['price'] +($archive['attr2'] * $orders['pnums'] * $pay[0]['pay_fee']); $amount = $total; if($money == $amount) { return true; }else { return false; } }
function list_action() { $this->view->page=front::get('page') ?front::get('page') : 1; $this->pagesize=config::get('list_pagesize'); $limit=(($this->view->page -1) * $this->pagesize).','.$this->pagesize; $area=new area(); $where='1'; if (front::get('province_id')) $where.=' and id='.front::get('province_id'); if (front::get('city_id')) $where.=' and id='.front::get('city_id'); if (front::get('section_id')) $where.=' and id='.front::get('section_id'); if (front::get('id')) $where.=' and id='.front::get('id'); $this->view->area=$area->getrow($where); $archive=new archive(); $where='1'; if (front::get('province_id')) $where.=' and province_id='.front::get('province_id'); if (front::get('city_id')) $where.=' and city_id='.front::get('city_id'); if (front::get('section_id')) $where.=' and section_id='.front::get('section_id'); if (front::get('id')) $where.=' and section_id='.front::get('id').' or city_id='.front::get('id').' or province_id='.front::get('id'); $archives=$archive->getrows($where,$limit,'listorder,aid desc'); foreach ($archives as $order=>$arc) { $archives[$order]['url']=archive::url($arc); $archives[$order]['catname']=category::name($arc['catid']); $archives[$order]['caturl']=category::url($arc['catid']); $archives[$order]['adddate']=sdate($arc['adddate']); $archives[$order]['stitle']=strip_tags($arc['title']); } $this->view->pages=true; if(front::get('id')!='') { $this->view->areaid=front::get('id'); }elseif(front::get('province_id')!='') { $this->view->areaid=front::get('province_id'); }elseif(front::get('city_id')!='') { $this->view->areaid=front::get('city_id'); }elseif(front::get('section_id')!='') { $this->view->areaid=front::get('section_id'); } $this->view->archive['title'] = area::name($this->view->areaid); $this->view->archives=$archives; $this->view->record_count=$archive->rec_count($where); front::$record_count=$this->view->record_count; if (front::get('t') == 'wap') { $this->out('wap/area_list.html'); return; } $this->render(); }
function show_action() { $tagname=urldecode(front::get('tag')); if(preg_match('/union/i',$tagname) || preg_match('/"/i',$tagname) ||preg_match('/\'/i',$tagname)){ exit('非法参数'); } $tag=new tag(); $tag=$tag->getrow('tagname="'.$tagname.'"'); $tagid=$tag['tagid']; $archives=array(); if($tagid) { $arctag=new arctag(); if(front::get('page')) $page=front::get('page'); else $page=1; $this->view->page=$page; $this->view->pagesize=config::get('list_pagesize'); $limit=(($this->view->page-1)*$this->view->pagesize).','.$this->view->pagesize; $this->view->record_count=$arctag->rec_count('tagid='.$tagid); if($this->view->record_count>$this->view->pagesize) $this->view->pages=true; front::$record_count=$this->view->record_count; $arctags=$arctag->getrows('tagid='.$tagid,$limit); $arcids=array(); foreach($arctags as $arctag) { $arcids[]=$arctag['aid']; } $archive=new archive(); $archives=$archive->getrows('aid in ('.implode(',',$arcids).')',null,'aid desc'); foreach($archives as $order=>$arc) { $archives[$order]['url']=archive::url($arc); $archives[$order]['catname']=category::name($arc['catid']); $archives[$order]['caturl']=category::url($arc['catid']); $archives[$order]['adddate']= sdate($arc['adddate']); $archives[$order]['stitle']= strip_tags($arc['title']); } } else echo lang('标签信息不存在'); $this->view->tag=$tagname; $this->view->archive['title'] = $tagname; $this->view->archives=$archives; if (front::get('t') == 'wap') { echo $this->fetch('wap/tag_show.html'); return; } $this->render(); }
function list_action() { $this->view->page=front::get('page') ?front::get('page') : 1; $this->pagesize=config::get('list_pagesize'); $limit=(($this->view->page -1) * $this->pagesize).','.$this->pagesize; $type=new type(); $types=array(); $types=$type->sons(front::get('typeid')); $types[]=front::get('typeid'); $where='typeid in ('.implode(',',$types).') AND checked=1 AND state=1'; $this->view->type=$type->getrow('typeid='.front::get('typeid')); $this->view->pages=@$this->view->type['ispages']; $this->view->typeid=front::get('typeid'); $archive=new archive(); $archives=$archive->getrows($where,$limit,'listorder desc,aid desc'); foreach ($archives as $order=>$arc) { $archives[$order]['url']=archive::url($arc); $archives[$order]['typename']=type::name($arc['typeid']); $archives[$order]['typeurl']=type::url($arc['typeid']); $archives[$order]['adddate']=sdate($arc['adddate']); $archives[$order]['stitle']=strip_tags($arc['title']); $archives[$order]['sthumb'] = @strstr($arc['thumb'], "http://") ? $arc['thumb'] : config::get('base_url') . '/' . $arc['thumb']; } $this->view->archives=$archives; $this->view->record_count=$archive->rec_count($where); front::$record_count=$this->view->record_count; $this->type=type::getInstance(); if (front::get('t') == 'wap') { $this->out('wap/type_list.html'); return; } $template=$this->type->type[front::get('typeid')]['template']; if ($template&&file_exists(TEMPLATE.'/'.$this->view->_style.'/'.$template)) $this->out($template); else { $tpl=type::gettemplate($this->view->typeid); if (type::getishtml($this->view->typeid)) { $path=ROOT.type::url($this->view->typeid,@front::$get['page']>1 ?front::$get['page'] : null); if (!preg_match('/\.[a-zA-Z]+$/',$path)) $path=rtrim(rtrim($path,'/'),'\\').'/index.html'; $this->cache_path=$path; } $this->out($tpl); } }
function list_action() { front::check_type(front::get('aid')); $this->view->article=archive::getInstance()->getrow(front::get('aid')); $this->view->page=front::get('page')?front::get('page'):1; $this->pagesize=config::get('list_pagesize'); $limit=(($this->view->page-1)*$this->pagesize).','.$this->pagesize; $comment=new comment(); $this->view->comments=$comment->getrows('state=1 and aid='.front::get('aid'),$limit); $this->view->record_count=$comment->rec_count('state=1 and aid='.front::get('aid')); front::$record_count=$this->view->record_count; $this->view->aid=front::get('aid'); }
if ($site->fdat['op'] == "upload") { $ext = new extension_upload(); } if ($site->fdat['upload']) { verify_form_token(); $ext->tmp_location = $site->absolute_path . "shared/" . time() . "_" . rand(1, 837838); $ext->extensions_folder = $site->absolute_path . "extensions"; $ext->overwrite_extension = $site->fdat['overwrite']; $ext->unpack_extension('extension'); // variable is the array name in $_FILES where the file resides. $ext->find_file('extension.config.php'); if ($ext->validate_extension()) { sync_extensions(); $synced = 1; } $zip = new archive(); $zip->deltree($ext->tmp_location); @rmdir($ext->tmp_location); } if ($site->fdat['op'] == "upload") { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title><?php echo $site->sys_sona(array('sona' => 'extension_upload', 'tyyp' => 'Admin')); ?> </title> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $site->encoding;
static function countarchiveformcategory($catid) { $arc=archive::getInstance(); return $arc->rec_count('catid='.$catid); }
<div class="c" style="font-family: monospace;"> <Br><Br> <table width="100%" Height="" id="archvie" border="0"> <tr id="archive" bgcolor=""> <td nowrap width="25" id=""><span class="whitetext_md"><B>Name / Title</B><hr></td> <td nowrap width="25"><span class="whitetext_md"><b>Posted</b><Hr></span></td> <td nowrap width="25"><span class="whitetext_md"><b>Total Hits</b><Hr></span></td> <td nowrap width="25"><span class="whitetext_md"><b>Syntax</b><hr></span></td> </tr> <?php //include needed files include_once 'include/config.php'; include_once 'classes/archive.class.php'; include_once 'classes/main.class.php'; // create new archive object $archive = new archive(); // check if page number is set if (isset($_GET['page'])) { $page = $_GET['page']; // sanitize $san = new main(); $page = $san->clean($page); } else { $page = null; } // get the archive data from object $archive->getarchive($page); ?> </div>
function orders_action() { $this->view->aid = trim(front::get('aid')); if (front::post('submit')) { $this->orders = new orders(); $row = $this->orders->getrow("","adddate DESC"); //var_dump(time()); if($row['adddate'] && time() - $row['adddate'] <= intval(config::get('order_time'))){ alerterror('操作频繁,请稍后再试'); return; } if (front::$post['telphone'] == '') { alerterror('联系电话为必填!'); return; } front::$post['mid'] = $this->view->user['userid'] ? $this->view->user['userid'] : 0; front::$post['adddate'] = time(); front::$post['ip'] = front::ip(); if (isset(front::$post['aid'])) { $aidarr = front::$post['aid']; unset(front::$post['aid']); foreach ($aidarr as $val) { front::$post['aid'].=$val . ','; front::$post['pnums'].=front::$post['thisnum'][$val] . ','; } } else { front::$post['aid'] = $this->view->aid; } if (!isset(front::$post['logisticsid'])) front::$post['logisticsid'] = 0; front::$post['oid'] = date('YmdHis') . '-' . front::$post['logisticsid'] . '-' . front::$post['mid'] . '-' . front::$post['payname']; $insert = $this->orders->rec_insert(front::$post); if ($insert < 1) { front::flash($this->tname . lang('添加失败!')); } else { if (config::get('sms_on') && config::get('sms_order_on')) { sendMsg(front::$post['telphone'], config::get('sms_order')); } if (config::get('sms_on') && config::get('sms_order_admin_on') && $mobile = config::get('site_mobile')) { sendMsg($mobile, '网站在' . date('Y-m-d H:i:s') . '有新订单了'); //echo 11; } $user = $this->view->user; if(config::get('email_order_send_cust') && $user['e_mail']){ $title = "您在".config::get('sitename')."的订单".front::get('oid')."已提交"; $this->sendmail($user['e_mail'], $title, $title); } if(config::get('email_order_send_admin') && config::get('email')){ $title = '网站在' . date('Y-m-d H:i:s') . '有新订单了'; $this->sendmail(config::get('email'), $title, $title); } if (front::$post['payname'] && front::$post['payname'] != 'nopay') { echo '<script type="text/javascript">alert("' . lang('orderssuccess') . ' ' . lang('现在转入支付页面') . '");window.location.href="' . url('archive/payorders/oid/' . front::$post['oid'], true) . '";</script>'; } echo '<script type="text/javascript">alert("' . lang('orderssuccess') . '");window.location.href="' . url('archive/orders/oid/' . front::$post['oid'], true) . '";</script>'; } } elseif (front::get('oid')) { preg_match_all("/-(.*)-(.*)-(.*)/isu", front::get('oid'), $oidout); $this->view->paytype = $oidout[3][0]; if($oidout[2][0] != $this->view->user['userid']){ alertinfo('查看订单失败', url::create('index/index')); } $where = array(); $where['oid'] = front::get('oid'); $this->view->orders = orders::getInstance()->getrow($where); $this->view->statusnum = $data['status'] = $this->view->orders['status']; switch ($data['status']) { case 1: $data['status'] = lang('完成'); break; case 2: $data['status'] = lang('处理中'); break; case 3: $data['status'] = lang('已发货'); break; case 4: $data['status'] = lang('客户已付款,待审核'); break; case 5: $data['status'] = lang('已核实客户支付'); break; default: $data['status'] = lang('新订单'); break; } $this->view->orders['status'] = $data['status']; if ($this->view->paytype) { $this->view->gotopaygateway = '<a href="' . url('archive/payorders/oid/' . front::get('oid'), true) . '">进入支付页面</a>'; } //var_dump($this->view->user);var_dump($_SESSION);exit(); $this->out('message/orderssuccess.html'); } elseif (front::get('aid')) { $this->view->archive = archive::getInstance()->getrow(front::get('aid')); $this->view->categorys = category::getpositionlink2($this->view->archive['catid']); $this->view->paylist = pay::getInstance()->getrows('', 50); $this->view->logisticslist = logistics::getInstance()->getrows('', 50); $prices = getPrices($this->view->archive['attr2']); $this->view->archive['attr2'] = $prices['price']; if (!is_array($this->view->archive)) $this->out('message/error.html'); if ($this->view->archive['checked'] < 1) exit(lang('未审核!')); if (!rank::arcget(front::get('aid'), $this->view->usergroupid)) { $this->out('message/error.html'); } } else { $oreders_c = cookie::get('ce_orders_cookie'); if(preg_match('/union/i', $oreders_c)){ alerterror("非法字符"); } $oreders_c = stripslashes(htmlspecialchars_decode($oreders_c)); $aid = !empty($oreders_c) ? unserialize($oreders_c) : 0; if ($aid) { foreach ($aid as $key => $val) { $archive = archive::getInstance()->getrow(intval($val['aid'])); $val['title'] = $archive['title']; $prices = getPrices($archive['attr2']); $val['attr2'] = $prices['price']; $aid[$key] = $val; } $this->view->orderaidlist = $aid; $this->view->paylist = pay::getInstance()->getrows('', 50); $this->view->logisticslist = logistics::getInstance()->getrows('', 50); } else { if (isset(front::$get['oid'])) { //echo '<script type="text/javascript">alert("' . lang('请输入订单编号!') . '");'; if ($_SERVER['HTTP_REFERER']) { front::refresh($_SERVER['HTTP_REFERER']); //echo 'window.location.href="' . $_SERVER['HTTP_REFERER'] . '";'; } else { front::refresh(url('index')); //echo 'window.location.href="' . url('index') . '";'; } //echo '</script>'; exit; } echo '<script type="text/javascript">alert("' . lang('购物车暂无商品!') . '");'; if ($_SERVER['HTTP_REFERER']) { //front::refresh($_SERVER['HTTP_REFERER']); echo 'window.location.href="' . $_SERVER['HTTP_REFERER'] . '";'; } else { //front::refresh(url('index')); echo 'window.location.href="' . url('index') . '";'; } echo '</script>'; } } }
<div class="blank30"></div> <div class="p_info"><?php echo lang(relatedcontent); ?> :<?php echo $archive['tag']; ?> </div> <div class="blank10"></div> <ul class="news_list"> <?php if (is_array($likenews) && !empty($likenews)) { foreach ($likenews as $item) { ?> <li><a href="<?php echo archive::url($item); ?> "><?php echo cut($item['title'], 20); ?> </a></li> <?php } } ?> </ul> <?php } ?> <!-- 相关文章结束 -->
<?php include '../libs/archive/archive.php'; $arch = new archive('E:/WebServers/home/alien.com/www/exp/fud.tar.bz2', 'E:/WebServers/home/alien.com/www/exp/fud14'); $arch->compress('fud14');
<div id="tagscontent" class="right_box"> <table border="0" cellspacing="0" cellpadding="0" name="table1" id="table1"> <form name="aidform" method="post" action="<?php echo front::$uri;?>"> <tbody> <tr> <td width="19%" align="right">按ID</td> <td width="1%"> </td> <td width="70%"> <?php $archive=new archive(); $aid=$archive->rec_query_one("select min(aid) as min,max(aid) as max from ".$archive->name); echo " ".form::input('aid_start',max($aid['max']-100,1)); echo " 到 ".form::input('aid_end',$aid['max']); ?> <?php echo form::submit('更新'); ?> (ID范围: {$aid['min']}~{$aid['max']} ) </td></tr></tbody> </form> <form name="aidform2" method="post" action="<?php echo front::$uri;?>"> <tbody> <tr> <td width="19%" align="right">按栏目</td> <td width="1%"> </td> <td width="70%"> <?php //$archive=archive::getInstance(); echo form::select('catid',get('catid'),category::option()); ?>
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; }
function delete_before($id) { $arc = new archive(); $info = $arc->getrow($id); $attachment = new attachment(); $res = $attachment->getrows(array("aid"=>$id)); if(is_array($res) && !empty($res)){ foreach($res as $v){ @unlink($v['path']); } } if(category::getarcishtml($info)) { $path=ROOT.preg_replace("%".THIS_URL."[\\/]%",'',archive::url($info)); if(file_exists($path)) unlink($path); } }
function unpack_extension($farray_name) { if (file_exists($_FILES[$farray_name]['tmp_name']) && $_FILES[$farray_name]['error'] == 0 && $_FILES[$farray_name]['size'] > 0) { //we unpack the extension to a temp folder. $zip = new archive(); $zip->unzip($_FILES[$farray_name]['tmp_name'], $this->tmp_location, false); if ($zip->error()) { $this->create_error($zip->error()); } } else { $this->create_error("No file found under \$_FILES['" . $farray_name . "']!"); } }
$data['mid']='游客'; }else{ $data['mid']='注册会员'; } $string = $data['aid']; $find = ','; $pos = strpos($string, $find); if($pos!==false){ $_aid = $string; $_aid = substr($_aid,0,-1); $_archivearr=archive::getInstance()->getrows('aid in ('.$_aid.')',100); }else{ $_archive=archive::getInstance()->getrow($data['aid']); $data['aid']=$_archive['title']; $logisticsid = substr($data['oid'],15,1); $where=array(); $where['id'] = $logisticsid; $logistics=logistics::getInstance()->getrows($where); if($logistics[0]['cashondelivery']){ $logistics[0]['price'] = 0.00; }else{ if($logistics[0]['insure']){ $logistics[0]['price'] = $logistics[0]['price'] + ($_archive['attr2'] * $orders['pnums'])*($logistics[0]['insureproportion']/100); } }
function doarchivetimeout(){ $archive = new archive(); $date = date('Y-m-d'); $sql = "UPDATE ".$archive->name." SET state='-1' WHERE outtime!='0000-00-00' AND outtime<='$date'"; $archive->query($sql); }
function search_action() { if(front::get('keyword') &&!front::post('keyword')) front::$post['keyword']=front::get('keyword'); front::check_type(front::post('keyword'),'safe'); if(front::post('keyword')) { $this->view->keyword=trim(front::post('keyword')); session::set('keyword',$this->view->keyword); } else { session::set('keyword',null); $this->view->keyword=session::get('keyword'); } $type = $this->view->type; $condition = ""; if(front::post('catid')) { $condition .= "catid = '".front::post('catid')."' AND "; } $condition .= "(title like '%".$this->view->keyword."%'"; $sets=settings::getInstance()->getrow(array('tag'=>'table-fieldset')); $arr = unserialize($sets['value']); if(is_array($arr['archive']) &&!empty($arr['archive'])) { foreach ($arr['archive'] as $v) { if($v['issearch'] == '1') { $condition .= " OR {$v['name']} like '%{$this->view->keyword}%'"; } } } $condition .= ")"; $order = "`listorder` desc,1 DESC"; $limit=(($this->view->page-1)*$this->pagesize).','.$this->pagesize; $articles=$this->archive->getrows($condition,$limit,$order); 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']); } $this->view->articles=$articles; $this->view->archives=$articles; $this->view->record_count=$this->archive->record_count; }
<div id="tagscontent" class="right_box"> <form name="typeform" method="post" action="<?php echo front::$uri;?>"> <table border="0" cellspacing="0" cellpadding="0" name="table1" id="table1" width="100%"> <tbody> <tr> <td width="19%" align="right">栏目</span></td> <td width="1%"> </td> <td width="70%"><?php $archive=archive::getInstance(); echo form::select('catid',get('catid'),category::option()); ?> <?php echo form::submit('更新'); ?> </td></tr></tbody> </table> </form> </div>
function make_show_action() { header('Cache-control: private, must-revalidate'); @set_time_limit(0); $submit = front::post('submit') ? front::post('submit') : front::get('submit'); if (!$submit) return; chkpw('cache_content'); //time::start(); $post = front::$post + front::$get; unset($post['submit']); $c_url = preg_replace('#&make_page=(\d+)#', '', $_SERVER['QUERY_STRING']); $c_url = preg_replace('#&aid_start=(\d+)#', '', $c_url); $c_url = preg_replace('#&aid_end=(\d+)#', '', $c_url); $c_url = preg_replace('#&catid=(\d+)#', '', $c_url); $c_url = preg_replace('#&submit=(\d+)#', '', $c_url); $c_url = 'index.php?' . $c_url; $c_url.='&submit=1'; $category = category::getInstance(); //实例化栏目类 if ($post['aid_start']) { $aid_start = $post['aid_start']; $aid_end = $post['aid_end']; $where = "aid>=$aid_start and aid<=$aid_end AND checked=1 AND (ishtml IS NULL OR ishtml!=2)"; $c_url.='&aid_start=' . $aid_start . '&aid_end=' . $aid_end; } elseif (isset($post['catid'])) { $catid = $post['catid']; $categories = $category->sons($catid); $categories[] = $catid; $categories = implode(',', $categories); $where = "catid in(" . $categories . ') and checked=1 AND (ishtml IS NULL OR ishtml!=2)'; $c_url.='&catid=' . $catid; }else return; $case = 'archive'; $act = 'show'; $_GET = array('case' => $case, 'act' => $act); $front = new front(); front::$admin = false; front::$html = true; front::$rewrite = false; $case = $case . '_act'; $case = new $case(); $case->init(); $method = $act . '_action'; //$time_start = time::getTime(); $archive = new archive(); //实例化文章类 if (config::get('group_on')) { //启用分组生成 $make_page = $post['make_page'] == '' ? 1 : $post['make_page']; $archive->getrows($where); $archive_num = $archive->record_count; $group_count = config::get('group_count'); $make_page_num = ceil($archive_num / $group_count); $totalpage = (($make_page - 1) * $group_count) . ',' . $group_count; $c_url.='&make_page=' . ($make_page + 1); } else { $totalpage = ""; } $archives = $archive->getrows($where, $totalpage, '1'); //取到要生成的所有文章 $cpage = 0; foreach ($archives as $arc) { if (!category::getarcishtml($arc)) //如果文章设置不生成则跳过 continue; if($arc['linkto']){ //如果有跳转连接则跳过生成 continue; } $case->view->archive = $arc; front::$get['aid'] = $case->view->aid = $case->view->archive['aid']; $case->view->catid = $case->view->archive['catid']; $case->view->topid = category::gettopparent($case->view->catid); $case->view->parentid = $category->getparent($case->view->catid); $template = $case->view->archive['template']; $content = $case->view->archive['content']; $case->view->categories = category::getpositionlink2($case->view->catid); //关键字连接 $linkword = new linkword(); $linkwords = $linkword->getrows(null, 1000, 'linkorder desc'); foreach ($linkwords as $linkword) { if (trim($linkword['linkurl']) && !preg_match('%^http://$%', trim($linkword['linkurl']))) { $linkword['linktimes'] = (int) $linkword['linktimes']; $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>"; } if (isset($link)) { $content = preg_replace("%(?!\"]*>)$linkword[linkword](?!\s*\")%i", "\\1$link\\2", $content, $linkword['linktimes']); } unset($link); } //相关文章 $case->view->likenews = $case->getLike($case->view->archive['tag'], $case->view->archive['keyword']); //内容分页 $contents = preg_split('%<div style="page-break-after(.*?)</div>%si', $content); if (!empty($contents)) { $case->view->pages = count($contents); front::$record_count = $case->view->pages * config::get('list_pagesize'); $case->view->pages = count($contents); } else { $case->view->pages = 1; } //标签连接 $taghtml = ''; $tag_table = new tag(); foreach ($tag_table->urls($case->view->archive['tag']) as $tag => $url) { $taghtml.="<a href='$url' target='_blank'>$tag</a> "; } $case->view->archive['tag'] = $taghtml; //专题连接 $case->view->archive['special'] = null; if ($case->view->archive['spid']) { $spurl = special::url($case->view->archive['spid'],special::getishtml($case->view->archive['spid'])); $sptitle = special::gettitle($case->view->archive['spid']); $case->view->archive['special'] = "<a href='$spurl' target='_blank'>$sptitle</a> "; } //分类连接 $case->view->archive['type'] = null; if ($case->view->archive['typeid']) { $typeurl = type::url($case->view->archive['typeid'],1); $typetitle = type::name($case->view->archive['typeid']); $case->view->archive['type'] = "<a href='$typeurl' target='_blank'>$typetitle</a> "; } //地区连接 $case->view->archive['area'] = null; $case->view->archive['area'] = area::getpositonhtml($case->view->archive['province_id'], $case->view->archive['city_id'], $case->view->archive['section_id']); //$arc = $case->view->archive; for ($c = 1; $c <= $case->view->pages; $c++) { front::$get['page'] = $c; $case->view->page = $c; if (!empty($contents)) { $content = $contents[$c - 1]; } $case->view->archive['content'] = $content; //自定义字段 cb_data($case->view->archive); $str = ""; foreach( $case->view->archive as $key => $value){ if(!preg_match('/^my/',$key) || !$value) continue; $sonids = $category->sons(setting::$var['archive'][$key]['catid']); $sonids[] = setting::$var['archive'][$key]['catid']; if(!in_array($case->view->archive['catid'],$sonids) && intval(setting::$var['archive'][$key]['catid'])){ //unset($case->view->field[$key]); continue; } $str .= '<p> '.setting::$var['archive'][$key]['cname'].':'. $value.'</p>'; } $arc['my_fields'] = $str; //上一篇,下一篇 $aid = $case->view->archive['aid']; $catid = $case->view->archive['catid']; $sql1 = "SELECT * FROM `{$archive->name}` WHERE catid = '$catid' AND aid > '$aid' ORDER BY aid ASC LIMIT 0,1"; $sql2 = "SELECT * FROM `{$archive->name}` WHERE catid = '$catid' AND aid < '$aid' ORDER BY aid DESC LIMIT 0,1"; $n = $archive->rec_query_one($sql1); $p = $archive->rec_query_one($sql2); $case->view->archive['p'] = $p; $case->view->archive['n'] = $n; $case->view->archive['p']['url'] = archive::url($p); $case->view->archive['n']['url'] = archive::url($n); //评级 $case->view->archive['strgrade'] = archive::getgrade($arc['grade']); //图片 $case->view->archive['pics'] = unserialize($case->view->archive['pics']); if(is_array($case->view->archive['pics']) && !empty($case->view->archive['pics'])){ foreach ($case->view->archive['pics'] as $k => $v){ if(strtolower(substr($v,0,7)) == 'http://'){ $case->view->archive['pics'][$k] = $v; }else{ $case->view->archive['pics'][$k] = $v; } } } $case->view->archive['pics'] = serialize($case->view->archive['pics']); if ($template && file_exists(TEMPLATE . '/' . $case->view->_style . '/' . $template)) $tpl = $template; else $tpl = category::gettemplate($case->view->catid, 'showtemplate'); $content = $case->fetch($tpl); $path = ROOT . archive::url($case->view->archive, front::$get['page'] > 1 ? front::$get['page'] : null, true); if (!preg_match('/\.[a-zA-Z]+$/', $path)) $path = rtrim(rtrim($path, '/'), '\\') . '/index.html'; $path = rtrim($path, '/'); $path = rtrim($path, '\\'); $path = str_replace('//', '/', $path); tool::mkdir(dirname($path)); file_put_contents($path, $content); $cpage++; if ($case->view->pages > 1 && $c == 1) { $path = ROOT . archive::url($case->view->archive, 1, true); if (!preg_match('/\.[a-zA-Z]+$/', $path)) $path = rtrim(rtrim($path, '/'), '\\') . '/index.html'; $path = rtrim($path, '/'); $path = rtrim($path, '\\'); $path = str_replace('//', '/', $path); tool::mkdir(dirname($path)); //file_put_contents('logs.txt', file_get_contents('logs.txt')."\r\n".$path); $f = fopen($path,'w'); fwrite($f, $content); fclose($f); $cpage++; } } } $totalpage = count($archives); if (!isset($archives[0])) $totalpage = 0; if ($make_page >= $make_page_num) { $show_msg = "本组生成html <b>{$cpage}</b> 页! 生成html完毕,本次共生成 <b>{$archive_num}</b> 页! 3秒后自动返回内容生成首页面!\n"; $c_url = preg_replace('#&make_page=(\d+)#', '', $_SERVER['QUERY_STRING']); $c_url = preg_replace('#&aid_start=(\d+)#', '', $c_url); $c_url = preg_replace('#&aid_end=(\d+)#', '', $c_url); $c_url = preg_replace('#&catid=(\d+)#', '', $c_url); $c_url = preg_replace('#&submit=(\d+)#', '', $c_url); $c_url = 'index.php?' . $c_url; } else { $show_msg = "第 <b>{$make_page}</b> 组成功生成html <b>{$cpage}</b> 页! 本次共需生成 <b>{$archive_num}</b> 页! 已经生成 <b>" . ($make_page * $group_count) . "</b> 页! 3秒后自动跳入下组生成!\n"; } $getnexturl = "<script>"; $getnexturl.="var t=4;\n"; $getnexturl.="setInterval('testTime()',3000);\n"; $getnexturl.="function testTime() \n"; $getnexturl.=" { \n"; $getnexturl.="if(t == 0) location = '" . $c_url . "'; \n"; $getnexturl.=" t--;\n"; $getnexturl.="}\n</script> \n"; if ($cpage > 0) { if (!config::get('group_on')) { front::flash("成功生成html <b>{$cpage}</b> 页!用时".time::getTime()."!\n"); } else { front::flash($show_msg . "\n" . $getnexturl); } } else { front::flash("没有需要生成的html,可能您选择的栏目暂无内容或者网站并未开启内容生成静态功能!"); } front::$admin = true; front::$post = $post; }