function &Link_Get($LinkID, $TypeID = NULL) { #----------------------------------------------------------------------------- $Links =& Links(); #----------------------------------------------------------------------------- if (!isset($Links[$LinkID])) { $Links[$LinkID] = NULL; #--------------------------------------------------------------------------- if ($TypeID) { SetType($Links[$LinkID], $TypeID); } } #----------------------------------------------------------------------------- return $Links[$LinkID]; }
function DrawVerticalTicks() { if ($this->skip_top_tick != 1) { //If tick increment doesn't hit the top //Left Top //ImageLine($this->img,(-$this->tick_length+$this->xtr($this->plot_min_x)), // $this->ytr($this->plot_max_y),$this->xtr($this->plot_min_x),$this->ytr($this->plot_max_y),$this->ndx_tick_color); //$ylab = $this->FormatYTickLabel($plot_max_y); //Right Top //ImageLine($this->img,($this->xtr($this->plot_max_x)+$this->tick_length), // $this->ytr($this->plot_max_y),$this->xtr($this->plot_max_x-1),$this->ytr($this->plot_max_y),$this->ndx_tick_color); //Draw Grid Line at Top ImageLine($this->img, $this->plot_area[0] + 1, $this->ytr($this->plot_max_y), $this->plot_area[2] - 1, $this->ytr($this->plot_max_y), $this->ndx_light_grid_color); } if ($this->skip_bottom_tick != 1) { //Right Bottom //ImageLine($this->img,($this->xtr($this->plot_max_x)+$this->tick_length), // $this->ytr($this->plot_min_y),$this->xtr($this->plot_max_x), // $this->ytr($this->plot_min_y),$this->ndx_tick_color); //Draw Grid Line at Bottom of Plot ImageLine($this->img, $this->xtr($this->plot_min_x) + 1, $this->ytr($this->plot_min_y), $this->xtr($this->plot_max_x), $this->ytr($this->plot_min_y), $this->ndx_light_grid_color); } // maxy is always > miny so delta_y is always positive if ($this->vert_tick_increment) { $delta_y = $this->vert_tick_increment; } elseif ($this->num_vert_ticks) { $delta_y = ($this->plot_max_y - $this->plot_min_y) / $this->num_vert_ticks; } else { $delta_y = ($this->plot_max_y - $this->plot_min_y) / 10; } $y_tmp = $this->plot_min_y; SetType($y_tmp, 'double'); if ($this->skip_bottom_tick == 1) { $y_tmp += $delta_y; } while ($y_tmp <= $this->plot_max_y) { //For log plots: if ($this->yscale_type == "log" && $this->plot_min_y == 1 && $delta_y % 10 == 0 && $y_tmp == $this->plot_min_y) { $y_tmp = $y_tmp - 1; //Set first increment to 9 to get: 1,10,20,30,... } $ylab = $this->FormatYTickLabel($y_tmp); $this->DrawVerticalTick($ylab, $y_tmp); $y_tmp += $delta_y; } return true; }
function Datum_datab($datum) { SetType($datum, string); $datum = EReg_Replace(" ", "", $datum); if($datum<>"") { $pom = explode(".", $datum); $datum = $pom[2]."-".$pom[1]."-".$pom[0]; } return $datum; }
function get_totals($user) { $game = substr($this->game, 0, 5); if ($game == "WAR3_" || $game == "W3XP_") { $temp[$game . 'total_wins'] = $user[$game . 'nightelves_wins'] + $user[$game . 'orcs_wins'] + $user[$game . 'humans_wins'] + $user[$game . 'undead_wins'] + $user[$game . 'random_wins']; $temp[$game . 'total_losses'] = $user[$game . 'nightelves_losses'] + $user[$game . 'orcs_losses'] + $user[$game . 'humans_losses'] + $user[$game . 'undead_losses'] + $user[$game . 'random_losses']; if (!($temp[$game . 'total_wins'] + $temp[$game . 'total_losses'] == 0)) { $temp[$game . 'total_perc'] = sprintf("%2.2f", $temp[$game . 'total_wins'] / ($temp[$game . 'total_wins'] + $temp[$game . 'total_losses']) * 100); } else { $temp[$game . 'total_perc'] = "0.00"; } SetType($temp[$game . 'total_wins'], String); SetType($temp[$game . 'total_losses'], String); SetType($temp[$game . 'total_perc'], String); } return $temp; }
function ToArray() { /****************************************************************************/ $__args_types = array('string,array'); #----------------------------------------------------------------------------- $__args__ = Func_Get_Args(); eval(FUNCTION_INIT); /****************************************************************************/ $Names = Array_Merge($__args__, array('ListElement')); #----------------------------------------------------------------------------- $AttribsIDs = array(); #----------------------------------------------------------------------------- foreach ($__args__ as $__arg__) { #--------------------------------------------------------------------------- if (Is_Array($__arg__)) { $AttribsIDs = Array_Merge($AttribsIDs, $__arg__); } } #----------------------------------------------------------------------------- $Childs = $this->Childs; #----------------------------------------------------------------------------- if (Count($Childs) > 0) { #--------------------------------------------------------------------------- $j = 1; #--------------------------------------------------------------------------- $Result = array(); #--------------------------------------------------------------------------- foreach ($Childs as $Child) { #------------------------------------------------------------------------- $Name = $Child->Name; #------------------------------------------------------------------------- if (In_Array($Name, $Names)) { $Name = SPrintF('%s%06u', $Name, $j++); } #------------------------------------------------------------------------- $Name = $Name != 'UniqID' ? $Name : UniqID('UniqID'); #------------------------------------------------------------------------- $Result[$Name] = Call_User_Func_Array(array($Child, 'ToArray'), $__args__); #------------------------------------------------------------------------- foreach (Array_Keys($Child->Attribs) as $AttribID) { #----------------------------------------------------------------------- if (In_Array($AttribID, $AttribsIDs)) { #--------------------------------------------------------------------- if (!Is_Array($Result[$Name])) { $Result[$Name] = array(); } #--------------------------------------------------------------------- $Result[$Name][$AttribID] = $Child->Attribs[$AttribID]; } } } } else { #--------------------------------------------------------------------------- $Result = $this->Text != '' ? $this->Text : NULL; #--------------------------------------------------------------------------- $Type = 'string'; #--------------------------------------------------------------------------- if (isset($this->Attribs['type'])) { $Type = $this->Attribs['type']; } #--------------------------------------------------------------------------- @SetType($Result, $Type); } #----------------------------------------------------------------------------- return $Result; }
function freshports_CategoryDisplay($db, $category, $PageNo = 1, $PageSize = DEFAULT_PAGE_SIZE) { global $TableWidth; global $User; header('HTTP/1.1 200 OK'); $Debug = 0; if (isset($_SERVER['REDIRECT_QUERY_STRING'])) { if (isset($_SERVER["REDIRECT_QUERY_STRING"])) { parse_str($_SERVER['REDIRECT_QUERY_STRING'], $query_parts); if (isset($query_parts['page'])) { $PageNo = $query_parts['page']; } if (isset($query_parts['page_size'])) { $PageSize = $query_parts['page_size']; } } } if (!isset($page) || $page == '') { $page = 1; } if (!isset($page_size) || $page_size == '') { $page_size = $User->page_size; } if ($Debug) { echo "\$page = '{$page}'<br>\n"; echo "\$page_size = '{$page_size}'<br>\n"; } SetType($PageNo, "integer"); SetType($PageSize, "integer"); if (!isset($PageNo) || !str_is_int("{$PageNo}") || $PageNo < 1) { $PageNo = 1; } if (!isset($PageSize) || !str_is_int("{$PageSize}") || $PageSize < 1 || $PageSize > MAX_PAGE_SIZE) { $PageSize = DEFAULT_PAGE_SIZE; } if ($Debug) { echo "\$PageNo = '{$PageNo}'<br>\n"; echo "\$PageSize = '{$PageSize}'<br>\n"; } require_once $_SERVER['DOCUMENT_ROOT'] . '/../classes/categories.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/../classes/watch_lists.php'; if ($category->IsPrimary()) { $WatchLists = new WatchLists($db); $WatchListCount = $WatchLists->IsOnWatchList($User->id, $category->element_id); } $title = $category->{'name'}; # find out how many ports are in this category $PortCount = $category->PortCount($category->name); global $User; if ($Debug) { echo "\$User->id='{$User->id}'"; } freshports_Start($title, 'freshports - new ports, applications', 'FreeBSD, index, applications, ports'); $port = new Port($db); $numrows = $port->FetchByCategoryInitialise($category->name, $User->id, $PageSize, $PageNo); ?> <?php echo freshports_MainTable(); ?> <tr><td valign="top" width="100%"> <?php echo freshports_MainContentTable(); ?> <tr> <?php echo freshports_PageBannerText('Category listing - ' . $category->{'name'}); ?> </tr> <tr><td> <?php if ($category->IsPrimary()) { if ($WatchListCount) { echo freshports_Watch_Link_Remove('', 0, $category->{'element_id'}); } else { echo freshports_Watch_Link_Add('', 0, $category->{'element_id'}); } } ?> <BIG><BIG><B><?php echo $category->{'description'}; ?> </B></BIG></BIG>- Number of ports in this category: <?php echo $PortCount; ?> <p> Ports marked with a <sup>*</sup> actually reside within another category but have <b><?php echo $category->{'name'}; ?> </b> listed as a secondary category. <?php global $ShowAds, $BannerAd; if ($ShowAds && $BannerAd) { echo "<br><center>\n" . Ad_728x90() . "\n</center>\n"; } echo '<div align="center"><br>'; freshports_CategoryNextPreviousPage($category->name, $PortCount, $PageNo, $PageSize); echo '</div>'; ?> </td></tr> <?php if ($Debug) { echo "\$CategoryID = '{$CategoryID}'<BR>\n"; echo "GlobalHideLastChange = {$GlobalHideLastChange}<BR>\n"; echo "\$numrows = {$numrows}<BR>\n"; } $ShowShortDescription = "Y"; $HTML = freshports_echo_HTML("<TR>\n<TD>\n"); require_once $_SERVER['DOCUMENT_ROOT'] . '/../classes/port-display.php'; $port_display = new port_display($db, $User); $port_display->SetDetailsCategory(); for ($i = 0; $i < $numrows; $i++) { $port->FetchNth($i); $port_display->port = $port; $Port_HTML = $port_display->Display(); $HTML .= $port_display->ReplaceWatchListToken($port->{'onwatchlist'}, $Port_HTML, $port->{'element_id'}); } // end for echo $HTML; ?> </TD></TR> <TR><TD> <div align="center"><br> <?php freshports_CategoryNextPreviousPage($category->name, $PortCount, $PageNo, $PageSize); ?> </div> </TD></TR> </TABLE> <TD VALIGN="top" WIDTH="*" ALIGN="center"> <?php echo freshports_SideBar(); ?> </td> </TR> </TABLE> <?php echo freshports_ShowFooter(); ?> </body> </html> <?php }
if ($Debug) { echo "\$page = '{$page}'<br>\n"; echo "\$page_size = '{$page_size}'<br>\n"; } if (!isset($page) || $page == '') { $page = 1; } if (!isset($page_size) || $page_size == '') { $page_size = $User->page_size; } if ($Debug) { echo "\$page = '{$page}'<br>\n"; echo "\$page_size = '{$page_size}'<br>\n"; } SetType($PageNo, "integer"); SetType($PageSize, "integer"); if (!isset($PageNo) || !str_is_int("{$PageNo}") || $PageNo < 1) { $PageNo = 1; } if (!isset($PageSize) || !str_is_int("{$PageSize}") || $PageSize < 1 || $PageSize > MAX_PAGE_SIZE) { $PageSize = DEFAULT_PAGE_SIZE; } if ($Debug) { echo "\$PageNo = '{$PageNo}'<br>\n"; echo "\$PageSize = '{$PageSize}'<br>\n"; } $Title = 'Commit found by '; if ($message_id) { $Title .= 'message id'; # if found, this will be > 0 if (strpos($message_id, MESSAGE_ID_OLD_DOMAIN)) {
<?php include "./Config/vars.php"; //// CODE if (!isset($w)) { $w = 50; } if (!isset($h)) { $h = 50; } SetType($mode, 'integer'); SetType($w, 'integer'); SetType($h, 'integer'); SetType($img, 'string'); function percent($p, $w) { return (double) (100 * ($p / $w)); } function unpercent($percent, $whole) { return (double) ($percent * $whole / 100); } // Initialization print $img; // Make sure the file exists... if (!file_exists($img)) { echo "Error: could not find file: {$img}."; exit; } // If the user defined a type to use. if (!isset($type)) {