Merge branch '164-crash-on-patching-and-possibly-right-after-login' into 'main/atys...
[ryzomcore.git] / nelns / admin / public_html / html_headers.php
blobcb5a47e1f17da500e4051289d055011b3d6dedad
1 <?php
2 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
3 // Copyright (C) 2010 Winch Gate Property Limited
4 //
5 // This program is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU Affero General Public License as
7 // published by the Free Software Foundation, either version 3 of the
8 // License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Affero General Public License for more details.
15 // You should have received a copy of the GNU Affero General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
18 function addToLog($str)
20 global $adminLog;
21 $adminLog[] = $str;
24 function htmlProlog($rootFile, $title, $displayLinks = true, $addToHead = "")
26 echo "<html>\n";
27 echo "<head>\n";
28 echo "<title>$title</title>\n";
29 echo "<SCRIPT LANGUAGE=\"JavaScript\">\n";
30 echo "<!-- Begin\n";
31 echo "function helpPopup(file,topic) {\n";
32 echo "ElementWindow = window.open('help.php?file='+file+'&topic='+topic,'NeLToolHelpPopup','width=502,height=350,scrollbars=1')\n";
33 echo "}\n";
34 echo "function sqlPopup(sqlText) {\n";
35 echo "ElementWindow = window.open('sql_connection.php?queries='+sqlText,'NeLToolSqlPopup','width=800,height=350,scrollbars=1')\n";
36 echo "}\n";
37 echo "// End -->\n";
38 echo "</SCRIPT>\n";
39 echo $addToHead."\n";
40 echo "</head>\n";
41 echo "<style type=\"text/css\">\n";
42 echo "<!--\n";
43 echo "body { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; }\n";
44 echo "td { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; }\n";
45 echo "table { margin: 0px; padding: 0px; border-collapse: collapse; border-spacing: 0;}\n";
46 echo "th { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; }\n";
47 echo "input { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; }\n";
48 echo "textarea { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; width:98%; }\n";
49 echo "a:link { color: #000088; text-decoration: none; }\n";
50 echo "a:visited { color: #880088; text-decoration: none; }\n";
51 echo "a:active { color: #000033; text-decoration: none; }\n";
52 echo "a:hover { color: #8800CC; text-decoration: underline; }\n";
53 echo "-->\n";
54 echo "</style>\n";
55 echo "<body>\n";
57 global $admcookielogin, $admcookiepassword;
59 addToLog("admcookielogin=$admcookielogin admcookiepassword=$admcookiepassword");
60 addToLog("admlogin=$admcookielogin admcookiepassword=$admcookiepassword");
62 if ($displayLinks)
63 linkBar($title);
66 function htmlEpilog($logInfo = true)
68 global $HTTP_POST_VARS, $HTTP_GET_VARS, $sqlQueries, $nel_queries, $nel_updates, $admlogin, $allowrootdebug, $adminLog;
70 if ($admlogin == "root")
71 echo "<form method=post action='index.php'>Execute Raw NeL query : <input name=executeQuery size=80 maxlength=20480></form>\n";
73 if ($admlogin == "root" && $allowrootdebug && $logInfo)
75 if (isset($nel_queries) && count($nel_queries)>=1)
77 echo "<hr>NeL shard queries\n";
78 echo "<ul>\n";
79 foreach ($nel_queries as $query)
80 echo "<li>$query</li>\n";
81 echo "</ul>\n";
85 displayQueries();
87 echo "<hr><pre>HTTP_POST_VARS\n";
88 print_r($HTTP_POST_VARS);
89 echo "\nHTTP_GET_VAR\n";
90 print_r($HTTP_GET_VARS);
91 echo "</pre>\n";
93 if (is_array($adminLog))
95 echo "<hr>\n";
96 foreach ($adminLog as $log)
97 echo "$log<br>\n";
102 echo "<pre>";
103 print_r($GLOBALS);
104 echo "</pre>";
106 echo "</body>\n";
107 echo "</html>\n";
110 function button($text, $bdcolor="#888888", $bgcolor="#eeeeee")
112 return "<table border=0 cellspacing=0 cellpadding=1><tr><td bgcolor=$bdcolor><table border=0 cellspacing=0 cellpadding=2><tr valign=bottom><td bgcolor=$bgcolor height=21>&nbsp;$text&nbsp;</td></tr></table></td></tr></table>";
115 function linkBar($title)
117 global $admlogin, $group;
118 echo "<table width=100% cellpadding=0 cellspacing=0><tr>\n";
120 if (file_exists("./nel.gif"))
122 echo "<td width=40 align=center>";
123 echo "<a href='http://www.nevrax.org' border=0><img src='./nel.gif'></a>";
124 echo "</td>\n";
127 echo "<td>\n";
128 echo "<table cellpadding=1 cellspacing=0 border=0 bgcolor=#cccccc width=100%><tr height=100%>\n";
130 echo "<td align=left>";
131 echo "<table cellpadding=0 cellspacing=2 border=0><tr align=left height=100%>";
132 echo "<td>".button($title)."</td>";
133 echo "<td>".button("<b>$admlogin</b>/<b>$group</b> on ".$HTTP_HOST.$_SERVER['PHP_SELF'].helpLink("Main"))."</td>";
134 echo "</tr></table>";
135 echo "</td>\n";
137 echo "<td align=right>";
138 echo "<table cellpadding=0 cellspacing=2 border=0 height=20><tr align=right height=100%>\n";
139 echo "<td>".button("<a href='index.php'>Main page</a>")."</td>";
140 echo "<td>".button("<a href='custom_view.php'>Custom View</a>")."</td>";
141 echo "<td>".button("<a href='player_locator.php'>Player Locator</a>")."</td>";
142 echo "<td>".button("<a href='las_interface.php'>Log Analysis</a>")."</td>";
143 echo "<td>".button("<a href='prefs.php'>Preferences</a>")."</td>";
144 if ($admlogin == "root" || strtolower($group) == "nevraxgroup")
146 echo "<td>".button("<a href='commands.php'>Commands</a>")."</td>";
148 if ($admlogin == "root")
150 echo "<td>".button("<a href='admin.php'>Administration</a>")."</td>";
152 echo "<td>".button("<a href='index.php?command=logout'>Logout</a>")."</td>";
153 echo "</tr></table>";
154 echo "</td>\n";
156 echo "</tr></table>\n";
157 echo "</td></tr></table>\n";
160 function subBar($menus)
162 echo "<table cellpadding=1 cellspacing=0 border=0 width=100%><tr><td align=right><table cellpadding=0 cellspacing=2 border=0><tr align=right>\n";
163 foreach($menus as $name => $url)
164 echo "<td>".button("<a href='$url'>$name</a>")."</td>";
165 echo "\n</tr></table></tr></td></table>\n";
168 function getFileRoot($name)
170 $n = basename($name);
171 $pos = strrpos($n, ".");
172 if ($pos === NULL)
173 return $n;
174 return substr($n, 0, $pos);
177 function helpLink($topic)
179 return "<a href='javascript:helpPopup(\"".getFileRoot($_SERVER['PHP_SELF'])."\",\"$topic\")'><sup>+</sup></a>";
182 function help($topic)
184 return helpLink($topic);
187 function helpCommon($topic)
189 return "<a href='javascript:helpPopup(\"common\",\"$topic\")'><sup>+</sup></a>";
192 function helpAll($directory, $topic)
194 return "<a href='javascript:helpPopup(\"$directory\",\"$topic\")'><sup>+</sup></a>";
197 function getVar($name)
199 if(isset($_POST[$name])) return $_POST[$name];
200 else if(isset($_GET[$name])) return $_GET[$name];