| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496 | <?php/** * 纵横后台 * @author cp */if (! defined ( 'IN_ZHASK' )) {	exit ( 'invalid request' );}class AdminController extends DooController {		private $userlogic;	private $asklogic;	private $adminlogic;		private $menu = array ('navon' => array () );		private $userinfo = array ('uid' => '0' );		function __construct() {				//parent::__construct ();				Load::controller ( "BaseController" );		$base = new BaseController ();				$rs = $base->admin_init ();				$this->userinfo = $rs ['userinfo'];				$this->menu = $rs ['menu'];		Load::logic ( 'User' );		Load::logic ( 'Ask' );		Load::logic ( 'Admin' );				$this->userlogic = new UserLogic ();		$this->asklogic = new AskLogic ();		$this->adminlogic = new AdminLogic ();			}		/**	 * 进入后台登录页面	 */	function login() {		$data ['user_info'] = $this->userinfo;		$this->render ( '/admin/login', $data );	}		/**	 * 用户登出	 */	function admin_user_exit() {		setcookie ( "auth_main", "", time () + 3600 * 24, "/", COOKIE_WEB_SITE );		$this->Messager ( "登出成功", "/" );	}		/**	 * 进入后台	 */	function do_login() {				$data ['name'] = $this->get_args ( 'name' );				$data ['password'] = $this->get_args ( 'password' );				$user = $this->userlogic->get_users_by_name ( $data ['name'] );				require_once (SITE_PATH . '/protected/plugin/client.php');				$client = new client ( ZHSSO );				$is_login = $client->zhsso_member_login ( $data ['name'], $data ['password'] );		$is_login = explode ( "\r", $is_login );				if (is_numeric ( $is_login [0] )) {			if ($is_login [0] == USERNAME_ONFINE) {								$this->Messager ( "您输入的帐号或者密码有误", "/login" );								//删除用户相关记录--是否有同步删除功能				if ($user) {					//$this->userlogic->delete_user_tem( $user['uid']);				}			} elseif ($is_login [0] == PASSWORD_ERROR)				$this->Messager ( "您输入的帐号或者密码有误", "/login" );			elseif ($is_login [0] == - 3) //USER_NOACTION				$this->Messager ( "用户未激活", "http://sso.smartcost.com.cn/" );		} elseif (! empty ( $is_login [0] )) {			$group = $this->userlogic->get_group_by_id ( $user ['groupid'] );			if ($group ['grouptype'] != 1) {								setcookie ( "auth_main", "", time () + 3600 * 24, "/", COOKIE_WEB_SITE );				header ( 'Content-Type:text/html;charset=utf-8' );				@header ( "Location: " . WEB_SITE . "/messager?content=无权进入后台&url=/" );			}						$userinfo = authcode ( $user ['username'], "tr" );						setcookie ( "auth_main", $userinfo, time () + 3600 * 24, "/", COOKIE_WEB_SITE );						//define ( 'MEMBER_NAME', $user ['username'] );						//define ( "MASTER_ID", $user ['uid'] );						$data ['now'] = 'use';						$data ['li'] = $this->menu ['navon'];						$data ['map'] = '';						header ( 'Content-Type:text/html;charset=utf-8' );			@header ( "Location: " . WEB_SITE . "/index/main_navon" );		}			//		//对登录用户认证	//		if (empty ( $data ['name'] ) || empty ( $data ['password'] ) || $user_info ['username'] != $data ['name'] || $user_info ['password'] != md5 ( $data ['password'] )) {	//				//			$this->Messager ( "请输入正确的账号密码", "/index/main_admin" );	//		} else {	//			//登录成功-写入session	//			$data ['now'] = 'use';	//				//			$data ['li'] = $this->menu ['navon'];	//				//			$data ['map'] = '';	//				//			$this->render ( '/admin/index', $data );	//			//		}	}		/**	 * 常用操作	 */	function navon() {		$data ['now'] = 'use';				$list=$this->adminlogic->get_examine_list();				if(!empty($list)){			$this->menu ['navon'][4]='<a href="/index/main_examine_manage" target="main">审批问题 <b style="color:#f00;">'.count($list).'</b></a>';		}						$data ['li'] = $this->menu ['navon'];				$data ['map'] = '';				$this->render ( '/admin/index', $data );	}		/**	 * 获取后台欢迎页	 */	function welcome() {				$this->render ( '/admin/welcome' );	}		/**	 * 获取用户管理	 */	function user_manage() {		$u = "";		$n = "";		$e = "";		$i = "";		$t = "";				$on_page = is_numeric ( $this->params ['on_page'] ) ? $this->params ['on_page'] : 1;				if ($on_page <= 0)			$on_page = 1;				$uid = $this->get_args ( 'uid' );				$uid = is_numeric ( $uid ) ? $uid : 0;				$name = $this->get_args ( 'name' );				$email = $this->get_args ( 'email' );				$regip = $this->get_args ( 'regip' );				$srchregdatestart = $this->get_args ( 'srchregdatestart' );				$srchregdateend = $this->get_args ( 'srchregdateend' );				$page_size = 18;		//检索条件		if ($uid)			$u = " and uid=" . $uid;		if (! empty ( $name ))			$n = " and username like '%" . $name . "%'";		if (! empty ( $email ))			$e = " and email like '%" . $email . "%'";		if (! empty ( $regip ))			$e = " and regip like '%" . $regip . "%'";		if (! empty ( $srchregdatestart ) && ! empty ( $srchregdateend )) {						$srchregdatestart = get_time ( $srchregdatestart );						$srchregdateend = get_time ( $srchregdateend );						$t = " and regtime between " . $srchregdatestart . " and " . $srchregdateend;		}				$condition = " and uid!= 1 " . $u . $n . $e . $i . $t;				$action = "/index/main_user_manage/";				//获取分页相关数据		$page = $this->adminlogic->get_page ( t_user, $condition, $on_page, $page_size, $action, "", "admin" );				$limit = " order by regtime desc limit " . $page ['lower'] . " , " . $page_size . " ";				$page ['user_list'] = $this->userlogic->get_users_list ( array (), $condition, $limit );				$data ['map'] = '用户管理';				$data ['user'] = $page;				$this->render ( '/admin/user_manage', $data );	}		/**	 * 添加用户-需要推送用户到通行证	 */	function user_manage_add() {				$data ['map'] = '<a  href="/index/main_user_manage" target="main" >用户管理</a> » 添加用户';				$this->render ( '/admin/user_manage_add', $data );	}		/**	 * 进入编辑用户基本信息	 */	function user_manage_edit() {		$uid = $this->check_params ( "uid" );				if (is_numeric ( $uid )) {			if ($uid == SUPER_ADMIN_UID || $uid <= 0) {				echo "请输入正确请求";				die ();			}		} else {			echo "请输入正确请求";			die ();		}				$data ['user'] = $this->userlogic->get_users_information ( $uid );				$data ['group'] = $this->userlogic->get_group ();				$data ['categoryinfo'] = $this->asklogic->get_category_list ();				$data ['map'] = '<a  href="/index/main_user_manage" target="main" >用户管理</a> » 编辑用户';				$data ['success'] = "";				$this->render ( '/admin/user_manage_edit', $data );	}		/**	 * 修改用户信息	 */	function user_manage_update() {				$params ['uid'] = $this->get_args ( 'uid' );				$params ['password'] = $this->get_args ( 'password' );				$confirmpw = $this->get_args ( 'confirmpw' );				$params ['email'] = $this->get_args ( 'email' );				$params ['groupid'] = $this->get_args ( 'groupid' );				$params ['credits'] = $this->get_args ( 'credits' );				$params ['credit1'] = $this->get_args ( 'credit1' );				$params ['gender'] = $this->get_args ( 'gender' );				$params ['bday'] = $this->get_args ( 'bday' );				$params ['phone'] = $this->get_args ( 'phone' );				$params ['qq'] = $this->get_args ( 'qq' );				$params ['msn'] = $this->get_args ( 'msn' );				$params ['signature'] = $this->get_args ( 'signature' );				$params ['expert'] = $this->get_args ( 'expert' );				$params ['cids'] = json_encode ( $_POST ['cids'] );				if ($params ['password'] != $confirmpw) {			echo "密码不一致";			die ();		}				if (is_numeric ( $params ['uid'] )) {			if ($params ['uid'] == SUPER_ADMIN_UID || $params ['uid'] <= 0) {				echo "请输入正确请求";				die ();			}		} else {			echo "请输入正确请求";			die ();		}				$this->userlogic->update_user ( $params );				$data ['user'] = $this->userlogic->get_users_information ( $params ['uid'] );				$data ['group'] = $this->userlogic->get_group ();				$data ['map'] = '<a  href="/index/main_user_manage" target="main" >用户管理</a> » 编辑用户';				$data ['success'] = "编辑成功";				header ( 'Content-Type:text/html;charset=utf-8' );		@header ( "Location: /index/main_user_manage_edit/" . $params ['uid'] );		}		/**	 * 删除用户	 */	function user_manage_delete() {		$type = $this->check_params ( "type" );				$uid = $this->get_args ( 'uid' );				if ($type == "all") {			$this->userlogic->delete_user_and_QA ( $uid );		} else {			$this->userlogic->delete_user ( $uid );		}				Header ( "Location:/index/main_user_manage" );	}		/**	 * 用户积分明细	 */	function user_manage_credit() {		$uid = $this->check_params ( "uid" );				$data ['map'] = '<a  href="/index/main_user_manage" target="main" >用户管理</a> » 用户积分明细';				$data ['creditList'] = $this->asklogic->get_credit_details ( $uid );				$this->render ( '/admin/user_manage_credits', $data );	}		/**	 * 专家用户	 */	function user_manage_expert() {				$data ['map'] = '专家管理 ';				$param ['expert'] = 1;				$data ['userExpert'] = $this->userlogic->get_users_list ( $param, '', "" );				$this->render ( '/admin/user_manage_expert', $data );	}		/**	 * 进入用户组管理	 */	function group_manage() {				$data ['group'] = $this->userlogic->get_group ();				$data ['map'] = '用户组管理 ';				$data ['success'] = "";				$this->render ( '/admin/group_manage', $data );	}		/**	 * 用户组管理-添加	 */	function group_manage_add() {				$params ['grouptitle'] = $this->get_args ( 'grouptitle' );				if (empty ( $params ['grouptitle'] ))			die ( '用户组名称为空' );				$this->userlogic->add_group ( $params );				$data ['group'] = $this->userlogic->get_group ();				$data ['map'] = '用户组管理 ';				$data ['success'] = "<span style='color:red'>添加成功</span>";				$this->render ( '/admin/group_manage', $data );	}		/**	 * 用户组管理-编辑	 */	function group_manage_edit() {				$params ['groupid'] = $this->get_args ( 'groupid' );				$params ['grouptitle'] = $this->get_args ( 'grouptitle' );				$params ['creditslower'] = $this->get_args ( 'scorelower' );				$this->userlogic->update_group_list ( $params );				$data ['group'] = $this->userlogic->get_group ();				$data ['map'] = '用户组管理';				$data ['success'] = "<span style='color:red'>编辑成功</span> ";				$this->render ( '/admin/group_manage', $data );	}		/**	 * 用户组管理-删除	 */	function group_manage_delete() {				$groupid = $this->check_params ( "groupid" );				if (is_numeric ( $groupid )) {			if ($groupid == SUPER_ADMIN_ID || $groupid <= 0) {				echo "请输入正确请求";				die ();			}		} else {			echo "请输入正确请求";			die ();		}				$this->userlogic->delete_group ( $groupid );				$data ['group'] = $this->userlogic->get_group ();				$data ['map'] = '用户组管理 ';				$data ['success'] = "<span style='color:red'>删除成功</span> ";				$this->render ( '/admin/group_manage', $data );	}		/**	 * 用户组管理-权限设置 	 */	function group_manage_set() {		$data ['map'] = '用户组权限设置 ';				$data ['success'] = "<span style='color:red'></span> ";				$data ['groupid'] = $this->check_params ( 'groupid' );				$data ['group'] = $this->userlogic->get_group_by_id ( $data ['groupid'] );				$data ['PERMISSIONS'] = Doo::conf ()->PERMISSIONS_ACTION;		include SITE_PATH . '/protected/config/permissions.conf.php';				$data ['PERMISSIONS_user'] = "";				if (isset ( $config ['GENERAL_USER_lv' . $data ['groupid']] ))			$data ['PERMISSIONS_user'] = $config ['GENERAL_USER_lv' . $data ['groupid']];				$this->render ( '/admin/group_manage_set', $data );	}		/**	 * 为用户组设置权限	 */	function group_manage_update_set() {		$permissions=$this->get_args('permissons_key');				$b=array('##USER7','##/USER7');				$Content="<USER7>\$config['GENERAL_USER_lv7']=array('index', 'show_ask_page', 'login', 'show_into_home', 'show_home_answer', 'show_home_question', 'do_login', 'upload_question_img', 'show_home_per_info', 'show_home_avatar', 'show_home_message', 'show_vip_ask_post', 'show_ask_post', 'show_post_enter', 'show_search', 'do_support_answer', 'do_edit_answer', 'do_edit_question', 'do_up_price', 'do_add_supply', 'upload_avatar', 'do_update_vip_question', 'do_add_vip_question', 'do_delete_answer', 'do_delete_question', 'do_question_close', 'do_update_user_info', 'do_update_avatar', 'answer_again', 'do_reply_question', 'to_ask_question', 'do_add_vip_question', 'do_add_question','show_advisory_page','user_exit',//编辑问题'do_edit_vip_question',//设置满意'set_vip_question_satisfy',//设置不满意'set_vip_question_nosatisfy',//追加回答'do_add_vip_tag', //评价回答'do_comment_vip_answer',//添加评论'do_add_discuss',//获取退款机会'get_vip_refunds',//交易'show_my_pay_oder', //充值'show_my_recharge',//登录'do_login_index',//充值记录'show_recharge_oder',//编辑邮件'do_add_email_config','do_best_answer','show_article_page','show_messager','show_tip2','get_search_works',);<USER7>";		$Content="<USER7>fsdfsdfsdfwerewr</USER7>";		preg_match("<USER7>(.*)</USER7>",$Content,$kk);		//ereg_replace("PHP","",$temp)		//preg_replace("^##USER7 ##USER7$", " \$config['GENERAL_USER_lv7']=array() ", $Content);				echo $kk;		//		foreach ($permissions as $value){//			//		}				//print_r($permissions);	}		/**	 * 进去问题管理-	 */	function question_manage() {				$u = "";		$n = "";		$e = "";		$i = "";		$t = "";				$on_page = $this->check_params ( 'on_page' );				$on_page = is_numeric ( $on_page ) ? $on_page : 1;				$authorid = $this->get_args ( 'authorid' );				$title = $this->get_args ( 'title' );				$status = $this->get_args ( 'status' );				$srchregdatestart = $this->get_args ( 'srchregdatestart' );				$srchregdateend = $this->get_args ( 'srchregdateend' );				$page_size = 18;		//检索条件		if ($authorid)			$u = " and author like '%" . $authorid . "%'";		if (! empty ( $title ))			$n = " and title like '%" . $title . "%'";		if ($status >= 1)			$e = " and status = " . $status;		if (! empty ( $srchregdatestart ) && ! empty ( $srchregdateend )) {						$srchregdatestart = get_time ( $srchregdatestart );						$srchregdateend = get_time ( $srchregdateend );						$t = " and time between " . $srchregdatestart . " and " . $srchregdateend;		}				$condition = ' and 1 ' . $u . $n . $e . $i . $t;				$action = "/index/main_question_manage/";				$get = "?status=" . $status . "&authorid=" . $authorid . "&title=" . $title . "&srchregdatestart=" . $srchregdatestart . "&srchregdateend=" . $srchregdateend;				//获取分页相关数据		$page = $this->adminlogic->get_page ( t_question, $condition, $on_page, $page_size, $action, $get, "admin" );				$limit = " order by time desc limit " . $page ['lower'] . " , " . $page_size . " ";				$data ['category'] = $this->asklogic->get_category_list ();				$page ['question_list'] = $this->asklogic->get_questions_list_tem ( array (), $condition, $limit );				$data ['question'] = $page;				$data ['status'] = $status;		$data ['authorid'] = $authorid;		$data ['title'] = $title;		$data ['srchregdatestart'] = $srchregdatestart;		$data ['srchregdateend'] = $srchregdateend;				$data ['map'] = '问题管理 ';				$data ['success'] = "<span style='color:red'></span> ";				$this->render ( '/admin/question_manage', $data );	}		/**	 * 移动问题分类	 */	function question_manage_move_category() {		}		/**	 * 批量关闭问题	 */	function question_manage_close() {				$id = $this->get_args ( 'id' );				$status = array ();				$params ['id'] = $id;				for($i = 0; $i < count ( $id ); $i ++) {			array_push ( $status, 9 );		}				$params ['status'] = $status;				$this->userlogic->update_list ( $params, t_question, "id" );				Header ( "Location:/index/main_question_manage" );	}		/**	 * 批量删除问题	 */	function question_manage_delete() {				$id = $this->get_args ( 'id' );				if (empty ( $id ))			return "/index/main_question_manage";				//推广		//;$id = implode ( ",", $id );		$fundstr=file_get_contents(SITE_PATH . '/protected/config/fund.conf.php') ;				if($fundstr){						foreach ($id as $value){				Doo::loadModel ( 'QuestionDao' );								$questionDao = new QuestionDao ();								$question=$questionDao->get_question_by_id($value);								if($question['price']==1&&$question['status']=1){					Doo::loadModel ( 'FundDao' );									$funddao = new FundDao ();										$fund=$funddao->get_fund_by_amount();										if(!empty($fund)){						$funddao->set_fund_amount_spread("+1",$fund['id']);					}				}			}				}		$this->userlogic->delete_question_list ( $id );				Header ( "Location:/index/main_question_manage" );	}		/**	 * 批量设置问题为待解决	 */	function question_manage_set_status() {		//只针对已关闭的问题进行操作--是否还有RMB问题		$id = $this->get_args ( 'id' );				$this->userlogic->update_question_list ( $id );				return "/index/main_question_manage";	}		/**	 * 进去回答管理-	 */	function answer_manage() {				$u = "";		$n = "";		$e = "";		$i = "";		$t = "";				$on_page = $this->check_params ( 'on_page' );				$on_page = is_numeric ( $on_page ) ? $on_page : 1;				$authorid = $this->get_args ( 'author' );				$title = $this->get_args ( 'title' );				$srchregdatestart = $this->get_args ( 'srchregdatestart' );				$srchregdateend = $this->get_args ( 'srchregdateend' );				$page_size = 18;		//检索条件		if ($authorid)			$u = " and author like '%" . $authorid . "%'";		if (! empty ( $title ))			$n = " and title like '%" . $title . "%'";				if (! empty ( $srchregdatestart ) && ! empty ( $srchregdateend )) {						$srchregdatestart = get_time ( $srchregdatestart );						$srchregdateend = get_time ( $srchregdateend );						$t = " and time between " . $srchregdatestart . " and " . $srchregdateend;		}				$condition = $u . $n . $t;				$action = "/index/main_answer_manage/";				$get = "?author=" . $authorid . "&title=" . $title . "&srchregdatestart=" . $srchregdatestart . "&srchregdateend=" . $srchregdateend;				//获取分页相关数据		$page = $this->adminlogic->get_page ( t_answer, $condition, $on_page, $page_size, $action, $get, "admin" );				$limit = " order by time desc limit " . $page ['lower'] . " , " . $page_size . " ";				$data ['category'] = $this->asklogic->get_category_list ();				$answer_list = $this->asklogic->get_answers_list_tem ( array (), $condition, $limit );				foreach ( $answer_list as $key => $value ) {						$answer_list [$key] ['content'] = strip_tags ( $value ['content'] );		}				$page ['answer_list'] = $answer_list;				$data ['answer'] = $page;				$data ['author'] = $authorid;		$data ['title'] = $title;		$data ['srchregdatestart'] = $srchregdatestart;		$data ['srchregdateend'] = $srchregdateend;				$data ['map'] = '回答管理 ';				$data ['success'] = "<span style='color:red'></span> ";				$this->render ( '/admin/answer_manage', $data );	}		/**	 * 回答管理-删除回答	 */	function answer_manage_delete() {		$data ['map'] = '回答管理 ';				$data ['success'] = "<span style='color:red'></span> ";				$id = $this->get_args ( 'id' );				if (empty ( $id ))			return "/index/main_answer_manage";				$this->userlogic->delete_answer_list ( $id );				return "/index/main_answer_manage";	}		/**	 * 名师答疑管理	 */	function vip_question_manage() {				$u = "";		$n = "";		$e = "";		$i = "";		$t = "";				$on_page = $this->check_params ( 'on_page' );				$on_page = is_numeric ( $on_page ) ? $on_page : 1;				$authorid = $this->get_args ( 'authorid' );				$title = $this->get_args ( 'title' );				$status = $this->get_args ( 'status' );				$srchregdatestart = $this->get_args ( 'srchregdatestart' );				$srchregdateend = $this->get_args ( 'srchregdateend' );				$page_size = 18;		//检索条件		if ($authorid)			$u = " and author like '%" . $authorid . "%'";		if (! empty ( $title ))			$n = " and title like '%" . $title . "%'";		if ($status >= 1)			$e = " and status = " . $status;		if (! empty ( $srchregdatestart ) && ! empty ( $srchregdateend )) {						$srchregdatestart = get_time ( $srchregdatestart );						$srchregdateend = get_time ( $srchregdateend );						$t = " and time between " . $srchregdatestart . " and " . $srchregdateend;		}				$nowtime = get_time ();				$condition = " " . $u . $n . $e . $i . $t;				$action = "/index/main_vip_question_manage/";				$get = "?status=" . $status . "&authorid=" . $authorid . "&title=" . $title . "&srchregdatestart=" . $srchregdatestart . "&srchregdateend=" . $srchregdateend;				//获取分页相关数据		$page = $this->adminlogic->get_page ( t_vipquestion, $condition, $on_page, $page_size, $action, $get, "admin" );				$limit = " order by time desc limit " . $page ['lower'] . " , " . $page_size . " ";				$data ['category'] = $this->asklogic->get_category_list ();				$page ['question_list'] = $this->asklogic->get_vip_questions_list_admin ( array (), $condition, $limit, "vip" );				$data ['question'] = $page;				$data ['status'] = $status;		$data ['authorid'] = $authorid;		$data ['title'] = $title;		$data ['srchregdatestart'] = $srchregdatestart;		$data ['srchregdateend'] = $srchregdateend;				$data ['map'] = '名师答疑管理 ';				$data ['success'] = "<span style='color:red'></span> ";				$this->render ( '/admin/vip_question_manage', $data );	}		/**	 * 编辑回答	 */	function vip_question_edit_manage() {		$id = $this->check_params ( 'id' );				$id = is_numeric ( $id ) && $id > 0 ? $id : 1;				$data ['vip_question'] = $this->asklogic->get_vip_questions_by_id ( $id );				//获取回答		$data ['vip_answer'] = $this->asklogic->get_vip_answer_by_id ( $id );				$data ['map'] = '名师答疑管理 ';				$this->render ( '/admin/vip_question_page_manage', $data );	}		/**	 * 回答名师答疑	 */	function vip_question_add_answer_manage() {		$id = $this->get_args ( 'qid' );				$aid = $this->get_args ( 'aid' );				$content = stripcslashes ( $this->get_args ( 'content_text' ) );				$id = is_numeric ( $id ) && $id > 0 ? $id : 0;				$data ['vip_question'] = $this->asklogic->get_vip_questions_by_id ( $id );				$params ['id'] = array (0 => $aid );				$params ['qid'] = array (0 => $id );				$params ['content'] = array (0 => $content );				$params ['title'] = array (0 => $data ['vip_question'] ['title'] );				$params ['time'] = array (0 => get_date () );				$params ['ip'] = array (0 => client_ip () );				//加入回答		$this->userlogic->update_list ( $params, t_vipanswer, "qid" );				//发邮件		$this->userlogic->send_email ( $data ['vip_question'] ['authorid'], "VIP_NEW_ANSWER", $id, 0 );				//更新检索库		$params ['vip_question'] = $data ['vip_question'];				$ans ['time'] = get_date ();				$ans ['content'] = $content;				$answer = serialize ( array (0 => $ans ) );				$params ['answer'] = $answer;				$this->userlogic->update_vip_question_search ( $params );				//发送系统信息		$this->userlogic->update_vip_question_by_answers ( $id );				$subject = "您的" . $data ['vip_question'] ['title'] . "问题有了新的回答";				$content = "名师答疑-问题 <a href=/advisory_page/" . $id . ">" . $data ['vip_question'] ['title'] . "</a> 有了新的回答";				$this->userlogic->send_sys_message ( $subject, $content, $data ['vip_question'] ['authorid'] );				//获取回答		$data ['vip_answer'] = $this->asklogic->get_vip_answer_by_id ( $id );				$data ['map'] = '名师答疑管理 ';				$this->render ( '/admin/vip_question_page_manage', $data );	}		/**	 * 回答追问--加入检索库	 */	function vip_question_add_answeragain_manage() {		$id = $this->get_args ( 'qid' );				$content = stripcslashes ( $this->get_args ( 'answer_again_text' ) );				$id = is_numeric ( $id ) && $id > 0 ? $id : 0;				$data ['vip_question'] = $this->asklogic->get_vip_questions_by_id ( $id );				//获取回答		$data ['vip_answer'] = $this->asklogic->get_vip_answer_by_id ( $id );				//加入追问		$this->userlogic->update_vip_answer ( $content, $data ['vip_answer'] ['id'], $data ['vip_answer'] ['tag'] );				//发邮件		$this->userlogic->send_email ( $data ['vip_question'] ['authorid'], "VIP_FOLLOW_ANSWER", $id, 0 );				//加入检索库		$params ['vip_question'] = $data ['vip_question'];				$answer = $data ['vip_answer'];				$ans ['aid'] = $answer ['id'];		$ans ['time'] = $answer ['time'];		$ans ['content'] = $answer ['content'];		$ans ['comment'] = $answer ['comment'];		$tag_list = unserialize ( $answer ['tag'] );		array_push ( $tag_list, $content );				$tag = serialize ( $tag_list );		$ans ['tag'] = $tag;		$answer = serialize ( array (0 => $ans ) );				$params ['answer'] = $answer;				$this->userlogic->update_vip_question_search ( $params );				//发送系统信息		$this->userlogic->update_vip_question_by_answers ( $id );				$subject = "您的" . $data ['vip_question'] ['title'] . "问题回答了您的追问";				$content = "名师答疑-问题 <a href=/advisory_page/" . $id . " >" . $data ['vip_question'] ['title'] . "</a> 回答了追问";				$this->userlogic->send_sys_message ( $subject, $content, $data ['vip_question'] ['authorid'] );				$data ['map'] = '名师答疑管理 ';				$this->render ( '/admin/vip_question_page_manage', $data );	}		/**	 * 公告管理	 */	function article_manage() {				$n = "";				$t = "";				$on_page = $this->check_params ( 'on_page' );				$on_page = is_numeric ( $on_page ) ? $on_page : 1;				$title = $this->get_args ( 'title' );				$srchregdatestart = $this->get_args ( 'srchregdatestart' );				$srchregdateend = $this->get_args ( 'srchregdateend' );				$page_size = 18;		//检索条件		if (! empty ( $title ))			$n = " and title like '%" . $title . "%'";				if (! empty ( $srchregdatestart ) && ! empty ( $srchregdateend )) {						$srchregdatestart = get_time ( $srchregdatestart );						$srchregdateend = get_time ( $srchregdateend );						$t = " and time between " . $srchregdatestart . " and " . $srchregdateend;		}				$condition = $n . $t;				$action = "/index/main_article_manage/";				$get = "?title=" . $title . "&srchregdatestart=" . $srchregdatestart . "&srchregdateend=" . $srchregdateend;				//获取分页相关数据		$page = $this->adminlogic->get_page ( t_article, $condition, $on_page, $page_size, $action, $get, "admin" );				$limit = " order by time desc limit " . $page ['lower'] . " , " . $page_size . " ";				$page ['question_list'] = $this->asklogic->get_article_list ( array (), $condition, $limit );				$data ['question'] = $page;				$data ['title'] = $title;		$data ['srchregdatestart'] = $srchregdatestart;		$data ['srchregdateend'] = $srchregdateend;				$data ['map'] = '公告管理 ';				$data ['success'] = "<span style='color:red'></span> ";				$this->render ( '/admin/article_manage', $data );	}		/**	 * 文章添加	 */	function article_manage_add() {				$params ['title'] = $this->get_args ( 'title' );				$params ['content'] = stripcslashes ( $this->get_args ( 'content_text' ) );				$is_add = $this->get_args ( 'is_add' );				if (! empty ( $is_add )) {			if (empty ( $params ['title'] ))				die ( '标题为空' );			if (empty ( $params ['content'] ))				die ( '内容为空' );						$this->userlogic->add_article ( $params );			echo "添加成功 <a href=/index/main_article_manage >点击进入公告</a>";			die ();		}				$data ['map'] = '公告管理-添加 ';				$data ['success'] = "";				$this->render ( '/admin/article_manage_add', $data );	}		/**	 * 编辑公告	 */	function article_manage_edit() {				$params ['id'] = $this->check_params ( 'id' );				$params ['title'] = $this->get_args ( 'title' );				$params ['content'] = stripcslashes ( $this->get_args ( 'content_text' ) );				$is_edit = $this->get_args ( 'is_edit' );				if (! empty ( $is_edit )) {			if (empty ( $params ['title'] ))				die ( '标题为空' );			if (empty ( $params ['content'] ))				die ( '内容为空' );						$params ['id'] = $this->get_args ( 'id' );						$this->userlogic->update_article ( $params );			echo "更新成功 <a href=/index/main_article_edit_manage/" . $params ['id'] . " >点击进入公告</a>";			die ();		}				$data ['article'] = $this->userlogic->get_article_by_id ( $params ['id'] );				$data ['map'] = '公告管理-编辑 ';				$data ['success'] = "";				$this->render ( '/admin/article_manage_edit', $data );	}		/**	 * 删除公告	 */	function article_manage_delete() {				$id = $this->get_args ( 'id' );				$this->userlogic->delete_article ( $id );				Header ( "Location:/index/main_article_manage" );	}		/**	 * 分类管理	 */	function category_manage() {				$n = "";				$on_page = $this->check_params ( 'on_page' );				$on_page = is_numeric ( $on_page ) ? $on_page : 1;				if ($on_page <= 0)			$on_page = 1;				$title = $this->get_args ( 'title' );				$page_size = 18;		//检索条件		if (! empty ( $title ))			$n = " and name like '%" . $title . "%'";				$condition = $n;				$action = "/index/main_category_manage/";				$get = "?title=" . $title;				//获取分页相关数据		$page = $this->adminlogic->get_page ( t_category, $condition, $on_page, $page_size, $action, $get, "admin" );				$limit = " limit " . $page ['lower'] . " , " . $page_size . " ";				$page ['question_list'] = $this->asklogic->get_list ( array (), $condition, $limit, t_category );				$data ['question'] = $page;				$data ['title'] = $title;				$data ['map'] = '分类管理 ';				$data ['success'] = "<span style='color:red'></span> ";				$this->render ( '/admin/category_manage', $data );	}		/**	 * 进入添加分类页面	 */	function category_manage_add() {				//获取顶级分类		$data ['category'] = $this->asklogic->get_category_list ();				$data ['map'] = '添加分类 ';				$data ['success'] = "<span style='color:red'></span> ";				$this->render ( '/admin/category_manage_add', $data );	}		/**	 * 添加分类	 */	function category_manage_doadd() {		$params ['name'] = $this->get_args ( 'name' );				$params ['pid'] = $this->get_args ( 'pid' );				if (empty ( $params ['name'] ))			die ( '填写分类名称' );				$this->userlogic->add_category ( $params );				Header ( "Location:/index/main_category_manage" );	}		/**	 * 分类管理-删除	 */	function category_manage_delete() {				$id = $this->get_args ( 'id' );				$this->userlogic->delete_category_list ( $id );				Header ( "Location:/index/main_category_manage" );	}		/**	 * 编辑分类	 */	function category_manage_edit() {				$id = $this->check_params ( 'id' );				$data ['categoryinfo'] = $this->asklogic->get_category_by_id ( $id );				//获取顶级分类		$data ['category'] = $this->asklogic->get_category_list ();				$data ['map'] = '添加分类 ';				$data ['success'] = "<span style='color:red'></span> ";				$this->render ( '/admin/category_manage_edit', $data );	}		/**	 * 更新分类信息	 */	function category_manage_update() {				$id = $this->get_args ( 'id' );				$name = $this->get_args ( 'name' );				$pid = $this->get_args ( 'pid' );				if (empty ( $name ))			die ( '填写分类名称' );				$this->userlogic->update_category ( $id, $name, $pid );				Header ( "Location:/index/main_category_manage" );	}		/**	 * 进入系统设置	 */	function system_manage() {				$data ['map'] = '系统管理 ';				include SITE_PATH . '/protected/config/set_email_to_admin.conf.php';				$data ['email'] = $sys ['set_email'];				$fundstr=file_get_contents(SITE_PATH . '/protected/config/fund.conf.php') ;				$data['fund']=$fundstr;				$this->render ( '/admin/system_manage', $data );	}		function system_fund_do(){				$string=$this->get_args('fund');				file_put_contents(SITE_PATH . '/protected/config/fund.conf.php', $string);				Header ( "Location:/index/main_system_manage" );	}		/**	 * 系统设置	 */	function system_manage_do() {		$email = $this->get_args ( 'set_email_to_admin' );				$string="<?php ";		$string.="\$sys=array('set_email'=>'".$email."'";		$string.=");";				file_put_contents(SITE_PATH . '/protected/config/set_email_to_admin.conf.php', $string);				Header ( "Location:/index/main_system_manage" );	}		/**	 * 问题审批	 */	function examine_manage(){				$data ['examine_list'] = $this->adminlogic->get_examine_list ();				$data ['map'] = '审批管理 ';		$data ['success'] = "<span style='color:red'></span> ";		$this->render ( '/admin/examine_manage', $data );	}		/**	 * 清空审批列表	 */	function examine_manage_clear(){				$this->adminlogic->examine_clear();				$data ['examine_list']= $this->adminlogic->get_examine_list ();				$data ['map'] = '审批管理 ';		$data ['success'] = "<span style='color:red'></span> ";		$this->render ( '/admin/examine_manage', $data );	}		function examine_add(){		$idKey = $this->check_params ( "id" );		$data=$this->adminlogic->get_examine ($idKey);				if(empty($data))			die('illegal request');				$data ['category_id']=$data['cid'];		$id = $this->userlogic->add_question ( $data );				if (empty($id)){//金钱不够 发送站内通知---暂停开发站内通知			//$this->send_email ( $data ['authorid'], "PAY_FORMONEY", $result, 0 );			/*			 			 //发送系统信息-发送给发回答用户  			$subject = "回答 <a href=/askpage/" . $rs ['qid'] . " >" . $rs ['title'] . "</a> 追问后有新的回答";					$content = "回答 <a href=/askpage/" . $rs ['qid'] . " >" . $rs ['title'] . "</a> 追问后有新的回答";					$this->messagedao->send_message ( ADMIN_NAME, 0, $question ['authorid'], $subject, $content );			 */		}		$this->adminlogic->examine_delete ($idKey);		return '/index/main_examine_manage';		//$rs=$this->adminlogic->examine_add ($idKey);			}		/**	 * 获取get或者POST值	 * @param string $name 属性名称	 * @return fixed 值	 */	function get_args($name) {		if (isset ( $_GET [$name] )) {			if (is_array ( $_GET [$name] ))				return $_GET [$name];			else				return addslashes ( $_GET [$name] );				} elseif (isset ( $_POST [$name] )) {			if (is_array ( $_POST [$name] ))				return $_POST [$name];			else				return addslashes ( $_POST [$name] );		} else {						return false;		}	}		/**	 * 检测数据输入的非法字符和转义非法字符	 */	function check_params($name = "") {		if (isset ( $this->params [$name] )) {						return addslashes ( $this->params [$name] );		} else {						return false;		}	}		/**	 * 限时跳转	 * @param unknown_type $message	 * @param unknown_type $redirectto	 * @param unknown_type $time	 * @param unknown_type $return_msg	 * @param unknown_type $js	 */	function Messager($message, $redirectto = '', $time = -1, $return_msg = false, $js = null) {		global $rewriteHandler;		$data ['redirectto'] = $redirectto;		$data ['message'] = $message;				if ($time === - 1) {			//配置文件			//$time=(is_numeric($this->Config['msg_time'])?$this->Config['msg_time']:5);			$data ['time'] = 5;		}				$data ['to_title'] = ($data ['redirectto'] === '' or $data ['redirectto'] == - 1) ? "返回上一页" : "跳转到指定页面";				if ($data ['redirectto'] === null) {			$return_msg = $return_msg === false ? " " : $return_msg;		} else {			$data ['redirectto'] = ($data ['redirectto'] !== '') ? $data ['redirectto'] : ($from_referer = referer ());			//			if(str_exists($data['redirectto'],'mod=login','code=register','/login','/register'))			//			{			//				$referer='&referer='.urlencode('index.php?'.$_SERVER['QUERY_STRING']);			//				$this->CookieHandler->Setvar('referer','index.php?'.$_SERVER['QUERY_STRING']);			//			}						if (is_numeric ( $data ['redirectto'] ) !== false and $data ['redirectto'] !== 0) {				if ($data ['time'] !== null) {					$data ['url_redirect'] = "<script language=\"JavaScript\" type=\"text/javascript\">\r\n";					$data ['url_redirect'] .= sprintf ( "window.setTimeout(\"history.go(%s)\",%s);\r\n", $data ['redirectto'], $data ['time'] * 1000 );					$data ['url_redirect'] .= "</script>\r\n";								}								$data ['redirectto'] = "javascript:history.go({$data['redirectto']})";			} else {				if ($rewriteHandler && null !== $data ['message']) {					$data ['redirectto'] .= $referer;					if (! $from_referer && ! $referer) {						$data ['redirectto'] = $rewriteHandler->formatURL ( $data ['redirectto'], true );					}				}								if ($data ['message'] === null) {					$data ['redirectto'] = rawurldecode ( stripslashes ( ($data ['redirectto']) ) );					@header ( "Location: " . $data ['redirectto'] ); #HEADER跳转				}				if ($data ['time'] !== null) {					$data ['url_redirect'] = ($data ['redirectto'] ? '<meta http-equiv="refresh" content="' . $data ['time'] . '; URL=' . $data ['redirectto'] . '">' : null);				}			}		}		$title = "消息提示:" . (is_array ( $data ['message'] ) ? implode ( ',', $data ['message'] ) : $data ['message']);				$title = strip_tags ( $title );		if ($js != "") {			$js = "<script language=\"JavaScript\" type=\"text/javascript\">{$js}</script>";		}		$additional_str = $data ['url_redirect'] . $js;				$this->render ( 'messager', $data );				exit ();	}}?>
 |