📄 index.php
字号:
// RX & TX if ($values["running"]) imagettftext($finalimg, FONTSIZE, 0, 25, 85, $fgcolor, FONTFILE, $text["rx"].": ".$values["rxspeed"].$text["transrate"]. " | ".$text["tx"].": ".$values["txspeed"]. $text["transrate"]); else imagettftext($finalimg, FONTSIZE, 0, 25, 85, $fgcolor, FONTFILE, $text["rx"].": ".$text["na"]." | ".$text["tx"].": ". $text["na"]); // queued clients if ($values["running"]) imagettftext($finalimg, FONTSIZE, 0, 270, 107, $fgcolor, FONTFILE, $text["queuedclients"].": ". $values["queuedclients"]); else imagettftext($finalimg, FONTSIZE, 0, 270, 107, $fgcolor, FONTFILE, $text["queuedclients"].": ".$text["na"]); // RFC 2822 Datestamp imagettftext($finalimg, FONTSIZE, 0, 25, 107, $fgcolor, FONTFILE, date("r")); // outputs the signature image based on the value of IMAGETYPE. The case // for png and default are the same; in other words, PNG is the default // image output type. Note that your installation of GD has to support // the type of image you are outputting here. switch (IMAGETYPE) { case "jpg": case "jpeg": { header("Content-type: image/jpeg"); imagejpeg($finalimg, "", 100); } case "gif": { header("Content-type: image/gif"); imagegif($finalimg); } case "png": default: { header("Content-type: image/png"); imagepng($finalimg); } }}/** * This function outputs a simple image containing an error message specified * by the only parameter, $err_message. The image is black text and border on * a white background. */function output_error_img($err_message){ // determine the size of the text string and add to it the amount of // padding specified earlier. $fontdims = imagettfbbox(FONTSIZE, 0, FONTFILE, $err_message); $min_x = min($fontdims[0], $fontdims[2], $fontdims[4], $fontdims[6]); $max_x = max($fontdims[0], $fontdims[2], $fontdims[4], $fontdims[6]); $min_y = min($fontdims[1], $fontdims[3], $fontdims[5], $fontdims[7]); $max_y = max($fontdims[1], $fontdims[3], $fontdims[5], $fontdims[7]); $width = ($max_x - $min_x) + (2 * ERRFONTPADDING); $height = ($max_y - $min_y) + (2 * ERRFONTPADDING); $img = @imagecreate($width, $height); $bgcolor = imagecolorallocate($img, 255, 255, 255); $fgcolor = imagecolorallocate($img, 0, 0, 0); imagesetthickness($img, 2); // draw the border imagerectangle($img, 1, 1, $width - 2, $height - 2, $fgcolor); // print the text imagettftext($img, FONTSIZE, 0, ERRFONTPADDING, ERRFONTPADDING + 0.5 * $height, $fgcolor, FONTFILE, $err_message); header("Content-type: image/jpeg"); imagejpeg($img, "", 100);}/** * Writes the non-dynamic leading part of the HTML that makes up the statistics * page. Right now this is just a stub for future theme support. */function write_header(){?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head> <title>AMPS - AMule PHP Statistics</title> <link href="./style.css" rel="stylesheet" type="text/css"></head><body class="thebody"><p align="center"><table class="toplevel"><tr><td><?php}/** * Writes the non-dynamic trailing part of the HTML that makes up the statistics * page. Right now this is just a stub for future theme support. */function write_footer(){?></td></tr></table><p align="center"><i>Generated by AMPS version <?php echo VERSION; ?></i><br><i><a href="http://www.amule-project.net/">http://www.amule-project.net/</a></i><br><i><uberpenguin at hotpop dot com></i></body></html><?php}/** * Write out the stats to the browser. I will probably change this later on * to be themable, but for now I lack the motivation... */write_header();$ret = get_stats();if (!$ret) echo $text["sigfileerr"];else{ // html strings that are used over and over $nastring = "\t\t\t\t\t<td class=\"organize\">".$text["na"]. "</td>\n\t\t\t\t</tr>\n"; $titlecolstart = "\t\t\t\t<tr>\n\t\t\t\t\t<td class=\"organize\">"; $titlecolend = "</td>\n"; $datacolstart = "\t\t\t\t\t<td class=\"organize\">"; $datacolend = "</td>\n\t\t\t\t</tr>\n"; $sectiontablestart = "\t<table class=\"sec\">\n\t\t". "<tr class=\"secheader\">\n\t\t\t<td class=\"secheader\">"; $sectiontablenext = "</td>\n\t\t</tr>\n"; $sectionend = "\t\t\t</table>\n\t\t\t</td>\n\t\t</tr>\n\t</table>". "\n\t<p>\n"; $innertable = "\t\t<tr class=\"secbody\">\n\t\t\t". "<td class=\"secbody\">\n"; $organizetable = "\t\t\t<table class=\"organize\">\n"; // title echo "\t<table class=\"sec\">\n\t\t<tr class=\"secheader\">\n\t\t\t". "<td class=\"secheader\"><center><h2>AMPS - ". "AMule PHP Statistics</h2></center></td>\n\t\t</tr>\n\t". "</table>\n\t<p>\n"; // first section echo $sectiontablestart.$text["general"].$sectiontablenext; echo $innertable; echo $organizetable; // client info echo $titlecolstart.$text["client"].$titlecolend; if ($values["running"]) echo $datacolstart."aMule ".$values["muleversion"]." ". $text["runtimemsg"]." ".$values["psuptime"].$datacolend; else echo $datacolstart."aMule ".$text["norunmsg"].$datacolend; // ed2kstatus echo $titlecolstart.$text["ed2kstatus"].$titlecolend; if ($values["connected"] == "2") echo $datacolstart.$text["connecting"]; else if ($values["connected"] == "1") echo $datacolstart.$text["online"]; else echo $datacolstart.$text["offline"]; if (!$values["running"]) echo " ".$text["amulenorun"].$datacolend; else echo $datacolend; // kadstatus echo $titlecolstart.$text["kadstatus"].$titlecolend; if ($values["kad"] == "2") echo $datacolstart.$text["kadon"]; else if ($values["kad"] == "1") echo $datacolstart.$text["kadfw"]; else echo $datacolstart.$text["kadoff"]; if (!$values["running"]) echo " ".$text["amulenorun"].$datacolend; else echo $datacolend; // nick echo $titlecolstart.$text["nick"].$titlecolend; if ($values["running"]) echo $datacolstart.$values["nick"].$datacolend; else echo $nastring; // RFC 2282 datestamp echo $titlecolstart.$text["localtime"].$titlecolend; echo $datacolstart.date("r").$datacolend; // RX speed echo $titlecolstart.$text["rxspeed"].$titlecolend; if ($values["running"]) echo $datacolstart.$values["rxspeed"].$text["transrate"]. $datacolend; else echo $nastring; // TX speed echo $titlecolstart.$text["txspeed"].$titlecolend; if ($values["running"]) echo $datacolstart.$values["txspeed"].$text["transrate"]. $datacolend; else echo $nastring; // queued clients echo $titlecolstart.$text["queuedclients"].$titlecolend; if ($values["running"]) echo $datacolstart.$values["queuedclients"].$datacolend; else echo $nastring; // TX total echo $titlecolstart.$text["txtotal"].$titlecolend; if ($values["running"]) echo $datacolstart.round($values["txtotal"] / 1073741824, 2). $text["gigabytes"].$datacolend; else echo $nastring; // RX total echo $titlecolstart.$text["rxtotal"].$titlecolend; if ($values["running"]) echo $datacolstart.round($values["rxtotal"] / 1073741824, 2). $text["gigabytes"].$datacolend; else echo $nastring; // shared files echo $titlecolstart.$text["sharedfiles"].$titlecolend; if ($values["running"] && $values["connected"] == "1") echo $datacolstart.$values["sharedfiles"].$datacolend; else echo $nastring; // OS identification echo $titlecolstart.$text["osversion"].$titlecolend; echo $datacolstart.exec("uname -sr").$datacolend; // uptime echo $titlecolstart.$text["hostuptime"].$titlecolend; echo $datacolstart.exec("uptime").$datacolend; // break into next section echo $sectionend; echo $sectiontablestart.$text["server"].$sectiontablenext; echo $innertable; echo $organizetable; // server name echo $titlecolstart.$text["servername"].$titlecolend; if ($values["running"] && $values["connected"] == "1") echo $datacolstart.$values["servername"].$datacolend; else echo $nastring; // server IP:port echo $titlecolstart.$text["serveraddr"].$titlecolend; if ($values["running"] && $values["connected"] == "1") echo $datacolstart.$values["serverip"].":". $values["serverport"].$datacolend; else echo $nastring; // ED2K link echo $titlecolstart.$text["ed2klink"].$titlecolend; if ($values["running"] && $values["connected"] == "1") echo $datacolstart."<a href=\"ed2k://".$values["servername"]. "|".$values["serverip"]."|".$values["serverport"]. "|/\">ed2k://".$values["servername"]."|". $values["serverip"]."|".$values["serverport"]. "|/</a>".$datacolend; else echo $nastring; // break into next section echo $sectionend; echo $sectiontablestart.$text["signature"].$sectiontablenext; echo $innertable; echo $organizetable; // signature image global $lang; echo "\t\t\t\t<tr><td><a href=\"".$_SERVER['PHP_SELF']."?lang=".$lang."&sig_image\"><img border=\"0\"". "src=\"".$_SERVER['PHP_SELF']."?lang=".$lang."&sig_image\" alt=\"\"></a></td></tr>\n"; // language selection echo $sectionend; echo $sectiontablestart; echo "\n\t\t\t\t<form method=\"POST\" action=\"".$_SERVER['PHP_SELF']."\">\n\t\t\t\t\t". $text["language"].": <select name=\"lang\">\n"; foreach ($completelangs as $langcode) if ($langcode == $lang) echo "\t\t\t\t\t\t<option value=\"".$langcode."\" selected>".$langcode. "</option>\n"; else echo "\t\t\t\t\t\t<option value=\"".$langcode."\">".$langcode."</option>\n"; echo "\t\t\t\t\t</select>\n\t\t\t\t\t <input type=\"submit\" value=\"". $text["submit"]."\">\n\t\t\t\t</form>\n"; echo "\t\t\t</td>\n\t\t</tr>\n\t</table>";}write_footer();?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -