gnuheter-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnuheter-dev] comments: isRealUser() m m


From: Ulf Harnhammar
Subject: [Gnuheter-dev] comments: isRealUser() m m
Date: Thu, 15 Aug 2002 21:57:50 +0200 (CEST)

Hej,

nu har jag commitat en till patch (!) som lägger in isRealUser() i
comments. Som trevlig bieffekt får man ner antalet olika ställen där
mainfile.php inkluderas från sex till ett ställe. Strulet med
$savemainfile beror på att comments inkluderas från article.

// Ulf


--- comments.php.old    2002-08-15 20:39:23.000000000 +0200
+++ comments.php        2002-08-15 21:11:10.000000000 +0200
@@ -27,6 +27,14 @@
 
 if (!isset($config)) include('config.php');
 
+$savemainfile = $mainfile;
+if (ereg('/comments\.php$', $SCRIPT_NAME))
+       include('mainfile.php');
+$mainfile = $savemainfile;
+
+isRealUser($HTTP_COOKIE_VARS['user']);
+
+
 function modone() {
        global $admin,$moderate,$REQUEST_URI;
        if (((isset($admin)) && ($moderate == 1)) || ($moderate == 2)) {
@@ -215,10 +223,9 @@
        global $user, $datetime, $cookie, $mainfile, $admin;
        global $bgcolor1, $bgcolor2, $bgcolor3;
        global $dbhost,$dbuname,$dbpass,$dbname;
-       if (address@hidden) {
-               include('mainfile.php');
+       if (address@hidden)
                include('header.php');
-       } else {
+       else {
                if (!isset($config)) include('config.php');
         }
        dbconnect();
@@ -252,7 +259,6 @@
 }
 
 function singlecomment($tid, $sid, $mode, $order, $thold) {
-       include('mainfile.php');
        include('header.php');
        global $user, $cookie;
        dbconnect();
@@ -268,11 +274,10 @@
 }
 
 function reply($pid, $sid, $mode, $order, $thold) {
-        global $dbhost,$dbuname,$dbpass,$dbname,$REQUEST_URI;
-        if (address@hidden) {
-                include('mainfile.php');
+        global $mainfile,$dbhost,$dbuname,$dbpass,$dbname,$REQUEST_URI;
+        if (address@hidden)
                 include('header.php');
-        } else {
+        else {
                 if (!isset($config)) include('config.php');
         }
        global $user, $cookie, $bgcolor1, $bgcolor2, $bgcolor3;
@@ -323,11 +328,10 @@
 }
 
 function replyPreview ($pid, $sid, $subject, $comment, $postanon, $mode, 
$order, $thold, $posttype) {
-        global $dbhost,$dbuname,$dbpass,$dbname,$REQUEST_URI;
-       if(address@hidden) {
-                include('mainfile.php');
+       global $mainfile,$dbhost,$dbuname,$dbpass,$dbname,$REQUEST_URI;
+       if(address@hidden)
                 include('header.php');
-        } else {
+        else {
                 if (!isset($config)) include('config.php');
         }
        global $user, $cookie;
@@ -383,7 +387,6 @@
 
 function CreateTopic ($postanon, $subject, $comment, $pid, $sid, $host_name, 
$mode, $order, $thold, $posttype) {
         global $dbhost,$dbuname,$dbpass,$dbname,$mainfile;
-       if (!$mainfile) include('mainfile.php');
        global $user, $userinfo, $EditedMessage, $cookie;
        dbconnect();
        $author = FixQuotes($author);
@@ -442,6 +445,7 @@
        Header("Location: 
article.php?sid=$sid&mode=$mode&order=$order&thold=$thold");
 }
 
+
 switch ($op) {
        case "Reply":
                reply($pid, $sid, $mode, $order, $thold);
@@ -456,7 +460,6 @@
                if (isset($admin)) {
                        include('auth.inc.php');
                } else {
-                       include('mainfile.php');
                        dbconnect();
                }
                if (($admintest==1) || ($moderate==2)) {





reply via email to

[Prev in Thread] Current Thread [Next in Thread]