X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmysql-manager.php;h=c019248ea03d23b3979f8d096028ef7fb5d29803;hb=4001187f22197f55e5a1f211fc8defcc180f7c32;hp=0f5051ae0ce704c8a693c3a072f81f766d8dc293;hpb=e3701377bd1dcae6ac39265f8c1bdd8d0fed7911;p=mailer.git
diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php
index 0f5051ae0c..c019248ea0 100644
--- a/inc/mysql-manager.php
+++ b/inc/mysql-manager.php
@@ -312,7 +312,7 @@ function ADD_DESCR ($ACC_LVL, $FQFN, $return = false, $output = true) {
list($ret) = SQL_FETCHROW($result);
// Shall we return it?
- if ($return) {
+ if ($return === true) {
// Return title
return $ret;
} elseif (((GET_EXT_VERSION("sql_patches") >= "0.2.3") && (getConfig('youre_here') == "Y")) || ((IS_ADMIN()) && ($modCheck == "admin"))) {
@@ -363,7 +363,7 @@ function ADD_MENU ($MODE, $act, $wht) {
// Non-admin shall not see all menus
if (!IS_ADMIN()) {
$AND = " AND `visible`='Y' AND `locked`='N'";
- }
+ } // END - if
// Load SQL data and add the menu to the output stream...
$result_main = SQL_QUERY_ESC("SELECT title, action FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE (what='' OR `what` IS NULL)".$AND." ORDER BY `sort`",
@@ -372,60 +372,69 @@ function ADD_MENU ($MODE, $act, $wht) {
if (SQL_NUMROWS($result_main) > 0) {
OUTPUT_HTML("
");
}
}
@@ -529,53 +540,49 @@ function IS_ADMIN ($admin="") {
// Generates a list of "max receiveable emails per day"
function ADD_MAX_RECEIVE_LIST ($MODE, $default = "", $return = false) {
$OUT = "";
+ $result = false;
+
switch ($MODE) {
- case "guest":
- // Guests (in the registration form) are not allowed to select 0 mails per day.
- $result = SQL_QUERY("SELECT value, comment FROM `{!_MYSQL_PREFIX!}_max_receive` WHERE value > 0 ORDER BY value", __FUNCTION__, __LINE__);
- if (SQL_NUMROWS($result) > 0) {
- $OUT = "";
- while (list($value, $comment) = SQL_FETCHROW($result)) {
- $OUT .= " \n";
+ $ret = "\n";
}
}
// Return - hopefully - the requested data
return $ret;
}
-// Activate exchange (DEPERECATED???)
-function activateExchange() {
+// Activate exchange
+function activateExchange () {
// Check total amount of users
$totalUsers = GET_TOTAL_DATA("CONFIRMED", "user_data", "userid", "status", true, " AND max_mails > 0");
@@ -1798,21 +1807,24 @@ function ADD_CATEGORY_OPTIONS ($mode) {
$result = SQL_QUERY("SELECT id, cat FROM `{!_MYSQL_PREFIX!}_cats`".$whereStatement." ORDER BY `sort`", __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) > 0) {
// ... and begin loading stuff
- while (list($id, $cat) = SQL_FETCHROW($result)) {
+ while ($content = SQL_FETCHARRAY($result)) {
// Transfer some data
- $CATS['id'][] = $id;
- $CATS['name'][] = $cat;
+ $CATS['id'][] = $content['id'];
+ $CATS['name'][] = $content['cat'];
// Check which users are in this category
$result_uids = SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_cats` WHERE cat_id=%s",
- array(bigintval($id)), __FUNCTION__, __LINE__);
+ array(bigintval($content['id'])), __FUNCTION__, __LINE__);
// Start adding all
$uid_cnt = 0;
+ // @TODO Rewrite this to $content = SQL_FETCHARRAY()
while (list($ucat) = SQL_FETCHROW($result_uids)) {
$result_ver = SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data`
WHERE userid=%s AND `status`='CONFIRMED' AND receive_mails > 0".PREPARE_SQL_HTML_HOLIDAY($mode)." LIMIT 1",
- array(bigintval($ucat)), __FUNCTION__, __LINE__);
+ array(bigintval($ucat)), __FUNCTION__, __LINE__);
+
+ // Add user count
$uid_cnt += SQL_NUMROWS($result_ver);
// Free memory
@@ -1824,7 +1836,7 @@ WHERE userid=%s AND `status`='CONFIRMED' AND receive_mails > 0".PREPARE_SQL_HTML
// Add counter
$CATS['uids'][] = $uid_cnt;
- }
+ } // END - while
// Free memory
SQL_FREERESULT($result);
@@ -1833,8 +1845,8 @@ WHERE userid=%s AND `status`='CONFIRMED' AND receive_mails > 0".PREPARE_SQL_HTML
$OUT = "";
foreach ($CATS['id'] as $key => $value) {
if (strlen($CATS['name'][$key]) > 20) $CATS['name'][$key] = substr($CATS['name'][$key], 0, 17)."...";
- $OUT .= " \n";
- }
+ $OUT .= " \n";
+ } // END - foreach
} else {
// No cateogries are defined yet
$OUT = "\n";
@@ -1913,6 +1925,7 @@ function GENERATE_RECEIVER_LIST ($cat, $receiver, $mode="") {
$CAT_TABS = "%s";
$CAT_WHERE = "";
$receiverList = "";
+ $result = false;
// Secure data
$cat = bigintval($cat);
@@ -1940,19 +1953,19 @@ function GENERATE_RECEIVER_LIST ($cat, $receiver, $mode="") {
if ((EXT_IS_ACTIVE("html_mail")) && ($mode == "html")) {
// Only include HTML receivers
$result = SQL_QUERY_ESC("SELECT d.userid FROM `{!_MYSQL_PREFIX!}_user_data` AS d ".$CAT_TABS." WHERE d.`status`='CONFIRMED' AND d.html='Y'".$CAT_WHERE." ORDER BY d.%s %s LIMIT %s",
- array($cat, getConfig('order_select'), getConfig('order_mode'), $receiver), __FUNCTION__, __LINE__);
+ array($cat, getConfig('order_select'), getConfig('order_mode'), $receiver), __FUNCTION__, __LINE__);
} else {
// Include all
$result = SQL_QUERY_ESC("SELECT d.userid FROM `{!_MYSQL_PREFIX!}_user_data` AS d ".$CAT_TABS." WHERE d.`status`='CONFIRMED'".$CAT_WHERE." ORDER BY d.%s %s LIMIT %s",
- array($cat, getConfig('order_select'), getConfig('order_mode'), $receiver), __FUNCTION__, __LINE__);
+ array($cat, getConfig('order_select'), getConfig('order_mode'), $receiver), __FUNCTION__, __LINE__);
}
// Entries found?
if ((SQL_NUMROWS($result) >= $receiver) && ($receiver > 0)) {
// Load all entries
- while (list($REC) = SQL_FETCHROW($result)) {
+ while ($content = SQL_FETCHARRAY($result)) {
// Add receiver when not empty
- if (!empty($REC)) $receiverList .= $REC.";";
+ if (!empty($content['userid'])) $receiverList .= $content['userid'].";";
} // END - while
// Free memory
@@ -2099,6 +2112,7 @@ function REDUCED_RECIPIENT_RECEIVED_MAILS ($column, $id, $count) {
// Are there entries?
if (SQL_NUMROWS($result) > 0) {
// Now load all userids for one big query!
+ // @TODO This can be somehow rewritten
$UIDs = array();
while (list($uid) = SQL_FETCHROW($result)) {
$UIDs[$uid] = $uid;