]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/admin-inc.php
Deprecated variables for templates removed, mor EL-rewrites, getMessage() rewritten:
[mailer.git] / inc / modules / admin / admin-inc.php
index 402b3ed7d7adb31ed149e1496ef69c1be2e350ca..d2fc10212b45644a9228404d5c667f41ff76c273 100644 (file)
@@ -124,7 +124,7 @@ function ifAdminCookiesAreValid ($adminLogin, $passHash) {
        if ($adminHash != '-1') {
                // Now, we need to encode the password in the same way the one is encoded in database
                $testHash = encodeHashForCookie($adminHash);
-               //* DEBUG: */ outputHtml('adminLogin='.$adminLogin.',<br />passHash='.$passHash.',<br />adminHash='.$adminHash.',<br />testHash='.$testHash.'<br />');
+               //* DEBUG: */ debugOutput('adminLogin=' . $adminLogin . ',passHash='.$passHash.',adminHash='.$adminHash.',testHash='.$testHash);
 
                // If they both match, the login data is valid
                if ($testHash == $passHash) {
@@ -137,7 +137,7 @@ function ifAdminCookiesAreValid ($adminLogin, $passHash) {
        } // END - if
 
        // Return status
-       //* DEBUG: */ outputHtml('ret='.$ret);
+       //* DEBUG: */ debugOutput('ret='.$ret);
        return $ret;
 }
 
@@ -146,7 +146,7 @@ function doAdminAction () {
        // Get default what
        $what = getWhat();
 
-       //* DEBUG: */ outputHtml(__LINE__.'*'.$what.'/'.getModule().'/'.getAction().'/'.getWhat().'*<br />');
+       //* DEBUG: */ debugOutput(__LINE__.'*'.$what.'/'.getModule().'/'.getAction().'/'.getWhat().'*');
 
        // Remove any spaces from variable
        if (empty($what)) {
@@ -570,7 +570,7 @@ function adminSaveSettings (&$postData, $tableName = '_config', $whereStatement
        rebuildCache('config', 'config');
 
        // Settings saved, so display message?
-       if ($displayMessage === true) loadTemplate('admin_settings_saved', false, getMessage('SETTINGS_SAVED'));
+       if ($displayMessage === true) loadTemplate('admin_settings_saved', false, '{--SETTINGS_SAVED--}');
 
        // Return affected rows
        return $affected;
@@ -715,7 +715,7 @@ function adminChangeActivationStatus ($IDs, $table, $row, $idRow = 'id') {
                loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_STATUS_CHANGED'), $cnt, count($IDs)));
        } else {
                // Nothing selected!
-               loadTemplate('admin_settings_saved', false, getMessage('ADMIN_NOTHING_SELECTED_CHANGE'));
+               loadTemplate('admin_settings_saved', false, '{--ADMIN_NOTHING_SELECTED_CHANGE--}');
        }
 }
 
@@ -787,14 +787,14 @@ function adminListBuilder ($listType, $IDs, $table, $columns, $filterFunctions,
                                } // END - if
 
                                // If the key matches the idColumn variable, we need to temporary remember it
-                               //* DEBUG: */ print 'key=' . $key . ',idColumn=' . $idColumn . ',value=' . $value . '<br />';
+                               //* DEBUG: */ debugOutput('key=' . $key . ',idColumn=' . $idColumn . ',value=' . $value);
                                if ($key == $idColumn) {
                                        // Found, so remember it
                                        $GLOBALS['admin_list_builder_id_value'] = $value;
                                } // END - if
 
                                // Handle the call in external function
-                               //* DEBUG: */ print 'key=' . $key . ',fucntion=' . $filterFunctions[$idx] . ',value=' . $value . '<br />';
+                               //* DEBUG: */ debugOutput('key=' . $key . ',fucntion=' . $filterFunctions[$idx] . ',value=' . $value);
                                $content[$key] = handleExtraValues($filterFunctions[$idx], $value, $extraValues[$idx]);
                        } // END - foreach
 
@@ -955,7 +955,7 @@ function adminDeleteEntriesConfirm ($IDs, $table, $columns = array(), $filterFun
                        // Was this fine?
                        if (SQL_AFFECTEDROWS() == count($IDs)) {
                                // All deleted
-                               loadTemplate('admin_settings_saved', false, getMessage('ADMIN_ALL_ENTRIES_REMOVED'));
+                               loadTemplate('admin_settings_saved', false, '{--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)));
@@ -1044,7 +1044,7 @@ function adminEditEntriesConfirm ($IDs, $table, $columns = array(), $filterFunct
                        // Was this fine?
                        if ($affected == count($IDs)) {
                                // All deleted
-                               loadTemplate('admin_settings_saved', false, getMessage('ADMIN_ALL_ENTRIES_EDITED'));
+                               loadTemplate('admin_settings_saved', false, '{--ADMIN_ALL_ENTRIES_EDITED--}');
                        } else {
                                // Some are still there :(
                                loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_SOME_ENTRIES_NOT_EDITED'), $affected, count($IDs)));
@@ -1346,7 +1346,7 @@ function doVerifyExpertSettings () {
        // Output message for other status than ask/agreed
        if (($return != 'ask') && ($return != 'agreed')) {
                // Output message
-               loadTemplate('admin_settings_saved', false, getMessage('ADMIN_EXPERT_SETTINGS_STATUS_' . strtoupper($return)));
+               loadTemplate('admin_settings_saved', false, '{--ADMIN_EXPERT_SETTINGS_STATUS_' . strtoupper($return) . '--}');
        } // END - if
 
        // Return status
@@ -1368,5 +1368,67 @@ function generateUnconfirmedAdminLink ($id, $unconfirmed, $type = 'bid') {
        return $OUT;
 }
 
+// Generates a navigation row for listing emails
+function addEmailNavigation ($numPages, $offset, $show_form, $colspan, $return=false) {
+       // Don't do anything if $numPages is 1
+       if ($numPages == 1) {
+               // Abort here with empty content
+               return '';
+       } // END - if
+
+       $TOP = '';
+       if ($show_form === false) {
+               $TOP = ' top';
+       } // END - if
+
+       $NAV = '';
+       for ($page = 1; $page <= $numPages; $page++) {
+               // Is the page currently selected or shall we generate a link to it?
+               if (($page == getRequestParameter('page')) || ((!isGetRequestParameterSet('page')) && ($page == 1))) {
+                       // Is currently selected, so only highlight it
+                       $NAV .= '<strong>-';
+               } else {
+                       // Open anchor tag and add base URL
+                       $NAV .= '<a href="{%url=modules.php?module=admin&amp;what=' . getWhat() . '&amp;page=' . $page . '&amp;offset=' . $offset;
+
+                       // Add userid when we shall show all mails from a single member
+                       if ((isGetRequestParameterSet('userid')) && (bigintval(getRequestParameter('userid')) > 0)) $NAV .= '&amp;userid=' . bigintval(getRequestParameter('userid'));
+
+                       // Close open anchor tag
+                       $NAV .= '%}">';
+               }
+               $NAV .= $page;
+               if (($page == getRequestParameter('page')) || ((!isGetRequestParameterSet('page')) && ($page == 1))) {
+                       // Is currently selected, so only highlight it
+                       $NAV .= '-</strong>';
+               } else {
+                       // Close anchor tag
+                       $NAV .= '</a>';
+               }
+
+               // Add seperator if we have not yet reached total pages
+               if ($page < $numPages) {
+                       // Add it
+                       $NAV .= '|';
+               } // END - if
+       } // END - for
+
+       // Define constants only once
+       $content['nav']  = $NAV;
+       $content['span'] = $colspan;
+       $content['top']  = $TOP;
+
+       // Load navigation template
+       $OUT = loadTemplate('admin_email_nav_row', true, $content);
+
+       if ($return === true) {
+               // Return generated HTML-Code
+               return $OUT;
+       } else {
+               // Output HTML-Code
+               outputHtml($OUT);
+       }
+}
+
 // [EOF]
 ?>