X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmysql-manager.php;h=cfd3e318cd896fcbf174e2eaf150380de76538d5;hb=eabcb2e3f319c840d3908b5a21b32f40fce40d2b;hp=58564d9b54a388a48e1a99525f58b717e9c6b93e;hpb=18eb87f5ec1182966e2ff5ef128a379330534f80;p=mailer.git
diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php
index 58564d9b54..cfd3e318cd 100644
--- a/inc/mysql-manager.php
+++ b/inc/mysql-manager.php
@@ -16,8 +16,8 @@
* $Author:: $ *
* -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2009 by Roland Haeder *
- * Copyright (c) 2009 - 2011 by Mailer Developer Team *
- * For more information visit: http://www.mxchange.org *
+ * Copyright (c) 2009 - 2012 by Mailer Developer Team *
+ * 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 *
@@ -42,11 +42,20 @@ if (!defined('__SECURITY')) {
// "Getter" for module description
// @TODO Can we cache this?
-function getTitleFromMenu ($mode, $what, $column = 'what', $ADD='') {
+function getTitleFromMenu ($mode, $what, $column = 'what', $ADD = '') {
+ // Debug message
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'mode=' . $mode . ',what=' . $what . ',column=' . $column . ',add=' . $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 == 'welcome') {
+ // Overview page
+ return '{--WHAT_IS_WELCOME--}';
+ }
// Default is not found
$data['title'] = '??? (' . $what . ')';
@@ -78,7 +87,7 @@ function addYouAreHereLink ($accessLevel, $FQFN, $return = false) {
$file = basename($FQFN);
// Init variables
- $LINK_ADD = '';
+ $linkAdd = '';
$OUT = '';
$ADD = '';
$prefix = '';
@@ -116,13 +125,11 @@ function addYouAreHereLink ($accessLevel, $FQFN, $return = false) {
$type = 'what';
$search = $file;
$modCheck = getModule();
- $ADD = '';
} else {
// Other
$type = 'menu';
$search = $file;
$modCheck = getModule();
- $ADD = '';
}
// Begin the navigation line
@@ -131,17 +138,19 @@ 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' => $linkAdd, 'content' => '', 'add' => $ADD));
// Add pre-content
$prefix = $ret['content'];
- $prefix .= '
{--YOU_ARE_HERE--}
Home';
+ // Add default content
+ $prefix .= '
{--YOU_ARE_HERE--}
Home';
} elseif ($return === false) {
// Count depth
$GLOBALS['nav_depth']++;
}
+ // Add arrow
$prefix .= ' -> ';
// We need to remove .php and the end
@@ -150,23 +159,27 @@ function addYouAreHereLink ($accessLevel, $FQFN, $return = false) {
$search = substr($search, 0, -4);
} // END - if
+ // Is ext-sql_patches installed?
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'isExtensionInstalledAndNewer()=' . intval(isExtensionInstalledAndNewer('sql_patches', '0.2.3')) . ',youre_here=' . getConfig('youre_here') . ',isAdmin()=' . intval(isAdmin()) . ',modCheck=' . $modCheck);
if (((isExtensionInstalledAndNewer('sql_patches', '0.2.3')) && (getConfig('youre_here') == 'Y')) || ((isAdmin()) && ($modCheck == 'admin'))) {
// Output HTML code
- $OUT = $prefix . '
' . getTitleFromMenu($accessLevel, $search, $type, $ADD) . '';
+ $OUT = $prefix . '
' . getTitleFromMenu($accessLevel, $search, $type, $ADD) . '';
// Can we close the you-are-here navigation?
- //* DEBUG: */ debugOutput(__LINE__.'*'.$type.'/'.getWhat().'*');
- if (($type == 'what') || (($type == 'action') && ((!isWhatSet()) || (getWhat() == 'overview')))) {
- //* DEBUG: */ debugOutput(__LINE__.'+'.$type.'+');
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'type=' . $type . ',getWhat()=' . getWhat() . ',accessLevel=' . $accessLevel . ',isWhatSet()=' . intval(isWhatSet()));
+ if (($type == 'what') || (($type == 'action') && ((!isWhatSet()) || (($accessLevel == 'admin') && (getWhat() == 'welcome'))))) {
+ //* 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' => $linkAdd, '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
@@ -184,7 +197,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)) {
@@ -192,13 +204,19 @@ 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
@@ -208,12 +226,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);
@@ -232,10 +250,13 @@ WHERE
`action`='%s' AND
`what` != '' AND
`what` IS NOT NULL
- ".$ADD."
+ " . $ADD . "
ORDER BY
`sort` ASC",
- array($mode, $content['action']), __FUNCTION__, __LINE__);
+ array(
+ $mode,
+ $content['action']
+ ), __FUNCTION__, __LINE__);
// Do we have some entries?
if (!SQL_HASZERONUMS($result_sub)) {
@@ -251,7 +272,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
@@ -259,11 +280,17 @@ ORDER BY
$OUT = '';
} // END - if
- // Navigation link
- $OUT .= '