function testBuildUrl()
 {
     $aConf = array('protocol' => 'http', 'host' => 'www.example.com', 'path' => '/foo', 'httpPort' => 80, 'httpsPort' => 443);
     $this->assertEqual('http://www.example.com/foo', OA_Central::buildUrl($aConf));
     $aConf['httpPort'] = 8080;
     $this->assertEqual('http://www.example.com:8080/foo', OA_Central::buildUrl($aConf));
     $aConf['protocol'] = 'https';
     $this->assertEqual('https://www.example.com/foo', OA_Central::buildUrl($aConf));
     $aConf['httpsPort'] = 4443;
     $this->assertEqual('https://www.example.com:4443/foo', OA_Central::buildUrl($aConf));
     $aConf['protocol'] = 'http';
     $aConf['port'] = 80;
     $this->assertEqual('http://www.example.com/foo', OA_Central::buildUrl($aConf));
     $aConf['protocol'] = 'https';
     $aConf['port'] = 443;
     $this->assertEqual('https://www.example.com/foo', OA_Central::buildUrl($aConf));
     $aConf['protocol'] = 'http';
     $aConf['port'] = 81;
     $this->assertEqual('http://www.example.com:81/foo', OA_Central::buildUrl($aConf));
     $aConf['path1'] = '/bar';
     $this->assertEqual('http://www.example.com:81/bar', OA_Central::buildUrl($aConf, 'path1'));
 }
Example #2
0
 /**
  * A method to retrieve the URL of the captcha image
  *
  * @see R-AN-20: Captcha Validation
  *
  * @return string
  */
 function getCaptchaUrl()
 {
     $platformHash = OA_Dal_ApplicationVariables::get('platform_hash');
     $url = OA_Central::buildUrl($GLOBALS['_MAX']['CONF']['oacXmlRpc'], 'captcha');
     $url .= '?ph=' . urlencode($platformHash);
     return $url;
 }