X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=inc%2Fmysql-manager.php;h=47366597c9ddf5569228a3f84ed4a31892459efe;hb=7c183881355ea6e8dcc4324e1b081a4f75da77cb;hp=e377a6b3c1550698ac9d9675ec90394226879dc4;hpb=086762b9606889fbda59d946b7b557d764ec2c0e;p=mailer.git
diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php
index e377a6b3c1..47366597c9 100644
--- a/inc/mysql-manager.php
+++ b/inc/mysql-manager.php
@@ -134,10 +134,10 @@ function checkModulePermissions ($mod = '') {
// Check for prefix is a extension...
$modSplit = explode('_', $mod);
$extension = ''; $mod_chk = $mod;
- //* DEBUG: */ outputHtml(__LINE__."*".count($modSplit)."*/".$mod."*
");
+ //* DEBUG: */ print(__LINE__."*".count($modSplit)."*/".$mod."*
");
if (count($modSplit) == 2) {
// Okay, there is a seperator (_) in the name so is the first part a module?
- //* DEBUG: */ outputHtml(__LINE__."*".$modSplit[0]."*
");
+ //* DEBUG: */ print(__LINE__."*".$modSplit[0]."*
");
if (isExtensionActive($modSplit[0])) {
// The prefix is an extension's name, so let's set it
$extension = $modSplit[0]; $mod = $modSplit[1];
@@ -381,9 +381,9 @@ function addMenuDescription ($accessLevel, $FQFN, $return = false, $output = tru
$OUT = $prefix . "" . $ret . "\n";
// Can we close the you-are-here navigation?
- //* DEBUG: */ outputHtml(__LINE__."*".$type.'/'.getWhat()."*
");
+ //* DEBUG: */ print(__LINE__."*".$type.'/'.getWhat()."*
");
if (($type == 'what') || (($type == 'action') && ((!isWhatSet()) || (getWhat() == 'overview')))) {
- //* DEBUG: */ outputHtml(__LINE__.'+'.$type."+
");
+ //* DEBUG: */ print(__LINE__.'+'.$type."+
");
// Add closing div and br-tag
$OUT .= "
\n";
$GLOBALS['nav_depth'] = 0;
@@ -428,12 +428,12 @@ function addMenu ($mode, $action, $what) {
$result_main = SQL_QUERY_ESC("SELECT `title`, `action` FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE (`what`='' OR `what` IS NULL)".$AND." ORDER BY `sort` ASC",
array($mode), __FUNCTION__, __LINE__);
- //* DEBUG: */ outputHtml(__LINE__.'/'.$main_cnt.':'.getWhat()."*
");
+ //* DEBUG: */ print(__LINE__.'/'.$main_cnt.':'.getWhat()."*
");
if (SQL_NUMROWS($result_main) > 0) {
// There are menus available, so we simply display them... :)
$GLOBALS['rows'] = '';
while ($content = SQL_FETCHARRAY($result_main)) {
- //* DEBUG: */ outputHtml(__LINE__.'/'.$main_cnt.'/'.$content['action'].':'.getWhat()."*
");
+ //* DEBUG: */ print(__LINE__.'/'.$main_cnt.'/'.$content['action'].':'.getWhat()."*
");
// Init variables
enableBlockMode(false);
$action = $content['action'];
@@ -462,7 +462,7 @@ function addMenu ($mode, $action, $what) {
$OUT = '';
// Full file name for checking menu
- //* DEBUG: */ outputHtml(__LINE__.":!!!!".$content['sub_what']."!!!
");
+ //* DEBUG: */ print(__LINE__.":!!!!".$content['sub_what']."!!!
");
$inc = sprintf("inc/modules/%s/what-%s.php", $mode, $content['sub_what']);
if (isIncludeReadable($inc)) {
// Mark currently selected menu - open
@@ -517,17 +517,17 @@ function addMenu ($mode, $action, $what) {
if (isFileReadable($INC)) {
// Load include file
if ((!isExtensionActive($content['action'])) || ($content['action'] == 'online')) $GLOBALS['rows'] .= loadTemplate('menu_what_begin', true, $mode);
- //* DEBUG: */ outputHtml(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.getWhat()."*
");
+ //* DEBUG: */ print(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.getWhat()."*
");
loadInclude($INC);
- //* DEBUG: */ outputHtml(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.getWhat()."*
");
+ //* DEBUG: */ print(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.getWhat()."*
");
if ((!isExtensionActive($content['action'])) || ($content['action'] == 'online')) $GLOBALS['rows'] .= loadTemplate('menu_what_end', true, $mode);
}
- //* DEBUG: */ outputHtml(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.$content['sub_what'].':'.getWhat()."*
");
+ //* DEBUG: */ print(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.$content['sub_what'].':'.getWhat()."*
");
}
$main_cnt++;
- //* DEBUG: */ outputHtml(__LINE__.'/'.$main_cnt.':'.getWhat()."*
");
+ //* DEBUG: */ print(__LINE__.'/'.$main_cnt.':'.getWhat()."*
");
if (SQL_NUMROWS($result_main) > $main_cnt) {
// Add seperator
$GLOBALS['rows'] .= loadTemplate('menu_seperator', true, $mode);
@@ -562,7 +562,7 @@ function addMenu ($mode, $action, $what) {
);
// Load main template
- //* DEBUG: */ outputHtml(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.$content['sub_what'].':'.getWhat()."*
");
+ //* DEBUG: */ print(__LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.$content['sub_what'].':'.getWhat()."*
");
loadTemplate('menu_table', false, $content);
} // END - if
}
@@ -613,12 +613,12 @@ function isMember () {
$ret = true;
} else {
// Maybe got locked etc.
- //* DEBUG: */ outputHtml(__LINE__."!!!
");
+ //* DEBUG: */ print(__LINE__."!!!
");
destroyUserSession();
}
} else {
// Cookie data is invalid!
- //* DEBUG: */ outputHtml(__LINE__."***
");
+ //* DEBUG: */ print(__LINE__."***
");
destroyUserSession();
}
@@ -626,7 +626,7 @@ function isMember () {
SQL_FREERESULT($result);
} else {
// Cookie data is invalid!
- //* DEBUG: */ outputHtml(__LINE__."///
");
+ //* DEBUG: */ print(__LINE__."///
");
destroyUserSession();
}
@@ -641,7 +641,7 @@ function isMember () {
function isAdmin ($admin = '') {
// Init variables
$ret = false; $passCookie = ''; $valPass = '';
- //* DEBUG: */ outputHtml(__LINE__."ADMIN:".$admin."
");
+ //* DEBUG: */ print(__FUNCTION__.':'.$admin.'
');
// If admin login is not given take current from cookies...
if ((empty($admin)) && (isSessionVariableSet('admin_login')) && (isSessionVariableSet('admin_md5'))) {
@@ -649,7 +649,7 @@ function isAdmin ($admin = '') {
$admin = getSession('admin_login');
$passCookie = getSession('admin_md5');
} // END - if
- //* DEBUG: */ outputHtml(__LINE__."ADMIN:".$admin.'/'.$passCookie."
");
+ //* DEBUG: */ print(__FUNCTION__.':'.$admin.'/'.$passCookie.'
');
// Search in array for entry
if (isset($GLOBALS['admin_hash'])) {
@@ -688,7 +688,7 @@ function isAdmin ($admin = '') {
if (!empty($valPass)) {
// Check if password is valid
- //* DEBUG: */ print(__FUNCTION__ . ':' . $valPass . '/' . $passCookie . '
');
+ //* DEBUG: */ print(__FUNCTION__ . ':(' . $valPass . '==' . $passCookie . ')='.intval($valPass == $passCookie).'
');
$ret = (($valPass == $passCookie) || ((strlen($valPass) == 32) && ($valPass == md5($passCookie))) || (($valPass == '*FAILED*') && (!isExtensionActive('cache'))));
} // END - if
@@ -783,7 +783,7 @@ function isMenuActionValid ($mode, $action, $what, $updateEntry=false) {
$add = '';
if ((!isAdmin()) && ($mode != 'admin')) $add = " AND `locked`='N'";
- //* DEBUG: */ outputHtml(__LINE__.':'.$mode.'/'.$action.'/'.$what."*
");
+ //* DEBUG: */ print(__LINE__.':'.$mode.'/'.$action.'/'.$what."*
");
if (($mode != 'admin') && ($updateEntry === true)) {
// Update guest or member menu
$sql = SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_%s_menu` SET counter=counter+1 WHERE `action`='%s' AND `what`='%s'".$add." LIMIT 1",
@@ -944,7 +944,7 @@ function getModeAction ($mode, $what) {
// Init status
$ret = '';
- //* DEBUG: */ outputHtml(__LINE__.'='.$mode.'/'.$what.'/'.getAction()."=
");
+ //* DEBUG: */ print(__LINE__.'='.$mode.'/'.$what.'/'.getAction()."=
");
if ((empty($what)) && ($mode != 'admin')) {
$what = getConfig('index_home');
} // END - if
@@ -965,7 +965,7 @@ function getModeAction ($mode, $what) {
// Get it directly from URL
return getAction();
}
- //* DEBUG: */ outputHtml(__FUNCTION__."(".__LINE__."): ret=".$ret."
");
+ //* DEBUG: */ print(__FUNCTION__."(".__LINE__."): ret=".$ret.'
');
// Does the module have a menu?
if (ifModuleHasMenu($mode)) {
@@ -1115,8 +1115,8 @@ function removeReceiver (&$receivers, $key, $userid, $pool_id, $stats_id = '', $
// Calculate sum (default) or count records of given criteria
function countSumTotalData ($search, $tableName, $lookFor = 'id', $whereStatement = 'userid', $countRows = false, $add = '') {
$ret = 0;
- //* DEBUG: */ outputHtml($search.'/'.$tableName.'/'.$lookFor.'/'.$whereStatement.'/'.$add.'
');
- if ((empty($search)) && ($search != 0)) {
+ //* DEBUG: */ print($search.'/'.$tableName.'/'.$lookFor.'/'.$whereStatement.'/'.$add.'
');
+ if ((empty($search)) && ($search != '0')) {
// Count or sum whole table?
if ($countRows === true) {
// Count whole table
@@ -1129,12 +1129,12 @@ function countSumTotalData ($search, $tableName, $lookFor = 'id', $whereStatemen
}
} elseif (($countRows === true) || ($lookFor == 'userid')) {
// Count rows
- //* DEBUG: */ outputHtml("COUNT!
");
+ //* DEBUG: */ print("COUNT!
");
$result = SQL_QUERY_ESC("SELECT COUNT(`%s`) FROM `{?_MYSQL_PREFIX?}_%s` WHERE `%s`='%s'".$add,
array($lookFor, $tableName, $whereStatement, $search), __FUNCTION__, __LINE__);
} else {
// Add all rows
- //* DEBUG: */ outputHtml("SUM!
");
+ //* DEBUG: */ print("SUM!
");
$result = SQL_QUERY_ESC("SELECT SUM(`%s`) FROM `{?_MYSQL_PREFIX?}_%s` WHERE `%s`='%s'".$add,
array($lookFor, $tableName, $whereStatement, $search), __FUNCTION__, __LINE__);
}
@@ -1206,7 +1206,7 @@ function getReferalLevelPercents ($level) {
* for default value will cause no referal will get points ever!!!)
*/
function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify = false, $rid = 0, $locked = false, $add_mode = 'ref') {
- //* DEBUG: */ outputHtml("----------------------- ".__FUNCTION__." - ENTRY ------------------------
- \n");
+ //* DEBUG: */ print("----------------------- ".__FUNCTION__." - ENTRY ------------------------
- \n");
// Convert mode to lower-case
$add_mode = strtolower($add_mode);
@@ -1235,12 +1235,12 @@ function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify
// Count up referal depth
if (!isset($GLOBALS['ref_level'])) {
// Initialialize referal system
- //* DEBUG: */ outputHtml(__FUNCTION__."(".__LINE__."): Referal system initialized!
");
+ //* DEBUG: */ print(__FUNCTION__."(".__LINE__."): Referal system initialized!
");
$GLOBALS['ref_level'] = 0;
} else {
// Increase referal level
$GLOBALS['ref_level']++;
- //* DEBUG: */ outputHtml(__FUNCTION__."(".__LINE__."): Referal level increased. DEPTH={$GLOBALS['ref_level']}
");
+ //* DEBUG: */ print(__FUNCTION__."(".__LINE__."): Referal level increased. DEPTH={$GLOBALS['ref_level']}
");
}
// Default is 'normal' points
@@ -1253,7 +1253,7 @@ function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify
$result_user = SQL_QUERY_ESC("SELECT `refid`, `email` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `userid`=%s AND `status`='CONFIRMED' LIMIT 1",
array(bigintval($userid)), __FUNCTION__, __LINE__);
- //* DEBUG: */ outputHtml(__FUNCTION__."(".__LINE__."):userid={$userid},numRows=".SQL_NUMROWS($result_user).",points={$points}
");
+ //* DEBUG: */ print(__FUNCTION__."(".__LINE__."):userid={$userid},numRows=".SQL_NUMROWS($result_user).",points={$points}
");
if (SQL_NUMROWS($result_user) == 1) {
// This is the user and his ref
list($ref, $email) = SQL_FETCHROW($result_user);
@@ -1261,32 +1261,32 @@ function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify
// Get percents
$per = getReferalLevelPercents($GLOBALS['ref_level']);
- //* DEBUG: */ outputHtml(__FUNCTION__."(".__LINE__."):userid={$userid},points={$points},depth={$GLOBALS['ref_level']},per={$per},mode={$add_mode}
");
+ //* DEBUG: */ print(__FUNCTION__."(".__LINE__."):userid={$userid},points={$points},depth={$GLOBALS['ref_level']},per={$per},mode={$add_mode}
");
// Some percents found?
if ($per > 0) {
// Calculate new points
- //* DEBUG: */ outputHtml(__FUNCTION__."(".__LINE__."):userid={$userid},points={$points},per={$per},depth={$GLOBALS['ref_level']}
");
+ //* DEBUG: */ print(__FUNCTION__."(".__LINE__."):userid={$userid},points={$points},per={$per},depth={$GLOBALS['ref_level']}
");
$ref_points = $points * $per / 100;
// Pay refback here if level > 0 and in ref-mode
if ((isExtensionActive('refback')) && ($GLOBALS['ref_level'] > 0) && ($per < 100) && ($add_mode == "ref") && (isset($GLOBALS['cache_array']['add_userid'][$userid]))) {
- //* DEBUG: */ outputHtml(__FUNCTION__."(".__LINE__."):userid={$userid},data={$GLOBALS['cache_array']['add_userid'][$userid]},ref_points={$ref_points},depth={$GLOBALS['ref_level']} - BEFORE!
");
+ //* DEBUG: */ print(__FUNCTION__."(".__LINE__."):userid={$userid},data={$GLOBALS['cache_array']['add_userid'][$userid]},ref_points={$ref_points},depth={$GLOBALS['ref_level']} - BEFORE!
");
$ref_points = addRefbackPoints($GLOBALS['cache_array']['add_userid'][$userid], $userid, $points, $ref_points);
- //* DEBUG: */ outputHtml(__FUNCTION__."(".__LINE__."):userid={$userid},data={$GLOBALS['cache_array']['add_userid'][$userid]},ref_points={$ref_points},depth={$GLOBALS['ref_level']} - AFTER!
");
+ //* DEBUG: */ print(__FUNCTION__."(".__LINE__."):userid={$userid},data={$GLOBALS['cache_array']['add_userid'][$userid]},ref_points={$ref_points},depth={$GLOBALS['ref_level']} - AFTER!
");
} // END - if
// Update points...
SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_points` SET `%s`=`%s`+%s WHERE `userid`=%s AND `ref_depth`='%s' LIMIT 1",
array($data, $data, $ref_points, bigintval($userid), bigintval($GLOBALS['ref_level'])), __FUNCTION__, __LINE__);
- //* DEBUG: */ outputHtml(__FUNCTION__."(".__LINE__."):data={$data},ref_points={$ref_points},userid={$userid},depth={$GLOBALS['ref_level']},mode={$add_mode} - UPDATE! (".SQL_AFFECTEDROWS().")
");
+ //* DEBUG: */ print(__FUNCTION__."(".__LINE__."):data={$data},ref_points={$ref_points},userid={$userid},depth={$GLOBALS['ref_level']},mode={$add_mode} - UPDATE! (".SQL_AFFECTEDROWS().")
");
// No entry updated?
if (SQL_AFFECTEDROWS() < 1) {
// First ref in this level! :-)
SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_points` (`userid`,`ref_depth`,`%s`) VALUES (%s,'%s',%s)",
array($data, bigintval($userid), bigintval($GLOBALS['ref_level']), $ref_points), __FUNCTION__, __LINE__);
- //* DEBUG: */ outputHtml(__FUNCTION__."(".__LINE__."):data={$data},ref_points={$ref_points},userid={$userid},depth={$GLOBALS['ref_level']},mode={$add_mode} - INSERTED! (".SQL_AFFECTEDROWS().")
");
+ //* DEBUG: */ print(__FUNCTION__."(".__LINE__."):data={$data},ref_points={$ref_points},userid={$userid},depth={$GLOBALS['ref_level']},mode={$add_mode} - INSERTED! (".SQL_AFFECTEDROWS().")
");
} // END - if
// Points updated, maybe I shall send him an email?
@@ -1321,7 +1321,7 @@ function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify
// Maybe there's another ref?
if (($ref > 0) && ($points > 0) && ($ref != $userid) && ($add_mode == 'ref')) {
// Then let's credit him here...
- //* DEBUG: */ outputHtml(__FUNCTION__."(".__LINE__."):userid={$userid},ref={$ref},points={$points} - ADVANCE!
");
+ //* DEBUG: */ print(__FUNCTION__."(".__LINE__."):userid={$userid},ref={$ref},points={$points} - ADVANCE!
");
addPointsThroughReferalSystem(sprintf("%s_ref:%s", $subject, $GLOBALS['ref_level']), $ref, $points, $sendNotify, $ref, $locked);
} // END - if
} // END - if
@@ -1329,26 +1329,26 @@ function addPointsThroughReferalSystem ($subject, $userid, $points, $sendNotify
// Free result
SQL_FREERESULT($result_user);
- //* DEBUG: */ outputHtml("
----------------------- ".__FUNCTION__." - EXIT ------------------------
");
+ //* DEBUG: */ print("
----------------------- ".__FUNCTION__." - EXIT ------------------------
");
}
// Updates the referal counter
function updateReferalCounter ($userid) {
// Make it sure referal level zero (member him-/herself) is at least selected
if (empty($GLOBALS['cache_array']['ref_level'][$userid])) $GLOBALS['cache_array']['ref_level'][$userid] = 1;
- //* DEBUG: */ outputHtml(__FUNCTION__."(".__LINE__."):userid={$userid},level={$GLOBALS['cache_array']['ref_level'][$userid]}
");
+ //* DEBUG: */ print(__FUNCTION__."(".__LINE__."):userid={$userid},level={$GLOBALS['cache_array']['ref_level'][$userid]}
");
// Update counter
SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_refsystem` SET `counter`=`counter`+1 WHERE `userid`=%s AND `level`='%s' LIMIT 1",
array(bigintval($userid), $GLOBALS['cache_array']['ref_level'][$userid]), __FUNCTION__, __LINE__);
// When no entry was updated then we have to create it here
- //* DEBUG: */ outputHtml(__FUNCTION__."(".__LINE__."):updated=".SQL_AFFECTEDROWS()."
");
+ //* DEBUG: */ print(__FUNCTION__."(".__LINE__."):updated=".SQL_AFFECTEDROWS().'
');
if (SQL_AFFECTEDROWS() < 1) {
// First count!
SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_refsystem` (`userid`, `level`, `counter`) VALUES (%s,%s,1)",
array(bigintval($userid), $GLOBALS['cache_array']['ref_level'][$userid]), __FUNCTION__, __LINE__);
- //* DEBUG: */ outputHtml(__FUNCTION__."(".__LINE__."):userid={$userid}
");
+ //* DEBUG: */ print(__FUNCTION__."(".__LINE__."):userid={$userid}
");
} // END - if
// Check for his referal
@@ -1360,16 +1360,16 @@ function updateReferalCounter ($userid) {
// Free memory
SQL_FREERESULT($result);
- //* DEBUG: */ outputHtml(__FUNCTION__."(".__LINE__."):userid={$userid},ref={$ref}
");
+ //* DEBUG: */ print(__FUNCTION__."(".__LINE__."):userid={$userid},ref={$ref}
");
// When he has a referal...
if (($ref > 0) && ($ref != $userid)) {
// Move to next referal level and count his counter one up!
- //* DEBUG: */ outputHtml(__FUNCTION__."(".__LINE__."):ref={$ref} - ADVANCE!
");
+ //* DEBUG: */ print(__FUNCTION__."(".__LINE__."):ref={$ref} - ADVANCE!
");
$GLOBALS['cache_array']['ref_level'][$userid]++; updateReferalCounter($ref);
} elseif ((($ref == $userid) || ($ref == 0)) && (getExtensionVersion('cache') >= '0.1.2')) {
// Remove cache here
- //* DEBUG: */ outputHtml(__FUNCTION__."(".__LINE__."):ref={$ref} - CACHE!
");
+ //* DEBUG: */ print(__FUNCTION__."(".__LINE__."):ref={$ref} - CACHE!
");
rebuildCacheFile('refsystem', 'refsystem');
}
@@ -1641,11 +1641,17 @@ function FILTER_ACTIVATE_EXCHANGE () {
// Deletes a user account with given reason
function deleteUserAccount ($userid, $reason) {
$points = 0;
- $result = SQL_QUERY_ESC("SELECT (SUM(p.points) - d.used_points) AS points
-FROM `{?_MYSQL_PREFIX?}_user_points` AS p
-LEFT JOIN `{?_MYSQL_PREFIX?}_user_data` AS d
-ON p.userid=d.userid
-WHERE p.userid=%s", array(bigintval($userid)), __FUNCTION__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT
+ (SUM(p.points) - d.used_points) AS points
+FROM
+ `{?_MYSQL_PREFIX?}_user_points` AS p
+LEFT JOIN
+ `{?_MYSQL_PREFIX?}_user_data` AS d
+ON
+ p.userid=d.userid
+WHERE
+ p.userid=%s",
+ array(bigintval($userid)), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Save his points to add them to the jackpot
list($points) = SQL_FETCHROW($result);
@@ -1710,7 +1716,7 @@ function getWhatFromModule ($modCheck) {
// Default is empty
$what = '';
- //* DEBUG: */ outputHtml(__LINE__.'!'.$modCheck."!
");
+ //* DEBUG: */ print(__LINE__.'!'.$modCheck."!
");
switch ($modCheck) {
case 'admin':
$what = 'overview';
@@ -1718,7 +1724,14 @@ function getWhatFromModule ($modCheck) {
case 'login':
case 'index':
- $what = getConfig('index_home');
+ // Is ext-sql_patches installed and newer than 0.0.5?
+ if (isExtensionInstalledAndNewer('sql_patches', '0.0.5')) {
+ // Use it from config
+ $what = getConfig('index_home');
+ } else {
+ // Use default 'welcome'
+ $what = 'welcome';
+ }
break;
default:
@@ -1906,7 +1919,7 @@ VALUES ('%s','%s','%s','%s','%s','NEW', UNIX_TIMESTAMP(),'%s','%s','%s','%s')",
// Generate a receiver list for given category and maximum receivers
function generateReceiverList ($cat, $receiver, $mode = '') {
// Init variables
- $CAT_TABS = "%s";
+ $CAT_TABS = '';
$CAT_WHERE = '';
$receiverList = '';
$result = false;
@@ -1925,7 +1938,7 @@ function generateReceiverList ($cat, $receiver, $mode = '') {
if ($cat > 0) {
// Select category
$CAT_TABS = "LEFT JOIN `{?_MYSQL_PREFIX?}_user_cats` AS c ON d.userid=c.userid";
- $CAT_WHERE = " AND c.cat_id=%s";
+ $CAT_WHERE = sprintf(" AND c.cat_id=%s", $cat);
} // END - if
// Exclude users in holiday?
@@ -1936,12 +1949,16 @@ function generateReceiverList ($cat, $receiver, $mode = '') {
if ((isExtensionActive('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__);
+ $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.{?order_select?} {?order_mode?} LIMIT %s",
+ array(
+ $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__);
+ $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.{?order_select?} {?order_mode?} LIMIT %s",
+ array(
+ $receiver
+ ), __FUNCTION__, __LINE__);
}
// Entries found?
@@ -2027,7 +2044,7 @@ function insertUserStatsRecord ($userid, $type, $data) {
// "Getter" for array for user refs and points in given level
function getUserReferalPoints ($userid, $level) {
- //* DEBUG: */ outputHtml("----------------------- ".__FUNCTION__." - ENTRY ------------------------- \n");
+ //* DEBUG: */ print("----------------------- ".__FUNCTION__." - ENTRY ------------------------
- \n");
// Default is no refs and no nickname
$add = '';
$refs = array();
@@ -2100,7 +2117,7 @@ ORDER BY ur.refid ASC",
SQL_FREERESULT($result);
// Return result
- //* DEBUG: */ outputHtml("
----------------------- ".__FUNCTION__." - EXIT ------------------------
");
+ //* DEBUG: */ print("
----------------------- ".__FUNCTION__." - EXIT ------------------------
");
return $refs;
}