./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/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/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/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???
-./mailid_top.php:205: // @TODO Rewrite these blocks to filter
./surfbar.php:60: // @TODO Display quick login form here or redirect as configured
+./mailid_top.php:205: // @TODO Rewrite these blocks to filter
}
// 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?
// 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
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;
////////////////////////
// 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
);
// 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?
- if (!FILE_READABLE($file)) {
+ if (!FILE_READABLE($FQFN)) {
// Reset to default template
- $file = $BASE.$template.".tpl";
+ $FQFN = $BASE.$template.".tpl";
} // 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. :)
- $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); }
} 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>
// 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
- $file = $BASE."guest/".$template.".tpl";
+ $FQFN = $BASE."guest/".$template.".tpl";
} 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
- $file = $BASE.$test."/".$template.".tpl";
+ $FQFN = $BASE.$test."/".$template.".tpl";
} else {
// No special filename
- $file = $BASE.$template.".tpl";
+ $FQFN = $BASE.$template.".tpl";
}
}
// Does the special template exists?
- if (!FILE_READABLE($file)) {
+ if (!FILE_READABLE($FQFN)) {
// Reset to default template
- $file = $BASE.$template.".tpl";
+ $FQFN = $BASE.$template.".tpl";
} // 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. :)
- $tmpl_file = READ_FILE($file);
+ $tmpl_file = READ_FILE($FQFN);
$tmpl_file = SQL_ESCAPE($tmpl_file);
// Run code
}
// 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!");
- 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
}
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";
- 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);
// 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
- $INCs[] = $file;
+ $INCs[] = $FQFN;
}
} // END - if
} // END - while
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 //
//////////////////////////////////////////////////
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'),
- $file_hash
+ $fileHash
);
// Count of chars to be taken from back of the string
$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?
- 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);
- // 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",
- array($file_hash), __FILE__, __LINE__);
+ array($fileHash), __FILE__, __LINE__);
// Generate FQFN for .htaccess file
$FQFN = sprintf("%sinc/.secret/.htaccess",
// Also update configuration
setConfigEntry('secret_key', $secretKey);
- setConfigEntry('file_hash' , $file_hash);
+ setConfigEntry('file_hash' , $fileHash);
// Remove variables
unset($secretKey);
- unset($file_hash);
+ unset($fileHash);
} // END - if
} // END - if
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 = "";
-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))) {
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 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 ((!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'])
// 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
- $SQLs = READ_FILE($file, true);
+ $SQLs = READ_FILE($FQFN, true);
// 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
// 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'));
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... :-)
}
// Checks validity of cache file and if content is given
- function loadCacheFile ($file, $forceContent = false) {
+ function loadCacheFile ($cacheName, $forceContent = false) {
// Remember cache file
- $this->name = $file;
+ $this->name = $cacheName;
// 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")));
$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?
- if (FILE_READABLE($file1)) {
+ if (FILE_READABLE($FQFN)) {
// By default no extension is always active, except sql_patches
$EXT_ALWAYS_ACTIVE = "N";
// 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'];
}
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&action=login®ister=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&action=login");
// 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) {
// 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);
- $file = sprintf("%sthemes/%s/theme.php", constant('PATH'), $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;
// 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) {
$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) {
- $file .= $f;
+ $bannerContent .= $f;
}
}
- $size = strlen($file);
+ $size = strlen($bannerContent);
} elseif (FILE_READABLE($test)) {
$size = filesize($test);
}
}
// 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;
- // Use only filename of the file ;)
- $file = basename($file);
+ // Use only filename of the FQFN...
+ $file = basename($FQFN);
// 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);
- switch ($ACC_LVL)
- {
+ switch ($ACC_LVL) {
case "admin":
$modCheck = "admin";
break;
$type = "what";
$search = substr($file, 5);
$AND = "";
- switch ($ACC_LVL)
- {
+ switch ($ACC_LVL) {
case "admin":
$modCheck = "admin";
break;
$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'];
- $AND = "";
+ $AND = "";
} else {
// Other
- $type = "menu";
- $search = $file;
+ $type = "menu";
+ $search = $file;
$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--} <strong><a class=\"you_are_here\" href=\"{!URL!}/modules.php?module=".$GLOBALS['module'].$LINK_ADD."\">Home</a></strong>";