'NO-ACL' is more clear that we don't have an ACL for the given admin than three aster...
[mailer.git] / inc / modules / admin / admin-inc.php
index f5a70264af536ecb155eccc65ca7de42dc8de978..e5427c7409fafb4d3f3ffc60e604b1ab59f31d10 100644 (file)
@@ -240,7 +240,7 @@ function isAdminAllowedAccessMenu ($action, $what = null) {
        if (!isset($GLOBALS[__FUNCTION__][$action][$what])) {
                // ACL is always 'allow' when no ext-admins is installed
                // @TODO This can be rewritten into a filter
-               $GLOBALS[__FUNCTION__][$action][$what] = ((!isExtensionInstalledAndNewer('admins', '0.2.0')) || (adminsCheckAdminAcl($action, $what)));
+               $GLOBALS[__FUNCTION__][$action][$what] = ((!isExtensionInstalledAndNewer('admins', '0.2.0')) || (isAdminsAllowedByAcl($action, $what)));
        } // END - if
 
        // Return the cached value
@@ -296,7 +296,7 @@ ORDER BY
                                                $OUT .= '[<a href="{%url=modules.php?module=admin&amp;action=' . $menu . '%}">';
                                        }
                                } else {
-                                       $OUT .= '<em style="cursor:help" class="notice" title="{%message,MENU_ACTION_404=' . $menu . '}">';
+                                       $OUT .= '<em style="cursor:help" class="notice" title="{%message,ADMIN_MENU_ACTION_404=' . $menu . '%}">';
                                }
 
                                $OUT .= $title;
@@ -334,7 +334,8 @@ ORDER BY
                                // Do we have entries?
                                if ((ifAdminMenuHasEntries($menu)) && (!SQL_HASZERONUMS($result_what))) {
                                        $GLOBALS['menu']['description'] = array();
-                                       $GLOBALS['menu']['title'] = array(); $SUB = true;
+                                       $GLOBALS['menu']['title'] = array();
+                                       $SUB = true;
                                        $OUT .= '<li class="admin_menu_sub"><ul class="admin_menu_sub">';
                                        // @TODO Rewrite this to $content = SQL_FETCHARRAY()
                                        while (list($what_sub, $title_what, $desc_what) = SQL_FETCHROW($result_what)) {
@@ -358,7 +359,7 @@ ORDER BY
                                                                        $OUT .= '[<a href="{%url=modules.php?module=admin&amp;what=' . $what_sub . '%}">';
                                                                }
                                                        } else {
-                                                               $OUT .= '<em style="cursor:help" class="notice" title="{%message,MENU_WHAT_404=' . $what_sub . '%}">';
+                                                               $OUT .= '<em style="cursor:help" class="notice" title="{%message,ADMIN_MENU_WHAT_404=' . $what_sub . '%}">';
                                                        }
 
                                                        $OUT .= $title_what;
@@ -489,7 +490,7 @@ function adminSaveSettings (&$postData, $tableName = '_config', $whereStatement
                // Process only formular field but not submit buttons ;)
                if ($id != 'ok') {
                        // Do not save the ok value
-                       convertSelectionsToTimestamp($postData, $tableData, $id, $skip);
+                       convertSelectionsToEpocheTime($postData, $tableData, $id, $skip);
 
                        // Shall we process this id? It muss not be empty, of course
                        if (($skip === false) && (!empty($id)) && ((!isset($GLOBALS['skip_config'][$id]))) || ($tableName != '_config')) {
@@ -576,7 +577,7 @@ function adminSaveSettings (&$postData, $tableName = '_config', $whereStatement
        rebuildCache('config', 'config');
 
        // Settings saved, so display message?
-       if ($displayMessage === true) loadTemplate('admin_settings_saved', false, '{--SETTINGS_SAVED--}');
+       if ($displayMessage === true) displayMessage('{--SETTINGS_SAVED--}');
 
        // Return affected rows
        return $affected;
@@ -638,7 +639,11 @@ function generateUserProfileLink ($userid, $title = '', $what = 'list_user') {
                $nick = getNickname($userid);
 
                // Is it not empty, use it as title else the userid
-               if (!empty($nick)) $title = $nick . '(' . $userid . ')'; else $title = $userid;
+               if (!empty($nick)) {
+                       $title = $nick . '(' . $userid . ')';
+               } else {
+                       $title = $userid;
+               }
        }
 
        // Return link
@@ -727,10 +732,10 @@ function adminChangeActivationStatus ($IDs, $table, $row, $idRow = 'id') {
                } // END - foreach
 
                // Output status
-               loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_STATUS_CHANGED'), $count, count($IDs)));
+               displayMessage(sprintf(getMessage('ADMIN_STATUS_CHANGED'), $count, count($IDs)));
        } else {
                // Nothing selected!
-               loadTemplate('admin_settings_saved', false, '{--ADMIN_NOTHING_SELECTED_CHANGE--}');
+               displayMessage('{--ADMIN_NOTHING_SELECTED_CHANGE--}');
        }
 }
 
@@ -961,10 +966,10 @@ function adminDeleteEntriesConfirm ($IDs, $table, $columns = array(), $filterFun
                        // Was this fine?
                        if (SQL_AFFECTEDROWS() == count($IDs)) {
                                // All deleted
-                               loadTemplate('admin_settings_saved', false, '{--ADMIN_ALL_ENTRIES_REMOVED--}');
+                               displayMessage('{--ADMIN_ALL_ENTRIES_REMOVED--}');
                        } else {
                                // Some are still there :(
-                               loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_SOME_ENTRIES_NOT_DELETED'), SQL_AFFECTEDROWS(), count($IDs)));
+                               displayMessage(sprintf(getMessage('ADMIN_SOME_ENTRIES_NOT_DELETED'), SQL_AFFECTEDROWS(), count($IDs)));
                        }
                } else {
                        // List for deletion confirmation
@@ -1050,10 +1055,10 @@ function adminEditEntriesConfirm ($IDs, $table, $columns = array(), $filterFunct
                        // Was this fine?
                        if ($affected == count($IDs)) {
                                // All deleted
-                               loadTemplate('admin_settings_saved', false, '{--ADMIN_ALL_ENTRIES_EDITED--}');
+                               displayMessage('{--ADMIN_ALL_ENTRIES_EDITED--}');
                        } else {
                                // Some are still there :(
-                               loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_SOME_ENTRIES_NOT_EDITED'), $affected, count($IDs)));
+                               displayMessage(sprintf(getMessage('ADMIN_SOME_ENTRIES_NOT_EDITED'), $affected, count($IDs)));
                        }
                } else {
                        // List for editing
@@ -1352,7 +1357,7 @@ function doVerifyExpertSettings () {
        // Output message for other status than ask/agreed
        if (($return != 'ask') && ($return != 'agreed')) {
                // Output message
-               loadTemplate('admin_settings_saved', false, '{--ADMIN_EXPERT_SETTINGS_STATUS_' . strtoupper($return) . '--}');
+               displayMessage('{--ADMIN_EXPERT_SETTINGS_STATUS_' . strtoupper($return) . '--}');
        } // END - if
 
        // Return status
@@ -1484,17 +1489,17 @@ function adminProcessMenuEditForm ($type, $subMenu) {
 
                        default: // Unexpected action
                                logDebugMessage(__FILE__, __LINE__, sprintf("Unsupported action %s detected.", postRequestParameter('ok')));
-                               loadTemplate('admin_settings_saved', false, getMaskedMessage('ADMIN_UNKNOWN_OKAY', postRequestParameter('ok')));
+                               displayMessage(getMaskedMessage('ADMIN_UNKNOWN_OKAY', postRequestParameter('ok')));
                                break;
                } // END - switch
        } // END - foreach
 
        // Load template
-       loadTemplate('admin_settings_saved', false, '{--SETTINGS_SAVED--}');
+       displayMessage('{--SETTINGS_SAVED--}');
 }
 
 // Handle weightning
-function doAdminProcessMenuWeightning ($type) {
+function doAdminProcessMenuWeightning ($type, $AND) {
        // Are there all required (generalized) GET parameter?
        if ((isGetRequestParameterSet('act')) && (isGetRequestParameterSet('tid')) && (isGetRequestParameterSet('fid'))) {
                // Init variables