<?php
/************************************************************************
- * MXChange v0.2.1 Start: 07/24/2004 *
- * ================ Last change: 07/31/2004 *
+ * Mailer v0.2.1-FINAL Start: 07/24/2004 *
+ * =================== Last change: 07/31/2004 *
* *
* -------------------------------------------------------------------- *
* File : what-holiday.php *
`sender`=%s
ORDER BY
`timestamp` DESC
-LIMIT 1", array(getUserId()), __FILE__, __LINE__);
+LIMIT 1", array(getMemberId()), __FILE__, __LINE__);
// Check for sent mail orders in stats
$result2 = SQL_QUERY_ESC("SELECT
`userid`=%s
ORDER BY
`timestamp_ordered` DESC
-LIMIT 1", array(getUserId()), __FILE__, __LINE__);
+LIMIT 1", array(getMemberId()), __FILE__, __LINE__);
if ((SQL_NUMROWS($result1) == 1) || (SQL_NUMROWS($result2) == 1)) {
// Mail order found!
$content = merge_array($content, SQL_FETCHARRAY($result2));
// Fix missing entries
- if (empty($content['timestamp'])) $content['timestamp'] = 0;
- if (empty($content['timestamp_ordered'])) $content['timestamp_ordered'] = 0;
+ if (empty($content['timestamp'])) $content['timestamp'] = '0';
+ if (empty($content['timestamp_ordered'])) $content['timestamp_ordered'] = '0';
if ((($content['timestamp'] + getConfig('holiday_lock')) > time()) || (($content['timestamp_ordered'] + getConfig('holiday_lock')) > time())) {
// Mail order is to close away!
- unsetPostRequestElement('ok');
- unsetPostRequestElement('stop');
+ unsetPostRequestParameter('ok');
+ unsetPostRequestParameter('stop');
if (($content['timestamp'] + getConfig('holiday_lock')) > time()) {
// Mail found in pool
}
// Display message and exit here
- loadTemplate('admin_settings_saved', false, sprintf(getMessage('HOLIDAY_MEMBER_ORDER'), generateDateTime($stamp, 1)));
+ loadTemplate('admin_settings_saved', false, getMaskedMessage('HOLIDAY_MEMBER_ORDER', generateDateTime($stamp, 1)));
return;
}
} // END - if
if (isFormSent()) {
// Check holiday request...
- $START = mktime(0, 0, 0, postRequestElement('start_month'), postRequestElement('start_day'), postRequestElement('start_year'));
- $content['holiday_end'] = mktime(0, 0, 0, postRequestElement('end_month') , postRequestElement('end_day') , postRequestElement('end_year') );
+ $START = mktime(0, 0, 0, postRequestParameter('start_month'), postRequestParameter('start_day'), postRequestParameter('start_year'));
+ $content['holiday_end'] = mktime(0, 0, 0, postRequestParameter('end_month') , postRequestParameter('end_day') , postRequestParameter('end_year') );
// Test both values
$TEST = $content['holiday_end'] - $START;
if (($TEST < 0) || ($TEST > (getConfig('ONE_DAY') * getConfig('holiday_max'))) || ($START < time()) || ($content['holiday_end'] < time())) {
// Time test failed
- unsetPostRequestElement('ok');
+ unsetPostRequestParameter('ok');
} else {
// Everything went okay so let's store his request and send mails
SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_holidays` (`userid`, `holiday_start`, `holiday_end`, `comments`) VALUES ('%s','%s','%s','%s')",
- array(getUserId(), $START, $content['holiday_end'], postRequestElement('comments')), __FILE__, __LINE__);
+ array(getMemberId(), $START, $content['holiday_end'], postRequestParameter('comments')), __FILE__, __LINE__);
// Activate holiday system
SQL_QUERY_ESC("UPDATE
WHERE
`userid`=%s
LIMIT 1",
- array(getUserId()), __FILE__, __LINE__);
+ array(getMemberId()), __FILE__, __LINE__);
// Prepare constants
- $content['start_day'] = bigintval(postRequestElement('start_day'));
- $content['start_month'] = $GLOBALS['month_descr'][postRequestElement('start_month')];
- $content['start_year'] = bigintval(postRequestElement('start_year'));
- $content['end_day'] = bigintval(postRequestElement('end_day'));
- $content['end_month'] = $GLOBALS['month_descr'][postRequestElement('end_month')];
- $content['end_year'] = bigintval(postRequestElement('end_year'));
- $content['comments'] = secureString(postRequestElement('comments'));
+ $content['start_day'] = bigintval(postRequestParameter('start_day'));
+ $content['start_month'] = $GLOBALS['month_descr'][postRequestParameter('start_month')];
+ $content['start_year'] = bigintval(postRequestParameter('start_year'));
+ $content['end_day'] = bigintval(postRequestParameter('end_day'));
+ $content['end_month'] = $GLOBALS['month_descr'][postRequestParameter('end_month')];
+ $content['end_year'] = bigintval(postRequestParameter('end_year'));
+ $content['comments'] = secureString(postRequestParameter('comments'));
// Send mail to member
- $message = loadEmailTemplate('member_holiday_request', $content, getUserId());
- sendEmail(getUserId(), getMessage('HOLIDAY_MEMBER_SUBJECT'), $message);
+ $message = loadEmailTemplate('member_holiday_request', $content, getMemberId());
+ sendEmail(getMemberId(), getMessage('HOLIDAY_MEMBER_SUBJECT'), $message);
// Send mail to all admins
- sendAdminNotification(getMessage('HOLIDAY_ADMIN_SUBJECT'), 'admin_holiday_request', $content, getUserId());
+ sendAdminNotification(getMessage('HOLIDAY_ADMIN_SUBJECT'), 'admin_holiday_request', $content, getMemberId());
// Create task
- createNewTask('{--HOLIDAY_ADMIN_SUBJECT--}', $message, 'HOLIDAY_REQUEST', getUserId());
+ createNewTask('{--HOLIDAY_ADMIN_SUBJECT--}', $message, 'HOLIDAY_REQUEST', getMemberId());
// Display message
loadTemplate('admin_settings_saved', false, getMessage('HOLIDAY_IS_ACTIVATED_NOW'));
} // END - if
// Holiday shall be ended now
-if (isPostRequestElementSet('stop')) {
+if (isPostRequestParameterSet('stop')) {
// Okay, end the holiday here...
$result = SQL_QUERY_ESC("SELECT
`holiday_active`, `holiday_activated`
`{?_MYSQL_PREFIX?}_user_data`
WHERE
`userid`=%s
-LIMIT 1", array(getUserId()), __FILE__, __LINE__);
+LIMIT 1", array(getMemberId()), __FILE__, __LINE__);
$content = merge_array($content, SQL_FETCHARRAY($result));
SQL_FREERESULT($result);
`{?_MYSQL_PREFIX?}_user_holidays`
WHERE
`userid`=%s
-LIMIT 1", array(getUserId()), __FILE__, __LINE__);
+LIMIT 1", array(getMemberId()), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Data was found
$content = merge_array($content, SQL_FETCHARRAY($result));
WHERE
`userid`=%s
LIMIT 1",
- array(getUserId()), __FILE__, __LINE__);
+ array(getMemberId()), __FILE__, __LINE__);
// Remove entry
SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM
WHERE
`userid`=%s
LIMIT 1",
- array(getUserId()), __FILE__, __LINE__);
+ array(getMemberId()), __FILE__, __LINE__);
// Send email to admin
- sendAdminNotification(getMessage('HOLIDAY_ADMIN_DEAC_SUBJ'), 'admin_holiday_deactivated', $content, getUserId());
+ 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'));
} // END - if
// If something is wrong or link in menu is just clicked display form
-if ((!isFormSent()) && (!isPostRequestElementSet('stop'))) {
+if ((!isFormSent()) && (!isPostRequestParameterSet('stop'))) {
// Check if user is in holiday...
$result = SQL_QUERY_ESC("SELECT
`holiday_active`, `holiday_activated`
`{?_MYSQL_PREFIX?}_user_data`
WHERE
`userid`=%s
-LIMIT 1", array(getUserId()), __FILE__, __LINE__);
+LIMIT 1", array(getMemberId()), __FILE__, __LINE__);
$content = SQL_FETCHARRAY($result);
SQL_FREERESULT($result);
`{?_MYSQL_PREFIX?}_user_holidays`
WHERE
`userid`=%s
-LIMIT 1", array(getUserId()), __FILE__, __LINE__);
+LIMIT 1", array(getMemberId()), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Data was found
$content = merge_array($content, SQL_FETCHARRAY($result));
`holiday_active`='N'
WHERE
`userid`=%s
-LIMIT 1", array(getUserId()), __FILE__, __LINE__);
+LIMIT 1", array(getMemberId()), __FILE__, __LINE__);
redirectToUrl('modules.php?module=login&what=holiday');
return;
}