/** * @package MaxDelivery * @subpackage image * * This library defines functions that need to be available to * the ai delivery script * */ function MAX_imageServe($aCreative, $filename, $contenttype) { // Check if the browser sent a If-Modified-Since header and if the image was // modified since that date if (!isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) || $aCreative['t_stamp'] > strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])) { MAX_header("Last-Modified: " . gmdate('D, d M Y H:i:s', $aCreative['t_stamp']) . ' GMT'); if (isset($contenttype) && $contenttype != '') { switch ($contenttype) { case 'swf': MAX_header('Content-type: application/x-shockwave-flash; name=' . $filename); break; case 'dcr': MAX_header('Content-type: application/x-director; name=' . $filename); break; case 'rpm': MAX_header('Content-type: audio/x-pn-realaudio-plugin; name=' . $filename); break; case 'mov': MAX_header('Content-type: video/quicktime; name=' . $filename); break; default: MAX_header('Content-type: image/' . $contenttype . '; name=' . $filename); break; } } echo $aCreative['contents']; } else { // Send "Not Modified" status header MAX_sendStatusCode(304); } }
function MAX_sendStatusCode($iStatusCode) { $aConf = $GLOBALS['_MAX']['CONF']; $arr = array(100 => 'Continue', 101 => 'Switching Protocols', 200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', 300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 306 => '[Unused]', 307 => 'Temporary Redirect', 400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', 406 => 'Not Acceptable', 407 => 'Proxy Authentication Required', 408 => 'Request Timeout', 409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Long', 415 => 'Unsupported Media Type', 416 => 'Requested Range Not Satisfiable', 417 => 'Expectation Failed', 500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Timeout', 505 => 'HTTP Version Not Supported'); if (isset($arr[$iStatusCode])) { $text = $iStatusCode . ' ' . $arr[$iStatusCode]; if (!empty($aConf['delivery']['cgiForceStatusHeader']) && strpos(php_sapi_name(), 'cgi') !== 0) { MAX_header('Status: ' . $text); } else { MAX_header($_SERVER["SERVER_PROTOCOL"] . ' ' . $text); } } }
function MAX_sendStatusCode($iStatusCode) { $aConf = $GLOBALS['_MAX']['CONF']; $arr = array(100 => 'Continue', 101 => 'Switching Protocols', 200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', 300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 306 => '[Unused]', 307 => 'Temporary Redirect', 400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', 406 => 'Not Acceptable', 407 => 'Proxy Authentication Required', 408 => 'Request Timeout', 409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Long', 415 => 'Unsupported Media Type', 416 => 'Requested Range Not Satisfiable', 417 => 'Expectation Failed', 500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Timeout', 505 => 'HTTP Version Not Supported'); if (isset($arr[$iStatusCode])) { $text = $iStatusCode . ' ' . $arr[$iStatusCode]; // Using header('Status: foo') with CGI sapis appears to be deprecated but PHP-CGI seems to discard // the Reason-Phrase and some webservers do not add a default one. Some bad spiders do not cope // with that, that's why we added the cgiForceStatusHeader confgiuration directive. If enabled // with CGI sapis, OpenX will use a "Status: NNN Reason" header, which seems to fix the behaviour // on the tested webserver (Apache 1.3, running php-cgi) if (!empty($aConf['delivery']['cgiForceStatusHeader']) && strpos(php_sapi_name(), 'cgi') !== 0) { MAX_header('Status: ' . $text); } else { MAX_header($_SERVER["SERVER_PROTOCOL"] . ' ' . $text); } } }
/** * Send the appropriate P3P headers to attempt to permit 3rd party cookies * */ function MAX_cookieSendP3PHeaders() { // Send P3P headers if ($GLOBALS['_MAX']['CONF']['p3p']['policies']) { MAX_header("P3P: " . _generateP3PHeader()); } }
/** * Starts or continue existing session * * @param unknown_type $checkRedirectFunc */ function OA_Start($checkRedirectFunc = null) { $conf = $GLOBALS['_MAX']['CONF']; global $session; // Send no cache headers MAX_header('Pragma: no-cache'); MAX_header('Cache-Control: no-cache, no-store, must-revalidate'); MAX_header('Expires: 0'); if (RV_INSTALLATION_STATUS == RV_INSTALLATION_STATUS_INSTALLED) { phpAds_SessionDataFetch(); } if (!OA_Auth::isLoggedIn() || OA_Auth::suppliedCredentials()) { // Required files include_once MAX_PATH . '/lib/max/language/Loader.php'; // Load the required language files Language_Loader::load('default'); phpAds_SessionDataRegister(OA_Auth::login($checkRedirectFunc)); $aPlugins = OX_Component::getListOfRegisteredComponentsForHook('afterLogin'); foreach ($aPlugins as $i => $id) { if ($obj = OX_Component::factoryByComponentIdentifier($id)) { $obj->afterLogin(); } } } // Overwrite certain preset preferences if (!empty($session['language']) && $session['language'] != $GLOBALS['pref']['language']) { $GLOBALS['_MAX']['CONF']['max']['language'] = $session['language']; } // Check if manual account switch has happened and migrate to new global variable if (isset($session['accountSwitch'])) { $GLOBALS['_OX']['accountSwtich'] = $session['accountSwitch']; unset($session['accountSwitch']); phpAds_SessionDataStore(); } }
<?php /** * apStatsGraphs for the OpenX ad server (Free Version). * * @author Matteo Beccati * @copyright 2009 AdserverPlugins.com * @license http://creativecommons.org/licenses/by-nd/3.0/ * * $Id$ */ // Prepare the OpenX environment via standard external OpenX scripts require_once '../../../../init.php'; require_once '../../config.php'; require_once './lib/apGraph.php'; // Limit access to logged in users OA_Permission::enforceAccount(OA_ACCOUNT_ADMIN, OA_ACCOUNT_MANAGER, OA_ACCOUNT_ADVERTISER, OA_ACCOUNT_TRAFFICKER); // Custom no cache - OFC seems to have issues with the standard OpenX headers MAX_header('Cache-Control: private, max-age=0, no-store'); MAX_header('Expires: ' . date('r')); $oGraph = AP_Graph::factory($_GET); $oGraph->displayGraph();
<?php /* +---------------------------------------------------------------------------+ | Revive Adserver | | http://www.revive-adserver.com | | | | Copyright: See the COPYRIGHT.txt file. | | License: GPLv2 or later, see the LICENSE.txt file. | +---------------------------------------------------------------------------+ */ // Require the initialisation file require_once '../../init-delivery.php'; // Required files require_once MAX_PATH . '/lib/max/Delivery/cache.php'; // Get JS $output = MAX_cacheGetGoogleJavaScript(); // Output JS MAX_commonSendContentTypeHeader("application/x-javascript"); MAX_header("Expires: " . gmdate('r', time() + 86400)); echo $output;