Exemplo n.º 1
0
 public static function convertPhysicalToUri($path)
 {
     if (self::$physicalEncoding == "") {
         self::$physicalEncoding = self::getPhysicalEncoding();
     }
     if (self::$directoryIndex == null) {
         self::$directoryIndex = self::getDirectoryIndexArray();
     }
     if (isset(self::$directoryIndex[self::getName($path)])) {
         $path = self::getDirectory($path) . "/";
     }
     if ('utf-8' !== self::$physicalEncoding) {
         $path = Text\Encoding::convertEncoding($path, self::$physicalEncoding, 'utf-8');
     }
     return implode('/', array_map("rawurlencode", explode('/', $path)));
 }
Exemplo n.º 2
0
 protected static function unConvertData($data)
 {
     return Encoding::convertEncodingArray($data, 'UTF-8', SITE_CHARSET);
 }
Exemplo n.º 3
0
 public function getRequestedPage()
 {
     if ($this->requestedFile != null) {
         return $this->requestedFile;
     }
     $page = $this->getRequestUri();
     if (empty($page)) {
         $this->requestedFile = parent::getRequestedPage();
         return $this->requestedFile;
     }
     $page = urldecode($page);
     $page = Text\Encoding::convertEncodingToCurrent($page);
     $this->requestedFile = $this->convertToPath($page);
     return $this->requestedFile;
 }
Exemplo n.º 4
0
	protected function query($scope, $method = "GET", $data = null, $bSkipRefreshAuth = false)
	{
		if($this->engineSettings['AUTH'])
		{
			$http = new \CHTTP();
			$http->setAdditionalHeaders(
				array(
					'Authorization' => 'OAuth '.$this->engineSettings['AUTH']['access_token']
				)
			);
			$http->setFollowRedirect(false);

			switch($method)
			{
				case 'GET':
					$result = $http->get($scope);
				break;
				case 'POST':
					$result = $http->post($scope, $data);
				break;
				case 'PUT':
					$result = $http->httpQuery($method, $scope, $http->prepareData($data));
				break;
				case 'DELETE':

				break;
			}

			if($http->status == 401 && !$bSkipRefreshAuth)
			{
				if($this->checkAuthExpired(false))
				{
					$this->query($scope, $method, $data, true);
				}
			}

			$http->result = Text\Encoding::convertEncoding($http->result, 'utf-8', LANG_CHARSET);

			return $http;
		}
	}