コード例 #1
0
ファイル: ologin.php プロジェクト: jiangsuei8/public_php_shl
 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;
     }
 }
コード例 #2
0
 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));
 }
コード例 #3
0
 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');
 }
コード例 #4
0
<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%">&nbsp;</td>
                        <td width="70%"><?php
	$archive=archive::getInstance();
	echo form::select('catid',get('catid'),category::option());
	?>
	&nbsp;&nbsp;
	<?php echo form::submit('更新');
	?>
    </td></tr></tbody>
</table>
</form>
</div>
コード例 #5
0
function archive($catid='0',$typeid='0',$spid=0,$area='0,0,0',$length=20,$ordertype='aid',$limit=10,$image=false,$attr1=null,$son=true,$wheretype='',$tpl=null,$intro_len='0',$istop=0) {
    $_ordertype=$ordertype;
    $cache_id=md5($catid.$typeid.$spid.$area.$length.$ordertype.$limit.$son.$wheretype.$tpl.$intro_len.$istop);
    if ($ordertype == 'rand()')
        $cache_id=$cache_id.time();
    if (cache::get($cache_id))
        $archives=cache::get($cache_id);
    else {
        $ordertype=str_replace('-',' ',$ordertype);
        $wheretype=str_replace('-',' ',$wheretype);
        $order = 'listorder=0,listorder ASC ';
        if (preg_match('/^\w+$/',$ordertype))
            $order .= ','.$ordertype.' desc';
        elseif ($ordertype)
            $order .= ','.$ordertype;
        $where=array();
        if ($wheretype)
            foreach (explode(',',$wheretype) as $_wheretype)
                switch ($_wheretype) {
                    case 'day': $where[]='adddate>'.date('Y-m-d H:i:s',time() -3600 * 24);
                        break;
                    case 'week': $where[]='adddate>'.date('Y-m-d H:i:s',time() -3600 * 24 * 7);
                        break;
                    case 'month': $where[]='adddate>'.date('Y-m-d H:i:s',time() -3600 * 24 * 30);
                        break;
                    default:
                        if (preg_match('/commend=(\d+)/i',$_wheretype,$match))
                            $where[]=" attr1 REGEXP  '(^|,)$match[1](,|$)'  ";
                        else
                        if (preg_match('/^\w+$/',$_wheretype))
                            $where[]=$_wheretype."<>''";
                        else
                            $where[]=$_wheretype;
                        break;
                }
        if (!empty($where))
            $where=' and '.implode(' and ',$where);
        else
            $where='';
        $archive=archive::getInstance();
        $category=category::getInstance();
        $categories=array();
        if (isset($catid) &&$catid != '0') {
            $catid=explode('-',$catid);
            //var_dump($catid);
            $categories=$catid;
            $_categories1=array();
            if ($son) {
                
                foreach ($categories as $key=>$val) {
                    $_categories[$key]=$category->sons($val);
                    $_categories1=array_merge($_categories[$key],$_categories1);
                }
                //var_dump($_categories);
            }
            //var_dump($categories);
            $categories=array_merge($categories,$_categories1);
            //var_dump($categories);
        }
        //var_dump($categories);
        $type=type::getInstance();
        $types=array();
        if (isset($typeid) &&$typeid != '0') {
            $types[]=$typeid;
            if ($son) {
                $_types=$type->sons($typeid);
            }
            $types=array_merge($types,$_types);
        }
        $where='1';
        if (!empty($types))
            $where.=' and typeid in ('.implode(',',$types).')';
        if (!empty($categories))
            $where.=' and catid in ('.implode(',',$categories).')';
        if ($spid)
            $where.=' and spid='.$spid;
        list($province_id,$city_id,$section_id)=explode(',',$area);
        if ($province_id)
            $where.=' and province_id='.$province_id;
        if ($city_id)
            $where.=' and city_id='.$city_id;
        if ($section_id)
            $where.=' and section_id='.$section_id;
        if ($image)
            $where.=' and thumb <> "" ';
        if ($attr1)
            $where.=" and FIND_IN_SET('$attr1',attr1) ";
        if ($_ordertype == 'aid-asc') {
            $order .=',aid asc';
        }
        if ($_ordertype == 'new') {
        	$order .= ',adddate desc';
        }
        if($istop){
        	$tops = $archive->getrows($where." AND checked=1 AND state=1 AND toppost!=0",0,'toppost DESC,listorder=0,listorder ASC,aid DESC');
        }
        $archives = $archive->getrows($where.' AND state=1 AND checked=1',$limit-count($tops),$order,$archive->getcols('list'));
        
        if(is_array($tops) && !empty($tops)){
        	foreach($tops as $order => $arc){
        		if($arc['toppost'] == 3){
        			$tops[$order]['title'] = "[全站置顶]".$arc['title'];
        		}
        		if($arc['toppost'] == 2){
        			$subcatids = $category->sons($arc['catid']);
        			if($arc['catid'] != $catid[0] && !in_array($catid[0], $subcatids)){
        				unset($tops[$order]);
        			}else{
        				$tops[$order]['title'] = "[栏目置顶]".$arc['title'];
        			}
        		}
        	}
        	$archives = array_merge($tops , $archives);
        }
        
        foreach ($archives as $order=>$arc) {
            if (!$arc['introduce'])
                $arc['introduce']=cut($arc['content'],$arc['introduce_len'] ?$arc['introduce_len'] : 200);
            $archives[$order]['url']=$arc['linkto'] ?$arc['linkto'] : archive::url($arc);
            $archives[$order]['catname']=category::name($arc['catid']);
            $archives[$order]['caturl']=category::url($arc['catid']);
            $archives[$order]['image']=@strstr($arc['image'],"http://") ?$arc['image'] : config::get('base_url').'/'.$arc['image'];
            $archives[$order]['adddate']=sdate($arc['adddate']);
            $archives[$order]['stitle']=strip_tags($arc['title']);
            $archives[$order]['title']=tool::cn_substr($arc['title'],$length);
            $archives[$order]['strgrade'] = archive::getgrade($arc['grade']);
            $archives[$order]['buyurl']=url('archive/orders/aid/'.$arc['aid']);
            $prices = getPrices($arc['attr2']);
            $archives[$order]['oldprice'] = $prices['oldprice'];
            $archives[$order]['attr2'] = $prices['price'];
            if(!$intro_len){
            	$archives[$order]['intro'] = '';
            }else if($intro_len == '-1'){
            	$archives[$order]['intro'] = $arc['introduce'];
            }else{
            	$archives[$order]['intro'] = cut($arc['introduce'],$intro_len);
            }
            if(strtolower(substr($arc['thumb'],0,7)) == 'http://'){
            	$archives[$order]['sthumb'] = $arc['thumb'];
            }else{
            	$archives[$order]['sthumb'] = config::get('base_url').'/'.$arc['thumb'];
            }
            if($arc['strong']){
                $archives[$order]['title'] = '<strong>'.$archives[$order]['title'].'</strong>';
            }
            if($arc['color'] !="#000000"){
                $archives[$order]['title'] = '<font style="color:'.$arc['color'].';">'.$archives[$order]['title'].'</font>';
            }
            cb_data($archives[$order]);
            /*if($arc['toppost'] == '3'){
                $tmp[] = $archives[$order];
                unset($archives[$order]);
            }
            if($arc['toppost'] == '2' && front::get('catid') == $arc['catid']) {
            	$tmp2[] = $archives[$order];
            	unset($articles[$order]);
            }*/
            
            /*foreach ($archives[$order] 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'] != $archive['catid'] && !in_array($archive['catid'],$sonids) && (setting::$var['archive'][$key]['catid'])){
            		unset($field[$key]);
                	continue;
                	$archives[$order][$key] = $value;
            	}
            }*/
        }
        /*if(is_array($tmp)){
            $archives = array_merge($tmp,$archives);
        }*/
        if ($ordertype != 'rand()')
            cache::set($cache_id,$archives);
    }
    //run::_start();
    if ($tpl) {
        front::$view->_var->articles=$archives;
        return template($tpl);
    }
    else
        return $archives;
}
コード例 #6
0
    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>';
            }
        }
    }
コード例 #7
0
ファイル: archive.php プロジェクト: jiangsuei8/public_php_shl
 static function countarchiveformcategory($catid) {
     $arc=archive::getInstance();
     return $arc->rec_count('catid='.$catid);
 }
コード例 #8
0
ファイル: edit.php プロジェクト: jiangsuei8/public_php_shl
	$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);
		}
	}