function list_ads($admin = false, $order, $offset, $list_mode = 'ALL', $user_id = '') { ## Globals global $label; global $tag_to_field_id; $tag_to_field_id = ad_tag_to_field_id_init(); ########################################### # Load in the form data, including column names # (dont forget LANGUAGE TOO) global $ad_tag_to_field_id; $records_per_page = 40; global $label; // languages array $order_str = $order; if ($order == '') { $order = " `order_id` "; } else { $order = " `{$order}` "; } global $action; // process search result if ($_REQUEST['action'] == 'search') { $q_string = generate_q_string(1); $where_sql = generate_search_sql(1); } // DATE_FORMAT(`adate`, '%d-%b-%Y') AS formatted_date $order = $_REQUEST['order_by']; if ($_REQUEST['ord'] == 'asc') { $ord = 'ASC'; } elseif ($_REQUEST['ord'] == 'desc') { $ord = 'DESC'; } else { $ord = 'DESC'; // sort descending by default } if ($order == '') { $order = " `ad_date` "; } else { $order = " `{$order}` "; } global $BID; if ($list_mode == 'USER') { if (!is_numeric($user_id)) { $user_id = $_SESSION['MDS_ID']; } $sql = "Select * FROM `ads` as t1, `orders` as t2 WHERE t1.ad_id=t2.ad_id AND t1.order_id > 0 AND t1.banner_id='" . $BID . "' AND t1.user_id='" . $user_id . "' AND (t2.status = 'completed' OR t2.status = 'expired') {$where_sql} ORDER BY {$order} {$ord} "; } elseif ($list_mode == 'TOPLIST') { // $sql = "SELECT *, DATE_FORMAT(MAX(order_date), '%Y-%c-%d') as max_date, sum(quantity) AS pixels FROM orders, ads where ads.order_id=orders.order_id AND status='completed' and orders.banner_id='$BID' GROUP BY orders.user_id, orders.banner_id order by pixels desc "; } else { $sql = "Select * FROM `ads` as t1, `orders` AS t2 WHERE t1.ad_id=t2.ad_id AND t1.banner_id='{$BID}' and t1.order_id > 0 {$where_sql} ORDER BY {$order} {$ord} "; } //echo "[".$sql."]"; $result = mysql_query($sql) or die(mysql_error()); ############ # get the count $count = mysql_num_rows($result); if ($count > $records_per_page) { mysql_data_seek($result, $offset); } if ($count > 0) { if ($pages == 1) { } elseif ($list_mode != 'USER') { $pages = ceil($count / $records_per_page); $cur_page = $_REQUEST['offset'] / $records_per_page; $cur_page++; echo "<center>"; //echo "Page $cur_page of $pages - "; $label["navigation_page"] = str_replace("%CUR_PAGE%", $cur_page, $label["navigation_page"]); $label["navigation_page"] = str_replace("%PAGES%", $pages, $label["navigation_page"]); echo "<span > " . $label["navigation_page"] . "</span> "; $nav = nav_pages_struct($result, $q_string, $count, $records_per_page); $LINKS = 10; render_nav_pages($nav, $LINKS, $q_string, $show_emp, $cat); echo "</center>"; } $dir = dirname(__FILE__); $dir = preg_split('%[/\\\\]%', $dir); $blank = array_pop($dir); $dir = implode('/', $dir); include $dir . '/mouseover_box.htm'; // edit this file to change the style of the mouseover box! echo '<script language="JAVASCRIPT">'; include 'mouseover_js.inc.php'; echo '</script>'; ?> <table border='0' bgcolor='#d9d9d9' cellspacing="1" cellpadding="5" id="adslist" > <tr bgcolor="#EAEAEA"> <?php if ($admin == true) { echo '<td class="list_header_cell"> </td>'; } if ($list_mode == 'USER') { echo '<td class="list_header_cell"> </td>'; } echo_list_head_data(1, $admin); if ($list_mode == 'USER' || $admin) { echo '<td class="list_header_cell">' . $label['ads_inc_pixels_col'] . '</td>'; echo '<td class="list_header_cell">' . $label['ads_inc_expires_col'] . '</td>'; echo '<td class="list_header_cell" >' . $label['ad_list_status'] . '</td>'; } ?> </tr> <?php $i = 0; global $prams; while (($prams = mysql_fetch_array($result, MYSQL_ASSOC)) && $i < $records_per_page) { $i++; ?> <tr bgcolor="ffffff" onmouseover="old_bg=this.getAttribute('bgcolor');this.setAttribute('bgcolor', '#FBFDDB', 0);" onmouseout="this.setAttribute('bgcolor', old_bg, 0);"> <?php if ($admin == true) { echo '<td class="list_data_cell" >'; ?> <!--<input style="font-size: 8pt" type="button" value="Delete" onClick="if (!confirmLink(this, 'Delete, are you sure?')) {return false;} window.location='<?php echo htmlentities($_SERVER['PHP_SELF']); ?> ?action=delete&ad_id=<?php echo $prams['ad_id']; ?> '"><br>!--> <input type="button" style="font-size: 8pt" value="Edit" onClick="window.location='<?php echo htmlentities($_SERVER['PHP_SELF']); ?> ?action=edit&ad_id=<?php echo $prams['ad_id']; ?> '"> <?php echo '</td>'; } if ($list_mode == 'USER') { echo '<td class="list_data_cell">'; ?> <!--<input style="font-size: 8pt" type="button" value="Delete" onClick="if (!confirmLink(this, 'Delete, are you sure?')) {return false;} window.location='<?php echo htmlentities($_SERVER['PHP_SELF']); ?> ?action=delete&ad_id=<?php echo $prams['ad_id']; ?> '"><br>--> <input type="button" style="font-size: 8pt" value="Edit" onClick="window.location='<?php echo htmlentities($_SERVER['PHP_SELF']); ?> ?ad_id=<?php echo $prams['ad_id']; ?> '"> <?php echo '</td>'; } echo_ad_list_data($admin); if ($list_mode == 'USER' || $admin) { ///////////////// echo '<td class="list_data_cell"><img src="get_order_image.php?BID=' . $BID . '&aid=' . $prams['ad_id'] . '"></td>'; ////////////////// echo '<td>'; if ($prams['days_expire'] > 0) { if ($prams['published'] != 'Y') { $time_start = strtotime(gmdate('r')); } else { $time_start = strtotime($prams['date_published'] . " GMT"); } $elapsed_time = strtotime(gmdate('r')) - $time_start; $elapsed_days = floor($elapsed_time / 60 / 60 / 24); $exp_time = $prams['days_expire'] * 24 * 60 * 60; $exp_time_to_go = $exp_time - $elapsed_time; $exp_days_to_go = floor($exp_time_to_go / 60 / 60 / 24); $to_go = elapsedtime($exp_time_to_go); $elapsed = elapsedtime($elapsed_time); if ($prams['status'] == 'expired') { $days = "<a href='orders.php'>" . $label['ads_inc_expied_stat'] . "</a>"; } elseif ($prams['date_published'] == '') { $days = $label['ads_inc_nyp_stat']; } else { $days = str_replace('%ELAPSED%', $elapsed, $label['ads_inc_elapsed_stat']); $days = str_replace('%TO_GO%', $to_go, $days); //$days = "$elapsed elapsed<br> $to_go to go "; } //$days = $elapsed_time; //print_r($prams); } else { $days = $label['ads_inc_nev_stat']; } echo $days; echo '</td>'; ///////////////// if ($prams['published'] == 'Y') { $pub = $label['ads_inc_pub_stat']; } else { $pub = $label['ads_inc_npub_stat']; } if ($prams['approved'] == 'Y') { $app = $label['ads_inc_app_stat'] . ', '; } else { $app = $label['ads_inc_napp_stat'] . ', '; } //$label['ad_list_st_'.$prams['status']]." echo '<td class="list_data_cell">' . $app . $pub . "</td>"; } ?> </tr> <?php //$prams[file_photo] = ''; // $new_name=''; } echo "</table>"; } else { echo "<center><font size='2' face='Arial'><b>" . $label["ads_not_found"] . ".</b></font></center>"; } return $count; }
function catbody($title, $page, $body) { global $script; // MUST BE SKIN.FILE. Do not delete line. global $vars, $arg, $defaultpage, $whatsnew, $help_page, $hr; global $attach_link, $related_link, $function_freeze; global $search_word_color, $foot_explain, $note_hr, $head_tags, $foot_tags; global $trackback, $referer, $javascript; global $newtitle, $newbase, $language, $use_local_time; // Plus! skin extension global $nofollow; global $_LANG, $_LINK, $_IMAGE; global $pkwk_dtd; // XHTML 1.1, XHTML1.0, HTML 4.01 Transitional... global $page_title; // Title of this site global $do_backup; // Do backup or not global $modifier; // Site administrator's web page global $modifierlink; // Site administrator's name global $skin_file, $menubar, $sidebar; global $_string; if (!defined('SKIN_FILE') || !file_exists(SKIN_FILE) || !is_readable(SKIN_FILE)) { if (!file_exists($skin_file) || !is_readable($skin_file)) { die_message(SKIN_FILE . '(skin file) is not found.'); } else { define('SKIN_FILE', $skin_file); } } $_LINK = $_IMAGE = array(); // Add JavaScript header when ... if (!PKWK_ALLOW_JAVASCRIPT) { unset($javascript); } $_page = isset($vars['page']) ? $vars['page'] : ''; $r_page = rawurlencode($_page); // Set $_LINK for skin $_LINK['add'] = get_cmd_uri('add', $_page); $_LINK['backup'] = get_cmd_uri('backup', $_page); $_LINK['brokenlink'] = get_cmd_uri('brokenlink', $_page); $_LINK['copy'] = get_cmd_uri('template', '', '', 'refer=' . $r_page); $_LINK['diff'] = get_cmd_uri('diff', $_page); $_LINK['edit'] = get_cmd_uri('edit', $_page); $_LINK['guiedit'] = get_cmd_uri('guiedit', $_page); $_LINK['filelist'] = get_cmd_uri('filelist'); $_LINK['freeze'] = get_cmd_uri('freeze', $_page); $_LINK['help'] = get_cmd_uri('help'); $_LINK['linklist'] = get_cmd_uri('linklist', $_page); $_LINK['list'] = get_cmd_uri('list'); $_LINK['log_login'] = get_cmd_uri('logview', '', '', 'kind=login'); $_LINK['log_browse'] = get_cmd_uri('logview', $_page, '', 'kind=browse'); $_LINK['log_update'] = get_cmd_uri('logview', $_page); $_LINK['log_down'] = get_cmd_uri('logview', $_page, '', 'kind=download'); $_LINK['log_check'] = get_cmd_uri('logview', $_page, '', 'kind=check'); $_LINK['menu'] = get_page_uri($menubar); $_LINK['new'] = get_cmd_uri('newpage', '', '', 'refer=' . $r_page); $_LINK['newsub'] = get_cmd_uri('newpage_subdir', '', '', 'directory=' . $r_page); $_LINK['print'] = get_cmd_uri('print', $_page); $_LINK['full'] = get_cmd_uri('print', $_page) . '&nohead&nofoot'; $_LINK['read'] = get_page_uri($_page); $_LINK['recent'] = get_page_uri($whatsnew); $_LINK['refer'] = get_cmd_uri('referer', $_page); $_LINK['reload'] = get_page_absuri($_page); // 本当は、get_script_uri でいいけど、絶対パスでないと、スキンに影響が出る $_LINK['reload_rel'] = get_page_uri($_page); $_LINK['rename'] = get_cmd_uri('rename', '', '', 'refer=' . $r_page); $_LINK['skeylist'] = get_cmd_uri('skeylist', $_page); $_LINK['search'] = get_cmd_uri('search'); $_LINK['side'] = get_page_uri($sidebar); $_LINK['source'] = get_cmd_uri('source', $_page); $_LINK['template'] = get_cmd_uri('template', '', '', 'refer=' . $r_page); $_LINK['top'] = get_page_uri($defaultpage); if ($trackback) { $tb_id = tb_get_id($_page); $_LINK['trackback'] = get_cmd_uri('tb', '', '', '__mode=view&tb_id=' . $tb_id); } $_LINK['unfreeze'] = get_cmd_uri('unfreeze', $_page); $_LINK['upload'] = get_cmd_uri('attach', $_page, '', 'pcmd=upload'); // link rel="alternate" にも利用するため absuri にしておく $_LINK['rdf'] = get_cmd_absuri('rss', '', 'ver=1.0'); $_LINK['rss'] = get_cmd_absuri('rss'); $_LINK['rss10'] = get_cmd_absuri('rss', '', 'ver=1.0'); // Same as 'rdf' $_LINK['rss20'] = get_cmd_absuri('rss', '', 'ver=2.0'); $_LINK['mixirss'] = get_cmd_absuri('mixirss'); // Same as 'rdf' for mixi // Compat: Skins for 1.4.4 and before $link_add =& $_LINK['add']; $link_backup =& $_LINK['backup']; $link_brokenlink =& $_LINK['brokenlink']; $link_template =& $_LINK['copy']; $link_diff =& $_LINK['diff']; $link_edit =& $_LINK['edit']; $link_guiedit =& $_LINK['guiedit']; $link_filelist =& $_LINK['filelist']; $link_freeze =& $_LINK['freeze']; $link_help =& $_LINK['help']; $link_linklist =& $_LINK['linklist']; $link_list =& $_LINK['list']; $link_log_login =& $_LINK['log_login']; $link_log_browse =& $_LINK['log_browse']; $link_log_update =& $_LINK['log_update']; $link_log_down =& $_LINK['log_down']; $link_log_check =& $_LINK['log_check']; $link_menu =& $_LINK['menu']; $link_new =& $_LINK['new']; $link_newsub =& $_LINK['newsub']; $link_print =& $_LINK['print']; $link_full =& $_LINK['full']; $link_read =& $_LINK['read']; $link_whatsnew =& $_LINK['recent']; $link_refer =& $_LINK['refer']; $link_reload =& $_LINK['reload']; $link_reload_rel =& $_LINK['reload_rel']; $link_rename =& $_LINK['rename']; $link_skeylist =& $_LINK['skeylist']; $link_search =& $_LINK['search']; $link_side =& $_LINK['side']; $link_source =& $_LINK['source']; $link_top =& $_LINK['top']; if ($trackback) { $link_trackback =& $_LINK['trackback']; } $link_unfreeze =& $_LINK['unfreeze']; $link_upload =& $_LINK['upload']; // $link_rdf =& $_LINK['rdf']; $link_rss =& $_LINK['rss']; $link_rss10 =& $_LINK['rss10']; $link_rss20 =& $_LINK['rss20']; $link_mixirss =& $_LINK['mixirss']; // Init flags $is_page = is_pagename($_page) && !arg_check('backup') && !is_cantedit($_page); $is_read = arg_check('read') && is_page($_page); $is_freeze = is_freeze($_page); // Last modification date (string) of the page $lastmodified = $is_read ? get_date('D, d M Y H:i:s T', get_filetime($_page)) . ' ' . get_pg_passage($_page, FALSE) : ''; // List of attached files to the page $attaches = ''; if ($attach_link && $is_read && exist_plugin_action('attach')) { if (do_plugin_init('attach') !== FALSE) { $attaches = attach_filelist(); } } // List of related pages $related = $related_link && $is_read ? make_related($_page) : ''; // List of footnotes ksort($foot_explain, SORT_NUMERIC); $notes = !empty($foot_explain) ? $note_hr . join("\n", $foot_explain) : ''; // Tags will be inserted into <head></head> $head_tag = !empty($head_tags) ? join("\n", $head_tags) . "\n" : ''; $foot_tag = !empty($foot_tags) ? join("\n", $foot_tags) . "\n" : ''; // 1.3.x compat // Last modification date (UNIX timestamp) of the page $fmt = $is_read ? get_filetime($_page) : 0; // Search words if ($search_word_color && isset($vars['word'])) { $body = '<div class="small">' . $_string['word'] . htmlspecialchars($vars['word']) . '</div>' . $hr . "\n" . $body; // BugTrack2/106: Only variables can be passed by reference from PHP 5.0.5 $words = preg_split('/\\s+/', $vars['word'], -1, PREG_SPLIT_NO_EMPTY); $words = array_splice($words, 0, 10); // Max: 10 words $words = array_flip($words); $keys = array(); foreach ($words as $word => $id) { $keys[$word] = strlen($word); } arsort($keys, SORT_NUMERIC); $keys = get_search_words(array_keys($keys), TRUE); $id = 0; foreach ($keys as $key => $pattern) { $s_key = htmlspecialchars($key); $pattern = '/' . '<textarea[^>]*>.*?<\\/textarea>' . '|' . '<[^>]*>' . '|' . '&[^;]+;' . '|' . '(' . $pattern . ')' . '/sS'; $decorate_Nth_word = create_function('$matches', 'return (isset($matches[1])) ? ' . '\'<strong class="word' . $id . '">\' . $matches[1] . \'</strong>\' : ' . '$matches[0];'); $body = preg_replace_callback($pattern, $decorate_Nth_word, $body); $notes = preg_replace_callback($pattern, $decorate_Nth_word, $notes); ++$id; } } // Compat: 'HTML convert time' without time about MenuBar and skin $taketime = elapsedtime(); require SKIN_FILE; }
//$time_when_cancel = $time_expired + ($b_row['days_expire '] * 24 * 60 * 60); if ($order_row['days_expire'] > 0) { // //} else { if ($order_row['published'] != 'Y') { $time_start = strtotime(gmdate('r')); } else { $time_start = strtotime($order_row['date_published'] . " GMT"); } $elapsed_time = strtotime(gmdate('r')) - $time_start; $elapsed_days = floor($elapsed_time / 60 / 60 / 24); $exp_time = $order_row['days_expire'] * 24 * 60 * 60; $exp_time_to_go = $exp_time - $elapsed_time; $exp_days_to_go = floor($exp_time_to_go / 60 / 60 / 24); $to_go = elapsedtime($exp_time_to_go); $elapsed = elapsedtime($elapsed_time); $days = "{$elapsed} passed<br> {$to_go} to go (" . $order_row['days_expire'] . ")"; // } if ($order_row['published'] != 'Y') { $days = "not published"; } elseif ($exp_time_to_go <= 0) { $days .= 'Expired!'; } //$days = $elapsed_time; } else { $days = "Never"; } $alt_text = "<b>Customer:</b> " . $user_row['FirstName'] . " " . $user_row['LastName'] . " <br><b>Username:</b> " . $user_row['Username'] . "<br><b>Email:</b> " . $user_row['Email'] . "<br><b>Order</b> # : " . $row['order_id'] . " <br> <b>Block Status:</b> " . $row['status'] . "<br><b>Published:</b> " . $order_row['published'] . "<br><b>Approved:</b> " . $order_row['published'] . "<br><b>Expires:</b> " . $days . "<br><b>Click Count:</b> " . $row['click_count'] . "<br><b>Co-ordinate:</b> x:" . $row['x'] . ", y:" . $row['y'] . ""; //if (strlen($row['image_data'])>0) { ?>
<div id="footer"> <div id="f-officialico"> <a href="http://pukiwiki.cafelounge.net/plus/"><img src="<?php echo IMAGE_URI; ?> pukiwiki-plus.png" alt="PukiWikiPlus" /></a> </div> <div id="f-officialdevico"> <a href="http://pukiwiki.cafelounge.net/plus/"><img src="<?php echo IMAGE_URI; ?> pukiwiki-plus.dev.png" alt="PukiWikiPlus-dev" /></a> </div> <div id="f-list"> <ul><?php echo $lastmodified . $siteadmin . $footer_counter; ?> <li>convert time: <?php echo function_exists('elapsedtime') ? elapsedtime() : $taketime; ?> sec</li> <li>Powered by PukiWiki</li> <li><a href="http://lsx.sourceforge.jp/?monobook">Monobook for PukiWiki Plus! i18n</a></li> </ul> </div> <div style="clear:both;"></div> </div> </div> </body> </html>
function get_game_list($args = array()) { $args['sort'] = trim(strtolower($args['sort'])); $args['order'] = trim(strtolower($args['order'])); if (!in_array($args['sort'], array('start_time', 'start_time,end_time', 'server_name', 'gametype', 'modtype', 'map'))) { $args['sort'] = 'start_time,end_time'; } if (!in_array($args['order'], array('asc', 'desc'))) { $args['order'] = 'desc'; } if (!is_numeric($args['start']) || $args['start'] < 0) { $args['start'] = 0; } if (!is_numeric($args['limit']) || $args['limit'] < 0) { $args['limit'] = 100; } $args['filter'] = trim($args['filter']); $cmd = "SELECT g.*, " . "IF(end_time, end_time - start_time, " . "(SELECT MAX(event_time) FROM {$this->ps->t_live_events} e " . "WHERE e.game_id=g.game_id) - start_time" . ") total_time, " . "(SELECT COUNT(*) FROM {$this->ps->t_live_entities} " . "WHERE game_id=g.game_id) total_players " . "FROM {$this->ps->t_live_games} g "; if ($args['filter']) { $q = $this->ps->db->escape($args['filter']); $cmd .= "WHERE map LIKE '{$q}' OR server_name LIKE '{$q}'"; unset($q); } $cmd .= $this->ps->getsortorder($args); $list = $this->ps->db->fetch_rows(1, $cmd); for ($i = 0, $j = count($list); $i < $j; $i++) { // calculate the elapsed time if (!is_null($list[$i]['total_time'])) { $elapsed = elapsedtime($list[$i]['total_time'], 0, true); $list[$i]['elapsed_time'] = elapsedtime_str($elapsed); } // get the map thumbnail url (or false if not found) $list[$i]['map_url'] = $this->ps->mapimg($list[$i]['map'], array('gametype' => $list[$i]['gametype'], 'modtype' => $list[$i]['modtype'], 'urlonly' => true, 'noimg' => false)); } return $list; }
/** * Smarty number elapsedtime modifier plugin * * Type: modifier<br> * Name: elapsedtime<br> * Purpose: convert seconds into a string representing "years, months, weeks, days, hours, minutes, seconds" * @param string * @return string */ function smarty_modifier_elapsedtime($seconds, $start = 0, $wantarray = false) { return elapsedtime($seconds, $start, $wantarray); }