DATEIVERGLEICH
Erstellt: 22.05.2005 01:00:18
   
Modus: Alle Zeilen  
   
Linke Datei: D:\Localhost_2\nuke5.5\html\mainfile.php     Rechte Datei: D:\Localhost_2\2fcms-temp\mainfile.php  
1 <?php = 1 <?php
2     2  
3 ob_start("ob_gzhandler"); <>    
4     3 /**
5 /************************************************************************/   4 * Die Datei mainfile.php ist der Anker des Kernels.
6 /* PHP-NUKE: Advanced Content Management System                         */   5 * Über die mainfile.php stehen sämtliche Kernfunktionen und systeminternen Arbeitsabläufe zur Verfügung.
7 /* ============================================                         */   6 * Diese Datei ist die einzige Bibliothek die in eigenen Seiten benötigt wird.
8 /*                                                                      */   7 * In dieser Datei ist im 2F CMS keine einzige Funktion direkt enthalten! Alle Funktionen sind ausgelagert.
9 /* Copyright (c) 2002 by Francisco Burzi (fbc@mandrakesoft.com)         */   8 * Wenn diese Datei geladen wurde, wird $GLOBALS['mainfile'] auf 1 gesetzt.
10 /* http://phpnuke.org                                                   */      
11 /*                                                                      */      
12 /* This program is free software. You can redistribute it and/or modify */      
13 /* it under the terms of the GNU General Public License as published by */      
14 /* the Free Software Foundation; either version 2 of the License.       */      
15 /************************************************************************/      
16     9 * @author Jens Ferner
17 foreach ($HTTP_GET_VARS as $secvalue) {   10 * @copyright Jens Ferner, 2F Promoting & Consulting
18     if (eregi("<[^>]*script*\"?[^>]*>", $secvalue)) {   11 * @link http://www.2f-cms.com
19         die ("I don't like you...");      
20     }   12 * @package 2F-CMS
21 }      
22     13 * @subpackage Kernsystem
23 if (eregi("mainfile.php",$PHP_SELF)) {   14 * @category Systembibliothek
24    Header("Location: index.php");   15 * @license http://www.2f-cms.com/2flicence.txt 2F CMS Lizenz
25     die();      
26 }   16 */
27   = 17  
28 require_once("config.php"); <>    
29 require_once("includes/sql_layer.php");      
30 $dbi = sql_connect($dbhost, $dbuname, $dbpass, $dbname);      
31 $mainfile = 1;      
32     18 /**
33 if (isset($newlang)) {   19 * Hier wird definiert, wo sich die einzelnen Konfigurationsdateien befinden.
34     if (file_exists("language/lang-$newlang.php")) {   20 * Sie können das jederzeit anpassen, Bedenken Sie aber, dann auch die richtigen Rechte per CHMOD zu setzen.
35         setcookie("lang",$newlang,time()+31536000);   21 * Es steht somit dem Admin frei, selber zu entscheiden, wohin Dateien gelegt werden.
36         include("language/lang-$newlang.php");   22 * @todo Über Admin-Interface eingeben, welche Config-Datei wo liegt
37         $currentlang = $newlang;      
38     } else {      
39         setcookie("lang",$language,time()+31536000);      
40         include("language/lang-$language.php");      
41         $currentlang = $language;      
42     }      
43 } elseif (isset($lang)) {      
44     include("language/lang-$lang.php");      
45     $currentlang = $lang;      
46 } else {      
47     setcookie("lang",$language,time()+31536000);      
48     include("language/lang-$language.php");      
49     $currentlang = $language;      
50 }   23 */
51   = 24  
52 function get_lang($module) { <>    
53     global $currentlang;      
54     if ($module == admin) {      
55         if (file_exists("admin/language/lang-$currentlang.php")) {      
56             include_once("admin/language/lang-$currentlang.php");      
57         }   25 /**
58     } else {   26 * @global string $GLOBALS['config_general']
59         if (file_exists("modules/$module/language/lang-$currentlang.php")) {      27 * @global string Wo liegt die Config-Datei mit den allgemeinen Daten
60             include_once("modules/$module/language/lang-$currentlang.php");      
61         }   28 */
62     }   29 $GLOBALS['config_general']="includes/config/config-general.php";
63 }      
64   = 30  
65 function is_admin($admin) { <>    
66     global $prefix, $dbi;      
67     if(!is_array($admin)) {      
68         $admin = base64_decode($admin);      
69         $admin = explode(":", $admin);      
70         $aid = "$admin[0]";      
71         $pwd = "$admin[1]";      
72     } else {      
73         $aid = "$admin[0]";      
74         $pwd = "$admin[1]";      
75     }   31 /**
76     $result = sql_query("select pwd from ".$prefix."_authors where aid='$aid'", $dbi);   32 * @global string $GLOBALS['config_content']
77     list($pass) = sql_fetch_row($result, $dbi);   33 * @global string Wo liegt die Config-Datei mit den Einstellungen rund um den Content
78     if($pass == $pwd && $pass != "") {      
79         return 1;      
80     }   34 */
81     return 0;   35 $GLOBALS['config_content']="includes/config/config-content.php";
82 }   36  
83     37 /**
84 function is_user($user) {   38 * @global string $GLOBALS['config_security']
85     global $prefix, $dbi, $user_prefix;   39 * @global string Wo liegt die Config-Datei mit den Einstellungen zur Sicherheit
86     if(!is_array($user)) {      
87         $user = base64_decode($user);      
88         $user = explode(":", $user);      
89         $uid = "$user[0]";      
90         $pwd = "$user[2]";      
91     } else {      
92         $uid = "$user[0]";      
93         $pwd = "$user[2]";      
94     }   40 */
95    $result = sql_query("select pass from ".$user_prefix."_users where uid='$uid'", $dbi);   41 $GLOBALS['config_security']="includes/config/config-security.php";
96     list($pass) = sql_fetch_row($result, $dbi);      
97     if($pass == $pwd && $pass != "") {      
98         return 1;   42  
99     }   43 /**
100     return 0;   44 * @global string $GLOBALS['config_performance']
101 }   45 * @global string Wo liegt die Config-Datei mit den Einstellungen zur Performance
102     46 */
103 function title($text) {   47 $GLOBALS['config_performance']="includes/config/config-performance.php";
104     OpenTable();      
105     echo "<center><font class=\"title\"><b>$text</b></font></center>";      
106     CloseTable();      
107     echo "<br>";      
108 }   48  
109     49 /**
110 function is_active($module) {   50 * @global string $GLOBALS['config_admin']
111     global $prefix, $dbi;   51 * @global string Wo liegt die Config-Datei mit den Einstellungen für den Adminbereich
112     $result = sql_query("select active from ".$prefix."_modules where title='$module'", $dbi);      
113     list ($act) = sql_fetch_row($result, $dbi);      
114     if (!$result OR $act == 0) {      
115         return 0;   52 */
116     } else {   53 $GLOBALS['config_admin']="includes/config/config-admin.php";
117         return 1;      
118     }      
119 }   54  
120     55 /**
121 function render_blocks($side, $blockfile, $title, $content, $bid, $url) {   56 * @global string $GLOBALS['config_user']
122     if ($url == "") {   57 * @global string Wo liegt die Config-Datei mit den User-Einstellungen
123         if ($blockfile == "") {      
124             if ($side == "c") {      
125                 themecenterbox($title, $content);      
126             } else {      
127                 themesidebox($title, $content);      
128             }   58 */
129         } else {   59 $GLOBALS['config_user']="includes/config/config-user.php";
130             if ($side == "c") {      
131                 blockfileinc($title, $blockfile, 1);      
132             } else {      
133                 blockfileinc($title, $blockfile);      
134             }   60  
135         }   61 /**
136     } else {   62 * @global string $GLOBALS['config_footer']
137         if ($side == "c") {   63 * @global string Wo liegt die Config-Datei mit den Footer-Daten
138             headlines($bid,1);      
139         } else {      
140             headlines($bid);      
141         }   64 */
142     }   65 $GLOBALS['config_footer']="includes/config/config-footer.php";
143 }   66  
144     67 /**
145 function blocks($side) {   68 * @global string $GLOBALS['config_downloads']
146     global $storynum, $prefix, $multilingual, $currentlang, $dbi, $admin, $user;   69 * @global string Wo liegt die Config-Datei mit den Einstellungen zum Download-Modul
147     if ($multilingual == 1) {      
148         $querylang = "AND (blanguage='$currentlang' OR blanguage='')";      
149     } else {   70 */
150         $querylang = "";   71 $GLOBALS['config_downloads']="includes/config/config-downloads.php";
151     }   72  
152     if (strtolower($side[0]) == "l") {      
153         $pos = "l";      
154     } elseif (strtolower($side[0]) == "r") {      
155         $pos = "r";      
156     }  elseif (strtolower($side[0]) == "c") {      
157         $pos = "c";      
158     }   73 /**
159     $side = $pos;   74 * @global string $GLOBALS['config_links']
160     $result = sql_query("select bid, bkey, title, content, url, blockfile, view from ".$prefix."_blocks where position='$pos' AND active='1' $querylang ORDER BY weight ASC", $dbi);   75 * @global string Wo liegt die Config-Datei mit den Einstellungen zum WebLinks-Modul
161     while(list($bid, $bkey, $title, $content, $url, $blockfile, $view) = sql_fetch_row($result, $dbi)) {      
162         if ($bkey == admin) {      
163             adminblock();      
164         } elseif ($bkey == userbox) {      
165             userblock();      
166         } elseif ($bkey == "") {      
167             if ($view == 0) {      
168                 render_blocks($side, $blockfile, $title, $content, $bid, $url);      
169             } elseif ($view == 1 AND is_user($user) || is_admin($admin)) {      
170                 render_blocks($side, $blockfile, $title, $content, $bid, $url);      
171             } elseif ($view == 2 AND is_admin($admin)) {      
172                 render_blocks($side, $blockfile, $title, $content, $bid, $url);      
173             } elseif ($view == 3 AND !is_user($user) || is_admin($admin)) {      
174                 render_blocks($side, $blockfile, $title, $content, $bid, $url);      
175             }      
176         }   76 */
177     }   77 $GLOBALS['config_links']="includes/config/config-links.php";
178 }   78  
179     79 /**
180 function message_box() {   80 * @global string $startvkptime
181     global $bgcolor1, $bgcolor2, $user, $admin, $cookie, $textcolor2, $prefix, $multilingual, $currentlang, $dbi;   81 * @global string Einlesen der Startzeit - wichtig um später zu erkennen, wie lange die Seitenerstellung dauerte
182     if ($multilingual == 1) {      
183         $querylang = "AND (mlanguage='$currentlang' OR mlanguage='')";      
184     } else {      
185         $querylang = "";      
186     }   82 */
187     $result = sql_query("select mid, title, content, date, expire, view from ".$prefix."_message where active='1' $querylang", $dbi);      
188     if (sql_num_rows($result, $dbi) == 0) {      
189         return;   83 global $startvkptime;
190     } else {      
191         while (list($mid, $title, $content, $mdate, $expire, $view) = sql_fetch_row($result, $dbi)) {      
192         if ($title != "" && $content != "") {      
193             if ($expire == 0) {      
194                 $remain = _UNLIMITED;      
195             } else {      
196                 $etime = (($mdate+$expire)-time())/3600;      
197                 $etime = (int)$etime;   84 $startvkptime=microtime();
198                 if ($etime < 1) {      
199                     $remain = _EXPIRELESSHOUR;      
200                 } else {      
201                     $remain = ""._EXPIREIN." $etime "._HOURS."";      
202                 }   85  
203             }   86 //Wenn die mainfile direktgeladen wird sofort auf die index.php umleiten
204             if ($view == 4 AND is_admin($admin)) {   87 if (stristr($_SERVER['PHP_SELF'],"mainfile.php")) Header("Location: index.php?problem=2");
205                 OpenTable();      
206                 echo "<center><font class=\"option\" color=\"$textcolor2\"><b>$title</b></font></center>\n"      
207                     ."<font class=\"content\">$content</font>"      
208                     ."<br><br><center><font class=\"content\">[ "._MVIEWADMIN." - $remain - <a href=\"admin.php?op=editmsg&mid=$mid\">"._EDIT."</a> ]</font></center>";      
209                 CloseTable();      
210                 echo "<br>";      
211             } elseif ($view == 3 AND is_user($user) || is_admin($admin)) {      
212                 OpenTable();      
213                 echo "<center><font class=\"option\" color=\"$textcolor2\"><b>$title</b></font></center>\n"      
214                     ."<font class=\"content\">$content</font>";      
215                 if (is_admin($admin)) {      
216                     echo "<br><br><center><font class=\"content\">[ "._MVIEWUSERS." - $remain - <a href=\"admin.php?op=editmsg&mid=$mid\">"._EDIT."</a> ]</font></center>";      
217                 }   88  
218                 CloseTable();   89 //Ein paar Grundsätzliche Variablen und Einstellungen
219                 echo "<br>";   90 if(empty($_SERVER['PHP_SELF'])) $_SERVER['PHP_SELF']=$_SERVER['REQUEST_URI'];   //Wegen eines Bugs in PHP 4.3.1
220             } elseif ($view == 2 AND !is_user($user) || is_admin($admin)) {   91 $PHP_SELF=$_SERVER['PHP_SELF'];                                                 //Nötig für register_globals off!
221                 OpenTable();      
222                 echo "<center><font class=\"option\" color=\"$textcolor2\"><b>$title</b></font></center>\n"      
223                     ."<font class=\"content\">$content</font>";      
224                 if (is_admin($admin)) {      
225                     echo "<br><br><center><font class=\"content\">[ "._MVIEWANON." - $remain - <a href=\"admin.php?op=editmsg&mid=$mid\">"._EDIT."</a> ]</font></center>";      
226                 }   92  
227                 CloseTable();      
228                 echo "<br>";      
229             } elseif ($view == 1) {      
230                 OpenTable();      
231                 echo "<center><font class=\"option\" color=\"$textcolor2\"><b>$title</b></font></center>\n"      
232                     ."<font class=\"content\">$content</font>";      
233                 if (is_admin($admin)) {      
234                     echo "<br><br><center><font class=\"content\">[ "._MVIEWALL." - $remain - <a href=\"admin.php?op=editmsg&mid=$mid\">"._EDIT."</a> ]</font></center>";      
235                 }   93 /**
236                 CloseTable();      
237                 echo "<br>";      
238             }   94 * Die Prüf-Variable setzen
239             if ($expire != 0) {   95 * @global bool $GLOBALS['mainfile']
240                 $past = time()-$expire;   96 * @global bool Prüfvariable die nur auf 1 gesetzt wird wenn die mainfile.php geladen wird
241                 if ($mdate < $past) {      
242                     $result = sql_query("update ".$prefix."_message set active='0' where mid='$mid'", $dbi);      
243                 }   97 */
244                 }      
245             }      
246         }   98 $GLOBALS['mainfile']=1;
247     }      
248 }   99 $mainfile=1;
249   = 100  
250 function online() { <>    
251     global $user, $cookie, $prefix, $dbi;      
252     cookiedecode($user);      
253     $ip = getenv("REMOTE_ADDR");      
254     $username = $cookie[1];      
255     if (!isset($username)) {      
256         $username = "$ip";      
257         $guest = 1;      
258     }   101 /**
259     $past = time()-1800;   102 * Laden der Sicherheits-Einstellungen
260     sql_query("DELETE FROM ".$prefix."_session WHERE time < $past", $dbi);      
261     $result = sql_query("SELECT time FROM ".$prefix."_session WHERE username='$username'", $dbi);      
262     $ctime = time();      
263     if ($row = sql_fetch_array($result, $dbi)) {      
264         sql_query("UPDATE ".$prefix."_session SET username='$username', time='$ctime', host_addr='$ip', guest='$guest' WHERE username='$username'", $dbi);      
265     } else {      
266         sql_query("INSERT INTO ".$prefix."_session (username, time, host_addr, guest) VALUES ('$username', '$ctime', '$ip', '$guest')", $dbi);      
267     }   103 */
268 }   104 include($GLOBALS['config_security']);
269   = 105  
270 function blockfileinc($title, $blockfile, $side=0) { <>    
271     $blockfiletitle = $title;      
272     $file = @file("blocks/$blockfile");      
273     if (!$file) {      
274         $content = _BLOCKPROBLEM;      
275     } else {      
276         include("blocks/$blockfile");      
277     }   106 /**
278     if ($content == "") {   107 * Wenn gewünscht: Register_Globals=On emulieren - Vorsicht: erhebliches Sicherheitsrisiko
279         $content = _BLOCKPROBLEM2;      
280     }      
281     if ($side == 1) {      
282         themecenterbox($blockfiletitle, $content);      
283     } else {      
284         themesidebox($blockfiletitle, $content);      
285     }      
286 }      
287     108 */
288 function selectlanguage() {      
289     global $useflags, $currentlang;   109 global $vkp_register_globals;
290     if ($useflags == 1) {   110 if($vkp_register_globals) foreach($_REQUEST as $bezeichner=>$wert) $$bezeichner=$wert;
291     $title = _SELECTLANGUAGE;      
292     $content = "<center><font class=\"content\">"._SELECTGUILANG."<br><br>";      
293     $langdir = dir("language");      
294     while($func=$langdir->read()) {      
295         if(substr($func, 0, 5) == "lang-") {      
296             $menulist .= "$func ";      
297         }   111  
298     }   112 /**
299    closedir($langdir->handle);   113 * Zurücksetzen wesentlicher Daten, auf Wunsch einfach erweitern
300     $menulist = explode(" ", $menulist);      
301     sort($menulist);      
302     for ($i=0; $i < sizeof($menulist); $i++) {      
303         if($menulist[$i]!="") {      
304             $tl = ereg_replace("lang-","",$menulist[$i]);      
305             $tl = ereg_replace(".php","",$tl);      
306             $altlang = ucfirst($tl);      
307             $content .= "<a href=\"index.php?newlang=$tl\"><img src=\"images/language/flag-$tl.png\" border=\"0\" alt=\"$altlang\" hspace=\"3\" vspace=\"3\"></a> ";      
308         }   114 */
309     }   115 $resetarray = array ( "db", "sql", "result", "user", "admin", "temp", "dbhost", "dbpass", "dbuser", "radminsuper", "admintest", "vkptable", "admin_aid", "admin_name", "admin_url", "admin_email","admin_pwd","admin_counter","radminarticle","radmintopic","radminuser","radminsurvey","radminsection","radminlink","radminephem","radminfaq","radmindownload","radminreviews","radminnewsletter","radminforum","radmincontent","radminency","radminsuper","admlanguage");
310     $content .= "</font></center>";   116 foreach( $resetarray as $wert) unset($$wert);
311     themesidebox($title, $content);      
312         } else {      
313     $title = _SELECTLANGUAGE;      
314         $content = "<center><font class=\"content\">"._SELECTGUILANG."<br><br></font>";      
315     $content .= "<form action=\"index.php\" method=\"get\"><select name=\"newlanguage\" onChange=\"top.location.href=this.options[this.selectedIndex].value\">";      
316             $handle=opendir('language');      
317             while ($file = readdir($handle)) {      
318                 if (preg_match("/^lang\-(.+)\.php/", $file, $matches)) {      
319                     $langFound = $matches[1];      
320                     $languageslist .= "$langFound ";      
321                 }      
322             }      
323             closedir($handle);      
324             $languageslist = explode(" ", $languageslist);      
325             sort($languageslist);      
326             for ($i=0; $i < sizeof($languageslist); $i++) {      
327                 if($languageslist[$i]!="") {      
328         $content .= "<option value=\"index.php?newlang=$languageslist[$i]\" ";      
329                 if($languageslist[$i]==$currentlang) $content .= " selected";      
330         $content .= ">".ucfirst($languageslist[$i])."</option>\n";      
331                 }   117  
332     }   118 /**
333     $content .= "</select></form></center>";   119 * Laden der Kernadmin-Funktionen, u.a. auch "is_admin"
334     themesidebox($title, $content);   120 * Diese Datei muss manuell vorgeladen werden, da is_admin() schon sehr früh benötigt wird
335         }   121 */
336 }   122 include_once("modules/Authors/mainfile-functions.php");
337   = 123  
338 function ultramode() { <>    
339     global $prefix, $dbi;      
340     $ultra = "ultramode.txt";      
341     $file = fopen("$ultra", "w");      
342     fwrite($file, "General purpose self-explanatory file with news headlines\n");      
343     $rfile=sql_query("select sid, aid, title, time, comments, topic from ".$prefix."_stories order by time DESC limit 0,10", $dbi);      
344     while(list($sid, $aid, $title, $time, $comments, $topic) = sql_fetch_row($rfile, $dbi)) {      
345         $rfile2=sql_query("select topictext, topicimage from ".$prefix."_topics where topicid=$topic", $dbi);      
346         list($topictext, $topicimage) = sql_fetch_row($rfile2, $dbi);      
347         $content = "%%\n$title\n/modules.php?name=News&file=article&sid=$sid\n$time\n$aid\n$topictext\n$comments\n$topicimage\n";      
348         fwrite($file, $content);      
349     }   124 /**
350     fclose($file);   125 * Sonstige Funktionen, Sammelbecken für alles nicht spezifische, aber wichtige an Funktionen für das Kernsystem
351 }      
352     126 */
353 function cookiedecode($user) {   127 include("includes/2f/2fmain-sonstiges.php");
354     global $cookie, $prefix, $dbi, $user_prefix;      
355     $user = base64_decode($user);      
356     $cookie = explode(":", $user);      
357     $result = sql_query("select pass from ".$user_prefix."_users where uname='$cookie[1]'", $dbi);      
358     list($pass) = sql_fetch_row($result, $dbi);      
359     if ($cookie[2] == $pass && $pass != "") {      
360         return $cookie;      
361     } else {      
362         unset($user);      
363         unset($cookie);      
364     }      
365 }   128  
366     129 /**
367 function getusrinfo($user) {   130 * Funktionen zur Ausgabe von Daten über das System
368     global $userinfo, $user_prefix, $dbi;      
369     $user2 = base64_decode($user);      
370     $user3 = explode(":", $user2);      
371     $result = sql_query("select uid, name, uname, email, femail, url, user_avatar, user_icq, user_occ, user_from, user_intrest, user_sig, user_viewemail, user_theme, user_aim, user_yim, user_msnm, pass, storynum, umode, uorder, thold, noscore, bio, ublockon, ublock, theme, commentmax, newsletter from ".$user_prefix."_users where uname='$user3[1]' and pass='$user3[2]'", $dbi);      
372     if (sql_num_rows($result, $dbi) == 1) {      
373         $userinfo = sql_fetch_array($result, $dbi);      
374     }   131 */
375     return $userinfo;   132 load_functions("2fmain-ausgabe.php");
376 }      
377   = 133  
378 function searchblock() { <>    
379     OpenTable();      
380     echo "<form action=\"modules.php?name=Forum&file=search\" method=\"post\">";      
381     echo "<input type=\"hidden\" name=\"addterm\" value=\"any\">";      
382     echo "<input type=\"hidden\" name=\"sortby\" value=\"p.post_time\">";      
383     echo "&nbsp;&nbsp;<b>"._SEARCH."</b>&nbsp;<input type=\"text\" name=\"term\" size=\"15\">";      
384     echo "<input type=\"hidden\" name=\"submit\" value=\"submit\"></form>";      
385     echo "<div align=\"left\"><font class=\"content\">&nbsp;&nbsp;[ <a href=\"modules.php?name=Forum&file=search&addterm=any&amp;sortby=p.post_time&amp;adv=1\">Advanced Search</a> ]</font></div>";      
386     CloseTable();      
387 }   134 /**
388     135 * Servervariablen laden
389 function FixQuotes ($what = "") {      
390         $what = ereg_replace("'","''",$what);      
391         while (eregi("\\\\'", $what)) {      
392                 $what = ereg_replace("\\\\'","'",$what);      
393         }   136 */
394         return $what;   137 load_functions("2fserver_vars.php");
395 }   138  
396     139 /**
397 /*********************************************************/   140 * Laden der Konfigurationsdaten.
398 /* text filter                                           */      
399 /*********************************************************/      
400     141 */
401 function check_words($Message) {      
402     global $EditedMessage;      
403     include("config.php");   142 include("config.php");
404     $EditedMessage = $Message;      
405     if ($CensorMode != 0) {      
406   = 143  
407         if (is_array($CensorList)) { <>    
408             $Replace = $CensorReplace;      
409             if ($CensorMode == 1) {      
410                 for ($i = 0; $i < count($CensorList); $i++) {      
411                     $EditedMessage = eregi_replace("$CensorList[$i]([^a-zA-Z0-9])","$Replace\\1",$EditedMessage);      
412                 }   144 /**
413             } elseif ($CensorMode == 2) {   145 * Datenbankdaten einlesen.
414                 for ($i = 0; $i < count($CensorList); $i++) {      
415                     $EditedMessage = eregi_replace("(^|[^[:alnum:]])$CensorList[$i]","\\1$Replace",$EditedMessage);      
416                 }   146 */
417             } elseif ($CensorMode == 3) {      
418                 for ($i = 0; $i < count($CensorList); $i++) {      
419                     $EditedMessage = eregi_replace("$CensorList[$i]","$Replace",$EditedMessage);      
420                 }   147 include('db.php');
421             }      
422         }   148  
423     }   149 /**
424     return ($EditedMessage);   150 * Laden der Datenbankfunktionen.
425 }   151 */
      152 load_functions("2fsql_layer.php");
426   = 153  
427 function delQuotes($string){ <>    
428     /* no recursive function to add quote to an HTML tag if needed */      
429     /* and delete duplicate spaces between attribs. */      
430     $tmp="";    # string buffer      
431     $result=""; # result string      
432     $i=0;   154 /**
433     $attrib=-1; # Are us in an HTML attrib ?   -1: no attrib   0: name of the attrib   1: value of the atrib      
434     $quote=0;   # Is a string quote delimited opened ? 0=no, 1=yes      
435     $len = strlen($string);   155 * Datenbankverbindung herstellen
436     while ($i<$len) {      
437         switch($string[$i]) { # What car is it in the buffer ?      
438             case "\"": #"       # a quote.      
439                 if ($quote==0) {      
440                     $quote=1;      
441                 } else {      
442                     $quote=0;      
443                     if (($attrib>0) && ($tmp != "")) { $result .= "=\"$tmp\""; }      
444                     $tmp="";      
445                     $attrib=-1;      
446                 }   156 */
447                 break;   157 global $dbhost, $dbuname, $dbpass, $dbname;                 //Zugangsdaten der Datenbank deklarieren
448             case "=":           # an equal - attrib delimiter   158 $dbi = sql_connect($dbhost, $dbuname, $dbpass, $dbname);                   //Verbindung zur Datenbank herstellen
449                 if ($quote==0) {  # Is it found in a string ?   159 $db = new vkp_db_class;                           //Kompatibilitätsklasse, um zu Modulen > 5.5 kompatibel zu sein
450                     $attrib=1;      
451                     if ($tmp!="") $result.=" $tmp";      
452                     $tmp="";      
453                 } else $tmp .= '=';      
454                 break;      
455             case " ":           # a blank ?      
456                 if ($attrib>0) {  # add it to the string, if one opened.      
457                     $tmp .= $string[$i];      
458                 }   160  
459                 break;   161 //Laden der externen Bibliotheken
460             default:            # Other   162 //Dies sind die "besonderen" 2F CMS Funktionen
461                 if ($attrib<0)    # If we weren't in an attrib, set attrib to 0   163 global $use_modrewrite, $use_error;
462                 $attrib=0;   164 if($use_error==1) error_reporting("E_ALL ^ E_NOTICES");             //Fehlerunterdrückung aktivieren wenn gewünscht
463                 $tmp .= $string[$i];      
464                 break;      
465         }   165  
466         $i++;      
467     }   166 /**
468     if (($quote!=0) && ($tmp != "")) {   167 * Spezielle Startfunktionen des 2F CMS.
469         if ($attrib==1) $result .= "=";      
470         /* If it is the value of an atrib, add the '=' */      
471         $result .= "\"$tmp\"";  /* Add quote if needed (the reason of the function ;-) */      
472     }   168 */
473     return $result;   169 load_functions("2fstart.php");                         //Spezielle Start-Datei
474 }      
475   = 170  
476 function check_html ($str, $strip="") { <>    
477     /* The core of this code has been lifted from phpslash */      
478     /* which is licenced under the GPL. */      
479     include("config.php");      
480     if ($strip == "nohtml")      
481         $AllowableHTML=array('');      
482         $str = stripslashes($str);      
483         $str = eregi_replace("<[[:space:]]*([^>]*)[[:space:]]*>",      
484                          '<\\1>', $str);      
485                // Delete all spaces from html tags .      
486         $str = eregi_replace("<a[^>]*href[[:space:]]*=[[:space:]]*\"?[[:space:]]*([^\" >]*)[[:space:]]*\"?[^>]*>",      
487                          '<a href="\\1">', $str); # "      
488                // Delete all attribs from Anchor, except an href, double quoted.      
489         $str = eregi_replace("<img?",      
490                          '', $str); # "      
491         $tmp = "";      
492         while (ereg("<(/?[[:alpha:]]*)[[:space:]]*([^>]*)>",$str,$reg)) {      
493                 $i = strpos($str,$reg[0]);      
494                 $l = strlen($reg[0]);      
495                 if ($reg[1][0] == "/") $tag = strtolower(substr($reg[1],1));      
496                 else $tag = strtolower($reg[1]);      
497                 if ($a = $AllowableHTML[$tag])      
498                         if ($reg[1][0] == "/") $tag = "</$tag>";      
499                         elseif (($a == 1) || ($reg[2] == "")) $tag = "<$tag>";      
500                         else {      
501                           # Place here the double quote fix function.      
502                           $attrb_list=delQuotes($reg[2]);      
503                           // A VER      
504                           $attrb_list = ereg_replace("&","&amp;",$attrb_list);      
505                           $tag = "<$tag" . $attrb_list . ">";      
506                         } # Attribs in tag allowed      
507                 else $tag = "";      
508                 $tmp .= substr($str,0,$i) . $tag;      
509                 $str = substr($str,$i+$l);      
510         }   171 /**
511         $str = $tmp . $str;      
512         return $str;      
513         exit;   172 * Lizenzfunktionen.
514         /* Squash PHP tags unconditionally */      
515         $str = ereg_replace("<\?","",$str);      
516         return $str;      
517 }      
518     173 */
519 function filter_text($Message, $strip="") {   174 load_functions("2flizenz.php");
520     global $EditedMessage;      
521     check_words($Message);      
522     $EditedMessage=check_html($EditedMessage, $strip);      
523     return ($EditedMessage);      
524 }      
525   = 175  
526 /*********************************************************/ <>    
527 /* formatting stories                                    */      
528 /*********************************************************/      
529     176 /**
530 function formatTimestamp($time) {   177 * Auslesen des aktiven Moduls
531     global $datetime, $locale;   178 * @global string $GLOBALS['aktivesmodul']
532     setlocale ("LC_TIME", "$locale");   179 * @global string Beinhaltet den Namen des Moduls, das auf der Startseite liegt
533     ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $time, $datetime);      
534     $datetime = strftime(""._DATESTRING."", mktime($datetime[4],$datetime[5],$datetime[6],$datetime[2],$datetime[3],$datetime[1]));      
535     $datetime = ucfirst($datetime);      
536     return($datetime);      
537 }      
538     180 */
539 function formatAidHeader($aid) {      
540     global $prefix, $dbi;   181 global $prefix, $dbi;
541     $holder = sql_query("SELECT url, email FROM ".$prefix."_authors where aid='$aid'", $dbi);   182 $resulttempx = sql_query("select main_module from ".$prefix."_main", $dbi);
542     if (!$holder) {   183 list($nameakt) = sql_fetch_row($resulttempx, $dbi);
543         echo _ERROR;   184 $GLOBALS['aktivesmodul']=$nameakt;
544         exit();   185  
545     }   186 /**
546     list($url, $email) = sql_fetch_row($holder, $dbi);   187 * Funktionen zum Sprachsystem.
547     if (isset($url)) {      
548         $aid = "<a href=\"$url\">$aid</a>";      
549     } elseif (isset($email)) {      
550         $aid = "<a href=\"mailto:$email\">$aid</a>";      
551     } else {      
552         $aid = $aid;      
553     }   188 */
554     echo "$aid";   189 load_functions("2fsprachen.php");
555 }      
556   = 190  
557 function get_author($aid) { <>    
558     global $prefix, $dbi;      
559     $holder = sql_query("SELECT url, email FROM ".$prefix."_authors where aid='$aid'", $dbi);      
560     if (!$holder) {      
561         echo _ERROR;      
562         exit();      
563     }   191 /**
564     list($url, $email) = sql_fetch_row($holder, $dbi);   192 * Laden der Versionsbibliothek.
565     if (isset($url)) {      
566         $aid = "<a href=\"$url\">$aid</a>";      
567     } elseif (isset($email)) {      
568         $aid = "<a href=\"mailto:$email\">$aid</a>";      
569     } else {      
570         $aid = $aid;      
571     }   193 */
572     return($aid);   194 load_functions("2fversion.php");
573 }   195  
574     196 /**
575 function themepreview($title, $hometext, $bodytext="", $notes="") {   197 * Die 2F CMS Content-Klasse laden.
576     echo "<b>$title</b><br><br>$hometext";      
577     if ($bodytext != "") {      
578         echo "<br><br>$bodytext";      
579     }   198 */
580     if ($notes != "") {   199 load_functions("2fcontent_classes.php");
581         echo "<br><br><b>"._NOTE."</b> <i>$notes</i>";      
582     }      
583 }   200  
584     201 /**
585 function adminblock() {   202 * Die Gruppenrechte-Klasse laden um Inhalte verschiedenen Gruppen zuzuordnen.
586     global $admin, $prefix, $dbi;      
587     if (is_admin($admin)) {      
588         $result = sql_query("select title, content from ".$prefix."_blocks where bkey='admin'", $dbi);      
589         while(list($title, $content) = sql_fetch_array($result, $dbi)) {      
590             $content = "<font class=\"content\">$content</font>";      
591             themesidebox($title, $content);      
592         }   203 */
593         $title = ""._WAITINGCONT."";   204 load_functions("2fgrouprights.php");
594         $result = sql_query("select * from ".$prefix."_queue", $dbi);      
595         $num = sql_num_rows($result, $dbi);      
596         $content = "<font class=\"content\">";      
597         $content .= "<strong><big>&middot;</big></strong>&nbsp;<a href=\"admin.php?op=submissions\">"._SUBMISSIONS."</a>: $num<br>";      
598         $result = sql_query("select * from ".$prefix."_reviews_add", $dbi);      
599         $num = sql_num_rows($result, $dbi);      
600         $content .= "<strong><big>&middot;</big></strong>&nbsp;<a href=\"admin.php?op=reviews\">"._WREVIEWS."</a>: $num<br>";      
601         $result = sql_query("select * from ".$prefix."_links_newlink", $dbi);      
602         $num = sql_num_rows($result, $dbi);      
603         $content .= "<strong><big>&middot;</big></strong>&nbsp;<a href=\"admin.php?op=Links\">"._WLINKS."</a>: $num<br>";      
604         $result = sql_query("select * from ".$prefix."_downloads_newdownload", $dbi);      
605         $num = sql_num_rows($result, $dbi);      
606         $content .= "<strong><big>&middot;</big></strong>&nbsp;<a href=\"admin.php?op=downloads\">"._UDOWNLOADS."</a>: $num<br></font>";      
607         themesidebox($title, $content);      
608     }      
609 }   205  
610     206 /**
611 function loginbox() {   207 * Laden einer "eigenen" Startdatei.
612     global $user;   208 * Wenn eigene Funktionen definiert werden sollen, einfach eine Datei "mystart.php" in includes/ anlegen.
613     if (!is_user($user)) {   209 * Diese Datei wird dann geladen - bei Updates geht dann nichts verloren.
614         $title = _LOGIN;      
615         $boxstuff = "<form action=\"modules.php?name=Your_Account\" method=\"post\">";      
616         $boxstuff .= "<center><font class=\"content\">"._NICKNAME."<br>";      
617         $boxstuff .= "<input type=\"text\" name=\"uname\" size=\"8\" maxlength=\"25\"><br>";      
618         $boxstuff .= ""._PASSWORD."<br>";      
619         $boxstuff .= "<input type=\"password\" name=\"pass\" size=\"8\" maxlength=\"20\"><br>";      
620         $boxstuff .= "<input type=\"hidden\" name=\"op\" value=\"login\">";      
621         $boxstuff .= "<input type=\"submit\" value=\""._LOGIN."\"></font></center></form>";      
622         $boxstuff .= "<center><font class=\"content\">"._ASREGISTERED."</font></center>";      
623         themesidebox($title, $boxstuff);      
624     }   210 */
625 }   211 if( file_exists("includes/mystart.php")) include_once("includes/mystart.php");
626   = 212  
627 function userblock() { <>    
628     global $user, $cookie, $prefix, $dbi, $user_prefix;      
629     if((is_user($user)) AND ($cookie[8])) {      
630         $getblock = sql_query("select ublock from ".$user_prefix."_users where uid='$cookie[0]'", $dbi);      
631         $title = ""._MENUFOR." $cookie[1]";      
632         list($ublock) = sql_fetch_row($getblock, $dbi);      
633         themesidebox($title, $ublock);      
634     }   213 /**
635 }   214 * Lädt den internen Cache
636     215 */
637 function getTopics($s_sid) {   216 load_functions("2fmain-cache.php");
638     global $topicname, $topicimage, $topictext, $prefix, $dbi;      
639     $sid = $s_sid;      
640     $result = sql_query("SELECT topic FROM ".$prefix."_stories where sid=$sid", $dbi);      
641     list($topic) = sql_fetch_row($result, $dbi);      
642     $result = sql_query("SELECT topicid, topicname, topicimage, topictext FROM ".$prefix."_topics where topicid=$topic", $dbi);      
643     list($topicid, $topicname, $topicimage, $topictext) = sql_fetch_row($result, $dbi);      
644 }   217  
645     218 /**
646 function headlines($bid, $cenbox=0) {   219 * Zurücksetzen der zwingenden CSS Dateien
647     global $prefix, $dbi;      
648     $result = sql_query("select title, content, url, refresh, time from ".$prefix."_blocks where bid='$bid'", $dbi);      
649     list($title, $content, $url, $refresh, $otime) = sql_fetch_row($result, $dbi);      
650     $past = time()-$refresh;      
651     if ($otime < $past) {      
652         $btime = time();      
653         $rdf = parse_url($url);      
654         $fp = fsockopen($rdf['host'], 80, $errno, $errstr, 15);      
655         if (!$fp) {      
656             $content = "";      
657             //$content = "<font class=\"content\">"._RSSPROBLEM."</font>";      
658             $result = sql_query("update ".$prefix."_blocks set content='$content', time='$btime' where bid='$bid'", $dbi);      
659             $cont = 0;      
660             if ($cenbox == 0) {      
661                 themesidebox($title, $content);      
662             } else {      
663                 themecenterbox($title, $content);      
664             }   220 */
665             return;   221 $cssmodules = array ();
666         }   222  
667         if ($fp) {      
668             fputs($fp, "GET " . $rdf['path'] . "?" . $rdf['query'] . " HTTP/1.0\r\n");      
669             fputs($fp, "HOST: " . $rdf['host'] . "\r\n\r\n");      
670             $string     = "";      
671             while(!feof($fp)) {      
672                 $pagetext = fgets($fp,300);      
673                 $string .= chop($pagetext);      
674             }   223 /**
675             fputs($fp,"Connection: close\r\n\r\n");   224 * Zurücksetzen der eigenen mod_rewrite Variablen
676             fclose($fp);   225 * Diese soll in jedem Modul in der mainfile-functions.php deklariert werden - um modulares mod_rewrite zu ermöglichen
677             $items = explode("</item>",$string);   226 * @global array $mod_rewrite_modules
678             $content = "<font class=\"content\">";   227 * @global array Beinhaltet die mod_rewrite-Regeln, die die Module in der mainfile-functions.php beliebig erweitern können
679             for ($i=0;$i<10;$i++) {      
680                 $link = ereg_replace(".*<link>","",$items[$i]);      
681                 $link = ereg_replace("</link>.*","",$link);      
682                 $title2 = ereg_replace(".*<title>","",$items[$i]);      
683                 $title2 = ereg_replace("</title>.*","",$title2);      
684                 if ($items[$i] == "") {      
685                     $content = "";      
686                     sql_query("update ".$prefix."_blocks set content='$content', time='$btime' where bid='$bid'", $dbi);      
687                     $cont = 0;      
688                     if ($cenbox == 0) {      
689                         themesidebox($title, $content);      
690                     } else {      
691                         themecenterbox($title, $content);      
692                     }      
693                     return;      
694                 } else {      
695                     if (strcmp($link,$title)) {      
696                         $cont = 1;      
697                         $content .= "<strong><big>&middot;</big></strong><a href=\"$link\" target=\"new\">$title2</a><br>\n";      
698                     }      
699                 }   228 */
700             }   229 $mod_rewrite_modules = array ();
701   = 230  
702         } <> 231 /**
703         sql_query("update ".$prefix."_blocks set content='$content', time='$btime' where bid='$bid'", $dbi);   232 * Hier werden Funktionen aus den Modulen direkt in die mainfile.php geladen.
704    }   233 * Dazu muss im Modul-Verzeichnis nur eine Datei mainfile-functions.php vorhanden sein.
705     $siteurl = ereg_replace("http://","",$url);   234 * Diese Datei wird automatisch geladen
706     $siteurl = explode("/",$siteurl);      
707     if (($cont == 1) OR ($content != "")) {      
708         $content .= "<br><a href=\"http://$siteurl[0]\" target=\"blank\"><b>"._HREADMORE."</b></a></font>";      
709     } elseif (($cont == 0) OR ($content == "")) {      
710         $content = "<font class=\"content\">"._RSSPROBLEM."</font>";      
711     }   235 */
712     if ($cenbox == 0) {   236 foreach($GLOBALS['allemodule'] as $modulname)
713         themesidebox($title, $content);   237 if(file_exists("modules/$modulname/mainfile-functions.php")) include_once("modules/$modulname/mainfile-functions.php");
714     } else {      
715         themecenterbox($title, $content);      
716     }      
717 }   238  
718     239 /**
719 function automated_news() {   240 * Die mod_rewrite Funktionen einlesen.
720     global $prefix, $multilingual, $currentlang, $dbi;      
721     if ($multilingual == 1) {      
722             $querylang = "WHERE (alanguage='$currentlang' OR alanguage='')"; /* the OR is needed to display stories who are posted to ALL languages */      
723     } else {      
724             $querylang = "";      
725     }   241 */
726     $today = getdate();   242 if($use_modrewrite==1) include("includes/2f/2fmodrewrite.php");
727     $day = $today[mday];      
728     if ($day < 10) {      
729         $day = "0$day";      
730     }   243  
731     $month = $today[mon];      
732     if ($month < 10) {      
733         $month = "0$month";      
734     }   244 /**
735     $year = $today[year];   245 * Fehlerroutinen und Funktionen zur Fehlererkennung laden
736     $hour = $today[hours];      
737     $min = $today[minutes];      
738     $sec = "00";      
739     $result = sql_query("select anid, time from ".$prefix."_autonews $querylang", $dbi);      
740     while(list($anid, $time) = sql_fetch_row($result, $dbi)) {      
741         ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $time, $date);      
742         if (($date[1] <= $year) AND ($date[2] <= $month) AND ($date[3] <= $day)) {      
743             if (($date[4] < $hour) AND ($date[5] >= $min) OR ($date[4] <= $hour) AND ($date[5] <= $min)) {      
744                 $result2 = sql_query("select catid, aid, title, time, hometext, bodytext, topic, informant, notes, ihome, alanguage, acomm from ".$prefix."_autonews where anid='$anid'", $dbi);      
745                 while(list($catid, $aid, $title, $a_time, $hometext, $bodytext, $topic, $author, $notes, $ihome, $alanguage, $acomm) = sql_fetch_row($result2, $dbi)) {      
746                     $title = stripslashes(FixQuotes($title));      
747                     $hometext = stripslashes(FixQuotes($hometext));      
748                     $bodytext = stripslashes(FixQuotes($bodytext));      
749                     $notes = stripslashes(FixQuotes($notes));      
750                     sql_query("insert into ".$prefix."_stories values (NULL, '$catid', '$aid', '$title', '$a_time', '$hometext', '$bodytext', '0', '0', '$topic', '$author', '$notes', '$ihome', '$alanguage', '$acomm', '0', '0', '0', '0')", $dbi);      
751                     sql_query("delete from ".$prefix."_autonews where anid='$anid'", $dbi);      
752                 }   246 */
753             }   247 load_functions("2ffehler.php");
754         }   248  
755     }   249 /**
756 }   250 * Ist die Seite Offline? Dann weiterleiten!
757     251 */
758 function themecenterbox($title, $content) {   252 global $usr_offline_onoff, $admin;
759     OpenTable();   253 if($usr_offline_onoff==1)
760     echo "<center><fon class=\"option\"><b>$title</b></font></center><br>"      
761         ."$content";   254 {
762     CloseTable();   255   if( $_REQUEST['name']!="Offline" && !stristr($_SERVER['PHP_SELF'],"admin.php") && !is_admin($admin) ) vkpLocation("modules.php?name=Offline");
763     echo "<br>";      
764 }   256 }
765   = 257  
766 ?>   258 ?>