$content['time'] = (getConfig('ap_inactive_time') / 60 / 60);
// Mark found accounts as inactive and send an email
- while ($content = merge_array($content, SQL_FETCHARRAY($result_inactive))) {
+ while ($row = SQL_FETCHARRAY($result_inactive)) {
+ // Merge both arrays
+ $content = merge_array($content, $row);
+
// Remember userids for the admin
$useridsContent .= $content['userid'].", ";
$content['time'] = (getConfig('ap_unconfirmed_time') / 60 / 60);
// Delete inactive accounts
- while ($content = merge_array($content, SQL_FETCHARRAY($result_uncon))) {
+ while ($row = SQL_FETCHARRAY($result_uncon)) {
+ // Merge both arrays
+ $content = merge_array($content, $row);
+
// Remember userids for the admin
$userids .= $content['userid'] . ', ';
// Return row
return $row;
} else {
- // Return a false here...
+ // Return a false, else some loops would go endless...
return false;
}
}
'HOLIDAY_ADMIN_MODE' => "Zeitpunkt der Abarbeitung der Urlaubsschaltungen",
'HOLIDAY_ADMIN_MODE_RESET' => "Am täglichen Reset um 00:00 Uhr",
'HOLIDAY_ADMIN_MODE_DIRECT' => "Sofort nach Beantragung prüfen",
+ 'HOLIDAY_MEMBER_NOT_STOPPED_404' => "Beim Beenden Ihres Urlaubes ist ein unerwarteter Fehler aufgetreten: Mitglieder-Id <span class=\"data\">%s</span> nicht gefunden.",
-// Subject lines
+ // Subject lines
'HOLIDAY_MEMBER_SUBJECT' => "[HINWEIS:] Ihre Urlaubsanfrage",
'HOLIDAY_ADMIN_SUBJECT' => "Urlaubsanfrage in Ihrem {?mt_word?}",
'HOLIDAY_MEMBER_UNLOCK_SUBJ' => "[HINWEIS:] Beendigung Ihres Urlaubes",
$result_user = SQL_QUERY("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `status`='CONFIRMED' ORDER BY `userid` ASC", __FUNCTION__, __LINE__);
// Let's begin with the userids...
- while ($content = merge_array($content, SQL_FETCHARRAY($result_user))) {
+ while ($row = SQL_FETCHARRAY($result_user)) {
+ // Merge both arrays
+ $content = merge_array($content, $row);
+
$un = false;
// Get refs by userid
$receiver = ''; $userids = array();
// Okay lets notify all users!
- while ($content = merge_array($content, SQL_FETCHARRAY($result_main))) {
+ while ($row = SQL_FETCHARRAY($result_main)) {
+ // Merge arrays
+ $content = merge_array($content, $row);
+
// Update account
SQL_QUERY_ESC("UPDATE
`{?_MYSQL_PREFIX?}_user_data`
__FILE__, __LINE__);
// Process all entries
- while ($content = merge_array($content, SQL_FETCHARRAY($result_main))) {
+ while ($row = SQL_FETCHARRAY($result_main)) {
+ // Merge both arrays
+ $content = merge_array($content, $row);
+
// Remove depth to prevent booking errors. This is a bad coding
// practice, thats also why we need to write this project from
// scratch...
if (SQL_NUMROWS($result_cats) > 0) {
// List categories
$cnt = 1; $OUT = ''; $SW = 2;
- while ($content = merge_array($content, SQL_FETCHARRAY($result_cats))) {
+ while ($row = SQL_FETCHARRAY($result_cats)) {
+ // Merge both arrays
+ $content = merge_array($content, $row);
+
// Check user's selection
$result_user = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_user_cats` WHERE `userid`=%s AND `cat_id`=%s LIMIT 1",
array(bigintval(getRequestParameter('userid')), bigintval($content['id'])), __FILE__, __LINE__);
} // END - while
// Free memory
- SQL_FREERESULT($result);
+ SQL_FREERESULT($result_cats);
// Remember all rows in the array
$content['rows'] = $OUT;
$menge_lck = countSumTotalData($userid, 'user_data', 'userid', 'refid', true, " AND `status` != 'CONFIRMED'");
// Output info message
- loadTemplate('admin_settings_saved', false, getMaskedMessage('ADMIN_USER_TOTAL_REFS', generateUserProfileLink(getRequestParameter('userid')), $menge, $menge_lck));
+ loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_USER_TOTAL_REFS'), generateUserProfileLink(getRequestParameter('userid')), $menge, $menge_lck));
// Load all referal levels
$result_levels = SQL_QUERY("SELECT
} // END - while
} else {
// Output info message
- $levels['info'] = getMaskedMessage('ADMIN_USER_TOTAL_REFS', generateUserProfileLink($userid), 0, 0);
+ $levels['info'] = sprintf(getMessage('ADMIN_USER_TOTAL_REFS'), generateUserProfileLink($userid), 0, 0);
// No refs found
$levels['rows'] = loadTemplate('admin_list_refs_norefs', true, array('userid' => $userid));
// Prepare content
$content = array(
- 'rows' => $OUT,
- 'userid' => generateUserProfileLink(getRequestParameter('userid'))
+ 'rows' => $OUT,
+ 'userid' => generateUserProfileLink(getRequestParameter('userid'))
);
// Load main template
addMenuDescription('admin', __FILE__);
if (getRequestParameter('userid') == 'all') {
- // Add points to all accounts
- $content['points'] = bigintval(postRequestParameter('points'));
-
// Is the form sent?
if ((isFormSent()) && (postRequestParameter('points') > 0)) {
+ // Add points to all accounts
+ $content['points'] = bigintval(postRequestParameter('points'));
+
+ // Load userid
$result_main = SQL_QUERY("SELECT userid, email FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `status`='CONFIRMED' ORDER BY `userid` ASC",
__FILE__, __LINE__);
- while ($content = merge_array($content, SQL_FETCHARRAY($result_main))) {
+ while ($row = SQL_FETCHARRAY($result_main)) {
+ // Merge both arrays
+ $content = merge_array($content, $row);
+
// Ok, add points to used points and send an email to him...
subtractPoints('admin_all', $content['userid'], postRequestParameter('points'));
WHERE
`userid`=%s
LIMIT 1", array(getMemberId()), __FILE__, __LINE__);
- $content = merge_array($content, SQL_FETCHARRAY($result));
- SQL_FREERESULT($result);
- if (($content['holiday_active'] == 'Y') && (($content['holiday_activated'] + getConfig('holiday_lock')) < time())) {
- // Load data
- $result = SQL_QUERY_ESC("SELECT
+ // Do we have an entry?
+ if (SQL_NUMROWS($result) == 1) {
+ // Merge arrays
+ $content = merge_array($content, SQL_FETCHARRAY($result));
+
+ if (($content['holiday_active'] == 'Y') && (($content['holiday_activated'] + getConfig('holiday_lock')) < time())) {
+ // Load data
+ $result2 = SQL_QUERY_ESC("SELECT
`holiday_start`, `holiday_end`
FROM
`{?_MYSQL_PREFIX?}_user_holidays`
WHERE
`userid`=%s
LIMIT 1", array(getMemberId()), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 1) {
- // Data was found
- $content = merge_array($content, SQL_FETCHARRAY($result));
- SQL_FREERESULT($result);
+ if (SQL_NUMROWS($result2) == 1) {
+ // Data was found so merge it
+ $content = merge_array($content, SQL_FETCHARRAY($result2));
- // Prepare it for the template
- $content['start'] = generateDateTime($content['holiday_start'], 3);
- $content['end'] = generateDateTime($content['holiday_end'] , 3);
+ // Prepare it for the template
+ $content['start'] = generateDateTime($content['holiday_start'], 3);
+ $content['end'] = generateDateTime($content['holiday_end'] , 3);
- // Deactivate it now
- SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data`
+ // Deactivate it now
+ SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data`
SET
`holiday_active`='N',
`holiday_activated`=0
WHERE
`userid`=%s
LIMIT 1",
- array(getMemberId()), __FILE__, __LINE__);
+ array(getMemberId()), __FILE__, __LINE__);
- // Remove entry
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM
+ // Remove entry
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM
`{?_MYSQL_PREFIX?}_user_holidays`
WHERE
`userid`=%s
LIMIT 1",
- array(getMemberId()), __FILE__, __LINE__);
-
- // Send email to admin
- sendAdminNotification(getMessage('HOLIDAY_ADMIN_DEAC_SUBJ'), 'admin_holiday_deactivated', $content, getMemberId());
-
- // Display message to user
- loadTemplate('admin_settings_saved', false, getMessage('HOLIDAY_MEMBER_DEACTIVATED_NOW'));
- } else {
- // Display message to user
- loadTemplate('admin_settings_saved', false, getMessage('HOLIDAY_MEMBER_CANNOT_DEACTIVATE'));
+ array(getMemberId()), __FILE__, __LINE__);
+
+ // Send email to admin
+ sendAdminNotification(getMessage('HOLIDAY_ADMIN_DEAC_SUBJ'), 'admin_holiday_deactivated', $content, getMemberId());
+
+ // Display message to user
+ loadTemplate('admin_settings_saved', false, getMessage('HOLIDAY_MEMBER_DEACTIVATED_NOW'));
+ } else {
+ // Display message to user
+ loadTemplate('admin_settings_saved', false, getMessage('HOLIDAY_MEMBER_CANNOT_DEACTIVATE'));
+ }
+
+ // Free result
+ SQL_FREERESULT($result2);
+ } elseif ($content['holiday_active'] == 'Y') {
+ // To fast!
+ loadTemplate('admin_settings_saved', false, getMessage('HOLIDAY_MEMBER_LOCKED'));
}
- } elseif ($content['holiday_active'] == 'Y') {
- // To fast!
- loadTemplate('admin_settings_saved', false, getMessage('HOLIDAY_MEMBER_LOCKED'));
+ } else {
+ // User not found
+ loadTemplate('admin_settings_saved', false, getMaskedMessage('HOLIDAY_MEMBER_NOT_STOPPED_404', getMemberId()));
}
+
+ // Free result
+ SQL_FREERESULT($result);
} // END - if
// If something is wrong or link in menu is just clicked display form
`userid`=%s
LIMIT 1", array(getMemberId()), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
- // Data was found
+ // Data was found so merge it
$content = merge_array($content, SQL_FETCHARRAY($result));
- SQL_FREERESULT($result);
// Prepare it for the template
$content['start'] = generateDateTime($content['holiday_start'] , 3);
redirectToUrl('modules.php?module=login&what=holiday');
return;
}
+
+ // Free result
+ SQL_FREERESULT($result);
break;
case 'N': // Display activation form
// Load mail again... 0 1 2 3 4 5 6 7
$result = SQL_QUERY_ESC("SELECT `subject`, `text`, `receivers`, `payment_id`, `timestamp`, `url`, `cat_id`, `target_send` FROM `{?_MYSQL_PREFIX?}_pool` WHERE `id`=%s AND `sender`=%s LIMIT 1",
array(bigintval(getRequestParameter('order')), getMemberId()), __FILE__, __LINE__);
+
+ // Merge arrays
$content = merge_array($content, SQL_FETCHARRAY($result));
+
+ // Free result
SQL_FREERESULT($result);
+
+ // Fix empty subject line
if (empty($content['subject'])) $content['subject'] = getMessage('DEFAULT_SUBJECT_LINE');
// Calculate used points
if (SQL_NUMROWS($result_bonus) > 0) {
// We found some mail orders...
- while ($content = merge_array($content, SQL_FETCHARRAY($result_bonus))) {
+ while ($content = SQL_FETCHARRAY($result_bonus)) {
// Add points
SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `bonus_stats`=`bonus_stats`+{?bonus_stats?} WHERE `userid`=%s LIMIT 1",
array(bigintval($content['userid'])), __FILE__, __LINE__);
`holiday_start` <= UNIX_TIMESTAMP() AND
`holiday_end` > UNIX_TIMESTAMP()
LIMIT 1",
- array(bigintval($content['userid'])), __FILE__, __LINE__);
+ array(bigintval($content['userid'])), __FILE__, __LINE__);
+
+ // Do we have an entry?
if (SQL_NUMROWS($result_holiday) == 1) {
// Okay, this user can be send away to holiday...
$content = merge_array($content, SQL_FETCHARRAY($result_holiday));