 <?php
	if (! defined ( 'APP_PATH' ) || ! defined ( 'I_PATH' )) {
		exit ( 'Access Denied' );
	}
	
	class ld_authlogin extends controllerBase {
		function __construct() {
			parent::__construct ();
			$this->Get_c = 'ld_authlogin';
			require (APP_PATH . "/config.php");
			$this->lists = $iConfig ['authlogin']; //	print_r($iConfig);
		}
		
		function index() {
			$this->toptxt = '快捷登陆';
			$this->display ( "authlogin.html" );
		}
		
		function edit() {
			$type = $this->sysParams ( 'type', 1 );
			if ($this->sysParams ( 'run' ) == 1) {
				$configfile = 'config.php';
				$fp_tp = @fopen ( $configfile, "r" );
				$fp_txt = @fread ( $fp_tp, filesize ( $configfile ) );
				@fclose ( $fp_tp );
				foreach ( $this->lists as $pay ) {
					if ($pay ['type'] == $type) {
						foreach ( $pay as $k => $v ) {
							$value=$this->sysParams($k,1);
							$t= str_replace('(', '\(', $v);
							$t=str_replace("\\","\\\\", $t);
							$t=str_replace("/","\\/", $t);						
							$fp_txt=preg_replace("/'".$k."' => '$t',/","'".$k."' => '".$value."',",$fp_txt);
						}
					}
				}
				$fpt_tpl = @fopen ( $configfile, "w" );
				@fwrite ( $fpt_tpl, $fp_txt );
				@fclose ( $fpt_tpl );
				message_a ( "快捷登陆修改成功", '?c=ld_authlogin' );
			}
			foreach ( $this->lists as $v ) {
				if ($v ['type'] == $type) {
					$this->d = $v;
					break;
				}
			}
			syDB("sysconfig")->update(array('code'=>set_qq),array('value'=>1));//1代表已经设置完QQ快捷登录
			$this->postgo = 'edit';
			$this->display ( "authlogin_edit.html" );
		}
	}	