More variables renamed to , install/admin_WriteData() is now generic (with open TODO)
authorRoland Häder <roland@mxchange.org>
Tue, 24 Feb 2009 00:02:26 +0000 (00:02 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 24 Feb 2009 00:02:26 +0000 (00:02 +0000)
12 files changed:
DOCS/TODOs.txt
inc/db/lib-mysql3.php
inc/functions.php
inc/gen_sql_patches.php
inc/install-inc.php
inc/libs/cache_functions.php
inc/load_extensions.php
inc/modules/admin.php
inc/modules/admin/admin-inc.php
inc/modules/admin/what-theme_check.php
inc/modules/member/what-reflinks.php
inc/mysql-manager.php

index 08a314f678bd08d523fa9dee6f4bd48b2c93bd56..096d83001ea33a8b61a0aac55b9a32899979ac59 100644 (file)
@@ -3,6 +3,7 @@
 ./inc/extensions/ext-sql_patches.php:740:                      // @TODO Rewrite this to a filter!
 ./inc/extensions/ext-sql_patches.php:778:              // @TODO Can we remove this? setConfigEntry('verbose_sql'        , "N");
 ./inc/extensions/ext-nickname.php:204: // @TODO|@DEPRECATED Please rewrite these constants, LOAD_CONFIG() is no more needed in extensions
 ./inc/extensions/ext-sql_patches.php:740:                      // @TODO Rewrite this to a filter!
 ./inc/extensions/ext-sql_patches.php:778:              // @TODO Can we remove this? setConfigEntry('verbose_sql'        , "N");
 ./inc/extensions/ext-nickname.php:204: // @TODO|@DEPRECATED Please rewrite these constants, LOAD_CONFIG() is no more needed in extensions
+./inc/modules/guest/what-wernis_portal.php:80://  @TODO Can this be removed? $rdf->clear_cache();
 ./inc/modules/guest/what-sponsor_reg.php:279:          // @TODO Swap this HTML code to templates
 ./inc/modules/guest/what-register.php:194:     // @TODO Rewrite this to a single filter
 ./inc/modules/member/what-bonus.php:50:        // @TODO Rewrite this to a filter
 ./inc/modules/guest/what-sponsor_reg.php:279:          // @TODO Swap this HTML code to templates
 ./inc/modules/guest/what-register.php:194:     // @TODO Rewrite this to a single filter
 ./inc/modules/member/what-bonus.php:50:        // @TODO Rewrite this to a filter
@@ -23,8 +24,8 @@
 ./inc/modules/admin/overview-inc.php:269:                                      default: // @TODO Unknown support mode
 ./inc/modules/admin/what-repair_amenu.php:79:// @TODO This causes the whole (!) menu cache being rebuilded
 ./inc/modules/admin.php:92:                            // @TODO Why is this set to 'done'?
 ./inc/modules/admin/overview-inc.php:269:                                      default: // @TODO Unknown support mode
 ./inc/modules/admin/what-repair_amenu.php:79:// @TODO This causes the whole (!) menu cache being rebuilded
 ./inc/modules/admin.php:92:                            // @TODO Why is this set to 'done'?
-./inc/libs/task_functions.php:48:// @TODO Move all extension-dependent queries into filters
 ./inc/libs/yoomedia_functions.php:60:  $response = YOOMEDIA_QUERY_API("out_textmail.php", true); // @TODO Ask Yoo!Media for test script
 ./inc/libs/yoomedia_functions.php:60:  $response = YOOMEDIA_QUERY_API("out_textmail.php", true); // @TODO Ask Yoo!Media for test script
+./inc/libs/task_functions.php:48:// @TODO Move all extension-dependent queries into filters
 ./inc/libs/rallye_functions.php:653:   $EXPIRE = getConfig('one_day') * 3; // @TODO The hard-coded value...
 ./inc/libs/rallye_functions.php:717:           // @TODO Rewrite this to our API function
 ./inc/libs/doubler_functions.php:41:// @TODO Lame description
 ./inc/libs/rallye_functions.php:653:   $EXPIRE = getConfig('one_day') * 3; // @TODO The hard-coded value...
 ./inc/libs/rallye_functions.php:717:           // @TODO Rewrite this to our API function
 ./inc/libs/doubler_functions.php:41:// @TODO Lame description
@@ -46,8 +47,9 @@
 ./inc/functions.php:3321:// @TODO Implement $compress
 ./inc/functions.php:3328:// @TODO Implement $decompress
 ./inc/functions.php:3431:      // @TODO We may want to switch over to UTF-8 here!
 ./inc/functions.php:3321:// @TODO Implement $compress
 ./inc/functions.php:3328:// @TODO Implement $decompress
 ./inc/functions.php:3431:      // @TODO We may want to switch over to UTF-8 here!
-./inc/mysql-manager.php:1713:                          // @TODO Find a way for updating $_CONFIG here
-./inc/mysql-manager.php:1737:          // @TODO Find a way for updating $_CONFIG here
+./inc/functions.php:3439:// @TODO Rewrite this function to use READ_FILE() and WRITE_FILE()
+./inc/mysql-manager.php:1715:                          // @TODO Find a way for updating $_CONFIG here
+./inc/mysql-manager.php:1739:          // @TODO Find a way for updating $_CONFIG here
 ./beg.php:191:                         // @TODO Opps, what is missing here???
 ./beg.php:191:                         // @TODO Opps, what is missing here???
-./mailid_top.php:205:                                                                  // @TODO Rewrite these blocks to filter
 ./surfbar.php:60:              // @TODO Display quick login form here or redirect as configured
 ./surfbar.php:60:              // @TODO Display quick login form here or redirect as configured
+./mailid_top.php:205:                                                                  // @TODO Rewrite these blocks to filter
index f90a8f6f9ab8b009b1f8a885b86822a416349cb5..50b7189f8358b768cbee03da7fc8115b129c3c5e 100644 (file)
@@ -232,7 +232,7 @@ function SQL_FREERESULT ($result) {
 }
 
 // SQL string escaping
 }
 
 // SQL string escaping
-function SQL_QUERY_ESC ($qstring, $data, $file, $line, $run=true, $strip=true) {
+function SQL_QUERY_ESC ($qstring, $data, $F, $L, $run=true, $strip=true) {
        global $link;
 
        // Link is there?
        global $link;
 
        // Link is there?
@@ -260,7 +260,7 @@ function SQL_QUERY_ESC ($qstring, $data, $file, $line, $run=true, $strip=true) {
        // Debugging
        //
        //* DEBUG: */ $fp = fopen(constant('PATH')."inc/cache/escape_debug.log", 'a') or mxchange_die("Cannot write debug.log!");
        // Debugging
        //
        //* DEBUG: */ $fp = fopen(constant('PATH')."inc/cache/escape_debug.log", 'a') or mxchange_die("Cannot write debug.log!");
-       //* DEBUG: */ fwrite($fp, $file."(".$line."): ".str_replace("\r", "", str_replace("\n", " ", $eval))."\n");
+       //* DEBUG: */ fwrite($fp, $F."(".$L."): ".str_replace("\r", "", str_replace("\n", " ", $eval))."\n");
        //* DEBUG: */ fclose($fp);
 
        // Run the code
        //* DEBUG: */ fclose($fp);
 
        // Run the code
@@ -274,7 +274,7 @@ function SQL_QUERY_ESC ($qstring, $data, $file, $line, $run=true, $strip=true) {
 
        if ($run === true) {
                // Run SQL query (default)
 
        if ($run === true) {
                // Run SQL query (default)
-               return SQL_QUERY($query, $file, $line);
+               return SQL_QUERY($query, $F, $L);
        } else {
                // Return secured string
                return $query;
        } else {
                // Return secured string
                return $query;
index ef6cbde5323b40bf5ff838a7513d39983f08896d..f7c7e5be093bdba37e0ad2cb3ed14c2e8b2c3e2e 100644 (file)
@@ -303,7 +303,7 @@ function LOAD_TEMPLATE ($template, $return=false, $content=array()) {
        ////////////////////////
        // Generate file name //
        ////////////////////////
        ////////////////////////
        // Generate file name //
        ////////////////////////
-       $file = $BASE.$MODE.$template.".tpl";
+       $FQFN = $BASE.$MODE.$template.".tpl";
 
        if ((!empty($GLOBALS['what'])) && ((strpos($template, "_header") > 0) || (strpos($template, "_footer") > 0)) && (($MODE == "guest/") || ($MODE == "member/") || ($MODE == "admin/"))) {
                // Select what depended header/footer template file for admin/guest/member area
 
        if ((!empty($GLOBALS['what'])) && ((strpos($template, "_header") > 0) || (strpos($template, "_footer") > 0)) && (($MODE == "guest/") || ($MODE == "member/") || ($MODE == "admin/"))) {
                // Select what depended header/footer template file for admin/guest/member area
@@ -315,22 +315,22 @@ function LOAD_TEMPLATE ($template, $return=false, $content=array()) {
                );
 
                // Probe for it...
                );
 
                // Probe for it...
-               if (FILE_READABLE($file2)) $file = $file2;
+               if (FILE_READABLE($file2)) $FQFN = $file2;
 
                // Remove variable from memory
                unset($file2);
        }
 
        // Does the special template exists?
 
                // Remove variable from memory
                unset($file2);
        }
 
        // Does the special template exists?
-       if (!FILE_READABLE($file)) {
+       if (!FILE_READABLE($FQFN)) {
                // Reset to default template
                // Reset to default template
-               $file = $BASE.$template.".tpl";
+               $FQFN = $BASE.$template.".tpl";
        } // END - if
 
        // Now does the final template exists?
        } // END - if
 
        // Now does the final template exists?
-       if (FILE_READABLE($file)) {
+       if (FILE_READABLE($FQFN)) {
                // The local file does exists so we load it. :)
                // The local file does exists so we load it. :)
-               $tmpl_file = READ_FILE($file);
+               $tmpl_file = READ_FILE($FQFN);
 
                // Replace ' to our own chars to preventing them being quoted
                while (strpos($tmpl_file, "'") !== false) { $tmpl_file = str_replace("'", '{QUOT}', $tmpl_file); }
 
                // Replace ' to our own chars to preventing them being quoted
                while (strpos($tmpl_file, "'") !== false) { $tmpl_file = str_replace("'", '{QUOT}', $tmpl_file); }
@@ -351,7 +351,7 @@ function LOAD_TEMPLATE ($template, $return=false, $content=array()) {
        } elseif ((IS_ADMIN()) || ((isBooleanConstantAndTrue('mxchange_installing')) && (!isBooleanConstantAndTrue('mxchange_installed')))) {
                // Only admins shall see this warning or when installation mode is active
                $ret = "<br /><span class=\"guest_failed\">".TEMPLATE_404."</span><br />
        } elseif ((IS_ADMIN()) || ((isBooleanConstantAndTrue('mxchange_installing')) && (!isBooleanConstantAndTrue('mxchange_installed')))) {
                // Only admins shall see this warning or when installation mode is active
                $ret = "<br /><span class=\"guest_failed\">".TEMPLATE_404."</span><br />
-(".basename($file).")<br />
+(".basename($FQFN).")<br />
 <br />
 ".TEMPLATE_CONTENT."
 <pre>".print_r($content, true)."</pre>
 <br />
 ".TEMPLATE_CONTENT."
 <pre>".print_r($content, true)."</pre>
@@ -830,36 +830,36 @@ function LOAD_EMAIL_TEMPLATE($template, $content=array(), $UID="0") {
        // Check for admin/guest/member templates
        if (strpos($template, "admin_") > -1) {
                // Admin template found
        // Check for admin/guest/member templates
        if (strpos($template, "admin_") > -1) {
                // Admin template found
-               $file = $BASE."admin/".$template.".tpl";
+               $FQFN = $BASE."admin/".$template.".tpl";
        } elseif (strpos($template, "guest_") > -1) {
                // Guest template found
        } elseif (strpos($template, "guest_") > -1) {
                // Guest template found
-               $file = $BASE."guest/".$template.".tpl";
+               $FQFN = $BASE."guest/".$template.".tpl";
        } elseif (strpos($template, "member_") > -1) {
                // Member template found
        } elseif (strpos($template, "member_") > -1) {
                // Member template found
-               $file = $BASE."member/".$template.".tpl";
+               $FQFN = $BASE."member/".$template.".tpl";
        } else {
                // Test for extension
                $test = substr($template, 0, strpos($template, "_"));
                if (EXT_IS_ACTIVE($test)) {
                        // Set extra path to extension's name
        } else {
                // Test for extension
                $test = substr($template, 0, strpos($template, "_"));
                if (EXT_IS_ACTIVE($test)) {
                        // Set extra path to extension's name
-                       $file = $BASE.$test."/".$template.".tpl";
+                       $FQFN = $BASE.$test."/".$template.".tpl";
                } else {
                        // No special filename
                } else {
                        // No special filename
-                       $file = $BASE.$template.".tpl";
+                       $FQFN = $BASE.$template.".tpl";
                }
        }
 
        // Does the special template exists?
                }
        }
 
        // Does the special template exists?
-       if (!FILE_READABLE($file)) {
+       if (!FILE_READABLE($FQFN)) {
                // Reset to default template
                // Reset to default template
-               $file = $BASE.$template.".tpl";
+               $FQFN = $BASE.$template.".tpl";
        } // END - if
 
        // Now does the final template exists?
        $newContent = "";
        } // END - if
 
        // Now does the final template exists?
        $newContent = "";
-       if (FILE_READABLE($file)) {
+       if (FILE_READABLE($FQFN)) {
                // The local file does exists so we load it. :)
                // The local file does exists so we load it. :)
-               $tmpl_file = READ_FILE($file);
+               $tmpl_file = READ_FILE($FQFN);
                $tmpl_file = SQL_ESCAPE($tmpl_file);
 
                // Run code
                $tmpl_file = SQL_ESCAPE($tmpl_file);
 
                // Run code
@@ -2418,12 +2418,12 @@ function merge_array ($array1, $array2) {
 }
 
 // Debug message logger
 }
 
 // Debug message logger
-function DEBUG_LOG ($file, $line, $message, $force=true) {
+function DEBUG_LOG ($funcFile, $line, $message, $force=true) {
        // Is debug mode enabled?
        if ((isBooleanConstantAndTrue('DEBUG_MODE')) || ($force === true)) {
                // Log this message away
                $fp = fopen(constant('PATH')."inc/cache/debug.log", 'a') or mxchange_die("Cannot write logfile debug.log!");
        // Is debug mode enabled?
        if ((isBooleanConstantAndTrue('DEBUG_MODE')) || ($force === true)) {
                // Log this message away
                $fp = fopen(constant('PATH')."inc/cache/debug.log", 'a') or mxchange_die("Cannot write logfile debug.log!");
-               fwrite($fp, date("d.m.Y|H:i:s", time())."|".basename($file)."|".$line."|".strip_tags($message)."\n");
+               fwrite($fp, date("d.m.Y|H:i:s", time())."|".basename($funcFile)."|".$line."|".strip_tags($message)."\n");
                fclose($fp);
        } // END - if
 }
                fclose($fp);
        } // END - if
 }
@@ -2439,11 +2439,11 @@ function GET_DIR_AS_ARRAY ($baseDir, $prefix) {
        while ($baseFile = readdir($dirPointer)) {
                // Load file only if extension is active
                // Make full path
        while ($baseFile = readdir($dirPointer)) {
                // Load file only if extension is active
                // Make full path
-               $file = $baseDir.$baseFile;
+               $FQFN = $baseDir.$baseFile;
 
                // Is this a valid reset file?
                //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):baseDir={$baseDir},prefix={$prefix},baseFile={$baseFile}<br />\n";
 
                // Is this a valid reset file?
                //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):baseDir={$baseDir},prefix={$prefix},baseFile={$baseFile}<br />\n";
-               if ((FILE_READABLE($file)) && (substr($baseFile, 0, strlen($prefix)) == $prefix) && (substr($baseFile, -4, 4) == ".php")) {
+               if ((FILE_READABLE($FQFN)) && (substr($baseFile, 0, strlen($prefix)) == $prefix) && (substr($baseFile, -4, 4) == ".php")) {
                        // Remove both for extension name
                        $extName = substr($baseFile, strlen($prefix), -4);
 
                        // Remove both for extension name
                        $extName = substr($baseFile, strlen($prefix), -4);
 
@@ -2453,10 +2453,10 @@ function GET_DIR_AS_ARRAY ($baseDir, $prefix) {
                        // Is the extension valid and active?
                        if (($extId > 0) && (EXT_IS_ACTIVE($extName))) {
                                // Then add this file
                        // Is the extension valid and active?
                        if (($extId > 0) && (EXT_IS_ACTIVE($extName))) {
                                // Then add this file
-                               $INCs[] = $file;
+                               $INCs[] = $FQFN;
                        } elseif ($extId == 0) {
                                // Add non-extension files as well
                        } elseif ($extId == 0) {
                                // Add non-extension files as well
-                               $INCs[] = $file;
+                               $INCs[] = $FQFN;
                        }
                } // END - if
        } // END - while
                        }
                } // END - if
        } // END - while
@@ -3435,6 +3435,78 @@ function decodeEntities ($str) {
        return $decodedString;
 }
 
        return $decodedString;
 }
 
+// Wtites data to a config.php-style file
+// @TODO Rewrite this function to use READ_FILE() and WRITE_FILE()
+function changeDataInFile ($FQFN, $comment, $prefix, $suffix, $DATA, $seek=0) {
+       // Initialize some variables
+       $done = false;
+       $seek++;
+       $next  = -1;
+       $found = false;
+
+       // Is the file there and read-/write-able?
+       if ((FILE_READABLE($FQFN)) && (is_writeable($FQFN))) {
+               $search = "CFG: ".$comment;
+               $tmp = $FQFN.".tmp";
+
+               // Open the source file
+               $fp = @fopen($FQFN, 'r') or OUTPUT_HTML("<strong>READ:</strong> ".$FQFN."<br />");
+
+               // Is the resource valid?
+               if (is_resource($fp)) {
+                       // Open temporary file
+                       $fp_tmp = @fopen($tmp, 'w') or OUTPUT_HTML("<strong>WRITE:</strong> ".$tmp."<br />");
+
+                       // Is the resource again valid?
+                       if (is_resource($fp_tmp)) {
+                               while (!feof($fp)) {
+                                       // Read from source file
+                                       $line = fgets ($fp, 1024);
+
+                                       if (strpos($line, $search) > -1) { $next = 0; $found = true; }
+
+                                       if ($next > -1) {
+                                               if ($next === $seek) {
+                                                       $next = -1;
+                                                       $line = $prefix . $DATA . $suffix."\n";
+                                               } else {
+                                                       $next++;
+                                               }
+                                       }
+
+                                       // Write to temp file
+                                       fputs($fp_tmp, $line);
+                               }
+
+                               // Close temp file
+                               fclose($fp_tmp);
+
+                               // Finished writing tmp file
+                               $done = true;
+                       }
+
+                       // Close source file
+                       fclose($fp);
+
+                       if (($done) && ($found)) {
+                               // Copy back tmp file and delete tmp :-)
+                               @copy($tmp, $FQFN);
+                               @unlink($tmp);
+                               define('_FATAL', false);
+                       } elseif (!$found) {
+                               OUTPUT_HTML("<strong>CHANGE:</strong> 404!");
+                               define('_FATAL', true);
+                       } else {
+                               OUTPUT_HTML("<strong>TMP:</strong> UNDONE!");
+                               define('_FATAL', true);
+                       }
+               }
+       } else {
+               // File not found, not readable or writeable
+               OUTPUT_HTML("<strong>404:</strong> ".$FQFN."<br />");
+       }
+}
+
 //////////////////////////////////////////////////
 // AUTOMATICALLY RE-GENERATED MISSING FUNCTIONS //
 //////////////////////////////////////////////////
 //////////////////////////////////////////////////
 // AUTOMATICALLY RE-GENERATED MISSING FUNCTIONS //
 //////////////////////////////////////////////////
index 1a7c1fc7951b04528f5df70cf7af11e416328fb1..20cf9be76d26061f34060589bdebfcffc472bbd5 100644 (file)
@@ -71,10 +71,10 @@ if (getConfig('master_salt') == "") {
 
 if (getConfig('file_hash') == "") {
        // Create filename from hashed random string
 
 if (getConfig('file_hash') == "") {
        // Create filename from hashed random string
-       $file_hash = sha1(GEN_PASS(mt_rand(128, 256)));
-       $file = sprintf("%sinc/.secret/.%s",
+       $fileHash = sha1(GEN_PASS(mt_rand(128, 256)));
+       $FQFN = sprintf("%sinc/.secret/.%s",
                constant('PATH'),
                constant('PATH'),
-               $file_hash
+               $fileHash
        );
 
        // Count of chars to be taken from back of the string
        );
 
        // Count of chars to be taken from back of the string
@@ -84,18 +84,18 @@ if (getConfig('file_hash') == "") {
        $secretKey = substr(sha1(GEN_PASS(mt_rand(128, 256))), -$nums);
 
        // File hash was never created
        $secretKey = substr(sha1(GEN_PASS(mt_rand(128, 256))), -$nums);
 
        // File hash was never created
-       WRITE_FILE($file, $secretKey);
+       WRITE_FILE($FQFN, $secretKey);
 
        // Is the file there?
 
        // Is the file there?
-       if (FILE_READABLE($file)) {
-               //* DEBUG: */ unlink($file);
+       if (FILE_READABLE($FQFN)) {
+               //* DEBUG: */ unlink($FQFN);
                //* DEBUG: */ $test = hexdec(get_session('u_hash')) / hexdec($secretKey);
                //* DEBUG: */ $test = generateHash(str_replace('.', "", $test));
                //* DEBUG: */ die("Secret-Key: ".$secretKey."<br />Cookie: ".get_session('u_hash')."<br />Test: ".$test);
 
                //* DEBUG: */ $test = hexdec(get_session('u_hash')) / hexdec($secretKey);
                //* DEBUG: */ $test = generateHash(str_replace('.', "", $test));
                //* DEBUG: */ die("Secret-Key: ".$secretKey."<br />Cookie: ".get_session('u_hash')."<br />Test: ".$test);
 
-               // Write $file_hash to database
+               // Write $fileHash to database
                SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_config` SET file_hash='%s' WHERE config=0 LIMIT 1",
                SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_config` SET file_hash='%s' WHERE config=0 LIMIT 1",
-                       array($file_hash), __FILE__, __LINE__);
+                       array($fileHash), __FILE__, __LINE__);
 
                // Generate FQFN for .htaccess file
                $FQFN = sprintf("%sinc/.secret/.htaccess",
 
                // Generate FQFN for .htaccess file
                $FQFN = sprintf("%sinc/.secret/.htaccess",
@@ -110,11 +110,11 @@ if (getConfig('file_hash') == "") {
 
                // Also update configuration
                setConfigEntry('secret_key', $secretKey);
 
                // Also update configuration
                setConfigEntry('secret_key', $secretKey);
-               setConfigEntry('file_hash' , $file_hash);
+               setConfigEntry('file_hash' , $fileHash);
 
                // Remove variables
                unset($secretKey);
 
                // Remove variables
                unset($secretKey);
-               unset($file_hash);
+               unset($fileHash);
        } // END - if
 } // END - if
 
        } // END - if
 } // END - if
 
index eb857910094daf7a2bca0bbd174264c32e30d058..dad33f5438c98e51f9164c01a92ab512dc337287 100644 (file)
@@ -41,74 +41,9 @@ if (!defined('__SECURITY')) {
        require($INC);
 }
 
        require($INC);
 }
 
-//
-function install_WriteData ($file, $comment, $prefix, $suffix, $DATA, $sneak=0) {
-       // Initialize all and count up the "seak" value
-       $done = false;
-       $next = -1;
-       $sneak++;
-
-       if (FILE_READABLE($file)) {
-               $search = "CFG: ".$comment;
-               $tmp = $file.".tmp";
-               $fp = @fopen($file, 'r') or OUTPUT_HTML("<strong>READ:</strong> ".$file."<br />");
-               if (is_resource($fp)) {
-                       $fp_tmp = @fopen($tmp, 'w') or OUTPUT_HTML("<strong>WRITE:</strong> ".$tmp."<br />");
-                       if (is_resource($fp_tmp)) {
-                               while (!feof($fp)) {
-                                       $line = fgets ($fp, 10240);
-                                       //* DEBUG: */ echo $search."/<font color=\"red\">".htmlentities($line)."</font><br />\n";
-                                       $found = strpos($line, $search);
-                                       //* DEBUG: */ echo "FOUND: <font color=\"brown\">";
-                                       //* DEBUG: */ var_dump($found);
-                                       //* DEBUG: */ echo "</font><br />\n";
-                                       if ($found !== false) $next = 0;
-                                       if ($next > -1) {
-                                               if ($next == $sneak) {
-                                                       $next = -1;
-                                                       $line = $prefix.$DATA.$suffix."\n";
-                                                       //* DEBUG: */ echo "NEW: <font color=\"blue\">".htmlentities($line)."</font><br />\n";
-                                               } else {
-                                                       $next++;
-                                               }
-                                       } // END - if
-                                       //* DEBUG: */ echo "WRITE: <font color=\"green\">".htmlentities($line)."</font><br />\n";
-                                       fputs($fp_tmp, $line);
-                               } // END - while
-                               fclose($fp_tmp);
-
-                               // Finished writing tmp file
-                               $done = true;
-                       } // END - if
-
-                       // Close source directory
-                       fclose($fp);
-
-                       if (($done) && (is_writeable($file))) {
-                               // Copy back tmp file and delete tmp :-)
-                               @copy($tmp, $file);
-                               @unlink($tmp);
-                       } else {
-                               OUTPUT_HTML("<strong>TMP:</strong> UNDONE!");
-                       }
-               } // END - if
-       } else {
-               OUTPUT_HTML("<strong>404:</strong> ".$file."<br />");
-       }
-}
-
-//
+// Init variables
 $mysql = "";
 $mysql = "";
-if (isset($_POST['mysql']) && is_array($_POST['mysql'])) $mysql = $_POST['mysql'];
-
-if (URL != "http://your-server.com") {
-       // Already installed???
-       $burl = constant('URL');
-} elseif (empty($burl)) {
-       // Auto-detect URL
-       $burl = "http://".$SERVER_NAME.$_SERVER['PHP_SELF'];
-       $burl = substr($burl, 0, strpos($burl, "install.php"));
-}
+if ((isset($_POST['mysql'])) && (is_array($_POST['mysql']))) $mysql = $_POST['mysql'];
 
 // Check if both passwords from SMTP are matching
 if ((isset($_GET['page']) && ($_GET['page'] == 5))) {
 
 // Check if both passwords from SMTP are matching
 if ((isset($_GET['page']) && ($_GET['page'] == 5))) {
@@ -118,16 +53,19 @@ if ((isset($_GET['page']) && ($_GET['page'] == 5))) {
                OUTPUT_HTML(getMessage('INSTALL_SMTP_HOSTNAME_EMPTY')."<br />");
                $_GET['page'] = 3;
        } // END - if
                OUTPUT_HTML(getMessage('INSTALL_SMTP_HOSTNAME_EMPTY')."<br />");
                $_GET['page'] = 3;
        } // END - if
+
        if ((empty($_POST['smtp_pass1'])) && (!empty($_POST['smtp_pass2']))) {
                // Password is empty
                OUTPUT_HTML(getMessage('INSTALL_SMTP_PASS1_EMPTY')."<br />");
                $_GET['page'] = 3;
        } // END - if
        if ((empty($_POST['smtp_pass1'])) && (!empty($_POST['smtp_pass2']))) {
                // Password is empty
                OUTPUT_HTML(getMessage('INSTALL_SMTP_PASS1_EMPTY')."<br />");
                $_GET['page'] = 3;
        } // END - if
+
        if ((!empty($_POST['smtp_pass1'])) && (empty($_POST['smtp_pass2']))) {
                // Password repeat is empty
                OUTPUT_HTML(getMessage('INSTALL_SMTP_PASS2_EMPTY')."<br />");
                $_GET['page'] = 3;
        } // END - if
        if ((!empty($_POST['smtp_pass1'])) && (empty($_POST['smtp_pass2']))) {
                // Password repeat is empty
                OUTPUT_HTML(getMessage('INSTALL_SMTP_PASS2_EMPTY')."<br />");
                $_GET['page'] = 3;
        } // END - if
+
        if ($_POST['smtp_pass1'] != $_POST['smtp_pass1']) {
                // Passwords are not matching
                OUTPUT_HTML(getMessage('INSTALL_SMTP_PASS_MISMATCH')."<br />");
        if ($_POST['smtp_pass1'] != $_POST['smtp_pass1']) {
                // Passwords are not matching
                OUTPUT_HTML(getMessage('INSTALL_SMTP_PASS_MISMATCH')."<br />");
@@ -139,7 +77,7 @@ if ((isset($_GET['page']) && ($_GET['page'] == 5))) {
 if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndTrue('admin_registered')))
 {
        // Set URL for FORM actions
 if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndTrue('admin_registered')))
 {
        // Set URL for FORM actions
-       define('__BURL_ACTION', $burl);
+       define('__BURL_ACTION', constant('URL'));
 
        // Output page for entered value
        switch ($_GET['page'])
 
        // Output page for entered value
        switch ($_GET['page'])
@@ -341,14 +279,17 @@ if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndT
                                                // Both exists so import them
                                                foreach (array("tables.sql", "menu-".GET_LANGUAGE().".sql") as $dump) {
                                                        // Should be save here because file_exists() is there but we check it again. :)
                                                // Both exists so import them
                                                foreach (array("tables.sql", "menu-".GET_LANGUAGE().".sql") as $dump) {
                                                        // Should be save here because file_exists() is there but we check it again. :)
-                                                       $file = secureString($_POST['spath']) . "install/" . $dump;
-                                                       if (FILE_READABLE($file)) {
+                                                       $FQFN = secureString($_POST['spath']) . "install/" . $dump;
+                                                       if (FILE_READABLE($FQFN)) {
                                                                // Read the file
                                                                // Read the file
-                                                               $SQLs = READ_FILE($file, true);
+                                                               $SQLs = READ_FILE($FQFN, true);
 
                                                                // And split it up against ;\n ...
                                                                $SQLs = merge_array($SQLs, explode(";\n", $sql));
 
                                                                // And split it up against ;\n ...
                                                                $SQLs = merge_array($SQLs, explode(";\n", $sql));
-                                                       } // END - if
+                                                       } else {
+                                                               // Not readable!
+                                                               debug_report_bug(sprintf("SQL dump %s is not readable!", $dump));
+                                                       }
                                                } // END - foreach
 
                                                // Are some SQLs found?
                                                } // END - foreach
 
                                                // Are some SQLs found?
@@ -371,24 +312,24 @@ if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndT
                                                } // END - foreach
 
                                                // Ok, all done. So we can write the config data to the php files
                                                } // END - foreach
 
                                                // Ok, all done. So we can write the config data to the php files
-                                               if ($_POST['spath'] != constant('PATH')) install_WriteData($_POST['spath']."inc/config.php", "SERVER-PATH", "define('PATH', \"", "\");", $_POST['spath'], 0);
-                                               if ($_POST['burl']  != constant('URL'))  install_WriteData($_POST['spath']."inc/config.php", "HOST-URL", "define('URL', \"", "\");", $_POST['burl'], 0);
-                                               install_WriteData($_POST['spath']."inc/config.php", "MAIN_TITLE", "define('MAIN_TITLE', \"", "\");", $_POST['title'], 0);
-                                               install_WriteData($_POST['spath']."inc/config.php", "SLOGAN", "define('SLOGAN', \"", "\");", $_POST['slogan'], 0);
-                                               install_WriteData($_POST['spath']."inc/config.php", "WEBMASTER", "define('WEBMASTER', \"", "\");", $_POST['email'], 0);
-                                               install_WriteData($_POST['spath']."inc/config.php", "NULLPASS-WARNING", "define('warn_no_pass', ", ");", $_POST['warn_no_pass'], 0);
-                                               install_WriteData($_POST['spath']."inc/config.php", "WRITE-FOOTER", "define('WRITE_FOOTER', ", ");", $_POST['wfooter'], 0);
-                                               install_WriteData($_POST['spath']."inc/config.php", "BACKLINK", "define('ENABLE_BACKLINK', ", ");", $_POST['blink'], 0);
-                                               // install_WriteData($_POST['spath']."inc/config.php", "OUTPUT-MODE", "define('OUTPUT_MODE', \"", "\");", $_POST['omode'], 0);
-                                               install_WriteData($_POST['spath']."inc/config.php", "MYSQL-HOST", "     'host'     => \"", "\",", $mysql['host'], 0);
-                                               install_WriteData($_POST['spath']."inc/config.php", "MYSQL-DBASE", "    'dbase'    => \"", "\",", $mysql['dbase'], 0);
-                                               install_WriteData($_POST['spath']."inc/config.php", "MYSQL-LOGIN", "    'login'    => \"", "\",", $mysql['login'], 0);
-                                               install_WriteData($_POST['spath']."inc/config.php", "MYSQL-PASSWORD", " 'password' => \"", "\",", $mysql['pass1'], 0);
-                                               install_WriteData($_POST['spath']."inc/config.php", "MYSQL-PREFIX", "define('_MYSQL_PREFIX', \"", "\");", $mysql['prefix'], 0);
-                                               install_WriteData($_POST['spath']."inc/config.php", "SMTP-HOSTNAME", "define('SMTP_HOSTNAME', \"", "\");", $_POST['smtp_host'], 0);
-                                               install_WriteData($_POST['spath']."inc/config.php", "SMTP-USER", "define('SMTP_USER', \"", "\");", $_POST['smtp_user'], 0);
-                                               install_WriteData($_POST['spath']."inc/config.php", "SMTP-PASSWORD", "define('SMTP_PASSWORD', \"", "\");", $_POST['smtp_pass'], 0);
-                                               install_WriteData($_POST['spath']."inc/config.php", "INSTALLED", "define('mxchange_installed', ", ");", "true", 0);
+                                               if ($_POST['spath'] != constant('PATH')) changeDataInFile($_POST['spath']."inc/config.php", "SERVER-PATH", "define('PATH', \"", "\");", $_POST['spath'], 0);
+                                               if ($_POST['burl']  != constant('URL'))  changeDataInFile($_POST['spath']."inc/config.php", "HOST-URL", "define('URL', \"", "\");", $_POST['burl'], 0);
+                                               changeDataInFile($_POST['spath']."inc/config.php", "MAIN_TITLE", "define('MAIN_TITLE', \"", "\");", $_POST['title'], 0);
+                                               changeDataInFile($_POST['spath']."inc/config.php", "SLOGAN", "define('SLOGAN', \"", "\");", $_POST['slogan'], 0);
+                                               changeDataInFile($_POST['spath']."inc/config.php", "WEBMASTER", "define('WEBMASTER', \"", "\");", $_POST['email'], 0);
+                                               changeDataInFile($_POST['spath']."inc/config.php", "NULLPASS-WARNING", "define('warn_no_pass', ", ");", $_POST['warn_no_pass'], 0);
+                                               changeDataInFile($_POST['spath']."inc/config.php", "WRITE-FOOTER", "define('WRITE_FOOTER', ", ");", $_POST['wfooter'], 0);
+                                               changeDataInFile($_POST['spath']."inc/config.php", "BACKLINK", "define('ENABLE_BACKLINK', ", ");", $_POST['blink'], 0);
+                                               // changeDataInFile($_POST['spath']."inc/config.php", "OUTPUT-MODE", "define('OUTPUT_MODE', \"", "\");", $_POST['omode'], 0);
+                                               changeDataInFile($_POST['spath']."inc/config.php", "MYSQL-HOST", "      'host'     => \"", "\",", $mysql['host'], 0);
+                                               changeDataInFile($_POST['spath']."inc/config.php", "MYSQL-DBASE", "     'dbase'    => \"", "\",", $mysql['dbase'], 0);
+                                               changeDataInFile($_POST['spath']."inc/config.php", "MYSQL-LOGIN", "     'login'    => \"", "\",", $mysql['login'], 0);
+                                               changeDataInFile($_POST['spath']."inc/config.php", "MYSQL-PASSWORD", "  'password' => \"", "\",", $mysql['pass1'], 0);
+                                               changeDataInFile($_POST['spath']."inc/config.php", "MYSQL-PREFIX", "define('_MYSQL_PREFIX', \"", "\");", $mysql['prefix'], 0);
+                                               changeDataInFile($_POST['spath']."inc/config.php", "SMTP-HOSTNAME", "define('SMTP_HOSTNAME', \"", "\");", $_POST['smtp_host'], 0);
+                                               changeDataInFile($_POST['spath']."inc/config.php", "SMTP-USER", "define('SMTP_USER', \"", "\");", $_POST['smtp_user'], 0);
+                                               changeDataInFile($_POST['spath']."inc/config.php", "SMTP-PASSWORD", "define('SMTP_PASSWORD', \"", "\");", $_POST['smtp_pass'], 0);
+                                               changeDataInFile($_POST['spath']."inc/config.php", "INSTALLED", "define('mxchange_installed', ", ");", "true", 0);
                                        } else {
                                                // Installation area not found!
                                                addFatalMessage(getMessage('INSTALL_MISSING_DUMPS'));
                                        } else {
                                                // Installation area not found!
                                                addFatalMessage(getMessage('INSTALL_MISSING_DUMPS'));
@@ -418,7 +359,7 @@ if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndT
                                LOAD_TEMPLATE("install_fatal_errors");
                        } else {
                                // Installation is done!
                                LOAD_TEMPLATE("install_fatal_errors");
                        } else {
                                // Installation is done!
-                               LOAD_URL($burl."/install.php?page=finalize");
+                               LOAD_URL("install.php?page=finalize");
                        }
                } elseif (isBooleanConstantAndTrue('mxchange_installed')) {
                        // Redirection after writing data... :-)
                        }
                } elseif (isBooleanConstantAndTrue('mxchange_installed')) {
                        // Redirection after writing data... :-)
index 4e12fb90c3e20968167f84a2b39df891baf23128..121cfc096a79f08c32c6f8b53d09b3ce1b426281 100644 (file)
@@ -84,12 +84,12 @@ class CacheSystem {
        }
 
        // Checks validity of cache file and if content is given
        }
 
        // Checks validity of cache file and if content is given
-       function loadCacheFile ($file, $forceContent = false) {
+       function loadCacheFile ($cacheName, $forceContent = false) {
                // Remember cache file
                // Remember cache file
-               $this->name = $file;
+               $this->name = $cacheName;
 
                // Construct FQFN (full qualified file name)
 
                // Construct FQFN (full qualified file name)
-               $this->inc = $this->path.$file.".cache";
+               $this->inc = $this->path . $cacheName . ".cache";
 
                // Check if file exists and if version matches
                $status = (FILE_READABLE($this->inc) && (is_writeable($this->inc)) && ($this->extensionVersionMatches("cache")));
 
                // Check if file exists and if version matches
                $status = (FILE_READABLE($this->inc) && (is_writeable($this->inc)) && ($this->extensionVersionMatches("cache")));
index b6783c79eebb5bc76a409f291f24e7ad25a02fda..4b832a07d17ba104162a8394924ce67987fead64 100644 (file)
@@ -207,11 +207,11 @@ if ((SQL_NUMROWS($res_ext_crt) > 0) && ((($cacheMode == "init") && ($CSS != "1")
                        $content['ext_menu'] = "Y";
                } // END - if
 
                        $content['ext_menu'] = "Y";
                } // END - if
 
-               // Load extensions
-               $file1 = sprintf("%sinc/extensions/ext-%s.php", constant('PATH'), $content['ext_name']);
+               // Generate FQFN for extension
+               $FQFN = sprintf("%sinc/extensions/ext-%s.php", constant('PATH'), $content['ext_name']);
 
                // Does the extension file exists?
 
                // Does the extension file exists?
-               if (FILE_READABLE($file1)) {
+               if (FILE_READABLE($FQFN)) {
                        // By default no extension is always active, except sql_patches
                        $EXT_ALWAYS_ACTIVE = "N";
 
                        // By default no extension is always active, except sql_patches
                        $EXT_ALWAYS_ACTIVE = "N";
 
@@ -251,7 +251,7 @@ if ((SQL_NUMROWS($res_ext_crt) > 0) && ((($cacheMode == "init") && ($CSS != "1")
                                // Remember this value for later usage
                                $cacheArray['active_extensions'][$content['ext_name']] = $EXT_ALWAYS_ACTIVE;
                        }
                                // Remember this value for later usage
                                $cacheArray['active_extensions'][$content['ext_name']] = $EXT_ALWAYS_ACTIVE;
                        }
-               } elseif (!FILE_READABLE($file1)) {
+               } elseif (!FILE_READABLE($FQFN)) {
                        // Deleted extension file so we mark it for removal from DB
                        $DEL[] = $content['ext_name'];
                }
                        // Deleted extension file so we mark it for removal from DB
                        $DEL[] = $content['ext_name'];
                }
index 2127e9f67b3943c75814d3e34cfcb7845b3291d7..f72adf4b19c0210b9ef798cc2828c5ba1df85e33 100644 (file)
@@ -68,7 +68,7 @@ if (!isBooleanConstantAndTrue('admin_registered')) {
                switch ($ret)
                {
                case "done":
                switch ($ret)
                {
                case "done":
-                       admin_WriteData(constant('PATH')."inc/config.php", "ADMIN-SETUP", "define('admin_registered', ", ");", "true", 0);
+                       changeDataInFile(constant('PATH')."inc/config.php", "ADMIN-SETUP", "define('admin_registered', ", ");", "true", 0);
                        if (!constant('_FATAL')) {
                                // Registering is done
                                LOAD_URL("modules.php?module=admin&amp;action=login&register=done");
                        if (!constant('_FATAL')) {
                                // Registering is done
                                LOAD_URL("modules.php?module=admin&amp;action=login&register=done");
@@ -96,7 +96,7 @@ if (!isBooleanConstantAndTrue('admin_registered')) {
                        // Admin still not registered?
                        if (!isBooleanConstantAndTrue('admin_registered')) {
                                // Write to config that registration is done
                        // Admin still not registered?
                        if (!isBooleanConstantAndTrue('admin_registered')) {
                                // Write to config that registration is done
-                               admin_WriteData(constant('PATH')."inc/config.php", "ADMIN-SETUP", "define('admin_registered', ", ");", "true", 0);
+                               changeDataInFile(constant('PATH')."inc/config.php", "ADMIN-SETUP", "define('admin_registered', ", ");", "true", 0);
 
                                // Load URL for login
                                LOAD_URL("modules.php?module=admin&amp;action=login");
 
                                // Load URL for login
                                LOAD_URL("modules.php?module=admin&amp;action=login");
index 7ab5e1283ab55aa84f147e8d87058e4efb97c780..706a4724e41af99c773cf88334a507b9fe1a7920 100644 (file)
@@ -233,76 +233,6 @@ function CHECK_ADMIN_COOKIES ($admin_login, $password) {
        // Return result
        return $ret;
 }
        // Return result
        return $ret;
 }
-//
-function admin_WriteData ($file, $comment, $prefix, $suffix, $DATA, $seek=0) {
-       // Initialize some variables
-       $done = false;
-       $seek++;
-       $next=-1;
-       $found = false;
-
-       // Is the file there and read-/write-able?
-       if ((FILE_READABLE($file)) && (is_writeable($file))) {
-               $search = "CFG: ".$comment;
-               $tmp = $file.".tmp";
-
-               // Open the source file
-               $fp = @fopen($file, 'r') or OUTPUT_HTML("<strong>READ:</strong> ".$file."<br />");
-
-               // Is the resource valid?
-               if (is_resource($fp)) {
-                       // Open temporary file
-                       $fp_tmp = @fopen($tmp, 'w') or OUTPUT_HTML("<strong>WRITE:</strong> ".$tmp."<br />");
-
-                       // Is the resource again valid?
-                       if (is_resource($fp_tmp)) {
-                               while (!feof($fp)) {
-                                       // Read from source file
-                                       $line = fgets ($fp, 1024);
-
-                                       if (strpos($line, $search) > -1) { $next = 0; $found = true; }
-
-                                       if ($next > -1) {
-                                               if ($next === $seek) {
-                                                       $next = -1;
-                                                       $line = $prefix . $DATA . $suffix."\n";
-                                               } else {
-                                                       $next++;
-                                               }
-                                       }
-
-                                       // Write to temp file
-                                       fputs($fp_tmp, $line);
-                               }
-
-                               // Close temp file
-                               fclose($fp_tmp);
-
-                               // Finished writing tmp file
-                               $done = true;
-                       }
-
-                       // Close source file
-                       fclose($fp);
-
-                       if (($done) && ($found)) {
-                               // Copy back tmp file and delete tmp :-)
-                               @copy($tmp, $file);
-                               @unlink($tmp);
-                               define('_FATAL', false);
-                       } elseif (!$found) {
-                               OUTPUT_HTML("<strong>CHANGE:</strong> 404!");
-                               define('_FATAL', true);
-                       } else {
-                               OUTPUT_HTML("<strong>TMP:</strong> UNDONE!");
-                               define('_FATAL', true);
-                       }
-               }
-       } else {
-               // File not found, not readable or writeable
-               OUTPUT_HTML("<strong>404:</strong> ".$file."<br />");
-       }
-}
 
 //
 function ADMIN_DO_ACTION($wht) {
 
 //
 function ADMIN_DO_ACTION($wht) {
index 04a93543836571900ed1cbfa87193cadaac62332..d402ab529640203e59b1bfa3cddadc8b1506e07d 100644 (file)
@@ -68,14 +68,14 @@ if (($response[sizeof($response) - 1] == "[EOF]") && ($response[0] != "[EOF]"))
 
                // Leave loop when data is invalid or EOF?
                if ((substr($value, 0, 6) == "theme-") && (substr($value, -4) == ".zip")) {
 
                // Leave loop when data is invalid or EOF?
                if ((substr($value, 0, 6) == "theme-") && (substr($value, -4) == ".zip")) {
+                       // Extract name and version
                        $name = substr($value, 6, -4);
                        $name = substr($value, 6, -4);
-                       $file = sprintf("%sthemes/%s/theme.php", constant('PATH'), $name);
                        $ver  = trim(substr($response[$idx + 3], 4));
 
                        // Load version
                        $cver = THEME_GET_VERSION($name);
 
                        $ver  = trim(substr($response[$idx + 3], 4));
 
                        // Load version
                        $cver = THEME_GET_VERSION($name);
 
-                       // Is the extension already installed or not?
+                       // Is the theme already installed or not?
                        if (($ver != $cver) && ($cver != "?") && ($cver != "!")) {
                                // No, it isn't. So let's add this one!
                                $THEMES['fname'][]  = $name;
                        if (($ver != $cver) && ($cver != "?") && ($cver != "!")) {
                                // No, it isn't. So let's add this one!
                                $THEMES['fname'][]  = $name;
@@ -87,7 +87,7 @@ if (($response[sizeof($response) - 1] == "[EOF]") && ($response[0] != "[EOF]"))
                                // Extract language strings from reponse
                                $LANG_DUMMY = explode("[nl]", $response[$idx + 4]);
                                $LANG = array();
                                // Extract language strings from reponse
                                $LANG_DUMMY = explode("[nl]", $response[$idx + 4]);
                                $LANG = array();
-                               $INFO = ADMIN_EXT_NO_INFO_FOUND;
+                               $INFO = getMessage('ADMIN_EXT_NO_INFO_FOUND');
 
                                // Trim every data line
                                foreach ($LANG_DUMMY as $k => $v) {
 
                                // Trim every data line
                                foreach ($LANG_DUMMY as $k => $v) {
index 4a88da8c96099c45b4ee9d5bee809ac65b96d2df..fbb1b0d59b4dc2c6b7bc6d8a859f333d4020a406 100644 (file)
@@ -81,15 +81,15 @@ if (SQL_NUMROWS($result) > 0) {
                $test = str_replace(URL, constant('PATH'), $url); $size = 0;
                if ($test == $url) {
                        // Download banner (I hope you keep the banner on same server???)
                $test = str_replace(URL, constant('PATH'), $url); $size = 0;
                if ($test == $url) {
                        // Download banner (I hope you keep the banner on same server???)
-                       $fp = GET_URL($url); $file = "";
+                       $fp = GET_URL($url); $bannerContent = "";
                        if ((!empty($fp)) && (is_array($fp)) && (count($fp) > 0) {
                                // Loads only found banner, when there is a 404 error this foreach() command
                                // will cause an "Invalid argument supplied for foreach()" error
                                foreach ($fp as $f) {
                        if ((!empty($fp)) && (is_array($fp)) && (count($fp) > 0) {
                                // Loads only found banner, when there is a 404 error this foreach() command
                                // will cause an "Invalid argument supplied for foreach()" error
                                foreach ($fp as $f) {
-                                       $file .= $f;
+                                       $bannerContent .= $f;
                                }
                        }
                                }
                        }
-                       $size = strlen($file);
+                       $size = strlen($bannerContent);
                } elseif (FILE_READABLE($test)) {
                        $size = filesize($test);
                }
                } elseif (FILE_READABLE($test)) {
                        $size = filesize($test);
                }
index fa65d85ae598da387404e4f4180840e797719d96..2304e13b9932506d4da3a9bc9ed77ea30fbefadb 100644 (file)
@@ -205,22 +205,23 @@ function CHECK_MODULE ($mod) {
 }
 
 // Add menu description pending on given file name (without path!)
 }
 
 // Add menu description pending on given file name (without path!)
-function ADD_DESCR ($ACC_LVL, $file, $return = false, $output = true) {
+function ADD_DESCR ($ACC_LVL, $FQFN, $return = false, $output = true) {
        global $NAV_DEPTH;
 
        global $NAV_DEPTH;
 
-       // Use only filename of the file ;)
-       $file = basename($file);
+       // Use only filename of the FQFN...
+       $file = basename($FQFN);
 
        // Init variables
 
        // Init variables
-       $LINK_ADD = ""; $OUT = ""; $AND = "";
+       $LINK_ADD = "";
+       $OUT = "";
+       $AND = "";
 
        // First we have to do some analysis...
        if (substr($file, 0, 7) == "action-") {
                // This is an action file!
                $type = "action";
                $search = substr($file, 7);
 
        // First we have to do some analysis...
        if (substr($file, 0, 7) == "action-") {
                // This is an action file!
                $type = "action";
                $search = substr($file, 7);
-               switch ($ACC_LVL)
-               {
+               switch ($ACC_LVL) {
                case "admin":
                        $modCheck = "admin";
                        break;
                case "admin":
                        $modCheck = "admin";
                        break;
@@ -237,8 +238,7 @@ function ADD_DESCR ($ACC_LVL, $file, $return = false, $output = true) {
                $type = "what";
                $search = substr($file, 5);
                $AND = "";
                $type = "what";
                $search = substr($file, 5);
                $AND = "";
-               switch ($ACC_LVL)
-               {
+               switch ($ACC_LVL) {
                case "admin":
                        $modCheck = "admin";
                        break;
                case "admin":
                        $modCheck = "admin";
                        break;
@@ -255,17 +255,19 @@ function ADD_DESCR ($ACC_LVL, $file, $return = false, $output = true) {
                $AND .= " AND `action`='".GET_ACTION($ACC_LVL, $dummy)."'";
        } elseif (($ACC_LVL == "sponsor") || ($ACC_LVL == "engine")) {
                // Sponsor / engine menu
                $AND .= " AND `action`='".GET_ACTION($ACC_LVL, $dummy)."'";
        } elseif (($ACC_LVL == "sponsor") || ($ACC_LVL == "engine")) {
                // Sponsor / engine menu
-               $type = "what";
-               $search = $file;
+               $type     = "what";
+               $search   = $file;
                $modCheck = $GLOBALS['module'];
                $modCheck = $GLOBALS['module'];
-               $AND = "";
+               $AND      = "";
        } else {
                // Other
        } else {
                // Other
-               $type = "menu";
-               $search = $file;
+               $type     = "menu";
+               $search   = $file;
                $modCheck = $GLOBALS['module'];
                $modCheck = $GLOBALS['module'];
-               $AND = "";
+               $AND      = "";
        }
        }
+
+       // Begin the navigation line
        if ((!isset($NAV_DEPTH)) && (!$return)) {
                $NAV_DEPTH = 0;
                $prefix = "<div class=\"you_are_here\">{--YOU_ARE_HERE--}&nbsp;<strong><a class=\"you_are_here\" href=\"{!URL!}/modules.php?module=".$GLOBALS['module'].$LINK_ADD."\">Home</a></strong>";
        if ((!isset($NAV_DEPTH)) && (!$return)) {
                $NAV_DEPTH = 0;
                $prefix = "<div class=\"you_are_here\">{--YOU_ARE_HERE--}&nbsp;<strong><a class=\"you_are_here\" href=\"{!URL!}/modules.php?module=".$GLOBALS['module'].$LINK_ADD."\">Home</a></strong>";