* -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2009 by Roland Haeder *
* Copyright (c) 2009 - 2011 by Mailer Developer Team *
- * For more information visit: http://www.mxchange.org *
+ * For more information visit: http://mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
// Fix empty 'what'
if (empty($what)) {
$what = getIndexHome();
- } elseif ((isGetRequestParameterSet('action')) && ($column == 'what')) {
+ } elseif ((isGetRequestElementSet('action')) && ($column == 'what')) {
// Get it from action
return getTitleFromMenu($mode, getAction(), 'action', $ADD);
} elseif ($what == 'overview') {
if (!isExtensionActive('user')) {
// Absent ext-user is really not good
return false;
- } // END - if
+ } elseif (is_null($value)) {
+ // This shall never happen, so please report it
+ debug_report_bug(__FUNCTION__, __LINE__, 'value=NULL,column=' . $column . ' - value can never be NULL');
+ }
// If we should look for userid secure&set it here
if (substr($column, -2, 2) == 'id') {
$OUT = '';
while ($content = SQL_FETCHARRAY($result)) {
$OUT .= ' <option value="' . $content['value'] . '"';
- if (postRequestParameter('max_mails') == $content['value']) $OUT .= ' selected="selected"';
+ if (postRequestElement('max_mails') == $content['value']) $OUT .= ' selected="selected"';
$OUT .= '>' . $content['value'] . ' {--PER_DAY--}';
if (!empty($content['comment'])) $OUT .= '(' . $content['comment'] . ')';
$OUT .= '</option>';
if ($module == 'admin') {
// Action value for admin area
- if (isGetRequestParameterSet('action')) {
+ if (isGetRequestElementSet('action')) {
// Use from request!
- return getRequestParameter('action');
+ return getRequestElement('action');
} elseif (isActionSet()) {
// Get it directly from URL
return getAction();
$module = mapModuleToTable($module);
// Guest and member menu is 'main' as the default
- if (empty($data['action'])) $data['action'] = 'main';
+ if (empty($data['action'])) {
+ $data['action'] = 'main';
+ } // END - if
// Load from database
$result = SQL_QUERY_ESC("SELECT `action` FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE `what`='%s' LIMIT 1",
- array($module, $what), __FUNCTION__, __LINE__);
+ array(
+ $module,
+ $what
+ ), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Load action value and pray that this one is the right you want... ;-)
$data = SQL_FETCHARRAY($result);
return $data['email'];
}
-// Get default ACL of admin id
+// Get default ACL of admin id
function getAdminDefaultAcl ($adminId) {
// By default an invalid ACL value is returned
$data['default_acl'] = 'NO-ACL';
if (!isExtensionActive('sql_patches')) {
// Not found, which is bad, so we need to allow all
$data['default_acl'] = 'allow';
- } elseif (isset($GLOBALS['cache_array']['admin']['def_acl'][$adminId])) {
+ } elseif (isset($GLOBALS['cache_array']['admin']['default_acl'][$adminId])) {
// Use cache
- $data['default_acl'] = $GLOBALS['cache_array']['admin']['def_acl'][$adminId];
+ $data['default_acl'] = $GLOBALS['cache_array']['admin']['default_acl'][$adminId];
// Update cache hits
incrementStatsEntry('cache_hits');
$data = SQL_FETCHARRAY($result_admin_id);
// Set cache
- $GLOBALS['cache_array']['admin']['def_acl'][$adminId] = $data['default_acl'];
+ $GLOBALS['cache_array']['admin']['default_acl'][$adminId] = $data['default_acl'];
}
// Free result
return $data['default_acl'];
}
+// Get menu mode (la_mode) of admin id
+function getAdminMenuMode ($adminId) {
+ // By default an invalid mode
+ $data['la_mode'] = 'INVALID';
+
+ // Is sql_patches there and was it found in cache?
+ if (!isExtensionActive('sql_patches')) {
+ // Not found, which is bad, so we need to allow all
+ $data['la_mode'] = 'global';
+ } elseif (isset($GLOBALS['cache_array']['admin']['la_mode'][$adminId])) {
+ // Use cache
+ $data['la_mode'] = $GLOBALS['cache_array']['admin']['la_mode'][$adminId];
+
+ // Update cache hits
+ incrementStatsEntry('cache_hits');
+ } elseif (!isExtensionActive('cache')) {
+ // Load from database
+ $result_admin_id = SQL_QUERY_ESC("SELECT `la_mode` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `id`=%s LIMIT 1",
+ array(bigintval($adminId)), __FUNCTION__, __LINE__);
+
+ // Do we have an entry?
+ if (SQL_NUMROWS($result_admin_id) == 1) {
+ // Fetch data
+ $data = SQL_FETCHARRAY($result_admin_id);
+
+ // Set cache
+ $GLOBALS['cache_array']['admin']['la_mode'][$adminId] = $data['la_mode'];
+ }
+
+ // Free result
+ SQL_FREERESULT($result_admin_id);
+ }
+
+ // Return default ACL
+ return $data['la_mode'];
+}
+
// Generates an option list from various parameters
-function generateOptionList ($table, $id, $name, $default = '', $special = '', $where = '', $disabled = array(), $callback = '') {
+function generateOptionList ($table, $id, $name, $default = '', $special = '', $whereStatement = '', $disabled = array(), $callback = '') {
$ret = '';
if ($table == '/ARRAY/') {
// Selection from array
// Data from database
$SPEC = ', `' . $id . '`';
if (!empty($special)) {
- $SPEC = ', `' . $special . '`';
+ $SPEC = ', `' . $special . '` AS `special`';
} // END - if
// Query the database
- $result = SQL_QUERY_ESC("SELECT `%s`,`%s`".$SPEC." FROM `{?_MYSQL_PREFIX?}_%s` ".$where." ORDER BY `%s` ASC",
+ $result = SQL_QUERY_ESC("SELECT `%s` AS `id`,`%s` AS `name`".$SPEC." FROM `{?_MYSQL_PREFIX?}_%s` ".$whereStatement." ORDER BY `%s` ASC",
array(
$id,
$name,
// Do we have rows?
if (!SQL_HASZERONUMS($result)) {
- // Found data so add them as OPTION lines: $id is the value and $name is the "name" of the option
- // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
- while (list($value, $title, $add) = SQL_FETCHROW($result)) {
- if (empty($special)) $add = '';
- $ret .= '<option value="' . $value . '"';
- if ($default == $value) {
+ // Found data so add them as OPTION lines
+ while ($content = SQL_FETCHARRAY($result)) {
+ // Is special set?
+ if (!isset($content['special'])) {
+ // Set it to empty
+ $content['special'] = '';
+ } // END - if
+
+ $ret .= '<option value="' . $content['id'] . '"';
+
+ if ($default == $content['id']) {
// Selected by default
$ret .= ' selected="selected"';
- } elseif (isset($disabled[$value])) {
+ } elseif (isset($disabled[$content['id']])) {
// Disabled!
$ret .= ' disabled="disabled"';
}
// Add it, if set
- if (!empty($add)) {
- $add = ' ('.$add.')';
+ if (!empty($content['special'])) {
+ $content['special'] = ' (' . $content['special'] . ')';
} // END - if
// Is the call-back function set?
if (!empty($callback)) {
// Call it
- $title = call_user_func_array($callback, array($title));
+ $content['name'] = call_user_func_array($callback, array($content['name']));
} // END - if
// Finish option list
- $ret .= '>' . $title . $add . '</option>';
+ $ret .= '>' . $content['name'] . $content['special'] . '</option>';
} // END - while
} else {
// No data found
// Gets the matching what name from module
function getWhatFromModule ($modCheck) {
// Is the request element set?
- if (isGetRequestParameterSet('what')) {
+ if (isGetRequestElementSet('what')) {
// Then return this!
- return getRequestParameter('what');
+ return getRequestElement('what');
} // END - if
// Default is empty