- $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
+ $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
array($mod), __FUNCTION__, __LINE__);
list($name) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
array($mod), __FUNCTION__, __LINE__);
list($name) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
// Check validity of a given module name (no file extension)
function checkModulePermissions ($mod) {
// Filter module name (names with low chars and underlines are fine!)
// Check validity of a given module name (no file extension)
function checkModulePermissions ($mod) {
// Filter module name (names with low chars and underlines are fine!)
// Check for prefix is a extension...
$modSplit = explode("_", $mod);
// Check for prefix is a extension...
$modSplit = explode("_", $mod);
//* DEBUG: */ echo __LINE__."*".count($modSplit)."*/".$mod."*<br />";
if (count($modSplit) == 2) {
// Okay, there is a seperator (_) in the name so is the first part a module?
//* DEBUG: */ echo __LINE__."*".count($modSplit)."*/".$mod."*<br />";
if (count($modSplit) == 2) {
// Okay, there is a seperator (_) in the name so is the first part a module?
- $result = SQL_QUERY_ESC("SELECT locked, hidden, admin_only, mem_only FROM `{!_MYSQL_PREFIX!}_mod_reg` WHERE module='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT locked, hidden, admin_only, mem_only FROM `{!_MYSQL_PREFIX!}_mod_reg` WHERE `module`='%s' LIMIT 1",
array($mod_chk), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Read data
array($mod_chk), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Read data
// Check returned values against current access permissions
//
// Admin access ----- Guest access ----- --- Guest or member? ---
// Check returned values against current access permissions
//
// Admin access ----- Guest access ----- --- Guest or member? ---
// ----- Legacy module ----- ---- Module in base folder ---- --- Module with extension's name ---
if ((FILE_READABLE(sprintf("%sinc/modules/%s.php", constant('PATH'), $mod))) || (FILE_READABLE(sprintf("%s%s.php", constant('PATH'), $mod))) || (FILE_READABLE(sprintf("%s%s/%s.php", constant('PATH'), $extension, $mod)))) {
// Data is missing so we add it
// ----- Legacy module ----- ---- Module in base folder ---- --- Module with extension's name ---
if ((FILE_READABLE(sprintf("%sinc/modules/%s.php", constant('PATH'), $mod))) || (FILE_READABLE(sprintf("%s%s.php", constant('PATH'), $mod))) || (FILE_READABLE(sprintf("%s%s/%s.php", constant('PATH'), $extension, $mod)))) {
// Data is missing so we add it
// Since 0.3.6 we have a has_menu column, this took me a half hour
// to find a loop here... *sigh*
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_mod_reg`
// Since 0.3.6 we have a has_menu column, this took me a half hour
// to find a loop here... *sigh*
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_mod_reg`
// First we have to do some analysis...
if (substr($file, 0, 7) == "action-") {
// First we have to do some analysis...
if (substr($file, 0, 7) == "action-") {
} elseif (substr($file, 0, 5) == "what-") {
// This is an admin what file!
$type = "what";
$search = substr($file, 5);
} elseif (substr($file, 0, 5) == "what-") {
// This is an admin what file!
$type = "what";
$search = substr($file, 5);
}
$dummy = substr($search, 0, -4);
$AND .= " AND `action`='".GET_ACTION($ACC_LVL, $dummy)."'";
}
$dummy = substr($search, 0, -4);
$AND .= " AND `action`='".GET_ACTION($ACC_LVL, $dummy)."'";
$prefix = "<div class=\"you_are_here\">{--YOU_ARE_HERE--} <strong><a class=\"you_are_here\" href=\"{!URL!}/modules.php?module=".$GLOBALS['module'].$LINK_ADD."\">Home</a></strong>";
} else {
if (!$return) $GLOBALS['nav_depth']++;
$prefix = "<div class=\"you_are_here\">{--YOU_ARE_HERE--} <strong><a class=\"you_are_here\" href=\"{!URL!}/modules.php?module=".$GLOBALS['module'].$LINK_ADD."\">Home</a></strong>";
} else {
if (!$return) $GLOBALS['nav_depth']++;
- if (!VALIDATE_MENU_ACTION($MODE, $act, $wht, true)) {
+ if (!VALIDATE_MENU_ACTION($mode, $act, $wht, true)) {
- $result_main = SQL_QUERY_ESC("SELECT title, action FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE (what='' OR `what` IS NULL)".$AND." ORDER BY `sort`",
- array($MODE), __FUNCTION__, __LINE__);
+ $result_main = SQL_QUERY_ESC("SELECT title, action FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE (`what`='' OR `what` IS NULL)".$AND." ORDER BY `sort`",
+ array($mode), __FUNCTION__, __LINE__);
//* DEBUG: */ echo __LINE__."/".$main_cnt."/".$main_action."/".$sub_what.":".$GLOBALS['what']."*<br />\n";
if (SQL_NUMROWS($result_main) > 0) {
//* DEBUG: */ echo __LINE__."/".$main_cnt."/".$main_action."/".$sub_what.":".$GLOBALS['what']."*<br />\n";
if (SQL_NUMROWS($result_main) > 0) {
// There are menus available, so we simply display them... :)
while ($content = SQL_FETCHARRAY($result_main)) {
//* DEBUG: */ echo __LINE__."/".$main_cnt."/".$content['action']."/".$sub_what.":".$GLOBALS['what']."*<br />\n";
// There are menus available, so we simply display them... :)
while ($content = SQL_FETCHARRAY($result_main)) {
//* DEBUG: */ echo __LINE__."/".$main_cnt."/".$content['action']."/".$sub_what.":".$GLOBALS['what']."*<br />\n";
// Sub menu
$result_sub = SQL_QUERY_ESC("SELECT title AS sub_title, what AS sub_what FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ".$AND." ORDER BY `sort`",
// Sub menu
$result_sub = SQL_QUERY_ESC("SELECT title AS sub_title, what AS sub_what FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ".$AND." ORDER BY `sort`",
- array($MODE, $content['action']), __FUNCTION__, __LINE__);
+ array($mode, $content['action']), __FUNCTION__, __LINE__);
// Full file name for checking menu
//* DEBUG: */ echo __LINE__.":!!!!".$content['sub_what']."!!!<br />\n";
// Full file name for checking menu
//* DEBUG: */ echo __LINE__.":!!!!".$content['sub_what']."!!!<br />\n";
//* DEBUG: */ echo __LINE__."/".$main_cnt."/".$content['action']."/".$content['sub_what'].":".$GLOBALS['what']."*<br />\n";
LOAD_INC($INC_BLOCK);
//* DEBUG: */ echo __LINE__."/".$main_cnt."/".$content['action']."/".$content['sub_what'].":".$GLOBALS['what']."*<br />\n";
//* DEBUG: */ echo __LINE__."/".$main_cnt."/".$content['action']."/".$content['sub_what'].":".$GLOBALS['what']."*<br />\n";
LOAD_INC($INC_BLOCK);
//* DEBUG: */ echo __LINE__."/".$main_cnt."/".$content['action']."/".$content['sub_what'].":".$GLOBALS['what']."*<br />\n";
$main_cnt++;
//* DEBUG: */ echo __LINE__."/".$main_cnt."/".$content['action']."/".$content['sub_what'].":".$GLOBALS['what']."*<br />\n";
if (SQL_NUMROWS($result_main) > $main_cnt) {
$main_cnt++;
//* DEBUG: */ echo __LINE__."/".$main_cnt."/".$content['action']."/".$content['sub_what'].":".$GLOBALS['what']."*<br />\n";
if (SQL_NUMROWS($result_main) > $main_cnt) {
// This patched function will reduce many SELECT queries for the specified or current admin login
function IS_ADMIN ($admin="") {
// Init variables
// This patched function will reduce many SELECT queries for the specified or current admin login
function IS_ADMIN ($admin="") {
// Init variables
//* DEBUG: */ echo __LINE__."ADMIN:".$admin."<br />";
// If admin login is not given take current from cookies...
//* DEBUG: */ echo __LINE__."ADMIN:".$admin."<br />";
// If admin login is not given take current from cookies...
// Search for admin
$result = SQL_QUERY_ESC("SELECT HIGH_PRIORITY password FROM `{!_MYSQL_PREFIX!}_admins` WHERE login='%s' LIMIT 1",
array($admin), __FUNCTION__, __LINE__);
// Is he admin?
// Search for admin
$result = SQL_QUERY_ESC("SELECT HIGH_PRIORITY password FROM `{!_MYSQL_PREFIX!}_admins` WHERE login='%s' LIMIT 1",
array($admin), __FUNCTION__, __LINE__);
// Is he admin?
if (SQL_NUMROWS($result) == 1) {
// Admin login was found so let's load password from DB
list($passDB) = SQL_FETCHROW($result);
if (SQL_NUMROWS($result) == 1) {
// Admin login was found so let's load password from DB
list($passDB) = SQL_FETCHROW($result);
if (!empty($valPass)) {
// Check if password is valid
//* DEBUG: */ print __FUNCTION__."*".$valPass."/".$passCookie."*<br />\n";
if (!empty($valPass)) {
// Check if password is valid
//* DEBUG: */ print __FUNCTION__."*".$valPass."/".$passCookie."*<br />\n";
// 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__);
break;
// 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__);
break;
// Members are allowed to set to zero mails per day (we will change this soon!)
$result = SQL_QUERY("SELECT value, comment FROM `{!_MYSQL_PREFIX!}_max_receive` ORDER BY value",
__FUNCTION__, __LINE__);
break;
default: // Invalid!
// Members are allowed to set to zero mails per day (we will change this soon!)
$result = SQL_QUERY("SELECT value, comment FROM `{!_MYSQL_PREFIX!}_max_receive` ORDER BY value",
__FUNCTION__, __LINE__);
break;
default: // Invalid!
- DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Invalid mode %s detected.", $MODE));
+ DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Invalid mode %s detected.", $mode));
$OUT .= ">".$content['value']." {--PER_DAY--}";
if (!empty($content['comment'])) $OUT .= " (".$content['comment'].")";
$OUT .= "</option>\n";
$OUT .= ">".$content['value']." {--PER_DAY--}";
if (!empty($content['comment'])) $OUT .= " (".$content['comment'].")";
$OUT .= "</option>\n";
} else {
// Maybe the admin has to setup some maximum values?
debug_report_bug("Nothing is being done here?");
} else {
// Maybe the admin has to setup some maximum values?
debug_report_bug("Nothing is being done here?");
-function VALIDATE_MENU_ACTION ($MODE, $act, $wht, $UPDATE=false) {
+function VALIDATE_MENU_ACTION ($mode, $act, $wht, $UPDATE=false) {
- //* DEBUG: */ echo __LINE__.":".$MODE."/".$act."/".$wht."*<br />\n";
- if (($MODE != "admin") && ($UPDATE === true)) {
+ //* DEBUG: */ echo __LINE__.":".$mode."/".$act."/".$wht."*<br />\n";
+ if (($mode != 'admin') && ($UPDATE === 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",
// 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",
- array($MODE, $act, $wht), __FUNCTION__, __LINE__, false);
+ array($mode, $act, $wht), __FUNCTION__, __LINE__, false);
} elseif (($wht != "overview") && (!empty($wht))) {
// Other actions
$sql = SQL_QUERY_ESC("SELECT id, what FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE `action`='%s' AND `what`='%s'".$add." ORDER BY action DESC LIMIT 1",
} elseif (($wht != "overview") && (!empty($wht))) {
// Other actions
$sql = SQL_QUERY_ESC("SELECT id, what FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE `action`='%s' AND `what`='%s'".$add." ORDER BY action DESC LIMIT 1",
- array($MODE, $act, $wht), __FUNCTION__, __LINE__, false);
+ array($mode, $act, $wht), __FUNCTION__, __LINE__, false);
- $sql = SQL_QUERY_ESC("SELECT id, what FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE `action`='%s' AND (what='' OR `what` IS NULL)".$add." ORDER BY action DESC LIMIT 1",
- array($MODE, $act), __FUNCTION__, __LINE__, false);
+ $sql = SQL_QUERY_ESC("SELECT id, what FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE `action`='%s' AND (`what`='' OR `what` IS NULL)".$add." ORDER BY action DESC LIMIT 1",
+ array($mode, $act), __FUNCTION__, __LINE__, false);
- array($MODE, $column, $wht), __FUNCTION__, __LINE__);
+ array($mode, $column, $wht), __FUNCTION__, __LINE__);
// The admin needs to be notified about a profile change
$msg_admin = "admin_mydata_notify";
$sub_adm = ADMIN_CHANGED_DATA;
} else {
// No mail to admin
// The admin needs to be notified about a profile change
$msg_admin = "admin_mydata_notify";
$sub_adm = ADMIN_CHANGED_DATA;
} else {
// No mail to admin
if ((!empty($sub_adm)) && (!empty($msg_admin))) {
// Send admin mail
SEND_ADMIN_NOTIFICATION($sub_adm, $msg_admin, $content, getUserId());
if ((!empty($sub_adm)) && (!empty($msg_admin))) {
// Send admin mail
SEND_ADMIN_NOTIFICATION($sub_adm, $msg_admin, $content, getUserId());
array($mod), __FUNCTION__, __LINE__);
} // END - if
}
// Get action value from mode (admin/guest/member) and what-value
array($mod), __FUNCTION__, __LINE__);
} // END - if
}
// Get action value from mode (admin/guest/member) and what-value
- //* DEBUG: */ echo __LINE__."=".$MODE."/".$wht."/".$GLOBALS['action']."=<br />";
- if ((empty($wht)) && ($MODE != "admin")) {
+ //* DEBUG: */ echo __LINE__."=".$mode."/".$wht."/".$GLOBALS['action']."=<br />";
+ if ((empty($wht)) && ($mode != 'admin')) {
//* DEBUG: */ echo __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): ret=".$ret."<br />\n";
// Does the module have a menu?
//* DEBUG: */ echo __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): ret=".$ret."<br />\n";
// Does the module have a menu?
- array($MODE, $wht), __FUNCTION__, __LINE__);
+ array($mode, $wht), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Load action value and pray that this one is the right you want... ;-)
list($ret) = SQL_FETCHROW($result);
if (SQL_NUMROWS($result) == 1) {
// Load action value and pray that this one is the right you want... ;-)
list($ret) = SQL_FETCHROW($result);
// No sql_patches installed, but maybe we need to register an admin?
if (isAdminRegistered()) {
// Redirect
// @TODO Why does this lead into an endless loop but we still need it???
// No sql_patches installed, but maybe we need to register an admin?
if (isAdminRegistered()) {
// Redirect
// @TODO Why does this lead into an endless loop but we still need it???
} else {
// Return title and price
list($t, $p) = SQL_FETCHROW($result);
} else {
// Return title and price
list($t, $p) = SQL_FETCHROW($result);
$result = SQL_QUERY_ESC("SELECT %s FROM `{!_MYSQL_PREFIX!}_payments` WHERE id=%s LIMIT 1",
array($lookFor, $pid), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
$result = SQL_QUERY_ESC("SELECT %s FROM `{!_MYSQL_PREFIX!}_payments` WHERE id=%s LIMIT 1",
array($lookFor, $pid), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
-function REMOVE_RECEIVER (&$receivers, $key, $uid, $pool_id, $stats_id="", $bonus=false) {
+function REMOVE_RECEIVER (&$receivers, $key, $uid, $pool_id, $stats_id='', $bonus=false) {
// Is there already a line for this user available?
if ($stats_id > 0) {
// Only when we got a real stats ID continue searching for the entry
// Is there already a line for this user available?
if ($stats_id > 0) {
// Only when we got a real stats ID continue searching for the entry
// Try to look the entry up
$result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_user_links` WHERE %s='%s' AND userid=%s AND link_type='%s' LIMIT 1",
// Try to look the entry up
$result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_user_links` WHERE %s='%s' AND userid=%s AND link_type='%s' LIMIT 1",
// So we add one!
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_user_links` (%s, userid, link_type) VALUES ('%s','%s','%s')",
array($rowName, $stats_id, bigintval($uid), $type), __FUNCTION__, __LINE__);
// So we add one!
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_user_links` (%s, userid, link_type) VALUES ('%s','%s','%s')",
array($rowName, $stats_id, bigintval($uid), $type), __FUNCTION__, __LINE__);
-function GET_TOTAL_DATA ($search, $tableName, $lookFor = "id", $whereStatement = "userid", $countRows = false, $add = "") {
+function GET_TOTAL_DATA ($search, $tableName, $lookFor = 'id', $whereStatement = 'userid', $countRows = false, $add = '') {
- //* DEBUG: */ echo $search."/".$tableName."/".$lookFor."/".$whereStatement."/".$add."<br />\n";
- if ((empty($search)) && ($search != "0")) {
+ //* DEBUG: */ echo $search.'/'.$tableName.'/'.$lookFor.'/'.$whereStatement.'/'.$add.'<br />\n';
+ if ((empty($search)) && ($search != '0')) {
$result = SQL_QUERY_ESC("SELECT SUM(`%s`) FROM `{!_MYSQL_PREFIX!}_%s`".$add,
array($lookFor, $tableName), __FUNCTION__, __LINE__);
}
$result = SQL_QUERY_ESC("SELECT SUM(`%s`) FROM `{!_MYSQL_PREFIX!}_%s`".$add,
array($lookFor, $tableName), __FUNCTION__, __LINE__);
}
// Count rows
//* DEBUG: */ echo "COUNT!<br />\n";
$result = SQL_QUERY_ESC("SELECT COUNT(`%s`) FROM `{!_MYSQL_PREFIX!}_%s` WHERE `%s`='%s'".$add,
// Count rows
//* DEBUG: */ echo "COUNT!<br />\n";
$result = SQL_QUERY_ESC("SELECT COUNT(`%s`) FROM `{!_MYSQL_PREFIX!}_%s` WHERE `%s`='%s'".$add,
// Get referal data
$result_lvl = SQL_QUERY_ESC("SELECT percents FROM `{!_MYSQL_PREFIX!}_refdepths` WHERE level='%s' LIMIT 1",
array(bigintval($level)), __FUNCTION__, __LINE__);
// Get referal data
$result_lvl = SQL_QUERY_ESC("SELECT percents FROM `{!_MYSQL_PREFIX!}_refdepths` WHERE level='%s' LIMIT 1",
array(bigintval($level)), __FUNCTION__, __LINE__);
* add_mode = Add points only to $uid or also refs? (WARNING! Changing "ref" to "direct"
* for default value will cause no referal will get points ever!!!)
*/
* add_mode = Add points only to $uid or also refs? (WARNING! Changing "ref" to "direct"
* for default value will cause no referal will get points ever!!!)
*/
-function ADD_POINTS_REFSYSTEM ($subject, $uid, $points, $send_notify=false, $rid="0", $locked=false, $add_mode="ref") {
+function ADD_POINTS_REFSYSTEM ($subject, $uid, $points, $send_notify=false, $rid='0', $locked=false, $add_mode='ref') {
- ADD_BOOKING_RECORD($subject, $uid, $points, "add");
+ ADD_BOOKING_RECORD($subject, $uid, $points, 'add');
// Check user account
$result_user = SQL_QUERY_ESC("SELECT refid, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1",
// Check user account
$result_user = SQL_QUERY_ESC("SELECT refid, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1",
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},data={$GLOBALS['cache_array']['add_uid'][$uid]},ref_points={$ref_points},depth={$GLOBALS['ref_level']} - BEFORE!<br />\n";
$ref_points = ADD_REFBACK_POINTS($GLOBALS['cache_array']['add_uid'][$uid], $uid, $points, $ref_points);
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},data={$GLOBALS['cache_array']['add_uid'][$uid]},ref_points={$ref_points},depth={$GLOBALS['ref_level']} - AFTER!<br />\n";
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},data={$GLOBALS['cache_array']['add_uid'][$uid]},ref_points={$ref_points},depth={$GLOBALS['ref_level']} - BEFORE!<br />\n";
$ref_points = ADD_REFBACK_POINTS($GLOBALS['cache_array']['add_uid'][$uid], $uid, $points, $ref_points);
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},data={$GLOBALS['cache_array']['add_uid'][$uid]},ref_points={$ref_points},depth={$GLOBALS['ref_level']} - AFTER!<br />\n";
SEND_EMAIL($email, THANX_REFERRAL_ONE, $msg);
} elseif (($send_notify) && ($ref == 0) && (!$locked) && ($add_mode == "direct") && (!defined('__POINTS_VALUE'))) {
SEND_EMAIL($email, THANX_REFERRAL_ONE, $msg);
} elseif (($send_notify) && ($ref == 0) && (!$locked) && ($add_mode == "direct") && (!defined('__POINTS_VALUE'))) {
- if (!REQUEST_ISSET_GET(('mid'))) LOAD_TEMPLATE("admin_settings_saved", false, getMessage('ADMIN_POINTS_ADDED'));
+ if (!REQUEST_ISSET_GET(('mid'))) LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_POINTS_ADDED'));
// Then let's credit him here...
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},ref={$ref},points={$points} - ADVANCE!<br />\n";
ADD_POINTS_REFSYSTEM(sprintf("%s_ref:%s", $subject, $GLOBALS['ref_level']), $ref, $points, $send_notify, $ref, $locked);
// Then let's credit him here...
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):uid={$uid},ref={$ref},points={$points} - ADVANCE!<br />\n";
ADD_POINTS_REFSYSTEM(sprintf("%s_ref:%s", $subject, $GLOBALS['ref_level']), $ref, $points, $send_notify, $ref, $locked);
// Move to next referal level and count his counter one up!
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):ref={$ref} - ADVANCE!<br />\n";
$GLOBALS['cache_array']['ref_level'][$uid]++; UPDATE_REF_COUNTER($ref);
// Move to next referal level and count his counter one up!
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):ref={$ref} - ADVANCE!<br />\n";
$GLOBALS['cache_array']['ref_level'][$uid]++; UPDATE_REF_COUNTER($ref);
// Get ID number from administrator's login name
function GET_ADMIN_ID ($login) {
// By default no admin is found
// Get ID number from administrator's login name
function GET_ADMIN_ID ($login) {
// By default no admin is found
// Load from database
$result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_admins` WHERE login='%s' LIMIT 1",
array($login), __FUNCTION__, __LINE__);
// Load from database
$result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_admins` WHERE login='%s' LIMIT 1",
array($login), __FUNCTION__, __LINE__);
// Get password hash from administrator's login name
function GET_ADMIN_HASH ($aid) {
// By default an invalid hash is returned
// Get password hash from administrator's login name
function GET_ADMIN_HASH ($aid) {
// By default an invalid hash is returned
// Load from database
$result = SQL_QUERY_ESC("SELECT password FROM `{!_MYSQL_PREFIX!}_admins` WHERE id=%s LIMIT 1",
array($aid), __FUNCTION__, __LINE__);
// Load from database
$result = SQL_QUERY_ESC("SELECT password FROM `{!_MYSQL_PREFIX!}_admins` WHERE id=%s LIMIT 1",
array($aid), __FUNCTION__, __LINE__);
//
function GET_ADMIN_LOGIN ($aid) {
// By default a non-existent login is returned (other functions react on this!)
//
function GET_ADMIN_LOGIN ($aid) {
// By default a non-existent login is returned (other functions react on this!)
// Load from database
$result = SQL_QUERY_ESC("SELECT login FROM `{!_MYSQL_PREFIX!}_admins` WHERE id=%s LIMIT 1",
array(bigintval($aid)), __FUNCTION__, __LINE__);
// Load from database
$result = SQL_QUERY_ESC("SELECT login FROM `{!_MYSQL_PREFIX!}_admins` WHERE id=%s LIMIT 1",
array(bigintval($aid)), __FUNCTION__, __LINE__);
// Get email address of admin id
function GET_ADMIN_EMAIL ($aid) {
// By default an invalid emails is returned
// Get email address of admin id
function GET_ADMIN_EMAIL ($aid) {
// By default an invalid emails is returned
// Load from database
$result_aid = SQL_QUERY_ESC("SELECT email FROM `{!_MYSQL_PREFIX!}_admins` WHERE id=%s LIMIT 1",
array(bigintval($aid)), __FUNCTION__, __LINE__);
// Load from database
$result_aid = SQL_QUERY_ESC("SELECT email FROM `{!_MYSQL_PREFIX!}_admins` WHERE id=%s LIMIT 1",
array(bigintval($aid)), __FUNCTION__, __LINE__);
// Get default ACL of admin id
function GET_ADMIN_DEFAULT_ACL ($aid) {
// By default an invalid ACL value is returned
// Get default ACL of admin id
function GET_ADMIN_DEFAULT_ACL ($aid) {
// By default an invalid ACL value is returned
- if (isset($GLOBALS['cache_array']['admins']['def_acl'][$aid])) {
+ // Is sql_patches there and was it found in cache?
+ if (!EXT_IS_ACTIVE('sql_patches')) {
+ // Not found, which is bad, so we need to allow all
+ $ret = 'allow';
+ } elseif (isset($GLOBALS['cache_array']['admins']['def_acl'][$aid])) {
// Load from database
$result_aid = SQL_QUERY_ESC("SELECT default_acl FROM `{!_MYSQL_PREFIX!}_admins` WHERE id=%s LIMIT 1",
array(bigintval($aid)), __FUNCTION__, __LINE__);
// Load from database
$result_aid = SQL_QUERY_ESC("SELECT default_acl FROM `{!_MYSQL_PREFIX!}_admins` WHERE id=%s LIMIT 1",
array(bigintval($aid)), __FUNCTION__, __LINE__);
-function ADD_OPTION_LINES ($table, $id, $name, $default="", $special="", $where="") {
- $ret = "";
- if ($table == "/ARRAY/") {
+function ADD_OPTION_LINES ($table, $id, $name, $default='', $special='', $where='') {
+ $ret = '';
+ if ($table == '/ARRAY/') {
// Selection from array
if (is_array($id) && is_array($name) && count($id) == count($name)) {
// Both are arrays
foreach ($id as $idx => $value) {
// Selection from array
if (is_array($id) && is_array($name) && count($id) == count($name)) {
// Both are arrays
foreach ($id as $idx => $value) {
- $ret .= "<option value=\"".$value."\"";
- if ($default == $value) $ret .= " selected=\"selected\"";
- $ret .= ">".$name[$idx]."</option>\n";
+ $ret .= '<option value="' . $value . '"';
+ if ($default == $value) $ret .= ' selected="selected"';
+ $ret .= '>' . $name[$idx] . '</option>';
$result = SQL_QUERY_ESC("SELECT %s, %s".$SPEC." FROM `{!_MYSQL_PREFIX!}_%s` ".$where." ORDER BY %s",
array($id, $ORDER, $table, $name), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) > 0) {
// Found data so add them as OPTION lines: $id is the value and $name is the "name" of the option
// @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
while (list($value, $title, $add) = SQL_FETCHROW($result)) {
$result = SQL_QUERY_ESC("SELECT %s, %s".$SPEC." FROM `{!_MYSQL_PREFIX!}_%s` ".$where." ORDER BY %s",
array($id, $ORDER, $table, $name), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) > 0) {
// Found data so add them as OPTION lines: $id is the value and $name is the "name" of the option
// @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
while (list($value, $title, $add) = SQL_FETCHROW($result)) {
- if (empty($special)) $add = "";
- $ret .= "<option value=\"".$value."\"";
- if ($default == $value) $ret .= " selected=\"selected\"";
- if (!empty($add)) $add = " (".$add.")";
- $ret .= ">".$title.$add."</option>\n";
+ if (empty($special)) $add = '';
+ $ret .= '<option value="' . $value . '"';
+ if ($default == $value) $ret .= ' selected="selected"';
+ if (!empty($add)) $add = ' ('.$add.')';
+ $ret .= '>' . $title . $add . '</option>';
- $totalUsers = GET_TOTAL_DATA("CONFIRMED", "user_data", "userid", "status", true, " AND max_mails > 0");
+ $totalUsers = GET_TOTAL_DATA('CONFIRMED', 'user_data', 'userid', 'status', true, ' AND max_mails > 0');
- "UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `locked`='N', hidden='N', mem_only='Y' WHERE module='order' LIMIT 1",
- "UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what`='order' OR `what`='unconfirmed' LIMIT 2",
+ "UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `locked`='N', `hidden`='N', `mem_only`='Y' WHERE `module`='order' LIMIT 1",
+ "UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what='order' OR `what`='unconfirmed' LIMIT 2",
- rebuildCacheFiles("config", "config");
- rebuildCacheFiles("modreg", "modreg");
+ // @TODO Rewrite this to a filter
+ rebuildCacheFiles('config', 'config');
+ rebuildCacheFiles('modreg', 'modreg');
$points = 0;
$result = SQL_QUERY_ESC("SELECT (SUM(p.points) - d.used_points) AS points
FROM `{!_MYSQL_PREFIX!}_user_points` AS p
$points = 0;
$result = SQL_QUERY_ESC("SELECT (SUM(p.points) - d.used_points) AS points
FROM `{!_MYSQL_PREFIX!}_user_points` AS p
SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_points` WHERE userid=%s", array(bigintval($uid)), __FUNCTION__, __LINE__);
// Update mediadata as well
SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_points` WHERE userid=%s", array(bigintval($uid)), __FUNCTION__, __LINE__);
// Update mediadata as well
array(bigintval($uid)), __FUNCTION__, __LINE__);
// Remove from rallye if found
array(bigintval($uid)), __FUNCTION__, __LINE__);
// Remove from rallye if found
SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_users` WHERE userid=%s",
array(bigintval($uid)), __FUNCTION__, __LINE__);
}
SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_users` WHERE userid=%s",
array(bigintval($uid)), __FUNCTION__, __LINE__);
}
//
function META_DESCRIPTION ($mod, $wht) {
// Exclude admin and member's area
//
function META_DESCRIPTION ($mod, $wht) {
// Exclude admin and member's area
- $DESCR = "{!MAIN_TITLE!} ".trim(getConfig('title_middle'))." ".ADD_DESCR("guest", "what-".$wht, true);
+ $DESCR = '{!MAIN_TITLE!} '.trim(getConfig('title_middle')).' '.ADD_DESCR('guest', 'what-'.$wht, true);
// Get current points
$result = SQL_QUERY("SELECT points FROM `{!_MYSQL_PREFIX!}_jackpot` WHERE ok='ok' LIMIT 1", __FUNCTION__, __LINE__);
// Get current points
$result = SQL_QUERY("SELECT points FROM `{!_MYSQL_PREFIX!}_jackpot` WHERE ok='ok' LIMIT 1", __FUNCTION__, __LINE__);
array($points, bigintval($uid)), __FUNCTION__, __LINE__);
// Insert booking record
array($points, bigintval($uid)), __FUNCTION__, __LINE__);
// Insert booking record
- ADD_BOOKING_RECORD($subject, $uid, $points, "sub");
+ ADD_BOOKING_RECORD($subject, $uid, $points, 'sub');
if (($values[$idx] + 0) === $values[$idx]) {
// Number detected
$all .= sprintf("%s=%s,", $entry, (float)$values[$idx]);
if (($values[$idx] + 0) === $values[$idx]) {
// Number detected
$all .= sprintf("%s=%s,", $entry, (float)$values[$idx]);
// Function UNIX_TIMESTAMP() detected
$all .= sprintf("%s=%s,", $entry, $values[$idx]);
} else {
// Function UNIX_TIMESTAMP() detected
$all .= sprintf("%s=%s,", $entry, $values[$idx]);
} else {
}
// Prepares an SQL statement part for HTML mail and/or holiday depency
function PREPARE_SQL_HTML_HOLIDAY ($mode) {
// Exclude no users by default
}
// Prepares an SQL statement part for HTML mail and/or holiday depency
function PREPARE_SQL_HTML_HOLIDAY ($mode) {
// Exclude no users by default
function ADD_CATEGORY_OPTIONS ($mode) {
// Prepare WHERE statement
$whereStatement = " WHERE `visible`='Y'";
function ADD_CATEGORY_OPTIONS ($mode) {
// Prepare WHERE statement
$whereStatement = " WHERE `visible`='Y'";
foreach ($CATS['id'] as $key => $value) {
if (strlen($CATS['name'][$key]) > 20) $CATS['name'][$key] = substr($CATS['name'][$key], 0, 17)."...";
foreach ($CATS['id'] as $key => $value) {
if (strlen($CATS['name'][$key]) > 20) $CATS['name'][$key] = substr($CATS['name'][$key], 0, 17)."...";
-function ADD_BONUS_MAIL_TO_QUEUE ($subject, $text, $receiverList, $points, $seconds, $url, $cat, $mode="normal", $receiver=0) {
+function ADD_BONUS_MAIL_TO_QUEUE ($subject, $text, $receiverList, $points, $seconds, $url, $cat, $mode='normal', $receiver=0) {
array($cat, getConfig('order_select'), getConfig('order_mode'), $receiver), __FUNCTION__, __LINE__);
} else {
// Include all
array($cat, getConfig('order_select'), getConfig('order_mode'), $receiver), __FUNCTION__, __LINE__);
} else {
// Include all
// Inserts user stats
function USER_STATS_INSERT_RECORD ($uid, $type, $data) {
// Is the extension installed and updated?
// Inserts user stats
function USER_STATS_INSERT_RECORD ($uid, $type, $data) {
// Is the extension installed and updated?
function GET_USER_REF_POINTS ($uid, $level) {
//* DEBUG: */ print "----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n";
// Default is no refs and no nickname
function GET_USER_REF_POINTS ($uid, $level) {
//* DEBUG: */ print "----------------------- <font color=\"#00aa00\">".__FUNCTION__." - ENTRY</font> ------------------------<ul><li>\n";
// Default is no refs and no nickname
- if (EXT_IS_ACTIVE("nickname")) {
- $add = ", ud.nickname";
+ if (EXT_IS_ACTIVE('nickname')) {
+ $add = ', ud.nickname';
- $row['points'] = GET_TOTAL_DATA($row['refid'], "user_points", "points") - GET_TOTAL_DATA($row['refid'], "user_data", "used_points");
+ $row['points'] = GET_TOTAL_DATA($row['refid'], 'user_points', 'points') - GET_TOTAL_DATA($row['refid'], 'user_data', 'used_points');
- $row['unconfirmed'] = GET_TOTAL_DATA($row['refid'], "user_links", "id", "userid", true);
+ $row['unconfirmed'] = GET_TOTAL_DATA($row['refid'], 'user_links', 'id', 'userid', true);