X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmysql-manager.php;h=1a8ebe194ab92d561001406e4dd181168fe3f145;hp=9a774b446cebaa14de8930dc3375e201b04e7cda;hb=2379934be6a196a54f4155bb8e24c49b20736969;hpb=2e394cb5b8a6225a39a6942b1fcc17c37a17a175 diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index 9a774b446c..1a8ebe194a 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -46,7 +46,13 @@ function getTitleFromMenu ($mode, $what, $column = 'what', $ADD='') { // Fix empty 'what' if (empty($what)) { $what = getIndexHome(); - } // END - if + } elseif ((isGetRequestElementSet('action')) && ($column == 'what')) { + // Get it from action + return getTitleFromMenu($mode, getAction(), 'action', $ADD); + } elseif ($what == 'overview') { + // Overview page + return '{--WHAT_IS_OVERVIEW--}'; + } // Default is not found $data['title'] = '??? (' . $what . ')'; @@ -98,13 +104,16 @@ function addYouAreHereLink ($accessLevel, $FQFN, $return = false) { // This is a 'what file'! $type = 'what'; $search = substr($file, 5); - $ADD = " AND `visible`='Y' AND `locked`='N'"; // Get access level from it $modCheck = getModuleFromFileName($file, $accessLevel); // Do we have admin? Then display all - if (isAdmin()) $ADD = ''; + $ADD = " AND `visible`='Y' AND `locked`='N'"; + if (isAdmin()) { + // Display all! + $ADD = ''; + } // END - if $dummy = substr($search, 0, -4); $ADD .= sprintf(" AND `action`='%s'", getActionFromModuleWhat($accessLevel, $dummy)); @@ -128,11 +137,12 @@ function addYouAreHereLink ($accessLevel, $FQFN, $return = false) { $GLOBALS['nav_depth'] = '0'; // Run the pre-filter chain - $ret = runFilterChain('pre_youhere_line', array('access_level' => $accessLevel, 'type' => $type, 'content' => '')); + $ret = runFilterChain('pre_youhere_line', array('access_level' => $accessLevel, 'type' => $type, 'search' => $search, 'prefix' => $prefix, 'link_add' => $LINK_ADD, 'content' => '', 'add' => $ADD)); // Add pre-content $prefix = $ret['content']; + // Add default content $prefix .= '
{--YOU_ARE_HERE--} Home'; } elseif ($return === false) { // Count depth @@ -152,18 +162,20 @@ function addYouAreHereLink ($accessLevel, $FQFN, $return = false) { $OUT = $prefix . '' . getTitleFromMenu($accessLevel, $search, $type, $ADD) . ''; // Can we close the you-are-here navigation? - //* DEBUG: */ debugOutput(__LINE__.'*'.$type.'/'.getWhat().'*'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'type=' . $type . 'getWhat()=' . getWhat()); if (($type == 'what') || (($type == 'action') && ((!isWhatSet()) || (getWhat() == 'overview')))) { - //* DEBUG: */ debugOutput(__LINE__.'+'.$type.'+'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'type=' . $type); // Add closing div and br-tag - $OUT .= '
'; $GLOBALS['nav_depth'] = '0'; // Run the post-filter chain - $ret = runFilterChain('post_youhere_line', array('access_level' => $accessLevel, 'type' => $type, 'content' => '')); + $ret = runFilterChain('post_youhere_line', array('access_level' => $accessLevel, 'type' => $type, 'search' => $search, 'prefix' => $prefix, 'link_add' => $LINK_ADD, 'content' => $OUT, 'add' => $ADD)); + + // Get content from filter back + $OUT = $ret['content']; - // Add additional content - $OUT .= $ret['content']; + // Close div-tag, so not the filters have to do it + $OUT .= ''; } // END - if } // END - if @@ -181,7 +193,6 @@ function addYouAreHereLink ($accessLevel, $FQFN, $return = false) { function addMenu ($mode, $action, $what) { // Init some variables $main_cnt = '0'; - $ADD = ''; // is the menu action valid? if (!isMenuActionValid($mode, $action, $what, true)) { @@ -189,13 +200,15 @@ function addMenu ($mode, $action, $what) { } // END - if // Non-admin shall not see all menus - if (!isAdmin()) { - $ADD = " AND `visible`='Y' AND `locked`='N'"; + $ADD = " AND `visible`='Y' AND `locked`='N'"; + if (isAdmin()) { + // Is admin, so make all visible + $ADD = ''; } // END - if // Load SQL data and add the menu to the output stream... $result_main = SQL_QUERY_ESC("SELECT - `title`, `what`, `action`, `visible`, `locked` + `title`,`what`,`action`,`visible`,`locked` FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE @@ -205,12 +218,12 @@ ORDER BY `sort` ASC", array($mode), __FUNCTION__, __LINE__); - //* DEBUG: */ debugOutput(__LINE__ . '/' . $main_cnt . ':' . getWhat() . '*'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'main_cnt=' . $main_cnt . ',getWhat()=' . getWhat()); if (!SQL_HASZERONUMS($result_main)) { // There are menus available, so we simply display them... :) $GLOBALS['rows'] = ''; while ($content = SQL_FETCHARRAY($result_main)) { - //* DEBUG: */ debugOutput(__LINE__ . '/' . $main_cnt . '/' . $content['action'] . ':' . getWhat() . '*'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'main_cnt=' . $main_cnt . ',action=' . $content['action'] . ',getWhat()=' . getWhat()); // Disable the block-mode enableBlockMode(false); @@ -248,7 +261,7 @@ ORDER BY $OUT = ''; // Full file name for checking menu - //* DEBUG: */ debugOutput(__LINE__ . ':!!!!' . $content['sub_what'] . '!!!'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'sub_what=' . $content['sub_what']); $inc = sprintf("inc/modules/%s/what-%s.php", $mode, $content['sub_what']); if (isIncludeReadable($inc)) { // Mark currently selected menu - open @@ -256,11 +269,17 @@ ORDER BY $OUT = ''; } // END - if - // Navigation link - $OUT .= ''; + // Is ext-sql_patches up-to-date, and display_home_in_index is Y? + if ((isExtensionInstalledAndNewer('sql_patches', '0.8.3')) && (isDisplayHomeInIndexEnabled()) && ($content['sub_what'] == getIndexHome())) { + // Use index.php as link + $OUT .= ''; + } else { + // Regular navigation link + $OUT .= ''; + } } else { // Not found - open - $OUT .= ''; + $OUT .= ''; } // Menu title @@ -305,12 +324,12 @@ ORDER BY if (isFileReadable($INC)) { // Load include file if ((!isExtensionActive($content['action'])) || ($content['action'] == 'online')) $GLOBALS['rows'] .= loadTemplate('menu_what_begin', true, $mode); - //* DEBUG: */ debugOutput(__LINE__ . '/' . $main_cnt . '/' . $content['action'] . '/' . getWhat().'*'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'main_cnt=' . $main_cnt . ',action=' . $content['action'] . ',getWhat()=' . getWhat()); loadInclude($INC); - //* DEBUG: */ debugOutput(__LINE__ . '/' . $main_cnt . '/' . $content['action'] . '/' . getWhat() . '*'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'main_cnt=' . $main_cnt . ',action=' . $content['action'] . ',getWhat()=' . getWhat()); if ((!isExtensionActive($content['action'])) || ($content['action'] == 'online')) $GLOBALS['rows'] .= loadTemplate('menu_what_end', true, $mode); } - //* DEBUG: */ debugOutput(__LINE__ . '/' . $main_cnt . '/' . $content['action'] . '/' . $content['sub_what'] . ':' . getWhat() . '*'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'main_cnt=' . $main_cnt . ',action=' . $content['action'] . ',getWhat()=' . getWhat()); } // Free result @@ -319,7 +338,7 @@ ORDER BY // Count one up $main_cnt++; - //* DEBUG: */ debugOutput(__LINE__ . '/' . $main_cnt . ':' . getWhat() . '*'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'main_cnt=' . $main_cnt . ',getWhat()=' . getWhat()); if (SQL_NUMROWS($result_main) > $main_cnt) { // Add seperator $GLOBALS['rows'] .= loadTemplate('menu_seperator', true, $mode); @@ -354,7 +373,7 @@ ORDER BY ); // Load main template - //* DEBUG: */ debugOutput(__LINE__ . '/' . $main_cnt . '/' . $content['action'] . '/' . $content['sub_what'] . ':' . getWhat() . '*'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'main_cnt=' . $main_cnt . ',getWhat()=' . getWhat()); loadTemplate('menu_table', false, $content); } // END - if } @@ -428,6 +447,15 @@ function isMember () { // Fetch user data for given user id function fetchUserData ($value, $column = 'userid') { + // Extension ext-user must be there at any case + if (!isExtensionActive('user')) { + // Absent ext-user is really not good + return false; + } 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') { // Secure userid @@ -442,10 +470,12 @@ function fetchUserData ($value, $column = 'userid') { debug_report_bug(__FUNCTION__, __LINE__, 'User id ' . $value . ' is invalid.'); } elseif (isUserDataValid()) { // Use cache, so it is fine + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'value=' . $value . ' is valid, using cache #1'); return true; } - } elseif (isUserDataValid()) { - // Use cache, so it is fine + } elseif (isUserDataValid()) { + // Using cache is fine + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'value=' . $value . ' is valid, using cache #2'); return true; } @@ -477,7 +507,7 @@ function fetchUserData ($value, $column = 'userid') { if ((isExtensionInstalledAndNewer('user', '0.3.7')) && (isset($GLOBALS['user_data'][getCurrentUserId()]['last_failure']))) { // Backup the raw one and zero it $GLOBALS['user_data'][getCurrentUserId()]['last_failure_raw'] = $GLOBALS['user_data'][getCurrentUserId()]['last_failure']; - $GLOBALS['user_data'][getCurrentUserId()]['last_failure'] = null; + $GLOBALS['user_data'][getCurrentUserId()]['last_failure'] = NULL; // Is it not zero? if (!is_null($GLOBALS['user_data'][getCurrentUserId()]['last_failure_raw'])) { @@ -531,7 +561,7 @@ function isAdmin () { $adminId = getCurrentAdminId(); $passCookie = getAdminMd5(); } // END - if - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $adminId.'/'.$passCookie); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'mainId=' . $adminId . 'passCookie=' . $passCookie); // Abort if admin id is zero if ($adminId == '0') { @@ -583,13 +613,13 @@ function addMaxReceiveList ($mode, $default = '', $return = false) { switch ($mode) { case 'guest': // Guests (in the registration form) are not allowed to select 0 mails per day. - $result = SQL_QUERY('SELECT `value`, `comment` FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE `value` > 0 ORDER BY `value` ASC', + $result = SQL_QUERY('SELECT `value`,`comment` FROM `{?_MYSQL_PREFIX?}_max_receive` WHERE `value` > 0 ORDER BY `value` ASC', __FUNCTION__, __LINE__); break; case 'member': // Members are allowed to set to zero mails per day (we will change this soon!) - $result = SQL_QUERY('SELECT `value`, `comment` FROM `{?_MYSQL_PREFIX?}_max_receive` ORDER BY `value` ASC', + $result = SQL_QUERY('SELECT `value`,`comment` FROM `{?_MYSQL_PREFIX?}_max_receive` ORDER BY `value` ASC', __FUNCTION__, __LINE__); break; @@ -603,7 +633,7 @@ function addMaxReceiveList ($mode, $default = '', $return = false) { $OUT = ''; while ($content = SQL_FETCHARRAY($result)) { $OUT .= '