]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/admin-inc.php
Complete rewrite of and , wrapper functions added, see bug #101
[mailer.git] / inc / modules / admin / admin-inc.php
index ea677c8fdbc60bf4d1e2b7f9535623cb94ba6833..c960342106898a38e4290a52e95799afdc622f6d 100644 (file)
@@ -204,7 +204,7 @@ function LOGIN_ADMIN ($adminLogin, $passHash) {
                ) && (
                        set_session('admin_last', time())
                ) && (
-                       set_session('admin_to', bigintval($_POST['timeout']))
+                       set_session('admin_to', bigintval(REQUEST_POST('timeout')))
                )
        );
 }
@@ -536,15 +536,24 @@ function ADMIN_MENU_SELECTION($MODE, $default="", $defid="") {
                $OUT .= "</select>\n";
        } else {
                // No menus???
-               $OUT = ADMIN_PROBLEM_NO_MENU;
+               $OUT = getMessage('ADMIN_PROBLEM_NO_MENU');
        }
 
        // Return output
        return $OUT;
 }
 
+// Wrapper for $_POST and ADMIN_SAVE_SETTINGS
+function ADMIN_SAVE_SETTINGS_POST () {
+       // Get the array
+       $POST = REQUEST_POST_ARRAY();
+
+       // Call the lower function
+       ADMIN_SAVE_SETTINGS($POST);
+}
+
 // Save settings to the database
-function ADMIN_SAVE_SETTINGS (&$POST, $tableName="_config", $whereStatement="config=0", $translateComma=array(), $alwaysAdd=false) {
+function ADMIN_SAVE_SETTINGS (&$POST, $tableName = "_config", $whereStatement = "config=0", $translateComma = array(), $alwaysAdd = false) {
        // Prepare all arrays, variables
        $DATA = array();
        $skip = false;
@@ -643,7 +652,7 @@ function ADMIN_MAKE_MENU_SELECTION ($menu, $type, $name, $default="") {
        $handle = opendir(sprintf("%sinc/modules/%s/", constant('PATH'), $menu)) or mxchange_die("Cannot load menu ".$menu."!");
 
        // Init the selection box
-       $OUT = "<select name=\"".$name."\" class=\"admin_select\" size=\"1\">\n <option value=\"\">".IS_TOP_MENU."</option>\n";
+       $OUT = "<select name=\"".$name."\" class=\"admin_select\" size=\"1\">\n <option value=\"\">{--IS_TOP_MENU--}</option>\n";
 
        // Walk through all files
        while ($file = readdir($handle)) {
@@ -689,7 +698,7 @@ function ADMIN_USER_PROFILE_LINK ($uid, $title="", $wht="list_user") {
 
        //* DEBUG: */ echo "a:".$title."<br />";
        // Return link
-       return "<a href=\"{!URL!}/modules.php?module=admin&amp;what=".$wht."&amp;u_id=".$uid."\" title=\"{--ADMIN_USER_PROFILE_TITLE--}\">".$title."</a>";
+       return "<a href=\"{!URL!}/modules.php?module=admin&amp;what=".$wht."&amp;uid=".$uid."\" title=\"{--ADMIN_USER_PROFILE_TITLE--}\">".$title."</a>";
 }
 
 // Check "logical-area-mode"
@@ -782,7 +791,7 @@ function ADMIN_SEND_BUILD_MAILS ($mode, $table, $content, $id, $subjectPart="")
        } // END - if
 
        // Is the raw userid set?
-       if ($_POST['uid_raw'][$id] > 0) {
+       if (REQUEST_POST('uid_raw', $id) > 0) {
                // Generate subject
                $subjectLine = constant('MEMBER_'.strtoupper($subject).'_'.strtoupper($table).'_SUBJECT');
 
@@ -794,7 +803,7 @@ function ADMIN_SEND_BUILD_MAILS ($mode, $table, $content, $id, $subjectPart="")
                }
 
                // Send email out
-               SEND_EMAIL($_POST['uid_raw'][$id], $subjectLine, $mail);
+               SEND_EMAIL(REQUEST_POST('uid_raw', $id), $subjectLine, $mail);
        } // END - if
 
        // Generate subject
@@ -802,9 +811,9 @@ function ADMIN_SEND_BUILD_MAILS ($mode, $table, $content, $id, $subjectPart="")
 
        // Send admin notification out
        if (!empty($subjectPart)) {
-               SEND_ADMIN_NOTIFICATION($subjectLine, "admin_".$mode."_".strtolower($subjectPart)."_".$table, $content, $_POST['uid_raw'][$id]);
+               SEND_ADMIN_NOTIFICATION($subjectLine, "admin_".$mode."_".strtolower($subjectPart)."_".$table, $content, REQUEST_POST('uid_raw', $id));
        } else {
-               SEND_ADMIN_NOTIFICATION($subjectLine, "admin_".$mode."_".$table, $content, $_POST['uid_raw'][$id]);
+               SEND_ADMIN_NOTIFICATION($subjectLine, "admin_".$mode."_".$table, $content, REQUEST_POST('uid_raw', $id));
        }
 }
 
@@ -911,7 +920,7 @@ function ADMIN_BUILD_STATUS_HANDLER ($mode, $IDs, $table, $columns, $filterFunct
                        } // END - foreach
 
                        // Add other columns as well
-                       foreach ($_POST as $key => $entries) {
+                       foreach (REQUEST_POST_ARRAY() as $key => $entries) {
                                // Skip id, raw userid and 'do_$mode'
                                if (!in_array($key, array($idColumn, 'uid_raw', ('do_'.$mode)))) {
                                        // Are there brackets () at the end?
@@ -964,7 +973,7 @@ function ADMIN_DELETE_ENTRIES_CONFIRM ($IDs, $table, $columns=array(), $filterFu
                        $idList = "";
                        foreach ($IDs as $id => $sel) {
                                // Is there a userid?
-                               if (isset($_POST['uid_raw'][$id])) {
+                               if (REQUEST_ISSET_POST(('uid_raw', $id))) {
                                        // Load all data from that id
                                        $result = SQL_QUERY_ESC("SELECT * FROM `{!_MYSQL_PREFIX!}_%s` WHERE %s=%s LIMIT 1",
                                                array($table, $idColumn, $id), __FILE__, __LINE__);
@@ -1017,7 +1026,7 @@ function ADMIN_EDIT_ENTRIES_CONFIRM ($IDs, $table, $columns=array(), $filterFunc
                                $SQL = sprintf("UPDATE `{!_MYSQL_PREFIX!}_ SET",
                                        SQL_ESCAPE($table)
                                );
-                               foreach ($_POST as $key => $entries) {
+                               foreach (REQUEST_POST_ARRAY() as $key => $entries) {
                                        // Skip raw userid which is always invalid
                                        if ($key == "uid_raw") {
                                                // Continue with next field