// Get extension version
$ext_ver = getExtensionVersion($ext_name);
- // Write cache line to file
- fwrite($this->pointer, $this->rewriteEntry($ext_name, $ext_ver, 'version', true));
-
// Add the extension version to object (DO NOT REMOVE IT! Endless loop...)
$this->version[$this->name][$ext_name] = $ext_ver;
+
+ // Write cache line to file
+ fwrite($this->pointer, $this->rewriteEntry($ext_name, $ext_ver, 'version', true));
} // END - if
//* DEBUG: */ outputHtml(__METHOD__."(<font color=\"#0000aa\">".__LINE__."</font>): {$this->name} - {$ext_name}={$ext_ver}<br />");
} else {
incrementExtensionUpdateIterator();
// Check for required file
- if (loadExtension($ext_update, 'register', '', getExtensionDryRun())) {
+ if ((!isExtensionInstalled($ext_update)) && (loadExtension($ext_update, 'register', '', getExtensionDryRun()))) {
// Set current extension name again
setCurrentExtensionName($ext_name);
} // END - if
} elseif ($ext_ver != getCurrentExtensionVersion()) {
// Ok, update this extension now
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "currName=".getCurrentExtensionName().",ext_update=".$ext_update.",ext_ver=".$ext_ver."/".getCurrentExtensionVersion()."");
- $GLOBALS['ext_backup'][$ext_update][$ext_ver] = getCurrentExtensionName();
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName='.getCurrentExtensionName().',currVer='.getCurrentExtensionVersion().'');
+ $GLOBALS['ext_backup_name'][$ext_update][$ext_ver] = getCurrentExtensionName();
+ $GLOBALS['ext_backup_ver'][$ext_update][$ext_ver] = getCurrentExtensionVersion();
updateExtension($ext_update, $ext_ver, getExtensionDryRun());
- setCurrentExtensionName($GLOBALS['ext_backup'][$ext_update][$ext_ver]);
- unset($GLOBALS['ext_backup'][$ext_update][$ext_ver]);
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "currName=".getCurrentExtensionName()."");
+ setCurrentExtensionName($GLOBALS['ext_backup_name'][$ext_update][$ext_ver]);
+ setCurrentExtensionVersion($GLOBALS['ext_backup_ver'][$ext_update][$ext_ver]);
+ unset($GLOBALS['ext_backup_name'][$ext_update][$ext_ver]);
+ unset($GLOBALS['ext_backup_ver'][$ext_update][$ext_ver]);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName='.getCurrentExtensionName().',currVer='.getCurrentExtensionVersion().'');
// All okay!
$test = true;
// Is the cache written?
if (isset($GLOBALS['cache_array']['extension']['ext_version'][$ext_name])) {
// Load data from cache
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, ": CACHE!");
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $ext_name . ': CACHE!');
$data['ext_version'] = $GLOBALS['cache_array']['extension']['ext_version'][$ext_name];
// Count cache hits
// Load from database
$result = SQL_QUERY_ESC("SELECT `ext_version` FROM `{?_MYSQL_PREFIX?}_extensions` WHERE `ext_name`='%s' LIMIT 1",
array($ext_name), __FUNCTION__, __LINE__);
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, ": DB - ".SQL_NUMROWS($result)."");
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $ext_name . ': DB - '.SQL_NUMROWS($result).'');
// Is the extension there?
if (SQL_NUMROWS($result) == 1) {
// Load entry
$data = SQL_FETCHARRAY($result);
} elseif (isDebugModeEnabled()) {
- // Not found!
- logDebugMessage(__FUNCTION__, __LINE__, sprintf(": Cannot find extension %s in database!", $ext_name));
+ // Not found, please report all
+ debug_report_bug(sprintf(": Cannot find extension %s in database!", $ext_name));
}
// Free result
// All is false by default
$ret = false;
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "mod={$mod},cache=".getExtensionVersion('cache'));
+ // Extension installed and newer than or has version 0.1.2?
if (isExtensionInstalledAndNewer('cache', '0.1.2')) {
// Cache version is okay, so let's check the cache!
if (isset($GLOBALS['cache_array']['modules']['has_menu'][$mod])) {
}
// Return status
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "currName=".getCurrentExtensionName().intval($ret));
return $ret;
}
} // END - if
// Return result
- //* DEBUG: */ print __FUNCTION__.': '.$ext_name.'='.intval($GLOBALS['ext_inc_readable'][$ext_name]).'<br />';
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ',realable='.intval($GLOBALS['ext_inc_readable'][$ext_name]));
return $GLOBALS['ext_inc_readable'][$ext_name];
}
// Is the config valid?
if (isConfigEntrySet($matches[1][$key])) {
// Set it for caching
- $GLOBALS['compile_config'][$matches[1][$key]] = "\".getConfig('" . $matches[1][$key] . "').\"";
+ $GLOBALS['compile_config'][$matches[1][$key]] = "\" . getConfig('" . $matches[1][$key] . "') . \"";
} elseif (isConfigEntrySet('default_' . strtoupper($matches[1][$key]))) {
// Use default value
$GLOBALS['compile_config'][$matches[1][$key]] = "\" . getConfig('" . 'DEFAULT_' . strtoupper($matches[1][$key]) . "') . \"";
break;
case 'ext':
- // Construct call-back function name
- $functionName = 'getExtension' . ucfirst(strtolower($callback));
+ // Not installed is default
+ $replacer = 'false';
- // Construct call of the function
- $replacer = "\" . call_user_func_array('" . $functionName . "', array('" . $matches[4][$key] . "', true)) . \"";
+ // Is the extension installed?
+ if (isExtensionInstalled($matches[4][$key])) {
+ // Construct call-back function name
+ $functionName = 'getExtension' . ucfirst(strtolower($callback));
+
+ // Construct call of the function
+ $replacer = "\" . call_user_func_array('" . $functionName . "', array('" . $matches[4][$key] . "', true)) . \"";
+ } // END - if
// Replace it and insert parameter for GET request
- $code = str_replace($matches[0][$key], sprintf("&ext=%s&rev=\" . getConfig('CURR_SVN_REVISION') . \"", $replacer), $code);
+ $code = str_replace($matches[0][$key], sprintf("&ext=%s&ver=%s&rev=\" . getConfig('CURR_SVN_REVISION') . \"", $matches[4][$key], $replacer), $code);
break;
case 'config': // @TODO FILTER_COMPILE_CONFIG does not handle call-back functions so we handle it here again
// Is the reset set or old sql_patches?
if (((!isResetModeEnabled()) || (!isExtensionInstalled('sql_patches'))) && (getOutputMode() == '0')) {
// Then abort here
- logDebugMessage(__FUNCTION__, __LINE__, 'Cannot run reset! Please report this bug. Thanks');
+ debug_report_bug('Cannot run reset! enabled='.intval(isResetModeEnabled()).',ext='.intval(isExtensionInstalled('sql_patches')).' Please report this bug. Thanks');
} // END - if
// Get more daily reset scripts
// Filter for running daily reset
function FILTER_RUN_DAILY_RESET () {
// Only execute this filter if installed
- if ((!isInstalled()) || (!isAdminRegistered())) return;
+ if ((isInstallationPhase()) || (!isInstalled()) || (!isAdminRegistered()) || (!isExtensionInstalled('sql_patches'))) return;
// Shall we run the reset scripts? If a day has changed, maybe also a week/month has changed... Simple! :D
- // 012 3 4 43 3 4432 2 3 3 21 1 221 1 221 1 2 21 1 22 10
if (((date('d', getConfig('last_update')) != date('d', time())) || ((isConfigEntrySet('DEBUG_RESET')) && (getConfig('DEBUG_RESET') == 'Y'))) && (!isInstallationPhase()) && (isAdminRegistered()) && (!isGetRequestElementSet('register')) && (getOutputMode() != 1)) {
// Tell every module we are in reset-mode!
doReset();
if (isDebugModeEnabled()) {
// In debug mode we want to display the mail instead of sending it away so we can debug this part
outputHtml('<pre>
-Headers : ' . htmlentities(trim($mailHeader)) . '
-To : ' . htmlentities($toEmail) . '
-Subject : ' . htmlentities($subject) . '
-Message : ' . htmlentities($message) . '
+Headers : ' . htmlentities(utf8_decode(trim($mailHeader))) . '
+To : ' . htmlentities(utf8_decode($toEmail)) . '
+Subject : ' . htmlentities(utf8_decode($subject)) . '
+Message : ' . htmlentities(utf8_decode($message)) . '
</pre>');
} elseif (($isHtml == 'Y') && (isExtensionActive('html_mail'))) {
// Send mail as HTML away
}
// Create selection box or array of splitted timestamp
function createTimeSelections ($timestamp, $prefix = '', $display = '', $align = 'center', $return_array=false) {
+ // Do not continue if ONE_DAY is absend
+ if (!isConfigEntrySet('ONE_DAY')) {
+ // And return the timestamp itself or empty array
+ if ($return_array === true) {
+ return array();
+ } else {
+ return $timestamp;
+ }
+ } // END - if
+
// Calculate 2-seconds timestamp
$stamp = round($timestamp);
//* DEBUG: */ print("*" . $stamp.'/' . $timestamp."*<br />");
$scrambleNums = explode(':', genScrambleString(strlen($str)));
}
+ // Compare both lengths and abort if different
+ if (strlen($str) != count($scrambleNums)) return $str;
+
// Scramble string here
//* DEBUG: */ outputHtml('***Original=' . $str.'***<br />');
for ($idx = '0'; $idx < strlen($str); $idx++) {
// When the admin is logging in check several things first (new jobs to complete and so on)
if (getAction() == 'login') {
- if (isExtensionActive('task')) {
+ if ((isExtensionActive('task')) && (function_exists('outputAdvancedOverview'))) {
// When task extension is registered output advanced overview page
$jobsDone = outputAdvancedOverview($result_tasks); // This function is provided by the extension 'task'
$taskExt = true;
@TODO Doesn't work with sessions
<tr>
<td class="bottom" width="50%" align="right">{--SELECT_TIMEOUT--}:</td>
- <!-- @TODO Try to move the select box to our generic functions //-->
+ @TODO Try to move the select box to our generic functions
<td class="bottom" width="50%">
<select name="timeout" size="1" class="admin_select">
<option value="86400">{--TIMEOUT_ONE_DAY--}</option>