本文整理汇总了PHP中OX_getHostName函数的典型用法代码示例。如果您正苦于以下问题:PHP OX_getHostName函数的具体用法?PHP OX_getHostName怎么用?PHP OX_getHostName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OX_getHostName函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Class constructor
*
* @param string $id
* @param string $group
* @param int $lifeTime
* @param string $cacheDir // can be used to read cache backups from different directory
* @return OA_Cache
*/
function __construct($id, $group, $lifeTime = null, $cacheDir = null)
{
if (!isset($cacheDir)) {
$cacheDir = MAX_PATH . '/var/cache/';
}
$this->oCache = new Cache_Lite(array('cacheDir' => $cacheDir, 'lifeTime' => $lifeTime, 'readControlType' => 'md5', 'automaticSerialization' => true));
$this->id = $id;
$this->group = OX_getHostName() . (!empty($group) ? '_' . $group : '');
}
示例2: parseDeliveryIniFile
/**
* The delivery engine's function to parse the configuration .ini file
*
* @param $configPath The path to the config file
* @param $configFile Optional - The suffix of the config file
* @param $sections Optional - process sections to get a multidimensional array
*
* @return mixed The array resulting from the call to parse_ini_file(), with
* the appropriate .ini file for the installation.
*/
function parseDeliveryIniFile($configPath = null, $configFile = null, $sections = true)
{
// Set up the configuration .ini file path location
if (!$configPath) {
$configPath = MAX_PATH . '/var';
}
if ($configFile) {
$configFile = '.' . $configFile;
}
$host = OX_getHostName();
$configFileName = $configPath . '/' . $host . $configFile . '.conf.php';
$conf = @parse_ini_file($configFileName, $sections);
if (isset($conf['realConfig'])) {
// added for backward compatibility - realConfig points to different config
$realconf = @parse_ini_file(MAX_PATH . '/var/' . $conf['realConfig'] . '.conf.php', $sections);
$conf = mergeConfigFiles($realconf, $conf);
}
if (!empty($conf)) {
return $conf;
} elseif ($configFile === '.plugin') {
// For plugins, if no configuration file is found, return the sane default values
$pluginType = basename($configPath);
$defaultConfig = MAX_PATH . '/plugins/' . $pluginType . '/default.plugin.conf.php';
$conf = @parse_ini_file($defaultConfig, $sections);
if ($conf !== false) {
// check for false here - it's possible file doesn't exist
return $conf;
}
echo "Revive Adserver could not read the default configuration file for the {$pluginType} plugin";
exit(1);
}
// Check for a 'default.conf.php' file
$configFileName = $configPath . '/default' . $configFile . '.conf.php';
$conf = @parse_ini_file($configFileName, $sections);
if (isset($conf['realConfig'])) {
// added for backward compatibility - realConfig points to different config
$conf = @parse_ini_file(MAX_PATH . '/var/' . $conf['realConfig'] . '.conf.php', $sections);
}
if (!empty($conf)) {
return $conf;
}
// Check to ensure Max hasn't been installed
if (file_exists(MAX_PATH . '/var/INSTALLED')) {
echo "Revive Adserver has been installed, but no configuration file was found.\n";
exit(1);
}
// Revive Adserver hasn't been installed, so delivery engine can't run
echo "Revive Adserver has not been installed yet -- please read the INSTALL.txt file.\n";
exit(1);
}
示例3: test_parseDeliveryIniFile
/**
* A method to test the getConfigVersion() method.
*/
function test_parseDeliveryIniFile()
{
$host = OX_getHostName();
copy(MAX_PATH . '/lib/OA/tests/data/test.demo.conf.php', MAX_PATH . '/var/' . $host . '.test.demo.conf.php');
copy(MAX_PATH . '/lib/OA/tests/data/test.real.conf.php', MAX_PATH . '/var/test.real.conf.php');
$result = parseDeliveryIniFile('', 'test.demo');
$this->assertIsA($result, 'array');
$this->assertTrue(isset($result['database']));
$this->assertEqual($result['database']['username'], 'demo_user');
$this->assertEqual($result['database']['password'], 'demo_pass');
$this->assertEqual($result['database']['name'], 'demo_name');
$this->assertTrue(isset($result['real']));
$this->assertEqual($result['real']['key1'], 'val1');
$this->assertEqual($result['real']['key2'], 'val2');
@unlink(MAX_PATH . '/var/' . $host . '.test.demo.conf.php');
@unlink(MAX_PATH . '/var/test.real.conf.php');
}
示例4: testCreateGeoTargetingConfiguration
function testCreateGeoTargetingConfiguration()
{
if (file_exists(GEOCONFIG_PATH)) {
rename(GEOCONFIG_PATH, TMP_GEOCONFIG_PATH);
}
$upgradeConfig = new OA_Upgrade_Config();
$host = OX_getHostName();
$migration = new Migration_108();
$migration->init($this->oDbh, MAX_PATH . '/var/DB_Upgrade.test.log');
$this->checkNoGeoTargeting($migration, $host);
$this->checkGeoIp($migration, $host);
$this->checkModGeoIP($migration, $host);
Util_File_remove(GEOCONFIG_PATH);
if (file_exists(TMP_GEOCONFIG_PATH)) {
rename(TMP_GEOCONFIG_PATH, GEOCONFIG_PATH);
}
}
示例5: getConfigFileName
/**
* A method to return the path to the configuration file of a given plugin.
*
* @static
* @param string $module The plugin module name (i.e. /plugins/module directory).
* @param string $package An optional plugin package name (i.e. /plugins/module/package
* directory). If not given, generates the module level
* configuration file path.
* @param string $name An optional plugin name (i.e. /plugins/module/package/plugin.plugin.php).
* If not given, generates the package level configuration file path, or
* the module level configuration file path, depending on the $package
* parameter.
* @param boolean $defaultConfig Optional flag. When true, returns the path to the default
* configuration file distributed with Max; when false, the
* path to the "real" configuration file for the plugin that
* has been written previously is returned.
* @param string $host An optional parameter to override the host name via which the Max
* installation is currently being accessed.
* @return string The path to the configuration file.
*/
function getConfigFileName($module, $package = null, $name = null, $defaultConfig = false, $host = null)
{
$aConf = $GLOBALS['_MAX']['CONF'];
if ($defaultConfig) {
if (is_null($host)) {
$host = 'default';
}
$startPath = MAX_PATH . '/plugins/';
} else {
if (is_null($host)) {
$host = OX_getHostName();
}
$startPath = MAX_PATH . $aConf['pluginPaths']['var'] . 'config/';
}
$configName = $host . '.plugin.conf.php';
if ($package === null) {
$configPath = $module . '/';
} elseif ($name === null) {
$configPath = $module . '/' . $package . '/';
} else {
$configPath = $module . '/' . $package . '/' . $name . '.';
}
return $startPath . $configPath . $configName;
}
示例6: createConfigIfNotExists
/**
* This method creates config if it doesn't exist so test won't fail
*
*/
function createConfigIfNotExists()
{
if (!file_exists(MAX_PATH . '/var/' . OX_getHostName() . '.conf.php')) {
$oConfig = new OA_Upgrade_Config();
$oConfig->writeConfig(true);
}
}
示例7: OA_Delivery_XmlRpc_SPC
/**
* A function to handle XML-RPC advertisement SPC requests.
*
* @param XML_RPC_Message $params An XML_RPC_Message containing the parameters. The expected parameters
* are (in order):
* - An XML_RPC_Value of type "struct" containing remote informations
* which needs at least two members:
* - remote_addr (string) and
* - cookies (struct);
* - An XML_RPC_Value of type "string" containing the "what" value;
* - An XML_RPC_Value of type "string" containing the "target" value;
* - An XML_RPC_Value of type "string" containing the "source" value;
* - An XML_RPC_Value of type "boolean" containing the "withtext" value;
* - An XML_RPC_Value of type "boolean" containing the "block" value;
* - An XML_RPC_Value of type "boolean" containing the "blockcampaign" value;
* @return XML_RPC_Response The response. The XML_RPC_Value of the response can be one of
* a number of different values:
* - Error Code 21: wrong number of parameters.
* - Error Code 22: remote_addr element missing from the remote info struct.
* - Error Code 23: cookies element missing from the remote info struct.
* - An XML_RPC_Value of type "struct" with the HTML details required
* for displaying the advertisement stored as in XML_RPC_Value of
* type "string" in the "html" index, and other elements returned by the
* MAX_asSelect call. A special "cookies" element is either:
* - An empty XML_RPC_Value if there are no cookies to be set, or
* - An XML_RPC_Value of type "array", containing a number of XML_RPC_Values
* of tpye "array", each with 3 items:
* - An XML_RPC_Value of type "string" with the cookie name;
* - An XML_RPC_Value of type "string" with the cookie value; and
* - An XML_RPC_Value of type "string" with the cookie expiration time.
*/
function OA_Delivery_XmlRpc_SPC($params)
{
global $XML_RPC_erruser;
global $XML_RPC_String, $XML_RPC_Struct, $XML_RPC_Array;
// Check the parameters exist
$numParams = $params->getNumParams();
if ($numParams != 7) {
// Return an error
$errorCode = $XML_RPC_erruser + 21;
$errorMsg = 'Incorrect number of parameters';
return new XML_RPC_Response(0, $errorCode, $errorMsg);
}
// Set the XML values into their correct variables to make life easier
$vars = array(1 => 'what', 2 => 'target', 3 => 'source', 4 => 'withtext', 5 => 'block', 6 => 'blockcampaign');
// Parse parameters
for ($i = 0; $i < $numParams; $i++) {
$p = $params->getParam($i);
if ($i) {
// Put the decoded value the view arg array
${$vars}[$i] = XML_RPC_decode($p);
} else {
// First parameter: environment information supplied be XML-RPC client
$p = XML_RPC_decode($p);
if (!isset($p['remote_addr'])) {
// Return an error
$errorCode = $XML_RPC_erruser + 22;
$errorMsg = "Missing 'remote_addr' member";
return new XML_RPC_Response(0, $errorCode, $errorMsg);
}
if (!isset($p['cookies']) || !is_array($p['cookies'])) {
// Return an error
$errorCode = $XML_RPC_erruser + 23;
$errorMsg = "Missing 'cookies' member";
return new XML_RPC_Response(0, $errorCode, $errorMsg);
}
$aServerVars = array('remote_addr' => 'REMOTE_ADDR', 'remote_host' => 'REMOTE_HOST', 'request_uri' => 'REQUEST_URI', 'https' => 'HTTPS', 'server_name' => 'SERVER_NAME', 'http_host' => 'HTTP_HOST', 'accept_language' => 'HTTP_ACCEPT_LANGUAGE', 'referer' => 'HTTP_REFERER', 'user_agent' => 'HTTP_USER_AGENT', 'via' => 'HTTP_VIA', 'forwarded' => 'HTTP_FORWARDED', 'forwarded_for' => 'HTTP_FORWARDED_FOR', 'x_forwarded' => 'HTTP_X_FORWARDED', 'x_forwarded_for' => 'HTTP_X_FORWARDED_FOR', 'client_ip' => 'HTTP_CLIENT_IP');
// Extract environment vars to $_SERVER
foreach ($aServerVars as $xmlName => $varName) {
if (isset($p[$xmlName])) {
$_SERVER[$varName] = $p[$xmlName];
}
}
// Extract cookie vars to $_COOKIE
foreach ($p['cookies'] as $key => $value) {
$_COOKIE[$key] = MAX_commonAddslashesRecursive($value);
}
MAX_cookieUnpackCapping();
}
}
// Add defaults for not-applicable values
$richmedia = true;
$ct0 = '';
$context = array();
// Make loc and referer global to ensure that the delivery limitations work correctly
global $loc, $referer;
$loc = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . OX_getHostName() . $_SERVER['REQUEST_URI'];
// Add $referer parameter
$referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
// If the what parameter is an int, it is the affiliateid, otherwise it's a serialized array of name=zone pairs
// This convention is inline with the parameters passed into local-mode SPC
if (is_numeric($what)) {
$zones = OA_cacheGetPublisherZones($what);
$nz = false;
} else {
$zones = unserialize($what);
$nz = true;
}
$spc_output = array();
foreach ($zones as $zone => $data) {
//.........这里部分代码省略.........
示例8: Date
}
$oStartDate = new Date($oConnectionDate->format('%Y-%m-%d %H:00:00'));
$oEndDate = new Date($oConnectionDate->format('%Y-%m-%d %H:00:00'));
$oDal->_saveSummaryUpdateWithFinanceInfo($oStartDate, $oEndDate, $data_summary_table);
if (!is_null($plugin)) {
$plugin->serviceLocatorRemove();
}
}
}
}
if ($modified) {
// Clear cache
include_once 'Cache/Lite.php';
$options = array('cacheDir' => MAX_CACHE);
$cache = new Cache_Lite($options);
$cache->clean(OX_getHostName() . 'stats');
}
}
$addUrl = "entity=conversions&clientid={$clientId}&campaignid={$campaignId}&bannerid={$bannerId}&affiliateid={$affiliateId}&zoneid={$zoneId}";
if (!empty($period_preset)) {
$addUrl .= "&period_preset={$period_preset}&period_start={$period_start}&period_end={$period_end}";
}
if (!empty($day)) {
$addUrl .= "&day={$day}";
}
if (!empty($howLong)) {
$addUrl .= "&howLong={$howLong}";
}
if (!empty($hour)) {
$addUrl .= "&hour={$hour}";
}
示例9: write_sim_ini_file
function write_sim_ini_file($confAll)
{
if (array_key_exists('realConfig', $_REQUEST)) {
$conf['realConfig'] = $_REQUEST['realConfig'];
} else {
if (array_key_exists('realConfig', $confAll)) {
$conf['realConfig'] = $confAll['realConfig'];
}
}
if (array_key_exists('simdb', $_REQUEST)) {
$conf['simdb'] = $_REQUEST['simdb'];
} else {
if (array_key_exists('simdb', $confAll)) {
$conf['simdb'] = $confAll['simdb'];
}
}
if (array_key_exists('scenario', $_REQUEST)) {
$conf['scenario'] = $_REQUEST['scenario'];
} else {
if (array_key_exists('scenario', $confAll)) {
$conf['scenario'] = $confAll['scenario'];
}
}
if (array_key_exists('request', $_REQUEST)) {
$conf['request'] = $_REQUEST['request'];
} else {
if (array_key_exists('request', $confAll)) {
$conf['request'] = $confAll['request'];
}
}
if (array_key_exists('delivery', $_REQUEST)) {
$conf['delivery'] = $_REQUEST['delivery'];
} else {
if (array_key_exists('delivery', $confAll)) {
$conf['delivery'] = $confAll['delivery'];
}
}
if (array_key_exists('delivery', $_REQUEST)) {
$conf['logging'] = $_REQUEST['logging'];
} else {
if (array_key_exists('logging', $confAll)) {
$conf['logging'] = $confAll['logging'];
}
}
$content = '';
if (isset($conf['realConfig'])) {
if ($conf['realConfig']) {
$content .= "realConfig = \"{$conf['realConfig']}\"\n";
}
unset($conf['realConfig']);
}
require_once MAX_PATH . '/lib/max/other/common.php';
$conf = MAX_commonSlashArray($conf);
$content = parse_conf_for_ini_file($conf, $content, true);
if ($handle = fopen(MAX_PATH . '/var/' . OX_getHostName() . '.conf.php', 'w')) {
fwrite($handle, $content);
fclose($handle);
}
return get_conf();
}
示例10: define
if (isset($GLOBALS['_MAX']['FILES'][$file])) {
return;
}
###END_STRIP_DELIVERY
$GLOBALS['_MAX']['FILES'][$file] = true;
/**
* Constant used for permanent caching
*
*/
define('OA_DELIVERY_CACHE_FUNCTION_ERROR', 'Function call returned an error');
/**
* Global variable to keep cache informations
*
* @var array
*/
$GLOBALS['OA_Delivery_Cache'] = array('prefix' => 'deliverycache_', 'host' => OX_getHostName(), 'expiry' => $GLOBALS['_MAX']['CONF']['delivery']['cacheExpire']);
/**
* A function to fetch a cache entry.
*
* @param string $name The cache entry name
* @param bool $isHash Is $name a hash already or should hash be created from it?
* @param bool $expiryTime If null uses default expiry time (from config) but
* Determine how long cache is valid
* @return mixed False on error, or the cache content as a string
*/
function OA_Delivery_Cache_fetch($name, $isHash = false, $expiryTime = null)
{
$filename = OA_Delivery_Cache_buildFileName($name, $isHash);
$aCacheVar = OX_Delivery_Common_hook('cacheRetrieve', array($filename), $GLOBALS['_MAX']['CONF']['delivery']['cacheStorePlugin']);
if ($aCacheVar !== false) {
if ($aCacheVar['cache_name'] != $name) {
示例11: getConfigFilename
static function getConfigFilename()
{
if (isset($_SERVER['SERVER_NAME'])) {
// If test runs from web-client first check if host test config exists
// This could be used to have different tests for different configurations
$host = OX_getHostName();
$testFilePath = MAX_PATH . '/var/' . $host . '.test.conf.php';
if (file_exists($testFilePath)) {
return $testFilePath;
}
}
// Look into default location
$testFilePath = MAX_PATH . '/var/test.conf.php';
if (file_exists($testFilePath)) {
return $testFilePath;
}
}
示例12: fromCache
function fromCache()
{
// parse variable args
// method, id, timeout
// method, aParams, allFields, key, timeout
$numArgs = func_num_args();
if ($numArgs < 2 || $numArgs > 5) {
return PEAR::raiseError('incorrect args passed');
}
$aArgs = func_get_args();
// initialise cache object
$conf = $GLOBALS['_MAX']['CONF'];
require_once 'Cache/Lite/Function.php';
// manually determine timeout required to instantiate cache object
switch ($numArgs) {
case 3:
$timeout = $aArgs[2];
break;
case 5:
$timeout = $aArgs[4];
break;
default:
$timeout = null;
}
$method = $aArgs[0];
$options = array('cacheDir' => MAX_CACHE, 'lifeTime' => isset($timeout) ? $timeout : $conf['delivery']['cacheExpire']);
// check if this method has defined different cache group
$cacheGroups = $GLOBALS['_MAX']['Admin_DA']['cacheGroups'];
// Note: if you change this key, also change the key when clearing the cache in connections-modify.php
$options['defaultGroup'] = OX_getHostName();
if (isset($cacheGroups[$method])) {
$options['defaultGroup'] .= $cacheGroups[$method];
}
$cache = new Cache_Lite_Function($options);
switch ($numArgs) {
case 2:
case 3:
$id = $aArgs[1];
$timeout = @$aArgs[2];
// timeout may not be supplied
// catch stats case
if (is_array($aArgs[1])) {
$aParams = $aArgs[1];
$allFields = isset($aArgs[2]) ? $aArgs[2] : false;
$ret = $cache->call("Admin_DA::" . $method, $aParams, $allFields);
} else {
$ret = $cache->call("Admin_DA::" . $method, $id);
}
break;
case 4:
case 5:
$aParams = $aArgs[1];
$allFields = $aArgs[2];
$key = @$aArgs[3];
$timeout = @$aArgs[4];
$ret = $cache->call("Admin_DA::" . $method, $aParams, $allFields, $key);
break;
default:
return PEAR::raiseError('incorrect args passed');
}
return $ret;
}
示例13: OX_Delivery_Common_getFunctionFromComponentIdentifier
function OX_Delivery_Common_getFunctionFromComponentIdentifier($identifier, $hook = null)
{
$aInfo = explode(':', $identifier);
$functionName = 'Plugin_' . implode('_', $aInfo) . '_Delivery' . (!empty($hook) ? '_' . $hook : '');
if (!function_exists($functionName)) {
if (!empty($GLOBALS['_MAX']['CONF']['pluginSettings']['useMergedFunctions'])) {
_includeDeliveryPluginFile('/var/cache/' . OX_getHostName() . '_mergedDeliveryFunctions.php');
}
if (!function_exists($functionName)) {
_includeDeliveryPluginFile($GLOBALS['_MAX']['CONF']['pluginPaths']['plugins'] . '/' . implode('/', $aInfo) . '.delivery.php');
if (!function_exists($functionName)) {
_includeDeliveryPluginFile('/lib/OX/Extension/' . $aInfo[0] . '/' . $aInfo[0] . 'Delivery.php');
$functionName = 'Plugin_' . $aInfo[0] . '_delivery';
if (!empty($hook) && function_exists($functionName . '_' . $hook)) {
$functionName .= '_' . $hook;
}
}
}
}
return $functionName;
}
示例14: guessWebpath
function guessWebpath()
{
$path = dirname($_SERVER['SCRIPT_NAME']);
if (preg_match('#/www/admin$#', $path)) {
// User has web root configured as Openads' root directory so can guess at all locations
$subpath = preg_replace('#/www/admin$#', '', $path);
$basepath = OX_getHostNameWithPort() . $subpath . '/www/';
$this->setValue('webpath', 'admin', $basepath . 'admin');
$this->setValue('webpath', 'delivery', $basepath . 'delivery');
$this->setValue('webpath', 'deliverySSL', $basepath . 'delivery');
$this->setValue('webpath', 'images', $basepath . 'images');
$this->setValue('webpath', 'imagesSSL', $basepath . 'images');
} else {
if (preg_match('#/admin$#', $path)) {
// User has web root configured as Openads' /www directory so can guess at all locations
$subpath = preg_replace('#/admin$#', '', $path);
$basepath = OX_getHostName() . $subpath . '';
$this->setValue('webpath', 'admin', $basepath . '/admin');
$this->setValue('webpath', 'delivery', $basepath . '/delivery');
$this->setValue('webpath', 'deliverySSL', $basepath . '/delivery');
$this->setValue('webpath', 'images', $basepath . '/images');
$this->setValue('webpath', 'imagesSSL', $basepath . '/images');
} else {
// User has web root configured as Openads' www/admin directory so can only guess the admin location
$this->setValue('webpath', 'admin', OX_getHostName());
$this->setValue('webpath', 'delivery', OX_getHostName());
$this->setValue('webpath', 'images', OX_getHostName());
$this->setValue('webpath', 'deliverySSL', OX_getHostName());
$this->setValue('webpath', 'imagesSSL', OX_getHostName());
}
}
}
示例15: createGeoTargetingConfiguration
function createGeoTargetingConfiguration($geotracking_type, $geotracking_location, $geotracking_stats)
{
$upgradeConfig = new OA_Upgrade_Config();
$host = OX_getHostName();
if (empty($geotracking_type) || $geotracking_type == 'ip2country') {
return $this->writeGeoPluginConfig('"none"', $geotracking_stats, $host);
} elseif ($geotracking_type == 'mod_geoip') {
return $this->writeGeoPluginConfig('ModGeoIP', $geotracking_stats, $host) && $this->writeGeoSpecificConfig('ModGeoIP', '', $host);
} elseif ($geotracking_type == 'geoip') {
$databaseSetting = $this->getDatabaseSetting($geotracking_location);
if ($databaseSetting === false) {
$this->_logError('Unable to configure geoip');
return $this->writeGeoPluginConfig('"none"', $geotracking_stats, $host);
}
$result = $this->writeGeoPluginConfig('GeoIP', $geotracking_stats, $host);
return $result && $this->writeGeoSpecificConfig('GeoIP', $databaseSetting, $host);
}
return false;
}