function show_map($BID = 1) { if (!is_numeric($BID)) { die; } if (BANNER_DIR == 'BANNER_DIR') { $BANNER_DIR = "banners/"; } else { $BANNER_DIR = BANNER_DIR; } $p = explode("/", SERVER_PATH_TO_ADMIN); array_pop($p); array_pop($p); $BANNER_PATH = implode("/", $p); $BANNER_PATH .= "/" . $BANNER_DIR; $sql = "SELECT grid_width,grid_height, block_width, block_height, bgcolor, time_stamp FROM banners WHERE (banner_id = '{$BID}')"; $result = mysql_query($sql) or die(mysql_error() . $sql); $b_row = mysql_fetch_array($result); if (!$b_row['block_width']) { $b_row['block_width'] = 10; } if (!$b_row['block_height']) { $b_row['block_height'] = 10; } /* Cache controls: We have to make sure that this html page is cashed by the browser. If the banner was not modified, then send out a HTTP/1.0 304 Not Modified and exit otherwise output the HTML to the browser. */ if (MDS_AGRESSIVE_CACHE == 'YES') { header('Cache-Control: public, must-revalidate'); // cache all requests, browsers must respect this php script $if_modified_since = preg_replace('/;.*$/', '', $_SERVER['HTTP_IF_MODIFIED_SINCE']); $gmdate_mod = gmdate('D, d M Y H:i:s', $b_row['time_stamp']) . ' GMT'; if ($if_modified_since == $gmdate_mod) { header("HTTP/1.0 304 Not Modified"); exit; } header("Last-Modified: {$gmdate_mod}"); } ?> <head> <script language="JavaScript"> var h_padding=10; var v_padding=10; function is_right_available(box,e) { if ((box.clientWidth+e.clientX+h_padding)>=winWidth){ return false; // not available } return true; } function is_top_available(box,e) { if ((e.clientY-box.clientHeight-v_padding) < 0){ return false; } return true; } function is_bot_available(box,e) { if ((e.clientY+box.clientHeight+v_padding) > winHeight){ return false; } return true; } function is_left_available(box,e) { if ((e.clientX-box.clientWidth-h_padding)<0){ return false; } return true; } function boxFinishedMoving(box) { var y=box.offsetTop; var x=box.offsetLeft; //window.status="x:"+x+" y:"+y+" box.ypos:"+box.ypos+" box.xpos:"+box.xpos; if ((y<box.ypos)||(y>box.ypos)||(x<box.xpos)||(x>box.xpos)) { return false; } else { return true; } } function moveBox() { var box = document.getElementById('bubble'); var y=box.offsetTop; var x=box.offsetLeft; var diffx; var diffy; diffx = Math.abs(x-box.xpos); diffy = Math.abs(y-box.ypos); if (!boxFinishedMoving(box)) { if (y<box.ypos){ y+=Math.round(diffy*(0.01))+1; // calculate acceleration box.style.top = y; } if (y>box.ypos) { y-=Math.round(diffy*(0.01))+1; box.style.top = y; } if (x<box.xpos) { x+=Math.round(diffx*(0.01))+1; box.style.left = x; } if (x>box.xpos){ x-=Math.round(diffx*(0.01))+1; ; box.style.left = x; } window.setTimeout("moveBox()", <?php if (!is_numeric(ANIMATION_SPEED)) { echo '10'; } else { echo ANIMATION_SPEED; } ?> ); } } /////////////// // This function is used for the instant pop-up box function moveBox2() { var box = document.getElementById('bubble'); var y=box.offsetTop; var x=box.offsetLeft; var diffx; var diffy; diffx = Math.abs(x-box.xpos); diffy = Math.abs(y-box.ypos); if (!boxFinishedMoving(box)) { if (y<box.ypos) { y=y+diffy; box.style.top = y; } if (y>box.ypos) { y=y-diffy; box.style.top = y; } if (x<box.xpos) { x=x+diffx; box.style.left = x; } if (x>box.xpos) { x=x-diffx; box.style.left = x; } window.setTimeout("moveBox2()", <?php if (!is_numeric(ANIMATION_SPEED)) { echo '10'; } else { echo ANIMATION_SPEED; } ?> ); } } var winWidth=0; var winHeight=0; initFrameSize(); function initFrameSize() { // winWidth=<?php echo $b_row['grid_width'] * $b_row['block_width']; ?> ; winHeight=<?php echo $b_row['grid_height'] * $b_row['block_height']; ?> ; } var pos = 'right'; var strCache = new Array(); var lastStr; var trip_count = 0; function isBrowserCompatible() { // check if we can XMLHttpRequest var xmlhttp=false; /*@cc_on @*/ /*@if (@_jscript_version >= 5) // JScript gives us Conditional compilation, we can cope with old IE versions. // and security blocked creation of the objects. try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } @end @*/ if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp = new XMLHttpRequest(); } if (!xmlhttp) { return false } return true; } //////////////////// function fillAdContent(aid, bubble) { if (!isBrowserCompatible()) { return false; } // is the content cached? if (strCache[aid]) { bubble.innerHTML = strCache[aid]; return true; } ////////////////////////////////////////////////// // AJAX Magic. ////////////////////////////////////////////////// var xmlhttp=false; /*@cc_on @*/ /*@if (@_jscript_version >= 5) // JScript gives us Conditional compilation, we can cope with old IE versions. // and security blocked creation of the objects. try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } @end @*/ if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp = new XMLHttpRequest(); } xmlhttp.open("GET", "ga.php?AID="+aid+"<?php echo "&t=" . time(); ?> ", true); //alert("before trup_count:"+trip_count); if (trip_count != 0){ // trip_count: global variable counts how many times it goes to the server // waiting state... } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4) { // //alert(xmlhttp.responseText); if (xmlhttp.responseText.length > 0) { bubble.innerHTML = xmlhttp.responseText; strCache[''+aid] = xmlhttp.responseText } else { bubble.innerHTML = bubble.innerHTML.replace('<img src=\"<?php echo BASE_HTTP_PATH; ?> periods.gif\" border=\"0\">',''); } trip_count--; //document.getElementById('submit_button1').disabled=false; //document.getElementById('submit_button2').disabled=false; //var pointer = document.getElementById('block_pointer'); //pointer.style.cursor='pointer'; //var pixelimg = document.getElementById('pixelimg'); //pixelimg.style.cursor='pointer'; } } xmlhttp.send(null) } //////////////// function sB(e, str, area, aid) { var relTarg; var bubble = document.getElementById('bubble'); if (!e) var e = window.event; if (e.relatedTarget) relTarg = e.relatedTarget; else if (e.fromElement) relTarg = e.fromElement; b = bubble.style if ((lastStr!=str)) { lastStr=str; hideBubble(e); //window.status="x:"+x+" y:"+y+" box.ypos:"+box.ypos+" box.xpos:"+box.xpos; // window.status="e.clientX"+e.clientX+" e.clientY:"+e.clientY; //str=str+"hello: "+bubble.clientWidth; //b.filter="progid:DXImageTransform.Microsoft.Blinds(Duration=0.5)"; <?php if (ENABLE_TRANSITIONS == 'YES') { ?> if (bubble.filters) { bubble.filters[0].transition=<?php echo TRANSITION_EFFECT; ?> ; bubble.filters[0].duration=<?php echo TRANSITION_DURATION; ?> ; bubble.filters[0].Apply(); } <?php } ?> document.getElementById('content').innerHTML=str; trip_count++ fillAdContent(aid, document.getElementById('content')); <?php if (ENABLE_TRANSITIONS == 'YES') { ?> if (bubble.filters) { bubble.filters[0].Play(); } <?php } ?> //alert(document.getElementById('bubble').innerHTML); } var mytop = is_top_available(bubble,e); var mybot = is_bot_available(bubble, e); var myright = is_right_available(bubble,e); var myleft = is_left_available(bubble,e); //window.status="e.clientX"+e.clientX+" e.clientY:"+e.clientY+" mytop:"+mytop+" mybot:"+mybot+" myright:"+myright+" myleft:"+myleft+" | clientWidth:"+bubble.clientWidth+" clientHeight:"+bubble.clientHeight+" ww:"+winWidth+" wh:"+winHeight; if (mytop) { // move to the top //b.top=e.clientY-bubble.clientHeight-v_padding; bubble.ypos=e.clientY-bubble.clientHeight-v_padding; //alert(bubble.xpos); } if (myright) { // move to the right //b.left=e.clientX+h_padding;//+bubble.clientWidth; bubble.xpos=e.clientX+h_padding; } if (myleft) { // move to the left //b.left=e.clientX-bubble.clientWidth-h_padding ; bubble.xpos=e.clientX-bubble.clientWidth-h_padding ; } if (mybot) { // move to the bottom //b.top=e.clientY+v_padding; bubble.ypos=e.clientY+v_padding; } b.visibility='visible'; //ChangeBgd(bubble); <?php if (ENABLE_MOUSEOVER == 'POPUP') { ?> //bubble.style.top=e.clientY; //bubble.style.left=e.clientX; moveBox2() //moveBox(bubble); window.setTimeout("moveBox2()", <?php if (!is_numeric(ANIMATION_SPEED)) { echo '10'; } else { echo ANIMATION_SPEED; } ?> ); <?php } else { ?> moveBox() //moveBox(bubble); window.setTimeout("moveBox()", <?php if (!is_numeric(ANIMATION_SPEED)) { echo '10'; } else { echo ANIMATION_SPEED; } ?> ); <?php } ?> } function hBTimeout(e) { lastStr=''; hideBubble(e); } function hideBubble(e) { var bubble = document.getElementById('bubble'); b = bubble.style; <?php if (ENABLE_TRANSITIONS == 'YES') { ?> if (bubble.filters) { bubble.filters[0].transition=<?php echo TRANSITION_EFFECT; ?> ; bubble.filters[0].duration=<?php echo TRANSITION_DURATION; ?> ; bubble.filters[0].Apply(); } <?php } ?> b.visibility='hidden'; <?php if (ENABLE_TRANSITIONS == 'YES') { ?> if (bubble.filters) { bubble.filters[0].Play(); } <?php } ?> } var timeoutId=0; function hI() { if (timeoutId==0) { timeoutId = window.setTimeout('hBTimeout()', '<?php echo HIDE_TIMEOUT; ?> ') } } function cI() { if (timeoutId!=0) { window.clearTimeout(timeoutId); timeoutId=0; } } function po(block_id) { block_clicked=true; window.open('click.php?block_id=' + block_id + '&BID=<?php echo $BID; ?> ','',''); return false; } <?php if (REDIRECT_SWITCH == 'YES') { ?> p = parent.window; <?php } ?> var block_clicked=false; // did the user click a sold block? </script> </head> <body <?php if (DISPLAY_PIXEL_BACKGROUND == 'YES') { ?> bgcolor='<?php echo $b_row['bgcolor']; ?> ' background="<?php echo BASE_HTTP_PATH . $BANNER_DIR; ?> bg-main<?php echo $BID; ?> .gif" <?php } ?> > <?php include 'mouseover_box.htm'; // edit this file to change the style of the mouseover box! ?> <script language="JavaScript"> //document.getElementById('bubble').style.filer="progid:DXImageTransform.Microsoft.Iris(irisstyle='STAR',duration=4)"; </script> <?php $map_file = get_map_file_name($BID); if (!file_exists($map_file)) { process_map($BID, $map_file); } include_once $map_file; if (OUTPUT_JPEG == 'Y') { $ext = "jpg"; } elseif (OUTPUT_JPEG == 'N') { $ext = 'png'; } elseif (OUTPUT_JPEG == 'GIF') { $ext = 'gif'; } if (file_exists($BANNER_PATH . "main" . $BID . ".{$ext}")) { if (REDIRECT_SWITCH == 'YES') { $available_block_window = "parent.window.open('" . REDIRECT_URL . "', '', '');return false;"; } ?> <img <?php if (REDIRECT_SWITCH == 'YES') { ?> onclick="if (!block_clicked) {<?php echo $available_block_window; ?> }block_clicked=false;" <?php } ?> id="theimage" src="<?php echo $BANNER_DIR; ?> main<?php echo $BID; ?> .<?php echo $ext; ?> ?time=<?php echo $b_row['time_stamp']; ?> " width="<?php echo $b_row['grid_width'] * $b_row['block_width']; ?> " height="<?php echo $b_row['grid_height'] * $b_row['block_height']; ?> " border="0" usemap="#main" /><?php } else { echo "<b>The file: " . $BANNER_PATH . "main" . $BID . ".{$ext}" . " doesn't exist.</b><br>"; echo "<b>Please process your pixels from the Admin section (Look under 'Pixel Admin')</b>"; } ?> </body> <?php }
display_ad_form(1, $mode, ''); } else { insert_ad_data(true); // admin mode $prams = load_ad_values($_REQUEST['ad_id']); update_blocks_with_ad($_REQUEST['ad_id'], $prams['user_id']); display_ad_form(1, "edit", $prams); // disapprove the pixels because the ad was modified.. if (AUTO_APPROVE != 'Y') { // to be approved by the admin disapprove_modified_order($prams['order_id'], $BID); } if (AUTO_PUBLISH == 'Y') { process_image($BID); publish_image($BID); process_map($BID); //echo 'published.'; } echo 'Ad Saved. <A href="ads.php?BID=' . $prams['banner_id'] . '"><< Go to the Ad List</a>'; echo "<hr>"; } } else { $prams = load_ad_values($_REQUEST['ad_id']); display_ad_form(1, 'edit', $prams); } $prams = load_ad_values($_REQUEST['ad_id']); $sql = "select * FROM users where ID='" . $prams['user_id'] . "' "; $result = mysql_query($sql); $u_row = mysql_fetch_array($result); $b_row = load_banner_row($prams['banner_id']); ?>
if ($_REQUEST['process'] == '1') { if ($_REQUEST['banner_list'][0] == 'all') { // process all $sql = "select * from banners "; $result = mysql_query($sql) or die(mysql_error() . $sql); while ($row = mysql_fetch_array($result)) { echo process_image($row['banner_id']); publish_image($row['banner_id']); process_map($row['banner_id']); } } else { // process selected foreach ($_REQUEST['banner_list'] as $key => $banner_id) { echo process_image($banner_id); publish_image($banner_id); process_map($banner_id); } } echo "<br>Finished.<hr>"; } ####################### # Process images ?> <script language="JavaScript" type="text/javascript"> function confirmLink(theLink, theConfirmMsg) { if (theConfirmMsg == '' || typeof(window.opera) != 'undefined') { return true; }
function complete_renew_order($order_id) { global $label; $sql = "SELECT * from orders where order_id='{$order_id}' and status='renew_paid' "; $result = mysql_query($sql) or die(mysql_error() . $sql); $order_row = mysql_fetch_array($result); if ($order_row['status'] != 'completed') { $now = gmdate("Y-m-d H:i:s"); $sql = "UPDATE orders set status='completed', date_published=NULL, date_stamp='{$now}' WHERE order_id=" . $order_id; mysql_query($sql) or die(mysql_error() . $sql); // update pixel's order_id $sql = "UPDATE blocks SET order_id='" . $order_row['order_id'] . "' WHERE order_id='" . $order_row['original_order_id'] . "' AND banner_id='" . $row['banner_id'] . "' "; mysql_query($sql) or die(mysql_error() . $sql); // update ads' order id $sql = "UPDATE ads SET order_id='" . $order_row['order_id'] . "' WHERE order_id='" . $order_row['original_order_id'] . "' AND banner_id='" . $row['banner_id'] . "' "; mysql_query($sql) or die(mysql_error() . $sql); // mark pixels as sold. $sql = "SELECT * from orders where order_id='{$order_id}' "; $result = mysql_query($sql) or die(mysql_error() . $sql); $order_row = mysql_fetch_array($result); $blocks = explode(",", $order_row['blocks']); foreach ($blocks as $key => $val) { $sql = "UPDATE blocks set status='sold' where block_id='{$val}' and banner_id=" . $order_row['banner_id']; mysql_query($sql) or die(mysql_error() . $sql); } $sql = "SELECT * from users where ID='{$user_id}' "; $result = mysql_query($sql) or die(mysql_error() . $sql); $user_row = mysql_fetch_array($result); if ($order_row['days_expire'] == 0) { $order_row['days_expire'] = $label['advertiser_ord_never']; } $label["order_completed_renewal_email_template"] = str_replace("%SITE_NAME%", SITE_NAME, $label["order_completed_renewal_email_template"]); $label["order_completed_renewal_email_template"] = str_replace("%FNAME%", $user_row[FirstName], $label["order_completed_renewal_email_template"]); $label["order_completed_renewal_email_template"] = str_replace("%LNAME%", $user_row[LastName], $label["order_completed_renewal_email_template"]); $label["order_completed_renewal_email_template"] = str_replace("%ORDER_ID%", $order_row[order_id], $label["order_completed_renewal_email_template"]); $label["order_completed_renewal_email_template"] = str_replace("%ORIGINAL_ORDER_ID%", $order_row[original_order_id], $label["order_completed_renewal_email_template"]); $label["order_completed_renewal_email_template"] = str_replace("%PIXEL_COUNT%", $order_row[quantity], $label["order_completed_renewal_email_template"]); $label["order_completed_renewal_email_template"] = str_replace("%PIXEL_DAYS%", $order_row[days_expire], $label["order_completed_renewal_email_template"]); $label["order_completed_renewal_email_template"] = str_replace("%PRICE%", convert_to_default_currency_formatted($order_row[currency], $order_row[price]), $label["order_completed_renewal_email_template"]); $label["order_completed_renewal_email_template"] = str_replace("%SITE_CONTACT_EMAIL%", SITE_CONTACT_EMAIL, $label["order_completed_renewal_email_template"]); $label["order_completed_renewal_email_template"] = str_replace("%SITE_URL%", BASE_HTTP_PATH, $label["order_completed_renewal_email_template"]); $message = $label["order_completed_renewal_email_template"]; $to = trim($user_row['Email']); $subject = $label['order_completed_email_subject']; if (EMAIL_USER_ORDER_COMPLETED == 'YES') { if (USE_SMTP == 'YES') { $mail_id = queue_mail(addslashes($to), addslashes($user_row[FirstName] . " " . $user_row[LastName]), addslashes(SITE_CONTACT_EMAIL), addslashes(SITE_NAME), addslashes($subject), addslashes($message), '', 8); process_mail_queue(2, $mail_id); } else { send_email($to, $user_row[FirstName] . " " . $user_row[LastName], SITE_CONTACT_EMAIL, SITE_NAME, $subject, $message, '', 1); } } // send a copy to admin if (EMAIL_ADMIN_ORDER_COMPLETED == 'YES') { if (USE_SMTP == 'YES') { $mail_id = queue_mail(addslashes(SITE_CONTACT_EMAIL), addslashes($user_row[FirstName] . " " . $user_row[LastName]), addslashes(SITE_CONTACT_EMAIL), addslashes(SITE_NAME), addslashes($subject), addslashes($message), '', 8); process_mail_queue(2, $mail_id); } else { send_email(SITE_CONTACT_EMAIL, $user_row[FirstName] . " " . $user_row[LastName], SITE_CONTACT_EMAIL, SITE_NAME, $subject, $message, '', 1); } } // process the grid, if auto_publish is on $b_row = load_banner_row($order_row['banner_id']); if ($b_row['auto_publish'] == 'Y') { process_image($order_row['banner_id']); publish_image($order_row['banner_id']); process_map($order_row['banner_id']); } } }
$sql = "UPDATE blocks set approved='N' WHERE user_id=" . $user_id . " {$bid_sql}"; mysql_query($sql) or die(mysql_error() . $sql); $sql = "UPDATE orders set approved='N' WHERE user_id=" . $user_id . " {$bid_sql}"; mysql_query($sql) or die(mysql_error() . $sql); } echo "Advertiser(s) Disapproved.<br>"; } } if ($_REQUEST['do_it_now'] == 'true') { // process all grids $sql = "select * from banners "; $result = mysql_query($sql) or die(mysql_error() . $sql); while ($row = mysql_fetch_array($result)) { echo process_image($row['banner_id']); publish_image($row['banner_id']); process_map($row['banner_id']); } } /* if ($_REQUEST['all_go']!='') { $sql = "UPDATE blocks set approved='Y' "; mysql_query ($sql) or die (mysql_error().$sql); $sql = "select * from banners "; $result = mysql_query ($sql) or die (mysql_error().$sql); while ($row = mysql_fetch_array($result)) { process_image($row['banner_id']); publish_image($row['banner_id']); process_map($row['banner_id']); } } */
<? include('../build/config.php'); ini_set('memory_limit', '128M'); process_map('azeroth'); function process_map($name){ $folder = "../mop_out/world/maps/$name"; $zones = array(); $dh = opendir($folder); while (($file = readdir($dh)) !== false){ if (preg_match('!_(\d+)_(\d+)\.adt$!', $file, $m)){ extract_areas("$folder/$file", intval($m[1]), intval($m[2]), $zones); } } foreach ($zones as $k => $v){ $zones[$k] = reduce_squares($v); } foreach ($zones as $k => $v){ echo "$name $k $v[0] $v[1] $v[2] $v[3]\n"; }