/** * Test1: return unsecure URL * Test2: return secure URL * A function to generate the URL for delivery scripts without a protocol. * * @param string $file The file name of the delivery script. * @param boolean $ssl Use the SSL delivery path (true) or not. Default is false. * @return string The parital URL to the delivery script (i.e. without * an 'http:' or 'https:' prefix). */ function test_MAX_commonConstructPartialDeliveryUrl() { $this->sendMessage('test_MAX_commonConstructPartialDeliveryUrl'); $GLOBALS['_MAX']['CONF']['webpath']['deliverySSL'] = 'secure.maxstore.net/www/delivery'; $GLOBALS['_MAX']['CONF']['webpath']['delivery'] = 'www.maxstore.net/www/delivery'; $file = 'test.html'; // Test1 $ret = MAX_commonConstructPartialDeliveryUrl($file, false); $this->assertEqual($ret, '//www.maxstore.net/www/delivery/test.html'); // Test2 $ret = MAX_commonConstructPartialDeliveryUrl($file, true); $this->assertEqual($ret, '//secure.maxstore.net/www/delivery/test.html'); }
function generateLayerCode(&$mi) { $conf = $GLOBALS['_MAX']['CONF']; global $align, $valign, $closetime, $padding; global $shifth, $shiftv, $closebutton; global $backcolor, $bordercolor; global $nobg, $noborder; $mi->parameters[] = 'layerstyle=simple'; $mi->parameters[] = 'align=' . (isset($align) ? $align : 'right'); $mi->parameters[] = 'valign=' . (isset($valign) ? $valign : 'top'); $mi->parameters[] = 'padding=' . (isset($padding) ? (int) $padding : '2'); if (!empty($mi->charset)) { $mi->parameters[] = 'charset=' . urlencode($mi->charset); } if (isset($closetime) && $closetime > 0) { $mi->parameters[] = 'closetime=' . $closetime; } if (isset($padding)) { $mi->parameters[] = 'padding=' . $padding; } if (isset($shifth)) { $mi->parameters[] = 'shifth=' . $shifth; } if (isset($shiftv)) { $mi->parameters[] = 'shiftv=' . $shiftv; } if (isset($closebutton)) { $mi->parameters[] = 'closebutton=' . $closebutton; } if (isset($backcolor)) { $mi->parameters[] = 'backcolor=' . substr($backcolor, 1); } if (isset($bordercolor)) { $mi->parameters[] = 'bordercolor=' . substr($bordercolor, 1); } if (isset($nobg)) { $mi->parameters[] = 'nobg=' . $nobg; } if (isset($noborder)) { $mi->parameters[] = 'noborder=' . $noborder; } $scriptUrl = "http:" . MAX_commonConstructPartialDeliveryUrl($conf['file']['layer']); if (sizeof($mi->parameters) > 0) { $scriptUrl .= "?" . implode("&", $mi->parameters); } $buffer = "<script type='text/javascript'><!--//<![CDATA[\n var ox_u = '{$scriptUrl}';\n if (document.context) ox_u += '&context=' + escape(document.context);\n document.write(\"<scr\"+\"ipt type='text/javascript' src='\" + ox_u + \"'></scr\"+\"ipt>\");\n//]]>--></script>"; return $buffer; }
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | GNU General Public License for more details. | | | | You should have received a copy of the GNU General Public License | | along with this program; if not, write to the Free Software | | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | +---------------------------------------------------------------------------+ $Id: banner-htmlpreview.php 37157 2009-05-28 12:31:10Z andrew.hill $ */ // Require the initialisation file require_once '../../init.php'; // Required files require_once MAX_PATH . '/www/admin/config.php'; require_once MAX_PATH . '/www/admin/lib-statistics.inc.php'; require_once MAX_PATH . '/lib/max/Delivery/adRender.php'; require_once MAX_PATH . '/lib/max/Admin_DA.php'; /*-------------------------------------------------------*/ /* Main code */ /*-------------------------------------------------------*/ $aBanner = Admin_DA::getAd($bannerid); $aBanner['bannerid'] = $aBanner['ad_id']; if (!empty($aBanner)) { $conf = $GLOBALS['_MAX']['CONF']; $bannerName = strip_tags(phpAds_buildBannerName($bannerid, $aBanner['name'], $aBanner['alt'])); $sizeDescription = $aBanner['type'] == 'txt' ? ' ' : " width: {$aBanner['width']} height: {$aBanner['height']}"; $bannerCode = MAX_adRender($aBanner, 0, '', '', '', true, '', false, false); $protocol = $_SERVER['SERVER_PORT'] == $conf['openads']['sslPort'] ? "https" : "http"; $deliveryUrl = $protocol . ':' . MAX_commonConstructPartialDeliveryUrl($conf['file']['flash']); echo "\n<html>\n<head>\n<title>{$bannerName}</title>\n<link rel='stylesheet' href='" . OX::assetPath() . "/css/interface-{$phpAds_TextDirection}.css'>\n<script type='text/javascript' src='{$deliveryUrl}'></script>\n</head>\n<body marginheight='0' marginwidth='0' leftmargin='0' topmargin='0' bgcolor='#EFEFEF'>\n<table cellpadding='0' cellspacing='0' border='0'>\n<tr height='32'>\n <td width='32'><img src='" . OX::assetPath() . "/images/cropmark-tl.gif' width='32' height='32'></td>\n <td background='" . OX::assetPath() . "/images/ruler-top.gif'> </td>\n <td width='32'><img src='" . OX::assetPath() . "/images/cropmark-tr.gif' width='32' height='32'></td>\n</tr>\n<tr height='{$aBanner['height']}'>\n <td width='32' background='" . OX::assetPath() . "/images/ruler-left.gif'> </td>\n <td bgcolor='#FFFFFF' width='{$aBanner['width']}'>\n {$bannerCode}\n </td>\n <td width='32'> </td>\n</tr>\n<tr height='32'>\n <td width='32'><img src='" . OX::assetPath() . "/images/cropmark-bl.gif' width='32' height='32'></td>\n <td>{$sizeDescription}</td>\n <td width='32'><img src='" . OX::assetPath() . "/images/cropmark-br.gif' width='32' height='32'></td>\n</tr>\n</table>\n</body>\n</html>"; }
/** * Return invocation code for this plugin (codetype) * * @return string */ function generateInvocationCode() { $aComments = array('SSL Delivery Comment' => '', 'Comment' => $this->translate("\n * This noscript section of this tag only shows image banners. There\n * is no width or height in these banners, so if you want these tags to\n * allocate space for the ad before it shows, you will need to add this\n * information to the <img> tag.\n *\n * If you do not want to deal with the intricities of the noscript\n * section, delete the tag (from <noscript>... to </noscript>). On\n * average, the noscript tag is called from less than 1% of internet\n * users.")); parent::prepareCommonInvocationData($aComments); $conf = $GLOBALS['_MAX']['CONF']; $mi =& $this->maxInvocation; $buffer = $mi->buffer; if (isset($mi->withtext) && $mi->withtext != '0') { $mi->parameters['withtext'] = "withtext=1"; } if (isset($mi->block) && $mi->block == '1') { $mi->parameters['block'] = "block=1"; } if (isset($mi->blockcampaign) && $mi->blockcampaign == '1') { $mi->parameters['blockcampaign'] = "blockcampaign=1"; } if (!empty($mi->campaignid)) { $mi->parameters['campaignid'] = "campaignid=" . $mi->campaignid; } // The cachebuster for JS tags is auto-generated unset($mi->parameters['cb']); $buffer .= "<script type='text/javascript'><!--//<![CDATA[\n"; // Support for 3rd party server clicktracking if (!empty($mi->thirdpartytrack)) { // Don't pass this in as a parameter... it is dealt with seperatly unset($mi->parameters['ct0']); $buffer .= " document.MAX_ct0 = unescape('{$mi->macros['clickurl']}');\n\n"; } $buffer .= " var m3_u = (location.protocol=='https:'?'https:" . MAX_commonConstructPartialDeliveryUrl($conf['file']['js'], true) . "':'http:" . MAX_commonConstructPartialDeliveryUrl($conf['file']['js']) . "');\n"; $buffer .= " var m3_r = Math.floor(Math.random()*99999999999);\n"; $buffer .= " if (!document.MAX_used) document.MAX_used = ',';\n"; // Removed the non-XHTML compliant "language='JavaScript' $buffer .= " document.write (\"<scr\"+\"ipt type='text/javascript' src='\"+m3_u);\n"; if (count($mi->parameters) > 0) { $buffer .= " document.write (\"?" . implode("&", $mi->parameters) . "\");\n"; } $buffer .= " document.write ('&cb=' + m3_r);\n"; // Don't pass in exclude unless necessary $buffer .= " if (document.MAX_used != ',') document.write (\"&exclude=\" + document.MAX_used);\n"; if (empty($mi->charset)) { $buffer .= " document.write (document.charset ? '&charset='+document.charset : (document.characterSet ? '&charset='+document.characterSet : ''));\n"; } else { $buffer .= " document.write ('&charset=" . $mi->charset . "');\n"; } $buffer .= " document.write (\"&loc=\" + escape(window.location));\n"; $buffer .= " if (document.referrer) document.write (\"&referer=\" + escape(document.referrer));\n"; $buffer .= " if (document.context) document.write (\"&context=\" + escape(document.context));\n"; // Only pass in the 3rd party click URL if it is required and (probably) a valid URL (i.e. not a macro like '%c') if (!empty($mi->thirdpartytrack)) { $buffer .= " if ((typeof(document.MAX_ct0) != 'undefined') && (document.MAX_ct0.substring(0,4) == 'http')) {\n"; $buffer .= " document.write (\"&ct0=\" + escape(document.MAX_ct0));\n }\n"; } // Pass in if the FlashObject - Inline code has already been passed in $buffer .= " if (document.mmm_fo) document.write (\"&mmm_fo=1\");\n"; $buffer .= " document.write (\"'><\\/scr\"+\"ipt>\");\n"; $buffer .= "//]]>--></script>"; if ($mi->extra['delivery'] != phpAds_ZoneText) { $buffer .= "<noscript>{$mi->backupImage}</noscript>\n"; } return $buffer; }
function generateJavascriptTrackerCode($trackerId) { $conf = $GLOBALS['_MAX']['CONF']; $variablemethod = 'default'; $trackers = Admin_DA::getTrackers(array('tracker_id' => $trackerId), true); if (count($trackers)) { $variablemethod = $trackers[$trackerId]['variablemethod']; } $variables = Admin_DA::getVariables(array('trackerid' => $trackerId), true); $variablesQuerystring = ''; $buffer = "<!--/*\n *\n * OpenX JavaScript tracker code\n * - Generated with OpenX v" . OA_VERSION . "\n *\n * To help prevent caching of the <noscript> beacon, if possible,\n * Replace %%RANDOM_NUMBER%% with a randomly generated number (or timestamp)\n *\n */-->\n"; $varbuffer = ''; if (!empty($variables)) { foreach ($variables as $id => $variable) { if (($variablemethod == 'default' || $variablemethod == 'js') && $variable['variablecode']) { $varcode = stripslashes($variable['variablecode']); $varbuffer .= " {$varcode};\n"; } $variablesQuerystring .= "&{$variable['name']}=%%" . strtoupper($variable['name']) . "_VALUE%%"; } } if (!empty($varbuffer)) { $varprefix = $conf['var']['prefix']; $buffer .= "\n<!--/*\n *\n * In order for the adserver to track variables for this conversion,\n * they must be provided by the client.\n *\n * Additional variables may be added, however they must be added\n * in the adserver as well before they will be logged.\n *\n * The '%%VARIABLE_VALUE%%' should be replaced with the\n * actual values for this sale.\n *\n * NOTE: In order to track variables from the <noscript> section,\n * the above replacement must be performed within the img tag as well.\n *\n * The following values have been pre-configured in the adserver\n *\n */-->\n\n<script type='text/javascript'><!--//<![CDATA[\n"; $buffer .= $varbuffer; $buffer .= "//]]>--></script>\n"; } $buffer .= "\n<!--/*\n *\n * Place this code at the top of your thank-you page, just after the <body> tag,\n * below any definitions of Javascript variables that need to be tracked.\n *\n */-->\n\n<script type='text/javascript'><!--//<![CDATA[\n var {$varprefix}p=location.protocol=='https:'?'https:':'http:';\n var {$varprefix}r=Math.floor(Math.random()*999999);\n document.write (\"<\" + \"script language='JavaScript' \");\n document.write (\"type='text/javascript' src='\"+{$varprefix}p);\n document.write (\"" . MAX_commonConstructPartialDeliveryUrl($conf['file']['conversionjs']) . "\");\n document.write (\"?trackerid={$trackerId}&r=\"+{$varprefix}r+\"'><\" + \"\\/script>\");\n//]]>--></script><noscript>" . $this->_generateTrackerImageBeacon($trackerId) . "</noscript>"; $buffer .= "\n"; return $buffer; }
/** * Return invocation code for this plugin (codetype) * * @return string */ function generateInvocationCode() { $aComments = array('SSL Backup Comment' => "", 'SSL Delivery Comment' => "", 'Comment' => ""); parent::prepareCommonInvocationData($aComments); $conf = $GLOBALS['_MAX']['CONF']; $mi =& $this->maxInvocation; $buffer = $mi->buffer; if (isset($mi->block) && $mi->block == '1') { $mi->parameters['block'] = "block=1"; } if (isset($mi->blockcampaign) && $mi->blockcampaign == '1') { $mi->parameters['blockcampaign'] = "blockcampaign=1"; } // The cachebuster for async tags isn't needed unset($mi->parameters['cb']); // Add ID $mi->parameters['id'] = 'id=' . md5("{$conf['webpath']['delivery']}*{$conf['webpath']['deliverySSL']}"); // Remap as tag attributes with data-revive prefix $mi->parameters = array_map(function ($v) use($conf) { return preg_replace('#^(.*)=(.*)$#', 'data-' . $conf['var']['product'] . '-$1="$2"', $v); }, $mi->parameters); $buffer .= '<ins ' . join(' ', $mi->parameters) . '></ins>' . PHP_EOL; if ($conf['webpath']['delivery'] == $conf['webpath']['deliverySSL']) { // Yes, we can use the short version! $buffer .= '<script async src="' . MAX_commonConstructPartialDeliveryUrl($conf['file']['asyncjs']) . '"></script>'; } else { // Bummer, we need the longer variant $url = array(MAX_commonConstructDeliveryUrl($conf['file']['asyncjs']), MAX_commonConstructSecureDeliveryUrl($conf['file']['asyncjs'])); $buffer .= <<<EOF <script> (function () { var d = document, s = d.createElement('script'), p = d.location.protocol, i = d.getElementsByTagName('ins'), j = i[i.length-1]; try { s.src = p === 'http:' ? '{$url[0]}' : '{$url[1]}'; s.async = true; j.appendChild(s); } catch (e) {} })(); </script> EOF; } return $buffer; }
function generateLayerCode(&$mi) { $conf = $GLOBALS['_MAX']['CONF']; global $align, $collapsetime, $padding, $closetext; $mi->parameters[] = 'layerstyle=geocities'; $mi->parameters[] = 'align=' . (isset($align) ? $align : 'right'); $mi->parameters[] = 'padding=' . (isset($padding) ? (int) $padding : '2'); if (isset($closetext)) { $mi->parameters[] = 'closetext=' . urlencode($closetext); } if (!empty($mi->charset)) { $mi->parameters[] = 'charset=' . urlencode($mi->charset); } if (isset($collapsetime) && $collapsetime > 0) { $mi->parameters[] = 'collapsetime=' . $collapsetime; } $scriptUrl = "http:" . MAX_commonConstructPartialDeliveryUrl($conf['file']['layer']); if (sizeof($mi->parameters) > 0) { $scriptUrl .= "?" . implode("&", $mi->parameters); } $buffer = "<script type='text/javascript'><!--//<![CDATA[\n var ox_u = '{$scriptUrl}';\n if (document.context) ox_u += '&context=' + escape(document.context);\n document.write(\"<scr\"+\"ipt type='text/javascript' src='\" + ox_u + \"'></scr\"+\"ipt>\");\n//]]>--></script>"; return $buffer; }
function generateLayerCode(&$mi) { $conf = $GLOBALS['_MAX']['CONF']; global $ltr, $loop, $speed, $pause, $shiftv, $transparent, $backcolor; global $limited, $lmargin, $rmargin; if (!isset($limited)) { $limited = 'f'; } if ($limited == 't') { if (!isset($lmargin) || !isset($rmargin)) { $limited = 'f'; $lmargin = $rmargin = ''; } } if (!empty($mi->charset)) { $mi->parameters[] = 'charset=' . urlencode($mi->charset); } $mi->parameters[] = 'layerstyle=floater'; $mi->parameters[] = 'ltr=' . (isset($ltr) ? $ltr : 't'); $mi->parameters[] = 'loop=' . (isset($loop) ? $loop : 'n'); $mi->parameters[] = 'speed=' . (isset($speed) ? $speed : 3); $mi->parameters[] = 'pause=' . (isset($pause) ? $pause : 10); $mi->parameters[] = 'shiftv=' . (isset($shiftv) ? $shiftv : 0); $mi->parameters[] = 'transparent=' . (isset($transparent) ? $transparent : 't'); if (!isset($transparent)) { $transparent = 't'; } if (!isset($backcolor)) { $backcolor = '#FFFFFF'; } if ($transparent != 't') { $mi->parameters[] = 'backcolor=' . urlencode($backcolor); } $mi->parameters[] = 'limited=' . $limited; if ($limited == 't') { $mi->parameters[] = 'lmargin=' . $lmargin; $mi->parameters[] = 'rmargin=' . $rmargin; } $scriptUrl = "http:" . MAX_commonConstructPartialDeliveryUrl($conf['file']['layer']); if (sizeof($mi->parameters) > 0) { $scriptUrl .= "?" . implode("&", $mi->parameters); } $buffer = "<script type='text/javascript'><!--//<![CDATA[\n var ox_u = '{$scriptUrl}';\n if (document.context) ox_u += '&context=' + escape(document.context);\n document.write(\"<scr\"+\"ipt type='text/javascript' src='\" + ox_u + \"'></scr\"+\"ipt>\");\n//]]>--></script>"; return $buffer; }
function OA_SPCGetJavaScript($affiliateid) { $aConf = $GLOBALS['_MAX']['CONF']; $varprefix = $aConf['var']['prefix']; $aZones = OA_cacheGetPublisherZones($affiliateid); foreach ($aZones as $zoneid => $aZone) { $zones[$aZone['type']][] = " '" . addslashes($aZone['name']) . "' : {$zoneid}"; } $additionalParams = ''; $magic_quotes_gpc = ini_get('magic_quotes_gpc'); foreach ($_GET as $key => $value) { if ($key == 'id') { continue; } if ($magic_quotes_gpc) { $value = stripslashes($value); } $additionalParams .= htmlspecialchars('&' . urlencode($key) . '=' . urlencode($value), ENT_QUOTES); } $script = "\nif (typeof({$varprefix}zones) != 'undefined') {\nvar {$varprefix}zoneids = '';\nfor (var zonename in {$varprefix}zones) {$varprefix}zoneids += escape(zonename+'=' + {$varprefix}zones[zonename] + \"|\");\n{$varprefix}zoneids += '&nz=1';\n} else {\nvar {$varprefix}zoneids = escape('" . implode('|', array_keys($aZones)) . "');\n}\nif (typeof({$varprefix}source) == 'undefined') { {$varprefix}source = ''; }\nvar {$varprefix}p=location.protocol=='https:'?'https:':'http:';\nvar {$varprefix}r=Math.floor(Math.random()*99999999);\n{$varprefix}output = new Array();\nvar {$varprefix}spc=\"<\"+\"script type='text/javascript' \";\n{$varprefix}spc+=\"src='\"+{$varprefix}p+\"" . MAX_commonConstructPartialDeliveryUrl($aConf['file']['singlepagecall']) . "?zones=\"+{$varprefix}zoneids;\n{$varprefix}spc+=\"&source=\"+escape({$varprefix}source)+\"&r=\"+{$varprefix}r;" . (!empty($additionalParams) ? "\n {$varprefix}spc+=\"{$additionalParams}\";" : '') . "\n"; if (empty($_GET['charset'])) { $script .= "{$varprefix}spc+=(document.charset ? '&charset='+document.charset : (document.characterSet ? '&charset='+document.characterSet : ''));\n"; } $script .= "\nif (window.location) {$varprefix}spc+=\"&loc=\"+escape(window.location);\nif (document.referrer) {$varprefix}spc+=\"&referer=\"+escape(document.referrer);\n{$varprefix}spc+=\"'><\"+\"/script>\";\ndocument.write({$varprefix}spc);\nfunction {$varprefix}show(name) {\nif (typeof({$varprefix}output[name]) == 'undefined') {\nreturn;\n} else {\ndocument.write({$varprefix}output[name]);\n}\n}\nfunction {$varprefix}showpop(name) {\nzones = window.{$varprefix}zones ? window.{$varprefix}zones : false;\nvar zoneid = name;\nif (typeof(window.{$varprefix}zones) != 'undefined') {\nif (typeof(zones[name]) == 'undefined') {\nreturn;\n}\nzoneid = zones[name];\n}\nvar {$varprefix}pop=\"<\"+\"script type='text/javascript' \";\n{$varprefix}pop+=\"src='\"+{$varprefix}p+\"" . MAX_commonConstructPartialDeliveryUrl($aConf['file']['popup']) . "?zoneid=\"+zoneid;\n{$varprefix}pop+=\"&source=\"+escape({$varprefix}source)+\"&r=\"+{$varprefix}r;" . (!empty($additionalParams) ? "\n {$varprefix}spc+=\"{$additionalParams}\";" : '') . "\nif (window.location) {$varprefix}pop+=\"&loc=\"+escape(window.location);\nif (document.referrer) {$varprefix}pop+=\"&referer=\"+escape(document.referrer);\n{$varprefix}pop+=\"'><\"+\"/script>\";\ndocument.write({$varprefix}pop);\n}\n"; // Add the FlashObject include to the SPC output $script .= MAX_javascriptToHTML(MAX_flashGetFlashObjectExternal(), $varprefix . 'fo'); return $script; }
function generateLayerCode(&$mi) { $conf = $GLOBALS['_MAX']['CONF']; global $stickyness, $offsetx, $offsety, $hide, $transparancy, $delay, $trail; $mi->parameters[] = 'layerstyle=cursor'; $mi->parameters[] = 'hide=' . $hide; $mi->parameters[] = 'trail=' . $trail; $mi->parameters[] = 'offsetx=' . $offsetx; $mi->parameters[] = 'offsety=' . $offsety; if (!empty($mi->charset)) { $mi->parameters[] = 'charset=' . urlencode($mi->charset); } if ($trail == '1') { $mi->parameters[] = 'stickyness=' . $stickyness; } if ($hide == '1') { $mi->parameters[] = 'transparancy=' . $transparancy; $mi->parameters[] = 'delay=' . $delay; } $scriptUrl = "http:" . MAX_commonConstructPartialDeliveryUrl($conf['file']['layer']); if (sizeof($mi->parameters) > 0) { $scriptUrl .= "?" . implode("&", $mi->parameters); } $buffer = "<script type='text/javascript'><!--//<![CDATA[\n var ox_u = '{$scriptUrl}';\n if (document.context) ox_u += '&context=' + escape(document.context);\n document.write(\"<scr\"+\"ipt type='text/javascript' src='\" + ox_u + \"'></scr\"+\"ipt>\");\n//]]>--></script>"; return $buffer; }