| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | /* Copyright (C) NAVER <http://www.navercorp.com> */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  | define('FOLLOW_REQUEST_SSL', 0); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | define('ENFORCE_SSL', 1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | define('RELEASE_SSL', 2); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  * Manages Context such as request arguments/environment variables | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  * It has dual method structure, easy-to use methods which can be called as self::methodname(),and methods called with static object. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  * @author NAVER ([email protected]) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | class Context | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  | 	 * Allow rewrite | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | 	 * @var bool TRUE: using rewrite mod, FALSE: otherwise | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | 	public $allow_rewrite = FALSE; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  | 	 * Request method | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  | 	 * @var string GET|POST|XMLRPC | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  | 	public $request_method = 'GET'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | 	 * js callback function name. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  | 	 * @var string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  | 	public $js_callback_func = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  | 	 * Response method.If it's not set, it follows request method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  | 	 * @var string HTML|XMLRPC | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  | 	public $response_method = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  | 	 * Conatins request parameters and environment variables | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  | 	 * @var object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  | 	public $context = NULL; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  | 	 * DB info | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  | 	 * @var object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  | 	public $db_info = NULL; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  | 	 * FTP info | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  | 	 * @var object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  | 	public $ftp_info = NULL; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  | 	 * ssl action cache file | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  | 	 * @var array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  | 	public $sslActionCacheFile = './files/cache/sslCacheFile.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  | 	 * List of actions to be sent via ssl (it is used by javascript xml handler for ajax) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  | 	 * @var array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  | 	public $ssl_actions = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  | 	 * obejct oFrontEndFileHandler() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  | 	 * @var object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  | 	public $oFrontEndFileHandler; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  | 	 * script codes in <head>..</head> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  | 	 * @var string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  | 	public $html_header = NULL; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  | 	 * class names of <body> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  | 	 * @var array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  | 	public $body_class = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  | 	 * codes after <body> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  | 	 * @var string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  | 	public $body_header = NULL; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  | 	 * class names before </body> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  | 	 * @var string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  | 	public $html_footer = NULL; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  | 	 * path of Xpress Engine | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  | 	 * @var string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  | 	public $path = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  | 	// language information - it is changed by HTTP_USER_AGENT or user's cookie | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  | 	 * language type | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  | 	 * @var string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  | 	public $lang_type = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  | 	 * contains language-specific data | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  | 	 * @var object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  | 	public $lang = NULL; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  | 	 * list of loaded languages (to avoid re-loading them) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  | 	 * @var array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  | 	public $loaded_lang_files = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  | 	 * site's browser title | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  | 	 * @var string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  | 	public $site_title = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  | 	 * variables from GET or form submit | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  | 	 * @var mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  | 	public $get_vars = NULL; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  | 	 * Checks uploaded | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  | 	 * @var bool TRUE if attached file exists | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  | 	public $is_uploaded = FALSE; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  | 	 * Pattern for request vars check | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  | 	 * @var array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  | 	public $patterns = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  | 			'/<\?/iUsm', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  | 			'/<\%/iUsm', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  | 			'/<script\s*?language\s*?=\s*?("|\')?\s*?php\s*("|\')?/iUsm' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  | 			); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  | 	 * Check init | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  | 	 * @var bool FALSE if init fail | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  | 	public $isSuccessInit = TRUE; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  | 	 * returns static context object (Singleton). It's to use Context without declaration of an object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  | 	 * @return object Instance | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  | 	function &getInstance() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  | 		static $theInstance = null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  | 		if(!$theInstance) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  | 			$theInstance = new Context(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  | 		return $theInstance; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  | 	 * Cunstructor | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  | 	function Context() | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  | 		$this->oFrontEndFileHandler = new FrontEndFileHandler(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  | 		$this->get_vars = new stdClass(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  | 		// include ssl action cache file | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  | 		$this->sslActionCacheFile = FileHandler::getRealPath($this->sslActionCacheFile); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  | 		if(is_readable($this->sslActionCacheFile)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  | 			require($this->sslActionCacheFile); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  | 			if(isset($sslActions)) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  | 				$this->ssl_actions = $sslActions; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  | 	 * Initialization, it sets DB information, request arguments and so on. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  | 	 * @see This function should be called only once | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  | 	function init() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  | 		// fix missing HTTP_RAW_POST_DATA in PHP 5.6 and above | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  | 		if(!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === TRUE) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  | 			$GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  | 			 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  | 			// If content is not XML JSON, unset | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  | 			if(!preg_match('/^[\<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']) && strpos($_SERVER['CONTENT_TYPE'], 'json') === FALSE && strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json') === FALSE) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  | 				unset($GLOBALS['HTTP_RAW_POST_DATA']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  | 		// set context variables in $GLOBALS (to use in display handler) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  | 		$this->context = &$GLOBALS['__Context__']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  | 		$this->context->lang = &$GLOBALS['lang']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  | 		$this->context->_COOKIE = $_COOKIE; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  | 		// 20140429 editor/image_link | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  | 		$this->_checkGlobalVars(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  | 		$this->setRequestMethod(''); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  | 		$this->_setXmlRpcArgument(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  | 		$this->_setJSONRequestArgument(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  | 		$this->_setRequestArgument(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  | 		$this->_setUploadedArgument(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  | 		$this->loadDBInfo(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 |  |  | 		if($this->db_info->use_sitelock == 'Y') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  | 			if(is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  | 			if(!IpFilter::filter($whitelist)) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  | 				$title = ($this->db_info->sitelock_title) ? $this->db_info->sitelock_title : 'Maintenance in progress...'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  | 				$message = $this->db_info->sitelock_message; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  | 				define('_XE_SITELOCK_', TRUE); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  | 				define('_XE_SITELOCK_TITLE_', $title); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  | 				define('_XE_SITELOCK_MESSAGE_', $message); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  | 				header("HTTP/1.1 403 Forbidden"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  | 				if(FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html')) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  | 				{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  | 					include _XE_PATH_ . 'common/tpl/sitelock.user.html'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 |  |  | 				} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  | 				else | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 |  |  | 				{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 |  |  | 					include _XE_PATH_ . 'common/tpl/sitelock.html'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 |  |  | 				} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 |  |  | 				exit; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 |  |  | 		// If XE is installed, get virtual site information | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 |  |  | 		if(self::isInstalled()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  | 			$oModuleModel = getModel('module'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  | 			$site_module_info = $oModuleModel->getDefaultMid(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 |  |  | 			if(!isset($site_module_info)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  | 				$site_module_info = new stdClass(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 |  |  | 			// if site_srl of site_module_info is 0 (default site), compare the domain to default_url of db_config | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  | 			if($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  | 				$site_module_info->domain = $this->db_info->default_url; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 274 |  |  | 			$this->set('site_module_info', $site_module_info); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 275 |  |  | 			if($site_module_info->site_srl && isSiteID($site_module_info->domain)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 276 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 |  |  | 				$this->set('vid', $site_module_info->domain, TRUE); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  | 			if(!isset($this->db_info)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 281 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 282 |  |  | 				$this->db_info = new stdClass(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 285 |  |  | 			$this->db_info->lang_type = $site_module_info->default_language; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 |  |  | 			if(!$this->db_info->lang_type) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 287 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 288 |  |  | 				$this->db_info->lang_type = 'en'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 289 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 290 |  |  | 			if(!$this->db_info->use_db_session) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 291 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 292 |  |  | 				$this->db_info->use_db_session = 'N'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 293 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 294 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 295 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 296 |  |  | 		// Load Language File | 
            
                                                                                                            
                            
            
                                    
            
            
                | 297 |  |  | 		$lang_supported = $this->loadLangSelected(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 298 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 299 |  |  | 		// Retrieve language type set in user's cookie | 
            
                                                                                                            
                            
            
                                    
            
            
                | 300 |  |  | 		if($this->lang_type = $this->get('l')) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 301 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 302 |  |  | 			if($_COOKIE['lang_type'] != $this->lang_type) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 303 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 304 |  |  | 				setcookie('lang_type', $this->lang_type, $_SERVER['REQUEST_TIME'] + 3600 * 24 * 1000, '/'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 305 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 306 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 307 |  |  | 		elseif($_COOKIE['lang_type']) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 308 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 309 |  |  | 			$this->lang_type = $_COOKIE['lang_type']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 310 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 311 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 312 |  |  | 		// If it's not exists, follow default language type set in db_info | 
            
                                                                                                            
                            
            
                                    
            
            
                | 313 |  |  | 		if(!$this->lang_type) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 314 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 315 |  |  | 			$this->lang_type = $this->db_info->lang_type; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 316 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 317 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 318 |  |  | 		// if still lang_type has not been set or has not-supported type , set as English. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 319 |  |  | 		if(!$this->lang_type) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 320 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 321 |  |  | 			$this->lang_type = 'en'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 322 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 323 |  |  | 		if(is_array($lang_supported) && !isset($lang_supported[$this->lang_type])) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 324 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 325 |  |  | 			$this->lang_type = 'en'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 326 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 327 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 328 |  |  | 		$this->set('lang_supported', $lang_supported); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 329 |  |  | 		$this->setLangType($this->lang_type); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 330 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 331 |  |  | 		// load module module's language file according to language setting | 
            
                                                                                                            
                            
            
                                    
            
            
                | 332 |  |  | 		$this->loadLang(_XE_PATH_ . 'modules/module/lang'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 333 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 334 |  |  | 		// set session handler | 
            
                                                                                                            
                            
            
                                    
            
            
                | 335 |  |  | 		if(self::isInstalled() && $this->db_info->use_db_session == 'Y') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 336 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 337 |  |  | 			$oSessionModel = getModel('session'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 338 |  |  | 			$oSessionController = getController('session'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 339 |  |  | 			session_set_save_handler( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 340 |  |  | 					array(&$oSessionController, 'open'), array(&$oSessionController, 'close'), array(&$oSessionModel, 'read'), array(&$oSessionController, 'write'), array(&$oSessionController, 'destroy'), array(&$oSessionController, 'gc') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 341 |  |  | 			); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 342 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 343 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 344 |  |  | 		if($sess = $_POST[session_name()]) session_id($sess); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 345 |  |  | 		session_start(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 346 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 347 |  |  | 		// set authentication information in Context and session | 
            
                                                                                                            
                            
            
                                    
            
            
                | 348 |  |  | 		if(self::isInstalled()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 349 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 350 |  |  | 			$oModuleModel = getModel('module'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 351 |  |  | 			$oModuleModel->loadModuleExtends(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 352 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 353 |  |  | 			$oMemberModel = getModel('member'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 354 |  |  | 			$oMemberController = getController('member'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 355 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 356 |  |  | 			if($oMemberController && $oMemberModel) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 357 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 358 |  |  | 				// if signed in, validate it. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 359 |  |  | 				if($oMemberModel->isLogged()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 360 |  |  | 				{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 361 |  |  | 					$oMemberController->setSessionInfo(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 362 |  |  | 				} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 363 |  |  | 				// check auto sign-in | 
            
                                                                                                            
                            
            
                                    
            
            
                | 364 |  |  | 				elseif($_COOKIE['xeak']) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 365 |  |  | 				{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 366 |  |  | 					$oMemberController->doAutologin(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 367 |  |  | 				} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 368 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 369 |  |  | 				$this->set('is_logged', $oMemberModel->isLogged()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 370 |  |  | 				$this->set('logged_info', $oMemberModel->getLoggedInfo()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 371 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 372 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 373 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 374 |  |  | 		// load common language file | 
            
                                                                                                            
                            
            
                                    
            
            
                | 375 |  |  | 		$this->lang = &$GLOBALS['lang']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 376 |  |  | 		$this->loadLang(_XE_PATH_ . 'common/lang/'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 377 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 378 |  |  | 		// check if using rewrite module | 
            
                                                                                                            
                            
            
                                    
            
            
                | 379 |  |  | 		$this->allow_rewrite = ($this->db_info->use_rewrite == 'Y' ? TRUE : FALSE); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 380 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 381 |  |  | 		// set locations for javascript use | 
            
                                                                                                            
                            
            
                                    
            
            
                | 382 |  |  | 		$url = array(); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 383 |  |  | 		$current_url = self::getRequestUri(); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 384 |  |  | 		if($_SERVER['REQUEST_METHOD'] == 'GET') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 385 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 386 |  |  | 			if($this->get_vars) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 387 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 388 |  |  | 				$url = array(); | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 389 |  | View Code Duplication | 				foreach($this->get_vars as $key => $val) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 390 |  |  | 				{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 391 |  |  | 					if(is_array($val) && count($val) > 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 392 |  |  | 					{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 393 |  |  | 						foreach($val as $k => $v) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 394 |  |  | 						{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 395 |  |  | 							$url[] = $key . '[' . $k . ']=' . urlencode($v); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 396 |  |  | 						} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 397 |  |  | 					} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 398 |  |  | 					elseif($val) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 399 |  |  | 					{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 400 |  |  | 						$url[] = $key . '=' . urlencode($val); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 401 |  |  | 					} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 402 |  |  | 				} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 403 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 404 |  |  | 				$current_url = self::getRequestUri(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 405 |  |  | 				if($url) $current_url .= '?' . join('&', $url); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 406 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 407 |  |  | 			else | 
            
                                                                                                            
                            
            
                                    
            
            
                | 408 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 409 |  |  | 				$current_url = $this->getUrl(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 410 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 411 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 412 |  |  | 		else | 
            
                                                                                                            
                            
            
                                    
            
            
                | 413 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 414 |  |  | 			$current_url = self::getRequestUri(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 415 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 416 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 417 |  |  | 		$this->set('current_url', $current_url); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 418 |  |  | 		$this->set('request_uri', self::getRequestUri()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 419 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 420 |  |  | 		if(strpos($current_url, 'xn--') !== FALSE) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 421 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 422 |  |  | 			$this->set('current_url', self::decodeIdna($current_url)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 423 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 424 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 425 |  |  | 		if(strpos(self::getRequestUri(), 'xn--') !== FALSE) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 426 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 427 |  |  | 			$this->set('request_uri', self::decodeIdna(self::getRequestUri())); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 428 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 429 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 430 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 431 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 432 |  |  | 	 * Finalize using resources, such as DB connection | 
            
                                                                                                            
                            
            
                                    
            
            
                | 433 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 434 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 435 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 436 |  |  | 	function close() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 437 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 438 |  |  | 		session_write_close(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 439 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 440 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 441 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 442 |  |  | 	 * Load the database information | 
            
                                                                                                            
                            
            
                                    
            
            
                | 443 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 444 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 445 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 446 |  |  | 	function loadDBInfo() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 447 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 448 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 449 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 450 |  |  | 		if(!$self->isInstalled()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 451 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 452 |  |  | 			return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 453 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 454 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 455 |  |  | 		$config_file = $self->getConfigFile(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 456 |  |  | 		if(is_readable($config_file)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 457 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 458 |  |  | 			include($config_file); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 459 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 460 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 461 |  |  | 		// If master_db information does not exist, the config file needs to be updated | 
            
                                                                                                            
                            
            
                                    
            
            
                | 462 |  |  | 		if(!isset($db_info->master_db)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 463 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 464 |  |  | 			$db_info->master_db = array(); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 465 |  |  | 			$db_info->master_db["db_type"] = $db_info->db_type; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 466 |  |  | 			unset($db_info->db_type); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 467 |  |  | 			$db_info->master_db["db_port"] = $db_info->db_port; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 468 |  |  | 			unset($db_info->db_port); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 469 |  |  | 			$db_info->master_db["db_hostname"] = $db_info->db_hostname; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 470 |  |  | 			unset($db_info->db_hostname); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 471 |  |  | 			$db_info->master_db["db_password"] = $db_info->db_password; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 472 |  |  | 			unset($db_info->db_password); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 473 |  |  | 			$db_info->master_db["db_database"] = $db_info->db_database; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 474 |  |  | 			unset($db_info->db_database); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 475 |  |  | 			$db_info->master_db["db_userid"] = $db_info->db_userid; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 476 |  |  | 			unset($db_info->db_userid); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 477 |  |  | 			$db_info->master_db["db_table_prefix"] = $db_info->db_table_prefix; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 478 |  |  | 			unset($db_info->db_table_prefix); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 479 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 480 |  |  | 			if(isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 481 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 482 |  |  | 				$db_info->master_db["db_table_prefix"] .= '_'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 483 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 484 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 485 |  |  | 			$db_info->slave_db = array($db_info->master_db); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 486 |  |  | 			$self->setDBInfo($db_info); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 487 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 488 |  |  | 			$oInstallController = getController('install'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 489 |  |  | 			$oInstallController->makeConfigFile(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 490 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 491 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 492 |  |  | 		if(!$db_info->use_prepared_statements) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 493 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 494 |  |  | 			$db_info->use_prepared_statements = 'Y'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 495 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 496 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 497 |  |  | 		if(!$db_info->time_zone) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 498 |  |  | 			$db_info->time_zone = date('O'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 499 |  |  | 		$GLOBALS['_time_zone'] = $db_info->time_zone; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 500 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 501 |  |  | 		if($db_info->qmail_compatibility != 'Y') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 502 |  |  | 			$db_info->qmail_compatibility = 'N'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 503 |  |  | 		$GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 504 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 505 |  |  | 		if(!$db_info->use_db_session) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 506 |  |  | 			$db_info->use_db_session = 'N'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 507 |  |  | 		if(!$db_info->use_ssl) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 508 |  |  | 			$db_info->use_ssl = 'none'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 509 |  |  | 		$this->set('_use_ssl', $db_info->use_ssl); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 510 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 511 |  |  | 		$self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 512 |  |  | 		$self->set('_https_port', ($db_info->https_port) ? $db_info->https_port : NULL); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 513 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 514 |  |  | 		if(!$db_info->sitelock_whitelist) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 515 |  |  | 			$db_info->sitelock_whitelist = '127.0.0.1'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 516 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 517 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 518 |  |  | 		if(is_string($db_info->sitelock_whitelist)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 519 |  |  | 			$db_info->sitelock_whitelist = explode(',', $db_info->sitelock_whitelist); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 520 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 521 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 522 |  |  | 		$self->setDBInfo($db_info); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 523 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 524 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 525 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 526 |  |  | 	 * Get DB's db_type | 
            
                                                                                                            
                            
            
                                    
            
            
                | 527 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 528 |  |  | 	 * @return string DB's db_type | 
            
                                                                                                            
                            
            
                                    
            
            
                | 529 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 530 |  |  | 	function getDBType() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 531 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 532 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 533 |  |  | 		return $self->db_info->master_db["db_type"]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 534 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 535 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 536 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 537 |  |  | 	 * Set DB information | 
            
                                                                                                            
                            
            
                                    
            
            
                | 538 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 539 |  |  | 	 * @param object $db_info DB information | 
            
                                                                                                            
                            
            
                                    
            
            
                | 540 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 541 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 542 |  |  | 	function setDBInfo($db_info) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 543 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 544 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 545 |  |  | 		$self->db_info = $db_info; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 546 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 547 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 548 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 549 |  |  | 	 * Get DB information | 
            
                                                                                                            
                            
            
                                    
            
            
                | 550 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 551 |  |  | 	 * @return object DB information | 
            
                                                                                                            
                            
            
                                    
            
            
                | 552 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 553 |  |  | 	function getDBInfo() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 554 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 555 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 556 |  |  | 		return $self->db_info; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 557 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 558 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 559 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 560 |  |  | 	 * Return ssl status | 
            
                                                                                                            
                            
            
                                    
            
            
                | 561 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 562 |  |  | 	 * @return object SSL status (Optional - none|always|optional) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 563 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 564 |  |  | 	function getSslStatus() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 565 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 566 |  |  | 		$dbInfo = self::getDBInfo(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 567 |  |  | 		return $dbInfo->use_ssl; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 568 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 569 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 570 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 571 |  |  | 	 * Return default URL | 
            
                                                                                                            
                            
            
                                    
            
            
                | 572 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 573 |  |  | 	 * @return string Default URL | 
            
                                                                                                            
                            
            
                                    
            
            
                | 574 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 575 |  |  | 	function getDefaultUrl() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 576 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 577 |  |  | 		$db_info = self::getDBInfo(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 578 |  |  | 		return $db_info->default_url; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 579 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 580 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 581 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 582 |  |  | 	 * Find supported languages | 
            
                                                                                                            
                            
            
                                    
            
            
                | 583 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 584 |  |  | 	 * @return array Supported languages | 
            
                                                                                                            
                            
            
                                    
            
            
                | 585 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 586 |  |  | 	function loadLangSupported() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 587 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 588 |  |  | 		static $lang_supported = null; | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 589 |  | View Code Duplication | 		if(!$lang_supported) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 590 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 591 |  |  | 			$langs = file(_XE_PATH_ . 'common/lang/lang.info'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 592 |  |  | 			foreach($langs as $val) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 593 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 594 |  |  | 				list($lang_prefix, $lang_text) = explode(',', $val); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 595 |  |  | 				$lang_text = trim($lang_text); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 596 |  |  | 				$lang_supported[$lang_prefix] = $lang_text; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 597 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 598 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 599 |  |  | 		return $lang_supported; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 600 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 601 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 602 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 603 |  |  | 	 * Find selected languages to serve in the site | 
            
                                                                                                            
                            
            
                                    
            
            
                | 604 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 605 |  |  | 	 * @return array Selected languages | 
            
                                                                                                            
                            
            
                                    
            
            
                | 606 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 607 |  |  | 	function loadLangSelected() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 608 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 609 |  |  | 		static $lang_selected = null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 610 |  |  | 		if(!$lang_selected) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 611 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 612 |  |  | 			$orig_lang_file = _XE_PATH_ . 'common/lang/lang.info'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 613 |  |  | 			$selected_lang_file = _XE_PATH_ . 'files/config/lang_selected.info'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 614 |  |  | 			if(!FileHandler::hasContent($selected_lang_file)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 615 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 616 |  |  | 				$old_selected_lang_file = _XE_PATH_ . 'files/cache/lang_selected.info'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 617 |  |  | 				FileHandler::moveFile($old_selected_lang_file, $selected_lang_file); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 618 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 619 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 620 |  |  | 			if(!FileHandler::hasContent($selected_lang_file)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 621 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 622 |  |  | 				$buff = FileHandler::readFile($orig_lang_file); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 623 |  |  | 				FileHandler::writeFile($selected_lang_file, $buff); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 624 |  |  | 				$lang_selected = self::loadLangSupported(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 625 |  |  | 			} | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 626 |  | View Code Duplication | 			else | 
            
                                                                                                            
                            
            
                                    
            
            
                | 627 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 628 |  |  | 				$langs = file($selected_lang_file); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 629 |  |  | 				foreach($langs as $val) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 630 |  |  | 				{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 631 |  |  | 					list($lang_prefix, $lang_text) = explode(',', $val); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 632 |  |  | 					$lang_text = trim($lang_text); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 633 |  |  | 					$lang_selected[$lang_prefix] = $lang_text; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 634 |  |  | 				} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 635 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 636 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 637 |  |  | 		return $lang_selected; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 638 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 639 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 640 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 641 |  |  | 	 * Single Sign On (SSO) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 642 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 643 |  |  | 	 * @return bool True : Module handling is necessary in the control path of current request , False : Otherwise | 
            
                                                                                                            
                            
            
                                    
            
            
                | 644 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 645 |  |  | 	function checkSSO() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 646 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 647 |  |  | 		// pass if it's not GET request or XE is not yet installed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 648 |  |  | 		if($this->db_info->use_sso != 'Y' || isCrawler()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 649 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 650 |  |  | 			return TRUE; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 651 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 652 |  |  | 		$checkActList = array('rss' => 1, 'atom' => 1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 653 |  |  | 		if(self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')])) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 654 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 655 |  |  | 			return TRUE; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 656 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 657 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 658 |  |  | 		// pass if default URL is not set | 
            
                                                                                                            
                            
            
                                    
            
            
                | 659 |  |  | 		$default_url = trim($this->db_info->default_url); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 660 |  |  | 		if(!$default_url) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 661 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 662 |  |  | 			return TRUE; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 663 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 664 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 665 |  |  | 		if(substr_compare($default_url, '/', -1) !== 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 666 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 667 |  |  | 			$default_url .= '/'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 668 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 669 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 670 |  |  | 		// for sites recieving SSO valdiation | 
            
                                                                                                            
                            
            
                                    
            
            
                | 671 |  |  | 		if($default_url == self::getRequestUri()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 672 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 673 |  |  | 			if(self::get('default_url')) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 674 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 675 |  |  | 				$url = base64_decode(self::get('default_url')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 676 |  |  | 				$url_info = parse_url($url); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 677 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 678 |  |  | 				$oModuleModel = getModel('module'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 679 |  |  | 				$target_domain = (stripos($url, $default_url) !== 0) ? $url_info['host'] : $default_url; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 680 |  |  | 				$site_info = $oModuleModel->getSiteInfoByDomain($target_domain); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 681 |  |  | 				if(!$site_info->site_srl) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 682 |  |  | 					$oModuleObject = new ModuleObject(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 683 |  |  | 					$oModuleObject->stop('msg_invalid_request'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 684 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 685 |  |  | 					return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 686 |  |  | 				} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 687 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 688 |  |  | 				$url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . session_id(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 689 |  |  | 				$redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':' . $url_info['port'] : '', $url_info['path'], $url_info['query']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 690 |  |  | 				header('location:' . $redirect_url); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 691 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 692 |  |  | 				return FALSE; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 693 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 694 |  |  | 			// for sites requesting SSO validation | 
            
                                                                                                            
                            
            
                                    
            
            
                | 695 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 696 |  |  | 		else | 
            
                                                                                                            
                            
            
                                    
            
            
                | 697 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 698 |  |  | 			// result handling : set session_name() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 699 |  |  | 			if($session_name = self::get('SSOID')) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 700 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 701 |  |  | 				setcookie(session_name(), $session_name); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 702 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 703 |  |  | 				$url = preg_replace('/([\?\&])$/', '', str_replace('SSOID=' . $session_name, '', self::getRequestUrl())); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 704 |  |  | 				header('location:' . $url); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 705 |  |  | 				return FALSE; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 706 |  |  | 				// send SSO request | 
            
                                                                                                            
                            
            
                                    
            
            
                | 707 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 708 |  |  | 			else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 709 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 710 |  |  | 				setcookie('sso', md5(self::getRequestUri()), 0, '/'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 711 |  |  | 				$url = sprintf("%s?default_url=%s", $default_url, base64_encode(self::getRequestUrl())); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 712 |  |  | 				header('location:' . $url); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 713 |  |  | 				return FALSE; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 714 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 715 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 716 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 717 |  |  | 		return TRUE; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 718 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 719 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 720 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 721 |  |  | 	 * Check if FTP info is registered | 
            
                                                                                                            
                            
            
                                    
            
            
                | 722 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 723 |  |  | 	 * @return bool True: FTP information is registered, False: otherwise | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 724 |  |  | 	 */ | 
            
                                                                        
                            
            
                                    
            
            
                | 725 |  |  | 	function isFTPRegisted() | 
            
                                                                        
                            
            
                                    
            
            
                | 726 |  |  | 	{ | 
            
                                                                        
                            
            
                                    
            
            
                | 727 |  |  | 		return file_exists(self::getFTPConfigFile()); | 
            
                                                                        
                            
            
                                    
            
            
                | 728 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 729 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 730 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 731 |  |  | 	 * Get FTP information | 
            
                                                                                                            
                            
            
                                    
            
            
                | 732 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 733 |  |  | 	 * @return object FTP information | 
            
                                                                                                            
                            
            
                                    
            
            
                | 734 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 735 |  |  | 	function getFTPInfo() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 736 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 737 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 738 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 739 |  |  | 		if(!$self->isFTPRegisted()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 740 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 741 |  |  | 			return null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 742 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 743 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 744 |  |  | 		include($self->getFTPConfigFile()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 745 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 746 |  |  | 		return $ftp_info; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 747 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 748 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 749 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 750 |  |  | 	 * Add string to browser title | 
            
                                                                                                            
                            
            
                                    
            
            
                | 751 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 752 |  |  | 	 * @param string $site_title Browser title to be added | 
            
                                                                                                            
                            
            
                                    
            
            
                | 753 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 754 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 755 |  |  | 	function addBrowserTitle($site_title) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 756 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 757 |  |  | 		if(!$site_title) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 758 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 759 |  |  | 			return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 760 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 761 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 762 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 763 |  |  | 		if($self->site_title) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 764 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 765 |  |  | 			$self->site_title .= ' - ' . $site_title; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 766 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 767 |  |  | 		else | 
            
                                                                                                            
                            
            
                                    
            
            
                | 768 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 769 |  |  | 			$self->site_title = $site_title; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 770 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 771 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 772 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 773 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 774 |  |  | 	 * Set string to browser title | 
            
                                                                                                            
                            
            
                                    
            
            
                | 775 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 776 |  |  | 	 * @param string $site_title Browser title  to be set | 
            
                                                                                                            
                            
            
                                    
            
            
                | 777 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 778 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 779 |  |  | 	function setBrowserTitle($site_title) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 780 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 781 |  |  | 		if(!$site_title) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 782 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 783 |  |  | 			return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 784 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 785 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 786 |  |  | 		$self->site_title = $site_title; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 787 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 788 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 789 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 790 |  |  | 	 * Get browser title | 
            
                                                                                                            
                            
            
                                    
            
            
                | 791 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 792 |  |  | 	 * @return string Browser title(htmlspecialchars applied) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 793 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 794 |  |  | 	function getBrowserTitle() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 795 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 796 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 797 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 798 |  |  | 		$oModuleController = getController('module'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 799 |  |  | 		$oModuleController->replaceDefinedLangCode($self->site_title); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 800 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 801 |  |  | 		return htmlspecialchars($self->site_title, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 802 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 803 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 804 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 805 |  |  | 	 * Return layout's title | 
            
                                                                                                            
                            
            
                                    
            
            
                | 806 |  |  | 	 * @return string layout's title | 
            
                                                                                                            
                            
            
                                    
            
            
                | 807 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 808 |  |  | 	public function getSiteTitle() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 809 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 810 |  |  | 		$oModuleModel = getModel('module'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 811 |  |  | 		$moduleConfig = $oModuleModel->getModuleConfig('module'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 812 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 813 |  |  | 		if(isset($moduleConfig->siteTitle)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 814 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 815 |  |  | 			return $moduleConfig->siteTitle; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 816 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 817 |  |  | 		return ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 818 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 819 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 820 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 821 |  |  | 	 * Get browser title | 
            
                                                                                                            
                            
            
                                    
            
            
                | 822 |  |  | 	 * @deprecated | 
            
                                                                                                            
                            
            
                                    
            
            
                | 823 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 824 |  |  | 	function _getBrowserTitle() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 825 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 826 |  |  | 		return $this->getBrowserTitle(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 827 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 828 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 829 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 830 |  |  | 	 * Load language file according to language type | 
            
                                                                                                            
                            
            
                                    
            
            
                | 831 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 832 |  |  | 	 * @param string $path Path of the language file | 
            
                                                                                                            
                            
            
                                    
            
            
                | 833 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 834 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 835 |  |  | 	function loadLang($path) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 836 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 837 |  |  | 		global $lang; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 838 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 839 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 840 |  |  | 		if(!$self->lang_type) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 841 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 842 |  |  | 			return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 843 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 844 |  |  | 		if(!is_object($lang)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 845 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 846 |  |  | 			$lang = new stdClass; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 847 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 848 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 849 |  |  | 		if(!($filename = $self->_loadXmlLang($path))) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 850 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 851 |  |  | 			$filename = $self->_loadPhpLang($path); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 852 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 853 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 854 |  |  | 		if(!is_array($self->loaded_lang_files)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 855 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 856 |  |  | 			$self->loaded_lang_files = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 857 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 858 |  |  | 		if(in_array($filename, $self->loaded_lang_files)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 859 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 860 |  |  | 			return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 861 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 862 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 863 |  |  | 		if($filename && is_readable($filename)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 864 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 865 |  |  | 			$self->loaded_lang_files[] = $filename; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 866 |  |  | 			include($filename); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 867 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 868 |  |  | 		else | 
            
                                                                                                            
                            
            
                                    
            
            
                | 869 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 870 |  |  | 			$self->_evalxmlLang($path); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 871 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 872 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 873 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 874 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 875 |  |  | 	 * Evaluation of xml language file | 
            
                                                                                                            
                            
            
                                    
            
            
                | 876 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 877 |  |  | 	 * @param string Path of the language file | 
            
                                                                                                            
                            
            
                                    
            
            
                | 878 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 879 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 880 |  |  | 	function _evalxmlLang($path) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 881 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 882 |  |  | 		global $lang; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 883 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 884 |  |  | 		if(!$path) return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 885 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 886 |  |  | 		$_path = 'eval://' . $path; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 887 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 888 |  |  | 		if(in_array($_path, $this->loaded_lang_files)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 889 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 890 |  |  | 			return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 891 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 892 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 893 |  |  | 		if(substr_compare($path, '/', -1) !== 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 894 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 895 |  |  | 			$path .= '/'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 896 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 897 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 898 |  |  | 		$oXmlLangParser = new XmlLangParser($path . 'lang.xml', $this->lang_type); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 899 |  |  | 		$content = $oXmlLangParser->getCompileContent(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 900 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 901 |  |  | 		if($content) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 902 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 903 |  |  | 			$this->loaded_lang_files[] = $_path; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 904 |  |  | 			eval($content); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 905 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 906 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 907 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 908 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 909 |  |  | 	 * Load language file of xml type | 
            
                                                                                                            
                            
            
                                    
            
            
                | 910 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 911 |  |  | 	 * @param string $path Path of the language file | 
            
                                                                                                            
                            
            
                                    
            
            
                | 912 |  |  | 	 * @return string file name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 913 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 914 |  |  | 	function _loadXmlLang($path) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 915 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 916 |  |  | 		if(!$path) return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 917 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 918 |  |  | 		$oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 919 |  |  | 		return $oXmlLangParser->compile(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 920 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 921 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 922 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 923 |  |  | 	 * Load language file of php type | 
            
                                                                                                            
                            
            
                                    
            
            
                | 924 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 925 |  |  | 	 * @param string $path Path of the language file | 
            
                                                                                                            
                            
            
                                    
            
            
                | 926 |  |  | 	 * @return string file name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 927 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 928 |  |  | 	function _loadPhpLang($path) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 929 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 930 |  |  | 		if(!$path) return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 931 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 932 |  |  | 		if(substr_compare($path, '/', -1) !== 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 933 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 934 |  |  | 			$path .= '/'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 935 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 936 |  |  | 		$path_tpl = $path . '%s.lang.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 937 |  |  | 		$file = sprintf($path_tpl, $this->lang_type); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 938 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 939 |  |  | 		$langs = array('ko', 'en'); // this will be configurable. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 940 |  |  | 		while(!is_readable($file) && $langs[0]) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 941 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 942 |  |  | 			$file = sprintf($path_tpl, array_shift($langs)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 943 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 944 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 945 |  |  | 		if(!is_readable($file)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 946 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 947 |  |  | 			return FALSE; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 948 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 949 |  |  | 		return $file; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 950 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 951 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 952 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 953 |  |  | 	 * Set lang_type | 
            
                                                                                                            
                            
            
                                    
            
            
                | 954 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 955 |  |  | 	 * @param string $lang_type Language type. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 956 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 957 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 958 |  |  | 	function setLangType($lang_type = 'ko') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 959 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 960 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 961 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 962 |  |  | 		$self->lang_type = $lang_type; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 963 |  |  | 		$self->set('lang_type', $lang_type); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 964 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 965 |  |  | 		$_SESSION['lang_type'] = $lang_type; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 966 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 967 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 968 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 969 |  |  | 	 * Get lang_type | 
            
                                                                                                            
                            
            
                                    
            
            
                | 970 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 971 |  |  | 	 * @return string Language type | 
            
                                                                                                            
                            
            
                                    
            
            
                | 972 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 973 |  |  | 	function getLangType() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 974 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 975 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 976 |  |  | 		return $self->lang_type; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 977 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 978 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 979 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 980 |  |  | 	 * Return string accoring to the inputed code | 
            
                                                                                                            
                            
            
                                    
            
            
                | 981 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 982 |  |  | 	 * @param string $code Language variable name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 983 |  |  | 	 * @return string If string for the code exists returns it, otherwise returns original code | 
            
                                                                                                            
                            
            
                                    
            
            
                | 984 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 985 |  |  | 	function getLang($code) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 986 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 987 |  |  | 		if(!$code) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 988 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 989 |  |  | 			return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 990 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 991 |  |  | 		if($GLOBALS['lang']->{$code}) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 992 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 993 |  |  | 			return $GLOBALS['lang']->{$code}; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 994 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 995 |  |  | 		return $code; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 996 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 997 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 998 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 999 |  |  | 	 * Set data to lang variable | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1000 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1001 |  |  | 	 * @param string $code Language variable name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1002 |  |  | 	 * @param string $val `$code`s value | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1003 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1004 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1005 |  |  | 	function setLang($code, $val) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1006 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1007 |  |  | 		if(!isset($GLOBALS['lang'])) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1008 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1009 |  |  | 			$GLOBALS['lang'] = new stdClass(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1010 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1011 |  |  | 		$GLOBALS['lang']->{$code} = $val; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1012 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1013 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1014 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1015 |  |  | 	 * Convert strings of variables in $source_object into UTF-8 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1016 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1017 |  |  | 	 * @param object $source_obj Conatins strings to convert | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1018 |  |  | 	 * @return object converted object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1019 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1020 |  |  | 	function convertEncoding($source_obj) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1021 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1022 |  |  | 		$charset_list = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1023 |  |  | 			'UTF-8', 'EUC-KR', 'CP949', 'ISO8859-1', 'EUC-JP', 'SHIFT_JIS', 'CP932', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1024 |  |  | 			'EUC-CN', 'HZ', 'GBK', 'GB18030', 'EUC-TW', 'BIG5', 'CP950', 'BIG5-HKSCS', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1025 |  |  | 			'ISO2022-CN', 'ISO2022-CN-EXT', 'ISO2022-JP', 'ISO2022-JP-2', 'ISO2022-JP-1', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1026 |  |  | 			'ISO8859-6', 'ISO8859-8', 'JOHAB', 'ISO2022-KR', 'CP1255', 'CP1256', 'CP862', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1027 |  |  | 			'ASCII', 'ISO8859-1', 'ISO8850-2', 'ISO8850-3', 'ISO8850-4', 'ISO8850-5', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1028 |  |  | 			'ISO8850-7', 'ISO8850-9', 'ISO8850-10', 'ISO8850-13', 'ISO8850-14', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1029 |  |  | 			'ISO8850-15', 'ISO8850-16', 'CP1250', 'CP1251', 'CP1252', 'CP1253', 'CP1254', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1030 |  |  | 			'CP1257', 'CP850', 'CP866', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1031 |  |  | 		); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1032 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1033 |  |  | 		$obj = clone $source_obj; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1034 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1035 |  |  | 		foreach($charset_list as $charset) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1036 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1037 |  |  | 			array_walk($obj,'Context::checkConvertFlag',$charset); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1038 |  |  | 			$flag = self::checkConvertFlag($flag = TRUE); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1039 |  |  | 			if($flag) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1040 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1041 |  |  | 				if($charset == 'UTF-8') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1042 |  |  | 				{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1043 |  |  | 					return $obj; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1044 |  |  | 				} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1045 |  |  | 				array_walk($obj,'Context::doConvertEncoding',$charset); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1046 |  |  | 				return $obj; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1047 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1048 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1049 |  |  | 		return $obj; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1050 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1051 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1052 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1053 |  |  | 	 * Check flag | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1054 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1055 |  |  | 	 * @param mixed $val | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1056 |  |  | 	 * @param string $key | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1057 |  |  | 	 * @param mixed $charset charset | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1058 |  |  | 	 * @see arrayConvWalkCallback will replaced array_walk_recursive in >=PHP5 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1059 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1060 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1061 |  |  | 	function checkConvertFlag(&$val, $key = null, $charset = null) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1062 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1063 |  |  | 		static $flag = TRUE; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1064 |  |  | 		if($charset) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1065 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1066 |  |  | 			if(is_array($val)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1067 |  |  | 				array_walk($val,'Context::checkConvertFlag',$charset); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1068 |  |  | 			else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1069 |  |  | 			else $flag = FALSE; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1070 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1071 |  |  | 		else | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1072 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1073 |  |  | 			$return = $flag; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1074 |  |  | 			$flag = TRUE; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1075 |  |  | 			return $return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1076 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1077 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1078 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1079 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1080 |  |  | 	 * Convert array type variables into UTF-8 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1081 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1082 |  |  | 	 * @param mixed $val | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1083 |  |  | 	 * @param string $key | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1084 |  |  | 	 * @param string $charset character set | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1085 |  |  | 	 * @see arrayConvWalkCallback will replaced array_walk_recursive in >=PHP5 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1086 |  |  | 	 * @return object converted object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1087 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1088 |  |  | 	function doConvertEncoding(&$val, $key = null, $charset) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1089 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1090 |  |  | 		if (is_array($val)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1091 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1092 |  |  | 			array_walk($val,'Context::doConvertEncoding',$charset); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1093 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1094 |  |  | 		else $val = iconv($charset,'UTF-8',$val); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1095 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1096 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1097 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1098 |  |  | 	 * Convert strings into UTF-8 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1099 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1100 |  |  | 	 * @param string $str String to convert | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1101 |  |  | 	 * @return string converted string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1102 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1103 |  |  | 	function convertEncodingStr($str) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1104 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1105 |  |  |         if(!$str) return null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1106 |  |  | 		$obj = new stdClass(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1107 |  |  | 		$obj->str = $str; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1108 |  |  | 		$obj = self::convertEncoding($obj); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1109 |  |  | 		return $obj->str; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1110 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1111 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1112 |  |  | 	function decodeIdna($domain) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1113 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1114 |  |  | 		if(strpos($domain, 'xn--') !== FALSE) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1115 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1116 |  |  | 			require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1117 |  |  | 			$IDN = new idna_convert(array('idn_version' => 2008)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1118 |  |  | 			$domain = $IDN->decode($domain); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1119 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1120 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1121 |  |  | 		return $domain; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1122 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1123 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1124 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1125 |  |  | 	 * Force to set response method | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1126 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1127 |  |  | 	 * @param string $method Response method. [HTML|XMLRPC|JSON] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1128 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1129 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1130 |  |  | 	function setResponseMethod($method = 'HTML') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1131 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1132 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1133 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1134 |  |  | 		$methods = array('HTML' => 1, 'XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1135 |  |  | 		$self->response_method = isset($methods[$method]) ? $method : 'HTML'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1136 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1137 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1138 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1139 |  |  | 	 * Get reponse method | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1140 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1141 |  |  | 	 * @return string Response method. If it's not set, returns request method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1142 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1143 |  |  | 	function getResponseMethod() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1144 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1145 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1146 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1147 |  |  | 		if($self->response_method) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1148 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1149 |  |  | 			return $self->response_method; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1150 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1151 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1152 |  |  | 		$method = $self->getRequestMethod(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1153 |  |  | 		$methods = array('HTML' => 1, 'XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1154 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1155 |  |  | 		return isset($methods[$method]) ? $method : 'HTML'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1156 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1157 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1158 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1159 |  |  | 	 * Determine request method | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1160 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1161 |  |  | 	 * @param string $type Request method. (Optional - GET|POST|XMLRPC|JSON) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1162 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1163 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1164 |  |  | 	function setRequestMethod($type = '') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1165 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1166 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1167 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1168 |  |  | 		$self->js_callback_func = $self->getJSCallbackFunc(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1169 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1170 |  |  | 		($type && $self->request_method = $type) or | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1171 |  |  | 				((strpos($_SERVER['CONTENT_TYPE'], 'json') || strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json')) && $self->request_method = 'JSON') or | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1172 |  |  | 				($GLOBALS['HTTP_RAW_POST_DATA'] && $self->request_method = 'XMLRPC') or | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1173 |  |  | 				($self->js_callback_func && $self->request_method = 'JS_CALLBACK') or | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1174 |  |  | 				($self->request_method = $_SERVER['REQUEST_METHOD']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1175 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1176 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1177 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1178 |  |  | 	 * handle global arguments | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1179 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1180 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1181 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1182 |  |  | 	function _checkGlobalVars() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1183 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1184 |  |  | 		$this->_recursiveCheckVar($_SERVER['HTTP_HOST']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1185 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1186 |  |  | 		$pattern = "/[\,\"\'\{\}\[\]\(\);$]/"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1187 |  |  | 		if(preg_match($pattern, $_SERVER['HTTP_HOST'])) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1188 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1189 |  |  | 			$this->isSuccessInit = FALSE; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1190 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1191 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1192 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1193 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1194 |  |  | 	 * handle request arguments for GET/POST | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1195 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1196 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1197 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1198 |  |  | 	function _setRequestArgument() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1199 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1200 |  |  | 		if(!count($_REQUEST)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1201 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1202 |  |  | 			return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1203 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1204 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1205 |  |  | 		$requestMethod = $this->getRequestMethod(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1206 |  |  | 		foreach($_REQUEST as $key => $val) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1207 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1208 |  |  | 			if($val === '' || self::get($key)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1209 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1210 |  |  | 				continue; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1211 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1212 |  |  | 			$key = htmlentities($key); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1213 |  |  | 			$val = $this->_filterRequestVar($key, $val); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1214 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1215 |  |  | 			if($requestMethod == 'GET' && isset($_GET[$key])) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1216 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1217 |  |  | 				$set_to_vars = TRUE; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1218 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1219 |  |  | 			elseif($requestMethod == 'POST' && isset($_POST[$key])) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1220 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1221 |  |  | 				$set_to_vars = TRUE; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1222 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1223 |  |  | 			elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1224 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1225 |  |  | 				$set_to_vars = TRUE; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1226 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1227 |  |  | 			else | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1228 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1229 |  |  | 				$set_to_vars = FALSE; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1230 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1231 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1232 |  |  | 			if($set_to_vars) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1233 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1234 |  |  | 				$this->_recursiveCheckVar($val); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1235 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1236 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1237 |  |  | 			$this->set($key, $val, $set_to_vars); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1238 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1239 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1240 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1241 |  |  | 	function _recursiveCheckVar($val) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1242 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1243 |  |  | 		if(is_string($val)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1244 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1245 |  |  | 			foreach($this->patterns as $pattern) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1246 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1247 |  |  | 				if(preg_match($pattern, $val)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1248 |  |  | 				{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1249 |  |  | 					$this->isSuccessInit = FALSE; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1250 |  |  | 					return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1251 |  |  | 				} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1252 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1253 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1254 |  |  | 		else if(is_array($val)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1255 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1256 |  |  | 			foreach($val as $val2) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1257 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1258 |  |  | 				$this->_recursiveCheckVar($val2); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1259 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1260 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1261 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1262 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1263 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1264 |  |  | 	 * Handle request arguments for JSON | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1265 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1266 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1267 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1268 |  |  | 	function _setJSONRequestArgument() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1269 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1270 |  |  | 		if($this->getRequestMethod() != 'JSON') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1271 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1272 |  |  | 			return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1273 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1274 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1275 |  |  | 		$params = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1276 |  |  | 		parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $params); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1277 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1278 |  |  | 		foreach($params as $key => $val) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1279 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1280 |  |  | 			$this->set($key, $this->_filterRequestVar($key, $val, 1), TRUE); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1281 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1282 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1283 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1284 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1285 |  |  | 	 * Handle request arguments for XML RPC | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1286 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1287 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1288 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1289 |  |  | 	function _setXmlRpcArgument() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1290 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1291 |  |  | 		if($this->getRequestMethod() != 'XMLRPC') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1292 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1293 |  |  | 			return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1294 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1295 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1296 |  |  | 		$xml = $GLOBALS['HTTP_RAW_POST_DATA']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1297 |  |  | 		if(Security::detectingXEE($xml)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1298 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1299 |  |  | 			header("HTTP/1.0 400 Bad Request"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1300 |  |  | 			exit; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1301 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1302 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1303 |  |  | 		$oXml = new XmlParser(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1304 |  |  | 		$xml_obj = $oXml->parse($xml); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1305 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1306 |  |  | 		$params = $xml_obj->methodcall->params; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1307 |  |  | 		unset($params->node_name, $params->attrs, $params->body); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1308 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1309 |  |  | 		if(!count(get_object_vars($params))) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1310 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1311 |  |  | 			return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1312 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1313 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1314 |  |  | 		foreach($params as $key => $val) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1315 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1316 |  |  | 			$this->set($key, $this->_filterXmlVars($key, $val), TRUE); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1317 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1318 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1319 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1320 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1321 |  |  | 	 * Filter xml variables | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1322 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1323 |  |  | 	 * @param string $key Variable key | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1324 |  |  | 	 * @param object $val Variable value | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1325 |  |  | 	 * @return mixed filtered value | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1326 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1327 |  |  | 	function _filterXmlVars($key, $val) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1328 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1329 |  |  | 		if(is_array($val)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1330 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1331 |  |  | 			$stack = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1332 |  |  | 			foreach($val as $k => $v) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1333 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1334 |  |  | 				$stack[$k] = $this->_filterXmlVars($k, $v); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1335 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1336 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1337 |  |  | 			return $stack; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1338 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1339 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1340 |  |  | 		$body = $val->body; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1341 |  |  | 		unset($val->node_name, $val->attrs, $val->body); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1342 |  |  | 		if(!count(get_object_vars($val))) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1343 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1344 |  |  | 			return $this->_filterRequestVar($key, $body, 0); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1345 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1346 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1347 |  |  | 		$stack = new stdClass(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1348 |  |  | 		foreach($val as $k => $v) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1349 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1350 |  |  | 			$output = $this->_filterXmlVars($k, $v); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1351 |  |  | 			if(is_object($v) && $v->attrs->type == 'array') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1352 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1353 |  |  | 				$output = array($output); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1354 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1355 |  |  | 			if($k == 'value' && (is_array($v) || $v->attrs->type == 'array')) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1356 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1357 |  |  | 				return $output; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1358 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1359 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1360 |  |  | 			$stack->{$k} = $output; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1361 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1362 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1363 |  |  | 		if(!count(get_object_vars($stack))) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1364 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1365 |  |  | 			return NULL; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1366 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1367 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1368 |  |  | 		return $stack; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1369 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1370 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1371 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1372 |  |  | 	 * Filter request variable | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1373 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1374 |  |  | 	 * @see Cast variables, such as _srl, page, and cpage, into interger | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1375 |  |  | 	 * @param string $key Variable key | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1376 |  |  | 	 * @param string $val Variable value | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1377 |  |  | 	 * @param string $do_stripslashes Whether to strip slashes | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1378 |  |  | 	 * @return mixed filtered value. Type are string or array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1379 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1380 |  |  | 	function _filterRequestVar($key, $val, $do_stripslashes = 1) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1381 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1382 |  |  | 		if(!($isArray = is_array($val))) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1383 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1384 |  |  | 			$val = array($val); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1385 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1386 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1387 |  |  | 		$result = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1388 |  |  | 		foreach($val as $k => $v) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1389 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1390 |  |  | 			$k = htmlentities($k); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1391 |  |  | 			if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1392 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1393 |  |  | 				$result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1394 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1395 |  |  | 			elseif($key === 'mid' || $key === 'search_keyword') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1396 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1397 |  |  | 				$result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1398 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1399 |  |  | 			elseif($key === 'vid') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1400 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1401 |  |  | 				$result[$k] = urlencode($v); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1402 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1403 |  |  | 			else | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1404 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1405 |  |  | 				$result[$k] = $v; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1406 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1407 |  |  | 				if($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1408 |  |  | 				{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1409 |  |  | 					$result[$k] = stripslashes($result[$k]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1410 |  |  | 				} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1411 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1412 |  |  | 				if(!is_array($result[$k])) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1413 |  |  | 				{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1414 |  |  | 					$result[$k] = trim($result[$k]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1415 |  |  | 				} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1416 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1417 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1418 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1419 |  |  | 		return $isArray ? $result : $result[0]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1420 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1421 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1422 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1423 |  |  | 	 * Check if there exists uploaded file | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1424 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1425 |  |  | 	 * @return bool True: exists, False: otherwise | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1426 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1427 |  |  | 	function isUploaded() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1428 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1429 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1430 |  |  | 		return $self->is_uploaded; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1431 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1432 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1433 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1434 |  |  | 	 * Handle uploaded file | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1435 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1436 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1437 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1438 |  |  | 	function _setUploadedArgument() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1439 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1440 |  |  | 		if($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1441 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1442 |  |  | 			return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1443 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1444 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1445 |  |  | 		foreach($_FILES as $key => $val) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1446 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1447 |  |  | 			$tmp_name = $val['tmp_name']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1448 |  |  | 			if(!is_array($tmp_name)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1449 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1450 |  |  | 				if(!$tmp_name || !is_uploaded_file($tmp_name)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1451 |  |  | 				{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1452 |  |  | 					continue; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1453 |  |  | 				} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1454 |  |  | 				$val['name'] = htmlspecialchars($val['name'], ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1455 |  |  | 				$this->set($key, $val, TRUE); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1456 |  |  | 				$this->is_uploaded = TRUE; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1457 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1458 |  |  | 			else | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1459 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1460 |  |  | 				for($i = 0, $c = count($tmp_name); $i < $c; $i++) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1461 |  |  | 				{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1462 |  |  | 					if($val['size'][$i] > 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1463 |  |  | 					{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1464 |  |  | 						$file['name'] = $val['name'][$i]; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1465 |  |  | 						$file['type'] = $val['type'][$i]; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1466 |  |  | 						$file['tmp_name'] = $val['tmp_name'][$i]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1467 |  |  | 						$file['error'] = $val['error'][$i]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1468 |  |  | 						$file['size'] = $val['size'][$i]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1469 |  |  | 						$files[] = $file; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1470 |  |  | 					} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1471 |  |  | 				} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1472 |  |  | 				$this->set($key, $files, TRUE); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1473 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1474 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1475 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1476 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1477 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1478 |  |  | 	 * Return request method | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1479 |  |  | 	 * @return string Request method type. (Optional - GET|POST|XMLRPC|JSON) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1480 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1481 |  |  | 	function getRequestMethod() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1482 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1483 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1484 |  |  | 		return $self->request_method; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1485 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1486 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1487 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1488 |  |  | 	 * Return request URL | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1489 |  |  | 	 * @return string request URL | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1490 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1491 |  |  | 	function getRequestUrl() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1492 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1493 |  |  | 		static $url = null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1494 |  |  | 		if(is_null($url)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1495 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1496 |  |  | 			$url = self::getRequestUri(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1497 |  |  | 			if(count($_GET) > 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1498 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1499 |  |  | 				foreach($_GET as $key => $val) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1500 |  |  | 				{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1501 |  |  | 					$vars[] = $key . '=' . ($val ? urlencode(self::convertEncodingStr($val)) : ''); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1502 |  |  | 				} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1503 |  |  | 				$url .= '?' . join('&', $vars); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1504 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1505 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1506 |  |  | 		return $url; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1507 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1508 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1509 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1510 |  |  | 	 * Return js callback func. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1511 |  |  | 	 * @return string callback func. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1512 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1513 |  |  | 	function getJSCallbackFunc() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1514 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1515 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1516 |  |  | 		$js_callback_func = isset($_GET['xe_js_callback']) ? $_GET['xe_js_callback'] : $_POST['xe_js_callback']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1517 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1518 |  |  | 		if(!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1519 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1520 |  |  | 			unset($js_callback_func); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1521 |  |  | 			unset($_GET['xe_js_callback']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1522 |  |  | 			unset($_POST['xe_js_callback']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1523 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1524 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1525 |  |  | 		return $js_callback_func; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1526 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1527 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1528 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1529 |  |  | 	 * Make URL with args_list upon request URL | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1530 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1531 |  |  | 	 * @param int $num_args Arguments nums | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1532 |  |  | 	 * @param array $args_list Argument list for set url | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1533 |  |  | 	 * @param string $domain Domain | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1534 |  |  | 	 * @param bool $encode If TRUE, use url encode. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1535 |  |  | 	 * @param bool $autoEncode If TRUE, url encode automatically, detailed. Use this option, $encode value should be TRUE | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1536 |  |  | 	 * @return string URL | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1537 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1538 |  |  | 	function getUrl($num_args = 0, $args_list = array(), $domain = null, $encode = TRUE, $autoEncode = FALSE) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1539 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1540 |  |  | 		static $site_module_info = null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1541 |  |  | 		static $current_info = null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1542 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1543 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1544 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1545 |  |  | 		// retrieve virtual site information | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1546 |  |  | 		if(is_null($site_module_info)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1547 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1548 |  |  | 			$site_module_info = self::get('site_module_info'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1549 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1550 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1551 |  |  | 		// If $domain is set, handle it (if $domain is vid type, remove $domain and handle with $vid) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1552 |  |  | 		if($domain && isSiteID($domain)) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1553 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1554 |  |  | 			$vid = $domain; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1555 |  |  | 			$domain = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1556 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1557 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1558 |  |  | 		// If $domain, $vid are not set, use current site information | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1559 |  |  | 		if(!$domain && !$vid) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1560 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1561 |  |  | 			if($site_module_info->domain && isSiteID($site_module_info->domain)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1562 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1563 |  |  | 				$vid = $site_module_info->domain; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1564 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1565 |  |  | 			else | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1566 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1567 |  |  | 				$domain = $site_module_info->domain; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1568 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1569 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1570 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1571 |  |  | 		// if $domain is set, compare current URL. If they are same, remove the domain, otherwise link to the domain. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1572 |  |  | 		if($domain) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1573 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1574 |  |  | 			$domain_info = parse_url($domain); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1575 |  |  | 			if(is_null($current_info)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1576 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1577 |  |  | 				$current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . getScriptPath()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1578 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1579 |  |  | 			if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path']) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1580 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1581 |  |  | 				unset($domain); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1582 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1583 |  |  | 			else | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1584 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1585 |  |  | 				$domain = preg_replace('/^(http|https):\/\//i', '', trim($domain)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1586 |  |  | 				if(substr_compare($domain, '/', -1) !== 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1587 |  |  | 				{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1588 |  |  | 					$domain .= '/'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1589 |  |  | 				} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1590 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1591 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1592 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1593 |  |  | 		$get_vars = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1594 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1595 |  |  | 		// If there is no GET variables or first argument is '' to reset variables | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1596 |  |  | 		if(!$self->get_vars || $args_list[0] == '') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1597 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1598 |  |  | 			// rearrange args_list | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1599 |  |  | 			if(is_array($args_list) && $args_list[0] == '') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1600 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1601 |  |  | 				array_shift($args_list); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1602 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1603 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1604 |  |  | 		else | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1605 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1606 |  |  | 			// Otherwise, make GET variables into array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1607 |  |  | 			$get_vars = get_object_vars($self->get_vars); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1608 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1609 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1610 |  |  | 		// arrange args_list | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1611 |  |  | 		for($i = 0, $c = count($args_list); $i < $c; $i += 2) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1612 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1613 |  |  | 			$key = $args_list[$i]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1614 |  |  | 			$val = trim($args_list[$i + 1]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1615 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1616 |  |  | 			// If value is not set, remove the key | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1617 |  |  | 			if(!isset($val) || !strlen($val)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1618 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1619 |  |  | 				unset($get_vars[$key]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1620 |  |  | 				continue; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1621 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1622 |  |  | 			// set new variables | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1623 |  |  | 			$get_vars[$key] = $val; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1624 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1625 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1626 |  |  | 		// remove vid, rnd | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1627 |  |  | 		unset($get_vars['rnd']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1628 |  |  | 		if($vid) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1629 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1630 |  |  | 			$get_vars['vid'] = $vid; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1631 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1632 |  |  | 		else | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1633 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1634 |  |  | 			unset($get_vars['vid']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1635 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1636 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1637 |  |  | 		// for compatibility to lower versions | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1638 |  |  | 		$act = $get_vars['act']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1639 |  |  | 		$act_alias = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1640 |  |  | 			'dispMemberFriend' => 'dispCommunicationFriend', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1641 |  |  | 			'dispMemberMessages' => 'dispCommunicationMessages', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1642 |  |  | 			'dispDocumentAdminManageDocument' => 'dispDocumentManageDocument', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1643 |  |  | 			'dispModuleAdminSelectList' => 'dispModuleSelectList' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1644 |  |  | 		); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1645 |  |  | 		if($act_alias[$act]) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1646 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1647 |  |  | 			$get_vars['act'] = $act_alias[$act]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1648 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1649 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1650 |  |  | 		// organize URL | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1651 |  |  | 		$query = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1652 |  |  | 		if(count($get_vars) > 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1653 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1654 |  |  | 			// if using rewrite mod | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1655 |  |  | 			if($self->allow_rewrite) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1656 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1657 |  |  | 				$var_keys = array_keys($get_vars); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1658 |  |  | 				sort($var_keys); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1659 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1660 |  |  | 				$target = join('.', $var_keys); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1661 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1662 |  |  | 				$act = $get_vars['act']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1663 |  |  | 				$vid = $get_vars['vid']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1664 |  |  | 				$mid = $get_vars['mid']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1665 |  |  | 				$key = $get_vars['key']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1666 |  |  | 				$srl = $get_vars['document_srl']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1667 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1668 |  |  | 				$tmpArray = array('rss' => 1, 'atom' => 1, 'api' => 1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1669 |  |  | 				$is_feed = isset($tmpArray[$act]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1670 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1671 |  |  | 				$target_map = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1672 |  |  | 					'vid' => $vid, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1673 |  |  | 					'mid' => $mid, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1674 |  |  | 					'mid.vid' => "$vid/$mid", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1675 |  |  | 					'entry.mid' => "$mid/entry/" . $get_vars['entry'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1676 |  |  | 					'entry.mid.vid' => "$vid/$mid/entry/" . $get_vars['entry'], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1677 |  |  | 					'document_srl' => $srl, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1678 |  |  | 					'document_srl.mid' => "$mid/$srl", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1679 |  |  | 					'document_srl.vid' => "$vid/$srl", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1680 |  |  | 					'document_srl.mid.vid' => "$vid/$mid/$srl", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1681 |  |  | 					'act' => ($is_feed && $act !== 'api') ? $act : '', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1682 |  |  | 					'act.mid' => $is_feed ? "$mid/$act" : '', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1683 |  |  | 					'act.mid.vid' => $is_feed ? "$vid/$mid/$act" : '', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1684 |  |  | 					'act.document_srl.key' => ($act == 'trackback') ? "$srl/$key/$act" : '', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1685 |  |  | 					'act.document_srl.key.mid' => ($act == 'trackback') ? "$mid/$srl/$key/$act" : '', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1686 |  |  | 					'act.document_srl.key.vid' => ($act == 'trackback') ? "$vid/$srl/$key/$act" : '', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1687 |  |  | 					'act.document_srl.key.mid.vid' => ($act == 'trackback') ? "$vid/$mid/$srl/$key/$act" : '' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1688 |  |  | 				); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1689 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1690 |  |  | 				$query = $target_map[$target]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1691 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1692 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1693 |  |  | 			if(!$query) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1694 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1695 |  |  | 				$queries = array(); | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 1696 |  | View Code Duplication | 				foreach($get_vars as $key => $val) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1697 |  |  | 				{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1698 |  |  | 					if(is_array($val) && count($val) > 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1699 |  |  | 					{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1700 |  |  | 						foreach($val as $k => $v) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1701 |  |  | 						{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1702 |  |  | 							$queries[] = $key . '[' . $k . ']=' . urlencode($v); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1703 |  |  | 						} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1704 |  |  | 					} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1705 |  |  | 					elseif(!is_array($val)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1706 |  |  | 					{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1707 |  |  | 						$queries[] = $key . '=' . urlencode($val); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1708 |  |  | 					} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1709 |  |  | 				} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1710 |  |  | 				if(count($queries) > 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1711 |  |  | 				{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1712 |  |  | 					$query = 'index.php?' . join('&', $queries); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1713 |  |  | 				} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1714 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1715 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1716 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1717 |  |  | 		// If using SSL always | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1718 |  |  | 		$_use_ssl = $self->get('_use_ssl'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1719 |  |  | 		if($_use_ssl == 'always') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1720 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1721 |  |  | 			$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1722 |  |  | 			// optional SSL use | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1723 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1724 |  |  | 		elseif($_use_ssl == 'optional') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1725 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1726 |  |  | 			$ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1727 |  |  | 			$query = $self->getRequestUri($ssl_mode, $domain) . $query; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1728 |  |  | 			// no SSL | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1729 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1730 |  |  | 		else | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1731 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1732 |  |  | 			// currently on SSL but target is not based on SSL | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1733 |  |  | 			if($_SERVER['HTTPS'] == 'on') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1734 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1735 |  |  | 				$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1736 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1737 |  |  | 			else if($domain) // if $domain is set | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1738 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1739 |  |  | 				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1740 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1741 |  |  | 			else | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1742 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1743 |  |  | 				$query = getScriptPath() . $query; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1744 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1745 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1746 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1747 |  |  | 		if(!$encode) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1748 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1749 |  |  | 			return $query; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1750 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1751 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1752 |  |  | 		if(!$autoEncode) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1753 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1754 |  |  | 			return htmlspecialchars($query, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1755 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1756 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1757 |  |  | 		$output = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1758 |  |  | 		$encode_queries = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1759 |  |  | 		$parsedUrl = parse_url($query); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1760 |  |  | 		parse_str($parsedUrl['query'], $output); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1761 |  |  | 		foreach($output as $key => $value) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1762 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1763 |  |  | 			if(preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value))) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1764 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1765 |  |  | 				$value = urlencode(htmlspecialchars_decode(urldecode($value))); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1766 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1767 |  |  | 			$encode_queries[] = $key . '=' . $value; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1768 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1769 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1770 |  |  | 		return htmlspecialchars($parsedUrl['path'] . '?' . join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1771 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1772 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1773 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1774 |  |  | 	 * Return after removing an argument on the requested URL | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1775 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1776 |  |  | 	 * @param string $ssl_mode SSL mode | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1777 |  |  | 	 * @param string $domain Domain | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1778 |  |  | 	 * @retrun string converted URL | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1779 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1780 |  |  | 	function getRequestUri($ssl_mode = FOLLOW_REQUEST_SSL, $domain = null) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1781 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1782 |  |  | 		static $url = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1783 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1784 |  |  | 		// Check HTTP Request | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1785 |  |  | 		if(!isset($_SERVER['SERVER_PROTOCOL'])) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1786 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1787 |  |  | 			return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1788 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1789 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1790 |  |  | 		if(self::get('_use_ssl') == 'always') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1791 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1792 |  |  | 			$ssl_mode = ENFORCE_SSL; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1793 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1794 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1795 |  |  | 		if($domain) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1796 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1797 |  |  | 			$domain_key = md5($domain); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1798 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1799 |  |  | 		else | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1800 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1801 |  |  | 			$domain_key = 'default'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1802 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1803 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1804 |  |  | 		if(isset($url[$ssl_mode][$domain_key])) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1805 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1806 |  |  | 			return $url[$ssl_mode][$domain_key]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1807 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1808 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1809 |  |  | 		$current_use_ssl = ($_SERVER['HTTPS'] == 'on'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1810 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1811 |  |  | 		switch($ssl_mode) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1812 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1813 |  |  | 			case FOLLOW_REQUEST_SSL: $use_ssl = $current_use_ssl; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1814 |  |  | 				break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1815 |  |  | 			case ENFORCE_SSL: $use_ssl = TRUE; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1816 |  |  | 				break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1817 |  |  | 			case RELEASE_SSL: $use_ssl = FALSE; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1818 |  |  | 				break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1819 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1820 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1821 |  |  | 		if($domain) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1822 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1823 |  |  | 			$target_url = trim($domain); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1824 |  |  | 			if(substr_compare($target_url, '/', -1) !== 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1825 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1826 |  |  | 				$target_url.= '/'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1827 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1828 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1829 |  |  | 		else | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1830 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1831 |  |  | 			$target_url = $_SERVER['HTTP_HOST'] . getScriptPath(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1832 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1833 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1834 |  |  | 		$url_info = parse_url('http://' . $target_url); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1835 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1836 |  |  | 		if($current_use_ssl != $use_ssl) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1837 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1838 |  |  | 			unset($url_info['port']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1839 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1840 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1841 |  |  | 		if($use_ssl) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1842 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1843 |  |  | 			$port = self::get('_https_port'); | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 1844 |  | View Code Duplication | 			if($port && $port != 443) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1845 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1846 |  |  | 				$url_info['port'] = $port; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1847 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1848 |  |  | 			elseif($url_info['port'] == 443) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1849 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1850 |  |  | 				unset($url_info['port']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1851 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1852 |  |  | 		} | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 1853 |  | View Code Duplication | 		else | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1854 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1855 |  |  | 			$port = self::get('_http_port'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1856 |  |  | 			if($port && $port != 80) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1857 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1858 |  |  | 				$url_info['port'] = $port; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1859 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1860 |  |  | 			elseif($url_info['port'] == 80) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1861 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1862 |  |  | 				unset($url_info['port']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1863 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1864 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1865 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1866 |  |  | 		$url[$ssl_mode][$domain_key] = sprintf('%s://%s%s%s', $use_ssl ? 'https' : $url_info['scheme'], $url_info['host'], $url_info['port'] && $url_info['port'] != 80 ? ':' . $url_info['port'] : '', $url_info['path']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1867 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1868 |  |  | 		return $url[$ssl_mode][$domain_key]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1869 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1870 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1871 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1872 |  |  | 	 * Set a context value with a key | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1873 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1874 |  |  | 	 * @param string $key Key | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1875 |  |  | 	 * @param string $val Value | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1876 |  |  | 	 * @param mixed $set_to_get_vars If not FALSE, Set to get vars. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1877 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1878 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1879 |  |  | 	function set($key, $val, $set_to_get_vars = 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1880 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1881 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1882 |  |  | 		$self->context->{$key} = $val; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1883 |  |  | 		if($set_to_get_vars === FALSE) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1884 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1885 |  |  | 			return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1886 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1887 |  |  | 		if($val === NULL || $val === '') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1888 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1889 |  |  | 			unset($self->get_vars->{$key}); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1890 |  |  | 			return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1891 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1892 |  |  | 		if($set_to_get_vars || $self->get_vars->{$key}) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1893 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1894 |  |  | 			$self->get_vars->{$key} = $val; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1895 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1896 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1897 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1898 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1899 |  |  | 	 * Return key's value | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1900 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1901 |  |  | 	 * @param string $key Key | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1902 |  |  | 	 * @return string Key | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1903 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1904 |  |  | 	function get($key) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1905 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1906 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1907 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1908 |  |  | 		if(!isset($self->context->{$key})) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1909 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1910 |  |  | 			return null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1911 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1912 |  |  | 		return $self->context->{$key}; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1913 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1914 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1915 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1916 |  |  | 	 * Get one more vars in object vars with given arguments(key1, key2, key3,...) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1917 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1918 |  |  | 	 * @return object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1919 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1920 |  |  | 	function gets() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1921 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1922 |  |  | 		$num_args = func_num_args(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1923 |  |  | 		if($num_args < 1) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1924 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1925 |  |  | 			return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1926 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1927 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1928 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1929 |  |  | 		$args_list = func_get_args(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1930 |  |  | 		$output = new stdClass(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1931 |  |  | 		foreach($args_list as $v) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1932 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1933 |  |  | 			$output->{$v} = $self->get($v); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1934 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1935 |  |  | 		return $output; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1936 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1937 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1938 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1939 |  |  | 	 * Return all data | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1940 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1941 |  |  | 	 * @return object All data | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1942 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1943 |  |  | 	function getAll() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1944 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1945 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1946 |  |  | 		return $self->context; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1947 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1948 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1949 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1950 |  |  | 	 * Return values from the GET/POST/XMLRPC | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1951 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1952 |  |  | 	 * @return Object Request variables. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1953 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1954 |  |  | 	function getRequestVars() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1955 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1956 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1957 |  |  | 		if($self->get_vars) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1958 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1959 |  |  | 			return clone($self->get_vars); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1960 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1961 |  |  | 		return new stdClass; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1962 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1963 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1964 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1965 |  |  | 	 * Register if an action is to be encrypted by SSL. Those actions are sent to https in common/js/xml_handler.js | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1966 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1967 |  |  | 	 * @param string $action act name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1968 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1969 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1970 |  |  | 	function addSSLAction($action) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1971 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1972 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1973 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1974 |  |  | 		if(!is_readable($self->sslActionCacheFile)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1975 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1976 |  |  | 			$buff = '<?php if(!defined("__XE__"))exit;'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1977 |  |  | 			FileHandler::writeFile($self->sslActionCacheFile, $buff); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1978 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1979 |  |  |  | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 1980 |  | View Code Duplication | 		if(!isset($self->ssl_actions[$action])) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1981 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1982 |  |  | 			$self->ssl_actions[$action] = 1; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1983 |  |  | 			$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1984 |  |  | 			FileHandler::writeFile($self->sslActionCacheFile, $sslActionCacheString, 'a'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1985 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1986 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1987 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1988 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1989 |  |  | 	 * Register if actions are to be encrypted by SSL. Those actions are sent to https in common/js/xml_handler.js | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1990 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1991 |  |  | 	 * @param string $action act name | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1992 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1993 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1994 |  |  | 	function addSSLActions($action_array) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1995 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1996 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1997 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1998 |  |  | 		if(!is_readable($self->sslActionCacheFile)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 1999 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2000 |  |  | 			unset($self->ssl_actions); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2001 |  |  | 			$buff = '<?php if(!defined("__XE__"))exit;'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2002 |  |  | 			FileHandler::writeFile($self->sslActionCacheFile, $buff); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2003 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2004 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2005 |  |  | 		foreach($action_array as $action) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2006 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 2007 |  | View Code Duplication | 			if(!isset($self->ssl_actions[$action])) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2008 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2009 |  |  | 				$self->ssl_actions[$action] = 1; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2010 |  |  | 				$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2011 |  |  | 				FileHandler::writeFile($self->sslActionCacheFile, $sslActionCacheString, 'a'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2012 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2013 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2014 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2015 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2016 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2017 |  |  | 	 * Delete if action is registerd to be encrypted by SSL. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2018 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2019 |  |  | 	 * @param string $action act name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2020 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2021 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2022 |  |  | 	function subtractSSLAction($action) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2023 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2024 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2025 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2026 |  |  | 		if($self->isExistsSSLAction($action)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2027 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2028 |  |  | 			$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2029 |  |  | 			$buff = FileHandler::readFile($self->sslActionCacheFile); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2030 |  |  | 			$buff = str_replace($sslActionCacheString, '', $buff); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2031 |  |  | 			FileHandler::writeFile($self->sslActionCacheFile, $buff); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2032 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2033 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2034 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2035 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2036 |  |  | 	 * Get SSL Action | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2037 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2038 |  |  | 	 * @return string acts in array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2039 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2040 |  |  | 	function getSSLActions() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2041 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2042 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2043 |  |  | 		if($self->getSslStatus() == 'optional') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2044 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2045 |  |  | 			return $self->ssl_actions; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2046 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2047 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2048 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2049 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2050 |  |  | 	 * Check SSL action are existed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2051 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2052 |  |  | 	 * @param string $action act name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2053 |  |  | 	 * @return bool If SSL exists, return TRUE. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2054 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2055 |  |  | 	function isExistsSSLAction($action) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2056 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2057 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2058 |  |  | 		return isset($self->ssl_actions[$action]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2059 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2060 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2061 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2062 |  |  | 	 * Normalize file path | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2063 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2064 |  |  | 	 * @deprecated | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2065 |  |  | 	 * @param string $file file path | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2066 |  |  | 	 * @return string normalized file path | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2067 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2068 |  |  | 	function normalizeFilePath($file) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2069 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2070 |  |  | 		if($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2071 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2072 |  |  | 			$file = './' . $file; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2073 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2074 |  |  | 		$file = preg_replace('@/\./|(?<!:)\/\/@', '/', $file); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2075 |  |  | 		while(strpos($file, '/../') !== FALSE) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2076 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2077 |  |  | 			$file = preg_replace('/\/([^\/]+)\/\.\.\//s', '/', $file, 1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2078 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2079 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2080 |  |  | 		return $file; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2081 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2082 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2083 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2084 |  |  | 	 * Get abstract file url | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2085 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2086 |  |  | 	 * @deprecated | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2087 |  |  | 	 * @param string $file file path | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2088 |  |  | 	 * @return string Converted file path | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2089 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2090 |  |  | 	function getAbsFileUrl($file) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2091 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2092 |  |  | 		$file = self::normalizeFilePath($file); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2093 |  |  | 		if(strpos($file, './') === 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2094 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2095 |  |  | 			$file = dirname($_SERVER['SCRIPT_NAME']) . '/' . substr($file, 2); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2096 |  |  | 		} | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 2097 |  | View Code Duplication | 		elseif(strpos($file, '../') === 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2098 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2099 |  |  | 			$file = self::normalizeFilePath(dirname($_SERVER['SCRIPT_NAME']) . "/{$file}"); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2100 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2101 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2102 |  |  | 		return $file; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2103 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2104 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2105 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2106 |  |  | 	 * Load front end file | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2107 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2108 |  |  | 	 * @param array $args array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2109 |  |  | 	 * case js : | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2110 |  |  | 	 * 		$args[0]: file name, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2111 |  |  | 	 * 		$args[1]: type (head | body), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2112 |  |  | 	 * 		$args[2]: target IE, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2113 |  |  | 	 * 		$args[3]: index | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2114 |  |  | 	 * case css : | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2115 |  |  | 	 * 		$args[0]: file name, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2116 |  |  | 	 * 		$args[1]: media, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2117 |  |  | 	 * 		$args[2]: target IE, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2118 |  |  | 	 * 		$args[3]: index | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2119 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2120 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2121 |  |  | 	function loadFile($args) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2122 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2123 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2124 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2125 |  |  | 		$self->oFrontEndFileHandler->loadFile($args); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2126 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2127 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2128 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2129 |  |  | 	 * Unload front end file | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2130 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2131 |  |  | 	 * @param string $file File name with path | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2132 |  |  | 	 * @param string $targetIe Target IE | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2133 |  |  | 	 * @param string $media Media query | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2134 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2135 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2136 |  |  | 	function unloadFile($file, $targetIe = '', $media = 'all') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2137 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2138 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2139 |  |  | 		$self->oFrontEndFileHandler->unloadFile($file, $targetIe, $media); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2140 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2141 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2142 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2143 |  |  | 	 * Unload front end file all | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2144 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2145 |  |  | 	 * @param string $type Unload target (optional - all|css|js) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2146 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2147 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2148 |  |  | 	function unloadAllFiles($type = 'all') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2149 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2150 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2151 |  |  | 		$self->oFrontEndFileHandler->unloadAllFiles($type); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2152 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2153 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2154 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2155 |  |  | 	 * Add the js file | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2156 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2157 |  |  | 	 * @deprecated | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2158 |  |  | 	 * @param string $file File name with path | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2159 |  |  | 	 * @param string $optimized optimized (That seems to not use) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2160 |  |  | 	 * @param string $targetie target IE | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2161 |  |  | 	 * @param string $index index | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2162 |  |  | 	 * @param string $type Added position. (head:<head>..</head>, body:<body>..</body>) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2163 |  |  | 	 * @param bool $isRuleset Use ruleset | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2164 |  |  | 	 * @param string $autoPath If path not readed, set the path automatically. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2165 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2166 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2167 |  |  | 	function addJsFile($file, $optimized = FALSE, $targetie = '', $index = 0, $type = 'head', $isRuleset = FALSE, $autoPath = null) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2168 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2169 |  |  | 		if($isRuleset) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2170 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2171 |  |  | 			if(strpos($file, '#') !== FALSE) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2172 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2173 |  |  | 				$file = str_replace('#', '', $file); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2174 |  |  | 				if(!is_readable($file)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2175 |  |  | 				{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2176 |  |  | 					$file = $autoPath; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2177 |  |  | 				} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2178 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2179 |  |  | 			$validator = new Validator($file); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2180 |  |  | 			$validator->setCacheDir('files/cache'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2181 |  |  | 			$file = $validator->getJsPath(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2182 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2183 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2184 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2185 |  |  | 		$self->oFrontEndFileHandler->loadFile(array($file, $type, $targetie, $index)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2186 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2187 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2188 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2189 |  |  | 	 * Remove the js file | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2190 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2191 |  |  | 	 * @deprecated | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2192 |  |  | 	 * @param string $file File name with path | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2193 |  |  | 	 * @param string $optimized optimized (That seems to not use) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2194 |  |  | 	 * @param string $targetie target IE | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2195 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2196 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2197 |  |  | 	function unloadJsFile($file, $optimized = FALSE, $targetie = '') | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2198 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2199 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2200 |  |  | 		$self->oFrontEndFileHandler->unloadFile($file, $targetie); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2201 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2202 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2203 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2204 |  |  | 	 * Unload all javascript files | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2205 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2206 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2207 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2208 |  |  | 	function unloadAllJsFiles() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2209 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2210 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2211 |  |  | 		$self->oFrontEndFileHandler->unloadAllFiles('js'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2212 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2213 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2214 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2215 |  |  | 	 * Add javascript filter | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2216 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2217 |  |  | 	 * @param string $path File path | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2218 |  |  | 	 * @param string $filename File name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2219 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2220 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2221 |  |  | 	function addJsFilter($path, $filename) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2222 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2223 |  |  | 		$oXmlFilter = new XmlJSFilter($path, $filename); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2224 |  |  | 		$oXmlFilter->compile(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2225 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2226 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2227 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2228 |  |  | 	 * Same as array_unique but works only for file subscript | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2229 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2230 |  |  | 	 * @deprecated | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2231 |  |  | 	 * @param array $files File list | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2232 |  |  | 	 * @return array File list | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2233 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2234 |  |  | 	function _getUniqueFileList($files) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2235 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2236 |  |  | 		ksort($files); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2237 |  |  | 		$files = array_values($files); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2238 |  |  | 		$filenames = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2239 |  |  | 		for($i = 0, $c = count($files); $i < $c; ++$i) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2240 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2241 |  |  | 			if(in_array($files[$i]['file'], $filenames)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2242 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2243 |  |  | 				unset($files[$i]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2244 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2245 |  |  | 			$filenames[] = $files[$i]['file']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2246 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2247 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2248 |  |  | 		return $files; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2249 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2250 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2251 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2252 |  |  | 	 * Returns the list of javascripts that matches the given type. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2253 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2254 |  |  | 	 * @param string $type Added position. (head:<head>..</head>, body:<body>..</body>) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2255 |  |  | 	 * @return array Returns javascript file list. Array contains file, targetie. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2256 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2257 |  |  | 	function getJsFile($type = 'head') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2258 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2259 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2260 |  |  | 		return $self->oFrontEndFileHandler->getJsFileList($type); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2261 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2262 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2263 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2264 |  |  | 	 * Add CSS file | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2265 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2266 |  |  | 	 * @deprecated | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2267 |  |  | 	 * @param string $file File name with path | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2268 |  |  | 	 * @param string $optimized optimized (That seems to not use) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2269 |  |  | 	 * @param string $media Media query | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2270 |  |  | 	 * @param string $targetie target IE | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2271 |  |  | 	 * @param string $index index | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2272 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2273 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2274 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2275 |  |  | 	function addCSSFile($file, $optimized = FALSE, $media = 'all', $targetie = '', $index = 0) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2276 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2277 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2278 |  |  | 		$self->oFrontEndFileHandler->loadFile(array($file, $media, $targetie, $index)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2279 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2280 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2281 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2282 |  |  | 	 * Remove css file | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2283 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2284 |  |  | 	 * @deprecated | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2285 |  |  | 	 * @param string $file File name with path | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2286 |  |  | 	 * @param string $optimized optimized (That seems to not use) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2287 |  |  | 	 * @param string $media Media query | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2288 |  |  | 	 * @param string $targetie target IE | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2289 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2290 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2291 |  |  | 	function unloadCSSFile($file, $optimized = FALSE, $media = 'all', $targetie = '') | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2292 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2293 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2294 |  |  | 		$self->oFrontEndFileHandler->unloadFile($file, $targetie, $media); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2295 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2296 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2297 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2298 |  |  | 	 * Unload all css files | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2299 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2300 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2301 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2302 |  |  | 	function unloadAllCSSFiles() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2303 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2304 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2305 |  |  | 		$self->oFrontEndFileHandler->unloadAllFiles('css'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2306 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2307 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2308 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2309 |  |  | 	 * Return a list of css files | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2310 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2311 |  |  | 	 * @return array Returns css file list. Array contains file, media, targetie. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2312 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2313 |  |  | 	function getCSSFile() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2314 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2315 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2316 |  |  | 		return $self->oFrontEndFileHandler->getCssFileList(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2317 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2318 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2319 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2320 |  |  | 	 * Returns javascript plugin file info | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2321 |  |  | 	 * @param string $pluginName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2322 |  |  | 	 * @return stdClass | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2323 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2324 |  |  | 	function getJavascriptPluginInfo($pluginName) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2325 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2326 |  |  | 		if($plugin_name == 'ui.datepicker') | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2327 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2328 |  |  | 			$plugin_name = 'ui'; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2329 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2330 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2331 |  |  | 		$plugin_path = './common/js/plugins/' . $pluginName . '/'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2332 |  |  | 		$info_file = $plugin_path . 'plugin.load'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2333 |  |  | 		if(!is_readable($info_file)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2334 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2335 |  |  | 			return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2336 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2337 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2338 |  |  | 		$list = file($info_file); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2339 |  |  | 		$result = new stdClass(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2340 |  |  | 		$result->jsList = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2341 |  |  | 		$result->cssList = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2342 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2343 |  |  | 		foreach($list as $filename) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2344 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2345 |  |  | 			$filename = trim($filename); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2346 |  |  | 			if(!$filename) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2347 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2348 |  |  | 				continue; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2349 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2350 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2351 |  |  | 			if(strncasecmp('./', $filename, 2) === 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2352 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2353 |  |  | 				$filename = substr($filename, 2); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2354 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2355 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2356 |  |  | 			if(substr_compare($filename, '.js', -3) === 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2357 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2358 |  |  | 				$result->jsList[] = $plugin_path . $filename; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2359 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2360 |  |  | 			elseif(substr_compare($filename, '.css', -4) === 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2361 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2362 |  |  | 				$result->cssList[] = $plugin_path . $filename; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2363 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2364 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2365 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2366 |  |  | 		if(is_dir($plugin_path . 'lang')) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2367 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2368 |  |  | 			$result->langPath = $plugin_path . 'lang'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2369 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2370 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2371 |  |  | 		return $result; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2372 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2373 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2374 |  |  | 	 * Load javascript plugin | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2375 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2376 |  |  | 	 * @param string $plugin_name plugin name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2377 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2378 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2379 |  |  | 	function loadJavascriptPlugin($plugin_name) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2380 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2381 |  |  | 		static $loaded_plugins = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2382 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2383 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2384 |  |  | 		if($plugin_name == 'ui.datepicker') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2385 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2386 |  |  | 			$plugin_name = 'ui'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2387 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2388 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2389 |  |  | 		if($loaded_plugins[$plugin_name]) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2390 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2391 |  |  | 			return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2392 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2393 |  |  | 		$loaded_plugins[$plugin_name] = TRUE; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2394 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2395 |  |  | 		$plugin_path = './common/js/plugins/' . $plugin_name . '/'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2396 |  |  | 		$info_file = $plugin_path . 'plugin.load'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2397 |  |  | 		if(!is_readable($info_file)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2398 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2399 |  |  | 			return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2400 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2401 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2402 |  |  | 		$list = file($info_file); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2403 |  |  | 		foreach($list as $filename) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2404 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2405 |  |  | 			$filename = trim($filename); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2406 |  |  | 			if(!$filename) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2407 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2408 |  |  | 				continue; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2409 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2410 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2411 |  |  | 			if(strncasecmp('./', $filename, 2) === 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2412 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2413 |  |  | 				$filename = substr($filename, 2); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2414 |  |  | 			} | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 2415 |  | View Code Duplication | 			if(substr_compare($filename, '.js', -3) === 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2416 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2417 |  |  | 				$self->loadFile(array($plugin_path . $filename, 'body', '', 0), TRUE); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2418 |  |  | 			} | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 2419 |  | View Code Duplication | 			if(substr_compare($filename, '.css', -4) === 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2420 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2421 |  |  | 				$self->loadFile(array($plugin_path . $filename, 'all', '', 0), TRUE); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2422 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2423 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2424 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2425 |  |  | 		if(is_dir($plugin_path . 'lang')) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2426 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2427 |  |  | 			$self->loadLang($plugin_path . 'lang'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2428 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2429 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2430 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2431 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2432 |  |  | 	 * Add html code before </head> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2433 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2434 |  |  | 	 * @param string $header add html code before </head>. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2435 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2436 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2437 |  |  | 	function addHtmlHeader($header) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2438 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2439 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2440 |  |  | 		$self->html_header .= "\n" . $header; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2441 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2442 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2443 |  |  | 	function clearHtmlHeader() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2444 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2445 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2446 |  |  | 		$self->html_header = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2447 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2448 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2449 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2450 |  |  | 	 * Returns added html code by addHtmlHeader() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2451 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2452 |  |  | 	 * @return string Added html code before </head> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2453 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2454 |  |  | 	function getHtmlHeader() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2455 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2456 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2457 |  |  | 		return $self->html_header; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2458 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2459 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2460 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2461 |  |  | 	 * Add css class to Html Body | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2462 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2463 |  |  | 	 * @param string $class_name class name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2464 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2465 |  |  | 	function addBodyClass($class_name) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2466 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2467 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2468 |  |  | 		$self->body_class[] = $class_name; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2469 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2470 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2471 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2472 |  |  | 	 * Return css class to Html Body | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2473 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2474 |  |  | 	 * @return string Return class to html body | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2475 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2476 |  |  | 	function getBodyClass() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2477 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2478 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2479 |  |  | 		$self->body_class = array_unique($self->body_class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2480 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2481 |  |  | 		return (count($self->body_class) > 0) ? sprintf(' class="%s"', join(' ', $self->body_class)) : ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2482 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2483 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2484 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2485 |  |  | 	 * Add html code after <body> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2486 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2487 |  |  | 	 * @param string $header Add html code after <body> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2488 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2489 |  |  | 	function addBodyHeader($header) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2490 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2491 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2492 |  |  | 		$self->body_header .= "\n" . $header; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2493 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2494 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2495 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2496 |  |  | 	 * Returns added html code by addBodyHeader() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2497 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2498 |  |  | 	 * @return string Added html code after <body> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2499 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2500 |  |  | 	function getBodyHeader() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2501 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2502 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2503 |  |  | 		return $self->body_header; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2504 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2505 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2506 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2507 |  |  | 	 * Add html code before </body> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2508 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2509 |  |  | 	 * @param string $footer Add html code before </body> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2510 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2511 |  |  | 	function addHtmlFooter($footer) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2512 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2513 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2514 |  |  | 		$self->html_footer .= ($self->Htmlfooter ? "\n" : '') . $footer; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2515 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2516 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2517 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2518 |  |  | 	 * Returns added html code by addHtmlHeader() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2519 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2520 |  |  | 	 * @return string Added html code before </body> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2521 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2522 |  |  | 	function getHtmlFooter() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2523 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2524 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2525 |  |  | 		return $self->html_footer; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2526 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2527 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2528 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2529 |  |  | 	 * Get config file | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2530 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2531 |  |  | 	 * @retrun string The path of the config file that contains database settings | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2532 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2533 |  |  | 	function getConfigFile() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2534 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2535 |  |  | 		return _XE_PATH_ . 'files/config/db.config.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2536 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2537 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2538 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2539 |  |  | 	 * Get FTP config file | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2540 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2541 |  |  | 	 * @return string The path of the config file that contains FTP settings | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2542 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2543 |  |  | 	function getFTPConfigFile() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2544 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2545 |  |  | 		return _XE_PATH_ . 'files/config/ftp.config.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2546 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2547 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2548 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2549 |  |  | 	 * Checks whether XE is installed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2550 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2551 |  |  | 	 * @return bool True if the config file exists, otherwise FALSE. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2552 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2553 |  |  | 	function isInstalled() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2554 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2555 |  |  | 		return FileHandler::hasContent(self::getConfigFile()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2556 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2557 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2558 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2559 |  |  | 	 * Transforms codes about widget or other features into the actual code, deprecatred | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2560 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2561 |  |  | 	 * @param string Transforms codes | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2562 |  |  | 	 * @return string Transforms codes | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2563 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2564 |  |  | 	function transContent($content) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2565 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2566 |  |  | 		return $content; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2567 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2568 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2569 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2570 |  |  | 	 * Check whether it is allowed to use rewrite mod | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2571 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2572 |  |  | 	 * @return bool True if it is allowed to use rewrite mod, otherwise FALSE | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2573 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2574 |  |  | 	function isAllowRewrite() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2575 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2576 |  |  | 		$oContext = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2577 |  |  | 		return $oContext->allow_rewrite; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2578 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2579 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2580 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2581 |  |  | 	 * Converts a local path into an URL | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2582 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2583 |  |  | 	 * @param string $path URL path | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2584 |  |  | 	 * @return string Converted path | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2585 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2586 |  |  | 	function pathToUrl($path) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2587 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2588 |  |  | 		$xe = _XE_PATH_; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2589 |  |  | 		$path = strtr($path, "\\", "/"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2590 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2591 |  |  | 		$base_url = preg_replace('@^https?://[^/]+/?@', '', self::getRequestUri()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2592 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2593 |  |  | 		$_xe = explode('/', $xe); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2594 |  |  | 		$_path = explode('/', $path); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2595 |  |  | 		$_base = explode('/', $base_url); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2596 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2597 |  |  | 		if(!$_base[count($_base) - 1]) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2598 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2599 |  |  | 			array_pop($_base); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2600 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2601 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2602 |  |  | 		foreach($_xe as $idx => $dir) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2603 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2604 |  |  | 			if($_path[0] != $dir) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2605 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2606 |  |  | 				break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2607 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2608 |  |  | 			array_shift($_path); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2609 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2610 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2611 |  |  | 		$idx = count($_xe) - $idx - 1; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2612 |  |  | 		while($idx--) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2613 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2614 |  |  | 			if(count($_base) > 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2615 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2616 |  |  | 				array_shift($_base); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2617 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2618 |  |  | 			else | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2619 |  |  | 			{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2620 |  |  | 				array_unshift($_base, '..'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2621 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2622 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2623 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2624 |  |  | 		if(count($_base) > 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2625 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2626 |  |  | 			array_unshift($_path, join('/', $_base)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2627 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2628 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2629 |  |  | 		$path = '/' . join('/', $_path); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2630 |  |  | 		if(substr_compare($path, '/', -1) !== 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2631 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2632 |  |  | 			$path .= '/'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2633 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2634 |  |  | 		return $path; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2635 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2636 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2637 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2638 |  |  | 	 * Get meta tag | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2639 |  |  | 	 * @return array The list of meta tags | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2640 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2641 |  |  | 	function getMetaTag() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2642 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2643 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2644 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2645 |  |  | 		if(!is_array($self->meta_tags)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2646 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2647 |  |  | 			$self->meta_tags = array(); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2648 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2649 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2650 |  |  | 		$ret = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2651 |  |  | 		foreach($self->meta_tags as $key => $val) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2652 |  |  | 		{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2653 |  |  | 			list($name, $is_http_equiv) = explode("\t", $key); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2654 |  |  | 			$ret[] = array('name' => $name, 'is_http_equiv' => $is_http_equiv, 'content' => $val); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2655 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2656 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2657 |  |  | 		return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2658 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2659 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2660 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2661 |  |  | 	 * Add the meta tag | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2662 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2663 |  |  | 	 * @param string $name name of meta tag | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2664 |  |  | 	 * @param string $content content of meta tag | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2665 |  |  | 	 * @param mixed $is_http_equiv value of http_equiv | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2666 |  |  | 	 * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2667 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2668 |  |  | 	function addMetaTag($name, $content, $is_http_equiv = FALSE) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2669 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2670 |  |  | 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2671 |  |  | 		$self->meta_tags[$name . "\t" . ($is_http_equiv ? '1' : '0')] = $content; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2672 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2673 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2674 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2675 |  |  | /* End of file Context.class.php */ | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 2676 |  |  | /* Location: ./classes/context/Context.class.php */ | 
            
                                                        
            
                                    
            
            
                | 2677 |  |  |  |