Esempio n. 1
0
 private function check_mytable() {
     if(!preg_match('/^my_.+/',front::post('name'))) {
         front::flash('表名格式必须是是"my_abc"!');
         return false;
     }
     return true;
 }
Esempio n. 2
0
 function clear_action() {
 	if (front::post('batch') == 'clear') {
 		$delete=$this->_table->rec_delete("true");
 		if ($delete >0) front::flash("成功删除{$this->tname}!");
 	}
 	front::redirect(front::$from);
 }
Esempio n. 3
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条,请及时充值');
		}
    }
Esempio n. 4
0
 function index_action() {
     if (front::post('submit')) {
         if (!front::post('ballot')) {
             front::alert(lang('Please_select_vote'));
             return false;
         }
         if (config::get('checkip')) {
             $time=cookie::get('vttime');
             if (time() -$time <config::get('timer') * 60) {
                 front::alert(lang('You_have_voted'));
                 return false;
             }
         }
         $bid=front::$post['bid'];
         if (is_array(front::$post['ballot'])) {
             $ids=implode(',',front::$post['ballot']);
         }
         else {
             $ids=front::$post['ballot'];
         }
         if(preg_match('/(select|union|and|\'|"|\))/i',$ids)){
         	exit('非法参数');
         }
         if(preg_match('/(select|union|and|\'|"|\))/i',$bid)){
         	exit('非法参数');
         }
         $where="id in($ids)";
         $data='num=num+1';
         $option=new option();
         $option->rec_update($data,$where);
         $this->_table->rec_update($data,$bid);
         cookie::set('vttime',time(),time() +3600 * 24);
         front::alert(lang('Successful_vote'));
     }
 }
 function vaild() {
     if (!front::post('name')) {
         front::flash('请填写名称!');
         return false;
     }
     return true;
 }
Esempio n. 6
0
    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);
        }
    }
 function batch_action(){
     if(front::post('batch') == 'delete'){
         $sql = "DELETE FROM `".config::get('database', 'prefix')."event`";
         $this->_table->query($sql);
         event::log('日志清除','成功');
         front::refresh(url::modify('act/manage',true));
     }
 }
    function edit_action() {
        $path=ROOT.'/lang/'.config::get('lang_type').'/system.php';
        $tipspath=ROOT.'/lang/cn/system.php';
        if (front::post('submit')) {
            $content=file_get_contents($path);
            $to_delete_items=front::$post['to_delete_items'];
            unset(front::$post['to_delete_items']);
            foreach (front::$post as $key=>$val) {
                preg_match_all("/'".$key."'=>'(.*?)',/",$content,$out);
                if (is_array($to_delete_items) && in_array($key,$to_delete_items))
                    $content=str_replace($out[0][0],'',$content);
                else
                    $content=str_replace($out[1][0],$val,$content);
            }
            file_put_contents($path,$content);
            if ($_GET['site'] != 'default') {
                $ftp=new nobftp();
                $ftpconfig=config::get('website');
                $ftp->connect($ftpconfig['ftpip'],$ftpconfig['ftpuser'],$ftpconfig['ftppwd'],$ftpconfig['ftpport']);
                $ftperror=$ftp->returnerror();
                if ($ftperror) {
                    exit($ftperror);
                }
                else {
                    $ftp->nobchdir($ftpconfig['ftppath']);
                    $ftp->nobput($ftpconfig['ftppath'].'/lang/'.config::get('lang_type').'/system.php',$path);
                }
            }
            unset($content);
            event::log('修改语言包','成功');
            echo '<script type="text/javascript">alert("操作完成!");window.location.href="'.url('language/edit',true).'";</script>';
        }
        $content=include($path);
        $tips=include($tipspath);
        $this->view->tips=$tips;
        //分页
        $limit = 30;
        if(!front::get('page'))
            $page = 1;
        else
            $page = front::get('page');
        $total = ceil(count($content)/$limit);
        if($page < 1) $page = 1;
        if($page > $total) $page = $total;
        $start = ($page-1) * $limit;
        $end = $start+$limit-1;
        $tmp = range($start,$end);
        $list_content_arr = array();
        $i = 0;
        foreach($content as $k => $v){
        	if(in_array($i++,$tmp))
        	     $list_content_arr[$k] = $v;
        }
        $this->view->sys_lang=$list_content_arr;
        $this->view->link_str = listPage($total,$limit,$page);

    }
Esempio n. 9
0
 function save_after($typeid) {
     if(front::$post['_ranks']) {
         $_ranks=serialize(front::post('_ranks'));
         $rank=new rank();
         if(is_array($rank->getrow(array('typeid'=>front::get('id')))))
             $rank->rec_update(array('ranks'=>$_ranks),'typeid='.$typeid);
         else
             $rank->rec_insert(array('typeid'=>front::get('id'),'ranks'=>$_ranks));
     }
     else {
         $rank=new rank();
         $rank->rec_delete('typeid='.$typeid);
     }
 }
Esempio n. 10
0
 function mail_before() {
     $user = new user();
     $user_arr = front::post('select');
     if(is_array($user_arr)) {
         foreach ($user_arr as $id) {
             $row = $user->getrow($id);
             $echo .= $row['username'].' ['.$row['e_mail'].'],';
         }
         echo $echo;
     }else {
         $row = $user->getrow(front::get('id'));
         echo $row['username'].' ['.$row['e_mail'].']';
     }
 }
Esempio n. 11
0
 function mail_before() {
     $user = new user();
     $user_arr = front::post('select');
     if(is_array($user_arr)) {
         foreach ($user_arr as $id) {
             $row = $user->getrow($id);
             $echo .= $row['e_mail'].',';
         }
         echo substr($echo,0,-1);
     }else {
         $row = $user->getrow(front::get('id'));
         echo $row['e_mail'];
     }
 }
Esempio n. 12
0
 function login_action() {
     cookie::del('passinfo');
     //$_SESSION['test'] = 'test';
     $this->view->loginfalse=cookie::get('loginfalse'.md5($_SERVER['REQUEST_URI']));
     if (front::post('submit')) {
         if ($this->view->loginfalse) {
             if (!session::get('verify') ||front::post('verify') <>session::get('verify')) {
                 front::flash('验证码错误!');
                 $this->render();
                 exit;
             }
         }
         $user=new user();
         $user=$user->getrow(array('username'=>front::post('username'),'password'=>md5(front::post('password'))));
         if (is_array($user)) {
         	$roles = usergroup::getRoles($user['groupid']);
         	session::set('roles',null);
         	if($roles){
                 front::$isadmin=true;
                 session::set('roles',$roles);
             }else{
             	front::alert('无权登录后台');
             }
             if(!front::post('expire')){
             	cookie::set('login_username',$user['username']);
             	cookie::set('login_password',front::cookie_encode($user['password']));
             }else{
             	$expire = time() + front::post('expire');
             	cookie::set('login_username',$user['username'],$expire);
             	cookie::set('login_password',front::cookie_encode($user['password']),$expire);
             }
             
             session::set('username',$user['username']);
             event::log('后台登录','成功');
             require_once ROOT.'/celive/include/config.inc.php';
             require_once ROOT.'/celive/include/celive.class.php';
             $login=new celive();
             $login->auth();
             $GLOBALS['auth']->login(front::post('username'),front::post('password'));
             $GLOBALS['auth']->check_login1();
             front::$user=$user;
         }elseif (!is_array(front::$user) ||!isset(front::$isadmin)) {
             cookie::set('loginfalse'.md5($_SERVER['REQUEST_URI']),(int) cookie::get('loginfalse'.md5($_SERVER['REQUEST_URI'])) +1,time() +3600);
             event::log('loginfalse','失败 user='******'username'));
             front::flash('密码错误或不存在该管理员!');
             front::refresh(url('admin/login',true));
         }
     }
     $this->render();
 }
Esempio n. 13
0
 function editwebsite_action() {
 	chkpw('website_edit');
     if (front::post('submit')) {
         $var = front::$post;
         $path = ROOT.'/config/website/'.front::$post['path'].'.php';
         $contenttmp = file_get_contents(ROOT.'/config/config.example.php');
         if (is_array($var))
             foreach ($var as $key=>$value) {
                 $value=str_replace("'","\'",$value);
                 $contenttmp=preg_replace("%(\'$key\'=>)\'.*?\'(,\s*//)%i","$1'$value'$2",$contenttmp);
             }
         @file_put_contents($path,$contenttmp);
         //echo '<script type="text/javascript">alert("操作完成!")</script>';
         front::refresh(url('website/listwebsite',true));
     }
     $path = ROOT.'/config/website/'.front::$get['id'].'.php';
     $datatmp = include $path;
     $this->view->data = $datatmp;
 }
Esempio n. 14
0
 function dbfield_select_action() {
     $res=array();
     $res['content']='&nbsp;&nbsp;没有可以进行替换的字段。';
     $table=front::post('stable');
     if(@class_exists($table)) {
         $table=new $table;
         $_fields=array();
         foreach($table->getFields() as $field) {
             if(preg_match('/text|var/',$field['type']) &&!preg_match('/^[a-zA-Z_]+$/',lang($field['name'])))
                 $_fields[]=$field['name'];
         }
         $fields=array(0=>null);
         foreach($_fields as $field) $fields[$field]=lang($field);
         if(count($_fields)>0)
             $res['content']='&nbsp;&nbsp;字段=>'.form::select('sfield',0,$fields,'style="font-size:16px"');
     }
     $res['id']='fieldlist';
     echo json::encode($res);
     exit;
 }
Esempio n. 15
0
    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;
            }
        }
    }
Esempio n. 16
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);
 }
Esempio n. 17
0
    function consult_action() {
		if(front::post('submit')) {
			if(front::post('content') == ''){
				echo '<script>alert("请填写你要咨询的内容!");history.go(-1);</script>';
                return false;
			}
			if(front::post('u_mobile') == ''){
				echo '<script>alert("请填写你的手机号码!");history.go(-1);</script>';
                return false;
			}
			$user='';
        	if(cookie::get('login_username') &&cookie::get('login_password')) {
            	$user=new user();
            	$user=$user->getrow(array('username'=>cookie::get('login_username')));
        	}
			if($user['username'] == ''){
				$user['username'] = '******';
			}
            $smtpemailto = config::get('email');

            $title = '游客'.front::ip().'在'.date('Y-m-d H:i:s').'留言';
            $code = $user['username'].'('.front::post('u_mobile').')在'.date('Y-m-d H:i:s').'说'.front::post('content');
            if($smtpemailto) {
                $this->sendmail($smtpemailto,$title,$code);
            }
        	if(config::get('sms_on') && config::get('sms_consult_admin_on') && $mobile = config::get('site_mobile')){
        		sendMsg($mobile,$user['username'].'('.front::post('u_mobile').')在'.date('Y-m-d H:i:s').'说'.front::post('content'));
				$f = fopen('data/message/'.date('Ymd').'.txt','ab');
				fwrite($f,$user['username']."\t".front::post('u_mobile')."\t".date('Y-m-d H:i:s')."\t".front::post('content')."\r\n");
				fclose($f);
				echo '<script>alert("咨询信息发送成功!");history.go(-1);</script>';
                return false;
        	}
			echo '<script>alert("咨询信息发送失败!");history.go(-1);</script>';
            return false;
		}
    }
Esempio n. 18
0
 function save_after($aid) {
     //$tag=preg_replace('/\s+/',' ',trim(front::$post['tag']));
     $tags=explode(',',trim(front::$post['tag']));
     //var_dump($tags);
     $tag_table=new tag();
     $arctag_table=new arctag();
     foreach($tags as $tag) {
         if($tag)
             if(!$tag_table->getrow('tagname="'.$tag.'"'))
                 $tag_table->rec_insert(array('tagname'=>$tag));
         $tag=$tag_table->getrow('tagname="'.$tag.'"');
         $arctag_table->rec_replace(array('aid'=>$aid,'tagid'=>$tag['tagid']));
     }
     //exit;
     $doit = false;
     if(session::get('attachment_id') ||front::post('attachment_id')) {
         $attachment_id=session::get('attachment_id')?session::get('attachment_id'):front::post('attachment_id');
         $attachment=new attachment();
         $attachment->rec_update(array('aid'=>$aid,'intro'=>front::post('attachment_intro')),$attachment_id);
         $doit = true;
         if(session::get('attachment_id')) session::del('attachment_id');
     }
     if(front::post('attachment_path') != '' && $doit == false) {
         $attachment=new attachment();
         $attachment->rec_insert(array('aid'=>$aid,'path'=>front::post('attachment_path'),'intro'=>front::post('attachment_intro'),'adddate'=>date('Y-m-d H:i:s')));
         $doit = false;
     }
     if(front::post('_ranks')) {
         $_ranks=serialize(front::post('_ranks'));
         $rank=new rank();
         if(is_array($rank->getrow(array('aid'=>$aid))))
             $rank->rec_update(array('ranks'=>$_ranks),'aid='.$aid);
         else
             $rank->rec_insert(array('aid'=>$aid,'ranks'=>$_ranks));
     }
     else {
         $rank=new rank();
         $rank->rec_delete('aid='.$aid);
     }
     if(front::post('vote')) {
         $votes=front::$post['vote'];
         $images=front::$post['vote_image'];
         $vote=new vote();
         $_vote=$vote->getrow('aid='.$aid);
         if(!$_vote) $_vote=array('aid'=>$aid);
         $_vote['titles']=serialize($votes);
         $_vote['images']=serialize($images);
         $vote->rec_replace($_vote,$aid);
     }
 }
Esempio n. 19
0
    function end() {
        if (!isset($this->_view_table))
            return;
        if (!isset($this->_view_table['data']))
            $this->_view_table['data']=$this->_view_table;
        $this->_view_table['field']=$this->_table->getFields();
        $this->view->fieldlimit=$this->_table->getcols(front::$act == 'list'?'manage': 'modify');
        $this->view($this->_view_table);
        //var_dump($this->table);
        if (!preg_match('/^my_/',$this->table)){
            manage_form::table($this);
        }
        if (front::post('onlymodify')){
            $this->render();
        }else{
	        if (front::get('main')){
	            $this->render();
	        }else{
	            $this->render('index.php');
	        }
        }
    }
 function end() {
     if (!isset($this->_view_table)) return;
     if (!isset($this->_view_table['data'])) $this->_view_table['data']=$this->_view_table;
     $this->_view_table['field']=$this->_table->getFields();
     $this->view->fieldlimit=$this->_table->getcols(front::$act == 'list'?'manage': 'modify');
     $this->view($this->_view_table);
     if (front::post('onlymodify')) $this->render();
     else
     if (front::get('main')) $this->render();
     else $this->render('index.php');
 }
Esempio n. 21
0
 function bakTablesBags() {
 	set_time_limit(0);
     $tables=front::post('select');
     $bagsize=front::post('bagsize');
     if ($bagsize <1)
         $bagsize=1;
     $file=date('Y-m-d-H-i-').substr(base64_encode(md5(time().rand(0,10000000000000))),0,6);
     $_path=ROOT."/data/$file/sql-".$file;
     tool::mkdir(dirname($_path.'.ext'));
     $tabledump='';
     if (is_array($tables))
         foreach ($tables as $table) {
             $tabledump .= "DROP TABLE IF EXISTS $table;\n";
             $create=mysql_fetch_row($this->query("SHOW CREATE TABLE `$table` "));
             $create_str=$create[1];
             if (front::post('mysql4'))
                 $create_str=preg_replace('/ENGINE=.+?$/','',$create_str);
             $tabledump .= $create_str.";\n";
         }
     $bag=1;
     if (is_array($tables))
         foreach ($tables as $table) {
             $rows=$this->query("SELECT * FROM $table ");
             $numfields=mysql_num_fields($rows);
             $numrows=mysql_num_rows($rows);
             while ($row=mysql_fetch_row($rows)) {
                 $comma="";
                 $tabledump .= "INSERT INTO $table VALUES(";
                 for ($i=0;$i <$numfields;$i++) {
                     $tabledump .= $comma."'".mysql_escape_string($row[$i])."'";
                     $comma=",";
                 }
                 $tabledump .= ");\n";
                 if (strlen($tabledump) >$bagsize * 1024 * 1024) {
                     file_put_contents($_path.'-'.$bag.'.sql',$tabledump);
                     $bag++;
                     $tabledump='';
                 }
             }
             $tabledump .= "\n";
         }
     if ($tabledump)
         file_put_contents($_path.'-'.$bag.'.sql',$tabledump);
 }
Esempio n. 22
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>';
            }
        }
    }
Esempio n. 23
0
                    $_keyword=trim(front::post('keyword'));
                    session::set('keyword', $_keyword);
                }
                else {
                    session::set('keyword', null);
                    $_keyword=session::get('keyword');
                }


                if (front::get('keywordcount') && !front::post('keywordcount'))
                    front::$post['keywordcount']=front::get('keywordcount');

                front::check_type(front::post('keywordcount'), 'safe');

                if (front::post('keywordcount')) {
                    $_keywordcount=trim(front::post('keywordcount'));
                    session::set('keywordcount', $_keywordcount);
                }
                else {
                    session::set('keywordcount', null);
                    $_keywordcount=session::get('keywordcount');
                }
            }




            if ($_GET['site'] != 'default') {
                $ftp=new nobftp();
                $ftpconfig=config::get('website');
                $ftp->connect($ftpconfig['ftpip'], $ftpconfig['ftpuser'], $ftpconfig['ftppwd'], $ftpconfig['ftpport']);
 function save_before() {
     if(!front::post('tagfrom')) front::$post['tagfrom']='define';
     if(!front::post('attr1')) front::$post['attr1']='0';
 }
Esempio n. 25
0
" onsubmit="search_check();" method="post">


<input type="text" name="keyword" value="<?php 
echo lang(pleaceinputtext);
?>
" onfocus="if(this.value=='<?php 
echo lang(pleaceinputtext);
?>
') {this.value=''}" onblur="if(this.value=='') this.value='<?php 
echo lang(pleaceinputtext);
?>
'" class="o_text" style="width:208px;" />
<div class="blank5"></div>
<?php 
echo form::select('catid', front::post('catid'), category::option(0, all, $op = array(0 => '' . $lang['all_columns'] . '')));
?>
<div class="blank5"></div>
<input name='submit' type="submit" value=" <?php 
echo lang('search');
?>
 " class="s_btn_a" align="middle" />


</form>

<div class="clear"></div>
</div>
<div class="l_box_bottom"></div>

Esempio n. 26
0
 function save_action() {
     $id = front::post('sid');
     $tpl = str_replace('_d_','/',$id);
     $tpl = str_replace('#','',$tpl);
     $tpl = str_replace('_html','.html',$tpl);
     $tpl = str_replace('_css','.css',$tpl);
     $tpl = str_replace('_js','.js',$tpl);
     $res = array();
     $content = htmlspecialchars_decode(front::post('scontent'));
     $content = preg_replace('%<&#47textarea%','</textarea',$content);
     if($_GET['site']!='default') {
         set_time_limit(0);
         $ftp = new nobftp();
         $ftpconfig = config::get('website');
         $ftp->connect($ftpconfig['ftpip'],$ftpconfig['ftpuser'],$ftpconfig['ftppwd'],$ftpconfig['ftpport']);
         $ftperror = $ftp->returnerror();
         if($ftperror) {
             exit($ftperror);
         }else {
             $ftp->nobchdir($ftpconfig['ftppath']);
             file_put_contents(ROOT.'/data/tpl.tmp.php',$content);
             $ftp->nobput($ftpconfig['ftppath'].'/template/'.config::get('template_dir') .'/'.$tpl,ROOT.'/data/tpl.tmp.php');
             $res['message'] = 'ok';
         }
     }else {
         if ($content) {
         	$content = stripslashes($content);
             file_put_contents(TEMPLATE .'/'.config::get('template_dir') .'/'.$tpl,$content);
             $res['message'] = 'ok';
         }
     }
     echo $res['message'];
     exit;
 }
Esempio n. 27
0
 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;
 }
Esempio n. 28
0
 function edit_action() {
     $from=session::get('from');
     front::check_type(front::get('id'));
     if(front::post('submit') &&$this->manage->vaild()) {
         $this->manage->filter();
         $info=$this->_table->getrow(front::get('id'));
         if($info['userid'] != $this->view->user['userid'] ) {
             front::flash('记录修改失败!(原因:未经授权!)');
             header("Location: ".$from,TRUE,302);
             exit;
         }
         if($info['checked']) {
             front::flash('记录修改失败!(原因:已通过审核!)');
             header("Location: ".$from,TRUE,302);
             exit;
         }
         $this->manage->save_before();
         $data=array();
         $fieldlimit=$this->_table->getcols(front::$act=='list'?'user_manage':'user_modify');
         $fieldlimits=explode(',',$fieldlimit);
         foreach(front::$post as $key=>$value) {
         	if(preg_match('/(select|union|and|\'|"|\))/i',$value)){
         		exit('非法参数');
         	}
             if(in_array($key,$fieldlimits))
                 $data[$key]=$value;
         }
         $update=$this->_table->rec_update($data,front::get('id'));
         if($update<1) {
             front::flash(lang('记录修改失败!'));
         }
         else {
             front::flash(lang('记录修改成功!'));
             $from=session::get('from');
             session::del('from');
             header("Location: ".$from,TRUE,302);
             exit;
         }
     }
     if(!session::get('from')) session::set('from',front::$from);
     $this->_view_table=$this->_table->getrow(front::get('id'),'1',$this->_table->getcols('modify'));
 }
Esempio n. 29
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;
    }
Esempio n. 30
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;
 }