Bad things are now 'classified' as bad (CSS class 'bad' is being used instead of...
[mailer.git] / inc / mysql-manager.php
index 8a8e3107097c2312264d057065bb92556227670c..13b29b526495e831423a17e37a21d864ed2ad7ec 100644 (file)
@@ -279,7 +279,7 @@ ORDER BY
                                                }
                                        } else {
                                                // Not found - open
-                                               $OUT .= '<em style="cursor:help" class="notice" title="{%message,ADMIN_MENU_WHAT_404_TITLE=' . $content['sub_what'] . '%}">';
+                                               $OUT .= '<div style="cursor:help" class="bad" title="{%message,ADMIN_MENU_WHAT_404_TITLE=' . $content['sub_what'] . '%}">';
                                        }
 
                                        // Menu title
@@ -294,7 +294,7 @@ ORDER BY
                                                } // END - if
                                        } else {
                                                // Not found - close
-                                               $OUT .= '</em>';
+                                               $OUT .= '</div>';
                                        }
 
                                        // Cunt it up
@@ -340,16 +340,16 @@ ORDER BY
 
                        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'main_cnt=' . $main_cnt . ',getWhat()=' . getWhat());
                        if (SQL_NUMROWS($result_main) > $main_cnt) {
-                               // Add seperator
-                               $GLOBALS['rows'] .= loadTemplate('menu_seperator', true, $mode);
+                               // Add separator
+                               $GLOBALS['rows'] .= loadTemplate('menu_separator', true, $mode);
 
                                // Should we display adverts in this menu?
                                if ((isExtensionInstalledAndNewer('menu', '0.0.1')) && (getConfig($mode . '_menu_advert_enabled') == 'Y') && ($action != 'admin')) {
                                        // Display advert template
                                        $GLOBALS['rows'] .= loadTemplate('menu_' . $mode . '_advert_' . $action, true);
 
-                                       // Add seperator again
-                                       $GLOBALS['rows'] .= loadTemplate('menu_seperator', true, $mode);
+                                       // Add separator again
+                                       $GLOBALS['rows'] .= loadTemplate('menu_separator', true, $mode);
                                } // END - if
                        } // END - if
                } // END - while
@@ -359,8 +359,8 @@ ORDER BY
 
                // Should we display adverts in this menu?
                if ((isExtensionInstalledAndNewer('menu', '0.0.1')) && (getConfig($mode . '_menu_advert_enabled') == 'Y')) {
-                       // Add seperator again
-                       $GLOBALS['rows'] .= loadTemplate('menu_seperator', true, $mode);
+                       // Add separator again
+                       $GLOBALS['rows'] .= loadTemplate('menu_separator', true, $mode);
 
                        // Display advert template
                        $GLOBALS['rows'] .= loadTemplate('menu_' . $mode . '_advert_end', true);
@@ -959,14 +959,14 @@ function countSumTotalData ($search, $tableName, $lookFor = 'id', $whereStatemen
                // Count or sum whole table?
                if ($countRows === true) {
                        // Count whole table
-                       $result = SQL_QUERY_ESC("SELECT COUNT(`%s`) AS `res` FROM `{?_MYSQL_PREFIX?}_%s`".$add,
+                       $result = SQL_QUERY_ESC("SELECT COUNT(`%s`) AS `res` FROM `{?_MYSQL_PREFIX?}_%s`" . $add . ' LIMIT 1',
                                array(
                                        $lookFor,
                                        $tableName
                                ), __FUNCTION__, __LINE__);
                } else {
                        // Sum whole table
-                       $result = SQL_QUERY_ESC("SELECT SUM(`%s`) AS `res` FROM `{?_MYSQL_PREFIX?}_%s`".$add,
+                       $result = SQL_QUERY_ESC("SELECT SUM(`%s`) AS `res` FROM `{?_MYSQL_PREFIX?}_%s`" . $add . ' LIMIT 1',
                                array(
                                        $lookFor,
                                        $tableName
@@ -975,7 +975,7 @@ function countSumTotalData ($search, $tableName, $lookFor = 'id', $whereStatemen
        } elseif (($countRows === true) || ($lookFor == 'userid')) {
                // Count rows
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'COUNT!');
-               $result = SQL_QUERY_ESC("SELECT COUNT(`%s`) AS `res` FROM `{?_MYSQL_PREFIX?}_%s` WHERE `%s`%s'%s'".$add,
+               $result = SQL_QUERY_ESC("SELECT COUNT(`%s`) AS `res` FROM `{?_MYSQL_PREFIX?}_%s` WHERE `%s`%s'%s'" . $add . ' LIMIT 1',
                        array(
                                $lookFor,
                                $tableName,
@@ -986,7 +986,7 @@ function countSumTotalData ($search, $tableName, $lookFor = 'id', $whereStatemen
        } else {
                // Add all rows
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'SUM!');
-               $result = SQL_QUERY_ESC("SELECT SUM(`%s`) AS `res` FROM `{?_MYSQL_PREFIX?}_%s` WHERE `%s`%s'%s'".$add,
+               $result = SQL_QUERY_ESC("SELECT SUM(`%s`) AS `res` FROM `{?_MYSQL_PREFIX?}_%s` WHERE `%s`%s'%s'" . $add . ' LIMIT 1',
                        array(
                                $lookFor,
                                $tableName,
@@ -1292,9 +1292,9 @@ function generateOptionList ($table, $id, $name, $default = '', $special = '', $
                }
        } else {
                // Data from database
-               $SPEC = ', `' . $id . '`';
+               $SPEC = ',`' . $id . '`';
                if (!empty($special)) {
-                       $SPEC = ', `' . $special . '` AS `special`';
+                       $SPEC = ',`' . $special . '` AS `special`';
                } // END - if
 
                // Query the database
@@ -1513,7 +1513,7 @@ function generateCategoryOptionsList ($mode) {
                } // END - foreach
        } else {
                // No cateogries are defined yet
-               $OUT = '<option class="notice">{--MEMBER_NO_CATEGORIES--}</option>';
+               $OUT = '<option class="bad">{--MEMBER_NO_CATEGORIES--}</option>';
        }
 
        // Return HTML code
@@ -1691,12 +1691,12 @@ function reduceRecipientReceivedMails ($column, $id, $count) {
 }
 
 // Creates a new task
-function createNewTask ($subject, $notes, $taskType, $userid = NULL, $adminId = '0', $strip = true) {
+function createNewTask ($subject, $notes, $taskType, $userid = NULL, $adminId = NULL, $strip = true) {
        // Insert the task data into the database
        SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_task_system` (`assigned_admin`,`userid`,`status`,`task_type`,`subject`,`text`,`task_created`) VALUES (%s,%s,'NEW','%s','%s','%s', UNIX_TIMESTAMP())",
                array(
-                       $adminId,
-                       $userid,
+                       makeZeroToNull($adminId),
+                       makeZeroToNull($userid),
                        $taskType,
                        $subject,
                        $notes