$sqlString = FILTER_COMPILE_CONFIG($sqlString, true);
// Starting time
- $querytimeBefore = array_sum(explode(' ', microtime()));
+ $querytimeBefore = microtime(true);
// Run SQL command
//* DEBUG: */ print('F=' . basename($F) . ',L=' . $L . 'sql=' . $sqlString . '<br />');
' . $sqlString);
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'sql=' . $sqlString . ',numRows=' . SQL_NUMROWS($result) . ',affected=' . SQL_AFFECTEDROWS());
- // Ending time
- $querytimeAfter = array_sum(explode(' ', microtime()));
-
// Calculate query time
- $queryTime = $querytimeAfter - $querytimeBefore;
+ $queryTime = microtime(true) - $querytimeBefore;
// Add this query to array including timing
addSqlToDebug($result, $sqlString, $queryTime, $F, $L);
//
// Debugging stuff...
//
- $fp = fopen(getConfig('CACHE_PATH') . 'mysql.log', 'a') or app_die(__FILE__, __LINE__, "Cannot write mysql.log!");
+ $fp = fopen(getConfig('CACHE_PATH') . 'mysql.log', 'a') or app_die(__FILE__, __LINE__, 'Cannot write mysql.log!');
if (!isset($GLOBALS['sql_first_entry'])) {
// Write first entry
fwrite($fp, 'Module=' . getModule() . "\n");
addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_admin_menu` SET `what`=NULL WHERE `what`=''");
addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_guest_menu` SET `what`=NULL WHERE `what`=''");
addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `what`=NULL WHERE `what`=''");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_admin_menu` DROP INDEX `what`");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_admin_menu` ADD UNIQUE (`what`)");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_guest_menu` DROP INDEX `what`");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_guest_menu` ADD UNIQUE (`what`)");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_member_menu` ADD INDEX `action` (`action`)");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_member_menu` DROP INDEX `what`");
- addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_member_menu` ADD UNIQUE (`what`)");
+
+ // Make this depending on ext-menu
+ addExtensionUpdateDependency('menu');
// Update notes (these will be set as task text!)
setExtensionUpdateNotes("Schlüssel in Admin-, Gast- und Mitgliedsmenü verbessert.");
} // END - if
// Start couting
- $startCompile = explode(' ', microtime());
+ $startCompile = microtime(true);
// Comile the code
$code = compileRawCode($code, $simple, $constants, $full);
// Get timing
- $compiled = explode(' ', microtime());
+ $compiled = microtime(true);
// Add timing
- $code .= '<!-- Compilation time: ' . ((($compiled[1] + $compiled[0]) - ($startCompile[1] + $startCompile[0])) * 1000). 'ms //-->';
+ $code .= '<!-- Compilation time: ' . (($compiled - $startCompile) * 1000). 'ms //-->';
// Return compiled code
return $code;
if (substr(strtolower($script), 0, 7) == 'http://') {
// But only if http:// is in front!
$script = substr($script, (strlen($url) + 7));
- } elseif (substr(strtolower($script), 0, 8) == "https://") {
+ } elseif (substr(strtolower($script), 0, 8) == 'https://') {
// Does this work?!
$script = substr($script, (strlen($url) + 8));
}
die($debug);
}
-// Generates a ***weak*** seed (taken from de.php.net/mt_srand)
+// Generates a ***weak*** seed
function generateSeed () {
- list($usec, $sec) = explode(' ', microtime());
- $microTime = (((float)$sec + (float)$usec)) * 100000;
- return $microTime;
+ return microtime(true) * 100000;
}
// Converts a message code to a human-readable message
// Load message template
$content['login_message'] = loadTemplate('admin_login_msg', true, $loginMessage);
$content['pass_message'] = loadTemplate('admin_login_msg', true, $passwdMessage);
-
- // Reset variables
- unset($loginMessage);
- unset($passwdMessage);
} // END - if
// Load login form
}
} else {
// Invalid action/what pair found!
- loadTemplate('admin_menu_failed', false, sprintf(getMessage('ADMIN_ACTION_INVALID'), $action.'/'.$what));
+ loadTemplate('admin_menu_failed', false, sprintf(getMessage('ADMIN_ACTION_INVALID'), $action . '/' . $what));
}
// Free memory
//* DEBUG: */ print(__LINE__.'='.$mode.'/'.$what.'/'.getAction()."=<br />");
if (!isExtensionInstalledAndNewer('sql_patches', '0.0.5')) {
// sql_patches is missing so choose depending on mode
- if ($mode == 'admin') {
+ if (isWhatSet()) {
+ // Use setted what
+ $what = getWhat();
+ } elseif ($mode == 'admin') {
+ // Admin area
$what = 'overview';
} else {
+ // Everywhere else
$what = 'welcome';
}
} elseif ((empty($what)) && ($mode != 'admin')) {
// Free memory
SQL_FREERESULT($result);
- } elseif ((!isExtensionInstalled('sql_patches')) && ($mode != 'admin')) {
+ } elseif ((!isExtensionInstalled('sql_patches')) && (($mode != 'admin') && ($mode != 'unknown'))) {
// No sql_patches installed, but maybe we need to register an admin?
if (isAdminRegistered()) {
// Redirect to admin area
// Should we abort here?
if (($strict === true) && ($isset === false)) {
// Output backtrace
- print 'Module not set!<pre>';
- debug_print_backtrace();
- die('</pre');
debug_report_bug('module is empty.');
} // END - if
// Return it
- return $isset;
+ return (($isset === true) && ($GLOBALS['module'] != 'unknown')) ;
}
// Getter for 'output_mode' value
// Init output mode and module
$GLOBALS['output_mode'] = '0';
-$GLOBALS['module'] = '';
+$GLOBALS['module'] = 'unknown';
// Needed include files
require('inc/config-global.php');
setContentType('text/html');
// Fix missing module to 'index'
-if (!isGetRequestElementSet('module')) setRequestGetElement('module', 'index');
+if (!isGetRequestElementSet('module')) {
+ // Set element
+ setRequestGetElement('module', 'index');
+
+ // ... and module
+ setModule('index');
+} // END - if
// The header file
loadIncludeOnce('inc/header.php');
-<br />
-<br />
<table border="0" cellspacing="0" cellpadding="0" class="admin_table dashed">
<tr>
<td align="center" height="40" class="admin_title bottom2">