| 1 | <?php | <> | 1 | <?php // $Id: admin.php,v 1.8 2003/11/15 19:05:22 EllselAn Exp $ |
| 2 | = | |||
| 3 | /************************************************************************/ | <> | 2 | /**********************************************************************/ |
| 4 | /* PHP-NUKE: Advanced Content Management System */ | 3 | /* vkpMx 2.0 Content Management System Platform */ | |
| 5 | /* ============================================ */ | 4 | /* ================================================================== */ | |
| 6 | /* */ | 5 | /* Copyright (C) 2003 by the vkpMx & pragmaMx Developer Team */ | |
| 7 | /* Copyright (c) 2002 by Francisco Burzi (fbc@mandrakesoft.com) */ | 6 | /* email: team@pragmamx.org */ | |
| 8 | /* http://phpnuke.org */ | 7 | /* homepage: http://www.maax-design.de */ | |
| 9 | /* */ | 8 | /* further sites: http://www.pragmaMx.org, http://www.guggemahier.de, */ | |
| 10 | /* This program is free software. You can redistribute it and/or modify */ | 9 | /* http://www.marx-city.de, http://www.genutec-studios.de, */ | |
| 11 | /* it under the terms of the GNU General Public License as published by */ | 10 | /* http://www.shiba-design.de, http://www.power-maax.de */ | |
| 12 | /* the Free Software Foundation; either version 2 of the License. */ | 11 | /* ================================================================== */ | |
| 12 | /* The vkpMx is distributed free of charge by maax-design.de. */ | |||
| 13 | /* The use of this system is allowed until copyright information */ | |||
| 14 | /* is shown perspicuous visible and correcty on all system pages. */ | |||
| 15 | /* Sales, rent out and the use of single code parts from this */ | |||
| 16 | /* system must be allowed by maax-design.de. */ | |||
| 13 | /************************************************************************/ | 17 | /**********************************************************************/ | |
| 14 | = | |||
| 15 | require_once("mainfile.php"); | <> | 18 | define("mxAdminFileLoaded","1"); |
| 16 | get_lang(admin); | |||
| 17 | = | 19 | ||
| 18 | function create_first($name, $url, $email, $pwd, $user) { | <> | 20 | if(!defined("MX_TIME")) { |
| 19 | global $prefix, $dbi, $user_prefix; | 21 | $vstarttime = explode(" ",microtime()); | |
| 20 | $first = sql_num_rows(sql_query("select * from ".$prefix."_authors", $dbi),$dbi); | 22 | define("MX_TIME",(float)$vstarttime[1] + (float)$vstarttime[0]); | |
| 21 | if ($first == 0) { | |||
| 22 | $pwd = md5($pwd); | |||
| 23 | $the_adm = "God"; | |||
| 24 | $result = sql_query("insert into ".$prefix."_authors values ('$name', '$the_adm', '$url', '$email', '$pwd', 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, '')", $dbi); | |||
| 25 | if ($user == 1) { | 23 | unset($vstarttime); | |
| 26 | $user_regdate = date("M d, Y"); | |||
| 27 | $user_avatar = "blank.gif"; | |||
| 28 | $commentlimit = 4096; | |||
| 29 | $result = sql_query("insert into ".$user_prefix."_users values (NULL,'','$name','$email','','$url','$user_avatar','$user_regdate','','','','','','0','','','','','$pwd',10,'','0','0','0','','0','','$Default_Theme','$commentlimit','0','0','0','0','0','1')", $dbi); | |||
| 30 | } | = | 24 | } |
| 31 | login(); | <> | 25 | // nur zum initialisieren der Variablen, wird durch das Modul überschrieben |
| 32 | } | 26 | $GLOBALS['index'] = 0; | |
| 33 | } | |||
| 34 | = | 27 | ||
| 35 | $the_first = sql_num_rows(sql_query("select * from ".$prefix."_authors", $dbi), $dbi); | <> | ||
| 36 | if ($the_first == 0) { | |||
| 37 | if (!$name) { | |||
| 38 | include("header.php"); | 28 | require_once("mainfile.php"); | |
| 39 | title("$sitename: "._ADMINISTRATION.""); | 29 | if (basename(__file__) != basename($_SERVER['PHP_SELF'])) { | |
| 40 | OpenTable(); | 30 | echo "<b>Error:</b><br><br>Bad Server/PHP-Settings the \"\$_SERVER['PHP_SELF']\" variable is not correct.<br>Please contact your provider to fix it.<br><br>Current setting is: ".$_SERVER['PHP_SELF']."<br>Must be: ".MX_BASE_URI."/".basename(__file__).""; | |
| 41 | echo "<center><b>"._NOADMINYET."</b></center><br><br>" | |||
| 42 | ."<form action=\"admin.php\" method=\"post\">" | |||
| 43 | ."<table border=\"0\">" | |||
| 44 | ."<tr><td><b>"._NICKNAME.":</b></td><td><input type=\"text\" name=\"name\" size=\"30\" maxlength=\"25\"></td></tr>" | |||
| 45 | ."<tr><td><b>"._HOMEPAGE.":</b></td><td><input type=\"text\" name=\"url\" size=\"30\" maxlength=\"255\" value=\"http://\"></td></tr>" | |||
| 46 | ."<tr><td><b>"._EMAIL.":</b></td><td><input type=\"text\" name=\"email\" size=\"30\" maxlength=\"255\"></td></tr>" | |||
| 47 | ."<tr><td><b>"._PASSWORD.":</b></td><td><input type=\"password\" name=\"pwd\" size=\"11\" maxlength=\"10\"></td></tr>" | |||
| 48 | ."<tr><td colspan=\"2\">"._CREATEUSERDATA." <input type=\"radio\" name=\"user\" value=\"1\" checked>"._YES." <input type=\"radio\" name=\"user\" value=\"0\">"._NO."</td></tr>" | |||
| 49 | ."<tr><td><input type=\"hidden\" name=\"fop\" value=\"create_first\">" | |||
| 50 | ."<input type=\"submit\" value=\""._SUBMIT."\">" | |||
| 51 | ."</td></tr></table></form>"; | |||
| 52 | CloseTable(); | |||
| 53 | include("footer.php"); | |||
| 54 | } | |||
| 55 | switch($fop) { | |||
| 56 | case "create_first": | |||
| 57 | create_first($name, $url, $email, $pwd, $user); | |||
| 58 | break; | |||
| 59 | } | |||
| 60 | die(); | |||
| 61 | } | 31 | } | |
| 62 | 32 | mxGetLangfile("admin"); | ||
| 63 | require("auth.php"); | |||
| 64 | = | 33 | ||
| 65 | if(!isset($op)) { $op = "adminMain"; } | +- | ||
| 66 | $pagetitle = "- "._ADMINMENU.""; | = | 34 | $pagetitle = "- "._ADMINMENU.""; |
| 67 | 35 | |||
| 68 | /*********************************************************/ | <> | 36 | ################################################################################ |
| 69 | /* Login Function */ | |||
| 70 | /*********************************************************/ | |||
| 71 | = | |||
| 72 | function login() { | 37 | function login() { | |
| <> | 38 | if (defined("MX_CO_ERROR")) { | ||
| 39 | mxErrorScreen(_ADMIN_BADLOGIN3); | |||
| 40 | } | |||
| 41 | mt_srand((double)microtime()*1000000); | |||
| 42 | $xcv = mt_rand(); | |||
| 43 | mxSessionSetVar("reqcheck", $xcv); | |||
| 44 | $formmessage = mxSessionGetVar("formmessage"); | |||
| 45 | mxSessionDelVar("formmessage"); | |||
| 73 | include ("header.php"); | 46 | include ("header.php"); | |
| 74 | OpenTable(); | 47 | OpenTable(); | |
| 75 | echo "<center><font class=\"title\"><b>"._ADMINLOGIN."</b></font></center>"; | 48 | echo "<center><font class=\"title\"><b>"._ADMINLOGIN."</b></font></center>"; | |
| 76 | CloseTable(); | 49 | CloseTable(); | |
| 77 | echo "<br>"; | 50 | echo "<br>"; | |
| 78 | OpenTable(); | 51 | OpenTable(); | |
| 52 | if ($formmessage) { | |||
| 53 | echo "<br>".$formmessage."<br><br>"; | |||
| 54 | } | |||
| 79 | echo "<form action=\"admin.php\" method=\"post\">" | 55 | echo "<form action=\"admin.php\" method=\"post\" name=\"adminlogin\">" | |
| 80 | ."<table border=\"0\">" | 56 | ."<table border=\"0\">" | |
| 81 | ."<tr><td>"._ADMINID."</td>" | = | 57 | ."<tr><td>"._ADMINID."</td>" |
| 82 | ."<td><input type=\"text\" NAME=\"aid\" SIZE=\"20\" MAXLENGTH=\"20\"></td></tr>" | <> | 58 | ."<td><input type=\"text\" NAME=\"aid\" size=\"30\" maxlength=\"25\"></td></tr>" |
| 83 | ."<tr><td>"._PASSWORD."</td>" | = | 59 | ."<tr><td>"._PASSWORD."</td>" |
| 84 | ."<td><input type=\"password\" NAME=\"pwd\" SIZE=\"20\" MAXLENGTH=\"18\"></td></tr>" | <> | 60 | ."<td><input type=\"password\" NAME=\"pwd\" size=\"30\" maxlength=\"20\"></td></tr>" |
| 85 | ."<tr><td>" | = | 61 | ."<tr><td>" |
| 86 | ."<input type=\"hidden\" NAME=\"op\" value=\"login\">" | 62 | ."<input type=\"hidden\" NAME=\"op\" value=\"login\">" | |
| -+ | 63 | ."<input type=\"hidden\" NAME=\"check\" value=\"".MD5($xcv)."\">" | ||
| 64 | ."<input type=\"hidden\" NAME=\"sess\" value=\"".MD5(session_id())."\">" | |||
| 87 | ."<input type=\"submit\" VALUE=\""._LOGIN."\">" | = | 65 | ."<input type=\"submit\" VALUE=\""._LOGIN."\">" |
| 88 | ."</td></tr></table>" | 66 | ."</td></tr></table>" | |
| 89 | ."</form>"; | 67 | ."</form>"; | |
| <> | 68 | echo "<script language='JavaScript' type='text/javascript'>\n<!--\ndocument.adminlogin.aid.focus();\n//-->\n</script>"; | ||
| 90 | CloseTable(); | 69 | CloseTable(); | |
| 91 | include ("footer.php"); | 70 | include ("footer.php"); | |
| 92 | } | 71 | } | |
| 93 | = | 72 | ||
| -+ | 73 | ################################################################################## | ||
| 94 | function deleteNotice($id, $table, $op_back) { | = | 74 | function deleteNotice($id, $table, $op_back) { |
| 95 | global $dbi; | <> | 75 | sql_query("DELETE FROM $table WHERE id = $id"); |
| 96 | sql_query("delete from $table WHERE id = $id", $dbi); | |||
| 97 | Header("Location: admin.php?op=$op_back"); | 76 | Header("Location: admin.php?op=$op_back"); | |
| 98 | } | 77 | } | |
| 99 | = | 78 | ||
| 100 | /*********************************************************/ | <> | 79 | ################################################################################## |
| 101 | /* Administration Menu Function */ | |||
| 102 | /*********************************************************/ | |||
| 103 | = | |||
| 104 | function adminmenu($url, $title, $image) { | <> | 80 | function adminmenu($url, $title, $image, $target="_self") { |
| 105 | global $counter, $admingraphic; | 81 | global $myxlink, $admingraphic; | |
| 106 | if ($admingraphic == 1) { | 82 | if ($admingraphic) { | |
| 107 | $img = "<img src=\"images/admin/$image\" border=\"0\" alt=\"\"></a><br>"; | 83 | $img = mxCreateImage("images/admin/$image", strip_tags($title))."<br>"; | |
| 84 | $align=" align=\"center\""; | |||
| 108 | $close = ""; | 85 | } | |
| 109 | } else { | 86 | else { | |
| 110 | $image = ""; | 87 | $img = ""; | |
| 111 | $close = "</a>"; | 88 | $align=""; | |
| 112 | } | 89 | } | |
| 113 | echo "<td align=\"center\"><font class=\"content\"><a href=\"$url\">$img<b>$title</b>$close</font></td>"; | 90 | $output="<td $align><font class=\"content\"><a href=\"$url\" target=\"$target\">$img $title </a></font></td>"; # neu!! | |
| 114 | if ($counter == 5) { | 91 | # aus dem Titel und dem generierten Link/Grafik einen gemeinsamen String generieren | |
| 115 | echo "</tr><tr>"; | 92 | # Teil 1 wird zum Sortieren benoetigt, Teil 2 ist die eigentliche Ausgabe | |
| 116 | $counter = 0; | 93 | $myxlink=$title."@".$output; # neu!! | |
| 117 | } else { | |||
| 118 | $counter++; | |||
| 119 | } | |||
| 120 | } | 94 | } | |
| 121 | = | 95 | ||
| -+ | 96 | ################################################################################## | ||
| 122 | function GraphicAdmin() { | = | 97 | function GraphicAdmin() { |
| 123 | global $aid, $admingraphic, $language, $admin, $banners, $prefix, $dbi; | <> | 98 | global $aid, $admingraphic, $language, $admin, $banners, $bannersfsz, $prefix, $op; |
| 124 | $result = sql_query("SELECT qid FROM ".$prefix."_queue", $dbi); | 99 | global $myxlink; # temporaere Variable erstellen, wird in adminmenu() veraendert | |
| 125 | $newsubs = sql_num_rows($result, $dbi); | 100 | if(empty($op)) $op="adminMain"; | |
| 126 | $result = sql_query("select radminarticle,radmintopic,radminuser,radminsurvey,radminsection,radminlink,radminephem,radminfaq,radmindownload,radminreviews,radminnewsletter,radminforum,radmincontent,radminency,radminsuper from ".$prefix."_authors where aid='$aid'", $dbi); | 101 | $result = sql_query("select * from ${prefix}_authors where aid='$aid'"); | |
| 127 | list($radminarticle,$radmintopic,$radminuser,$radminsurvey,$radminsection,$radminlink,$radminephem,$radminfaq,$radmindownload,$radminreviews,$radminnewsletter,$radminforum,$radmincontent,$radminency,$radminsuper) = sql_fetch_array($result, $dbi); | 102 | $admindata = sql_fetch_array($result); | |
| 103 | extract($admindata); | |||
| 128 | OpenTable(); | 104 | OpenTable(); | |
| 129 | echo "<center><b><a class=\"storycat\" href=\"admin.php\">"._ADMINMENU."</a></b>"; | 105 | echo "<center>"; | |
| 130 | if ($radminsuper==1) { | 106 | echo"<table border=\"0\" cellspacing=\"0\" cellpadding=\"3\"><tr valign=\"top\">"; | |
| 131 | echo" <b><a class=\"storycat\" href=\"admin.php?op=BannersAdmin\">"._BANNERSADMIN."</a></b>"; | |||
| 132 | } | 107 | $menulist=""; | |
| 133 | echo "<br><br>"; | |||
| 134 | echo"<table border=\"0\" width=\"100%\" cellspacing=\"1\"><tr>"; | |||
| 135 | $linksdir = dir("admin/links"); | 108 | $linksdir = dir("admin/links"); | |
| 109 | $handle=opendir("admin/links"); # Ordner oeffnen | |||
| 136 | while($func=$linksdir->read()) { | 110 | $thelinks = array(); | |
| 137 | if(substr($func, 0, 6) == "links.") { | 111 | while ($linkfile = readdir($handle)) { # alle Dateien des Ordners durchlaufen | |
| 138 | $menulist .= "$func "; | 112 | if(substr($linkfile, 0, 6) == "links.") { # nur bestimmte Dateien ansprechen | |
| 113 | include_once("admin/links/".$linkfile); # Datei einlesen, hier wird jeweils die funktion adminmenu() ausgefuehrt | |||
| 114 | $thelinks[]=$myxlink; # array mit der veraenderten Variablen fuellen | |||
| 139 | } | 115 | } | |
| 116 | $myxlink=""; # temporaere Variable zuruecksetzen | |||
| 140 | } | 117 | } | |
| 141 | closedir($linksdir->handle); | 118 | $counter = 0; # counter initialisieren | |
| 142 | $menulist = explode(" ", $menulist); | 119 | natsort($thelinks); # array alphabetisch nach Titel sortieren | |
| 120 | $myxlink=""; # temporaere Variable nochmals zuruecksetzen | |||
| 121 | adminmenu("admin.php?op=logout", ""._ADMINLOGOUT."", "exit.gif"); # zusaetzlichen Logout Button erzeugen | |||
| 122 | $thelinks[]=$myxlink; # und an array anfuegen (am Ende) | |||
| 143 | sort($menulist); | 123 | ||
| 144 | for ($i=0; $i < sizeof($menulist); $i++) { | 124 | while (list ($key, $xlinkfile) = each ($thelinks)) { # sortiertes array durchlaufen | |
| 125 | $xlinkfile2=explode("@",$xlinkfile); # den in adminmenu() erzeugten String trennen | |||
| 126 | if(!empty($xlinkfile2[1])){ # nur wenn Link auch angezeigt werden soll (Adminberechtigung) | |||
| 127 | $linkfile=$xlinkfile2[1]; # daraus nur den Link/die Grafik verwenden | |||
| 128 | if ($counter == 5) { # wenn 5x durchlaufen | |||
| 129 | $linkfile="".$linkfile."</tr><tr valign=\"top\">"; # neue Tabellenzeile beginnen | |||
| 130 | $counter = 0; # und counter wieder auf 0 | |||
| 131 | } | |||
| 145 | if($menulist[$i]!="") { | 132 | else { | |
| 133 | $counter++; # ansonsten counter erhoehen | |||
| 146 | $counter = 0; | 134 | } | |
| 147 | include($linksdir->path."/$menulist[$i]"); | 135 | echo $linkfile; # das war's, Link/Grafik in Tabellenzelle anzeigen | |
| 148 | } | 136 | } | |
| 149 | } | 137 | } | |
| 150 | adminmenu("admin.php?op=logout", ""._ADMINLOGOUT."", "exit.gif"); | 138 | if ($counter>0 && $counter<6) { | |
| 139 | echo "<td colspan='".(6-$counter)."'> </td>"; | |||
| 140 | } | |||
| 151 | echo"</tr></table></center>"; | 141 | echo"</tr></table></center>"; | |
| 152 | CloseTable(); | 142 | CloseTable(); | |
| 153 | echo "<br>"; | 143 | echo "<br>"; | |
| 154 | } | 144 | } | |
| 155 | = | 145 | ||
| 156 | /*********************************************************/ | <> | 146 | ################################################################################## |
| 157 | /* Administration Main Function */ | |||
| 158 | /*********************************************************/ | |||
| 159 | = | |||
| 160 | function adminMain() { | 147 | function adminMain() { | |
| 161 | global $language, $admin, $aid, $prefix, $file, $dbi, $sitename; | <> | 148 | global $language, $admin, $aid, $prefix, $user_prefix, $file, $sitename, $bgcolor1,$bgcolor2, $bgcolor5; |
| 162 | include ("header.php"); | 149 | include ("header.php"); | |
| 150 | $queryalang = (empty($queryalang)) ? "" : $queryalang; | |||
| 163 | $dummy = 0; | 151 | $dummy = 0; | |
| 164 | GraphicAdmin(); | 152 | GraphicAdmin(); | |
| 165 | $result2 = sql_query("select radminarticle, radminsuper, admlanguage from ".$prefix."_authors where aid='$aid'", $dbi); | 153 | $content1 = ""; | |
| 166 | list($radminarticle, $radminsuper, $admlanguage) = sql_fetch_row($result2, $dbi); | 154 | if($GLOBALS['vkpUserregoption']==2){ | |
| 167 | if ($admlanguage != "" ) { | 155 | list($num) = sql_fetch_row(sql_query("select count(uid) from ${user_prefix}_users WHERE user_stat=0")); | |
| 168 | $queryalang = "WHERE alanguage='$admlanguage' "; | 156 | if(!empty($num)) $content1 .= "<tr><td><img src=\"images/menu/oarrow.gif\" alt=\"\" border=\"0\"> <b>$num</b> <a href=\"admin.php?op=mod_users\">"._AB_NEWUSERS."</a></td></tr>"; | |
| 157 | $num=0; | |||
| 169 | } else { | 158 | } | |
| 159 | list($num) = sql_fetch_row(sql_query("select count(qid) from ${prefix}_queue")); | |||
| 160 | if(!empty($num)) $content1 .= "<tr><td><img src=\"images/menu/oarrow.gif\" alt=\"\" border=\"0\"> <b>$num</b> <a href=\"admin.php?op=submissions\">"._AB_SUBMISSIONS."</a></td></tr>"; | |||
| 170 | $queryalang = ""; | 161 | $num=0; | |
| 162 | list($num) = sql_fetch_row(sql_query("select count(id) from ${prefix}_reviews WHERE active='0';")); | |||
| 163 | if(!empty($num)) $content1 .= "<tr><td><img src=\"images/menu/oarrow.gif\" alt=\"\" border=\"0\"> <b>$num</b> <a href=\"admin.php?op=reviews\">"._WREVIEWS."</a></td></tr>"; | |||
| 171 | } | 164 | $num=0; | |
| 172 | $main_m = sql_query("select main_module from ".$prefix."_main", $dbi); | 165 | list($num) = sql_fetch_row(sql_query("select count(lid) from ${prefix}_links_newlink;")); | |
| 173 | list($main_module) = sql_fetch_row($main_m, $dbi); | 166 | if(!empty($num)) $content1 .= "<tr><td><img src=\"images/menu/oarrow.gif\" alt=\"\" border=\"0\"> <b>$num</b> <a href=\"admin.php?op=Links\">"._AB_WLINKS."</a></td></tr>"; | |
| 174 | OpenTable(); | 167 | $num=0; | |
| 175 | echo "<center><b>$sitename: "._DEFHOMEMODULE."</b><br><br>" | 168 | list($num) = sql_fetch_row(sql_query("select count(requestid) from ${prefix}_links_modrequest where brokenlink=0;")); | |
| 176 | .""._MODULEINHOME." <b>$main_module</b><br>[ <a href=\"admin.php?op=modules\">"._CHANGE."</a> ]</center>"; | 169 | if(!empty($num)) $content1 .= "<tr><td><img src=\"images/menu/oarrow.gif\" alt=\"\" border=\"0\"> <b>$num</b> <a href=\"admin.php?op=LinksListModRequests\">"._AB_MODREQLINKS."</a></td></tr>"; | |
| 177 | CloseTable(); | 170 | $num=0; | |
| 178 | echo "<br>"; | 171 | list($num) = sql_fetch_row(sql_query("select count(requestid) from ${prefix}_links_modrequest where brokenlink=1;")); | |
| 172 | if(!empty($num)) $content1 .= "<tr><td><img src=\"images/menu/oarrow.gif\" alt=\"\" border=\"0\"> <b>$num</b> <a href=\"admin.php?op=LinksListBrokenLinks\">"._AB_BROKENLINKS."</a></td></tr>"; | |||
| 179 | OpenTable(); | 173 | $num=0; | |
| 180 | $result = sql_query("SELECT username FROM ".$prefix."_session where guest=1", $dbi); | 174 | list($num) = sql_fetch_row(sql_query("select count(lid) from ${prefix}_downloads_newdownload")); | |
| 181 | $guest_online_num = sql_num_rows($result, $dbi); | 175 | if(!empty($num)) $content1 .= "<tr><td><img src=\"images/menu/oarrow.gif\" alt=\"\" border=\"0\"> <b>$num</b> <a href=\"admin.php?op=downloads\">"._AB_UDOWNLOADS."</a></td></tr>"; | |
| 182 | $result = sql_query("SELECT username FROM ".$prefix."_session where guest=0", $dbi); | 176 | $num=0; | |
| 183 | $member_online_num = sql_num_rows($result, $dbi); | 177 | list($num) = sql_fetch_row(sql_query("select count(requestid) from ${prefix}_downloads_modrequest where brokendownload=0;")); | |
| 184 | $who_online_num = $guest_online_num + $member_online_num; | 178 | if(!empty($num)) $content1 .= "<tr><td><img src=\"images/menu/oarrow.gif\" alt=\"\" border=\"0\"> <b>$num</b> <a href=\"admin.php?op=DownloadsListModRequests\">"._AB_MODREQDOWN."</a></td></tr>"; | |
| 185 | $who_online = "<center><font class=\"option\">"._WHOSONLINE."</font><br><br><font class=\"content\">"._CURRENTLY." $guest_online_num "._GUESTS." $member_online_num "._MEMBERS."<br>"; | 179 | $num=0; | |
| 186 | echo "<center>$who_online</center>"; | 180 | list($num) = sql_fetch_row(sql_query("select count(requestid) from ${prefix}_downloads_modrequest where brokendownload=1;")); | |
| 187 | CloseTable(); | 181 | if(!empty($num)) $content1 .= "<tr><td><img src=\"images/menu/oarrow.gif\" alt=\"\" border=\"0\"> <b>$num</b> <a href=\"admin.php?op=DownloadsListBrokenDownloads\">"._AB_BROKENDOWN."</a></td></tr>"; | |
| 188 | echo "<br>"; | 182 | $num=0; | |
| 189 | OpenTable(); | 183 | list($num) = sql_fetch_row(sql_query("select count(pid) from ${prefix}_gallery_pictures_newpicture;")); | |
| 190 | echo "<center><b>"._AUTOMATEDARTICLES."</b></center><br>"; | 184 | if(!empty($num)) $content1 .= "<tr><td><img src=\"images/menu/oarrow.gif\" alt=\"\" border=\"0\"> <b>$num</b> <a href=\"admin.php?op=GallAdmin\">"._AB_PICTURES."</a></td></tr>"; | |
| 191 | $count = 0; | 185 | $num=0; | |
| 192 | $result = sql_query("select anid, aid, title, time, alanguage from ".$prefix."_autonews $queryalang order by time ASC", $dbi); | 186 | list($num) = sql_fetch_row(sql_query("SELECT Count(eid) FROM ${prefix}_events WHERE activ=0;")); | |
| 193 | while(list($anid, $said, $title, $time, $alanguage) = sql_fetch_row($result, $dbi)) { | 187 | if(!empty($num)) $content1 .= "<tr><td><img src=\"images/menu/oarrow.gif\" alt=\"\" border=\"0\"> <b>$num</b> <a href=\"admin.php?op=CalendarAdmin\">"._AB_EVENTS."</a></td></tr>"; | |
| 194 | if ($alanguage == "") { | 188 | $num=0; | |
| 195 | $alanguage = ""._ALL.""; | 189 | list($num) = sql_fetch_row(sql_query("select count(faq_id) from ${prefix}_faqnew;")); | |
| 190 | if(!empty($num)) $content1 .= "<tr><td><img src=\"images/menu/oarrow.gif\" alt=\"\" border=\"0\"> <b>$num</b> <a href=\"admin.php?op=FaqAnswerNew\">"._NEWADD2."</a></td></tr>"; | |||
| 196 | } | 191 | $num=0; | |
| 192 | list($num) = sql_fetch_row(sql_query("select count(id) from ${prefix}_nukebook_queue;")); | |||
| 193 | if(!empty($num)) $content1 .= "<tr><td><img src=\"images/menu/oarrow.gif\" alt=\"\" border=\"0\"> <b>$num</b> <a href=\"admin.php?op=NukebookAdmin\">"._GUESTBOOK."</a></td></tr>"; | |||
| 197 | if ($anid != "") { | 194 | $num=0; | |
| 195 | if (mxModuleAllowed("Webring")) { | |||
| 198 | if ($count == 0) { | 196 | $num=0; | |
| 199 | echo "<table border=\"1\" width=\"100%\">"; | 197 | list($num) = sql_fetch_row(sql_query("select count(ringid) from ${prefix}_webring where activ=0;")); | |
| 198 | if(!empty($num)) $content1 .= "<tr><td><img src=\"images/menu/oarrow.gif\" alt=\"\" border=\"0\"> <b>$num</b> <a href=\"modules.php?name=Webring&ring=1&file=index&mode=adminNewentry\">"._AB_WEBRING."</a></td></tr>"; | |||
| 200 | $count = 1; | 199 | } | |
| 201 | } | 200 | ||
| 202 | $time = ereg_replace(" ", "@", $time); | 201 | OpenTable2(); | |
| 203 | if (($radminarticle==1) OR ($radminsuper==1)) { | 202 | echo "<center>"; | |
| 204 | if (($radminarticle==1) AND ($aid == $said) OR ($radminsuper==1)) { | 203 | if ($content1) { | |
| 205 | echo "<tr><td nowrap> (<a href=\"admin.php?op=autoEdit&anid=$anid\">"._EDIT."</a>-<a href=\"admin.php?op=autoDelete&anid=$anid\">"._DELETE."</a>) </td><td width=\"100%\"> $title </td><td align=\"center\"> $alanguage </td><td nowrap> $time </td></tr>"; /* Multilingual Code : added column to display language */ | 204 | echo "<font class=\"title\">"._NEWSUBMISSIONS."</font><br><table border='0' cellpadding='5'>"; | |
| 206 | } else { | 205 | echo $content1; | |
| 207 | echo "<tr><td> ("._NOFUNCTIONS.") </td><td width=\"100%\"> $title </td><td align=\"center\"> $alanguage </td><td nowrap> $time </td></tr>"; /* Multilingual Code : added column to display language */ | 206 | echo "</table>"; | |
| 208 | } | = | 207 | } |
| 209 | } else { | <> | 208 | else { |
| 210 | echo "<tr><td width=\"100%\"> $title </td><td align=\"center\"> $alanguage </td><td nowrap> $time </td></tr>"; /* Multilingual Code : added column to display language */ | 209 | echo "<font class=\"title\">"._NOSUBMISSIONS."</font>"; | |
| 211 | } | 210 | } | |
| 211 | echo "</center>"; | |||
| 212 | CloseTable2(); | |||
| = | 213 | |||
| -+ | 214 | echo "<br>"; | ||
| 215 | list($mysqlversion) = sql_fetch_row(sql_query("SELECT VERSION() as version")); | |||
| 216 | OpenTable(); | |||
| 217 | echo "<table width='100%' border='0' cellspacing='1' cellpadding='2' bgcolor='$bgcolor2'>"; | |||
| 218 | echo "<tr valign='top' bgcolor=\"$bgcolor1\">\n"; | |||
| 219 | echo "<td><b>CMS-Version:</b></td>\n"; | |||
| 220 | echo "<td><b>PHP-Version:</b></td>\n"; | |||
| 221 | echo "<td><b>MySQL-Version:</b></td>"; | |||
| 222 | echo "<td><b>Server-Version:</b></td>\n"; | |||
| 223 | echo "</tr>\n"; | |||
| 224 | echo "<tr valign='top' bgcolor=\"$bgcolor1\">\n"; | |||
| 225 | echo "<td>".MX_VERSION.", ".MX_VERSION_SUB.", ".MX_CRYPTING."</td>\n"; | |||
| 226 | echo "<td>".phpversion()."</td>\n"; | |||
| 227 | echo "<td>".$mysqlversion."</td>"; | |||
| 228 | echo "<td>".getenv('SERVER_SOFTWARE')."</td>\n"; | |||
| 229 | echo "</tr>\n"; | |||
| 230 | echo "</table>"; | |||
| 231 | CloseTable(); | |||
| 232 | echo "<br>"; | |||
| 233 | include ("footer.php"); | |||
| 212 | } | = | 234 | } |
| 213 | } | <> | 235 | |
| 214 | if (($anid == "") AND ($count == 0)) { | 236 | ################################################################################## | |
| 215 | echo "<center><i>"._NOAUTOARTICLES."</i></center>"; | 237 | function mxAdminLanguageSelect($name, $curlang="", $hideall=0) { | |
| 238 | $handle = opendir('language'); | |||
| 239 | while ($file = readdir($handle)) { | |||
| 240 | if (preg_match("/^lang\-(.+)\.php/", $file, $matches)) { | |||
| 241 | $languageslist[] = $matches[1]; | |||
| 216 | } | 242 | } | |
| 217 | if ($count == 1) { | |||
| 218 | echo "</table>"; | |||
| 219 | } | 243 | } | |
| 220 | CloseTable(); | 244 | closedir($handle); | |
| 245 | sort($languageslist); | |||
| 221 | echo "<br>"; | 246 | $options = ""; | |
| 247 | foreach($languageslist as $lang) { | |||
| 222 | OpenTable(); | 248 | if(!empty($lang)) { | |
| 223 | echo "<center><b>"._LAST." 20 "._ARTICLES."</b></center><br>"; | 249 | $sel = ($lang == $curlang) ? "selected" : ""; | |
| 224 | $result = sql_query("select sid, aid, title, time, topic, informant, alanguage from ".$prefix."_stories $queryalang order by time desc limit 0,20", $dbi); | 250 | $options .= "<option value=\"$lang\" $sel>".ucfirst($lang)."</option>\n"; | |
| 225 | echo "<center><table border=\"1\" width=\"100%\" bgcolor=\"$bgcolor1\">"; | 251 | } | |
| 226 | while(list($sid, $said, $title, $time, $topic, $informant, $alanguage) = sql_fetch_row($result, $dbi)) { | 252 | } | |
| 227 | $ta = sql_query("select topicname from ".$prefix."_topics where topicid=$topic", $dbi); | 253 | if (empty($hideall)) { | |
| 228 | list($topicname) = sql_fetch_row($ta, $dbi); | 254 | $sel = ($lang == $curlang) ? "selected" : ""; | |
| 255 | $options = "<option value=\"\"> "._ALL."</option>\n".$options.""; | |||
| 229 | if ($alanguage == "") { | 256 | } | |
| 230 | $alanguage = ""._ALL.""; | 257 | $out = "<select name=\"".$name."\">\n".$options."</select>\n"; | |
| 258 | return $out; | |||
| 231 | } | = | 259 | } |
| 232 | formatTimestamp($time); | <> | 260 | |
| 233 | echo "<tr><td align=\"right\"><b>$sid</b>" | 261 | ################################################################################## | |
| 234 | ."</td><td align=\"left\" width=\"100%\"><a href=\"modules.php?name=News&file=article&sid=$sid\">$title</a>" | 262 | # zeigt nach erfolgreichem einloggen eine Auswahlseite | |
| 235 | ."</td><td align=\"center\">$alanguage" | 263 | function welcomepage($aid) { | |
| 236 | ."</td><td align=\"right\">$topicname"; | 264 | global $sitename, $index, $prefix, $user_prefix; | |
| 237 | if (($radminarticle==1) OR ($radminsuper==1)) { | 265 | $qry = "SELECT a.aid AS aid, a.pwd AS pwd, a.admlanguage AS admlanguage, u.* | |
| 238 | if (($radminarticle==1) AND ($aid == $said) OR ($radminsuper==1)) { | 266 | FROM ${prefix}_authors AS a | |
| 239 | echo "</td><td align=\"right\" nowrap>(<a href=\"admin.php?op=EditStory&sid=$sid\">"._EDIT."</a>-<a href=\"admin.php?op=RemoveStory&sid=$sid\">"._DELETE."</a>)" | 267 | LEFT JOIN ${user_prefix}_users AS u | |
| 240 | ."</td></tr>"; | 268 | ON a.user_uid = u.uid | |
| 269 | WHERE (a.aid='".$aid."');"; | |||
| 241 | } else { | 270 | #print $qry; exit; | |
| 242 | echo "</td><td align=\"right\" nowrap><font class=\"content\"><i>("._NOFUNCTIONS.")</i></font>" | 271 | $result=sql_query($qry); | |
| 243 | ."</td></tr>"; | 272 | $adminrow = sql_fetch_array($result); | |
| 273 | if(mxIsAvatarUploaded($adminrow["uname"])){ | |||
| 274 | $ava = "".mxIsAvatarUploaded($adminrow["uname"],true).""; | |||
| 244 | } | 275 | } | |
| 245 | } else { | 276 | else{ | |
| 246 | echo "</td></tr>"; | 277 | $ava = (empty($adminrow["user_avatar"])) ? "" : "<img src=\"".MX_PATH_AVATAR."/".$adminrow["user_avatar"]."\" border=\"0\" alt=\"".$adminrow["user_avatar"]."\">"; | |
| 247 | } | = | 278 | } |
| <> | 279 | $GLOBALS['index']=0; | ||
| 280 | mxSessionSetVar("lasttime", 0); // online() ausführen | |||
| 281 | include ("header.php"); | |||
| 248 | } | 282 | OpenTable(); | |
| 283 | echo "<center><font class=\"title\"><b>"._uaHello." ".$adminrow["uname"]."</b></font><br><br>"._uaWelcometo." $sitename</center>"; | |||
| 284 | CloseTable(); | |||
| 249 | echo "</table>"; | 285 | echo "<br>"; | |
| 250 | if (($radminarticle==1) OR ($radminsuper==1)) { | 286 | GraphicAdmin(); | |
| 287 | OpenTable(); | |||
| 251 | echo "<center>" | 288 | echo" | |
| 252 | ."<form action=\"admin.php\" method=\"post\">" | 289 | <table width=\"100%\" cellspacing=\"0\" cellpadding=\"5\" border=\"0\"> | |
| 253 | .""._STORYID.": <input type=\"text\" NAME=\"sid\" SIZE=\"10\">" | 290 | <tr> | |
| 254 | ."<select name=\"op\">" | 291 | <td align=\"center\">".$ava." </td> | |
| 255 | ."<option value=\"EditStory\" SELECTED>"._EDIT."</option>" | 292 | <td><p><font class=\"title\"><b>"._uaLoggedin."</b></font></p><p>"._uaAsadmin." <b>$aid</b><br>"._uaAsuser." <b>".$adminrow["uname"]."</b></p><br></td> | |
| 256 | ."<option value=\"RemoveStory\">"._DELETE."</option>" | 293 | </tr> | |
| 257 | ."</select>" | 294 | <tr> | |
| 258 | ."<input type=\"submit\" value=\""._GO."\">" | 295 | <td rowspan=\"7\"> </td> | |
| 259 | ."</form></center>"; | 296 | <td><font class=\"title\"><b>"._uaSelectoption."</b></font><br><br></td> | |
| 260 | } | 297 | </tr> | |
| 261 | CloseTable(); | 298 | <tr> | |
| 262 | $result = sql_query("SELECT pollID, pollTitle FROM ".$prefix."_poll_desc WHERE artid='0' ORDER BY pollID DESC limit 1", $dbi); | 299 | <td><b>·</b> <a href=\"index.php\">"._uaHome."</a><br><br></td> | |
| 263 | $object = sql_fetch_object($result, $dbi); | 300 | </tr> | |
| 264 | $pollID = $object->pollID; | 301 | <!-- <tr> | |
| 265 | $pollTitle = $object->pollTitle; | 302 | <td><b>·</b> <a href=\"admin.php\">"._uaAdminmenue."</a></td> | |
| 266 | echo "<br>"; | 303 | </tr> | |
| 267 | OpenTable(); | 304 | <tr> | |
| 268 | echo "<center><b>"._CURRENTPOLL.":</b> $pollTitle [ <a href=\"admin.php?op=polledit&pollID=$pollID\">"._EDIT."</a> | <a href=\"admin.php?op=create\">"._ADD."</a> ]</center>"; | 305 | <td><b>·</b> <a href=\"admin.php?op=modselfadmin\">"._uaYouradminaccount."</a></td> | |
| 269 | CloseTable(); | 306 | </tr> | |
| 270 | include ("footer.php"); | 307 | <tr> --> | |
| 308 | <td><b>·</b> <a href=\"modules.php?name=Userinfo&uname=".$adminrow["uname"]."\">"._uaYouraccount."</a><br><br></td> | |||
| 271 | } | 309 | </tr> | |
| 272 | 310 | <tr> | ||
| 311 | <td><b>·</b> <a href=\"admin.php?op=logout\">"._uaAdminlogout."</a> <br> "._uaAdminlogout2."</td> | |||
| 273 | if($admintest) { | 312 | </tr> | |
| 274 | 313 | <tr> | ||
| 275 | switch($op) { | 314 | <td><b>·</b> <a href=\"modules.php?name=Your_Account&op=logout\">"._uaUserlogout."</a> <br> "._uaUserlogout2."</td> | |
| 276 | 315 | </tr> | ||
| 277 | case "deleteNotice": | 316 | </table> | |
| 278 | deleteNotice($id, $table, $op_back); | 317 | <p align=\"right\"><span class=\"tiny\">AutoLogin © by <a href=\"http://www.shiba-design.de/\" target=\"_blank\" style=\"font-weight: normal;\">Æ</a> 2003</span></p> | |
| 279 | break; | 318 | "; | |
| 280 | 319 | CloseTable(); | ||
| 281 | case "GraphicAdmin": | 320 | include ("footer.php"); | |
| 282 | GraphicAdmin(); | 321 | die(); | |
| 283 | break; | 322 | } | |
| 284 | = | 323 | ||
| <> | 324 | ################################################################################## | ||
| 325 | function admindologout() { | |||
| 326 | mxSessionSafeCookie(MX_SAFECOOKIE_NAME_ADMIN, 0); | |||
| 327 | mxSetNukeCookie("admin"); | |||
| 285 | case "adminMain": | 328 | mxSessionDelVar("admin"); | |
| 329 | if(!mxIsUser()) { | |||
| 330 | mxSessionDestroy(); | |||
| 286 | adminMain(); | 331 | } | |
| 332 | else { | |||
| 333 | session_write_close(); | |||
| 287 | break; | 334 | } | |
| 335 | Header("Location: admin.php?op=logoutfin"); | |||
| 288 | 336 | } | ||
| 289 | case "logout": | 337 | ||
| 338 | ################################################################################## | |||
| 339 | function admindologoutfin() { | |||
| 290 | setcookie("admin"); | 340 | mxSessionDelVar("admin"); | |
| 341 | mxSessionSetVar("lasttime",0); // Zurücksetzen, damit Online ausgeführt wird | |||
| 291 | include("header.php"); | = | 342 | include("header.php"); |
| 292 | OpenTable(); | 343 | OpenTable(); | |
| 293 | echo "<center><font class=\"title\"><b>"._YOUARELOGGEDOUT."</b></font></center>"; | 344 | echo "<center><font class=\"title\"><b>"._YOUARELOGGEDOUT."</b></font></center>"; | |
| 294 | CloseTable(); | 345 | CloseTable(); | |
| -+ | 346 | echo "<META http-equiv=\"Refresh\" content=\"5;URL=index.php\">"; | ||
| 295 | include("footer.php"); | = | 347 | include("footer.php"); |
| 296 | break; | <> | 348 | } |
| 297 | = | 349 | ||
| <> | 350 | ################################################################################## | ||
| 351 | function getCheckUsersSelectOptions($user_stat = 0) { | |||
| 352 | global $user_prefix, $prefix; | |||
| 353 | $user_stat = (int)$user_stat; | |||
| 354 | $errmsg = (empty($user_stat)) ? "No New Users available" : "No deactivated Users available"; | |||
| 298 | case "login"; | 355 | $useroptions = ""; | |
| 356 | $qry = "SELECT uname, uid | |||
| 357 | FROM ${user_prefix}_users | |||
| 358 | WHERE ${user_prefix}_users.user_stat = ".$user_stat." | |||
| 359 | ORDER BY ${user_prefix}_users.uname"; | |||
| 360 | $result = sql_query($qry); | |||
| 299 | unset($op); | 361 | if($result){ | |
| 362 | while(list($uname, $uid) = sql_fetch_row($result)){ | |||
| 363 | $useroptions .= "<option value=\"".$uid."\">".$uname."</option>\n"; | |||
| 364 | } | |||
| 365 | } | |||
| 366 | $useroptions = (empty($useroptions)) ? "<option value=0>".$errmsg."</option>" : $useroptions; | |||
| 367 | return $useroptions; | |||
| 300 | 368 | } | ||
| 301 | default: | 369 | ||
| 370 | ################################################################################## | |||
| 371 | function getAllUsersSelectOptions2($currentgroup) { | |||
| 372 | global $user_prefix, $prefix; | |||
| 302 | $casedir = dir("admin/case"); | 373 | $useroptions = ""; | |
| 374 | $qry = "SELECT uname | |||
| 375 | FROM ${user_prefix}_users | |||
| 376 | WHERE user_ingroup=".$currentgroup." AND user_stat=1 | |||
| 377 | ORDER BY uname"; | |||
| 378 | $result = sql_query($qry); | |||
| 303 | while($func=$casedir->read()) { | 379 | if($result){ | |
| 304 | if(substr($func, 0, 5) == "case.") { | 380 | while(list($uname) = sql_fetch_row($result)){ | |
| 381 | $useroptions .= "<option value=\"".$uname."\">".$uname."</option>"; | |||
| 382 | } | |||
| 383 | } | |||
| 384 | $useroptions = (empty($useroptions)) ? "<option value=0>ERROR!!! No Users available</option>" : $useroptions; | |||
| 385 | return $useroptions; | |||
| 386 | } | |||
| = | 387 | |||
| <> | 388 | ################################################################################## | ||
| 389 | function getAllAccessLevelSelectOptions($selectedgroup) { | |||
| 390 | global $user_prefix, $prefix; | |||
| 391 | $selectedgroup = (empty($selectedgroup)) ? 1 : $selectedgroup; | |||
| 392 | $groupoptions = ""; | |||
| 393 | $result = sql_query("select access_id, access_title from ".$prefix."_groups_access where access_title != 'Deleted' order by access_title"); | |||
| 305 | include($casedir->path."/$func"); | 394 | if($result){ | |
| 395 | while(list($access_id, $access_title) = sql_fetch_row($result)){ | |||
| 396 | if (is_array($selectedgroup)) { | |||
| 397 | $sel = (in_array($access_id, $selectedgroup)) ? " SELECTED" : ""; | |||
| 398 | } | |||
| 399 | else { | |||
| 400 | $sel = ($selectedgroup == $access_id) ? " SELECTED" : ""; | |||
| 401 | } | |||
| 402 | $access_title = ($GLOBALS['default_group'] == $access_id) ? "".$access_title." *" : $access_title; | |||
| 403 | $groupoptions .= "<option value=\"".$access_id."\" ".$sel.">".$access_title."</option>\n"; | |||
| 404 | } | |||
| 405 | } | |||
| 406 | $groupoptions = (empty($groupoptions)) ? "<option value=0>ERROR!!! No Groups available</option>" : $groupoptions; | |||
| 407 | return $groupoptions; | |||
| 306 | } | 408 | } | |
| = | 409 | |||
| -+ | 410 | ################################################################################## | ||
| 411 | function getUserStatOptions($user_stat) { | |||
| 412 | $out = ""; | |||
| 413 | if (empty($user_stat)) { /// nur Anzeigen bei neuen Usern | |||
| 414 | $out .= "<option value=0".(($user_stat==0) ? " selected" : "").">"._YA_USERSTAT_0."</option>\n"; # neu, noch nicht aktiviert | |||
| 415 | } | |||
| 416 | $out .= "<option value=1".(($user_stat==1) ? " selected" : "").">"._YA_USERSTAT_1."</option>\n"; # aktiviert | |||
| 417 | if (!empty($user_stat)) { /// nicht Anzeigen bei neuen Usern | |||
| 418 | $out .= "<option value=2".(($user_stat==2) ? " selected" : "").">"._YA_USERSTAT_2."</option>\n"; # deaktiviert | |||
| 419 | } | |||
| 420 | return $out; | |||
| 307 | } | = | 421 | } |
| 422 | ||||
| <> | 423 | ################################################################################## | ||
| 424 | function create_first($pvs) { | |||
| 425 | global $prefix, $user_prefix; | |||
| 426 | extract($pvs); | |||
| 427 | if (!isset($_COOKIE[MX_SESSION_NAME])) { | |||
| 428 | /// wenn kein Session-Cookie gesetzt wurde | |||
| 429 | mxErrorScreen(_ADMIN_BADLOGIN4); | |||
| 430 | } | |||
| 431 | if (!mxSessionGetVar("create_first") || empty($first_check)) { | |||
| 432 | /// wenn session bereits geloescht (z.B. bei refresh der page) | |||
| 433 | /// oder Check-Variable des Formulars fehlt, umleiten | |||
| 434 | Header("Location: admin.php"); | |||
| 435 | } | |||
| 436 | /// wenn die Funktion nicht ueber das richtige Formular aufgerufen: | |||
| 437 | /// Intruder und Session blockieren (funktion: vkpIpBanning() in header.php) | |||
| 438 | $checkID = md5(mxSessionGetVar("create_first")); | |||
| 439 | mxSessionDelVar("create_first"); | |||
| 440 | if ($first_check != $checkID) { | |||
| 441 | $doblock = 1; | |||
| 442 | mxYoubad("create_first failed (no session-check-id) - $first_name"); | |||
| 443 | die(); | |||
| 444 | } | |||
| 445 | /// pruefen ob vielleicht doch schon ein God-Account besteht | |||
| 446 | $result = sql_query("SELECT count(aid) FROM ${prefix}_authors where name ='God'"); | |||
| 447 | list($first) = sql_fetch_row($result); | |||
| 448 | if ($first == 1) { | |||
| 449 | /// wenn doch schon einer da ist... | |||
| 450 | mxSecureLog("SecLog", "create_first failed (is available) - $first_name"); | |||
| 451 | mxErrorScreen(_ADMIN_GODEXIST); | |||
| 452 | } | |||
| 453 | /// pruefen ob der Adminname bereits vergeben ist | |||
| 454 | $result = sql_query("SELECT count(aid) FROM ${prefix}_authors where aid ='$first_name'"); | |||
| 455 | list($aexist) = sql_fetch_row($result); | |||
| 456 | if (!empty($aexist)) { | |||
| 457 | $pvs['msg'] = ""._uaNICKTAKEN." (".$first_name.")"; | |||
| 458 | unset($pvs['first_name']); | |||
| 459 | } | |||
| 460 | /// nicht alle Felder ausgefuellt? | |||
| 461 | else if (empty($first_name) || empty($first_email) || empty($first_pwd) || ereg("[^ a-zA-Z0-9_-]",$first_name)) { | |||
| 462 | $pvs['msg'] = _COMPLETEFIELDS; | |||
| 463 | } | |||
| 464 | /// Datenbankpasswort zur Sicherheit ueberpruefen | |||
| 465 | /// wer das nicht kennt, kann auch kein God sein | |||
| 466 | else if ($first_dbpass != $GLOBALS['dbpass']) { | |||
| 467 | mxSecureLog("SecLog", "create_first failed (bad dbPass) - $first_name"); | |||
| 468 | $pvs['msg'] = _ADMIN_ERRDBPASS; | |||
| 469 | unset($pvs['first_dbpass']); | |||
| 470 | } | |||
| 471 | /// wenn Fehler-Message, Seite neu aufrufen | |||
| 472 | if (isset($pvs['msg'])) { | |||
| 473 | /// uebergebene Parameter und Fehler-Message in Session schreiben | |||
| 474 | mxSessionSetVar("first_data", $pvs); | |||
| 475 | session_write_close(); | |||
| 476 | Header("Location: admin.php"); | |||
| 477 | exit; | |||
| 478 | } | |||
| 479 | /// Daten in Admintabelle schreiben | |||
| 480 | $first_pwd = md5(trim($first_pwd)); | |||
| 481 | $qry = "INSERT INTO ${prefix}_authors ( aid, name, url, email, pwd, counter, radminsuper ) | |||
| 482 | VALUES ( '".mxAddSlashesForSQL($first_name)."', 'God', '".mxAddSlashesForSQL($first_url)."', '".mxAddSlashesForSQL($first_email)."', '$first_pwd', 0, 1);"; | |||
| 483 | $result = sql_query($qry); | |||
| 484 | /// wenn beim schreiben Fehler aufgetreten | |||
| 485 | if (!$result) { | |||
| 486 | mxErrorScreen(""._ADMIN_ERRSQL."<br><br>$qry"); | |||
| 487 | } | |||
| 488 | /// Soll ein normaler User miterstellt werden? | |||
| 489 | if ($first_createuser) { | |||
| 490 | /// pruefen ob Benutzername bereits vorhanden | |||
| 491 | $result = sql_query("select uid from ${user_prefix}_users where uname='".mxAddSlashesForSQL($first_name)."'"); | |||
| 492 | list($uid) = sql_fetch_row($result); | |||
| 493 | if (empty($uid)) { | |||
| 494 | /// wenn nein, neuen Benutzer anlegen | |||
| 495 | ||||
| 496 | $user_regdate = mxGetNukeUserregdate(); | |||
| 497 | ||||
| 498 | $user_regtime = time(); | |||
| 499 | $qry="INSERT INTO ${user_prefix}_users | |||
| 500 | ( uname , name , email , url , pass , user_regdate , user_regtime , user_stat) values | |||
| 501 | ('$first_name', '".mxAddSlashesForSQL($first_name)."', '".mxAddSlashesForSQL($first_email)."', '".mxAddSlashesForSQL($first_url)."', '$first_pwd', '$user_regdate', $user_regtime, 1);"; | |||
| 502 | $result = sql_query($qry); | |||
| 503 | if ($result) { | |||
| 504 | /// wenn erfolgreich, eingefuegte uid ermitteln | |||
| 505 | $uid = sql_insert_id(); | |||
| 506 | } | |||
| 507 | } | |||
| 508 | /// wenn eine gueltige uid vorhanden ist, | |||
| 509 | if (!empty($uid)) { | |||
| 510 | /// diese in die Admintabelle zur Verknuepfung eintragen (selfadmin) | |||
| 511 | sql_query("UPDATE ${prefix}_authors SET user_uid=$uid WHERE aid='".mxAddSlashesForSQL($first_name)."';"); | |||
| 512 | } | |||
| 513 | } | |||
| 514 | mxSecureLog("SecLog", "create_first: ok - $first_name"); | |||
| 515 | /// Erfolgsnachricht in Session schreiben | |||
| 516 | $msg = "<b>"._ADMIN_GODCREATEOK."</b><br><br><b>"._uaAsadmin."</b>: $first_name<br><b>"._uaAsuser."</b>: $first_name"; | |||
| 517 | mxSessionSetVar("formmessage", $msg); | |||
| 518 | mxSessionDelVar("first_data"); | |||
| 308 | closedir($casedir->handle); | 519 | session_write_close(); | |
| 520 | /// und ab zum login :-)) | |||
| 521 | Header("Location: admin.php"); // zum Login | |||
| 309 | break; | 522 | } | |
| 310 | = | 523 | ||
| -+ | 524 | ################################################################################## | ||
| 525 | function checkforgodadmin() { | |||
| 526 | global $prefix; | |||
| 527 | $result = sql_query("SELECT aid FROM ${prefix}_authors where name ='God'"); | |||
| 528 | list($the_first) = sql_fetch_row($result); | |||
| 529 | if (empty($the_first)) { | |||
| 530 | $first_data = mxSessionGetVar("first_data"); | |||
| 531 | mxSessionDelVar("first_data"); | |||
| 532 | #mxDebugFuncvars($first_data); | |||
| 533 | mt_srand((double)microtime()*1000000); | |||
| 534 | $xcv = mt_rand(); | |||
| 535 | mxSessionSetVar("create_first", $xcv); | |||
| 536 | include("header.php"); | |||
| 537 | title($GLOBALS['sitename'].": "._ADMINISTRATION.""); | |||
| 538 | OpenTable(); | |||
| 539 | echo "<center><b>"._NOADMINYET."</b></center><br><br>" | |||
| 540 | ."".((isset($first_data['msg']))?"<center><b>".$first_data['msg']."</b></center><br><br>":"")."" | |||
| 541 | ."<form action=\"admin.php\" method=\"post\" name=\"dofirst\">" | |||
| 542 | ."<input type=\"hidden\" name=\"op\" value=\"create_first\">" | |||
| 543 | ."<input type=\"hidden\" NAME=\"first_check\" value=\"".MD5($xcv)."\">" | |||
| 544 | ."<table border=\"0\">" | |||
| 545 | ."<tr><td><b>"._NICKNAME.":</b></td><td><input type=\"text\" name=\"first_name\" size=\"40\" maxlength=\"25\" value=\"".((isset($first_data['first_name']))?$first_data['first_name']:"")."\"> <font class=\"tiny\">"._REQUIRED."</font></td></tr>" | |||
| 546 | ."<tr><td><b>"._HOMEPAGE.":</b></td><td><input type=\"text\" name=\"first_url\" size=\"40\" maxlength=\"255\" value=\"".((isset($first_data['first_url']))?$first_data['first_url']:MX_HOME_URL)."\"></td></tr>" | |||
| 547 | ."<tr><td><b>"._EMAIL.":</b></td><td><input type=\"text\" name=\"first_email\" size=\"40\" maxlength=\"255\" value=\"".((isset($first_data['first_email']))?$first_data['first_email']:$GLOBALS['adminmail'])."\"> <font class=\"tiny\">"._REQUIRED."</font></td></tr>" | |||
| 548 | ."<tr><td><b>"._PASSWORD.":</b></td><td><input type=\"password\" name=\"first_pwd\" size=\"40\" maxlength=\"20\" value=\"".((isset($first_data['first_pwd']))?$first_data['first_pwd']:"")."\"> <font class=\"tiny\">"._REQUIRED."</font></td></tr>" | |||
| 549 | ."<tr><td colspan=\"2\">"._CREATEUSERDATA." <input type=\"radio\" name=\"first_createuser\" value=\"1\" checked>"._YES." <input type=\"radio\" name=\"first_createuser\" value=\"0\">"._NO."</td></tr>" | |||
| 550 | ."<tr><td><b>"._DBPASS."</b></td><td><input type=\"password\" name=\"first_dbpass\" size=\"40\" maxlength=\"20\" value=\"".((isset($first_data['first_dbpass']))?$first_data['first_dbpass']:"")."\"> <font class=\"tiny\">"._REQUIRED."</font></td></tr>" | |||
| 551 | ."<tr><td colspan=\"2\"><input type=\"submit\" value=\""._SUBMIT."\"></td></tr>" | |||
| 552 | ."</table></form>"; | |||
| 553 | echo "<script language='JavaScript' type='text/javascript'>\n<!--\ndocument.dofirst.first_name.focus();\n//-->\n</script>"; | |||
| 554 | CloseTable(); | |||
| 555 | include("footer.php"); | |||
| 556 | exit; | |||
| 557 | } | |||
| 311 | } | = | 558 | } |
| 312 | 559 | |||
| <> | 560 | ################################################################################## | ||
| 561 | function php_info() { | |||
| 562 | extract(mxGetAdminSession()); | |||
| 563 | if (empty($GLOBALS["mxDemoMode"])){ | |||
| 564 | mxSystemInfo(); | |||
| 565 | exit; | |||
| 566 | } | |||
| 313 | } else { | 567 | else{ | |
| 568 | echo "<h1> Only Admin -> phpinfo();</h1>"; | |||
| 569 | } | |||
| 570 | } | |||
| 314 | = | 571 | ||
| <> | 572 | ################################################################################## | ||
| 573 | #mxDebugFuncVars($_REQUEST); | |||
| 315 | login(); | 574 | ||
| 575 | $op = (empty($_REQUEST['op'])) ? "adminMain" : $_REQUEST['op']; | |||
| 576 | $admintest = mxIsAdmin(); | |||
| 577 | if($admintest) { | |||
| 578 | mxSessionDelVar("abad"); | |||
| 579 | extract(mxGetAdminSession()); | |||
| 316 | = | 580 | ||
| <> | 581 | switch($op) { | ||
| 582 | case "deleteNotice": | |||
| 583 | //// was ist das ?? | |||
| 584 | deleteNotice($id, $table, $op_back); | |||
| 585 | break; | |||
| 586 | case "adminMain": | |||
| 587 | adminMain(); | |||
| 588 | break; | |||
| 589 | case "welcome": | |||
| 590 | welcomepage($aid); | |||
| 591 | break; | |||
| 592 | case "logout": | |||
| 593 | admindologout(); | |||
| 594 | break; | |||
| 595 | case "logoutfin": | |||
| 596 | mxErrorScreen("<b>Admin-Logout failed</b><br>Please delete your Session-Cookie (".MX_SESSION_NAME.") manualy."); | |||
| 597 | break; | |||
| 598 | case "info": | |||
| 599 | php_info(); | |||
| 600 | break; | |||
| 601 | case "login"; | |||
| 602 | $op = "adminMain"; | |||
| 603 | adminMain(); | |||
| 604 | break; | |||
| 605 | default: | |||
| 606 | //// Ausgabepuffer aktivieren um zu prüfen ob die $op-Option vorhanden ist | |||
| 607 | //// bei Problemen, die Zeilen mit *** dahinter, einfach auskommentieren ;) | |||
| 608 | ob_start(); // *** | |||
| 609 | $casedir = dir("admin/case"); | |||
| 610 | while($func = $casedir -> read()) { | |||
| 611 | if(substr($func, 0, 5) == "case.") { | |||
| 612 | include($casedir -> path."/".$func); | |||
| 613 | } | |||
| 614 | } | |||
| 615 | closedir($casedir->handle); | |||
| 616 | //// Ausgabepuffer zwischenspeichern um zu prüfen // *** | |||
| 617 | //// ob die $op-Option vorhanden ist und evtl. // *** | |||
| 618 | //// eine Fehlermeldung zu generieren // *** | |||
| 619 | $fileoutput = ob_get_contents(); // *** | |||
| 620 | ob_end_clean(); // *** | |||
| 621 | if (empty($fileoutput)) { // *** | |||
| 622 | mxErrorScreen("Diese Funktion ist nicht vorhanden.<br>This function is not available."); // *** | |||
| 623 | exit; // *** | |||
| 624 | } // *** | |||
| 625 | echo $fileoutput; // *** | |||
| 626 | //// ende Ausgabepuffer zwischenspeichern // *** | |||
| 627 | break; | |||
| 628 | } # end switch | |||
| 629 | } | |||
| 630 | else { | |||
| 631 | if ($op != "create_first" && empty($_POST['first_check'])) { | |||
| 632 | checkforgodadmin(); | |||
| 633 | } | |||
| 634 | switch($op) { | |||
| 635 | case "logoutfin": | |||
| 636 | admindologoutfin(); | |||
| 637 | break; | |||
| 638 | case "login": | |||
| 639 | mx_sys_adminlogin($_POST); | |||
| 640 | break; | |||
| 641 | case "create_first": | |||
| 642 | create_first($_POST); | |||
| 643 | break; | |||
| 644 | default: | |||
| 645 | login(); | |||
| 646 | } # end switch | |||
| 317 | } | 647 | } | |
| 318 | = | 648 | ||
| 319 | ?> | 649 | ?> |