./inc/functions.php:1299: // @TODO Remove this if() block if all is working fine
./inc/functions.php:1599: // @TODO This can be, somehow, rewritten
./inc/functions.php:214: // @TODO Remove this sanity-check if all is fine
-./inc/functions.php:2406: // @TODO The status should never be empty
-./inc/functions.php:2497: // @TODO shouldn't do the unset and the reloading $GLOBALS['cache_instance']->destroyCacheFile() Or a new methode like forceCacheReload('revision')?
+./inc/functions.php:2405: // @TODO The status should never be empty
+./inc/functions.php:2496: // @TODO shouldn't do the unset and the reloading $GLOBALS['cache_instance']->destroyCacheFile() Or a new methode like forceCacheReload('revision')?
./inc/functions.php:253: // @TODO Fine all templates which are using these direct variables and rewrite them.
./inc/functions.php:254: // @TODO After this step is done, this else-block is history
-./inc/functions.php:2560:// @TODO Please describe this function
-./inc/functions.php:2572: searchDirsRecursive($next_dir, $last_changed); // @TODO small change to API to $last_changed = searchDirsRecursive($next_dir, $time);
-./inc/functions.php:2655: // @TODO Add a little more infos here
-./inc/functions.php:2666: // @TODO This cannot be rewritten to app_die(), try to find a solution for this.
-./inc/functions.php:2824: // @TODO Are these convertions still required?
-./inc/functions.php:2842:// @TODO Rewrite this function to use readFromFile() and writeToFile()
+./inc/functions.php:2559:// @TODO Please describe this function
+./inc/functions.php:2577: searchDirsRecursive($next_dir, $last_changed); // @TODO small change to API to $last_changed = searchDirsRecursive($next_dir, $time);
+./inc/functions.php:2660: // @TODO Add a little more infos here
+./inc/functions.php:2671: // @TODO This cannot be rewritten to app_die(), try to find a solution for this.
+./inc/functions.php:2829: // @TODO Are these convertions still required?
+./inc/functions.php:2847:// @TODO Rewrite this function to use readFromFile() and writeToFile()
./inc/functions.php:398: // @TODO Extension 'msg' does not exist
./inc/functions.php:477:// @TODO Rewrite this to an extension 'smtp'
./inc/install-inc.php:20: * @TODO Rewrite all constants in this include file *
./inc/libs/cache_functions.php:412: // @TODO Add support for more types which break in last else-block
./inc/libs/doubler_functions.php:46:// @TODO Lame description
./inc/libs/rallye_functions.php:631: $EXPIRE = getConfig('one_day') * 3; // @TODO The hard-coded value...
-./inc/libs/rallye_functions.php:661: // @TODO Rewrite this to a function
-./inc/libs/rallye_functions.php:697: // @TODO Rewrite this to our API function
+./inc/libs/rallye_functions.php:693: // @TODO Rewrite this to our API function
./inc/libs/register_functions.php:53: // @TODO Rewrite these constants
./inc/libs/register_functions.php:62: // @TODO Rewrite these constants, too
./inc/libs/register_functions.php:97:// @TODO This function is no longer used???
./inc/modules/admin/overview-inc.php:447: // @TODO Rewritings: admin->assigned_admin,uid->userid,type->task_type_msg in template
./inc/modules/admin.php:257: // @TODO Rewrite all these constants
./inc/modules/admin.php:95: // @TODO Why is this set to 'done'?
-./inc/modules/admin/what-add_points.php:120: // @TODO Rewrite these both constants
+./inc/modules/admin/what-add_points.php:119: // @TODO Rewrite these both constants
./inc/modules/admin/what-add_points.php:54: // @TODO Rewrite this constant
./inc/modules/admin/what-add_surfbar_url.php:57: // @TODO Find all convertSelectionsToTimestamp() calls and rewrite REQUEST_POST() calls to $POST
./inc/modules/admin/what-admin_add.php:121: // @TODO This can be somehow rewritten to a function
./inc/modules/admin/what-config_mods.php:139: // @TODO Rewritings: mod->module in template
./inc/modules/admin/what-config_mods.php:161: // @TODO Rewrite this constant
./inc/modules/admin/what-config_payouts.php:146: // @TODO Rewrite this constant
-./inc/modules/admin/what-config_payouts.php:232: // @TODO Rewrite this constant
+./inc/modules/admin/what-config_payouts.php:237: // @TODO Rewrite this constant
./inc/modules/admin/what-config_points.php:267: // @TODO Rewritings: lvl->level, per->percents in template
./inc/modules/admin/what-config_rallye_prices.php:203: // @TODO Rewritings: level->price_level, infos->info in template
./inc/modules/admin/what-config_rallye_prices.php:220: // @TODO Rewrite these two constants
./inc/modules/admin/what-config_register.php:68: // @TODO Move this HTML code into a template
./inc/modules/admin/what-config_register.php:85:// @TODO Rewrite this constant
./inc/modules/admin/what-config_rewrite.php:97: // @TODO Rewrite this constant
+./inc/modules/admin/what-del_sponsor.php:58: // @TODO Rewrite these constants
+./inc/modules/admin/what-del_sponsor.php:86: // @TODO Rewrite these constants
./inc/modules/admin/what-del_transfer.php:106:// @TODO Rewrite all these constants
./inc/modules/admin/what-del_transfer.php:76: // @TODO Rewritings: idx->trans_id in template
./inc/modules/admin/what-edit_emails.php:113: // @TODO Yet another constant to rewrite
./inc/modules/admin/what-list_user.php:160: // @TODO Rewrite these to filters
./inc/modules/admin/what-list_user.php:285: // @TODO Rewrite this into a filter
./inc/modules/admin/what-list_user.php:337: // @TODO Rewrite this into a filter
-./inc/modules/admin/what-lock_user.php:133: // @TODO Rewrite these all constants
+./inc/modules/admin/what-lock_user.php:139: // @TODO Rewrite these all constants
./inc/modules/admin/what-logs.php:69: // @TODO Fix content-type here
./inc/modules/admin/what-logs.php:72: // @TODO Fix content-type here
./inc/modules/admin/what-mem_add.php:126: // @TODO This can be somehow rewritten to a function
./inc/modules/admin/what-refbanner.php:150: // @TODO Rewritings: alt->alternate,cnt->counter,clx->clicks in template
./inc/modules/admin/what-refbanner.php:169: // @TODO Rewrite this constant
./inc/modules/admin/what-repair_amnu.php:85:// @TODO This causes the whole (!) menu cache being rebuilded
-./inc/modules/admin/what-send_newsletter.php:86: // @TODO Rewrite this constant
+./inc/modules/admin/what-send_newsletter.php:90: // @TODO Rewrite this constant
./inc/modules/admin/what-sub_points.php:105: // @TODO Rewrite these constants
./inc/modules/admin/what-sub_points.php:53: // @TODO Rewrite this constant
./inc/modules/admin/what-theme_check.php:126: // @TODO Move this HTML code to a template "admin_theme_row"
./inc/modules/member/what-unconfirmed.php:134: // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
./inc/modules/order.php:76: // @TODO Unused: 2,4
./inc/monthly/monthly_bonus.php:71: // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:1574: // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
-./inc/mysql-manager.php:1617: // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:1769: // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:1797: // @TODO Find a way for updating $_CONFIG here
-./inc/mysql-manager.php:1821: // @TODO Find a way for updating $_CONFIG here
-./inc/mysql-manager.php:1844:// @TODO Can this be rewritten to a filter?
-./inc/mysql-manager.php:1906: // @TODO Rewrite this to $content = SQL_FETCHARRAY()
-./inc/mysql-manager.php:209: // @TODO Nothing helped???
-./inc/mysql-manager.php:2200: // @TODO This can be somehow rewritten
-./inc/mysql-manager.php:244: // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:535: // @TODO Try to rewrite this to one or more functions
-./inc/mysql-manager.php:564: // @TODO Try to rewrite this to one or more functions
-./inc/mysql-manager.php:972: // @TODO Why does this lead into an endless loop but we still need it???
-./inc/mysql-manager.php:973: // @TODO Commented out redirectToUrl('admin.php');
+./inc/mysql-manager.php:1575: // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
+./inc/mysql-manager.php:1618: // @TODO Rewrite this to a filter
+./inc/mysql-manager.php:1770: // @TODO Rewrite this to a filter
+./inc/mysql-manager.php:1798: // @TODO Find a way for updating $_CONFIG here
+./inc/mysql-manager.php:1822: // @TODO Find a way for updating $_CONFIG here
+./inc/mysql-manager.php:1845:// @TODO Can this be rewritten to a filter?
+./inc/mysql-manager.php:1907: // @TODO Rewrite this to $content = SQL_FETCHARRAY()
+./inc/mysql-manager.php:212: // @TODO Nothing helped???
+./inc/mysql-manager.php:2205: // @TODO This can be somehow rewritten
+./inc/mysql-manager.php:247: // @TODO Rewrite this to a filter
+./inc/mysql-manager.php:538: // @TODO Try to rewrite this to one or more functions
+./inc/mysql-manager.php:567: // @TODO Try to rewrite this to one or more functions
+./inc/mysql-manager.php:973: // @TODO Why does this lead into an endless loop but we still need it???
+./inc/mysql-manager.php:974: // @TODO Commented out redirectToUrl('admin.php');
./inc/wrapper-functions.php:152:// @TODO Implement $compress
./inc/wrapper-functions.php:159:// @TODO Implement $decompress
-./inc/wrapper-functions.php:391:// @TODO Do some more sanity check here
-./mailid.php:139: // @TODO Rewrite this to a filter
-./mailid.php:184: // @TODO Rewrite these constants
-./mailid.php:220: // @TODO Rewrite this to a filter
-./mailid.php:95: // @TODO Rewrite this to a filter
+./inc/wrapper-functions.php:389:// @TODO Do some more sanity check here
+./mailid.php:140: // @TODO Rewrite this to a filter
+./mailid.php:185: // @TODO Rewrite these constants
+./mailid.php:221: // @TODO Rewrite this to a filter
+./mailid.php:96: // @TODO Rewrite this to a filter
./mailid_top.php:136: // @TODO Rewrite this to a filter
./mailid_top.php:183: // @TODO Rewrite this to a filter
./mailid_top.php:190: // @TODO Rewrite this to a filter
./mailid_top.php:228: // @TODO Rewrite these blocks to filter
./mailid_top.php:89: // @TODO Rewrite this to a filter
./show_bonus.php:108: // @TODO Rewrite this constant
-./surfbar.php:73: // @TODO Display quick login form here or redirect as configured
+./surfbar.php:72: // @TODO Display quick login form here or redirect as configured
### ### DEPRECATION FOLLOWS: ### ###
./inc/functions.php:238: // @DEPRECATED Try to rewrite the if() condition
./inc/functions.php:252: // @DEPRECATED
$GLOBALS['module'] = 'beg';
$GLOBALS['refid'] = 0;
$GLOBALS['output_mode'] = -1;
-$msg = null;
+$errorCode = null;
// Load the required file(s)
require('inc/config-global.php');
array(REQUEST_GET('uid')), __FILE__, __LINE__);
} else {
// Nickname entered but nickname is not active
- $msg = getCode('EXTENSION_PROBLEM');
+ $errorCode = getCode('EXTENSION_PROBLEM');
$uid = -1;
}
} else {
// Remember remote address, userid and timestamp for next click
// but only when there is no admin begging.
// Admins shall be able to test it!
- SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_beg_ips` (userid, remote_ip,sid, timeout) VALUES ('%s','%s','%s', UNIX_TIMESTAMP())",
- array($uid, detectRemoteAddr(), session_id()), __FILE__, __LINE__);
+ SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_beg_ips` (`userid`, `remote_ip`,`sid`, `timeout`) VALUES ('%s','%s','%s', UNIX_TIMESTAMP())",
+ array($uid, detectRemoteAddr(), session_id()), __FILE__, __LINE__);
// Was is successfull?
$pay (SQL_AFFECTEDROWS() == 1);
loadIncludeOnce('inc/footer.php');
} elseif (($status != 'CONFIRMED') && ($status != 'failed')) {
// Maybe locked/unconfirmed account?
- $msg = generateErrorCodeFromUserStatus($status);
+ $errorCode = generateErrorCodeFromUserStatus($status);
} elseif (($uid == '0') || ($status == 'failed')) {
// Inalid or locked account, so let's find out
$result = SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nickname='%s' LIMIT 1",
- array(REQUEST_GET('uid')), __FILE__, __LINE__);
+ array(REQUEST_GET('uid')), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Locked account
- $msg = getCode('ACCOUNT_LOCKED');
+ $errorCode = getCode('ACCOUNT_LOCKED');
} else {
// Invalid nickname! (404)
- $msg = getCode('USER_404');
+ $errorCode = getCode('USER_404');
}
// Free memory
SQL_FREERESULT($result);
} elseif ($uid == getConfig('beg_uid')) {
// Webmaster's ID cannot beg for points!
- $msg = getCode('BEG_SAME_AS_OWN');
+ $errorCode = getCode('BEG_SAME_AS_OWN');
}
// Reload to index module
- if ((!empty($msg)) && (!empty($msg))) redirectToUrl('modules.php?module=index&msg='.$msg.'&ext=beg');
+ if ((!empty($errorCode)) && (!empty($errorCode))) redirectToUrl('modules.php?module=index&msg=' . $errorCode . '&ext=beg');
} else {
// No userid entered
redirectToUrl('modules.php?module=index');
} // END - if
// Remove entry from table
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_birthday` WHERE userid=%s AND chk_value='%s' LIMIT 1",
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_birthday` WHERE `userid`=%s AND `chk_value`='%s' LIMIT 1",
array($uid, $chk), __FILE__, __LINE__);
// "Translate" some data
$uid = 0; $points = 0;
while ($content = SQL_FETCHARRAY($result)) {
// Check if confirmation links are purged or not
- $result_links = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_user_links` WHERE stats_id=%s LIMIT 1",
+ $result_links = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_user_links` WHERE `stats_id`=%s LIMIT 1",
array(bigintval($content['id'])), __FILE__, __LINE__);
if (SQL_NUMROWS($result_links) == 1) {
// Free memory
$uid = $content['userid']; $points += $content['price']; $admin_points += $content['price'];
// Remove confirmation links from queue
- ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE stats_id=%s",
+ ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE `stats_id`=%s",
array(bigintval($content['id'])), __FILE__, __LINE__, false));
// Update status of order
- ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET data_type='DELETED' WHERE `id`=%s LIMIT 1",
+ ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET `data_type`='DELETED' WHERE `id`=%s LIMIT 1",
array(bigintval($content['pool_id'])), __FILE__, __LINE__, false));
} // END - if
} // END - while
// Is the 'bonus' extension installed and activated?
if (EXT_IS_ACTIVE('bonus', true)) {
// Check for bonus campaigns
- $result = SQL_QUERY_ESC("SELECT id, points FROM `{!_MYSQL_PREFIX!}_bonus` WHERE data_type='SEND' AND timestamp <= %s ORDER BY `id`",
- array(bigintval($PURGE)), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT `id`, `points` FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `data_type`='SEND' AND timestamp <= %s ORDER BY `id`",
+ array(bigintval($PURGE)), __FILE__, __LINE__);
if (SQL_NUMROWS($result) > 0) {
// Start deleting procedure
$points = 0;
while ($content = SQL_FETCHARRAY($result)) {
// Check if confirmation links are purged or not
- $result_links = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_user_links` WHERE bonus_id=%s",
+ $result_links = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_user_links` WHERE `bonus_id`=%s",
array(bigintval($content['id'])), __FILE__, __LINE__);
if (SQL_NUMROWS($result_links) > 0) {
// At least one link was found, enougth to pay back the points
SQL_FREERESULT($result_links);
// Remove confirmation links from queue
- ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE bonus_id=%s",
+ ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE `bonus_id`=%s",
array(bigintval($content['id'])), __FILE__, __LINE__, false));
// Update status of order
- ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_bonus` SET data_type='DELETED' WHERE `id`=%s LIMIT 1",
+ ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_bonus` SET `data_type`='DELETED' WHERE `id`=%s LIMIT 1",
array(bigintval($content['id'])), __FILE__, __LINE__, false));
} // END - if
} // END - while
$content['last_online'] = generateDateTime($content['last_online'], '0');
// Load mail template
- $msg = LOAD_EMAIL_TEMPLATE("member_autopurge_inactive", $content['last_online'], bigintval($content['userid']));
- sendEmail($content['email'], getMessage('AUTOPURGE_MEMBER_INACTIVE_SUBJECT'), $msg);
+ $message = LOAD_EMAIL_TEMPLATE("member_autopurge_inactive", $content['last_online'], bigintval($content['userid']));
+ sendEmail($content['email'], getMessage('AUTOPURGE_MEMBER_INACTIVE_SUBJECT'), $message);
// Update this account
ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `ap_notified`=UNIX_TIMESTAMP() WHERE `userid`=%s LIMIT 1",
// Okay, let's check for them...
$result_mails = SQL_QUERY_ESC("SELECT `sender`
FROM `{!_MYSQL_PREFIX!}_pool`
-WHERE data_type='DELETED' AND `timestamp` <= (UNIX_TIMESTAMP() - %s)
+WHERE `data_type`='DELETED' AND `timestamp` <= (UNIX_TIMESTAMP() - %s)
ORDER BY `sender` ASC",
array(getConfig('ap_dm_timeout')), __FILE__, __LINE__);
// Reset query (to prevent possible errors) ...;
$result_mails = SQL_QUERY_ESC("SELECT `sender`
FROM `{!_MYSQL_PREFIX!}_pool`
-WHERE data_type='DELETED' AND timestamp <= (UNIX_TIMESTAMP() - %s)
+WHERE `data_type`='DELETED' AND timestamp <= (UNIX_TIMESTAMP() - %s)
ORDER BY `sender` ASC",
array(getConfig('ap_dm_timeout')), __FILE__, __LINE__);
}
// Reset query (to prevent possible errors) ...
$result_mails = SQL_QUERY_ESC("SELECT `sender`
FROM `{!_MYSQL_PREFIX!}_user_stats`
-WHERE data_type='DELETED' AND timestamp_send <= (UNIX_TIMESTAMP() - %s)
+WHERE `data_type`='DELETED' AND timestamp_send <= (UNIX_TIMESTAMP() - %s)
ORDER BY `sender` ASC",
array(getConfig('ap_dm_timeout')), __FILE__, __LINE__);
}
if (!isCodeSet($key)) {
// Abort here
trigger_error(sprintf("%s[%s:] Code %s is not set.",
- __FUNCTION__,
- __LINE__,
- $key
+ __FUNCTION__,
+ __LINE__,
+ $key
));
} // END - if
);
// Load mail template and send mail away...
- $msg = LOAD_EMAIL_TEMPLATE('member_doubler', $content, $content['userid']);
- sendEmail($content['userid'], getMessage('DOUBLER_MEMBER_SUBJECT'), $msg);
+ $message = LOAD_EMAIL_TEMPLATE('member_doubler', $content, $content['userid']);
+ sendEmail($content['userid'], getMessage('DOUBLER_MEMBER_SUBJECT'), $message);
} // END - if
} // END - while
} // END - if
if ($test === true) {
// "Dry-run-mode" activated?
if ((!$dry_run) && (!EXT_IS_ON_REMOVAL_LIST())) {
- //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, " ext_name=".EXT_GET_CURR_NAME());
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "ext_name=".EXT_GET_CURR_NAME());
// Init SQLs and transfer ext->generic
INIT_SQLS();
SET_SQLS(GET_EXT_SQLS());
// Check if task is not there
if (DETERMINE_TASK_ID_BY_SUBJECT($subject) == 0) {
// Task not created so it's a brand-new extension which we need to register and create a task for!
- SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (assigned_admin, userid, status, task_type, subject, text, task_created) VALUES ('%s','0','NEW','EXTENSION_UPDATE','%s','%s', UNIX_TIMESTAMP())",
- array($admin_id, $subject, $notes), __FUNCTION__, __LINE__);
+ createNewTask($subject, $notes, 'EXTENSION_UPDATE', 0, $admin_id);
} // END - if
} // END - if
}
function CREATE_NEW_EXTENSION_TASK ($admin_id, $subject, $ext) {
// Not installed and do we have created a task for the admin?
if ((DETERMINE_TASK_ID_BY_SUBJECT($subject) == 0) && (GET_EXT_VERSION($ext) == '')) {
+ // Set default message if ext-foo is missing
+ $message = sprintf(getMessage('ADMIN_EXT_TEXT_FILE_MISSING'), $ext);
+
// Template file
$tpl = sprintf("%stemplates/%s/html/ext/ext_%s.tpl",
- constant('PATH'),
- getLanguage(),
- $ext
+ constant('PATH'),
+ getLanguage(),
+ $ext
);
- // Set default message if ext-foo is missing
- $msg = sprintf(getMessage('ADMIN_EXT_TEXT_FILE_MISSING'), $ext);
-
// Load text for task if found
if (isFileReadable($tpl)) {
// Load extension's own text template (HTML!)
- $msg = LOAD_TEMPLATE('ext_' . $ext, true);
+ $message = LOAD_TEMPLATE('ext_' . $ext, true);
} else {
// Write this in debug.log as well
- DEBUG_LOG(__FUNCTION__, __LINE__, $msg);
+ DEBUG_LOG(__FUNCTION__, __LINE__, $message);
}
// Task not created so it's a brand-new extension which we need to register and create a task for!
- SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (assigned_admin, userid, status, task_type, subject, text, task_created)
-VALUES (%s, 0, 'NEW', 'EXTENSION', '%s', '%s', UNIX_TIMESTAMP())",
- array(
- $admin_id,
- $subject,
- smartAddSlashes($msg),
- ), __FUNCTION__, __LINE__, true, false, false
- );
+ createNewTask($subject, $message, 'EXTENSION_UPDATE', 0, $admin_id, false);
} // END - if
}
// Not installed and do we have created a task for the admin?
if ((DETERMINE_TASK_ID_BY_SUBJECT($subject) == 0) && (GET_EXT_VERSION($ext) != '')) {
// Task not created so add it
- SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (assigned_admin, userid, status, task_type, subject, text, task_created)
-VALUES (0, 0, 'NEW', 'EXTENSION_DEACTIVATION', '%s', '%s', UNIX_TIMESTAMP())",
- array(
- $subject,
- SQL_ESCAPE(LOAD_TEMPLATE('task_ext_deactivated', true, $ext)),
- ), __FUNCTION__, __LINE__, true, false
- );
+ createNewTask($subject, SQL_ESCAPE(LOAD_TEMPLATE('task_ext_deactivated', true, $ext)), 'EXTENSION_DEACTIVATION');
} // END - if
}
}
} elseif ((GET_EXT_VERSION('sql_patches') >= '0.3.6') && ((!EXT_IS_ACTIVE('cache')) || ($forceDb === true))) {
// Check database for entry
- $result = SQL_QUERY_ESC("SELECT has_menu FROM `{!_MYSQL_PREFIX!}_mod_reg` WHERE `module`='%s' LIMIT 1",
- array($mod), __FUNCTION__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT `has_menu` FROM `{!_MYSQL_PREFIX!}_mod_reg` WHERE `module`='%s' LIMIT 1",
+ array($mod), __FUNCTION__, __LINE__);
// Entry found?
if (SQL_NUMROWS($result) == 1) {
$task_id = 0;
// Search for extension task's id
- $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_task_system` WHERE task_type='EXTENSION' AND subject='[%s:]' LIMIT 1",
- array($ext_name), __FUNCTION__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_task_system` WHERE `task_type`='EXTENSION' AND `subject`='[%s:]' LIMIT 1",
+ array($ext_name), __FUNCTION__, __LINE__);
// Entry found?
if (SQL_NUMROWS($result) == 1) {
$task_id = 0;
// Search for task id
- $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_task_system` WHERE subject LIKE '%s%%' LIMIT 1",
- array($subject), __FUNCTION__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_task_system` WHERE `subject` LIKE '%s%%' LIMIT 1",
+ array($subject), __FUNCTION__, __LINE__);
// Entry found?
if (SQL_NUMROWS($result) == 1) {
break;
case '0.6.8': // SQL queries for v0.6.8
- ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_bonus` SET data_type='SEND' WHERE data_type != 'SEND' AND data_type != 'DELETED' AND receivers='' AND target_send='0'");
+ ADD_EXT_SQL("UPDATE `{!_MYSQL_PREFIX!}_bonus` SET `data_type`='SEND' WHERE `data_type` != 'SEND' AND `data_type` != 'DELETED' AND `receivers`='' AND `target_send`='0'");
// Update notes (these will be set as task text!)
EXT_SET_UPDATE_NOTES("Eingegebene Anzahl auszusendener Bonus-Mails wurde bei der Empfänderauswahl nicht berücksichtigt. Zudem wird jetzt das eingestellte Auswahlverfahren mitberücksichtigt.");
// Filter for running SQL commands
function FILTER_RUN_SQLS ($data) {
// Debug message
- //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, " - Entered!");
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "- Entered!");
// Is the array there?
if ((IS_SQLS_VALID()) && ((!isset($data['dry_run'])) || ($data['dry_run'] == false))) {
// Run SQL commands
- //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, " - Found ".COUNT_SQLS()." queries to run.");
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "- Found ".COUNT_SQLS()." queries to run.");
foreach (GET_SQLS() as $sql) {
// Trim spaces away
$sql = trim($sql);
} // END - if
// Debug message
- //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, " - Left!");
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "- Left!");
}
// Filter for updating/validating login data
setUserId(getSession('userid'));
// Load last module and last online time
- $result = SQL_QUERY_ESC("SELECT last_module, last_online FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `last_module`, `last_online` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
array(getUserId()), __FUNCTION__, __LINE__);
// Entry found?
if (SQL_NUMROWS($result) == 1) {
// Load last module and online time
- list($mod, $onl) = SQL_FETCHROW($result);
+ $DATA = SQL_FETCHARRAY($result);
// Maybe first login time?
- if (empty($mod)) $mod = 'login';
+ if (empty($DATA['last_module'])) $DATA['last_module'] = 'login';
// This will be displayed on welcome page! :-)
if (empty($GLOBALS['last']['module'])) {
- $GLOBALS['last']['module'] = $mod; $GLOBALS['last']['online'] = $onl;
+ $GLOBALS['last']['module'] = $DATA['last_module']; $GLOBALS['last']['online'] = $DATA['last_online'];
} // END - if
// 'what' not set?
} // END - if
// Update last module / online time
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `last_module`='%s', last_online=UNIX_TIMESTAMP(), REMOTE_ADDR='%s' WHERE userid=%s LIMIT 1",
- array(getWhat(), detectRemoteAddr(), getUserId()), __FUNCTION__, __LINE__);
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `last_module`='%s', `last_online`=UNIX_TIMESTAMP(), `REMOTE_ADDR`='%s' WHERE `userid`=%s LIMIT 1",
+ array(
+ getWhat(),
+ detectRemoteAddr(),
+ getUserId()
+ ), __FUNCTION__, __LINE__);
} else {
// Destroy session, we cannot update!
destroyUserSession();
$regex = '@^' . $first . '\@' . $domain . '$@iU';
// Return check result
- // @NOTE altered the regex-pattern and added modificator i (match both upper and lower case letters) and U (PCRE_UNGREEDY) to work with preg_match the same way as eregi
return preg_match($regex, $email);
}
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):dir=" . $dir."<br />\n";
// Does it match what we are looking for? (We skip a lot files already!)
// RegexPattern to exclude ., .., .revision, .svn, debug.log or .cache in the filenames
- $excludePattern = '@(\.|\.\.|\.revision|\.svn|debug\.log|\.cache|config\.php)$@';
- $ds = getArrayFromDirectory($dir, '', true, false, $excludePattern);
+ $excludePattern = '@(\.revision|debug\.log|\.cache|config\.php)$@';
+ $ds = getArrayFromDirectory($dir, '', true, false, array(), '.php', $excludePattern);
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):ds[]=".count($ds)."<br />\n";
// Walk through all entries
foreach ($ds as $d) {
// Generate proper FQFN
- $FQFN = str_replace("//", '/', constant('PATH') . $dir. '/'. $d);
+ $FQFN = str_replace('//', '/', constant('PATH') . $dir. '/'. $d);
// Is it a file and readable?
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):FQFN={$FQFN}<br />\n";
// @TODO Please describe this function
function getArrayFromActualVersion () {
// Init variables
- $next_dir = ''; // Directory to start with search
+ $next_dir = '';
+
+ // Directory to start with search
$last_changed = array(
'path_name' => '',
'time' => 0
);
- $akt_vers = array(); // Init return array
- $res = 0; // Init value for counting the founded keywords
+
+ // Init return array
+ $akt_vers = array();
+
+ // Init value for counting the founded keywords
+ $res = 0;
// Searches all Files and there date of the last modifikation and puts the newest File in $last_changed.
searchDirsRecursive($next_dir, $last_changed); // @TODO small change to API to $last_changed = searchDirsRecursive($next_dir, $time);
return false;
} elseif (!isCacheInstanceValid()) {
// No cache instance!
- DEBUG_LOG(__FUNCTION__, __LINE__, " No cache instance found.");
+ DEBUG_LOG(__FUNCTION__, __LINE__, 'No cache instance found.');
return false;
} elseif ((!isConfigEntrySet('cache_admin_menu')) || (getConfig('cache_admin_menu') != 'Y')) {
// Caching disabled (currently experiemental!)
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_MORE_SELECTED'));
} else {
// Debug log
- DEBUG_LOG(__FUNCTION__, __LINE__, " cat={$data['cat']},receiver={$data['receiver']},data=".base64_encode(serialize($data))." More selected, than available!");
+ DEBUG_LOG(__FUNCTION__, __LINE__, "cat={$data['cat']},receiver={$data['receiver']},data=".base64_encode(serialize($data))." More selected, than available!");
}
}
return $message;
}
+// Reads a directory recursively by default and searches for files not matching
+// an exclusion pattern. You can now keep the exclusion pattern empty for reading
+// a whole directory.
+function getArrayFromDirectory ($baseDir, $prefix, $fileIncludeDirs = false, $addBaseDir = true, $excludeArray = array(), $extension = '.php', $excludePattern = '@(\.|\.\.)$@', $recursive = true) {
+ // Add default entries we should exclude
+ $excludeArray[] = '.';
+ $excludeArray[] = '..';
+ $excludeArray[] = '.svn';
+ $excludeArray[] = '.htaccess';
+
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "baseDir={$baseDir},prefix={$prefix} - Entered!");
+ // Init includes
+ $files = array();
+
+ // Open directory
+ $dirPointer = opendir(constant('PATH') . $baseDir) or app_die(__FUNCTION__, __LINE__, 'Cannot read directory ' . basename($baseDir) . '.');
+
+ // Read all entries
+ while ($baseFile = readdir($dirPointer)) {
+ // Exclude '.', '..' and entries in $excludeArray automatically
+ if (in_array($baseFile, $excludeArray, true)) {
+ // Exclude them
+ //* DEBUG: */ print 'excluded=' . $baseFile . '<br />';
+ continue;
+ } // END - if
+
+ // Construct include filename and FQFN
+ $fileName = $baseDir . '/' . $baseFile;
+ $FQFN = constant('PATH') . $fileName;
+
+ // Remove double slashes
+ $FQFN = str_replace('//', '/', $FQFN);
+
+ // Check if the base filename matches an exclusion pattern and if the pattern is not empty
+ if ((!empty($excludePattern)) && (preg_match($excludePattern, $baseFile, $match))) {
+ // These Lines are only for debugging!!
+ //* DEBUG: */ print 'baseDir:' . $baseDir . '<br />';
+ //* DEBUG: */ print 'baseFile:' . $baseFile . '<br />';
+ //* DEBUG: */ print 'FQFN:' . $FQFN . '<br />';
+
+ // Exclude this one
+ continue;
+ } // END - if
+
+ // Skip also files with non-matching prefix genericly
+ if (($recursive === true) && (isDirectory($FQFN))) {
+ // Is a redirectory so read it as well
+ $files = merge_array($files, getArrayFromDirectory ($baseDir . $baseFile . '/', $prefix, $fileIncludeDirs, $addBaseDir, $excludeArray, $extension, $excludePattern, $recursive));
+
+ // And skip further processing
+ continue;
+ } elseif (substr($baseFile, 0, strlen($prefix)) != $prefix) {
+ // Skip this file
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "Invalid prefix in file " . $baseFile . ", prefix=" . $prefix);
+ continue;
+ } elseif (!isFileReadable($FQFN)) {
+ // Not readable so skip it
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "File " . $FQFN . " is not readable!");
+ continue;
+ }
+
+ // Is the file a PHP script or other?
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "baseDir={$baseDir},prefix={$prefix},baseFile={$baseFile}");
+ if ((substr($baseFile, -4, 4) == '.php') || (($fileIncludeDirs === true) && (isDirectory($FQFN)))) {
+ // Is this a valid include file?
+ if ($extension == '.php') {
+ // Remove both for extension name
+ $extName = substr($baseFile, strlen($prefix), -4);
+
+ // Try to find it
+ $extId = GET_EXT_ID($extName);
+
+ // Is the extension valid and active?
+ if (($extId > 0) && (EXT_IS_ACTIVE($extName))) {
+ // Then add this file
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, 'Extension entry ' . $baseFile . ' added.');
+ $files[] = $fileName;
+ } elseif ($extId == 0) {
+ // Add non-extension files as well
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, 'Regular entry ' . $baseFile . ' added.');
+ if ($addBaseDir === true) {
+ $files[] = $fileName;
+ } else {
+ $files[] = $baseFile;
+ }
+ }
+ } else {
+ // We found .php file but should not search for them, why?
+ debug_report_bug('We should find files with extension=' . $extension . ', but we found a PHP script.');
+ }
+ } else {
+ // Other, generic file found
+ $files[] = $fileName;
+ }
+ } // END - while
+
+ // Close directory
+ closedir($dirPointer);
+
+ // Sort array
+ asort($files);
+
+ // Return array with include files
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, '- Left!');
+ return $files;
+}
+
//////////////////////////////////////////////////
// AUTOMATICALLY RE-GENERATED MISSING FUNCTIONS //
//////////////////////////////////////////////////
return is_writeable(dirname($FQFN));
}
-// Reads a directory with PHP files in and gets only files back
-function getArrayFromDirectory ($baseDir, $prefix, $includeDirs = false, $addBaseDir = true, $excludePattern = '@(\.|\.\.)$@') {
- //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "baseDir={$baseDir},prefix={$prefix} - Entered!");
- // Init includes
- $INCs = array();
-
- // Open directory
- $dirPointer = opendir(constant('PATH') . $baseDir) or app_die(__FUNCTION__, __LINE__, 'Cannot read '.basename($baseDir).' path!');
-
- // Read all entries
- while ($baseFile = readdir($dirPointer)) {
- // Steps over this returned $baseFile-Name, when it matches the $excludePattern
- if (preg_match($excludePattern, $baseFile, $match)) {
- // These Lines are only for debugging!!
- //$INC = $baseDir . '/' . $baseFile;
- //$FQFN = constant('PATH') . $INC;
- //echo '<pre>$baseDir:'.print_r($baseDir, true).'</pre>';
- //echo '<pre>$baseDir:'.print_r(constant('PATH') . $baseDir, true).'</pre>';
- //echo '<pre>constant(\'PATH\'):'.print_r(constant('PATH'), true).'</pre>';
- //echo '<pre>$FQFN:'.print_r($FQFN, true).'</pre>';
- continue;
- } // END - if
-
- // Construct include filename and FQFN
- $INC = $baseDir . '/' . $baseFile;
- $FQFN = constant('PATH') . $INC;
-
- // repalecment of // to / is needed, whenn $baseDir is an emty String
- $FQFN = str_replace('//', '/', $FQFN);
-
- // Is this a valid reset file?
- //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "baseDir={$baseDir},prefix={$prefix},baseFile={$baseFile}");
- if (((isFileReadable($FQFN)) && (substr($baseFile, 0, strlen($prefix)) == $prefix) && (substr($baseFile, -4, 4) == '.php')) || (($includeDirs) && (isDirectory($FQFN)))) {
- // Remove both for extension name
- $extName = substr($baseFile, strlen($prefix), -4);
-
- // Try to find it
- $extId = GET_EXT_ID($extName);
-
- // Is the extension valid and active?
- if (($extId > 0) && (EXT_IS_ACTIVE($extName))) {
- // Then add this file
- //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, " Extension entry ".$baseFile." added.");
- $INCs[] = $INC;
- } elseif ($extId == 0) {
- // Add non-extension files as well
- //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, " Regular entry ".$baseFile." added.");
- if ($addBaseDir) {
- $INCs[] = $INC;
- } else {
- $INCs[] = $baseFile;
- }
- }
- } // END - if
- } // END - while
-
- // Close directory
- closedir($dirPointer);
-
- // Sort array
- asort($INCs);
-
- // Return array with include files
- //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, " - Left!");
- return $INCs;
-}
-
// Init INC_POOL
function INIT_INC_POOL () {
$GLOBALS['inc_pool'] = array();
} // END - if
// Send out mail to user
- $msg = LOAD_EMAIL_TEMPLATE('member_autopurge_points', translateComma($points), $uid);
- sendEmail($uid, getMessage('AUTOPURGE_MEMBER_SUBJECT'), $msg);
+ $message = LOAD_EMAIL_TEMPLATE('member_autopurge_points', translateComma($points), $uid);
+ sendEmail($uid, getMessage('AUTOPURGE_MEMBER_SUBJECT'), $message);
}
}
);
// Send mail to user
- $msg = LOAD_EMAIL_TEMPLATE("member_holiday_unlock", $content, $content['userid']);
- sendEmail($content['userid'], getMessage('HOLIDAY_MEMBER_UNLOCK_SUBJ'), $msg);
+ $message = LOAD_EMAIL_TEMPLATE("member_holiday_unlock", $content, $content['userid']);
+ sendEmail($content['userid'], getMessage('HOLIDAY_MEMBER_UNLOCK_SUBJ'), $message);
// Remember userid for admin
$admin .= $content['userid']."\n";
} // END - if
// Now search for the user
- $result = SQL_QUERY_ESC("SELECT timestamp FROM `{!_MYSQL_PREFIX!}_online` WHERE sid='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `timestamp` FROM `{!_MYSQL_PREFIX!}_online` WHERE sid='%s' LIMIT 1",
array(session_id()), __FUNCTION__, __LINE__);
// Entry found?
if (SQL_NUMROWS($result) == 1) {
// Then update it
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_online` SET
-`module`='%s',
-`action`='%s',
-`what`='%s',
-userid=%s,
-refid=%s,
-is_member='%s',
-is_admin='%s',
-timestamp=UNIX_TIMESTAMP(),
-ip='%s'
-WHERE sid='%s' LIMIT 1",
+ SQL_QUERY_ESC("UPDATE
+ `{!_MYSQL_PREFIX!}_online`
+SET
+ `module`='%s',
+ `action`='%s',
+ `what`='%s',
+ `userid`=%s,
+ `refid`=%s,
+ `is_member`='%s',
+ `is_admin`='%s',
+ `timestamp`=UNIX_TIMESTAMP(),
+ `ip`='%s'
+WHERE
+ sid`='%s'
+LIMIT 1",
array(
getModule(),
getAction(),
), __FUNCTION__, __LINE__);
} else {
// No entry does exists so we simply add it!
- SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_online` (module, action, what, userid, refid, is_member, is_admin, timestamp, sid, ip) VALUES ('%s','%s','%s', %s, %s, '%s','%s', UNIX_TIMESTAMP(), '%s','%s')",
- array(
- getModule(),
- getAction(),
- getWhat(),
- $uid,
- $rid,
- $MEM,
- $ADMIN,
- session_id(),
- detectRemoteAddr()
- ), __FUNCTION__, __LINE__);
+ SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_online` (`module`, `action`, `what`, `userid`, `refid`, `is_member`, `is_admin`, `timestamp`, `sid`, `ip`) VALUES ('%s','%s','%s', %s, %s, '%s','%s', UNIX_TIMESTAMP(), '%s','%s')",
+ array(
+ getModule(),
+ getAction(),
+ getWhat(),
+ $uid,
+ $rid,
+ $MEM,
+ $ADMIN,
+ session_id(),
+ detectRemoteAddr()
+ ), __FUNCTION__, __LINE__);
}
// Free result
SQL_FREERESULT($result);
// Purge old entries
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_online` WHERE timestamp <= (UNIX_TIMESTAMP() - %s)",
- array(getConfig('online_timeout')), __FUNCTION__, __LINE__);
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_online` WHERE `timestamp` <= (UNIX_TIMESTAMP() - %s)",
+ array(getConfig('online_timeout')), __FUNCTION__, __LINE__);
}
//
// Shall I notify this member?
if (($notify == 'Y') && ($un)) {
// Load email template and send it to the user
- $msg = LOAD_EMAIL_TEMPLATE("member_rallye_notify", array('prices' => $prices), $content['userid']);
- sendEmail($content['userid'], sprintf(getMessage('RALLYE_MEMBER_NOTIFY'), $title), $msg);
+ $message = LOAD_EMAIL_TEMPLATE("member_rallye_notify", array('prices' => $prices), $content['userid']);
+ sendEmail($content['userid'], sprintf(getMessage('RALLYE_MEMBER_NOTIFY'), $title), $message);
} // END - if
} // END - while
$DATA['min_prices'] = RALLYE_DETERMINE_MIN_PRICES($min_prices);
// Send notification to member
- $msg = LOAD_EMAIL_TEMPLATE("member_rallye_notify", array('prices' => $prices), $uid);
- sendEmail($uid, sprintf(getMessage('RALLYE_MEMBER_NOTIFY'), $title), $msg);
+ $message = LOAD_EMAIL_TEMPLATE("member_rallye_notify", array('prices' => $prices), $uid);
+ sendEmail($uid, sprintf(getMessage('RALLYE_MEMBER_NOTIFY'), $title), $message);
} // END - if
} // END - if
}
// Check status
// active = 1: account is still confirmed
// active = 0: account is deleted or locked
- $result = SQL_QUERY_ESC("SELECT COUNT(userid) AS active
-FROM `{!_MYSQL_PREFIX!}_user_data`
-WHERE userid=%s AND `status`='CONFIRMED'
-LIMIT 1", array(bigintval($uid)), __FUNCTION__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT
+ COUNT(`userid`) AS active
+FROM
+ `{!_MYSQL_PREFIX!}_user_data`
+WHERE
+ `userid`=%s AND `status`='CONFIRMED'
+LIMIT 1",
+ array(bigintval($uid)), __FUNCTION__, __LINE__);
list($active) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
} // END - if
// Expire rallye
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET expired='Y' WHERE `id`=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_rallye_data` SET `expired`='Y' WHERE `id`=%s LIMIT 1",
array(bigintval($id)), __FUNCTION__, __LINE__);
// Run array through (by uid is the most important 2nd-level-array)
// Determine winner level
if ($DATA['level'] == 1) {
// The winner!
- $winnerLevel = "_gold";
+ $winnerLevel = '_gold';
} elseif ($DATA['level'] == 2) {
// The vice winner!
- $winnerLevel = "_silver";
+ $winnerLevel = '_silver';
} elseif ($DATA['level'] == 3) {
// The bronce winner
- $winnerLevel = "_bronce";
+ $winnerLevel = '_bronce';
}
if ($DATA['points'] > 0) {
$DATA['infos'] = $DATA['info'];
} else {
// Take points
- $DATA['infos'] = $DATA['points']." {!POINTS!}";
+ $DATA['infos'] = $DATA['points'] . ' {!POINTS!}';
}
// Add suffix to template name
- $template = "member_rallye_expired".$winnerLevel;
+ $template = 'member_rallye_expired' . $winnerLevel;
// Load template
- $msg = LOAD_EMAIL_TEMPLATE($template, $DATA, $uid);
- sendEmail($uid, sprintf(getMessage('RALLYE_MEMBER_EXPIRED_SUBJ'), $DATA['level']), $msg);
+ $message = LOAD_EMAIL_TEMPLATE($template, $DATA, $uid);
+ sendEmail($uid, sprintf(getMessage('RALLYE_MEMBER_EXPIRED_SUBJ'), $DATA['level']), $message);
} // END - if
// Count userid
sendAdminNotification(sprintf(getMessage('RALLYE_ADMIN_EXPIRED_SUBJ'), $title), $templ, $cnt, 0);
// Add task
- SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (status, task_type, subject, text, task_created)
-VALUES ('NEW','RALLYE_EXPIRED','{--RALLYE_ADMIN_EXPIRED--}: %s','{--RALLYE_ADMIN_EXPIRED_TEXT--}',UNIX_TIMESTAMP())",
- array($title), __FUNCTION__, __LINE__);
-
- // All work done here...
+ createNewTask('{--RALLYE_ADMIN_EXPIRED--}: ' . $title, '{--RALLYE_ADMIN_EXPIRED_TEXT--}', 'RALLYE_EXPIRED');
}
//
$ret = '';
// Load users
- $result = SQL_QUERY_ESC("SELECT userid, gender, surname, family, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid IN(%s) AND `status`='CONFIRMED' ORDER BY userid LIMIT %s",
- array($uid_string, count($uids_array)), __FUNCTION__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT `userid`, `gender`, `surname`, `family`, `email` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid` IN(%s) AND `status`='CONFIRMED' ORDER BY `userid` ASC LIMIT %s",
+ array($uid_string, count($uids_array)), __FUNCTION__, __LINE__);
while ($content = SQL_FETCHARRAY($result)) {
// Construct the message masked and add it
$ret .= sprintf("%s %s %s (%s) - %s\n",
// Purge whole rallye
ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_data` WHERE `id`=%s LIMIT 1",
- array(bigintval($content['id'])), __FUNCTION__, __LINE__, false));
+ array(bigintval($content['id'])), __FUNCTION__, __LINE__, false));
ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_prices` WHERE rallye_id=%s LIMIT 1",
- array(bigintval($content['id'])), __FUNCTION__, __LINE__, false));
+ array(bigintval($content['id'])), __FUNCTION__, __LINE__, false));
ADD_SQL(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_users` WHERE rallye_id=%s LIMIT 1",
- array(bigintval($content['id'])), __FUNCTION__, __LINE__, false));
+ array(bigintval($content['id'])), __FUNCTION__, __LINE__, false));
// Add task
- // @TODO Rewrite this to a function
- ADD_SQL(SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (status, task_type, subject, text, task_created)
-VALUES ('NEW','RALLYE_PURGED','{--RALLYE_ADMIN_PURGED--}: %s','{--RALLYE_ADMIN_PURGED_TEXT--}',UNIX_TIMESTAMP())",
- array($content['title']), __FUNCTION__, __LINE__, false));
+ createNewTask('{--RALLYE_ADMIN_PURGED--}: ' . $content['title'], '{--RALLYE_ADMIN_PURGED_TEXT--}', 'RALLYE_PURGED');
} // END - while
// Run all SQLs
}
//
-function RALLYE_TEMPLATE_SELECTION ($name="template", $default = '') {
+function RALLYE_TEMPLATE_SELECTION ($name = 'template', $default = '') {
+ // Init variables
+ $OUT = '';
+ $ral = array();
+
// Check templates directory
- $OUT = ''; $ral = array();
- $basePath = sprintf("%stemplates/%s/html/rallye/", constant('PATH'), getLanguage());
- $dir = opendir($basePath) or mxchange_die(sprintf("Cannot open dir %s.", $basePath));
- while ($read = readdir($dir)) {
- // If it is no dir (so a file)
- if (!isDirectory($basePath.$read)) {
- // Accept only templates matching with rallye_????.tpl.xx
- if (eregi("^rallye_.*\.tpl", $read)) {
- $read = substr($read, 7, strpos($read, '.') - 7);
- // Accept only template names between 1 and 255 chars length
- if ((strlen($read) < 256) && (!empty($read))) $ral[] = $read;
- } // END - if
- } // END - if
+ $basePath = sprintf("templates/%s/html/rallye/", getLanguage());
+
+ // Read the directory
+ $templates = getArrayFromDirectory($basePath, 'rallye_', false, true, array(), '.tpl');
+
+ // And walk through
+ foreach ($templates as $read) {
+ // Cut prefix and extension away
+ $read = substr($read, 7, strpos($read, '.') - 7);
+
+ // Accept only template names between 1 and 255 chars length
+ if ((strlen($read) < 256) && (!empty($read))) $ral[] = $read;
} // END - while
- closedir($dir);
// Do we have found templates which we can link with the new rallye?
if (!empty($ral[0])) {
}
//
-function RALLYE_GET_REFCOUNT ($uid, $old=0) {
+function RALLYE_GET_REFCOUNT ($uid, $old = 0) {
// Check current refs
if (GET_EXT_VERSION('cache') >= '0.1.2') {
// Get refs from cache
} else {
// Debug log
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): NO ENTRY FOUND! :-(<br />\n";
- DEBUG_LOG(__FUNCTION__, __LINE__, " uid={$uid},ref={$ref} - No entry found! :-(");
+ DEBUG_LOG(__FUNCTION__, __LINE__, "uid={$uid},ref={$ref} - No entry found! :-(");
}
// Free result
return $ret;
}
//
-function SPONSOR_GET_MESSAGE ($msg, $pos, $array) {
+function SPONSOR_GET_MESSAGE ($message, $pos, $array) {
// Check if the requested message was found in array
if (isset($array[$pos])) {
// ... if yes then use it!
$ret = $array[$pos];
} else {
// ... else use default message
- $ret = $msg;
+ $ret = $message;
}
// Return result
$ret = false;
if ((isSessionVariableSet('sponsorid')) && (isSessionVariableSet('sponsorpass'))) {
// Check cookies against database records...
- $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_sponsor_data`
-WHERE `id`='%s' AND password='%s' AND `status`='CONFIRMED' LIMIT 1",
- array(bigintval(getSession('sponsorid')), getSession('sponsorpass')), __FUNCTION__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT
+ `id`
+FROM
+ `{!_MYSQL_PREFIX!}_sponsor_data`
+WHERE
+ `id`='%s' AND `password`='%s' AND `status`='CONFIRMED'
+LIMIT 1",
+ array(
+ bigintval(getSession('sponsorid')),
+ getSession('sponsorpass')
+ ), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// All is fine
$ret = true;
- }
+ } // END - if
// Free memory
SQL_FREERESULT($result);
- }
+ } // END - if
// Return status
return $ret;
$performed = call_user_func_array($functionName, $urlData);
} else {
// Log invalid request
- DEBUG_LOG(__FUNCTION__, __LINE__, " action={$formData['action']},id={$formData['id']},function={$functionName}");
+ DEBUG_LOG(__FUNCTION__, __LINE__, "action={$formData['action']},id={$formData['id']},function={$functionName}");
addFatalMessage(__FUNCTION__, __LINE__, "Invalid member action! action=%s,id=%s,function=%s", array($formData['action'], $formData['id'], $functionName));
}
if (GET_EXT_VERSION('bonus') >= '0.8.7') {
// List all notifications
- ADD_SQL("SELECT `id` FROM `{!_MYSQL_PREFIX!}_bonus` WHERE is_notify='Y' ORDER BY timestamp DESC");
+ ADD_SQL("SELECT `id` FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `is_notify`='Y' ORDER BY `timestamp` DESC");
$WHATs[] = 'list_notifications';
$DESCRs[] = getMessage('ADMIN_TASK_LIST_NOTIFICATIONS');
$TITLEs[] = getMessage('ADMIN_TASK_LIST_NOTIFICATIONS_TITLE');
ADD_SQL("SELECT ".$USE." AS points
FROM `{!_MYSQL_PREFIX!}_user_data`
-WHERE `status`='CONFIRMED' AND ".$USE.">0".$lastOnline."
-ORDER BY points DESC, userid");
+WHERE `status`='CONFIRMED' AND ".$USE." > 0".$lastOnline."
+ORDER BY points DESC, `userid` ASC");
$WHATs[] = 'list_bonus';
$DESCRs[] = getMessage('ADMIN_TASK_LIST_BONUS');
$TITLEs[] = getMessage('ADMIN_TASK_LIST_BONUS_TITLE');
}
ADD_SQL("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data`
-WHERE `status`='CONFIRMED' AND beg_points>0".$lastOnline."
-ORDER BY beg_points DESC, userid");
+WHERE `status`='CONFIRMED' AND `beg_points` > 0".$lastOnline."
+ORDER BY `beg_points` DESC, `userid` ASC");
$WHATs[] = 'list_beg';
$DESCRs[] = getMessage('ADMIN_TASK_LIST_BEG');
$TITLEs[] = getMessage('ADMIN_TASK_LIST_BEG_TITLE');
if (EXT_IS_ACTIVE('doubler')) {
// List waiting payouts
- ADD_SQL("SELECT `id` FROM `{!_MYSQL_PREFIX!}_doubler` WHERE completed='N' ORDER BY `id`");
+ ADD_SQL("SELECT `id` FROM `{!_MYSQL_PREFIX!}_doubler` WHERE `completed`='N' ORDER BY `id`");
$WHATs[] = 'list_doubler&mode=waiting&select=all';
$DESCRs[] = getMessage('ADMIN_TASK_LIST_DOUBLER_WAITING');
$TITLEs[] = getMessage('ADMIN_TASK_LIST_DOUBLER_WAITING_TITLE');
array(generateHash($NEW_PASS), $uid), __FUNCTION__, __LINE__);
// Prepare data and message for email
- $msg = LOAD_EMAIL_TEMPLATE('new-pass', array('new_pass' => $NEW_PASS), $uid);
+ $message = LOAD_EMAIL_TEMPLATE('new-pass', array('new_pass' => $NEW_PASS), $uid);
// ... and send it away
- sendEmail($uid, getMessage('GUEST_NEW_PASSWORD'), $msg);
+ sendEmail($uid, getMessage('GUEST_NEW_PASSWORD'), $message);
// Output note to user
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('GUEST_NEW_PASSWORD_SEND'));
}
// Sets a status message and code
-function WERNIS_STATUS_MESSAGE ($msg, $status) {
- $GLOBALS['wernis_data']['message'] = $msg;
- $GLOBALS['wernis_data']['status'] = $status;
+function WERNIS_STATUS_MESSAGE ($message, $status) {
+ $GLOBALS['wernis_data']['message'] = $message;
+ $GLOBALS['wernis_data']['status'] = $status;
}
// Get the status message
// Is the array an array? ;-)
if (!is_array($array)) {
// Log error and return
- DEBUG_LOG(__FUNCTION__, __LINE__, ' Type '.gettype($array).'!=array.');
+ DEBUG_LOG(__FUNCTION__, __LINE__, 'Type ' . gettype($array) . ' != array.');
return;
} // END - if
$return = $GLOBALS['translation_tables']['yoomedia'][$type][$index];
} else {
// Not found!
- DEBUG_LOG(__FUNCTION__, __LINE__, " type={$type},index={$index} not found.");
+ DEBUG_LOG(__FUNCTION__, __LINE__, "type={$type},index={$index} not found.");
}
// Return value
print '<pre>';
debug_print_backtrace();
die('</pre>');
- DEBUG_LOG(__FUNCTION__, __LINE__, " errorCode={$errorCode}");
+ DEBUG_LOG(__FUNCTION__, __LINE__, "errorCode={$errorCode}");
}
// Return value
// @TODO 4 is hard-coded here, should we move it out in config?
for ($idx = 0; $idx < 4; $idx++) {
$content['check'] .= generateRandomCode("8", mt_rand(0, $month.$day), $content['userid'], ($age * ($idx + 1)));
- }
+ } // END - for
// Insert row into database
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_user_birthday` (userid, points, chk_value) VALUES ('%s','%s','%s' )",
- array(bigintval($content['userid']), getConfig('birthday_points'), $content['check']), __FILE__, __LINE__);
+ array(bigintval($content['userid']), getConfig('birthday_points'), $content['check']), __FILE__, __LINE__);
// Load email template with confirmation link
- $msg = LOAD_EMAIL_TEMPLATE("member_birthday_confirm", $content, bigintval($content['userid']));
+ $message = LOAD_EMAIL_TEMPLATE('member_birthday_confirm', $content, bigintval($content['userid']));
} else {
// Load default email template and fill in the age
- $msg = LOAD_EMAIL_TEMPLATE("member_birthday", $age, $content['userid']);
+ $message = LOAD_EMAIL_TEMPLATE('member_birthday', $age, $content['userid']);
}
// Send email
- sendEmail($content['email'], getMessage('HAPPY_BIRTHDAY'), $msg);
+ sendEmail($content['email'], getMessage('HAPPY_BIRTHDAY'), $message);
// Remember him that he has received a birthday mail
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET birthday_sent=UNIX_TIMESTAMP() WHERE userid=%s LIMIT 1",
- array(bigintval($content['userid'])), __FILE__, __LINE__);
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `birthday_sent`=UNIX_TIMESTAMP() WHERE `userid`=%s LIMIT 1",
+ array(bigintval($content['userid'])), __FILE__, __LINE__);
} // END - while
// Free memory
$content['points'] = bigintval(REQUEST_POST('points'));
// Load email template and send email away
- $msg = LOAD_EMAIL_TEMPLATE("add-points", $content, bigintval($content['userid']));
- sendEmail(bigintval($content['userid']), getMessage('ADMIN_ADD_SUBJ'), $msg);
+ $message = LOAD_EMAIL_TEMPLATE('add-points', $content, bigintval($content['userid']));
+ sendEmail(bigintval($content['userid']), getMessage('ADMIN_ADD_SUBJ'), $message);
} // END - while
// Free memory
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_ALL_POINTS_ADDED'));
} else {
// Display form add points
- LOAD_TEMPLATE("admin_add_points_all");
+ LOAD_TEMPLATE('admin_add_points_all');
}
} elseif (REQUEST_ISSET_GET('uid')) {
// User ID found in URL so we use this give him some credits
if (SQL_NUMROWS($result) == 1) {
// Selected user does exist
list($sname, $fname, $email) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
if ((isFormSent()) && (REQUEST_ISSET_POST(('points')))) {
// Remove depth to prevent booking errors. This is a bad coding
);
// Message laden
- $msg = LOAD_EMAIL_TEMPLATE("add-points", $content, bigintval(REQUEST_GET('uid')));
+ $message = LOAD_EMAIL_TEMPLATE("add-points", $content, bigintval(REQUEST_GET('uid')));
- sendEmail(bigintval(REQUEST_GET('uid')), getMessage('ADMIN_ADD_SUBJ'), $msg);
+ sendEmail(bigintval(REQUEST_GET('uid')), getMessage('ADMIN_ADD_SUBJ'), $message);
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_POINTS_ADDED'));
} else {
// Opps, missing form here
// User not found!
LOAD_TEMPLATE('admin_settings_saved', false, "<div class=\"admin_failed\">".sprintf(getMessage('ADMIN_MEMBER_404'), REQUEST_GET('uid'))."</div>");
}
+
+ // Free result
+ SQL_FREERESULT($result);
} else {
// Output selection form with all confirmed user accounts listed
ADD_MEMBER_SELECTION_BOX('0', true);
// Send mail or message
if ((EXT_IS_ACTIVE("msg")) && (REQUEST_POST('type') == "msg")) {
// Add message
- $msg = LOAD_EMAIL_TEMPLATE("admins_msg_contct_admin", REQUEST_POST('text'), '0');
- SEND_ADMIN_MESSAGE(REQUEST_GET('admin'), ADMINS_MSG_FROM_ADMIN, $msg);
+ $message = LOAD_EMAIL_TEMPLATE('admins_msg_contct_admin', REQUEST_POST('text'), '0');
+ SEND_ADMIN_MESSAGE(REQUEST_GET('admin'), ADMINS_MSG_FROM_ADMIN, $message);
} else {
// Load admin's email address
$email = getAdminEmail(bigintval(REQUEST_GET('admin')));
// Load email template and send the mail to the admin
- $msg = LOAD_EMAIL_TEMPLATE("admins_mail_contct_admin", REQUEST_POST('text'), '0');
- sendEmail($email, getMessage('ADMINS_MSG_FROM_ADMIN'), $msg);
+ $message = LOAD_EMAIL_TEMPLATE('admins_mail_contct_admin', REQUEST_POST('text'), '0');
+ sendEmail($email, getMessage('ADMINS_MSG_FROM_ADMIN'), $message);
}
// Mail / message dropped
} elseif (REQUEST_ISSET_GET('admin')) {
// Load contact form template
define('__ADMIN', REQUEST_GET('admin'));
- if (EXT_IS_ACTIVE("msg")) {
+ if (EXT_IS_ACTIVE('msg')) {
// Add option to select between mail and message
- define('ADMINS_MESSAGING_SELECTION', LOAD_TEMPLATE("admin_admins_contct_select", true));
+ define('ADMINS_MESSAGING_SELECTION', LOAD_TEMPLATE('admin_admins_contct_select', true));
} else {
// Outout hidden input
- define('ADMINS_MESSAGING_SELECTION', LOAD_TEMPLATE("admin_admins_contct_default", true));
+ define('ADMINS_MESSAGING_SELECTION', LOAD_TEMPLATE('admin_admins_contct_default', true));
}
- LOAD_TEMPLATE("admin_admins_contct_form");
+
+ // Load main form
+ LOAD_TEMPLATE('admin_admins_contct_form');
} else {
// Please select an admin!
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMINS_SELECT_ADMIN'));
), __FILE__, __LINE__);
// Get message
- $msg = getMessage('ADMIN_PAYOUT_TYPE_ADDED');
+ $message = getMessage('ADMIN_PAYOUT_TYPE_ADDED');
} else {
// Free memory
SQL_FREERESULT($result);
// Does already exist
- $msg = "<div class=\"admin_failed\">{--ADMIN_PAYOUT_TYPE_ALREADY--}</div>";
+ $message = "<div class=\"admin_failed\">{--ADMIN_PAYOUT_TYPE_ALREADY--}</div>";
}
}
runFilterChain('run_sqls');
// Get message
- $msg = getMessage('ADMIN_PAYOUT_ENTRIES_CHANGED');
+ $message = getMessage('ADMIN_PAYOUT_ENTRIES_CHANGED');
} else {
$display = false; //Suppress any other outputs
$OUT = ''; $SW = 2;
runFilterChain('run_sqls');
// Get message
- $msg = getMessage('ADMIN_PAYOUT_ENTRIES_DELETED');
+ $message = getMessage('ADMIN_PAYOUT_ENTRIES_DELETED');
} else {
$display = false; //Suppress any other outputs
$OUT = ''; $SW = 2;
}
}
-if (!empty($msg)) {
+if (!empty($message)) {
// Output message
- LOAD_TEMPLATE('admin_settings_saved', false, $msg);
-}
+ LOAD_TEMPLATE('admin_settings_saved', false, $message);
+} // END - if
// Payout types
-$result_type = SQL_QUERY("SELECT id, type, rate, min_points, from_account FROM `{!_MYSQL_PREFIX!}_payout_types` ORDER BY type", __FILE__, __LINE__);
+$result_type = SQL_QUERY("SELECT
+ `id`, `type`, `rate`, `min_points`, `from_account`
+FROM
+ `{!_MYSQL_PREFIX!}_payout_types`
+ORDER BY
+ `type` ASC", __FILE__, __LINE__);
if ((SQL_NUMROWS($result_type) > 0) && ($display)) {
// List all payout types
$DATA = array('url' => $url, 'subject' => $subject);
// Load email template and send the email away
- $msg_user = LOAD_EMAIL_TEMPLATE("order-deleted", array(), $sender);
- sendEmail($sender, getMessage('MEMBER_ORDER_DELETED'), $msg_user);
+ $message_user = LOAD_EMAIL_TEMPLATE('order-deleted', array(), $sender);
+ sendEmail($sender, getMessage('MEMBER_ORDER_DELETED'), $message_user);
// Fetch right stats_id from pool
$result_pool = SQL_QUERY_ESC("SELECT
}
// Remove links from DB
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE stats_id=%s",
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE `stats_id`=%s",
array(bigintval($stats_id)), __FILE__, __LINE__);
$cnt += SQL_AFFECTEDROWS();
);
// Send email to user
- $msg = LOAD_EMAIL_TEMPLATE("member_holiday_removed", $content, $uid);
- sendEmail($uid, getMessage('HOLIDAY_ADMIN_REMOVED_SUBJ'), $msg);
+ $message = LOAD_EMAIL_TEMPLATE("member_holiday_removed", $content, $uid);
+ sendEmail($uid, getMessage('HOLIDAY_ADMIN_REMOVED_SUBJ'), $message);
$cnt++;
}
}
$message = getMessage('HOLIDAY_ADMIN_SINGLE_404');
// Fetch data
- $result_load = SQL_QUERY_ESC("SELECT holiday_start AS start, holiday_end AS end
-FROM `{!_MYSQL_PREFIX!}_user_holidays`
-WHERE userid=%s LIMIT 1", array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
+ $result_load = SQL_QUERY_ESC("SELECT
+ `holiday_start` AS start, `holiday_end` AS end
+FROM
+ `{!_MYSQL_PREFIX!}_user_holidays`
+WHERE
+ `userid`=%s
+LIMIT 1",
+ array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
if (SQL_NUMROWS($result_load) == 1) {
// Load data
$content = SQL_FETCHARRAY($result_load);
// Delete one holiday request (for task)
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_holidays`
-WHERE userid=%s LIMIT 1", array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM
+ `{!_MYSQL_PREFIX!}_user_holidays`
+WHERE
+ `userid`=%s
+LIMIT 1", array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
// Send email to user
- $msg = LOAD_EMAIL_TEMPLATE("member_holiday_removed", $content, REQUEST_GET('uid'));
- sendEmail(REQUEST_GET('uid'), getMessage('HOLIDAY_ADMIN_REMOVED_SUBJ'), $msg);
+ $message = LOAD_EMAIL_TEMPLATE('member_holiday_removed', $content, REQUEST_GET('uid'));
+ sendEmail(REQUEST_GET('uid'), getMessage('HOLIDAY_ADMIN_REMOVED_SUBJ'), $message);
// Set message
$message = getMessage('HOLIDAY_ADMIN_SINGLE_DELETED');
if (REQUEST_ISSET_GET('id')) {
// Check for selected sponsor
$result = SQL_QUERY_ESC("SELECT email, gender, surname, family FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE `id`='%s' LIMIT 1",
- array(bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
+ array(bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Remove sponsor
if (isFormSent()) {
// Load data and remember it in constants
- list($email, $gender, $surname, $family) = SQL_FETCHROW($result);
+ $DATA = SQL_FETCHARRAY($result);
- // Free result
- SQL_FREERESULT($result);
-
- define('__EMAIL' , $email);
- define('__GENDER' , translateGender($gender));
- define('__SURNAME', $surname);
- define('__FAMILY' , $family);
+ // @TODO Rewrite these constants
+ define('__EMAIL' , $DATA['email']);
+ define('__GENDER' , translateGender($DATA['gender']));
+ define('__SURNAME', $DATA['surname']);
+ define('__FAMILY' , $DATA['family']);
// Prepare message and send it away
- $msg = LOAD_EMAIL_TEMPLATE("del_sponsor", REQUEST_POST('reason'), bigintval(REQUEST_GET('id')));
- sendEmail($email, getMessage('ADMIN_SPONSOR_DEL_SUBJECT'), $msg);
+ $message = LOAD_EMAIL_TEMPLATE('del_sponsor', REQUEST_POST('reason'), bigintval(REQUEST_GET('id')));
+ sendEmail($DATA['email'], getMessage('ADMIN_SPONSOR_DEL_SUBJECT'), $message);
// Remove account
SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE `id`='%s' LIMIT 1",
- array(bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
+ array(bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
// Remove orders
SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_sponsor_orders` WHERE sponsorid='%s' LIMIT 1",
- array(bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
+ array(bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
// Output message
LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('ADMIN_SPONSOR_DELETED'), bigintval(REQUEST_GET('id'))));
redirectToUrl('modules.php?module=admin&what=list_sponsor&id='.bigintval(REQUEST_GET('id')));
} else {
// Load data
- list ($email, $gender, $sname, $fname) = SQL_FETCHROW($result);
+ $DATA = SQL_FETCHARRAY($result);
// Transfer data to constants for the template
- define('__EMAIL' , $email);
- define('__SNAME' , $sname);
+ // @TODO Rewrite these constants
+ define('__EMAIL' , $DATA['email']);
+ define('__SNAME' , $DATA['surname']);
define('__FNAME' , $fname);
- define('__GENDER', translateGender($gender));
+ define('__GENDER', translateGender($DATA['gender']));
define('__UID' , bigintval(REQUEST_GET('id')));
// Display form
// Sponsor not found!
LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('ADMIN_SPONSOR_404'), bigintval(REQUEST_GET('id'))));
}
+
+ // Free result
+ SQL_FREERESULT($result);
} else {
// Not called by what-list_sponsor.php
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_CALL_NOT_DIRECTLY'));
define('__REASON' , REQUEST_POST('reason'));
// Send email
- $msg = LOAD_EMAIL_TEMPLATE('sponsor_add_points', REQUEST_POST('reason'), true);
- sendEmail(__EMAIL, ADMIN_SPONSOR_ADD_POINTS_SUBJ, $msg);
- $message = ADMIN_SPONSOR_POINTS_ADDED;
+ $message = LOAD_EMAIL_TEMPLATE('sponsor_add_points', REQUEST_POST('reason'), true);
+ sendEmail(constant('__EMAIL'), getMessage('ADMIN_SPONSOR_ADD_POINTS_SUBJ'), $message);
+ $message = getMessage('ADMIN_SPONSOR_POINTS_ADDED');
} else {
// No points entered to add!
- $message = ADMIN_SPONSPOR_NO_POINTS_TO_ADD;
+ $message = getMessage('ADMIN_SPONSPOR_NO_POINTS_TO_ADD');
}
break;
define('__REASON' , REQUEST_POST('reason'));
// Send email
- $msg = LOAD_EMAIL_TEMPLATE('sponsor_sub_points', REQUEST_POST('reason'), true);
- sendEmail(__EMAIL, ADMIN_SPONSOR_SUB_POINTS_SUBJ, $msg);
- $message = ADMIN_SPONSOR_POINTS_SUBTRACTED;
+ $message = LOAD_EMAIL_TEMPLATE('sponsor_sub_points', REQUEST_POST('reason'), true);
+ sendEmail(constant('__EMAIL'), getMessage('ADMIN_SPONSOR_SUB_POINTS_SUBJ'), $message);
+ $message = getMessage('ADMIN_SPONSOR_POINTS_SUBTRACTED');
} else {
// No points entered to add!
- $message = ADMIN_SPONSPOR_NO_POINTS_TO_SUBTRACT;
+ $message = getMessage('ADMIN_SPONSPOR_NO_POINTS_TO_SUBTRACT');
}
break;
REQUEST_UNSET_POST('pass1');
REQUEST_UNSET_POST('pass2');
$PASS = false;
- }
+ } // END - if
// Convert time selection
$DATA = array(); $id = 'warning_interval_ye'; $skip = false;
if ($PASS === false) REQUEST_SET_POST('pass1', getMessage('SPONSOR_PASS_UNCHANGED'));
// Load email template and send the mail away
- $msg = LOAD_EMAIL_TEMPLATE('admin_sponsor_edit', REQUEST_POST_ARRAY(), false);
- sendEmail(REQUEST_POST('email'), getMessage('ADMIN_SPONSOR_EDIT_SUBJECT'), $msg);
+ $message = LOAD_EMAIL_TEMPLATE('admin_sponsor_edit', REQUEST_POST_ARRAY(), false);
+ sendEmail(REQUEST_POST('email'), getMessage('ADMIN_SPONSOR_EDIT_SUBJECT'), $message);
break;
default: // Unknown mode
// 0 1 2 3 4 5 6 7 8 9 10
$sql = "SELECT id, sender, subject, text, receivers, payment_id, data_type, timestamp, url, target_send, cat_id
FROM `{!_MYSQL_PREFIX!}_pool`
- WHERE data_type='SEND' OR data_type='DELETED'
+ WHERE `data_type`='SEND' OR `data_type`='DELETED'
ORDER BY timestamp DESC";
// Check for maximum pages
LOAD_TEMPLATE('admin_settings_saved', false, $message);
} elseif ((REQUEST_ISSET_POST('change')) && (REQUEST_ISSET_POST('id'))) {
// Change all status
- ADMIN_CHANGE_ACTIVATION_STATUS(REQUEST_POST('id'), "countries", "is_active");
+ ADMIN_CHANGE_ACTIVATION_STATUS(REQUEST_POST('id'), 'countries', 'is_active');
// Show next link
LOAD_TEMPLATE('admin_next_link', false, array(
array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
} else {
// Load stats ID (2nd will be ignored later! But it is needed for the same fetchrow command)
- $result = SQL_QUERY_ESC("SELECT stats_id, stats_id, link_type FROM `{!_MYSQL_PREFIX!}_user_links` WHERE userid=%s ORDER BY `id`",
- array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT stats_id, stats_id, link_type FROM `{!_MYSQL_PREFIX!}_user_links` WHERE `userid`=%s ORDER BY `id` ASC",
+ array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
}
// Get number of rows from the query
// Some unconfirmed mails left
if (REQUEST_GET('del') == "all") {
// Delete all unconfirmed mails by this user
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE userid=%s LIMIT %s",
- array(bigintval(REQUEST_GET('uid')), $nums), __FILE__, __LINE__);
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE `userid`=%s LIMIT %s",
+ array(bigintval(REQUEST_GET('uid')), $nums), __FILE__, __LINE__);
// Prepare mail and send it away
- $msg = LOAD_EMAIL_TEMPLATE("admin-del_links", $nums, bigintval(REQUEST_GET('uid')));
- sendEmail($email, getMessage('ADMIN_DEL_LINK_SUBJ'), $msg);
+ $message = LOAD_EMAIL_TEMPLATE('admin-del_links', $nums, bigintval(REQUEST_GET('uid')));
+ sendEmail($email, getMessage('ADMIN_DEL_LINK_SUBJ'), $message);
// Display message
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_LINKS_DELETED'));
// @TODO Rewrite this to includes/filter
switch ($type) {
case 'NORMAL':
- $result_data = SQL_QUERY_ESC("SELECT subject, timestamp_ordered, cat_id FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE `id`=%s LIMIT 1",
- array(bigintval($id)), __FILE__, __LINE__);
+ $result_data = SQL_QUERY_ESC("SELECT `subject`, `timestamp_ordered`, `cat_id` FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE `id`=%s LIMIT 1",
+ array(bigintval($id)), __FILE__, __LINE__);
$type = 'mailid'; $DATA = $id; $PROBLEM = getMessage('NORMAL_MAIL_PROBLEM');
$LINK = "<a href=\"{!URL!}/mailid.php?uid=".REQUEST_GET('uid')."&mailid=".$id."\" target=\"_blank\">".$id."</a>";
break;
case 'BONUS':
- $result_data = SQL_QUERY_ESC("SELECT subject, timestamp, cat_id FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`=%s LIMIT 1",
- array(bigintval($id2)), __FILE__, __LINE__);
+ $result_data = SQL_QUERY_ESC("SELECT `subject`, `timestamp`, `cat_id` FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`=%s LIMIT 1",
+ array(bigintval($id2)), __FILE__, __LINE__);
$type = 'bonusid'; $DATA = $id2; $PROBLEM = getMessage('BONUS_MAIL_PROBLEM');
$LINK = "<a href=\"{!URL!}/mailid.php?uid=".REQUEST_GET('uid')."&bonusid=".$id2."\" target=\"_blank\">".$id2."</a>";
break;
// Update database...
// First user's account
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET nl_until=(UNIX_TIMESTAMP() + nl_timespan), nl_receive='N', nl_timespan=0 WHERE userid=%s LIMIT 1",
- array(bigintval(REQUEST_POST('uid'))), __FILE__, __LINE__);
+ array(bigintval(REQUEST_POST('uid'))), __FILE__, __LINE__);
// Next the task system...
runFilterChain('solve_task', bigintval(REQUEST_POST('id')));
// Send mail to user
- $msg = LOAD_EMAIL_TEMPLATE("member_newsletter_done", true, bigintval(REQUEST_POST('uid')));
- sendEmail(bigintval(REQUEST_POST('uid')), getMessage('NL_MEMBER_DONE_SUBJECT'), $msg);
+ $message = LOAD_EMAIL_TEMPLATE('member_newsletter_done', true, bigintval(REQUEST_POST('uid')));
+ sendEmail(bigintval(REQUEST_POST('uid')), getMessage('NL_MEMBER_DONE_SUBJECT'), $message);
// Output message to admin
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_NL_MEMBER_DONE'));
// Clear payout request
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_payouts` SET `status`='ACCEPTED' WHERE `id`=%s LIMIT 1",
- array(bigintval(REQUEST_GET('pid'))), __FILE__, __LINE__);
+ array(bigintval(REQUEST_GET('pid'))), __FILE__, __LINE__);
// Send out mail
- $msg = LOAD_EMAIL_TEMPLATE('member_payout_accepted', REQUEST_POST('text'), $uid);
+ $message = LOAD_EMAIL_TEMPLATE('member_payout_accepted', REQUEST_POST('text'), $uid);
// Output message
if ($allow == 'Y') {
}
// Finally send mail
- sendEmail($email, getMessage('PAYOUT_ACCEPTED_SUBJECT'), $msg);
+ sendEmail($email, getMessage('PAYOUT_ACCEPTED_SUBJECT'), $message);
} else {
// Something goes wrong... :-(
$content = implode("<br />", $ret);
- LOAD_TEMPLATE("admin_payout_failed_transfer", false, $content);
+ LOAD_TEMPLATE('admin_payout_failed_transfer', false, $content);
}
} else {
// Cannot load payout id
array(bigintval(REQUEST_GET('pid'))), __FILE__, __LINE__);
// Send out mail
- $msg = LOAD_EMAIL_TEMPLATE('member_payout_rejected', REQUEST_POST('text'), $uid);
+ $message = LOAD_EMAIL_TEMPLATE('member_payout_rejected', REQUEST_POST('text'), $uid);
// Output message
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('PAYOUT_REJECTED_NOTIFIED'));
// Finally send mail
- sendEmail($email, getMessage('PAYOUT_REJECTED_SUBJECT'), $msg);
+ sendEmail($email, getMessage('PAYOUT_REJECTED_SUBJECT'), $message);
} else {
// Prepare content
$content = array(
if (REQUEST_ISSET_GET('id')) {
// Check for selected sponsor
- $result = SQL_QUERY_ESC("SELECT gender, surname, family, email, status FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE `id`='%s' LIMIT 1",
- array(bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 1) {
+ $result_sponsor = SQL_QUERY_ESC("SELECT `gender`, `surname`, `family`, `email`, `status` FROM `{!_MYSQL_PREFIX!}_sponsor_data` WHERE `id`='%s' LIMIT 1",
+ array(bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
+ if (SQL_NUMROWS($result_sponsor) == 1) {
// Get sponsor's current status and let only confirmed and locked status pass
- list($gender, $sname, $fname, $email, $status) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
+ $DATA = SQL_FETCHARRAY($result_sponsor);
- if (($status == 'CONFIRMED') || ($status == 'LOCKED')) {
+ if (($DATA['status'] == 'CONFIRMED') || ($DATA['status'] == 'LOCKED')) {
// Transfer data to constants
- define('__GENDER' , translateGender($gender));
- define('__SURNAME', $sname);
- define('__FAMILY' , $fname);
+ define('__GENDER' , translateGender($DATA['gender']));
+ define('__SURNAME', $DATA['surname']);
+ define('__FAMILY' , $DATA['family']);
define('__ID' , bigintval(REQUEST_GET('id')));
if (isFormSent()) {
// Create messages
- if ($status == 'CONFIRMED') {
+ if ($DATA['status'] == 'CONFIRMED') {
// Message when sponsor's account got lock
define('__EMAIL_MSG', getMessage('SPONSOR_ACCOUNT_LOCKED'));
$subject = getMessage('SPONSOR_SUBJECT_LOCKED');
- $status = 'LOCKED';
+ $DATA['status'] = 'LOCKED';
} else {
// Message when sponsor's account got unlock
define('__EMAIL_MSG', getMessage('SPONSOR_ACCOUNT_UNLOCKED'));
$subject = getMessage('SPONSOR_SUBJECT_UNLOCKED');
- $status = 'CONFIRMED';
+ $DATA['status'] = 'CONFIRMED';
}
// Load email message
- $msg = LOAD_EMAIL_TEMPLATE("lock_sponsor", REQUEST_POST('reason'), bigintval(REQUEST_GET('id')));
+ $message = LOAD_EMAIL_TEMPLATE('lock_sponsor', REQUEST_POST('reason'), bigintval(REQUEST_GET('id')));
// And send it away
- sendEmail($email, $subject, $msg);
+ sendEmail($DATA['email'], $subject, $message);
// Update sponsor's account
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET `status`='".$status."' WHERE `id`='%s' LIMIT 1",
- array(bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET `status`='".$DATA['status']."' WHERE `id`='%s' LIMIT 1",
+ array(bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
} elseif (REQUEST_ISSET_POST('no')) {
// No don't lock / unlock now!
redirectToUrl('modules.php?module=admin&what=list_sponsor&id='.bigintval(REQUEST_GET('id')));
} else {
// Create header and text messages
- if ($status == 'CONFIRMED') {
+ if ($DATA['status'] == 'CONFIRMED') {
// Messages when sponsor's account is confirmed
define('__HEADER_MESSAGE', getMessage('SPONSOR_LOCK_SPONSOR_HEADER'));
define('__TEXT_MESSAGE' , getMessage('SPONSOR_LOCK_SPONSOR_TEXT'));
}
// Create email link
- define('__EMAIL_LINK', '<a href="' . generateEmailLink($email, 'sponsor_data') . '">{!__GENDER!} {!__SURNAME!} {!__FAMILY!}</a>');
+ define('__EMAIL_LINK', '<a href="' . generateEmailLink($DATA['email'], 'sponsor_data') . '">{!__GENDER!} {!__SURNAME!} {!__FAMILY!}</a>');
// Display form
LOAD_TEMPLATE('admin_lock_sponsor');
// Sponsor not found!
$message = sprintf(getMessage('ADMIN_SPONSOR_404'), bigintval(REQUEST_GET('id')));
}
+
+ // Free result
+ SQL_FREERESULT($result_sponsor);
} else {
// Not called by what-list_sponsor.php
$message = getMessage('ADMIN_CALL_NOT_DIRECTLY');
if (!empty($message)) {
// Output message
LOAD_TEMPLATE('admin_settings_saved', false, $message);
-}
+} // END - if
//
?>
// Entry updated?
if (SQL_AFFECTEDROWS() == 1) {
// Send an email to the user! In later version you can optionally switch this feature off
- $msg = LOAD_EMAIL_TEMPLATE("lock-user", array('text' => REQUEST_POST('reason')), bigintval(REQUEST_GET('uid')));
+ $message = LOAD_EMAIL_TEMPLATE('lock-user', array('text' => REQUEST_POST('reason')), bigintval(REQUEST_GET('uid')));
// Send away...
- sendEmail(bigintval(REQUEST_GET('uid')), ADMIN_LOCKED_SUBJ, $msg);
+ sendEmail(bigintval(REQUEST_GET('uid')), ADMIN_LOCKED_SUBJ, $message);
} // END - if
// Prepare message
// Ok, unlock the account!
if (GET_EXT_VERSION('user') >= '0.3.5') {
// Reset lock reason as well
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `status`='CONFIRMED',lock_reason='',lock_timestamp='0000-00-00 00:00' WHERE userid=%s LIMIT 1",
- array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
+ SQL_QUERY_ESC("UPDATE
+ `{!_MYSQL_PREFIX!}_user_data`
+SET
+ `status`='CONFIRMED',
+ `lock_reason`='',
+ `lock_timestamp`='0000-00-00 00:00'
+WHERE
+ `userid`=%s
+LIMIT 1",
+ array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
} else {
// No lock reason to reset
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `status`='CONFIRMED' WHERE userid=%s LIMIT 1",
- array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `status`='CONFIRMED' WHERE `userid`=%s LIMIT 1",
+ array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
}
// Entry updated?
if (SQL_AFFECTEDROWS() == 1) {
// Send an email to the user! In later version you can optionally switch this feature off
- $msg = LOAD_EMAIL_TEMPLATE("unlock-user", array('text' => REQUEST_POST('reason')), bigintval(REQUEST_GET('uid')));
+ $message = LOAD_EMAIL_TEMPLATE('unlock-user', array('text' => REQUEST_POST('reason')), bigintval(REQUEST_GET('uid')));
// Send away...
- sendEmail(bigintval(REQUEST_GET('uid')), getMessage('ADMIN_UNLOCKED_SUBJ'), $msg);
+ sendEmail(bigintval(REQUEST_GET('uid')), getMessage('ADMIN_UNLOCKED_SUBJ'), $message);
if (EXT_IS_ACTIVE('rallye')) {
RALLYE_AUTOADD_USER(REQUEST_GET('uid'));
} // END - if
} elseif (REQUEST_ISSET_POST('del')) {
// Delete the account
$ACT = true;
- loadIncludeOnce("inc/modules/admin/what-del_user.php");
+ loadIncludeOnce('inc/modules/admin/what-del_user.php');
} elseif (REQUEST_ISSET_POST('no')) {
// Do not lock him...
$URL = ADMIN_CREATE_USERID_LINK(REQUEST_GET('uid'));
} else {
- $result = SQL_QUERY_ESC("SELECT email, surname, family FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
+ // Load user data we need
+ $result = SQL_QUERY_ESC("SELECT `email`, `surname`, `family` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
// Entry found?
if (SQL_NUMROWS($result) == 1) {
// Load data
- list ($email, $sname, $fname) = SQL_FETCHROW($result);
-
- // Free result
- SQL_FREERESULT($result);
+ $DATA = SQL_FETCHARRAY($result);
// Transfer data to constants for the template
// @TODO Rewrite these all constants
- define('__EMAIL', generateEmailLink($email, 'user_data'));
- define('__SNAME', $sname);
- define('__FNAME', $fname);
+ define('__EMAIL', generateEmailLink($DATA['email'], 'user_data'));
+ define('__SNAME', $DATA['surname']);
+ define('__FNAME', $DATA['family']);
define('__UID' , bigintval(REQUEST_GET('uid')));
// Realy want to lock?
// Account does not exists!
LOAD_TEMPLATE('admin_settings_saved', false, "<div class=\"admin_failed\">".sprintf(getMessage('ADMIN_MEMBER_404'), REQUEST_GET('uid'))."</div>");
}
+
+ // Free result
+ SQL_FREERESULT($result);
}
// Is an URL set?
LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('LOGFILE_NOT_READABLE'), $access));
}
} else {
- // List access logfiles
- $dir = constant('PATH') . getConfig('logs_base') . '/';
-
// Is the directory there?
- if (isDirectory($dir)) {
- // logs directory does exist
- OUTPUT_HTML("<ol>");
- $handle = opendir($dir) or app_die(__FILE__, __LINE__, 'Cannot open directory '.getConfig('logs_base') . '!');
- while ($file = readdir($handle)) {
- // We currenly only like files with "access" as prefix, should be more flexible!
- if (substr($file, 0, 6) == 'access') {
- // Okay, let us print it out
- OUTPUT_HTML("<li><a href=\"{!URL!}/modules.php?module=admin&what=".getWhat()."&access=".urlencode($file)."\">".$file."</a></li>");
- }
- }
- closedir($handle);
- OUTPUT_HTML("</ol>");
+ if (isDirectory(constant('PATH') . getConfig('logs_base'))) {
+ // Logs directory does exist so begin the list
+ OUTPUT_HTML('<ol>');
+
+ // Read all files
+ $files = getArrayFromDirectory(getConfig('logs_base'), 'access');
+
+ // And walk through them
+ foreach ($files as $file) {
+ // Cut dirname away
+ $file = basename($file);
+
+ // Okay, let us print it out
+ OUTPUT_HTML("<li><a href=\"{!URL!}/modules.php?module=admin&what=".getWhat()."&access=".urlencode($file)."\">".$file."</a></li>");
+ } // END - foreach
+
+ // Finish list
+ OUTPUT_HTML('</ol>');
} else {
// logs directory does not exist
LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('ADMIN_LOGS_DIR_404'), getConfig('logs_base')));
}
}
-//
+// [EOF]
?>
ADD_DESCR('admin', __FILE__);
if (isFormSent()) {
- $result = SQL_QUERY("SELECT userid, email
-FROM `{!_MYSQL_PREFIX!}_user_data`
-WHERE `status`='CONFIRMED' AND nl_receive='Y'
-ORDER BY userid ASC", __FILE__, __LINE__);
+ $result = SQL_QUERY("SELECT
+ `userid`, `email`
+FROM
+ `{!_MYSQL_PREFIX!}_user_data`
+WHERE
+ `status`='CONFIRMED' AND `nl_receive`='Y'
+ORDER BY
+ `userid` ASC", __FILE__, __LINE__);
if (SQL_NUMROWS($result) > 0) {
// Members are available so we can send out the newsletter!
while ($content = SQL_FETCHARRAY($result)) {
// Check for extension and sending-mode
if (!EXT_IS_ACTIVE('html_mail', true) && (REQUEST_POST('mode') == 'html')) {
// Set mode to text mode
- REQUEST_POST('mode') == "text";
+ REQUEST_POST('mode') == 'text';
} elseif (REQUEST_POST('mode') == 'html') {
// Set HTML templates
- $template = "newsletter_html";
+ $template = 'newsletter_html';
}
// Compile message
REQUEST_SET_POST('text', COMPILE_CODE(REQUEST_POST('text')));
// Load template
- $msg = LOAD_EMAIL_TEMPLATE($template, array('text' => REQUEST_POST('text')), $content['userid']);
+ $message = LOAD_EMAIL_TEMPLATE($template, array('text' => REQUEST_POST('text')), $content['userid']);
// ... and send it away!
- SEND_NEWSLETTER($content['email'], REQUEST_POST('subject'), $msg, REQUEST_POST('mode'));
+ SEND_NEWSLETTER($content['email'], REQUEST_POST('subject'), $message, REQUEST_POST('mode'));
}
// Free memory
define('_DATESTAMP', generateDateTime(time(), '3'));
if (EXT_IS_ACTIVE('html_mail')) {
// Load template with HTML mode
- LOAD_TEMPLATE("admin_newsletter");
+ LOAD_TEMPLATE('admin_newsletter');
} else {
// Load template with only text mode
- LOAD_TEMPLATE("admin_newsletter_nohtml");
+ LOAD_TEMPLATE('admin_newsletter_nohtml');
}
}
$content['points'] = bigintval(REQUEST_POST('points'));
// Load message and send it away
- $msg = LOAD_EMAIL_TEMPLATE("sub-points", $content, bigintval($content['userid']));
- sendEmail($content['email'], getMessage('ADMIN_SUB_SUBJ'), $msg);
+ $message = LOAD_EMAIL_TEMPLATE('sub-points', $content, bigintval($content['userid']));
+ sendEmail($content['email'], getMessage('ADMIN_SUB_SUBJ'), $message);
} // END - while
// Free memory
$content['points'] = bigintval(REQUEST_POST('points'));
// Load email and send it away
- $msg = LOAD_EMAIL_TEMPLATE('sub-points', $content, bigintval(REQUEST_GET('uid')));
- sendEmail($content['email'], getMessage('ADMIN_SUB_SUBJ'), $msg);
+ $message = LOAD_EMAIL_TEMPLATE('sub-points', $content, bigintval(REQUEST_GET('uid')));
+ sendEmail($content['email'], getMessage('ADMIN_SUB_SUBJ'), $message);
// Output message
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_POINTS_SUBTRACTED'));
);
// Read directory "themes"
-$handle = opendir(constant('PATH') . 'theme/') or app_die(__FILE__, __LINE__, 'Cannot read themes dir!');
-while ($dir = readdir($handle)) {
- // Construct absolute theme.php file name
- $INC = sprintf("theme/%s/theme.php", $dir);
-
- // Test it...
- if ((!isDirectory($dir)) && (isIncludeReadable($INC))) {
- // Found a valid directory so let's load it's theme.php file
- loadInclude($INC);
-
- // Add found theme to array
- $THEMES['theme_unix'][] = $dir;
- $THEMES['theme_name'][] = $GLOBALS['theme_data']['name'];
- $THEMES['theme_author'][] = $GLOBALS['theme_data']['author'];
- $THEMES['theme_email'][] = $GLOBALS['theme_data']['email'];
- $THEMES['theme_url'][] = $GLOBALS['theme_data']['url'];
- $THEMES['theme_ver'][] = $GLOBALS['theme_data']['version'];
- } // END - if
+$includes = getArrayFromDirectory('theme/', '', false, true, array('css', 'images'));
+
+// Walk through all entries and add it
+foreach ($includes as $INC) {
+ // Get directory from it
+ $dir = basename(dirname($INC));
+
+ // Load include file
+ loadInclude($INC);
+
+ // Add found theme to array
+ $THEMES['theme_unix'][] = $dir;
+ $THEMES['theme_name'][] = $GLOBALS['theme_data']['name'];
+ $THEMES['theme_author'][] = $GLOBALS['theme_data']['author'];
+ $THEMES['theme_email'][] = $GLOBALS['theme_data']['email'];
+ $THEMES['theme_url'][] = $GLOBALS['theme_data']['url'];
+ $THEMES['theme_ver'][] = $GLOBALS['theme_data']['version'];
} // END - while
-// Close directory
-closedir($handle);
-
// Sort array by Uni* name
array_pk_sort($THEMES, array('theme_name'));
} // END - if
} // END - if
- if (REQUEST_ISSET_POST(('accept'))) {
+ if (REQUEST_ISSET_POST('accept')) {
if ($SEL > 0) {
// Accept mail orders
foreach (REQUEST_POST('sel') as $id => $value) {
$id = bigintval($id);
// Order placed in queue...
- $result = SQL_QUERY_ESC("SELECT po.url, po.subject, po.sender, pay.payment, po.payment_id
-FROM `{!_MYSQL_PREFIX!}_pool` AS po
-INNER JOIN `{!_MYSQL_PREFIX!}_payments` AS pay
-ON po.payment_id=pay.id
-WHERE po.id=%s
+ $result = SQL_QUERY_ESC("SELECT
+ po.url, po.subject, po.sender, pay.payment, po.payment_id
+FROM
+ `{!_MYSQL_PREFIX!}_pool` AS po
+INNER JOIN
+ `{!_MYSQL_PREFIX!}_payments` AS pay
+ON
+ po.payment_id=pay.id
+WHERE
+ po.id=%s
LIMIT 1",
array($id), __FILE__, __LINE__);
// Check for bonus extension version >= 0.4.4 for the order bonus
if ((GET_EXT_VERSION('bonus') >= '0.4.4') && (getConfig('bonus_active') == 'Y')) {
// Add points directly
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET bonus_order=bonus_order+".getConfig('bonus_order')." WHERE userid=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `bonus_order`=`bonus_order`+".getConfig('bonus_order')." WHERE `userid`=%s LIMIT 1",
array(bigintval($DATA['sender'])), __FILE__, __LINE__);
// Subtract bonus points from system
} // END - if
// Load email template
- $msg_user = LOAD_EMAIL_TEMPLATE('order-accept', array(), $DATA['sender']);
+ $message_user = LOAD_EMAIL_TEMPLATE('order-accept', array(), $DATA['sender']);
// Send email
- sendEmail($DATA['sender'], MEMBER_ORDER_ACCEPTED, $msg_user);
+ sendEmail($DATA['sender'], MEMBER_ORDER_ACCEPTED, $message_user);
// Unlock selected email
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET data_type='NEW' WHERE `id`=%s AND data_type='ADMIN' LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET `data_type`='NEW' WHERE `id`=%s AND `data_type`='ADMIN' LIMIT 1",
array($id), __FILE__, __LINE__);
} // END - if
} // END - foreach
$id = bigintval($id);
// Load URL and subject from pool
- $result = SQL_QUERY_ESC("SELECT url, subject, sender FROM `{!_MYSQL_PREFIX!}_pool` WHERE `id`=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `url`, `subject`, `sender` FROM `{!_MYSQL_PREFIX!}_pool` WHERE `id`=%s LIMIT 1",
array($id), __FILE__, __LINE__);
// Load data
SQL_FREERESULT($result);
// Load email template and send it away
- $msg_user = LOAD_EMAIL_TEMPLATE("order-reject", array(), $DATA['sender']);
- sendEmail($DATA['sender'], getMessage('MEMBER_ORDER_REJECTED'), $msg_user);
+ $message_user = LOAD_EMAIL_TEMPLATE('order-reject', array(), $DATA['sender']);
+ sendEmail($DATA['sender'], getMessage('MEMBER_ORDER_REJECTED'), $message_user);
// If you do not enter an URL to redirect to, your URL will be set!
if ((!REQUEST_ISSET_POST(('redirect'))) || (REQUEST_POST('redirect') == 'http://')) REQUEST_SET_POST('redirect', constant('URL'));
// Redirect URL
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET url='%s', data_type='NEW' WHERE `id`=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET url='%s', `data_type`='NEW' WHERE `id`=%s LIMIT 1",
array(REQUEST_POST('redirect'), $id),__FILE__, __LINE__);
// Prepare data for the row template
// Output message
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_URLS_BLOCKED'));
- } elseif ((!REQUEST_ISSET_POST('lock')) && (!REQUEST_ISSET_POST(('accept'))) && (!REQUEST_ISSET_POST(('reject'))) && (getConfig('url_blacklist') == 'Y')) {
+ } elseif ((!REQUEST_ISSET_POST('lock')) && (!REQUEST_ISSET_POST('accept')) && (!REQUEST_ISSET_POST(('reject'))) && (getConfig('url_blacklist') == 'Y')) {
// Mail orders are in pool so we can display them
$OUT = ''; $SW = 2;
while ($content = SQL_FETCHARRAY($result_main)) {
$content['points'] = translateComma($content['points_amount']);
// So let's send the email away
- $msg = LOAD_EMAIL_TEMPLATE("sponsor_unlocked", $content);
- sendEmail($content['email'], getMessage('SPONSOR_UNLOCKED_SUBJ'), $msg);
+ $message = LOAD_EMAIL_TEMPLATE('sponsor_unlocked', $content);
+ sendEmail($content['email'], getMessage('SPONSOR_UNLOCKED_SUBJ'), $message);
}
} else {
// Nothing selected
// Is a user id given?
if ((REQUEST_ISSET_GET('uid')) && (bigintval(REQUEST_GET('uid')) > 0)) {
// Load user data and display it
- $result = SQL_QUERY_ESC("SELECT surname, family, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `surname`, `family`, `email` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
// Is a user account found?
$content['text'] = trim(strip_tags(REQUEST_POST('text')));
// Send contact form out
- $msg = LOAD_EMAIL_TEMPLATE("member_contct", $content);
- sendEmail($content['email'], getMessage('ADMIN_CONTACT_USER_SUBJECT'), $msg);
+ $message = LOAD_EMAIL_TEMPLATE('member_contct', $content);
+ sendEmail($content['email'], getMessage('ADMIN_CONTACT_USER_SUBJECT'), $message);
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_USER_CONTACTED'));
} else {
// Load contact form template
- LOAD_TEMPLATE("admin_contct_user_form", false, $content);
+ LOAD_TEMPLATE('admin_contct_user_form', false, $content);
}
} else {
// Not found?
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `status`='CONFIRMED', ref_payout=%s, user_hash=NULL WHERE user_hash='%s' AND `status`='UNCONFIRMED' LIMIT 1",
array(getConfig('ref_payout'), REQUEST_GET('hash')), __FILE__, __LINE__);
if (SQL_AFFECTEDROWS() == 1) {
- $msg = LOAD_EMAIL_TEMPLATE("confirm-member", array('points' => getConfig('points_register')), bigintval($uid));
+ $message = LOAD_EMAIL_TEMPLATE("confirm-member", array('points' => getConfig('points_register')), bigintval($uid));
// And send him right away the confirmation mail
- sendEmail($email, getMessage('GUEST_THANX_CONFIRM'), $msg);
+ sendEmail($email, getMessage('GUEST_THANX_CONFIRM'), $message);
// Maybe he got "referaled"?
if (($rid > 0) && ($rid != $uid)) {
setSession('lead_uid', bigintval($uid));
// Lead-Code mode enabled
- redirectToUrl("lead-confirm.php");
+ redirectToUrl('lead-confirm.php');
} else {
define('__CONFIRM_MSG', getMessage('GUEST_CONFIRMED_DONE'));
define('__UID', bigintval($uid));
- LOAD_TEMPLATE("guest_confirm_table");
+ LOAD_TEMPLATE('guest_confirm_table');
}
} elseif (EXT_IS_ACTIVE('lead')) {
// Set special lead cookie
setSession('lead_uid', bigintval($uid));
// Lead-Code mode enabled
- redirectToUrl("lead-confirm.php");
+ redirectToUrl('lead-confirm.php');
} else {
// Nobody was found unter this hash key... or our new member want's to confirm twice?
define('__CONFIRM_MSG', getMessage('GUEST_CONFIRMED_TWICE'));
LOAD_TEMPLATE('guest_confirm_table');
}
} elseif ((isFormSent()) && (REQUEST_ISSET_POST('email'))) {
- // Confirmation link requested 0 1 2
- $result = SQL_QUERY_ESC("SELECT userid, status, user_hash FROM `{!_MYSQL_PREFIX!}_user_data` WHERE email='%s' LIMIT 1",
+ // Confirmation link requested 0 1 2
+ $result = SQL_QUERY_ESC("SELECT `userid`, `status`, `user_hash` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `email`='%s' LIMIT 1",
array(REQUEST_POST('email')), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Email address found
$DATA = SQL_FETCHROW($result);
- switch ($DATA[1])
- {
+ switch ($DATA[1]) {
case 'UNCONFIRMED': // Account not confirmed
- $msg = LOAD_EMAIL_TEMPLATE("guest_request_confirm", array('hash' => $DATA[2]), $DATA[0]);
- sendEmail(REQUEST_POST('email'), getMessage('REQUEST_CONFIRM_LINK_SUBJ'), $msg);
+ $message = LOAD_EMAIL_TEMPLATE('guest_request_confirm', array('hash' => $DATA[2]), $DATA[0]);
+ sendEmail(REQUEST_POST('email'), getMessage('REQUEST_CONFIRM_LINK_SUBJ'), $message);
$content = getMessage('CONFIRM_LINK_SENT');
break;
case 'LOCKED': // Account is locked
$content = getMessage('LOGIN_ID_LOCKED');
break;
- }
+ } // END - switch
} else {
// Email address not registered
$content = getMessage('EMAIL_ADDY_404');
}
define('__CONFIRM_MSG', $content);
- LOAD_TEMPLATE("guest_confirm_table");
+ LOAD_TEMPLATE('guest_confirm_table');
} else {
// No hash found, the guest may want to enter his email address to re-get his confirmation link?
- LOAD_TEMPLATE("guest_confirm_link");
+ LOAD_TEMPLATE('guest_confirm_link');
}
//
// Prepare email and send it to the sponsor
if ($SPONSOR['status'] == 'UNCONFIRMED') {
// Unconfirmed accounts
- $msg_sponsor = LOAD_EMAIL_TEMPLATE('sponsor_activate', $SPONSOR);
+ $message_sponsor = LOAD_EMAIL_TEMPLATE('sponsor_activate', $SPONSOR);
} else {
// Confirmed email address
- $msg_sponsor = LOAD_EMAIL_TEMPLATE('sponsor_email', $SPONSOR);
+ $message_sponsor = LOAD_EMAIL_TEMPLATE('sponsor_email', $SPONSOR);
}
- sendEmail(REQUEST_POST('email'), getMessage('SPONSOR_ACTIVATION_LINK_SUBJ'), $msg_sponsor);
+ sendEmail(REQUEST_POST('email'), getMessage('SPONSOR_ACTIVATION_LINK_SUBJ'), $message_sponsor);
// Output message
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('SPONSOR_ACTIVATION_LINK_SENT'));
if (isFormSent()) {
// Check email
- $result = SQL_QUERY_ESC("SELECT id, hash, remote_addr, gender, surname, family, sponsor_created
+ $result = SQL_QUERY_ESC("SELECT `id`, `hash`, `remote_addr`, `gender`, `surname`, `family`, `sponsor_created`
FROM `{!_MYSQL_PREFIX!}_sponsor_data`
-WHERE email='%s' AND id='%s' AND `status`='CONFIRMED' LIMIT 1",
+WHERE `email`='%s' AND `id`='%s' AND `status`='CONFIRMED' LIMIT 1",
array(REQUEST_POST('email'), bigintval(REQUEST_POST('id'))), __FILE__, __LINE__);
// Entry found?
if (SQL_NUMROWS($result) == 1) {
// Unconfirmed sponsor account found so let's load the requested data
- $SPONSOR = SQL_FETCHARRAY($result);
+ $DATA = SQL_FETCHARRAY($result);
// Translate some data
- $SPONSOR['gender'] = translateGender($SPONSOR['gender']);
- $SPONSOR['sponsor_created'] = generateDateTime($SPONSOR['sponsor_created']);
+ $DATA['gender'] = translateGender($DATA['gender']);
+ $DATA['sponsor_created'] = generateDateTime($DATA['sponsor_created']);
// Generate password
- $SPONSOR['password'] = generatePassword();
+ $DATA['password'] = generatePassword();
// Prepare email and send it to the sponsor
- $msg_sponsor = LOAD_EMAIL_TEMPLATE('sponsor_lost', $SPONSOR);
- sendEmail(REQUEST_POST('email'), getMessage('SPONSOR_LOST_PASSWORD_SUBJ'), $msg_sponsor);
+ $message_sponsor = LOAD_EMAIL_TEMPLATE('sponsor_lost', $DATA);
+ sendEmail(REQUEST_POST('email'), getMessage('SPONSOR_LOST_PASSWORD_SUBJ'), $message_sponsor);
// Update password
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET password='%s'
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET `password`='%s'
WHERE `id`='%s' LIMIT 1",
- array(md5($SPONSOR['password']), bigintval($SPONSOR['id'])), __FILE__, __LINE__);
+ array(md5($DATA['password']), bigintval($DATA['id'])), __FILE__, __LINE__);
// Output message
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('SPONSOR_LOST_PASSWORD_SENT'));
require($INC);
} elseif (!IS_MEMBER()) {
$URL = 'modules.php?module=index';
- if (checkModulePermissions('login') == 'mem_only') $URL .= '&msg='.getCode('MODULE_MEM_ONLY') . '&mod='.getModule();
+ if (checkModulePermissions('login') == 'mem_only') $URL .= '&msg=' . getCode('MODULE_MEM_ONLY') . '&mod=' . getModule();
redirectToUrl($URL);
}
define('_END_YEAR' , REQUEST_POST('end_year'));
// Send mail to member
- $msg = LOAD_EMAIL_TEMPLATE('member_holiday_request', REQUEST_POST('comments'), getUserId());
- sendEmail(getUserId(), getMessage('HOLIDAY_MEMBER_SUBJECT'), $msg);
+ $message = LOAD_EMAIL_TEMPLATE('member_holiday_request', REQUEST_POST('comments'), getUserId());
+ sendEmail(getUserId(), getMessage('HOLIDAY_MEMBER_SUBJECT'), $message);
// Send mail to all admins
sendAdminNotification(getMessage('HOLIDAY_ADMIN_SUBJECT'), 'admin_holiday_request', REQUEST_POST('comments'), getUserId());
// Create task
- SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (userid, assigned_admin, status, task_type, subject, text, task_created) VALUES ('%s','0','NEW','HOLIDAY_REQUEST','{--HOLIDAY_ADMIN_SUBJECT--}','%s', UNIX_TIMESTAMP())",
- array(getUserId(), $msg), __FILE__, __LINE__);
+ createNewTask('{--HOLIDAY_ADMIN_SUBJECT--}', $message, 'HOLIDAY_REQUEST', getUserId());
// Display message
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('HOLIDAY_IS_ACTIVATED_NOW'));
// Holiday shall be ended now
if (REQUEST_ISSET_POST('stop')) {
// Okay, end the holiday here...
- $result = SQL_QUERY_ESC("SELECT holiday_active, holiday_activated FROM `{!_MYSQL_PREFIX!}_user_data`
-WHERE userid=%s LIMIT 1", array(getUserId()), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT `holiday_active`, `holiday_activated` FROM `{!_MYSQL_PREFIX!}_user_data`
+WHERE `userid`=%s LIMIT 1", array(getUserId()), __FILE__, __LINE__);
list($active, $locked) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
if (($active == 'Y') && (($locked + getConfig('holiday_lock')) < time())) {
// Load data
- $result = SQL_QUERY_ESC("SELECT holiday_start, holiday_end FROM `{!_MYSQL_PREFIX!}_user_holidays`
-WHERE userid=%s LIMIT 1", array(getUserId()), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT `holiday_start`, `holiday_end` FROM `{!_MYSQL_PREFIX!}_user_holidays`
+WHERE `userid`=%s LIMIT 1", array(getUserId()), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Data was found
list($start, $end) = SQL_FETCHROW($result);
$OUT = "<select name=\"country_code\" class=\"member_select\" size=\"1\">\n";
$whereStatement = "WHERE `is_active`='Y'";
if (IS_ADMIN()) $whereStatement = '';
- $OUT .= generateOptionList("countries", 'id', "descr", $DATA[3], "code", $whereStatement);
+ $OUT .= generateOptionList('countries', 'id', 'descr', $DATA[3], 'code', $whereStatement);
$OUT .= "</select>";
define('__COUNTRY_CONTENT', $OUT);
} else {
), __FILE__, __LINE__);
} else {
// Old way
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET
-`gender`='%s', `surname`='%s', `family`='%s',
-`street_nr`='%s',
-`country`='%s', `zip`=%s, `city`='%s',
-`email`='%s',
-`birth_day`=%s, `birth_month`=%s, `birth_year`=%s,
-`max_mails`='%s',
-`last_update`=UNIX_TIMESTAMP()".$AND.",
-`notified`='N',
-`last_profile_sent`=UNIX_TIMESTAMP()
-WHERE `userid`=%s AND `password`='%s' LIMIT 1",
+ SQL_QUERY_ESC("UPDATE
+ `{!_MYSQL_PREFIX!}_user_data`
+SET
+ `gender`='%s', `surname`='%s', `family`='%s',
+ `street_nr`='%s',
+ `country`='%s', `zip`=%s, `city`='%s',
+ `email`='%s',
+ `birth_day`=%s, `birth_month`=%s, `birth_year`=%s,
+ `max_mails`='%s',
+ `last_update`=UNIX_TIMESTAMP()".$AND.",
+ `notified`='N',
+ `last_profile_sent`=UNIX_TIMESTAMP()
+WHERE
+ `userid`=%s AND `password`='%s'
+LIMIT 1",
array(
REQUEST_POST('gender'),
REQUEST_POST('surname'),
array(getUserId()), __FILE__, __LINE__);
// Load admin message
- $admin_msg = LOAD_EMAIL_TEMPLATE("admin_newsletter_request", array(), getUserId());
+ $admin_msg = LOAD_EMAIL_TEMPLATE('admin_newsletter_request', array(), getUserId());
// Add task
- SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (assigned_admin, status, task_type, subject, text, task_created, userid)
-VALUES ('0','NEW','NL_UNSUBSCRIBE','{--ADMIN_NL_SUBJECT--}','".$admin_msg."', UNIX_TIMESTAMP(),'%s')", array(getUserId()), __FILE__, __LINE__);
+ createNewTask('{--ADMIN_NL_SUBJECT--}', $admin_msg, 'NL_UNSUBSCRIBE', getUserId());
// Send mail to member
- $msg = LOAD_EMAIL_TEMPLATE("member_newsletter_request", array(), getUserId());
- sendEmail(getUserId(), getMessage('NL_MEMBER_SUBJECT'), $msg);
+ $message = LOAD_EMAIL_TEMPLATE('member_newsletter_request', array(), getUserId());
+ sendEmail(getUserId(), getMessage('NL_MEMBER_SUBJECT'), $message);
// Send mail to all admins
- sendAdminNotification(getMessage('NL_ADMIN_SUBJECT'), "admin_newsletter_request", array(), getUserId());
+ sendAdminNotification(getMessage('NL_ADMIN_SUBJECT'), 'admin_newsletter_request', array(), getUserId());
// Display message
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('NL_MEMBER_REQUEST_DONE'));
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('NL_MEMBER_REQUEST_ALREADY'));
} else {
// Load template for the note
- define('NL_MEMBER_NOTE', LOAD_TEMPLATE("member_newsletter_note", true));
+ define('NL_MEMBER_NOTE', LOAD_TEMPLATE('member_newsletter_note', true));
// Set status message and submit button
- switch ($status)
- {
+ switch ($status) {
case 'Y': // Receives the newsletter
define('__STATUS_VALUE', getMessage('NL_MEMBER_ON'));
define('__UNTIL_VALUE' , '');
define('__UNTIL_VALUE' , generateDateTime($until, '2'));
define('NL_SUBMIT' , getMessage('NL_MEMBER_SUBMIT_ON'));
break;
- }
+ } // END - switch
// Load template and member settings
- LOAD_TEMPLATE("member_newsletter");
+ LOAD_TEMPLATE('member_newsletter');
}
-//
+// [EOF]
?>
), __FILE__, __LINE__);
// Load templates
- $msg_mem = LOAD_EMAIL_TEMPLATE('member_payout_request_banner', REQUEST_POST_ARRAY(), getUserId());
+ $message_mem = LOAD_EMAIL_TEMPLATE('member_payout_request_banner', REQUEST_POST_ARRAY(), getUserId());
if (GET_EXT_VERSION('admins') >= '0.4.1') {
$adm_tpl = 'admin_payout_request_banner';
} else {
- $msg_adm = LOAD_EMAIL_TEMPLATE('admin_payout_request_banner', REQUEST_POST_ARRAY(), getUserId());
+ $message_adm = LOAD_EMAIL_TEMPLATE('admin_payout_request_banner', REQUEST_POST_ARRAY(), getUserId());
}
} else {
// e-currency payout requested
), __FILE__, __LINE__);
// Load templates
- $msg_mem = LOAD_EMAIL_TEMPLATE('member_payout_request', REQUEST_POST_ARRAY(), getUserId());
- $msg_adm = LOAD_EMAIL_TEMPLATE('admin_payout_request', REQUEST_POST_ARRAY(), getUserId());
+ $message_mem = LOAD_EMAIL_TEMPLATE('member_payout_request', REQUEST_POST_ARRAY(), getUserId());
+ $message_adm = LOAD_EMAIL_TEMPLATE('admin_payout_request', REQUEST_POST_ARRAY(), getUserId());
$admin_tpl = '';
// @TODO Rewrite this to a filter
}
// Generate task
- SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (assigned_admin, status, task_type, subject, text, task_created, userid)
-VALUES (0, 'NEW','PAYOUT_REQUEST','[payout:] {--PAYOUT_REQUEST_ADMIN--}','%s', UNIX_TIMESTAMP(), %s)",
- array(
- $msg_adm,
- getUserId()
- ), __FILE__, __LINE__);
+ createNewTask('[payout:] {--PAYOUT_REQUEST_ADMIN--}', $message_adm, 'PAYOUT_REQUEST', getUserId());
// Send out mails
- sendEmail(getUserId(), getMessage('PAYOUT_REQUEST_MEMBER'), $msg_mem);
+ sendEmail(getUserId(), getMessage('PAYOUT_REQUEST_MEMBER'), $message_mem);
// To admin(s)
sendAdminNotification(getMessage('PAYOUT_REQUEST_ADMIN'), $admin_tpl, REQUEST_POST_ARRAY(), getUserId());
if ((!isFormSent()) || (!REQUEST_ISSET_POST(('qsummary')))) {
// Output form
- LOAD_TEMPLATE("member_support_form");
+ LOAD_TEMPLATE('member_support_form');
} else {
// Load mail template based on your member's decision
if (GET_EXT_VERSION('admins') >= '0.4.1') {
- $a_tpl = "admin_support-".REQUEST_POST('qsummary');
+ $a_tpl = 'admin_support-' . REQUEST_POST('qsummary');
} else {
- $msg_a = LOAD_EMAIL_TEMPLATE("admin_support-".REQUEST_POST('qsummary'), array('text' => REQUEST_POST('qdetails')), getUserId());
+ $message_a = LOAD_EMAIL_TEMPLATE('admin_support-' . REQUEST_POST('qsummary'), array('text' => REQUEST_POST('qdetails')), getUserId());
}
- $msg_m = LOAD_EMAIL_TEMPLATE("member_support-".REQUEST_POST('qsummary'), array('text' => REQUEST_POST('qdetails')), getUserId());
+ $message_m = LOAD_EMAIL_TEMPLATE('member_support-' . REQUEST_POST('qsummary'), array('text' => REQUEST_POST('qdetails')), getUserId());
// Select right subject
switch (REQUEST_POST('qsummary')) {
- case "ordr":
+ case 'ordr':
$subj_a = getMessage('SUPPORT_SUBJ_ADMIN_ORDER');
$subj_m = getMessage('SUPPORT_SUBJ_MEMBER_ORDER');
break;
- case "reflink":
+ case 'reflink':
$subj_a = getMessage('SUPPORT_SUBJ_ADMIN_REFLINK');
$subj_m = getMessage('SUPPORT_SUBJ_MEMBER_REFLINK');
break;
- case "unconfirmed":
+ case 'unconfirmed':
$subj_a = getMessage('SUPPORT_SUBJ_ADMIN_UNCONFIRMED');
$subj_m = getMessage('SUPPORT_SUBJ_MEMBER_UNCONFIRMED');
break;
sendAdminNotification($subj_a, $a_tpl, array('text' => REQUEST_POST('qdetails')), getUserId());
// Send mail to user
- sendEmail(getUserId(), $subj_m, $msg_m);
+ sendEmail(getUserId(), $subj_m, $message_m);
// Drop a message in the admin's area
- SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (userid, assigned_admin, status, task_type, subject, text, task_created) VALUES ('%s','0','NEW','SUPPORT_MEMBER','%s','%s', UNIX_TIMESTAMP())",
- array(getUserId(), $subj_a, REQUEST_POST('qsummary') . ':'.array('text' => REQUEST_POST('qdetails'))), __FILE__, __LINE__);
+ createNewTask($subj_a, REQUEST_POST('qsummary') . ' : ' . REQUEST_POST('qdetails'), 'SUPPORT_MEMBER', getUserId());
// Form sent
- LOAD_TEMPLATE("member_support_contcted");
+ LOAD_TEMPLATE('member_support_contcted');
}
-//
+
+// [EOF]
?>
$insertId = SURFBAR_MEMBER_ADD_URL(REQUEST_POST('url'), REQUEST_POST('limit'));
// By default something went wrong
- $msg = getMessage('MEMBER_SURFBAR_URL_NOT_ADDED');
+ $message = getMessage('MEMBER_SURFBAR_URL_NOT_ADDED');
// Was this fine?
if ($insertId > 0) {
// URL added and waiting for unlock
- $msg = getMessage('MEMBER_SURFBAR_URL_ADDED');
+ $message = getMessage('MEMBER_SURFBAR_URL_ADDED');
} // END - if
// Load message template
- LOAD_TEMPLATE('admin_settings_saved', false, $msg);
+ LOAD_TEMPLATE('admin_settings_saved', false, $message);
} else {
// Prepare some content
$content = array(
);
// Read directory "themes"
-$handle = opendir(constant('PATH')."theme/") or app_die(__FILE__, __LINE__, "Cannot read themes dir!");
-while ($entry = readdir($handle)) {
- // Construct absolute theme.php file name
- $INC = sprintf("theme/%s/theme.php", $entry);
+$includes = getArrayFromDirectory('theme/', '', false, true, array('css', 'images'));
- if ((!isDirectory($entry)) && (isIncludeReadable($INC)) && (isThemeActive($entry))) {
+// Walk through all entries and add it
+foreach ($includes as $INC) {
+ // Get directory from it
+ $dir = basename(dirname($INC));
+
+ // Is the theme active, then include it
+ if (isThemeActive($dir)) {
// Found a valid directory so let's load it's theme.php file
loadInclude($INC);
// Add found theme to array
- $THEMES['theme_unix'][] = $entry;
+ $THEMES['theme_unix'][] = $dir;
$THEMES['theme_name'][] = $GLOBALS['theme_data']['name'];
$THEMES['theme_author'][] = $GLOBALS['theme_data']['author'];
$THEMES['theme_email'][] = $GLOBALS['theme_data']['email'];
// Remove last theme data
unset($GLOBALS['theme_data']);
-// Close directory
-closedir($handle);
-
// Sort array by Uni* name
-array_pk_sort($THEMES, array("theme_name"));
+array_pk_sort($THEMES, array('theme_name'));
// Generate output lines for the template
$OUT = ''; $SW = 2;
SUB_POINTS('transfer', getUserId(), REQUEST_POST('points'));
// First send email to recipient
- $msg = LOAD_EMAIL_TEMPLATE('member_transfer_recipient', '', constant('__RECIPIENT_UID'));
- sendEmail(constant('__RECIPIENT_EMAIL'), getMessage('TRANSFER_MEMBER_RECIPIENT_SUBJ') . ': ' . $SENDER, $msg);
+ $message = LOAD_EMAIL_TEMPLATE('member_transfer_recipient', '', constant('__RECIPIENT_UID'));
+ sendEmail(constant('__RECIPIENT_EMAIL'), getMessage('TRANSFER_MEMBER_RECIPIENT_SUBJ') . ': ' . $SENDER, $message);
// Second send email to sender
- $msg = LOAD_EMAIL_TEMPLATE('member_transfer_sender', '', constant('__SENDER_UID'));
- sendEmail(constant('__SENDER_EMAIL'), getMessage('TRANSFER_MEMBER_SENDER_SUBJ') . ': ' . $RECIPIENT, $msg);
+ $message = LOAD_EMAIL_TEMPLATE('member_transfer_sender', '', constant('__SENDER_UID'));
+ sendEmail(constant('__SENDER_EMAIL'), getMessage('TRANSFER_MEMBER_SENDER_SUBJ') . ': ' . $RECIPIENT, $message);
// At last send admin mail(s)
$ADMIN_SUBJ = sprintf("%s (%s->%s)", getMessage('TRANSFER_ADMIN_SUBJECT'), $SENDER, $RECIPIENT);
//
// First of all create the temporary table
$result = SQL_QUERY("CREATE TEMPORARY TABLE `{!_MYSQL_PREFIX!}_transfers_tmp` (
-trans_id VARCHAR(12) NOT NULL DEFAULT '',
-party_uid BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
-points BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
-reason VARCHAR(255) NOT NULL DEFAULT '',
-time_trans VARCHAR(10) NOT NULL DEFAULT '0',
-trans_type ENUM('IN','OUT') NOT NULL DEFAULT 'IN',
-KEY(party_uid)
+`trans_id` VARCHAR(12) NOT NULL DEFAULT '',
+`party_uid` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
+`points` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
+`reason` VARCHAR(255) NOT NULL DEFAULT '',
+`time_trans` VARCHAR(10) NOT NULL DEFAULT '0',
+`trans_type` ENUM('IN','OUT') NOT NULL DEFAULT 'IN',
+KEY(`party_uid`)
) TYPE=HEAP", __FILE__, __LINE__);
// Let's begin with the incoming list
$DATA[] = 'IN';
$DATA = implode("','", $DATA);
$res_temp = SQL_QUERY("INSERT INTO `{!_MYSQL_PREFIX!}_transfers_tmp` (`trans_id`, `party_uid`, `points`, `reason`, `time_trans`, `trans_type`) VALUES ('".$DATA."')", __FILE__, __LINE__);
- }
+ } // END - while
// Free memory
SQL_FREERESULT($result);
$content['category'] = getCategory($content['cat_id']);
// Send an email to the user
- $msg_mem = LOAD_EMAIL_TEMPLATE('order-member', $content, getUserId());
- sendEmail(getUserId(), getMessage('MEMBER_NEW_QUEUE'), $msg_mem);
+ $message_mem = LOAD_EMAIL_TEMPLATE('order-member', $content, getUserId());
+ sendEmail(getUserId(), getMessage('MEMBER_NEW_QUEUE'), $message_mem);
// Notify admins about this
sendAdminNotification(getMessage('ADMIN_NEW_QUEUE'), 'order-admin', $content, getUserId());
$content['points'] = translateComma($content['points']);
// Load email template and email it away
- $msg = LOAD_EMAIL_TEMPLATE('member_beg', $content, bigintval($content['userid']));
- sendEmail($content['email'], getMessage('BEG_MONTHLY_RALLYE'), $msg);
+ $message = LOAD_EMAIL_TEMPLATE('member_beg', $content, bigintval($content['userid']));
+ sendEmail($content['email'], getMessage('BEG_MONTHLY_RALLYE'), $message);
} // END - while
// Reset accounts
$content['points'] = translateComma($content['points']);
// Load email template and email it away
- $msg = LOAD_EMAIL_TEMPLATE("member_bonus", $content['points'], bigintval($content['uid']));
- sendEmail($content['email'], getMessage('BONUS_MONTHLY_ONLINE_BONUS'), $msg);
+ $message = LOAD_EMAIL_TEMPLATE('member_bonus', $content['points'], bigintval($content['uid']));
+ sendEmail($content['email'], getMessage('BONUS_MONTHLY_ONLINE_BONUS'), $message);
} // END - if
} // END - while
while ($content = SQL_FETCHARRAY($result)) {
// Update account
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `nl_receive`='Y', `nl_until`=0 WHERE `userid`=%s LIMIT 1",
- array(bigintval($content['userid'])), __FILE__, __LINE__);
+ array(bigintval($content['userid'])), __FILE__, __LINE__);
// Send email to him
- $msg = LOAD_EMAIL_TEMPLATE("member_newsletter_reset", true, bigintval($content['userid']));
- sendEmail($content['email'], getMessage('NL_MEMBER_RESET_SUBJECT'), $msg);
+ $message = LOAD_EMAIL_TEMPLATE("member_newsletter_reset", true, bigintval($content['userid']));
+ sendEmail($content['email'], getMessage('NL_MEMBER_RESET_SUBJECT'), $message);
// Send email to admin
sendAdminNotification(getMessage('NL_ADMIN_SUBJECT'), "admin_newsletter_reset", array(), getUserId());
// Update sending pool
if ((getOutputMode() != '1') && (getOutputMode() != '-1')) loadIncludeOnce('inc/pool-update.php'); // Sends out mails in configureable steps
- // Load all active extension including language files when not upgrading.
- // Check module for testing and count one click
- if (checkModulePermissions(getModule()) == 'done') countModuleHit(getModule());
+ // Check module for permissions
+ $checkModule = checkModulePermissions(getModule());
+ if ($checkModule != 'done') {
+ // Not fine!
+ DEBUG_LOG(__FILE__, __LINE__, sprintf("Check of module %s results in unpexted value: %s",
+ getModule(),
+ $checkModule
+ ));
+ } // END - if
// Shall we activate the exchange?
if (getConfig('activate_xchange') > 0) activateExchange();
// Check validity of a given module name (no file extension)
function checkModulePermissions ($mod) {
// Filter module name (names with low chars and underlines are fine!)
- $mod = preg_replace("/[^a-z_]/", '', $mod);
+ $mod = preg_replace('/[^a-z_]/', '', $mod);
// Check for prefix is a extension...
$modSplit = explode("_", $mod);
//
// Admin access ----- Guest access ----- --- Guest or member? ---
if ((IS_ADMIN()) || (($locked == 'N') && ($admin == 'N') && (($mem == 'N') || (IS_MEMBER())))) {
+ // Count module
+ countModuleHit($mod_chk);
+
// If you are admin you are welcome for everything!
$ret = 'done';
} elseif ($locked == 'Y') {
} // 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`",
+ $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: */ echo __LINE__.'/'.$main_cnt.'/'.$main_action.'/'.$sub_what.':'.getWhat()."*<br />\n";
if (SQL_NUMROWS($result_main) > 0) {
// Add regular menu row or bottom row?
if ($cnt < $ctl) {
- LOAD_TEMPLATE($mode."_menu_row", false, $content);
+ LOAD_TEMPLATE($mode . '_menu_row', false, $content);
} else {
- LOAD_TEMPLATE($mode."_menu_bottom", false, $content);
+ LOAD_TEMPLATE($mode . '_menu_bottom', false, $content);
}
}
} else {
// Close table
//* DEBUG: */ echo __LINE__.'/'.$main_cnt.'/'.$content['action'].'/'.$content['sub_what'].':'.getWhat()."*<br />\n";
OUTPUT_HTML("</table>");
- }
+ } // END - if
}
// Checks wether the current user is a member
// Are cookies set?
if ((isUserIdSet()) && (isSessionVariableSet('u_hash'))) {
// Cookies are set with values, but are they valid?
- $result = SQL_QUERY_ESC("SELECT password, status, last_module, last_online FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `password`, `status`, `last_module`, `last_online` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
array(getUserId()), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Load data from cookies
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",
- 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",
- array($mode, $act, $wht), __FUNCTION__, __LINE__, false);
+ $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);
} else {
// Admin login overview
- $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);
}
// Run SQL command
global $DATA;
// Load hash
- $result_main = SQL_QUERY_ESC("SELECT password FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1",
- array(getUserId()), __FUNCTION__, __LINE__);
+ $result_main = SQL_QUERY_ESC("SELECT `password` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s AND `status`='CONFIRMED' LIMIT 1",
+ array(getUserId()), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result_main) == 1) {
// Load hash from database
list($hashDB) = SQL_FETCHROW($result_main);
$content = merge_array($content, REQUEST_POST_ARRAY());
// Load template
- $msg = LOAD_EMAIL_TEMPLATE('member_mydata_notify', $content, getUserId());
+ $message = LOAD_EMAIL_TEMPLATE('member_mydata_notify', $content, getUserId());
if (getConfig('admin_notify') == 'Y') {
// The admin needs to be notified about a profile change
- $msg_admin = 'admin_mydata_notify';
+ $message_admin = 'admin_mydata_notify';
$sub_adm = getMessage('ADMIN_CHANGED_DATA');
} else {
// No mail to admin
- $msg_admin = '';
+ $message_admin = '';
$sub_adm = '';
}
}
// Send email to user if required
- if ((!empty($sub_mem)) && (!empty($msg))) {
+ if ((!empty($sub_mem)) && (!empty($message))) {
// Send member mail
- sendEmail($DATA[7], $sub_mem, $msg);
+ sendEmail($DATA[7], $sub_mem, $message);
} // END - if
// Send only if no other error has occured
if (empty($content)) {
- if ((!empty($sub_adm)) && (!empty($msg_admin))) {
+ if ((!empty($sub_adm)) && (!empty($message_admin))) {
// Send admin mail
- sendAdminNotification($sub_adm, $msg_admin, $content, getUserId());
+ sendAdminNotification($sub_adm, $message_admin, $content, getUserId());
} elseif (getConfig('admin_notify') == 'Y') {
// Cannot send mails to admin!
$content = getMessage('CANNOT_SEND_ADMIN_MAILS');
// Update module counter
function countModuleHit($mod) {
- if ($mod != "css") {
- // Do count all other modules but not accesses on CSS file css.php!
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET clicks=clicks+1 WHERE `module`='%s' LIMIT 1",
+ // Do count all other modules but not accesses on CSS file css.php!
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `clicks`=`clicks`+1 WHERE `module`='%s' LIMIT 1",
array($mod), __FUNCTION__, __LINE__);
- } // END - if
}
// Get action value from mode (admin/guest/member) and what-value
}
// Remove a receiver's ID from $receivers and add a link for him to confirm
-function removeReceiver (&$receivers, $key, $uid, $pool_id, $stats_id='', $bonus=false) {
+function removeReceiver (&$receivers, $key, $uid, $pool_id, $stats_id = '', $bonus = false) {
// Default is not removed
$ret = 'failed';
// Was it *not* found?
if (SQL_NUMROWS($result) == 0) {
// So we add one!
- SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_user_links` (%s, userid, link_type) VALUES ('%s','%s','%s')",
+ 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__);
$ret = 'done';
} else {
);
// Load email template
- $msg = LOAD_EMAIL_TEMPLATE('confirm-referal', $content, bigintval($uid));
+ $message = LOAD_EMAIL_TEMPLATE('confirm-referal', $content, bigintval($uid));
- sendEmail($email, THANX_REFERRAL_ONE, $msg);
+ sendEmail($email, THANX_REFERRAL_ONE, $message);
} elseif (($send_notify) && ($ref == 0) && (!$locked) && ($add_mode == 'direct') && (!defined('__POINTS_VALUE'))) {
// Direct payment shall be notified about
define('__POINTS_VALUE', $ref_points);
);
// Load message
- $msg = LOAD_EMAIL_TEMPLATE('add-points', $content, $uid);
+ $message = LOAD_EMAIL_TEMPLATE('add-points', $content, $uid);
// And sent it away
- sendEmail($email, getMessage('SUBJECT_DIRECT_PAYMENT'), $msg);
+ sendEmail($email, getMessage('SUBJECT_DIRECT_PAYMENT'), $message);
if (!REQUEST_ISSET_GET('mid')) LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_POINTS_ADDED'));
}
// Sends out mail to all administrators. This function is no longer obsolete
// because we need it when there is no ext-admins installed
-function SEND_ADMIN_EMAILS ($subj, $msg) {
+function SEND_ADMIN_EMAILS ($subj, $message) {
// Load all admin email addresses
$result = SQL_QUERY("SELECT `email` FROM `{!_MYSQL_PREFIX!}_admins` ORDER BY `id` ASC", __FUNCTION__, __LINE__);
while ($content = SQL_FETCHARRAY($result)) {
// Send the email out
- sendEmail($content['email'], $subj, $msg);
+ sendEmail($content['email'], $subj, $message);
} // END - if
// Free result
} // END - if
// Now a mail to the user and that's all...
- $msg = LOAD_EMAIL_TEMPLATE('del-user', array('text' => $reason), $uid);
- sendEmail($uid, getMessage('ADMIN_DEL_ACCOUNT'), $msg);
+ $message = LOAD_EMAIL_TEMPLATE('del-user', array('text' => $reason), $uid);
+ sendEmail($uid, getMessage('ADMIN_DEL_ACCOUNT'), $message);
// Ok, delete the account!
SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1", array(bigintval($uid)), __FUNCTION__, __LINE__);
// Try to find the entry
$result = SQL_QUERY_ESC("SELECT UNIX_TIMESTAMP(`inserted`) AS `stamp`
FROM `{!_MYSQL_PREFIX!}_user_stats_data`
-WHERE userid=%s AND stats_type='%s' AND stats_data='%s'
+WHERE `userid`=%s AND `stats_type`='%s' AND `stats_data`='%s'
LIMIT 1",
- array(bigintval($uid), $type, $data), __FUNCTION__, __LINE__);
+ array(
+ bigintval($uid),
+ $type,
+ $data
+ ), __FUNCTION__, __LINE__);
// Is the entry there?
if (SQL_NUMROWS($result) == 1) {
array(bigintval($uid), $type, $data), __FUNCTION__, __LINE__);
} elseif (is_array($data)) {
// Invalid data!
- DEBUG_LOG(__FUNCTION__, __LINE__, " uid={$uid},type={$type},data={".gettype($data).": Invalid statistics data type!");
+ DEBUG_LOG(__FUNCTION__, __LINE__, "uid={$uid},type={$type},data={".gettype($data).": Invalid statistics data type!");
}
}
// Now update all user accounts
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `emails_received`=`emails_received`-1 WHERE `userid` IN (%s) LIMIT %s",
- array(implode(',', $UIDs), count($UIDs)), __FUNCTION__, __LINE__);
+ array(implode(',', $UIDs), count($UIDs)), __FUNCTION__, __LINE__);
} // END - if
// Free result
// Checks wether the SQLs array is filled
function IS_SQLS_VALID () {
return (
- (IS_SQLS_INITIALIZED()) &&
- (COUNT_SQLS() > 0)
+ (IS_SQLS_INITIALIZED())
+ &&
+ (COUNT_SQLS() > 0)
);
}
+// Creates a new task
+function createNewTask($subject, $notes, $taskType, $userid = 0, $admin_id = 0, $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($admin_id, $userid, $taskType, $subject, $notes), __FUNCTION__, __LINE__, true, $strip);
+}
+
// [EOF]
?>
if ($GLOBALS['pool_cnt'] < getConfig('max_send')) {
// Do we need to send out bonus mails?
if (EXT_IS_ACTIVE('html_mail')) {
- // 0 1 2 3 4 5 6 7 8 9 10 11
- $result_bonus = SQL_QUERY("SELECT id, subject, text, receivers, points, time, data_type, timestamp, url, cat_id, target_send, html_msg FROM `{!_MYSQL_PREFIX!}_bonus` WHERE data_type='NEW' ORDER BY timestamp DESC", __FILE__, __LINE__);
+ // 0 1 2 3 4 5 6 7 8 9 10 11
+ $result_bonus = SQL_QUERY("SELECT `id`, `subject`, `text`, `receivers`, `points`, `time`, `data_type`, `timestamp`, `url`, `cat_id`, `target_send`, `html_msg` FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `data_type`='NEW' ORDER BY `timestamp` DESC", __FILE__, __LINE__);
} else {
- // 0 1 2 3 4 5 6 7 8 9 10
- $result_bonus = SQL_QUERY("SELECT id, subject, text, receivers, points, time, data_type, timestamp, url, cat_id, target_send FROM `{!_MYSQL_PREFIX!}_bonus` WHERE data_type='NEW' ORDER BY timestamp DESC", __FILE__, __LINE__);
+ // 0 1 2 3 4 5 6 7 8 9 10
+ $result_bonus = SQL_QUERY("SELECT `id`, `subject`, `text`, `receivers`, `points`, `time`, `data_type`, `timestamp`, `url`, `cat_id`, `target_send` FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `data_type`='NEW' ORDER BY `timestamp` DESC", __FILE__, __LINE__);
}
if (SQL_NUMROWS($result_bonus) > 0) {
$DATA['url'] = COMPILE_CODE($DATA['url']);
// Message is active in queue
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_bonus` SET data_type='QUEUE' WHERE `id`=%s LIMIT 1",
- array(bigintval($DATA['id'])), __FILE__, __LINE__);
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_bonus` SET `data_type`='QUEUE' WHERE `id`=%s LIMIT 1",
+ array(bigintval($DATA['id'])), __FILE__, __LINE__);
// "Explode" all receivers into an array
if (ereg(';', $DATA['receivers'])) {
foreach ($RECEIVERS as $key => $uid) {
// Load personal data
//* DEBUG: */ echo "*L:".__LINE__.'/'.$uid."*<br />";
- $result_user = SQL_QUERY_ESC("SELECT surname, family, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
- array(bigintval($uid)), __FILE__, __LINE__);
+ $result_user = SQL_QUERY_ESC("SELECT `surname`, `family`, `email` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
+ array(bigintval($uid)), __FILE__, __LINE__);
// Is his data available?
if (SQL_NUMROWS($result_user) == 1) {
);
// Prepare the mail
- $mailText = LOAD_EMAIL_TEMPLATE("bonus-mail", $content, $uid);
+ $mailText = LOAD_EMAIL_TEMPLATE('bonus-mail', $content, $uid);
// Send mail away
if (isset($DATA['html_msg'])) {
// Check for freed mail orders to send out
if (EXT_IS_ACTIVE('html_mail')) {
// 0 1 2 3 4 5 6 7 8 9 10
- $result_main = SQL_QUERY("SELECT id, sender, subject, text, receivers, payment_id, timestamp, url, target_send, cat_id, html_msg FROM `{!_MYSQL_PREFIX!}_pool` WHERE data_type='NEW' ORDER BY timestamp DESC", __FILE__, __LINE__);
+ $result_main = SQL_QUERY("SELECT id, sender, subject, text, receivers, payment_id, timestamp, url, target_send, cat_id, html_msg FROM `{!_MYSQL_PREFIX!}_pool` WHERE `data_type`='NEW' ORDER BY timestamp DESC", __FILE__, __LINE__);
} else {
// 0 1 2 3 4 5 6 7 8 9 10
- $result_main = SQL_QUERY("SELECT id, sender, subject, text, receivers, payment_id, timestamp, url, target_send, cat_id, id FROM `{!_MYSQL_PREFIX!}_pool` WHERE data_type='NEW' ORDER BY timestamp DESC", __FILE__, __LINE__);
+ $result_main = SQL_QUERY("SELECT id, sender, subject, text, receivers, payment_id, timestamp, url, target_send, cat_id, id FROM `{!_MYSQL_PREFIX!}_pool` WHERE `data_type`='NEW' ORDER BY timestamp DESC", __FILE__, __LINE__);
}
// Reset variables
// Parse all mails
while ($DATA = SQL_FETCHROW($result_main)) {
// Set mail order as 'active'. That means it will be sent out
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET data_type='ACTIVE' WHERE `id`=%s AND data_type='NEW' LIMIT 1",
- array($DATA[0]), __FILE__, __LINE__);
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET `data_type`='ACTIVE' WHERE `id`=%s AND `data_type`='NEW' LIMIT 1",
+ array($DATA[0]), __FILE__, __LINE__);
// Check fetched data for HTML
$HTML = $DATA[10]; if ($HTML == $DATA[0]) $HTML = 'N';
foreach ($RECEIVERS as $key => $uid) {
// Lookup user ID
$result_user = SQL_QUERY_ESC("SELECT gender, surname, family, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
- array(bigintval($uid)), __FILE__, __LINE__);
+ array(bigintval($uid)), __FILE__, __LINE__);
// Is his data available?
//* DEBUG: */ echo "*L:".__LINE__.'/'.SQL_NUMROWS($result_user)."*<br />";
// Do we have a stats entry?
$result_stats = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE pool_id=%s AND `userid`=%s AND timestamp_ordered='%s' LIMIT 1",
- array($DATA[0], $DATA[1], $DATA[6]), __FILE__, __LINE__);
+ array($DATA[0], $DATA[1], $DATA[6]), __FILE__, __LINE__);
// If there's no stats entry add it!
//* DEBUG: */ echo "!L:".__LINE__.'/'.SQL_NUMROWS($result_stats)."!<br />";
if (SQL_NUMROWS($result_stats) == 0) {
// No entry was found, so we add him!
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_user_stats` (pool_id , userid, cat_id, payment_id, subject, url , max_rec , timestamp_ordered, timestamp_sstart) VALUES ('%s','%s','%s','%s','%s','%s','%s','%s' , UNIX_TIMESTAMP())",
- array(bigintval($DATA[0]), bigintval($DATA[1]), bigintval($DATA[9]), bigintval($DATA[5]), $DATA[2], $DATA[7], $DATA[8], bigintval($DATA[6])), __FILE__, __LINE__);
+ array(bigintval($DATA[0]), bigintval($DATA[1]), bigintval($DATA[9]), bigintval($DATA[5]), $DATA[2], $DATA[7], $DATA[8], bigintval($DATA[6])), __FILE__, __LINE__);
// Receive it's ID for the links table
$result_stats = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE pool_id=%s AND `userid`=%s AND timestamp_ordered='%s' LIMIT 1",
- array(bigintval($DATA[0]), bigintval($DATA[1]), bigintval($DATA[6])), __FILE__, __LINE__);
+ array(bigintval($DATA[0]), bigintval($DATA[1]), bigintval($DATA[6])), __FILE__, __LINE__);
} // END - if
//* DEBUG: */ echo "!L:".__LINE__.'/'.SQL_NUMROWS($result_stats)."!<br />";
// Count sent mails...
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET emails_sent=emails_sent+1 WHERE userid=%s LIMIT 1",
- array(bigintval($DATA[1])), __FILE__, __LINE__);
+ array(bigintval($DATA[1])), __FILE__, __LINE__);
if (GET_EXT_VERSION('user') >= '0.1.4') {
// Update mails received for receiver
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET emails_received=emails_received+1 WHERE userid=%s LIMIT 1",
- array(bigintval($uid)), __FILE__, __LINE__);
+ array(bigintval($uid)), __FILE__, __LINE__);
} // END - if
// Update mediadata if version is 0.0.4 or higher
// Get sender's data
$result_sender = SQL_QUERY_ESC("SELECT surname, family, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
- array(bigintval($DATA[1])), __FILE__, __LINE__);
+ array(bigintval($DATA[1])), __FILE__, __LINE__);
// Is the sender found?
if (SQL_NUMROWS($result_sender) == 1) {
// Set status to SEND because we completely send it away
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET `data_type`='SEND', `target_send`=0, `receivers`='' WHERE `id`=%s LIMIT 1",
- array(bigintval($DATA[0])), __FILE__, __LINE__);
+ array(bigintval($DATA[0])), __FILE__, __LINE__);
// Update send-completed-time
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_stats` SET `timestamp_send`=UNIX_TIMESTAMP() WHERE `pool_id`=%s LIMIT 1",
- array(bigintval($DATA[0])), __FILE__, __LINE__);
+ array(bigintval($DATA[0])), __FILE__, __LINE__);
$lastSentId = $DATA[0]; $GLOBALS['pool_cnt'] = 0;
$cnt2 += $GLOBALS['pool_cnt'];
// There are some mails left to send for next round, so we reset the status back to NEW (=still not fully delivered)
$add = '';
if ($GLOBALS['pool_cnt'] <= $DATA[8]) $add = ", target_send=target_send-".$GLOBALS['pool_cnt'];
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET data_type='NEW', receivers='%s'".$add." WHERE `id`=%s LIMIT 1",
- array(implode(';', $dummy), bigintval($DATA[0])), __FILE__, __LINE__);
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET `data_type`='NEW', receivers='%s'".$add." WHERE `id`=%s LIMIT 1",
+ array(implode(';', $dummy), bigintval($DATA[0])), __FILE__, __LINE__);
//* DEBUG: */ echo"*EXIT/L:".__LINE__."*<br />";
break;
// User does not exists so we have add the sender's points back to sender's account
if (($RECEIVERS[0] == '0') || (empty($RECEIVERS[0]))) {
// List was empty
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET data_type='SEND' WHERE `id`=%s LIMIT 1",
- array(bigintval($DATA[0])), __FILE__, __LINE__);
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET `data_type`='SEND' WHERE `id`=%s LIMIT 1",
+ array(bigintval($DATA[0])), __FILE__, __LINE__);
} else {
// Is the userid set?
if ($uid > 0) {
// Update receivers
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET receivers='%s' WHERE `id`=%s LIMIT 1",
- array(implode(';', $dummy), bigintval($DATA[0])), __FILE__, __LINE__);
+ array(implode(';', $dummy), bigintval($DATA[0])), __FILE__, __LINE__);
}
}
}
}
if ((getConfig('send_prof_update') == 'Y') && (getConfig('profile_update') > 0) && (getConfig('resend_profile_update'))) {
- // Load personal data 0 1 2 3
- $result = SQL_QUERY_ESC("SELECT userid, email, last_update, joined
+ // Load personal data
+ $result = SQL_QUERY_ESC("SELECT `userid`, `email`, `last_update`, `joined`
FROM
- {!_MYSQL_PREFIX!}_user_data
+ `{!_MYSQL_PREFIX!}_user_data`
WHERE
- (last_update < (UNIX_TIMESTAMP() - %s) AND last_update != 0 AND last_profile_sent < (UNIX_TIMESTAMP() - %s))
+ (`last_update` < (UNIX_TIMESTAMP() - %s) AND `last_update` != 0 AND `last_profile_sent` < (UNIX_TIMESTAMP() - %s))
OR
- (last_update=0 AND last_profile_sent=0 AND joined < (UNIX_TIMESTAMP() - %s))
-ORDER BY `userid` ASC", array(getConfig('profile_update'), getConfig('resend_profile_update'), getConfig('profile_update')), __FILE__, __LINE__);
+ (`last_update` = 0 AND `last_profile_sent` = 0 AND `joined` < (UNIX_TIMESTAMP() - %s))
+ORDER BY
+ `userid` ASC",
+ array(
+ getConfig('profile_update'),
+ getConfig('resend_profile_update'),
+ getConfig('profile_update')
+ ), __FILE__, __LINE__);
// Do we have some notifications to sent?
if (SQL_NUMROWS($result) > 0) {
}
// Load email template and send mail away
- $msg = LOAD_EMAIL_TEMPLATE("profile-updte", '', bigintval($content['userid']));
- sendEmail($content['email'], getMessage('PROFILE_OUTDATED'), $msg);
+ $message = LOAD_EMAIL_TEMPLATE('profile-updte', '', bigintval($content['userid']));
+ sendEmail($content['email'], getMessage('PROFILE_OUTDATED'), $message);
// Update profile data
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET last_profile_sent=UNIX_TIMESTAMP(), notified='Y' WHERE userid=%s LIMIT 1",
- array(bigintval($content['userid'])), __FILE__, __LINE__);
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `last_profile_sent`=UNIX_TIMESTAMP(), `notified`='Y' WHERE `userid`=%s LIMIT 1",
+ array(bigintval($content['userid'])), __FILE__, __LINE__);
} // END - while
} // END - if
);
// Send email to user
- $msg = LOAD_EMAIL_TEMPLATE("member_holiday_activated", $content, $content['userid']);
- sendEmail($content['userid'], getMessage('HOLIDAY_MEMBER_ACTIVATED_SUBJ'), $msg);
+ $message = LOAD_EMAIL_TEMPLATE('member_holiday_activated', $content, $content['userid']);
+ sendEmail($content['userid'], getMessage('HOLIDAY_MEMBER_ACTIVATED_SUBJ'), $message);
// Update account
ADD_SQL(SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data`
SET `holiday_active`='Y'
-WHERE userid=%s
+WHERE `userid`=%s
LIMIT 1",
- array(bigintval($content['userid'])), __FILE__, __LINE__, false));
+ array(bigintval($content['userid'])), __FILE__, __LINE__, false));
} // END - if
// Free memory
}
// Check for 100% klickrate mails
-$result_bonus = SQL_QUERY("SELECT id, userid, subject, timestamp_ordered, clicks, url
-FROM `{!_MYSQL_PREFIX!}_user_stats`
-WHERE max_rec=clicks AND clicks>0 AND bonus_stats_active='N'
-ORDER BY `userid` ASC", __FILE__, __LINE__);
+$result_bonus = SQL_QUERY("SELECT
+ `id`, `userid`, `subject`, `timestamp_ordered`, `clicks`, `url`
+FROM
+ `{!_MYSQL_PREFIX!}_user_stats`
+WHERE
+ `max_rec`=`clicks` AND `clicks` > 0 AND `bonus_stats_active`='N'
+ORDER BY
+ `userid` ASC", __FILE__, __LINE__);
if (SQL_NUMROWS($result_bonus) > 0) {
// Remember stats bonus in constant
// We found some mail orders...
while ($content = SQL_FETCHARRAY($result_bonus)) {
// Add points
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET bonus_stats=bonus_stats+%s WHERE userid=%s LIMIT 1",
- array(getConfig('bonus_stats'), bigintval($content['userid'])), __FILE__, __LINE__);
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `bonus_stats`=`bonus_stats`+%s WHERE `userid`=%s LIMIT 1",
+ array(getConfig('bonus_stats'), bigintval($content['userid'])), __FILE__, __LINE__);
// Translate some data
$content['timestamp'] = generateDateTime($content['timestamp_ordered'], '2');
// Load email template and send email
- $msg = LOAD_EMAIL_TEMPLATE("member_stats_bonus", $content, bigintval($content['userid']));
- sendEmail($content['userid'], getMessage('BONUS_MEMBER_STATS_SUBJECT'), $msg);
+ $message = LOAD_EMAIL_TEMPLATE('member_stats_bonus', $content, bigintval($content['userid']));
+ sendEmail($content['userid'], getMessage('BONUS_MEMBER_STATS_SUBJECT'), $message);
// Update database
- $result_update = SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_stats` SET bonus_stats_active='Y' WHERE `id`=%s LIMIT 1",
- array(bigintval($content['id'])), __FILE__, __LINE__);
+ $result_update = SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_stats` SET `bonus_stats_active`='Y' WHERE `id`=%s LIMIT 1",
+ array(bigintval($content['id'])), __FILE__, __LINE__);
} // END - while
// Handle bonus points
// Free memory
SQL_FREERESULT($result_bonus);
-//
+// [EOF]
?>
// Is it not loaded?
if (!isset($GLOBALS['load_once'][$INC])) {
// Mark it as loaded
- $GLOBALS['load_once'][$INC] = "loaded";
+ $GLOBALS['load_once'][$INC] = 'loaded';
// Then try to load it
loadInclude($INC);
// Merges an array together but only if both are arrays
function merge_array ($array1, $array2) {
// Are both an array?
- if ((is_array($array1)) && (is_array($array2))) {
- // Merge all together
- return array_merge($array1, $array2);
- } elseif (is_array($array1)) {
- // Return left array
- DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("array2 is not an array. array != %s", gettype($array2)));
- return $array1;
- } elseif (is_array($array2)) {
- // Return right array
- DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("array1 is not an array. array != %s", gettype($array1)));
- return $array2;
+ if ((!is_array($array1)) && (!is_array($array2))) {
+ // Both are not arrays
+ debug_report_bug(__FUNCTION__ . ': No arrays provided!');
+ } elseif (!is_array($array1)) {
+ // Left one is not an array
+ debug_report_bug(__FUNCTION__, sprintf("array1 is not an array. array != %s", gettype($array1)));
+ } elseif (!is_array($array2)) {
+ // Right one is not an array
+ debug_report_bug(__FUNCTION__, sprintf("array2 is not an array. array != %s", gettype($array2)));
}
- // Both are not arrays
- debug_report_bug(__FUNCTION__.": No arrays provided!");
+ // Merge all together
+ return array_merge($array1, $array2);
}
// Check if given FQFN is a readable file
// Is the cookie set?
if (isSessionVariableSet('lead_uid')) {
// Is the user-account unlocked and valid?
- $result = SQL_QUERY_ESC("SELECT email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `email` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s AND `status`='CONFIRMED' LIMIT 1",
array(bigintval(getSession('lead_uid'))), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Secure the ID number
// Tell everyone we are in this module
$GLOBALS['module'] = 'mailid';
$GLOBALS['output_mode'] = -1;
+$errorCode = '';
// Load the required file(s)
require('inc/config-global.php');
// Maybe he wants to confirm an email?
if ($url_mid > 0) {
// Normal-Mails
- $result = SQL_QUERY_ESC("SELECT link_type FROM `{!_MYSQL_PREFIX!}_user_links` WHERE stats_id=%s AND `userid`=%s LIMIT 1",
- array($url_mid, $url_uid), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT `link_type` FROM `{!_MYSQL_PREFIX!}_user_links` WHERE `stats_id`=%s AND `userid`=%s LIMIT 1",
+ array($url_mid, $url_uid), __FILE__, __LINE__);
$type = 'mailid'; $urlId = $url_mid;
} elseif ($url_bid > 0) {
// Bonus-Mail
- $result = SQL_QUERY_ESC("SELECT link_type FROM `{!_MYSQL_PREFIX!}_user_links` WHERE bonus_id=%s AND `userid`=%s LIMIT 1",
- array($url_bid, $url_uid), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT `link_type` FROM `{!_MYSQL_PREFIX!}_user_links` WHERE `bonus_id`=%s AND `userid`=%s LIMIT 1",
+ array($url_bid, $url_uid), __FILE__, __LINE__);
$type = 'bonusid'; $urlId = $url_bid;
} else {
// Problem: No ID entered
setExtraTitle($title);
// Is the user's ID unlocked?
- $result = SQL_QUERY_ESC("SELECT status, gender, surname, family FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
- array($url_uid), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT `status`, `gender`, `surname`,` family` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
+ array($url_uid), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
list($status, $gender, $sname, $fname) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
// Load template
LOAD_TEMPLATE('mailid_frames');
} else {
- $msg = getCode('DATA_INVALID');
+ $errorCode = getCode('DATA_INVALID');
}
} else {
- $msg = getCode('POSSIBLE_INVALID');
+ $errorCode = getCode('POSSIBLE_INVALID');
}
} else {
- $msg = getCode('ACCOUNT_LOCKED');
+ $errorCode = getCode('ACCOUNT_LOCKED');
}
} else {
SQL_FREERESULT($result);
- $msg = getCode('USER_404');
+ $errorCode = getCode('USER_404');
}
} else {
SQL_FREERESULT($result);
- $msg = getCode('STATS_404');
+ $errorCode = getCode('STATS_404');
}
} else {
SQL_FREERESULT($result);
- $msg = getCode('ALREADY_CONFIRMED');
+ $errorCode = getCode('ALREADY_CONFIRMED');
}
} else {
// Nothing entered
- $msg = getCode('ERROR_MAILID');
+ $errorCode = getCode('ERROR_MAILID');
}
// Error code is set?
-if (!empty($msg)) {
+if (!empty($errorCode)) {
// @TODO Rewrite this to a filter
switch (getConfig('mailid_error_redirect')) {
case 'INDEX': // Redirect to index page
- redirectToUrl('modules.php?module=index&msg='.$msg.'&ext=mailid');
+ redirectToUrl('modules.php?module=index&msg=' . $errorCode . '&ext=mailid');
break;
case 'REJECT': // Redirect to rejection page
// Maybe he wants to confirm an email?
if ($url_mid > 0) {
- $result = SQL_QUERY_ESC("SELECT id, link_type FROM `{!_MYSQL_PREFIX!}_user_links` WHERE stats_id=%s AND `userid`=%s LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id`, `link_type` FROM `{!_MYSQL_PREFIX!}_user_links` WHERE `stats_id`=%s AND `userid`=%s LIMIT 1",
array($url_mid, $url_uid), __FILE__, __LINE__);
$type = 'mailid'; $urlId = $url_mid;
} elseif ($url_bid > 0) {
- $result = SQL_QUERY_ESC("SELECT id, link_type FROM `{!_MYSQL_PREFIX!}_user_links` WHERE bonus_id=%s AND `userid`=%s LIMIT 1",
- array($url_bid, $url_uid), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT `id`, link_type` FROM `{!_MYSQL_PREFIX!}_user_links` WHERE `bonus_id`=%s AND `userid`=%s LIMIT 1",
+ array($url_bid, $url_uid), __FILE__, __LINE__);
$type = 'bonusid'; $urlId = $url_bid;
}
// @TODO Rewrite this to a filter
switch ($ltype) {
case 'NORMAL':
- $result_mailid = SQL_QUERY_ESC("SELECT pool_id, userid, id FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE `id`=%s LIMIT 1",
+ $result_mailid = SQL_QUERY_ESC("SELECT `pool_id`, `userid`, `id` FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE `id`=%s LIMIT 1",
array($url_mid), __FILE__, __LINE__);
break;
case 'BONUS':
- $result_mailid = SQL_QUERY_ESC("SELECT id, id, is_notify FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`=%s LIMIT 1",
+ $result_mailid = SQL_QUERY_ESC("SELECT `id, `id`, `is_notify` FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`=%s LIMIT 1",
array($url_bid), __FILE__, __LINE__);
break;
if ($ref != ''.($ref + 0).'') {
if (EXT_IS_ACTIVE('nickname')) {
// Nickname in URL, so load the ID
- $result = SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nickname='%s' LIMIT 1",
- array($ref), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT `userid` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `nickname`='%s' LIMIT 1",
+ array($ref), __FILE__, __LINE__);
// Load userid
list($ref) = SQL_FETCHROW($result);
// Is the refid valid?
if ($ref > 0) {
// Update ref counter
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET ref_clicks=ref_clicks+1 WHERE userid=%s LIMIT 1",
- array(bigintval($ref)), __FILE__, __LINE__);
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `ref_clicks`=`ref_clicks`+1 WHERE `userid`=%s LIMIT 1",
+ array(bigintval($ref)), __FILE__, __LINE__);
} // END - if
} else {
// No refid and we add our refid (don't forget to set $def_refid!)
$GLOBALS['refid'] = 0;
$GLOBALS['output_mode'] = 0;
$GLOBALS['header_sent'] = 3;
-$msg = null;
// Load the required file(s)
require('inc/config-global.php');