]> git.mxchange.org Git - mailer.git/blobdiff - inc/mysql-manager.php
fooRequestElementBar() functions renamed, adding of request parameters added:
[mailer.git] / inc / mysql-manager.php
index b8f7fed89dcadc6667875e66a236c4b425cc6324..96785ed9d3b7b746b68c3822398bfd1e27ea0204 100644 (file)
@@ -768,7 +768,7 @@ function addMaxReceiveList ($mode, $default = '', $return = false) {
                $OUT = '';
                while ($content = SQL_FETCHARRAY($result)) {
                        $OUT .= '      <option value="' . $content['value'] . '"';
-                       if (postRequestElement('max_mails') == $content['value']) $OUT .= ' selected="selected"';
+                       if (postRequestParameter('max_mails') == $content['value']) $OUT .= ' selected="selected"';
                        $OUT .= '>' . $content['value'] . ' {--PER_DAY--}';
                        if (!empty($content['comment'])) $OUT .= '(' . $content['comment'] . ')';
                        $OUT .= '</option>';
@@ -889,9 +889,9 @@ function getModeAction ($mode, $what) {
 
        if ($mode == 'admin') {
                // Action value for admin area
-               if (isGetRequestElementSet('action')) {
+               if (isGetRequestParameterSet('action')) {
                        // Use from request!
-                       return getRequestElement('action');
+                       return getRequestParameter('action');
                } elseif (isActionSet()) {
                        // Get it directly from URL
                        return getAction();
@@ -1253,7 +1253,7 @@ function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify
 
                                // And sent it away
                                sendEmail($userid, getMessage('SUBJECT_DIRECT_PAYMENT'), $message);
-                               if (!isGetRequestElementSet('mid')) loadTemplate('admin_settings_saved', false, getMessage('ADMIN_POINTS_ADDED'));
+                               if (!isGetRequestParameterSet('mid')) loadTemplate('admin_settings_saved', false, getMessage('ADMIN_POINTS_ADDED'));
                        }
 
                        // Maybe there's another ref?
@@ -1519,7 +1519,7 @@ function getAdminDefaultAcl ($adminId) {
 }
 
 // Generates an option list from various parameters
-function generateOptionList ($table, $id, $name, $default='', $special='', $where='') {
+function generateOptionList ($table, $id, $name, $default='', $special='', $where='', $disabled=array()) {
        $ret = '';
        if ($table == '/ARRAY/') {
                // Selection from array
@@ -1527,7 +1527,13 @@ function generateOptionList ($table, $id, $name, $default='', $special='', $wher
                        // Both are arrays
                        foreach ($id as $idx => $value) {
                                $ret .= '<option value="' . $value . '"';
-                               if ($default == $value) $ret .= ' selected="selected"';
+                               if ($default == $value) {
+                                       // Selected by default
+                                       $ret .= ' selected="selected"';
+                               } elseif (isset($disabled[$value])) {
+                                       // Disabled!
+                                       $ret .= ' disabled="disabled"';
+                               }
                                $ret .= '>' . $name[$idx] . '</option>';
                        } // END - foreach
                } else {
@@ -1555,7 +1561,13 @@ function generateOptionList ($table, $id, $name, $default='', $special='', $wher
                        while (list($value, $title, $add) = SQL_FETCHROW($result)) {
                                if (empty($special)) $add = '';
                                $ret .= '<option value="' . $value . '"';
-                               if ($default == $value) $ret .= ' selected="selected"';
+                               if ($default == $value) {
+                                       // Selected by default
+                                       $ret .= ' selected="selected"';
+                               } elseif (isset($disabled[$value])) {
+                                       // Disabled!
+                                       $ret .= ' disabled="disabled"';
+                               }
                                if (!empty($add)) $add = ' ('.$add.')';
                                $ret .= '>' . $title . $add . '</option>';
                        } // END - while
@@ -1679,9 +1691,9 @@ function generateMetaDescriptionCode ($module, $what) {
 // Gets the matching what name from module
 function getWhatFromModule ($modCheck) {
        // Is the request element set?
-       if (isGetRequestElementSet('what')) {
+       if (isGetRequestParameterSet('what')) {
                // Then return this!
-               return getRequestElement('what');
+               return getRequestParameter('what');
        } // END - if
 
        // Default is empty
@@ -1944,7 +1956,7 @@ function generateReceiverList ($cat, $receiver, $mode = '') {
 }
 
 // Get timestamp for given stats type and data
-function getTimestampFromUserStats ($type, $data, $userid = '0') {
+function getTimestampFromUserStats ($statsType, $statsData, $userid = '0') {
        // Default timestamp is zero
        $data['inserted'] = '0';
 
@@ -1971,8 +1983,8 @@ WHERE
 LIMIT 1",
                array(
                        bigintval($userid),
-                       $type,
-                       $data
+                       $statsType,
+                       $statsData
                ), __FUNCTION__, __LINE__);
 
        // Is the entry there?
@@ -1989,7 +2001,7 @@ LIMIT 1",
 }
 
 // Inserts user stats
-function insertUserStatsRecord ($userid, $type, $data) {
+function insertUserStatsRecord ($userid, $statsType, $statsData) {
        // Is the extension installed and updated?
        if ((!isExtensionActive('sql_patches')) || (isExtensionOlder('sql_patches', '0.5.6'))) {
                // Return zero here
@@ -1997,13 +2009,13 @@ function insertUserStatsRecord ($userid, $type, $data) {
        } // END - if
 
        // Does it exist?
-       if ((!getTimestampFromUserStats($type, $data, $userid)) && (!is_array($data))) {
+       if ((!getTimestampFromUserStats($statsType, $statsData, $userid)) && (!is_array($statsData))) {
                // Then insert it!
                SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_stats_data` (`userid`,`stats_type`,`stats_data`) VALUES (%s,'%s','%s')",
-                       array(bigintval($userid), $type, $data), __FUNCTION__, __LINE__);
-       } elseif (is_array($data)) {
+                       array(bigintval($userid), $statsType, $statsData), __FUNCTION__, __LINE__);
+       } elseif (is_array($statsData)) {
                // Invalid data!
-               logDebugMessage(__FUNCTION__, __LINE__, "userid={$userid},type={$type},data={".gettype($data).": Invalid statistics data type!");
+               logDebugMessage(__FUNCTION__, __LINE__, "userid={$userid},type={$statsType},data={".gettype($statsData).": Invalid statistics data type!");
        }
 }