reportBug(__FUNCTION__, __LINE__, 'Required session data for this step not found.');
} // END - if
+ // Remove any previous flag
+ unsetSqlLinkUp(__FUNCTION__, __LINE__);
+
// Establish link
$linkResource = SQL_CONNECT(getSession('mysql_host'), getSession('mysql_login'), getSession('mysql_password1'), __FUNCTION__, __LINE__);
reportBug(__FUNCTION__, __LINE__, 'Cannot load/register extension ' . $ext_name . '.');
} // END - if
} // END - foreach
-
- // Close SQL link
- SQL_CLOSE(__FUNCTION__, __LINE__);
}
// Call-back function to write local configuration file
$GLOBALS[__FUNCTION__][$sqlString] = $sqlStringModified;
$GLOBALS['last_sql'] = $sqlStringModified;
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Stored cache: ' . $sqlStringModified);
- } else {
+ } elseif (!SQL_IS_LINK_UP()) {
+ // Link went down while using cached SQL
+ reportBug(__FUNCTION__, __LINE__, 'Link went down while using cached SQL: sqlString=' . $sqlString . ',F=' . basename($F) . ',L=' . $L . ',enableCodes=' . intval($enableCodes));
+ } else {
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cache used: ' . $sqlString);
// Use cache (to save a lot function calls
// SQL fetch row
function SQL_FETCHROW ($resource) {
- // Is a result resource set?
+ // Is $resource valid?
if ((!is_resource($resource)) || (!SQL_IS_LINK_UP())) return FALSE;
// Fetch the data and return it
// SQL fetch array
function SQL_FETCHARRAY ($resource) {
- // Is a result resource set?
+ // Is $resource valid?
if ((!is_resource($resource)) || (!SQL_IS_LINK_UP())) return FALSE;
- // Load row from database
+ // Load row as array from database
$row = mysql_fetch_assoc($resource);
// Return only arrays here
* SQL_IS_LINK_UP() will only return 'true' if there is really a
* working database link.
*/
- SQL_SET_LINK($linkResource);
+ SQL_SET_LINK(__FUNCTION__, __LINE__, $linkResource);
} // END - if
// Return the resource
+ //* DEBUG: */ logDebugMessage($F . ':' . __FUNCTION__, $L . ':' . __LINE__, 'linkResource[]=' . gettype($linkResource));
return $linkResource;
}
if (!SQL_IS_LINK_UP()) return FALSE;
// Return the result
+ //* DEBUG: */ logDebugMessage($F . ':' . __FUNCTION__, $L . ':' . __LINE__, 'Selecting database ' . $dbName);
return mysql_select_db($dbName, SQL_GET_LINK()) or SQL_ERROR($F, $L, mysql_error());
}
// SQL close link
function SQL_CLOSE ($F, $L) {
+ // Is the link up?
if (!SQL_IS_LINK_UP()) {
// Skip double close
+ //* DEBUG: */ logDebugMessage($F . ':' . __FUNCTION__, $L . ':' . __LINE__, 'Called but no link is open.');
return FALSE;
} // END - if
// Close database link and forget the link
- $close = mysql_close(SQL_GET_LINK()) or SQL_ERROR($F, $L, mysql_error());
+ $close = mysql_close(SQL_GET_LINK()) or SQL_ERROR($F . ':' . __FUNCTION__, $L . ':' . __LINE__, mysql_error());
- // Close link
- SQL_SET_LINK(NULL);
+ // Close link in this layer
+ unsetSqlLinkUp(__FUNCTION__, __LINE__);
// Return the result
+ //* DEBUG: */ logDebugMessage($F . ':' . __FUNCTION__, $L . ':' . __LINE__, 'close[' . gettype($close) . ']=' . intval($close));
return $close;
}
$filterFunction = 'FILTER_' . strtoupper($filterFunction);
// Debug message with FILTER_ prefix
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ENTRY: filterName=' . $filterName . ',filterFunction=' . $filterFunction . ',force=' . intval($force) . ',F=' . basename($F) . ',L=' . $L . ' - ENTERED!');
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ENTRY: filterName=' . $filterName . ',filterFunction=' . $filterFunction . ',force=' . intval($force) . ',isDryRun=' . intval($isDryRun) . ',F=' . basename($F) . ',L=' . $L . ' - ENTERED!');
// Is that filter already there?
if ((isset($GLOBALS['cache_array']['filter']['chains'][$filterName][$filterFunction])) && ($force === FALSE)) {
// Is the function there?
if (!function_exists($filterFunction)) {
// Then abort here
- addFatalMessage(__FUNCTION__, __LINE__, sprintf("Filter function %s could not be added to filter chain %s. F=%s,L=%s,force=%d", $filterFunction, $filterName, basename($F), $L, intval($force)));
+ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Filter function %s could not be added to filter chain %s. F=%s,L=%s,force=%d", $filterFunction, $filterName, basename($F), $L, intval($force)));
return FALSE;
} // END - if
$GLOBALS['cache_array']['filter']['counter'][$filterName][$filterFunction] = '0';
} // END - if
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ENTRY: filterName=' . $filterName . ',filterFunction=' . $filterFunction . ',force=' . intval($force) . ',F=' . basename($F) . ',L=' . $L . ' - EXIT!');
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ENTRY: filterName=' . $filterName . ',filterFunction=' . $filterFunction . ',force=' . intval($force) . ',isDryRun=' . intval($isDryRun) . ',F=' . basename($F) . ',L=' . $L . ' - EXIT!');
+
+ // Worked
+ return TRUE;
}
// "Unregisters" a filter from the given chain
// Is that filter there?
if ((!isset($GLOBALS['cache_array']['filter']['chains'][$filterName][$filterFunction])) && ($force === FALSE)) {
// Not found, so abort here
- addFatalMessage(__FUNCTION__, __LINE__, sprintf(getMessage('FILTER_FAILED_NOT_REMOVED'), $filterFunction, $filterName));
+ logDebugMessage(__FUNCTION__, __LINE__, sprintf('Filter function %s cannot be unregistered from filter %s.', $filterFunction, $filterName));
return FALSE;
} // END - if
} // END - if
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'F=' . $F . ',L=' . $L . ',filterName=' . $filterName . ',filterFunction=' . $filterFunction . ',force=' . intval($force) . ',isDryRun=' . intval($isDryRun) . ' - EXIT!');
+
+ // Worked
+ return TRUE;
}
// "Runs" the given filters, filterData is optional and can be any type of data
} // END - if
// Call the filter chain
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $filterName . '/' . $filterFunction . ',[]=' . gettype($returnValue));
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $filterName . '/' . $filterFunction . ',[]=' . gettype($returnValue) . ' - CALLING!');
$returnValue = call_user_func_array($filterFunction, array($returnValue));
// Update usage counter
reportBug(__FUNCTION__, __LINE__, 'No database link is up. Cannot flush filters.');
} elseif ((isInstallationPhase()) && (!SQL_IS_LINK_UP())) {
// If the link is not up in installation phase, skip flushing filters
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cannot flush filters: No link is up.');
return;
}
// Is the extension ext-sql_patches updated?
- if ((!isExtensionInstalled('sql_patches')) || (isExtensionInstalledAndOlder('sql_patches', '0.5.9'))) {
+ if (((!isExtensionInstalled('sql_patches')) || (isExtensionInstalledAndOlder('sql_patches', '0.5.9'))) && (!isInstallationPhase())) {
// Log only in debug mode
if (isDebugModeEnabled()) {
logDebugMessage(__FUNCTION__, __LINE__, 'Cannot flush filters, ext-sql_patches might be missing. isExtensionInstalled()=' . intval(isExtensionInstalled('sql_patches')) . ',isExtensionInstalledAndOlder()=' . intval(isExtensionInstalledAndOlder('sql_patches', '0.5.9')));
// Walk through all filters
foreach ($filterArray as $filterFunction => $active) {
// Is this filter loaded?
- //* DEBUG: */ debugOutput('FOUND:'.$filterName.'/'.$filterFunction.'='.$active);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'FOUND:'.$filterName.'/'.$filterFunction.'='.$active);
if (((!isset($GLOBALS['cache_array']['filter']['loaded'][$filterName][$filterFunction])) && ($active != 'R')) || ($active == 'A')) {
// Is this filter already in database?
if (countSumTotalData($filterFunction, 'filters', 'filter_name', 'filter_function', TRUE, sprintf(" AND `filter_name`='%s'", SQL_ESCAPE($filterName))) == 0) {
// Add this filter (all filters are active by default)
- //* DEBUG: */ debugOutput('ADD:'.$filterName.'/'.$filterFunction);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ADD:'.$filterName.'/'.$filterFunction);
$insertSQL .= sprintf("('%s','%s','Y'),", $filterName, $filterFunction);
$inserted++;
} elseif (isDebugModeEnabled()) {
}
} elseif ($active == 'R') {
// Remove this filter
- //* DEBUG: */ debugOutput('REMOVE:'.$filterName.'/'.$filterFunction);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'REMOVE:'.$filterName.'/'.$filterFunction);
$removeSQL .= sprintf(" (`filter_name`='%s' AND `filter_function`='%s') OR", $filterName, $filterFunction);
$removed++;
}
} // END - foreach
} // END - foreach
+ // Debug message
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'inserted=' . $inserted . ',removed=' . $removed . ' - AFTER COLLECTION');
+
// Something has been added?
if ($inserted > 0) {
// Finish SQL command and add it
return $content;
}
-// Filter for redirecting to logout if ext-sql_patches has been installed
-function FILTER_REDIRECT_TO_LOGOUT_SQL_PATCHES () {
- // Remove this filter
- unregisterFilter(__FUNCTION__, __LINE__, 'shutdown', __FUNCTION__);
-
- // Is the element set?
- if (isset($GLOBALS['ext_load_mode'])) {
- // Redirect here
- redirectToUrl('modules.php?module=admin&logout=1&' . $GLOBALS['ext_load_mode'] . '=sql_patches');
- } // END - if
-
- // This should not happen!
- logDebugMessage(__FUNCTION__, __LINE__, 'Cannot auto-logout because no extension load-mode has been set.');
-}
-
// Filter for auto-activation of a extension
function FILTER_AUTO_ACTIVATE_EXTENSION ($filterData) {
// Debug message
// Getter for total fatal message count
function getTotalFatalErrors () {
// Init count
- $count = '0';
+ $count = 0;
// Is there at least the first entry?
if (!empty($GLOBALS['fatal_messages'][0])) {
// Get total count
$count = count($GLOBALS['fatal_messages']);
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'count=' . $count . ' - FROM ARRAY');
} // END - if
// Return value
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'count=' . $count . ' - EXIT!');
return $count;
}
$message = str_replace(array(chr(13), PHP_EOL), array('', ''), $message);
// Log this message away
- appendLineToFile(getPath() . getCachePath() . 'debug.log', generateDateTime(time(), '4') . '|' . getModule(FALSE) . '|' . basename($funcFile) . '|' . $line . '|' . $message);
+ appendLineToFile(getPath() . getCachePath() . 'debug.log', generateDateTime(time(), '4') . '|' . getModule(FALSE) . ':' . getExtraModule() . '|' . basename($funcFile) . '|' . $line . '|' . $message);
} // END - if
}
// Call the filter chain 'shutdown'
runFilterChain('shutdown', NULL);
- // Check if not in installation phase and the link is up
- if ((!isInstallationPhase()) && (SQL_IS_LINK_UP())) {
+ // Check if link is up
+ if (SQL_IS_LINK_UP()) {
// Close link
SQL_CLOSE(__FUNCTION__, __LINE__);
} elseif (!isInstallationPhase()) {
return FALSE;
} // END - if
+ // Remove any previous flag
+ unsetSqlLinkUp(__FUNCTION__, __LINE__);
+
// Try to connect to the database
- $linkResource = SQL_CONNECT(postRequestElement('mysql_host'), postRequestElement('mysql_login'), postRequestElement('mysql_password1'), __FUNCTION__, __LINE__);
+ SQL_CONNECT(postRequestElement('mysql_host'), postRequestElement('mysql_login'), postRequestElement('mysql_password1'), __FUNCTION__, __LINE__);
// Is the link up
- if (!is_resource($linkResource)) {
+ if (!SQL_IS_LINK_UP()) {
// Cannot connect to database
$GLOBALS['installer_post_error'][$currentTab] = '{--INSTALLER_POST_DATABASE_CONNECT_ERROR--}';
array_push($GLOBALS['installer_failed_fields'][$currentTab], 'mysql_login', 'mysql_password1', 'mysql_password2');
initSqls();
// Remove any existing "cache"
- unset($GLOBALS['is_sql_link_up']);
+ unsetSqlLinkUp(__FILE__, __LINE__);
// Connect to database server
SQL_CONNECT($GLOBALS['install_mysql']['host'], $GLOBALS['install_mysql']['login'], $GLOBALS['install_mysql']['password1'], __FILE__, __LINE__);
'FILTER_FAILED_ALREADY_INIT' => "Filter-System ist bereits initialisiert.",
'FILTER_FAILED_ALREADY_ADDED' => "Die Filterfunktion <span class=\"data\">%s</span> ist bereits der Filterkette <span class=\"data\">%s</span> hinzugefügt.",
'FILTER_FAILED_NO_FILTER_FOUND' => "Die Filterkette <span class=\"data\">%s</span> konnte nicht gefunden werden.",
- 'FILTER_FAILED_NOT_REMOVED' => "Die Filterfunktion <span class=\"data\">%s</span> konnte nicht aus der Filterkette <span class=\"data\">%s</span> entfernt werden, da sie nicht existiert.",
// Status changes
'ADMIN_STATUS_CHANGED' => "Es wurden <span class=\"data\">%s</span> von <span class=\"data\">%s</span> Einträgen geändert.",
if (($GLOBALS['cache_instance']->loadCacheFile('foo')) && ($GLOBALS['cache_instance']->extensionVersionMatches('foo'))) {
// Load cache
$GLOBALS['cache_array']['foo'] = $GLOBALS['cache_instance']->getArrayFromCache();
-} elseif (isHtmlOutputMode()) {
+} elseif ((isHtmlOutputMode()) || (isRawOutputMode())) {
// Create cache file
$GLOBALS['cache_instance']->init();
$GLOBALS['cache_instance']->removeCacheFile();
unset($GLOBALS['cache_array']['admin']);
}
-} elseif (isHtmlOutputMode()) {
+} elseif ((isHtmlOutputMode()) || (isRawOutputMode())) {
// Create cache file
$GLOBALS['cache_instance']->init();
// This may drive a lot messages to the logfile
//* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'No entry found in admin_acls to rewrite.');
}
- } elseif (isHtmlOutputMode()) {
+ } elseif ((isHtmlOutputMode()) || (isRawOutputMode())) {
// Create cache file here
$GLOBALS['cache_instance']->init();
// Remove dummy array
unset($config);
-} elseif (isHtmlOutputMode()) {
+} elseif ((isHtmlOutputMode()) || (isRawOutputMode())) {
// Create cache file here
$GLOBALS['cache_instance']->init();
// Remove array and mark cache as loaded
unset($EXT_POOL);
-} elseif (isHtmlOutputMode()) {
+} elseif ((isHtmlOutputMode()) || (isRawOutputMode())) {
// Create cache file here
$GLOBALS['cache_instance']->init();
// Prepare the array here
prepareFilterArray();
-} elseif ((isHtmlOutputMode()) && (isExtensionInstalled('sql_patches'))) {
+} elseif (((isHtmlOutputMode()) || (isRawOutputMode())) && (isExtensionInstalledAndNewer('sql_patches', '0.5.9'))) {
// Create cache file here
$GLOBALS['cache_instance']->init();
if (($GLOBALS['cache_instance']->loadCacheFile('imprint')) && ($GLOBALS['cache_instance']->extensionVersionMatches('imprint'))) {
// Load cache
$GLOBALS['cache_array']['imprint'] = $GLOBALS['cache_instance']->getArrayFromCache();
-} elseif (isHtmlOutputMode()) {
+} elseif ((isHtmlOutputMode()) || (isRawOutputMode())) {
// Create cache file
$GLOBALS['cache_instance']->init();
} // END - foreach
} // END - foreach
unset($modArray);
-} elseif (isHtmlOutputMode()) {
+} elseif ((isHtmlOutputMode()) || (isRawOutputMode())) {
// Create cache file here
$GLOBALS['cache_instance']->init();
// Set the array back and remove temporary
$GLOBALS['cache_array']['payments'] = $paymentsData;
unset($paymentsData);
-} elseif (isHtmlOutputMode()) {
+} elseif ((isHtmlOutputMode()) || (isRawOutputMode())) {
// Create cache file
$GLOBALS['cache_instance']->init();
if (($GLOBALS['cache_instance']->loadCacheFile('refdepths')) && ($GLOBALS['cache_instance']->extensionVersionMatches('sql_patches'))) {
// Load referral system from cache
$GLOBALS['cache_array']['refdepths'] = $GLOBALS['cache_instance']->getArrayFromCache();
-} elseif (isHtmlOutputMode()) {
+} elseif ((isHtmlOutputMode()) || (isRawOutputMode())) {
// Create cache file here
$GLOBALS['cache_instance']->init();
if (($GLOBALS['cache_instance']->loadCacheFile('refsystem')) && ($GLOBALS['cache_instance']->extensionVersionMatches('sql_patches'))) {
// Load referral system from cache
$GLOBALS['cache_array']['refsystem'] = $GLOBALS['cache_instance']->getArrayFromCache();
-} elseif (isHtmlOutputMode()) {
+} elseif ((isHtmlOutputMode()) || (isRawOutputMode())) {
// Create cache file here
$GLOBALS['cache_instance']->init();
// Remove dummy array
unset($cache);
-} elseif (isHtmlOutputMode()) {
+} elseif ((isHtmlOutputMode()) || (isRawOutputMode())) {
// Create cache file here
$GLOBALS['cache_instance']->init();
// CFG: DATABASE-TYPE
setConfigEntry('_DB_TYPE', 'mysql3');
+ // Set link as down
+ unsetSqlLinkUp(__FILE__, __LINE__);
+
// Load database layer here
loadIncludeOnce('inc/db/lib.php');
return $SQL;
}
+// Function to unset __is_sql_link_up
+function unsetSqlLinkUp ($F, $L) {
+ // Unset it
+ //* DEBUG: */ logDebugMessage($F, $L, __FUNCTION__ . ': Called!');
+ SQL_SET_LINK($F, $L, NULL);
+}
+
// Initializes the SQL link by bringing it up if set
function initSqlLink () {
+ // "Unset" the link
+ unsetSqlLinkUp(__FUNCTION__, __LINE__);
+
// Do this only if link is down
assert(!SQL_IS_LINK_UP());
// Is the configuration data set?
if ((!empty($GLOBALS['mysql']['host'])) && (!empty($GLOBALS['mysql']['login'])) && (!empty($GLOBALS['mysql']['dbase']))) {
// Remove cache
- unset($GLOBALS['is_sql_link_up']);
+ unsetSqlLinkUp(__FUNCTION__, __LINE__);
// Connect to DB
- SQL_CONNECT($GLOBALS['mysql']['host'], $GLOBALS['mysql']['login'], $GLOBALS['mysql']['password'], __FILE__, __LINE__);
+ SQL_CONNECT($GLOBALS['mysql']['host'], $GLOBALS['mysql']['login'], $GLOBALS['mysql']['password'], __FUNCTION__, __LINE__);
// Is the link valid?
if (SQL_IS_LINK_UP()) {
enableExitOnError();
// Is it a valid resource?
- if (SQL_SELECT_DB($GLOBALS['mysql']['dbase'], __FILE__, __LINE__) === TRUE) {
+ if (SQL_SELECT_DB($GLOBALS['mysql']['dbase'], __FUNCTION__, __LINE__) === TRUE) {
// Set database name (required for ext-optimize and ifSqlTableExists())
setConfigEntry('__DB_NAME', $GLOBALS['mysql']['dbase']);
loadIncludeOnce('inc/load_cache.php');
} else {
// Wrong database?
- reportBug(__FILE__, __LINE__, 'Wrong database selected.');
+ reportBug(__FUNCTION__, __LINE__, 'Wrong database selected.');
}
} else {
// No link to database!
- reportBug(__FILE__, __LINE__, 'Database link is not yet up.');
+ reportBug(__FUNCTION__, __LINE__, 'Database link is not yet up.');
}
} else {
// Maybe you forgot to enter your database login?
- reportBug(__FILE__, __LINE__, 'Database login is missing.');
+ reportBug(__FUNCTION__, __LINE__, 'Database login is missing.');
}
}
// Is the file readable?
if (!isFileReadable($FQFN)) {
// Not found, which is bad
- reportBug(__FILE__, __LINE__, sprintf("SQL dump %s/%s.sql is not readable.", $path, $dumpName));
+ reportBug(__FUNCTION__, __LINE__, sprintf("SQL dump %s/%s.sql is not readable.", $path, $dumpName));
} // END - if
// Then read it
// Link is there?
if ((!SQL_IS_LINK_UP()) || (!is_array($data))) {
// Link is down or data is not an array
- /* DEBUG: */ logDebugMessage($F, $L, 'SQL_IS_LINK_UP()=' . intval(SQL_IS_LINK_UP()) . ',data[]=' . gettype($data) . ',sqlString=' . $sqlString . ': ABORTING!');
+ //* DEBUG: */ logDebugMessage($F, $L, 'SQL_IS_LINK_UP()=' . intval(SQL_IS_LINK_UP()) . ',data[]=' . gettype($data) . ',sqlString=' . $sqlString . ': ABORTING!');
return FALSE;
} // END - if
$link = NULL;
// Is it in the globals?
- if (isset($GLOBALS['sql_link'])) {
+ if (isset($GLOBALS['__sql_link'])) {
// Then take it
- $link = $GLOBALS['sql_link'];
+ $link = $GLOBALS['__sql_link'];
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'link[]=' . gettype($link) . ' - FROM GLOBALS!');
} // END - if
// Return it
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'link[]=' . gettype($link) . ' - EXIT!');
return $link;
}
// Setter for link
-function SQL_SET_LINK ($link) {
+function SQL_SET_LINK ($F, $L, $link) {
+ //* DEBUG: */ logDebugMessage($F . ':' . __FUNCTION__, $L . ':' . __LINE__, 'link[]=' . gettype($link) . ' - ENTERED!');
// Is this a resource or null?
if ((ifFatalErrorsDetected()) && (isInstallationPhase())) {
// This may happen in installation phase
+ //* DEBUG: */ logDebugMessage($F . ':' . __FUNCTION__, $L . ':' . __LINE__, 'Some fatal errors detected in installation phase.');
return;
} elseif ((!is_resource($link)) && (!is_null($link))) {
// This should never happen!
- reportBug(__FUNCTION__, __LINE__, sprintf("Type of link is not resource or null, type=%s", gettype($link)));
+ reportBug($F . ':' . __FUNCTION__, $L . ':' . __LINE__, sprintf("Type of link is not resource or null, type=%s", gettype($link)));
} // END - if
// Set it
- $GLOBALS['sql_link'] = $link;
+ $GLOBALS['__sql_link'] = $link;
// Re-init cache
- $GLOBALS['is_sql_link_up'] = is_resource($link);
+ $GLOBALS['__is_sql_link_up'] = is_resource($link);
+ //* DEBUG: */ logDebugMessage($F . ':' . __FUNCTION__, $L . ':' . __LINE__, '__is_sql_link_up=' . intval($GLOBALS['__is_sql_link_up']) . ' - EXIT!');
}
// Checks if the link is up
function SQL_IS_LINK_UP () {
// Is there cached this?
- if (!isset($GLOBALS['is_sql_link_up'])) {
- // Determine it
- $GLOBALS['is_sql_link_up'] = is_resource(SQL_GET_LINK());
+ if (!isset($GLOBALS['__is_sql_link_up'])) {
+ // Something bad went wrong
+ reportBug(__FUNCTION__, __LINE__, 'Called before SQL_SET_LINK() was called!');
} // END - if
// Return the result
- return $GLOBALS['is_sql_link_up'];
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, '__is_sql_link_up=' . intval($GLOBALS['__is_sql_link_up']) . ' - EXIT!');
+ return $GLOBALS['__is_sql_link_up'];
}
// Wrapper function to make code more readable
if (!isset($GLOBALS[__FUNCTION__][$tableName])) {
// Check if the table is there
$result = SQL_QUERY_ESC("SHOW TABLES FROM `{?__DB_NAME?}` WHERE `Tables_in_{?__DB_NAME?}`='{?_MYSQL_PREFIX?}_%s'",
- array($tableName), __FILE__, __LINE__);
+ array($tableName), __FUNCTION__, __LINE__);
// Is a link there?
if (!is_resource($result)) {
$GLOBALS['__module'] = strtolower($newModule);
}
+// Wrapper to get extra module names
+function getExtraModule () {
+ // Default is 'NULL'
+ $extra = 'NULL';
+
+ // Is 'tab/step' set?
+ if (isPostRequestElementSet('tab')) {
+ // Use this
+ $extra = 'tab=' . postRequestElement('tab');
+ } elseif (isPostRequestElementSet('step')) {
+ // Use this
+ $extra = 'step=' . postRequestElement('step');
+ } elseif ((isActionSet()) && (isWhatSet())) {
+ // Use 'action/what'
+ $extra = 'action=' . getAction() . ':what=' . getWhat();
+ }
+
+ // Return it
+ return $extra;
+}
+
// Checks whether module is set and optionally aborts on miss
function isModuleSet ($strict = FALSE) {
// Check for it