./birthday_confirm.php:93: // @TODO Try to rewrite the following unset()
./inc/autopurge/purge-inact.php:55: // @TODO Rewrite these if() blocks to a filter
./inc/cache/config-local.php:124:// @TODO Rewrite the following three constants, somehow...
-./inc/classes/cachesystem.class.php:499: // @TODO Add support for more types which break in last else-block
+./inc/classes/cachesystem.class.php:501: // @TODO Add support for more types which break in last else-block
./inc/config-functions.php:139: // @TODO Make this all better... :-/
./inc/expression-functions.php:164:// @TODO FILTER_COMPILE_CONFIG does not handle call-back functions so we handle it here again
./inc/expression-functions.php:46: // @TODO is escapeQuotes() enougth for strings with single/double quotes?
./inc/functions.php:1611:// @TODO Rewrite this function to use readFromFile() and writeToFile()
./inc/functions.php:181:// @TODO Rewrite this to an extension 'smtp'
./inc/functions.php:2269: // @TODO This is still very static, rewrite it somehow
-./inc/gen_sql_patches.php:94:// @TODO Rewrite this to a filter
-./inc/install-functions.php:57: // @TODO DEACTIVATED: changeDataInFile(getCachePath() . 'config-local.php', 'OUTPUT-MODE', "setConfigEntry('OUTPUT_MODE', '", "');", postRequestParameter('omode'), 0);
+./inc/gen_sql_patches.php:95:// @TODO Rewrite this to a filter
+./inc/install-functions.php:57: // @TODO DEACTIVATED: changeDataInInclude(getCachePath() . 'config-local.php', 'OUTPUT-MODE', "setConfigEntry('OUTPUT_MODE', '", "');", postRequestParameter('omode'), 0);
./inc/language/de.php:1085:// @TODO Rewrite these two constants
./inc/language/de.php:1100:// @TODO Rewrite these three constants
./inc/language/de.php:280: // @TODO Following two are unused?
./inc/reset/reset_beg.php:52:// @TODO This should be converted in a daily beg rallye
./inc/reset/reset_birthday.php:92: // @TODO 4 is hard-coded here, should we move it out in config?
./inc/revision-functions.php:169:// @TODO This function does also set and get in 'cache_array'
-./inc/template-functions.php:1044: // @TODO Deprecate this thing
-./inc/template-functions.php:1055: // @TODO Deprecate this thing
-./inc/template-functions.php:1142: // @TODO This can be easily moved out after the merge from EL branch to this is complete
-./inc/template-functions.php:1175: // @TODO Add a little more infos here
-./inc/template-functions.php:1463:// @TODO Lame description for this function
-./inc/template-functions.php:1485: // @TODO Move this in a filter
+./inc/template-functions.php:1041: // @TODO Deprecate this thing
+./inc/template-functions.php:1052: // @TODO Deprecate this thing
+./inc/template-functions.php:1139: // @TODO This can be easily moved out after the merge from EL branch to this is complete
+./inc/template-functions.php:1172: // @TODO Add a little more infos here
+./inc/template-functions.php:1460:// @TODO Lame description for this function
+./inc/template-functions.php:1482: // @TODO Move this in a filter
./inc/template-functions.php:187: * @TODO On some pages this is buggy
./inc/template-functions.php:263: // @TODO Remove this sanity-check if all is fine
./inc/template-functions.php:576:// @TODO $simple/$constants are deprecated
-./inc/template-functions.php:603: // @TODO Do only use $content and deprecate $GLOBALS and $DATA in templates
+./inc/template-functions.php:600: // @TODO Do only use $content and deprecate $GLOBALS and $DATA in templates
./inc/wrapper-functions.php:130:// @TODO Implement $compress
./inc/wrapper-functions.php:137:// @TODO Implement $decompress
./inc/wrapper-functions.php:452:// @TODO Do some more sanity check here
var $extension = '.cache';
var $status = array();
var $readable = array();
+ var $fullPath = '';
// Constructor
function CacheSystem () {
+ // Construct full path
+ $this->fullPath = getPath() . getCachePath();
+
// Failed is the default
$this->setStatusCode('failed');
- // Remeber path
-
// Check if path exists
- if (isDirectory(getCachePath())) {
+ if (isDirectory($this->fullPath)) {
// Is there a .htaccess file?
- if (isFileReadable(getCachePath() . '.htaccess')) {
+ if (isFileReadable($this->fullPath . '.htaccess')) {
// All done!
$this->setStatusCode('done');
} else {
$this->name = $cacheName;
// Construct FQFN (full qualified file name)
- $this->fqfn = getCachePath() . $cacheName . $this->extension;
+ $this->fqfn = $this->fullPath . $cacheName . $this->extension;
// Check if file exists and if version matches
if (!isset($this->status[$cacheName])) {
if (is_array($v)) {
// Multi line(s) found
$LINE = '';
- foreach($v as $k2 => $v2) {
+ foreach ($v as $k2 => $v2) {
// Put every array element in a row...
$LINE .= $this->rewriteEntry($k, $v2);
} // END - foreach
/// ... and write it to the new config
//* DEBUG: */ debugOutput('function=' . $function . ',new=' . $new . ',comment=' . $comment);
- changeDataInFile(getCachePath() . 'config-local.php', $comment, $function . "('" . $oldNew . "', \"", '");', constant($new), 0);
+ changeDataInInclude(getCachePath() . 'config-local.php', $comment, $function . "('" . $oldNew . "', \"", '");', constant($new), 0);
//* DEBUG: */ debugOutput('CHANGED!');
// Mark it as done
$key = substr(trim($parts[0]), 1, -1); $value = substr(trim($parts[1]), 1, -2);
// We can now save the right part in new config file
- changeDataInFile(getCachePath() . 'config-local.php', $comments[$key], " '".$key."' => \"", '",', $value, 0);
+ changeDataInInclude(getCachePath() . 'config-local.php', $comments[$key], " '".$key."' => \"", '",', $value, 0);
}
} // END - foreach
// CFG: COPY
setConfigEntry('COPY', 'Copyright © 2003 - 2009, by Roland Häder,<br />2009, 2010 by Mailer Developer Team');
-// CFG: CACHE-PATH
-setConfigEntry('CACHE_PATH', getConfig('PATH') . 'inc/cache/');
+// CFG: CACHE_PATH
+setConfigEntry('CACHE_PATH', 'inc/cache/');
// CFG: STATS-ENABLED (This setting is overwritten by ext-other; at least version 0.2.6)
setConfigEntry('stats_enabled', 'N');
// Test again
if ((isExtensionInstalledAndNewer('sql_patches', '0.3.6')) && (getFileHash() != '') && (getMasterSalt() != '') && (getPassScramble() != '')) {
// File hash fas generated so we can also file the secret file... hopefully.
- $hashFile = sprintf("%sinc/cache/.%s.cache", getPath(), getFileHash());
+ $hashFile = sprintf("%s%s.%s.cache", getPath(), getCachePath(), getFileHash());
if (isFileReadable($hashFile)) {
// Read file
setConfigEntry('secret_key', readFromFile($hashFile));
// Only execute this filter if installed and all config entries are there
if ((!isInstalled()) || (!isConfigEntrySet('patch_level'))) return;
- // Check for patch level differences between databases and current hard-coded
+ // Check for patch level differences between database and current hard-coded
if ((getCurrentRepositoryRevision() > getConfig('patch_level')) || (getConfig('patch_level') == 'CURRENT_REPOSITORY_REVISION') || (getConfig('patch_ctime') == 'UNIX_TIMES')) {
// Update database and CONFIG array
updateConfiguration(array('patch_level', 'patch_ctime'), array(getCurrentRepositoryRevision(), 'UNIX_TIMESTAMP()'));
// Filter for loading more runtime includes (not for installation)
function FILTER_LOAD_RUNTIME_INCLUDES () {
// Load more includes
- foreach (array('inc/databases.php','inc/session.php','inc/versions.php') as $inc) {
+ foreach (array('databases', 'session', 'versions') as $inc) {
// Load the include
- loadIncludeOnce($inc);
+ loadIncludeOnce('inc/' . $inc . '.php');
} // END - foreach
}
// Get data array with years/months/weeks/days/...
$data = createTimeSelections($stamp, '', '', '', true);
$ret = '';
- foreach($data as $k => $v) {
+ foreach ($data as $k => $v) {
if ($v > 0) {
// Value is greater than 0 "eval" data to return string
$ret .= ', ' . $v . ' {--_' . strtoupper($k) . '--}';
$message = str_replace("\r", '', str_replace("\n", '', $message));
// Log this message away
- appendLineToFile(getCachePath() . 'debug.log', generateDateTime(time(), '4') . '|' . getModule(false) . '|' . basename($funcFile) . '|' . $line . '|' . $message);
+ appendLineToFile(getPath() . getCachePath() . 'debug.log', generateDateTime(time(), '4') . '|' . getModule(false) . '|' . basename($funcFile) . '|' . $line . '|' . $message);
} // END - if
}
if (getFileHash() == '') {
// Create filename from hashed random string
$fileHash = sha1(generatePassword(mt_rand(128, 256)));
- $FQFN = sprintf("%sinc/cache/.%s.cache",
+ $FQFN = sprintf("%s%s.%s.cache",
getPath(),
+ getCachePath(),
$fileHash
);
// Loads an include file once
function loadIncludeOnce ($inc) {
- // Remove double path
- $inc = str_replace(getPath(), '', $inc);
-
// Is it not loaded?
if (!isset($GLOBALS['load_once'][$inc])) {
// Mark it as loaded
function isIncludeReadable ($inc) {
// Do we have cache?
if (!isset($GLOBALS['inc_readable'][$inc])) {
- // Remove double path
- $inc = str_replace(getPath(), '', $inc);
-
// Construct FQFN
$FQFN = getPath() . $inc;
// Write the local config-local.php file from "template"
function doInstallWriteLocalConfig () {
// Copy the config template and verify it
- copyFileVerified(postRequestParameter('spath') . 'inc/config-local.php.dist', getCachePath() . 'config-local.php', 0644);
+ copyFileVerified(postRequestParameter('spath') . 'inc/config-local.php.dist', getPath() . getCachePath() . 'config-local.php', 0644);
// Ok, all done. So we can write the config data to the php files
- if (postRequestParameter('spath') != getPath()) changeDataInFile(getCachePath() . 'config-local.php', 'SERVER-PATH', "setConfigEntry('PATH', '", "');", postRequestParameter('spath'), 0);
- if (postRequestParameter('burl') != getUrl()) changeDataInFile(getCachePath() . 'config-local.php', 'HOST-URL', "setConfigEntry('URL', '", "');", postRequestParameter('burl'), 0);
- changeDataInFile(getCachePath() . 'config-local.php', 'MAIN-TITLE', "setConfigEntry('MAIN_TITLE', '", "');", postRequestParameter('title'), 0);
- changeDataInFile(getCachePath() . 'config-local.php', 'SLOGAN', "setConfigEntry('SLOGAN', '", "');", postRequestParameter('slogan'), 0);
- changeDataInFile(getCachePath() . 'config-local.php', 'WEBMASTER', "setConfigEntry('WEBMASTER', '", "');", postRequestParameter('email'), 0);
- changeDataInFile(getCachePath() . 'config-local.php', 'NULLPASS-WARNING', "setConfigEntry('WARN_NO_PASS', '", "');", postRequestParameter('warn_no_pass'), 0);
- changeDataInFile(getCachePath() . 'config-local.php', 'WRITE-FOOTER', "setConfigEntry('WRITE_FOOTER', '", "');", postRequestParameter('wfooter'), 0);
- changeDataInFile(getCachePath() . 'config-local.php', 'BACKLINK', "setConfigEntry('ENABLE_BACKLINK', '", "');", postRequestParameter('blink'), 0);
- // @TODO DEACTIVATED: changeDataInFile(getCachePath() . 'config-local.php', 'OUTPUT-MODE', "setConfigEntry('OUTPUT_MODE', '", "');", postRequestParameter('omode'), 0);
- changeDataInFile(getCachePath() . 'config-local.php', 'MYSQL-HOST', " 'host' => '", "',", postRequestParameter('mysql','host'), 0);
- changeDataInFile(getCachePath() . 'config-local.php', 'MYSQL-DBASE', " 'dbase' => '", "',", postRequestParameter('mysql','dbase'), 0);
- changeDataInFile(getCachePath() . 'config-local.php', 'MYSQL-LOGIN', " 'login' => '", "',", postRequestParameter('mysql','login'), 0);
- changeDataInFile(getCachePath() . 'config-local.php', 'MYSQL-PASSWORD', " 'password' => '", "',", postRequestParameter('mysql','pass1'), 0);
- changeDataInFile(getCachePath() . 'config-local.php', 'MYSQL-PREFIX', "setConfigEntry('_MYSQL_PREFIX', '", "');", postRequestParameter('mysql','prefix'), 0);
- changeDataInFile(getCachePath() . 'config-local.php', 'TABLE-TYPE', "setConfigEntry('_TABLE_TYPE', '", "');", postRequestParameter('mysql','type'), 0);
- changeDataInFile(getCachePath() . 'config-local.php', 'SMTP-HOSTNAME', "setConfigEntry('SMTP_HOSTNAME', '", "');", postRequestParameter('smtp_host'), 0);
- changeDataInFile(getCachePath() . 'config-local.php', 'SMTP-USER', "setConfigEntry('SMTP_USER', '", "');", postRequestParameter('smtp_user'), 0);
- changeDataInFile(getCachePath() . 'config-local.php', 'SMTP-PASSWORD', "setConfigEntry('SMTP_PASSWORD', '", "');", postRequestParameter('smtp_pass1'), 0);
+ if (postRequestParameter('spath') != getPath()) changeDataInInclude(getCachePath() . 'config-local.php', 'SERVER-PATH', "setConfigEntry('PATH', '", "');", postRequestParameter('spath'), 0);
+ if (postRequestParameter('burl') != getUrl()) changeDataInInclude(getCachePath() . 'config-local.php', 'HOST-URL', "setConfigEntry('URL', '", "');", postRequestParameter('burl'), 0);
+ changeDataInInclude(getCachePath() . 'config-local.php', 'MAIN-TITLE', "setConfigEntry('MAIN_TITLE', '", "');", postRequestParameter('title'), 0);
+ changeDataInInclude(getCachePath() . 'config-local.php', 'SLOGAN', "setConfigEntry('SLOGAN', '", "');", postRequestParameter('slogan'), 0);
+ changeDataInInclude(getCachePath() . 'config-local.php', 'WEBMASTER', "setConfigEntry('WEBMASTER', '", "');", postRequestParameter('email'), 0);
+ changeDataInInclude(getCachePath() . 'config-local.php', 'NULLPASS-WARNING', "setConfigEntry('WARN_NO_PASS', '", "');", postRequestParameter('warn_no_pass'), 0);
+ changeDataInInclude(getCachePath() . 'config-local.php', 'WRITE-FOOTER', "setConfigEntry('WRITE_FOOTER', '", "');", postRequestParameter('wfooter'), 0);
+ changeDataInInclude(getCachePath() . 'config-local.php', 'BACKLINK', "setConfigEntry('ENABLE_BACKLINK', '", "');", postRequestParameter('blink'), 0);
+ // @TODO DEACTIVATED: changeDataInInclude(getCachePath() . 'config-local.php', 'OUTPUT-MODE', "setConfigEntry('OUTPUT_MODE', '", "');", postRequestParameter('omode'), 0);
+ changeDataInInclude(getCachePath() . 'config-local.php', 'MYSQL-HOST', " 'host' => '", "',", postRequestParameter('mysql','host'), 0);
+ changeDataInInclude(getCachePath() . 'config-local.php', 'MYSQL-DBASE', " 'dbase' => '", "',", postRequestParameter('mysql','dbase'), 0);
+ changeDataInInclude(getCachePath() . 'config-local.php', 'MYSQL-LOGIN', " 'login' => '", "',", postRequestParameter('mysql','login'), 0);
+ changeDataInInclude(getCachePath() . 'config-local.php', 'MYSQL-PASSWORD', " 'password' => '", "',", postRequestParameter('mysql','pass1'), 0);
+ changeDataInInclude(getCachePath() . 'config-local.php', 'MYSQL-PREFIX', "setConfigEntry('_MYSQL_PREFIX', '", "');", postRequestParameter('mysql','prefix'), 0);
+ changeDataInInclude(getCachePath() . 'config-local.php', 'TABLE-TYPE', "setConfigEntry('_TABLE_TYPE', '", "');", postRequestParameter('mysql','type'), 0);
+ changeDataInInclude(getCachePath() . 'config-local.php', 'SMTP-HOSTNAME', "setConfigEntry('SMTP_HOSTNAME', '", "');", postRequestParameter('smtp_host'), 0);
+ changeDataInInclude(getCachePath() . 'config-local.php', 'SMTP-USER', "setConfigEntry('SMTP_USER', '", "');", postRequestParameter('smtp_user'), 0);
+ changeDataInInclude(getCachePath() . 'config-local.php', 'SMTP-PASSWORD', "setConfigEntry('SMTP_PASSWORD', '", "');", postRequestParameter('smtp_pass1'), 0);
// Generate a long site key
$siteKey = generatePassword(50);
// And write it
- changeDataInFile(getCachePath() . 'config-local.php', 'SITE-KEY', "setConfigEntry('SITE_KEY', '", "');", $siteKey, 0);
+ changeDataInInclude(getCachePath() . 'config-local.php', 'SITE-KEY', "setConfigEntry('SITE_KEY', '", "');", $siteKey, 0);
// Script is now installed
- changeDataInFile(getCachePath() . 'config-local.php', 'INSTALLED', "setConfigEntry('MXCHANGE_INSTALLED', '", "');", 'Y', 0);
+ changeDataInInclude(getCachePath() . 'config-local.php', 'INSTALLED', "setConfigEntry('MXCHANGE_INSTALLED', '", "');", 'Y', 0);
}
// Adds a given template with content to install output stream
function parseContent ( $content ) {
$x = explode("\n", $content);
$return = array();
- foreach($x as $currentLine) {
+ foreach ($x as $currentLine) {
$line_exploded = explode(':', $currentLine,2);
if (count($line_exploded) > 1) {
$return[$line_exploded[0]] = $line_exploded[1];
// Just count...
$total = '0';
- foreach($prices['userid'] as $key => $userid) {
+ foreach ($prices['userid'] as $key => $userid) {
// Check status
// active = 1: account is still confirmed
// active = 0: account is deleted or locked
array(bigintval($id)), __FUNCTION__, __LINE__);
// Run array through (by userid is the most important 2nd-level-array)
- foreach($prices['userid'] as $key => $userid) {
+ foreach ($prices['userid'] as $key => $userid) {
// Allow valid and active users with at least one ref to get points
if ((isValidUserId($userid)) && ($prices['ref'][$key] > 0) && ($prices['active'][$key] == 1) && ($prices['cpoints'][$key] > 0)) {
// Transfer data to array for the mail template
unset($_GET[$seckey]);
} else {
// Only variables are allowed (non-array) but we secure them all!
- foreach ($GLOBALS['security_chars']['from'] as $key => $char) {
- // Pass all through
- $_GET[$seckey] = str_replace($char , $GLOBALS['security_chars']['to'][$key], $_GET[$seckey]);
- } // END - foreach
+ $_GET[$seckey] = str_replace($GLOBALS['security_chars']['from'], $GLOBALS['security_chars']['to'], $_GET[$seckey]);
// Strip all other out
$_GET[$seckey] = secureString($_GET[$seckey]);
// Check if registration wents fine
switch ($ret) {
case 'done':
- $done = changeDataInFile(getCachePath() . 'config-local.php', 'ADMIN-SETUP', "setConfigEntry('ADMIN_REGISTERED', '", "');", 'Y', 0);
+ $done = changeDataInInclude(getCachePath() . 'config-local.php', 'ADMIN-SETUP', "setConfigEntry('ADMIN_REGISTERED', '", "');", 'Y', 0);
if ($done === true) {
// Registering is done
redirectToUrl('modules.php?module=admin&register=done');
$content['profile_reupdate'] = createTimeSelections(getConfig('resend_profile_update') , 'resend_profile_update', 'MWD');
// Prepare more Y/N selections
- foreach(array('show_points_unconfirmed','show_timings','youre_here','member_menu','guest_menu','order_multi_page','autosend_active','send_prof_update','admin_notify','display_debug_sqls','stats_enabled') as $entry) {
+ foreach (array('show_points_unconfirmed','show_timings','youre_here','member_menu','guest_menu','order_multi_page','autosend_active','send_prof_update','admin_notify','display_debug_sqls','stats_enabled') as $entry) {
$content[$entry . '_y'] = '';
$content[$entry . '_n'] = '';
$content[$entry . '_' . strtolower(getConfig($entry))] = ' checked="checked"';
if (isInStringIgnoreCase('200 OK', $response[0])) {
// Found, kill header
$pos = '0';
- foreach($response as $k => $v) {
+ foreach ($response as $k => $v) {
$v = trim($v);
if (empty($v)) {
// Header ends here (+1)
$pos = $k + 1; break;
- }
- }
+ } // END - if
+ } // END - foreach
$response2 = array();
for($i = $pos; $i < count($response); $i++) {
initMessages();
// Include more
- foreach (array('databases','session','versions','install-functions','load_config','load_cache') as $inc) {
+ foreach (array('databases', 'session', 'versions', 'install-functions', 'load_config', 'load_cache') as $inc) {
// Load the include
loadIncludeOnce('inc/' . $inc . '.php');
} // END - foreach
$code = str_replace('{--', '{%message,', str_replace('--}', '%}', $code));
// Compile QUOT and other non-HTML codes
- foreach ($secChars['to'] as $k => $to) {
- // Do the reversed thing as in inc/libs/security_functions.php
- $code = str_replace($to, $secChars['from'][$k], $code);
- } // END - foreach
+ $code = str_replace($secChars['to'], $secChars['from'], $code);
// Find $content[bla][blub] entries
// @TODO Do only use $content and deprecate $GLOBALS and $DATA in templates
$count_lines = count($codeE);
$r = 'Line | Code:<br />';
- foreach($codeE as $line => $c) {
+ foreach ($codeE as $line => $c) {
$r .= '<div class="line"><span class="linenum">';
if ($count_lines == 1) {
$r .= 1;
fclose($fp);
}
+// Wrapper for changeDataInFile() but with full path added
+function changeDataInInclude ($FQFN, $comment, $prefix, $suffix, $DATA, $seek=0) {
+ // Add full path
+ $FQFN = getPath() . $FQFN;
+
+ // Call inner function
+ changeDataInFile($FQFN, $comment, $prefix, $suffix, $DATA, $seek);
+}
+
// [EOF]
?>