./inc/extensions-functions.php:434:// @TODO Change from ext_id to ext_name (not just even the variable! ;-) )
./inc/extensions-functions.php:564: // @TODO Extension is loaded, what next?
./inc/functions.php:110: // @TODO Extension 'msg' does not exist
-./inc/functions.php:1509: // @TODO Move this SQL code into a function, let's say 'getTimestampFromPoolId($id) ?
-./inc/functions.php:1597: // @TODO Are these convertions still required?
-./inc/functions.php:1615:// @TODO Rewrite this function to use readFromFile() and writeToFile()
+./inc/functions.php:1503: // @TODO Move this SQL code into a function, let's say 'getTimestampFromPoolId($id) ?
+./inc/functions.php:1591: // @TODO Are these convertions still required?
+./inc/functions.php:1609:// @TODO Rewrite this function to use readFromFile() and writeToFile()
./inc/functions.php:179:// @TODO Rewrite this to an extension 'smtp'
-./inc/functions.php:2273: // @TODO This is still very static, rewrite it somehow
+./inc/functions.php:2267: // @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/language/de.php:1091:// @TODO Rewrite these two constants
./inc/modules/member/what-unconfirmed.php:206: // @TODO This 'userid' cannot be saved because of encapsulated EL code
./inc/modules/order.php:74: // @TODO Unused: 2,4
./inc/monthly/monthly_bonus.php:67: // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:1188: // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:1443: // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
-./inc/mysql-manager.php:1551: // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:1922: // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:1966:// @TODO Fix inconsistency between last_module and getWhat()
+./inc/mysql-manager.php:1183: // @TODO Rewrite this to a filter
+./inc/mysql-manager.php:1438: // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
+./inc/mysql-manager.php:1546: // @TODO Rewrite this to a filter
+./inc/mysql-manager.php:1917: // @TODO Rewrite this to a filter
+./inc/mysql-manager.php:1961:// @TODO Fix inconsistency between last_module and getWhat()
./inc/mysql-manager.php:368: // @TODO Try to rewrite this to one or more functions
./inc/mysql-manager.php:44:// @TODO Can we cache this?
./inc/reset/reset_beg.php:49:// @TODO This should be converted in a daily beg rallye
return $GLOBALS[__FUNCTION__][$yn];
}
-// Translates the "pool type" into human-readable
-function translatePoolType ($type) {
- // Return "translation"
- return sprintf("{--POOL_TYPE_%s--}", $type);
-}
-
// Translates the american decimal dot into a german comma
function translateComma ($dotted, $cut = true, $max = '0') {
// First, cast all to double, due to PHP changes
//
-// Deprecated : $length
+// Deprecated : $length (still has one reference in this function)
// Optional : $DATA
//
function generateRandomCode ($length, $code, $userid, $DATA = '') {
// @TODO Try to rewrite this to one or more functions
if ((!isset($GLOBALS['last_online'])) || (!is_array($GLOBALS['last_online']))) $GLOBALS['last_online'] = array();
- // is the cache entry there?
+ // Is the cache entry there?
if (isset($GLOBALS[__FUNCTION__])) {
// Then return it
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'CACHED! (' . intval($GLOBALS[__FUNCTION__]) . ')');
return $GLOBALS[__FUNCTION__];
} elseif ((!isSessionVariableSet('userid')) || (!isSessionVariableSet('u_hash'))) {
- // No member
+ // Destroy any existing user session data
+ destroyMemberSession();
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'No member set in cookie/session.');
+
+ // Abort further processing
return false;
- } else {
- // Get it secured from session
- setMemberId(getSession('userid'));
- setCurrentUserId(getMemberId());
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . getSession('userid') . ' used from cookie/session.');
}
+ // Get userid secured from session
+ setMemberId(getSession('userid'));
+
+ // ... and set it as currently handled user id
+ setCurrentUserId(getMemberId());
+
// Init user data array
initUserData();
// Fix "deleted" cookies first
fixDeletedCookies(array('userid', 'u_hash'));
- // Are cookies set?
- if ((isMemberIdSet()) && (isSessionVariableSet('u_hash'))) {
- // Cookies are set with values, but are they valid?
- if (fetchUserData(getMemberId()) === true) {
- // Validate password by created the difference of it and the secret key
- $valPass = encodeHashForCookie(getUserData('password'));
+ // Are cookies set and can the member data be loaded?
+ if ((isMemberIdSet()) && (isSessionVariableSet('u_hash')) && (fetchUserData(getMemberId()) === true)) {
+ // Validate password by created the difference of it and the secret key
+ $valPass = encodeHashForCookie(getUserData('password'));
+ // So did we now have valid data and an unlocked user?
+ if ((getUserData('status') == 'CONFIRMED') && ($valPass == getSession('u_hash'))) {
// Transfer last module and online time
$GLOBALS['last_online']['module'] = getUserData('last_module');
$GLOBALS['last_online']['online'] = getUserData('last_online');
- // So did we now have valid data and an unlocked user?
- if ((getUserData('status') == 'CONFIRMED') && ($valPass == getSession('u_hash'))) {
- // Account is confirmed and all cookie data is valid so he is definely logged in! :-)
- $ret = true;
- } else {
- // Maybe got locked etc.
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'status=' . getUserData('status') . ',' . $valPass . '(' . strlen($valPass) . ')/' . getSession('u_hash') . '(' . strlen(getSession('u_hash')) . ')/' . getUserData('password') . '(' . strlen(getUserData('password')) . ')');
- destroyMemberSession();
- }
- } else {
- // Cookie data is invalid!
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cookie data invalid or user not found.');
- destroyMemberSession();
- }
- } else {
- // Cookie data is invalid!
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cookie data not complete.');
+ // Account is confirmed and all cookie data is valid so he is definely logged in! :-)
+ $ret = true;
+ } // END - if
+ } // END - if
+
+ // Is $ret still false?
+ if ($ret === false) {
+ // Yes, so destroy the session
destroyMemberSession();
- }
+ } // END - if
// Cache status
$GLOBALS[__FUNCTION__] = $ret;
return $return;
}
+// Translates the "pool type" into human-readable
+function translatePoolType ($type) {
+ // Return "translation"
+ return sprintf("{--POOL_TYPE_%s--}", strtoupper($type));
+}
+
//-----------------------------------------------------------------------------
-// Template Helper Functions
+// Template helper functions for EL
//-----------------------------------------------------------------------------
// Color-switch helper function
// Modules are by default not valid!
$isModuleValid = false;
$URL = '';
-$check = 'failed';
+
+// Init module state as 'failed' (always failed first)
+$moduleState = 'failed';
// Is the maintenance mode active or goes all well?
if ((isExtensionActive('maintenance')) && (getConfig('maintenance') == 'Y') && (!isAdmin()) && (getModule() != 'admin')) {
$GLOBALS['module_inc'] = sprintf("inc/modules/%s.php", getModule());
// Check module permission (again)
- $check = checkModulePermissions();
- switch ($check) {
+ $moduleState = checkModulePermissions();
+
+ // Which permission/error state do we have?
+ switch ($moduleState) {
case 'cache_miss': // The cache is gone
case 'admin_only': // Admin-only access
case 'mem_only': // Member-only access
default:
// Unknown module status
- logDebugMessage(__FILE__, __LINE__, sprintf("Unknown status %s return from module check. Module=%s", $check, getModule()));
- addFatalMessage(__FILE__, __LINE__, getMaskedMessage('UNKNOWN_MODULE_STATUS', $check));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown status %s return from module check. Module=%s", $moduleState, getModule()));
+ addFatalMessage(__FILE__, __LINE__, getMaskedMessage('UNKNOWN_MODULE_STATUS', $moduleState));
break;
} // END - switch
} elseif (!ifFatalErrorsDetected()) {