Example #1
0
    function manage_action() {
        if(!config::get('sms_username') || !config::get('sms_password')){
            echo '<script>alert("您需要先设置用户名和密码才能使用短信管理功能!");window.location.href="'.url('config/system/set/sms').'";</script>';
            exit;
        }
        include_once("phprpc/phprpc_client.php");
        $client = new PHPRPC_Client();
        $client->setProxy(NULL);
        $client->useService('http://pay.cmseasy.cn/sms.php');
        $client->setKeyLength(128);
        $client->setEncryptMode(3);
        $info = $client->getInfo(config::get('sms_username'),md5(config::get('sms_password')));
        $info[0] = intval($info[0]);
        $info[1] = intval($info[1]);
        $this->view->info = $info;
        if (front::post('submit')) {
            if (front::post('act') == 'test') {
                $rs = sendMsg(front::post('mobile'),'test');
                if($rs->SendSMSResult == '0'){
                    front::flash('发送成功');
                }else{
                    front::flash('发送失败,请检查用户名、密码或剩余条数');
                }
            }
        }else{
			if($info[0] < 50) front::flash('你的剩余短信不足50条,请及时充值');
		}
    }
Example #2
0
 private function check_mytable() {
     if(!preg_match('/^my_.+/',front::post('name'))) {
         front::flash('表名格式必须是是"my_abc"!');
         return false;
     }
     return true;
 }
 function vaild() {
     if (!front::post('name')) {
         front::flash('请填写名称!');
         return false;
     }
     return true;
 }
    function add_action() {
        if(front::post('submit') &&front::post('aid')) {
        	if(config::get('verifycode')) {
	            if(front::post('verify')<>session::get('verify')) {
	                 alertinfo('验证码错误。', front::$from);
	                //front::redirect(front::$from);
	            }
        	}
            if(!front::post('username')) {
                /*front::flash(lang('请留下你的名字!'));
                front::redirect(front::$from);*/
            	alertinfo('请留下你的名字!', front::$from);
            }
            if(!front::post('content')) {
                /*front::flash(lang('请填写评论内容!'));
                front::redirect(front::$from);*/
                alertinfo('请填写评论内容!', front::$from);
            }
            $this->manage->filter();
            $comment=new comment();
            $archive=new archive();
            front::$post['state'] = '0';
            front::$post['adddate']=date('Y-m-d H:i:s');
            $comment->rec_insert(front::$post);
            $archive->rec_update('comment=comment+1',front::post('aid'));
            //front::flash(lang('提交成功!'));
            alertinfo('评论提交成功。', front::$from);
            //front::redirect(front::$from);
        }else {
            front::flash(lang('提交失败!'));
            front::redirect(front::$from);
        }
    }
Example #5
0
 function ctsitemap_action(){
 	$category = category::getInstance();
 	$category->sitemap();
 	front::flash('生成网站地图成功');
 	front::redirect(front::$from);
     /*echo "<script>alert('生成网站地图成功!');window.close();</script>";
     exit;*/
 }
Example #6
0
 function vaild() {
     if(!front::post('typename')) {
         front::flash('请填写类别标题等!');
         return false;
     }
     if(!front::post('htmldir'))
         front::$post['htmldir']=pinyin::get(front::post('typename'));
     return true;
 }
 function vaild() {
     if(!front::post('title')) {
         front::flash('请填写标题!');
         return false;
     }
     if(!front::post('catid')) {
         front::flash('请选择分类!');
         return false;
     }
     return true;
 }
 function deleteimg_action() {
     if (!front::get('dir') || !front::get('imgname'))
         return;
     $img = ROOT . '/upload/images/' . front::get('dir') . '/' . str_replace('___', '.', front::get('imgname'));
     if (!file_exists($img))
         front::flash('图片不存在');
     if (!unlink($img))
         front::flash('删除失败,请检查权限');
     else
         front::flash('图片已删除');
     front::redirect(url::modify('act/listimg/dir/' . front::get('dir')));
 }
Example #9
0
 function __construct() {
     if (ADMIN_DIR!=config::get('admin_dir')) {
         config::modify(array('admin_dir'=>ADMIN_DIR));
         front::flash('后台目录更改成功!');
     }
     front::$rewrite=false;
     parent::__construct();
     $servip = gethostbyname($_SERVER['SERVER_NAME']);
     //if($this instanceof file_admin && in_array(front::get('act'), array('updialog','upfile','upfilesave','netfile','netfilesave','swfsave'))) return;
     if($servip==front::ip()&&front::get('ishtml')==1) return;
     $this->check_admin();
 }
Example #10
0
 function delete_before() {
     $user = new user();
     $row = $user->getrow(front::get('id'));
     if($row['username'] == config::get('install_admin')) {
         front::flash("不能删除安装管理员!");
         front::redirect(front::$from);
     }
     if(front::get('id')==front::$user['userid']) {
         front::flash("不能删除当前用户!");
         front::redirect(front::$from);
     }
     if(is_array(front::post('select')) &&in_array(front::$user['userid'],front::post('select'))) {
         front::flash("不能删除当前用户!");
         front::redirect(front::$from);
     }
 }
    function downfile_action() {
    	$base_url = config::get('base_url');
        if(front::post('submit')) {
            if(!session::get('verify') ||front::post('verify')<>session::get('verify')) {
                front::flash(lang('验证码错误!'));
                return;
            }else {
                front::check_type(front::get('aid'));
                $aid=front::get('aid');
                $name=archive_attachment($aid,'intro');
                $path=archive_attachment($aid,'path');
                if(!$name) $name=preg_replace('%(.*)[\\\\\/](.*)_\d+(\.[a-z]+)$%i','$2',$path);
				@cookie::set('allowdown',md5(url::create('attachment/downfile/aid/'.$aid.'/v/ce')));
                if(!rank::arcget($aid,$this->view->usergroupid,'down'))
                    $link="<p align='center'><a id='att' href='javascript:alert(\"未取得授权,无法下载!\");'><img src='{$base_url}/images/download.gif' alt='$name' border='0' /></a></p>";
                else $link="<p align='center'><a id='att' href='".url::create('attachment/down/aid/'.$aid)."'><img src='{$base_url}/images/download.gif' alt='$name' border='0' /></a></p>";
                echo $link;
                exit;
            }
        }
    }
Example #12
0
 function do_action() {
     if(front::post('submit') &&front::post('vote') &&front::post('aid')) {
         front::check_type(front::post('aid'));
         if(!isset($this->view->user)) front::flash(lang('请登陆!'));
         $vote=new vote();
         $_vote=$vote->getrow('aid='.front::post('aid'));
         if(eregi($this->view->user['username'].',',$_vote['users'])) {
             front::flash(lang('不能重复投票!'));
             front::redirect(front::$from);
         }
         $_votes=$_vote['votes'];
         if(!$_votes) $_votes=array();
         else $_votes=unserialize($_votes);
         $_votes[front::post('vote')]=$_votes[front::post('vote')]+1;
         $votes=serialize($_votes);
         $vote_data=array_merge($_vote,array('votes'=>$votes,'aid'=>front::post('aid'),'users'=>$_vote['users'].$this->view->user['username'].','));
         $vote->rec_replace($vote_data,front::post('aid'));
         front::flash(lang('投票成功!'));
     }else {
         front::flash(lang('投票失败!'));
     }
     front::redirect(front::$from);
 }
 function emailpost_action() {
 	if(!front::post('guestemail')) {
 		front::flash(lang('请填写联系电话!'));
 		return false;
 	}
 	if(!front::post('title')) {
 		front::flash(lang('请填写标题!'));
 		return false;
 	}
 	if(!front::post('content')) {
 		front::flash(lang('请选择内容!'));
 		return false;
 	}
 	if(config::get('verifycode')) {
 		if(front::post('verify')<>session::get('verify')) {
 			front::flash(lang('验证码错误!'));
 			return false;
 		}
 	}
 	$smtpemailto = config::get('email'); 
 	$title = "网站留言:".front::post('title'); 
 	
 	$mailbody = "客户邮箱: ".front::post('content'); 
 		
 	$this->sendmail($smtpemailto, $title, $mailbody); 
 	
 	front::flash(lang('留言成功!'));	
 }
function sendMsg($mobile, $content) {
    $tc = file_get_contents('config/sms.tmp.php');
    $tmp = explode('@', $tc);
    if ($tmp[0] >= config::get('sms_maxnum') && $tmp[1] == date('Y-m-d')) {
    	front::flash('发送失败,请检查用户名、密码或剩余条数');
        return;
    }
    include_once("phprpc/phprpc_client.php");
    $client = new PHPRPC_Client();
    $client->setProxy(NULL);
    $client->useService('http://pay.cmseasy.cn/sms.php');
    $client->setKeyLength(128);
    $client->setEncryptMode(3);
    $keys = config::get('sms_keyword');
    if ($keys != '') {
        $keys = explode(',', $keys);
        $content = str_ireplace($keys, '*', $content);
    }
    $rs = $client->sendMsg($mobile, $content, config::get('sms_username'), md5(config::get('sms_password')));
    if ($rs->SendSMSResult == '0') {
        $num = $tmp[0] + 1;
        file_put_contents('config/sms.tmp.php', $num . '@' . date('Y-m-d'));
    }
    return $rs;
}
Example #15
0
 function checkstr($str) {
     if (preg_match("/<(\/?)(script|i?frame|style|html|body|title|link|meta)([^>]*?)>/is",$str,$match)) {
         front::flash(print_r($match,true));
         return false;
     }
     if (preg_match("/(<[^>]*)on[a-zA-Z]+\s*=([^>]*>)/is",$str,$match)) {
         return false;
     }
     return true;
 }
 function setting_action() {
     $this->_view_table=false;
     $set=settings::getInstance();
     $sets=$set->getrow(array('tag'=>'table-'.$this->table));
     $data=unserialize($sets['value']);
     if (front::post('submit')) {
         $var=front::$post;
         unset($var['submit']);
         $set->rec_replace(array('value'=>serialize($var),'tag'=>'table-'.$this->table,'array'=>var_export($var,true)));
         front::flash("{$this->tname}配置成功!");
     }
     $this->view->settings=$data;
 }
Example #17
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>';
            }
        }
    }
Example #18
0
 function delete_action() {
     $this->manage->delete_before(front::get('id'));
     $delete=$this->_table->rec_delete(front::get('id'));
     if ($delete) front::flash("删除{$this->tname}成功!");
     front::redirect(url::modify('act/list/table/'.$this->table));
 }
Example #19
0
 function register_action() {
     $r = $this->_union->getrow(array('userid'=>$this->view->data['userid']));
     if($r) {
         echo '<script type="text/javascript">alert("'.lang('你已经申请,转入联盟页面!').'")</script>';
         front::refresh(url::create('union/stats'));
     }
     if(front::post('submit')) {
         if(!config::get('reg_on')) {
             front::flash(lang('网站已经关闭注册!'));
             return;
         }
         if(config::get('verifycode')) {
             if(!session::get('verify') ||front::post('verify')<>session::get('verify')) {
                 front::flash(lang('验证码错误!'));
                 return;
             }
         }
         if(front::post('nickname') != strip_tags(front::post('nickname'))
                 ||front::post('nickname') != htmlspecialchars(front::post('nickname'))
         ) {
             front::flash(lang('姓名不规范!'));
             return;
         }
         if(strlen(front::post('nickname'))<4) {
             front::flash(lang('请填写认真填写真实姓名!'));
             return;
         }
         if(strlen(front::post('payaccount'))<1) {
             front::flash(lang('请填写支付账号!'));
             return;
         }
         if(strlen(front::post('tel'))<1) {
             front::flash(lang('请填写联系电话!'));
             return;
         }
         if(strlen(front::post('address'))<1) {
             front::flash(lang('请填写联系地址!'));
             return;
         }
         if(strlen(front::post('website'))<1) {
             front::flash(lang('请填写网站地址!'));
             return;
         }
         /*if(strlen(front::post('e_mail'))<1) {
             front::flash(lang('请填写邮箱!'));
             return;
         }*/
         if(is_array($_POST)){
         	foreach ($_POST as $v){
         		if(preg_match('/(select|load_file|\[|password)/i', $v)){
         			exit('not access');
         		}
         	}
         }
         $userarr = array();
         $userarr['nickname'] = front::$post['nickname'];
         $userarr['tel'] = front::$post['tel'];
         $userarr['address'] = front::$post['address'];
         //$userarr['e_mail'] = front::$post['e_mail'];
         $unionarr = array();
         $unionarr['userid'] = $this->view->data['userid'];
         $unionarr['username'] = $this->view->data['username'];
         $unionarr['payaccount'] = front::$post['payaccount'];
         $unionarr['website'] = front::$post['website'];
         $unionarr['profitmargin'] = union::getconfig('profitmargin');
         $unionarr['regtime'] = time();
         $unionarr['regip'] = front::ip();
         $unionarr['passed'] = 1;
         if(front::post('nickname') &&$this->view->data['userid']) {
             $insert=$this->_user->rec_update($userarr,'userid='.$this->view->user['userid']);
             $insert1 = $this->_union->rec_insert($unionarr);
             if($insert &&$insert1) front::flash(lang('申请成功!'));
             else {
                 front::flash(lang('申请失败!'));
                 return;
             }
             front::redirect(url::create('union/stats'));
             exit;
         }
         else {
             front::flash(lang('申请失败!'));
             return;
         }
     }
 }
Example #20
0
 function setting_action() {
 	if($this->table == 'archive'){
 		chkpw('archive_setting');
 	}
 	if($this->table == 'friendlink'){
 		chkpw('seo_friendlink_setting');
 	}
     $this->_view_table=false;
     $set=settings::getInstance();
     $sets=$set->getrow(array('tag'=>'table-'.$this->table));
     $data=unserialize($sets['value']);
     if (front::post('submit')) {
         $var=front::$post;
         unset($var['submit']);
         $set->rec_replace(array('value'=>mysql_escape_string(serialize($var)),'tag'=>'table-'.$this->table,'array'=>mysql_escape_string(var_export($var,true))));
         event::log("修改{$this->tname}配置",'成功');
         front::flash("配置成功!");
     }
     $this->view->settings=$data;
 }
Example #21
0
 function delete_action() {
     front::check_type(front::get('id'));
     $row = $this->_table->getrow(array('id'=>front::get('id')));
     if($row['mid'] != $this->view->user['userid']){
     	exit('你没权限删除');
     }
     $delete=$this->_table->rec_delete(front::get('id'));
     if($delete)  front::flash(lang('删除记录成功!'));
     front::redirect(url::modify('act/list/manage/'.$this->table));
 }
Example #22
0
 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>&nbsp;&nbsp;";
         }
         $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>&nbsp;&nbsp;";
         }
         
         //分类连接
         $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>&nbsp;&nbsp;";
         }
         
         //地区连接
         $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;
 }
Example #23
0
 function loginfalsemaxtimes() {
     if (cookie::get('loginfalse'.md5($_SERVER['REQUEST_URI'])) >10 ||event::loginfalsemaxtimes()) {
         front::flash('帐号输入错误次数太多!请1小时后再登录!');
         return true;
     }
 }
Example #24
0
 function add_action() {
     if(front::$post['submit']) {
         if(config::get('verifycode')) {
             if(!session::get('verify') ||front::post('verify')<>session::get('verify')) {
                 alerterror(lang('验证码错误!'));
                 $this->render(@setting::$var[$this->table]['myform']['template']);
                 $this->end=false;
                 return;
             }
         }
         front::$post['checked']=0;
         front::$post['userid']=$this->view->user['userid'];
         front::$post['username']=$this->view->user['username'];
         front::$post['author']=$this->view->user['username'];
         front::$post['adddate']=date('Y-m-d H:i:s');
         front::$post['ip']=front::ip();
         foreach(front::$post as $k=>$p) {
             if( is_array($p))  front::$post[$k]=implode(',',$p);
         }
         $data=front::$post;
         $insert=$this->_table->rec_insert($data);
         if($insert<1) {
             front::flash(lang('表单提交失败!'));
         }
         else {
             if(is_array(front::$post) &&!empty(front::$post)) {
                 foreach(front::$post as $k =>$v) {
                     if(preg_match('/^my_.*?mail$/i',$k) &&strstr($v,'@')) {
                         $email = front::$post[$k];
                         break;
                     }
                 }
                 foreach(front::$post as $k =>$v) {
                     if(preg_match('/^my_.*?tel$/i',$k) &&strstr($v,'@')) {
                         $tel = front::$post[$k];
                         break;
                     }
                 }
             }
             $code = '';
             foreach ($this->view->field as $k =>$v) {
                 $cname = setting::$var[$this->table][$k]['cname'];
                 $val = front::$post[$k];
                 $code .= $cname.": ".$val."<br>";
             }
             $smtpemailto = config::get('email');
             $title = setting::$var[$this->table]['myform']['cname'].lang('的结果');
             if(config::get('email_form_on') && $email) {
                 $this->sendmail($email,$title,$code);
             }
             if(config::get('email_form_on') && $smtpemailto) {
                 $this->sendmail($smtpemailto,$title,$code);
             }
             if($tel) {
                 if(config::get('sms_on') && config::get('sms_form_on')){
                     sendMsg($tel,config::get('sms_form'));
                 }
                 if(config::get('sms_on') && config::get('sms_form_admin_on') && $mobile = config::get('site_mobile')){
                     sendMsg($mobile,front::$post['username'].'在'.date('Y-m-d H:i:s').'提交了表单');
                 }
             }
             if(front::$post['aid']){
                 echo "<script>alert('表单提交成功!');window.location.href='".url::create('/archive/show/aid/'.front::$post['aid'])."'</script>";
                 //front::redirect();
             }else{
                 front::redirect(url::create('/form/message'));
             }
         }
     }
     $this->render(@setting::$var[$this->table]['myform']['template']);
     $this->end=false;
 }
    function phpwebinsert_action(){
    	chkpw('func_data_phpweb');
        //插入数据库的总条目数
        $total_num = 0;
        $set=settings::getInstance();
        $set->name = $set->prefix.'user';
        //目标表前缀
        $d_prefix = $set->prefix;
        $user_info = $set->rec_select_one("`username`='{$_COOKIE['login_username']}'","*","`userid`");
               
        if(!empty(front::$post['submit'])){    	       	
            //判断是否填写原表前缀
         	if(!empty(front::$post['phpweb_prefix'])){
         		$s_prefix = front::$post['phpweb_prefix'].'_';
         	}else{
       		    front::flash('请填写原表前缀');
       		    return ;
          	}
          	//判断上传的数据库文件是否存在
          	$filename = ROOT.'/'.front::$post['data'];
          	if(!file_exists(ROOT.'/'.front::$post['data'])){
          		front::flash('请检查是否正确上传数据库文件');
          		return ;
          	}
            //记录前面插入的category的id
    	    $cat_id = array();
            $sql_file = fopen($filename,'r');
            while ($row = fgets($sql_file)){
               //如果这一行不是INSERT语句就略过
               if(!strstr($row,'INSERT')) continue; 
           
               $tmp = strstr($row,'(');
               $tmp = trim($tmp,"\n\t\r\0\x0B(); ");
               $tmp_arr = explode('),(',$tmp);
            
               //如果是feedback_info表,则选择对应数据插入guestbook中
               if(strstr($row,$s_prefix.'feedback_info')){
           	       foreach($tmp_arr as $v){
           	            $arr = super_explode($v);
           	            $arr_data = array(
           	                      'username'  =>$arr[4],
           	                      'adddate'   =>date('Y-m-d H:i:s',$arr[26]),
           	                      'state'     =>$arr[29],
           	                      'guesttel'  =>$arr[6],
           	                      'guestemail'=>$arr[8],           	                 
           	                      'guestqq'   =>$arr[10],
           	                      'title'     =>$arr[2],
           	                      'content'   =>$arr[3],
           	            );
           	           $id = put_into_db($d_prefix.'guestbook',$arr_data);
           	           if($id) $total_num++;
           	       
           	       }
                   continue;
               }
          
               //如果是advs_link表,则选择对应数据插入linkword中
               if(strstr($row,$s_prefix.'advs_link')){
           	       foreach($tmp_arr as $v){
           	            $arr = super_explode($v);
           	            $arr_data = array(
           	                      'linkword'  =>$arr[2],
           	                      'linkurl'   =>$arr[3],
           	                      'linktimes' =>mktime(),
           	            );
           	            $id = put_into_db($d_prefix.'linkword',$arr_data);
           	            if($id) $total_num++;
           	       }
                   continue;
               }
           
               //如果是pollindex表,则选择对应数据插入ballot中
               if(strstr($row,$s_prefix.'tools_pollindex')){
           	       foreach($tmp_arr as $v){
           	           $arr = super_explode($v);
           	            $arr_data = array(
           	                      'id'    =>$arr[0],
           	                      'title' =>$arr[1],
           	                          'type'  =>'radio',
           	            );
               	       $id = put_into_db($d_prefix.'ballot',$arr_data);
               	       if($id) $total_num++;
           	   }
                   continue;
               }
           
               //如果是tools_polldata表,则选择对应数据插入option中
               if(strstr($row,$s_prefix.'tools_polldata')){
               	   foreach($tmp_arr as $v){
               	        $arr = super_explode($v);
               	        $arr_data = array(
              	                  'bid'  =>$arr[1],
               	                  'name' =>$arr[3],
               	                  'num'  =>$arr[5],
               	                  'order'=>$arr[2],
               	                );
               	       $id = put_into_db($d_prefix.'option',$arr_data);
               	       if($id) $total_num++;
               	   }
                   continue;
               }
           
               //如果是product_cat表,则选择对应数据插入b_category中
               if(strstr($row,$s_prefix.'product_cat')){
               	   foreach($tmp_arr as $v){
               	        $arr = super_explode($v);
               	        $arr_data = array(
               	                  'parentid'          =>3,
           	                      'catname'           =>$arr[2],
           	                      'listorder'         => $arr[3],
           	                      'htmldir'           =>pinyin::get($arr[2]),
           	                      'showtemplate'      =>0,
           	                      'template'          =>'archive/list_pic.html',           	                   	        
               	                  'listtemplate'      =>'archive/list_pic.html',
               	                  'showtemplate'      =>'archive/show_products.html',
               	                  'includecatarchives'=>1,
           	                      'ispages'           =>1,
           	                      'ishtml'            =>0,      
           	                      'includecatarchives'=>1,     	                 
           	                      'thumb_width'       =>0,
           	                      'thumb_height'      =>0,
               	                  'isnav'             =>0, //是否在导航栏显示字段
               	                );
               	       $id = put_into_db($d_prefix.'b_category',$arr_data);
           	           $cat_id['product_cat'][$arr[0]] = $id;
           	           if($id) $total_num++;
           	       }
                   continue;
               }
           
               //如果是product_con表,则选择对应数据插入archive中
               if(strstr($row,$s_prefix.'product_con')){
               	   foreach($tmp_arr as $v){
           	            $arr = super_explode($v);
           	            $arr_data = array(
           	                      'catid'        =>isset($cat_id['product_cat'][$arr[1]]) ? $cat_id['product_cat'][$arr[1]] : -1,
           	                      'title'        =>$arr[5],
           	                      'username'     =>$user_info['username'],
               	                  'userid'       =>$user_info['userid'],
               	                  'view'         =>7,//确认首页是以图片的版面来显示
               	                  'spid'         =>0,
           	                      'tag'          =>$arr[43], 
           	                      'keyword'      =>$arr[43],           	                  
           	                      'listorder'    =>0,
           	                      'adddate'      =>date('Y-m-d H:i:s',$arr[16]),
           	                      'author'       =>$arr[17],
               	                  'thumb'        =>$arr[15],//列表显示的图片
               	                  'state'        =>1,           	                 
               	                  'checked'      =>1,
           	                      'introduce'    =>$arr[22],
           	                      'introduce_len'=>200,
           	                      'content'      =>$arr[6],
           	                      'template'     =>'archive/show_products.html',
           	                      'ishtml'       =>0,
               	                  'attr2'        =>9,//产品金额
               	                  'pics'         =>'a:1:{i:0;s:0:"";}',//内容多图
               	                  'city_id'      =>0,
               	                  'section_id'   =>0,
           	                    );
           	            $id = put_into_db($d_prefix.'archive',$arr_data);
           	            if($id) $total_num++;
               	   }
                   continue;
               }

               //如果是news_cat表,则选择对应数据插入b_category中
               if(strstr($row,$s_prefix.'news_cat')){
           	       foreach($tmp_arr as $v){
           	            $arr = super_explode($v);
           	            $arr_data = array(
           	                      'parentid'          =>2,
           	                      'catname'           =>$arr[2],
           	                      'listorder'         =>$arr[3],
           	                      'htmldir'           =>pinyin::get($arr[2]),          	                  
           	                      'template'          =>'archive/list_text.html',             	                         	                   	        
           	                      'listtemplate'      =>'archive/list_text.html',
           	                      'showtemplate'      =>0,
           	                      'includecatarchives'=>1,
           	                      'ispages'           =>1,
           	                      'ishtml'            =>0,    
           	                      'includecatarchives'=>1,       	                 
           	                      'thumb_width'       =>0,
           	                      'thumb_height'      =>0,
           	                      'isnav'             =>0, //是否在导航栏显示字段
           	                    );
           	           $id = put_into_db($d_prefix.'b_category',$arr_data);
           	           $cat_id['news_cat'][$arr[0]] = $id;
           	           if($id) $total_num++;
           	       }
                   continue;
               }
           
               //如果是news_con表,则选择对应数据插入archive中
               if(strstr($row,$s_prefix.'news_con')){
           	       foreach($tmp_arr as $v){
           	            $arr = super_explode($v);
           	            $arr_data = array(
           	                      'catid'        =>isset($cat_id['news_cat'][$arr[1]]) ? $cat_id['news_cat'][$arr[1]] : -1 ,
           	                      'title'        =>$arr[5],
           	                      'tag'          =>$arr[46], 
           	                      'username'     =>$user_info['username'],
           	                      'userid'       =>$user_info['userid'],
           	                      'view'         =>0,//确认首页是以文本版面显示
           	                      'spid'         =>0,
           	                      'keyword'      =>$arr[46],       	                  
           	                      'listorder'    =>0,
           	                      'adddate'      =>date('Y-m-d H:i:s',$arr[16]),
           	                      'author'       =>$arr[17],
           	                      'thumb'        =>'',//列表显示的图片
           	                      'state'        =>1,           	                 
           	                      'checked'      =>1,
           	                      'introduce'    =>$arr[22],
           	                      'introduce_len'=>200,
           	                      'content'      =>$arr[6],
           	                      'template'     =>0,
           	                      'ishtml'       =>0,
           	                      'attr2'        =>'',//产品金额
           	                      'pics'         =>'a:0:{}',
           	                      'city_id'      =>0,
           	                      'section_id'   =>0,
           	                    );
           	            $id = put_into_db($d_prefix.'archive',$arr_data);
           	            if($id) $total_num++;
           	       }
                   continue;
               }
           
               //如果是down_cat表,则选择对应数据插入b_category中
               if(strstr($row,$s_prefix.'down_cat')){
           	       foreach($tmp_arr as $v){
           	            $arr = super_explode($v);
           	            $arr_data = array(
           	                      'parentid'          =>6,
           	                      'catname'           =>$arr[2],
           	                      'listorder'         =>$arr[3],
           	                      'htmldir'           =>pinyin::get($arr[2]),          	                  
           	                      'template'          =>'archive/list_down.html',             	                         	                   	        
           	                      'listtemplate'      =>'archive/list_down.html',
           	                      'showtemplate'      =>0,
           	                      'includecatarchives'=>1,
           	                      'ispages'           =>1,
           	                      'ishtml'            =>0,    
           	                      'includecatarchives'=>1,       	                 
           	                      'thumb_width'       =>0,
           	                      'thumb_height'      =>0,
           	                      'isnav'             =>0, //是否在导航栏显示字段
           	                    );
           	           $id = put_into_db($d_prefix.'b_category',$arr_data);
           	           $cat_id['down_cat'][$arr[0]] = $id;
           	           if($id) $total_num++;
           	       }
                   continue;
               }
           
               //如果是down_con表,则选择对应数据插入archive中
               if(strstr($row,$s_prefix.'down_con')){
           	       foreach($tmp_arr as $v){
           	            $arr = super_explode($v);
           	            $arr_data = array(
           	                      'catid'        =>isset($cat_id['down_cat'][$arr[1]]) ? $cat_id['down_cat'][$arr[1]] : -1 ,
           	                      'title'        =>$arr[5],
           	                      'tag'          =>$arr[45], 
           	                      'username'     =>$user_info['username'],
           	                      'userid'       =>$user_info['userid'],
           	                      'view'         =>0,//确认首页是以文本版面显示
           	                      'spid'         =>0,
           	                      'keyword'      =>$arr[45],       	                  
           	                      'listorder'    =>0,
           	                      'adddate'      =>date('Y-m-d H:i:s',$arr[16]),
           	                      'author'       =>$arr[17],
           	                      'thumb'        =>'',//列表显示的图片
           	                      'state'        =>1,           	                 
           	                      'checked'      =>1,
           	                      'introduce'    =>$arr[22],
           	                      'introduce_len'=>200,
           	                      'content'      =>$arr[6],
           	                      'template'     =>0,
           	                      'ishtml'       =>0,
           	                      'linkto'       =>$arr[43],
           	                      'attr1'        =>$arr[44],//存放文件被下载的次数
           	                      'pics'         =>'a:1:{i:0;s:0:"";}',
           	                      'city_id'      =>0,
           	                      'section_id'   =>0,
           	                    );
           	            $id = put_into_db($d_prefix.'archive',$arr_data);
           	            if($id) $total_num++;
           	       }
                   continue;
               }
           
               //如果是photo_cat表,则选择对应数据插入b_category中
               if(strstr($row,$s_prefix.'photo_cat')){
           	       foreach($tmp_arr as $v){
           	            $arr = super_explode($v);
           	            $arr_data = array(
           	                      'parentid'          =>2,
               	                  'catname'           =>$arr[2],
               	                  'listorder'         => $arr[3],
               	                  'htmldir'           =>pinyin::get($arr[2]),          	                  
           	                      'template'          =>'archive/list_text.html',             	                         	                   	        
           	                      'listtemplate'      =>'archive/list_text.html',
           	                      'showtemplate'      =>0,
           	                      'includecatarchives'=>1,
           	                      'ispages'           =>1,
               	                  'ishtml'            =>0,    
               	                  'includecatarchives'=>1,       	                 
               	                  'thumb_width'       =>0,
           	                      'thumb_height'      =>0,
           	                      'isnav'             =>0, //是否在导航栏显示字段
           	                    );
           	           $id = put_into_db($d_prefix.'b_category',$arr_data);
           	           $cat_id['photo_cat'][$arr[0]] = $id;
           	           if($id) $total_num++;
           	       }
                   continue;
               }
           
               //如果是photo_con表,则选择对应数据插入archive中
               if(strstr($row,$s_prefix.'photo_con')){
               	   foreach($tmp_arr as $v){
           	            $arr = super_explode($v);
           	            $arr_data = array(
               	                  'catid'        =>isset($cat_id['photo_cat'][$arr[1]]) ? $cat_id['photo_cat'][$arr[1]] : -1 ,
               	                  'title'        =>$arr[5],
               	                  'tag'          =>$arr[22], 
           	                      'username'     =>$user_info['username'],
           	                      'userid'       =>$user_info['userid'],
           	                      'view'         =>0,//确认首页是以文本版面显示
           	                      'spid'         =>0,
           	                      'keyword'      =>$arr[22],       	                  
               	                  'listorder'    =>0,
               	                  'adddate'      =>date('Y-m-d H:i:s',$arr[16]),
               	                  'author'       =>$arr[17],
           	                      'image'        =>$arr[15],//列表显示的图片
           	                      'state'        =>1,           	                 
           	                      'checked'      =>1,
           	                      'introduce'    =>$arr[22],
           	                      'introduce_len'=>200,
           	                      'content'      =>$arr[6],
           	                      'template'     =>0,
           	                      'ishtml'       =>0,
           	                      'attr2'        =>'',//产品金额
           	                      'pics'         =>'a:0:{}',
           	                      'city_id'      =>0,
           	                      'section_id'   =>0,
           	                    );
           	            $id = put_into_db($d_prefix.'archive',$arr_data);
           	            if($id) $total_num++;
           	       }
                   continue;
               } 
             }
             front::flash('已共插入'.$total_num.'条数据');
         }
    }
Example #26
0
 public function rec_insert($tag_info) {
     $setting=array();
     foreach ($tag_info as $key=>$tag) {
         if (!in_array($key,explode(',',$this->getcols()))) {
             unset($tag_info[$key]);
             $setting[$key]=$tag;
         }
     }
     $max_id=0;
     foreach (self::$setting as $set) {
         if ($set['name'] == $tag_info['name']) {
             front::flash("标签 $tag_info[name] 已存在!");
             return false;
         }
         if ($set['id'] >$max_id)
             $max_id=$set['id'];
     }
     $this->insert_id=$max_id +1;
     $tag_info=array_merge(array('id'=>$max_id +1),$tag_info,array('tagfrom'=>get('tagfrom'),'setting'=>$setting));
     self::$setting[]=$tag_info;
     $this->savesetting();
     return true;
 }
Example #27
0
    function getpass_action() {
        if(front::post('step') == '') {
            echo template('user/getpass.html');
        }else if(front::post('step') == '1') {
            if(!session::get('verify') ||front::post('verify')<>session::get('verify')) {
                front::flash(lang('验证码错误!'));
                return;
            }
            if(strlen(front::post('username'))<4) {
                front::flash(lang('用户名太短!'));
                return;
            }
            $user=new user();
            $user=$user->getrow(array('username'=>front::post('username')));
            $this->view->user = $user;
            session::set('answer',$user['answer']);
            session::set('username',$user['username']);
            session::set('e_mail',$user['e_mail']);
            if(!empty($user['answer'])) {
                echo template('user/getpass_1.html');
            }else {
                session::set('ischk','true');
                echo template('user/getpass_2.html');
            }
        }else if (front::post('step') == '2') {
            if(strlen(front::post('answer'))<1) {
                echo '<script>alert("'.lang('请输入答案!').'");</script>';
                return;
            }
            if(front::post('answer') != session::get('answer')) {
                echo '<script>alert("'.lang('您的答案错误!').'");</script>';
                return;
            }
            session::set('ischk','true');
            echo template('user/getpass_2.html');
        }else if (front::post('step') == '3') {
            if(strlen(front::post('e_mail'))<1) {
                echo '<script>alert("'.lang('请输入注册填写的邮箱!').'");</script>';
                return;
            }
            if(front::post('e_mail') != session::get('e_mail')) {
                echo '<script>alert("'.lang('邮箱和用户不匹配!').'");</script>';
                return;
            }
            if(session::get('ischk') == 'true') {
                function randomstr($length) {
                    $str = '1234567890abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLOMNOPQRSTUVWXYZ';
                    for($i=0;$i<$length;$i++) {
                        $str1 .= $str{mt_rand(0,35)};
                    }
                    return $str1;
                }
                $password1 = randomstr(6);
                $password = md5($password1);
                $user=new user();
                $user->rec_update(array('password'=>$password),'username="******"');
                config::setPath(ROOT.'/config/config.php');
                function sendmail($email_to,$email_subject,$email_message,$email_from = '') {
                    extract($GLOBALS,EXTR_SKIP);
                    require ROOT.'/lib/tool/sendmail_inc.php';
                }
                $mail[email]=config::get('email');
                sendmail(session::get('username').' <'.session::get('e_mail').'>',lang('会员找回密码'),' '.lang('尊敬的').session::get('username').', '.lang('您好! 您的新密码是').':'.$password1.' '.lang(您可以登录后到会员中心进行修改).'!',$mail[email]);
                echo '<script>alert("系统重新生成的密码已经发送到你的邮箱,跳转到登录页!!");
window.location="index.php?case=user&act=login"</script>';
            }else {
                echo '<script>alert("'.lang('参数错误!').'");</script>';
                return;
            }
        }
        exit;
    }
 function init() {
 }
 
 function getcnzz_action(){