Ejemplo n.º 1
0
 function remotelogin_action() {
     cookie::del('passinfo');
     $this->view->loginfalse=cookie::get('loginfalse'.md5($_SERVER['REQUEST_URI']));
     if (front::$args) {
         $user=new user();
         $args = xxtea_decrypt(base64_decode(front::$args), config::get('cookie_password'));
         $user=$user->getrow(unserialize($args));
         if (is_array($user)) {
             if ($user['groupid'] == '888')
                 front::$isadmin=true;
             cookie::set('login_username',$user['username']);
             cookie::set('login_password',front::cookie_encode($user['password']));
             session::set('username',$user['username']);
             require_once ROOT.'/celive/include/config.inc.php';
             require_once ROOT.'/celive/include/celive.class.php';
             $login=new celive();
             $login->auth();
             $GLOBALS['auth']->remotelogin($user['username'],$user['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();
 }
Ejemplo n.º 2
0
 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));
     }
 }
Ejemplo n.º 3
0
 function deletewebsite_action() {
 	chkpw('website_del');
     $path = ROOT.'/config/website/'.front::$get['id'].'.php';
     @unlink($path);
     $path = ROOT.'/config/help_'.front::$get['id'].'.php';
     @unlink($path);
     echo '<script type="text/javascript">alert("操作完成!")</script>';
     front::refresh(url('website/listwebsite',true));
 }
Ejemplo n.º 4
0
 function add_action() {
     if (front::post('submit') &&$this->manage->vaild()) {
         $this->manage->filter($this->Exc);
         $this->manage->add_before($this);
         $this->manage->save_before();
         $insert=$this->_table->rec_insert(front::$post);
         $_insertid = $this->_table->insert_id();
         if ($insert <1) {
             front::flash("{$this->tname}添加失败!");
         }
         else {
             $this->manage->save_after($_insertid);
             $info='';
             front::flash("{$this->tname}添加成功!$info");
             front::refresh(url::modify('act/list',true));
         }
     }
     $this->_view_table=array();
     $this->_view_table['data']=array();
 }
Ejemplo n.º 5
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>';
            }
        }
    }
Ejemplo n.º 6
0
    function add_action() {
    	if($this->table == 'category'){
    		chkpw('category_add');
    	}
    	if($this->table == 'archive'){
    		chkpw('archive_add');
    	}
    	if($this->table == 'type'){
    		chkpw('type_add');
    		front::$post['typecontent'] = htmlspecialchars_decode(front::$post['typecontent']);
    	}
    	if($this->table == 'special'){
    		chkpw('special_add');
    		front::$post['description'] = htmlspecialchars_decode(front::$post['description']);
    	}
    	if($this->table == 'user'){
    		chkpw('user_add');
    	}
    	if($this->table == 'usergroup'){
    		chkpw('usergroup_add');
    	}
    	if($this->table == 'ballot'){
    		chkpw('func_ballot_add');
    	}
    	if($this->table == 'announcement'){
    		chkpw('func_announc_add');
    		front::$post['content'] = htmlspecialchars_decode(front::$post['content']);
    	}
    	if($this->table == 'templatetag' && front::get('tagfrom') == 'define'){
    		chkpw('templatetag_add_define');
    	}
    	if($this->table == 'templatetag' && front::get('tagfrom') == 'category'){
    		chkpw('templatetag_add_category');
    	}
    	if($this->table == 'templatetag' && front::get('tagfrom') == 'content'){
    		chkpw('templatetag_add_content');
    	}
    	if($this->table == 'linkword'){
    		chkpw('seo_linkword_add');
    	}
    	if($this->table == 'friendlink'){
    		chkpw('seo_friendlink_add');
    	}
    	
    	//用户异步提取图库图片
    	if(front::$get['ajax']){
            front::$get['dir'] = front::$get['ajax'];
            $img_arr = image_admin::listimg_action();
            foreach($img_arr as $v){
            	echo '<img src="upload/images/'.front::$get['dir'].'/'.$v.'" id="img'.str_replace('.','',$v).'" onClick="select_img(\'img'.str_replace('.','',$v).'\');" />';
            }
            exit();
        }
       
        
        if (front::post('submit') &&$this->manage->vaild()) {
            $this->manage->filter($this->Exc);
            $this->manage->add_before($this);
            $this->manage->save_before();
            front::$post['catname']=str_replace(' ','&nbsp;',front::$post['catname']);
            front::$post['htmldir']=str_replace(' ','_',front::$post['htmldir']);
            if(front::$post['introduce'] == ''){
                front::$post['introduce'] = tool::cn_substr(preg_replace('/&(.*?);/is','', strip_tags(front::$post['content'])),200);
            }
            if($this->table == 'user'){
            	//var_dump($_SESSION);
            	if(!Phpox_token::is_token('user_add', front::$post['token'])){
            		exit('非法参数');
            	}
            }
            if ($this->table == 'templatetag') {
            	if(front::$post['tagfrom']!='define' && !preg_match('/^tag_(.*?)+\.html$/is', front::$post['tagtemplate'])){
            		exit('参数非法');
            	}
            }
            if($this->table == 'category'){
	            if (front::$post['addtype'] == 'single') {
	            	if (!front::$post['htmldir']) {
	            		front::$post['htmldir'] = pinyin::get(front::$post['catname']);
	            	}
	            	$insert=$this->_table->rec_insert(front::$post);
		            if ($insert <1) {
		                front::flash("{$this->tname}添加失败!");
		            }else{
		            	$_insertid=$this->_table->insert_id();
		            	$this->manage->save_after($_insertid);
		            }
	            } else {
	            	$catearr = explode("\n", front::$post['batch_add']);
	            	foreach ($catearr as $cates) {
	            		$catetmp = explode("|", $cates);
	            		if ($catetmp[0] != '') {
	            			front::$post['catname'] = $catetmp[0];
	            			front::$post['htmldir'] = $catetmp[1];
	            			if ($catetmp[1] == '') {
	            				front::$post['htmldir'] = pinyin::get($catetmp[0]);
	            			}
	            			$insert = $this->_table->rec_insert(front::$post);
	            			if ($insert <1) {
	            				front::flash("{$this->tname}添加失败!");
	            			}else{
	            				$_insertid=$this->_table->insert_id();
	            				$this->manage->save_after($_insertid);
	            			}
	            		}
	            	}
	            }
	            front::refresh(url::modify('act/list',true));
            }else{
	            $insert = $this->_table->rec_insert(front::$post);
	            $_insertid=$this->_table->insert_id();
	            $this->manage->save_after($_insertid);
	            if ($insert <1) {
	                front::flash("{$this->tname}添加失败!");
	            }else {
	                event::log("添加".$this->tname,'成功');  
	                $info='';
	                if ($this->table == 'archive') {
	                    $url=url('archive/show/aid/'.$_insertid,false);
	                    if (front::get('site') == 'default'||front::get('site') == '') {
	                        $info='<a href="'.$url.'" target="_blank">查看</a>';
	                    }
	                }
	                front::flash("{$this->tname}添加成功!$info");
	                if (front::get('type') == 'dialog') {
	                    if ($this->table == 'option') {
	                        front::flash();
	                        exit('添加成功!');
	                    }
	                }
	                if ($this->table == 'templatetag') {
	                    front::refresh(url::modify('act/list/tagfrom/content',true));
	                }
	                else {
	                    front::refresh(url::modify('act/list',true));
	                }
	            }
            }
        }
        //$tag_option_info = settings::getInstance()->getrow(array('tag'=>'table-hottag'));
        //$tag_option_arr = unserialize($tag_option_info['value']);
        $this->_view_table=array();
        $this->_view_table['data']=array();
        $this->view->image_dir = image_admin::listdir_action();
        $this->view->token = Phpox_token::grante_token('user_add');
        //$this->view->tag_opton = explode("\n",$tag_option_arr['hottag']);
    }
Ejemplo n.º 7
0
 function delete_action() {
     $path=ROOT.'/lang/'.config::get('lang_type').'/system.php';
     $lang=include $path;
     event::log('删除语言包','成功');
     exit;
     front::refresh(url('language/edit',true));
 }
Ejemplo n.º 8
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;
         }
     }
 }
Ejemplo n.º 9
0
 function install_action() {
     if (front::post('submit') &&$this->manage->vaild()) {
         $this->manage->filter($this->Exc);
         $this->manage->add_before($this);
         $this->manage->save_before();
         front::$post['ologin_config'] = array();
         if (isset(front::$post['cfg_value']) &&is_array(front::$post['cfg_value'])) {
             for ($i = 0;$i <count(front::$post['cfg_value']);$i++) {
                 $ologin_config[] = array('name'=>trim(front::$post['cfg_name'][$i]),
                         'type'=>trim(front::$post['cfg_type'][$i]),
                         'value'=>trim(front::$post['cfg_value'][$i])
                 );
             }
         }
         front::$post['ologin_config'] = serialize($ologin_config);
         front::$post['enabled'] = 1;
         $insert=$this->_table->rec_insert(front::$post);
         $_insertid = $this->_table->insert_id();
         if ($insert <1) {
             front::flash("{$this->tname}添加失败!");
         }
         else {
             $this->manage->save_after($_insertid);
             $info='';
             front::flash("{$this->tname}添加成功!$info");
             front::refresh(url::modify('act/list',true));
         }
     }
     $set_modules = true;
     global $_LANG;
     include_once(ROOT.'/lib/plugins/ologin/'.front::get('name').'.php');
     $data = $modules[0];
     $ologin['ologin_code']    = $data['code'];
     $ologin['ologin_name']    = $_LANG[$data['code']];
     $ologin['ologin_desc']    = $_LANG[$data['desc']];
     $ologin['is_cod']      = $data['is_cod'];
     $ologin['is_online']   = $data['is_online'];
     $ologin['ologin_config']  = array();
     foreach ($data['config'] as $key =>$value) {
         $config_desc = (isset($_LANG[$value['name'] .'_desc'])) ?$_LANG[$value['name'] .'_desc'] : '';
         $ologin['ologin_config'][$key] = $value +
                 array('label'=>$_LANG[$value['name']],'value'=>$value['value'],'desc'=>$config_desc);
         if ($ologin['ologin_config'][$key]['type'] == 'select'||
                 $ologin['ologin_config'][$key]['type'] == 'radiobox') {
             $ologin['ologin_config'][$key]['range'] = $_LANG[$ologin['ologin_config'][$key]['name'] .'_range'];
         }
     }
     $this->_view_table['ologin'] = $ologin;
 }