columns = $columns; $this->keycol = $keycol; $this->showranking = $showranking; $this->numperpage = $numperpage; $this->var_page = $var_page; $this->var_sort = $var_sort; $this->var_sortorder = $var_sortorder; $this->sorthash = $sorthash; $this->sort_default_order = $sort_default_order; $this->ajax = ( $g_options['playerinfo_tabs'] ) ? $ajax : false; $this->page = valid_request(intval($_GET[$var_page]), 1); $this->sort = valid_request($_GET[$var_sort], 0); $this->sortorder = valid_request($_GET[$var_sortorder], 0); if ($this->page < 1) { $this->page = 1; } $this->startitem = ($this->page - 1) * $this->numperpage; foreach ($columns as $col) { if ($col->sort != 'no') { $this->columnlist[] = $col->name; } } if (!is_array($this->columnlist) || !in_array($this->sort, $this->columnlist)) { $this->sort = $sort_default; } if ($this->sortorder != 'asc' && $this->sortorder != 'desc') { $this->sortorder = $this->sort_default_order; } if ($this->sort == $sort_default2) { $this->sort2 = $sort_default; } else { $this->sort2 = $sort_default2; } } function start($numitems, $width=100, $align='center') { global $g_options, $game, $realgame, $db; $numpages = ceil($numitems / $this->numperpage); ?>
showranking) { $totalwidth += 5; echo "\n"; } foreach ($this->columns as $col) { $totalwidth += $col->width; echo "\n"; } ?> page - 1) * $this->numperpage + 1; } function draw ($result, $numitems, $width=100, $align='center') { global $g_options, $game, $realgame, $db; $numpages = ceil($numitems / $this->numperpage); ?>
Rankwidth%;text-align:$col->align;\" class=\"fSmall\">"; if ($col->sort != 'no') { echo getSortArrow($this->sort, $this->sortorder, $col->name, $col->title, $this->var_sort, $this->var_sortorder, $this->sorthash); } else { echo $col->title; } echo "
showranking) { $totalwidth += 5; echo "\n"; } foreach ($this->columns as $col) { $totalwidth += $col->width; echo "\n"; } ?> page - 1) * $this->numperpage + 1; while ($rowdata = $db->fetch_array($result)) { echo "\n"; $i = 0; if ($this->showranking) { $c = ($i % 2) + 1; $i++; echo "\n"; } foreach ($this->columns as $col) { $c = ($i % 2) + 1; $class=""; $cellbody = ''; $colval = $rowdata[$col->name]; if ($col->align != 'left') { $colalign = " style=\"text-align:$col->align;\""; } else { $colalign = ""; } $class = "bg$c"; if (($col->icon) || ($col->flag)) { $cellbody = ' '; } if ($col->link) { if (strpos($col->link, 'javascript:') === false) { $link = str_ireplace('%k', urlencode($rowdata[$this->keycol]), $col->link); $cellbody .= ""; } else { $col->link = str_replace('\\\\', '', $col->link); $link = str_ireplace('%k', $rowdata[$this->keycol], $col->link); $cellbody .= ""; } } if ($col->icon) { $image = getImage("/$col->icon"); if ($image) { $cellbody .= '\"$col-icon\" />"; } } elseif ($col->flag) { #$link = ereg_replace("%f", $col->link); if ($g_options['countrydata'] == 1) { if ($rowdata['flag'] == '') { $rowdata['flag'] = '0'; $alt_text = 'No Country'; } else { $alt_text = ucfirst(strtolower($rowdata['country'])); } $cellbody .= '\"$alt_text\""; } else { $col->flag = 'player'; $cellbody .= 'flag.gif\" class=\"tableicon\" alt=\"$col->icon.gif\" />"; } } switch ($col->type) { case 'timestamp': $cellbody = timestamp_to_str($colval); break; case 'roleimg': $image = getImage("/games/$game/roles/".strtolower($colval)); // check if image exists for game -- otherwise check realgame if ($image) { $cellbody .= '' . $col->fname[$colval] . ' '; } elseif ($image = getImage("/games/$realgame/roles/".strtolower($colval))) { $cellbody .= '' . $col->fname[$colval] . ' '; } if ($col->fname[$colval] != '') { $cellbody .= ''.$col->fname[$colval].''; } else { $cellbody .= ''.ucwords(preg_replace('/_/', ' ', $colval)).''; } break; case 'weaponimg': // Check if game has the image -- if not, failback to real game. If not, no image. $image = getImage("/games/$realgame/weapons/".strtolower($colval)); if ($image) { $cellbody .= ''.$col->fname[$colval].''; } elseif ($image = getImage("/games/$realgame/weapons/".strtolower($colval))) { $cellbody .= ''.$col->fname[$colval].''; } else { $cellbody .= '' . (($col->fname[$colval] != '') ? $col->fname[$colval] : ucwords(preg_replace('/_/', ' ', $colval))) . ''; } break; case 'bargraph': $cellbody .= '\"$colval%\""; break; case 'heatmap': $heatmap = getImage("/games/$game/heatmaps/$colval-kill"); $heatmapthumb = getImage("/games/$game/heatmaps/$colval-kill-thumb"); if ($heatmap) { $cellbody .= ""; } else { $cellbody .= " "; } break; default: if ($this->showranking && $rank == 1 && $i == 1) $cellbody .= ''; if ((is_numeric($colval)) && ($colval >= 1000)) $colval = number_format($colval); $colval = nl2br(htmlspecialchars($colval, ENT_COMPAT)); if ($col->embedlink == 'yes') { $colval = preg_replace(array('/%A%([^ %]+)%/','/%\/A%/'), array("", ''), $colval); } $cellbody .= $colval; if ($this->showranking && $rank == 1 && $i == 1) $cellbody .= ''; break; } if ($col->link) { $cellbody .= ''; } if ($col->append) { $cellbody .= $col->append; } if ($col->skill_change) { if ($rowdata['last_skill_change'] == '') $rowdata['last_skill_change'] = 0; if ($rowdata['last_skill_change'] == 0) $cellbody .= " \"".$rowdata['last_skill_change'].""; elseif ($rowdata['last_skill_change'] > 0) $cellbody .= " \"".$rowdata['last_skill_change'].""; elseif ($rowdata['last_skill_change'] < 0) $cellbody .= " \"".$rowdata['last_skill_change'].""; } echo "" . $cellbody . "\n"; $i++; } echo "\n\n"; $rank++; } ?>
Rankwidth%;text-align:$col->align;\" class=\"fSmall\">"; if ($col->sort != 'no') { echo getSortArrow($this->sort, $this->sortorder, $col->name, $col->title, $this->var_sort, $this->var_sortorder, $this->sorthash, $this->ajax); } else { echo $col->title; } echo "
$rank


1) { ?>
page - intval($this->maxpagenumbers / 2); if ($start < 1) $start=1; $end = $numpages; if ($end > $this->maxpagenumbers + $start-1) $end = $this->maxpagenumbers + $start-1; if ($end - $start + 1 < $this->maxpagenumbers) $start = $end - $this->maxpagenumbers + 1; if ($start < 1) $start=1; if ($start > 1) { if ($start > 2) $this->_echoPageNumber(1, "First page", "", " ..."); else $this->_echoPageNumber(1, 1); } for ($i=$start; $i <= $end; $i++) { if ($i == $this->page) { echo "$i "; } else { $this->_echoPageNumber($i, $i); } if ($i == $end && $i < $numpages) { if ($i < $numpages - 1) $this->_echoPageNumber($numpages, "Last page", "... "); else $this->_echoPageNumber($numpages, 10); } } ?>


var_page, $number); if ($this->sorthash) echo "#$this->sorthash"; if ($this->ajax) echo "\" onclick=\"Tabs.refreshTab({'" . $this->var_page . "': " . $number . "}); return false;"; echo "\">$label$postfix "; } } // // TableColumn // // Data structure for the properties of a column in a Table // class TableColumn { var $name; var $title; var $align = 'left'; var $width = 20; var $icon; var $link; var $sort = 'yes'; var $type = 'text'; var $embedlink = 'no'; var $flag; function TableColumn ($name, $title, $attrs="", $fname=null) { $this->name = $name; $this->title= $title; $allowed_attrs = array( 'align', 'width', 'icon', 'link', 'sort', 'append', 'type', 'embedlink', 'flag', 'skill_change', 'heatmap' ); parse_str($attrs); foreach ($allowed_attrs as $a) { if (isset($$a)) { $this->$a = mystripslashes($$a); } } $this->fname = $fname; } }