$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
require($INC);
} elseif (!IS_MEMBER()) {
- LOAD_URL("modules.php?module=index");
-} elseif ((!EXT_IS_ACTIVE("order")) && (!IS_ADMIN())) {
- addFatalMessage(__FILE__, __LINE__, getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), "order");
+ LOAD_URL('modules.php?module=index');
+} elseif ((!EXT_IS_ACTIVE('order')) && (!IS_ADMIN())) {
+ addFatalMessage(__FILE__, __LINE__, getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), 'order');
return;
}
// Add description as navigation point
-ADD_DESCR("member", __FILE__);
+ADD_DESCR('member', __FILE__);
-$URL = ""; $id = 0;
+$URL = ''; $id = 0;
$whereStatement = " WHERE `visible`='Y'";
// Set undefined array elements
-if (!REQUEST_ISSET_GET(('msg'))) REQUEST_SET_GET('msg' , "");
-if (!REQUEST_ISSET_POST(('zip'))) REQUEST_SET_POST('zip' , "");
-if (!REQUEST_ISSET_POST(('html'))) REQUEST_SET_POST('html' , "");
-if (!REQUEST_ISSET_POST(('receiver'))) REQUEST_SET_POST('receiver', "");
-if (IS_ADMIN()) $whereStatement = "";
+if (!REQUEST_ISSET_GET('msg')) REQUEST_SET_GET('msg' , '');
+if (!REQUEST_ISSET_POST('zip')) REQUEST_SET_POST('zip' , '');
+if (!REQUEST_ISSET_POST('html')) REQUEST_SET_POST('html' , '');
+if (!REQUEST_ISSET_POST('receiver')) REQUEST_SET_POST('receiver', '');
+if (IS_ADMIN()) $whereStatement = '';
// Minimum mails / order
define('__MIN_VALUE', getConfig('order_min'));
// Count unconfirmed mails
-$links = GET_TOTAL_DATA(getUserId(), "user_links", "id", "userid", true);
+$links = GET_TOTAL_DATA(getUserId(), "user_links", "id", 'userid', true);
// Does the user has more than 0 mails per day set?
-$HOLIDAY = "userid";
-if (GET_EXT_VERSION("holiday") >= "0.1.3") {
+$HOLIDAY = 'userid';
+if (GET_EXT_VERSION('holiday') >= '0.1.3') {
// Fetch also holiday activation data
$HOLIDAY = "holiday_active";
} // END - if
if ($HOLIDAY == $DMY) $HOLIDAY='N';
$ALLOWED = $MAXI - $ORDERS;
-if (getConfig('order_max_full') == "MAX") $ALLOWED = $MAXI;
+if (getConfig('order_max_full') == 'MAX') $ALLOWED = $MAXI;
// Now check his points amount
$total = GET_TOTAL_DATA(getUserId(), "user_points", "points") - GET_TOTAL_DATA(getUserId(), "user_data", "used_points");;
-if (($HOLIDAY == "Y") && (GET_EXT_VERSION("holiday") >= "0.1.3")) {
+if (($HOLIDAY == 'Y') && (GET_EXT_VERSION('holiday') >= '0.1.3')) {
// Holiday is active!
- LOAD_TEMPLATE("admin_settings_saved", false, getMessage('HOLIDAY_ORDER_NOT_POSSIBLE'));
+ LOAD_TEMPLATE('admin_settings_saved', false, getMessage('HOLIDAY_ORDER_NOT_POSSIBLE'));
} elseif ((REQUEST_ISSET_POST(('frametester'))) && ($ALLOWED > 0) && (REQUEST_POST('receiver') > 0)) {
// Continue with the frametester, we first need to store the data temporary in the pool
//
if ($type == "TEMP") {
// No entry found, so we need to check out the stats table as well... :)
// We have to add that suff here, now we continue WITHOUT checking and check the text and subject against some filters
- $URL = "";
- if (getConfig('test_text') == "Y") {
+ $URL = '';
+ if (getConfig('test_text') == 'Y') {
// Test submitted text against some filters (length, URLs in text etc.)
if ((strpos(strtolower(REQUEST_POST('text')), "https://") > -1) || (strpos(strtolower(REQUEST_POST('text')), "http://") > -1) || (strpos(strtolower(REQUEST_POST('text')), "www") > -1)) {
// URL found!
- $URL = "modules.php?module=login&what=order&msg=".getCode('URL_FOUND');
+ $URL = 'modules.php?module=login&what=order&msg=' . getCode('URL_FOUND');
} // END - if
// Remove new-line and carriage-return characters
- $TEST = str_replace("\n", "", str_replace("\r", "", REQUEST_POST('text')));
+ $TEST = str_replace("\n", '', str_replace("\r", '', REQUEST_POST('text')));
// Text length within allowed length?
if (strlen($TEST) > getConfig('max_tlength')) {
// Text is too long!
- $URL = "modules.php?module=login&what=order&msg=".getCode('OVERLENGTH');
+ $URL = 'modules.php?module=login&what=order&msg=' . getCode('OVERLENGTH');
} // END - if
} // END - if
// Shall I test the subject line against URLs?
- if (getConfig('test_subj') == "Y") {
+ if (getConfig('test_subj') == 'Y') {
// Check the subject line for issues
REQUEST_SET_POST('subject', str_replace("\\", "[nl]", substr(REQUEST_POST('subject'), 0, 200)));
if ((strpos(strtolower(REQUEST_POST('subject')), "http://") > -1) || (strpos(strtolower(REQUEST_POST('subject')), "www") > -1)) {
// URL in subject found
- $URL = "modules.php?module=login&what=order&msg=".getCode('SUBJ_URL');
+ $URL = 'modules.php?module=login&what=order&msg=' . getCode('SUBJ_URL');
} // END - if
} // END - if
// And shall I check that his URL is not in the black list?
- if (getConfig('url_blacklist') == "Y") {
+ if (getConfig('url_blacklist') == 'Y') {
// Ok, I do that for you know...
$result = SQL_QUERY_ESC("SELECT UNIX_TIMESTAMP(`timestamp`) AS tstamp FROM `{!_MYSQL_PREFIX!}_url_blacklist` WHERE `url`='%s' LIMIT 1",
array(REQUEST_POST('url')), __FILE__, __LINE__);
list($blist) = SQL_FETCHROW($result);
// Create redirect-URL
- $URL = "modules.php?module=login&what=order&msg=".getCode('BLIST_URL')."&blist=".$blist;
+ $URL = 'modules.php?module=login&what=order&msg=' . getCode('BLIST_URL')."&blist=".$blist;
} // END - if
// Free result
// Enougth receivers entered?
if ((REQUEST_POST('receiver') < getConfig('order_min')) && (!IS_ADMIN())) {
// Less than allowed receivers entered!
- $URL = "modules.php?module=login&what=order&msg=".getCode('MORE_RECEIVERS3');
+ $URL = 'modules.php?module=login&what=order&msg=' . getCode('MORE_RECEIVERS3');
} // END - if
// Validate URL
if (!VALIDATE_URL(REQUEST_POST('url'))) {
// URL is invalid!
- $URL = "modules.php?module=login&what=order&msg=".getCode('INVALID_URL');
+ $URL = 'modules.php?module=login&what=order&msg=' . getCode('INVALID_URL');
} // END - if
// Probe for HTML extension
- if (EXT_IS_ACTIVE("html_mail")) {
+ if (EXT_IS_ACTIVE('html_mail')) {
// HTML or regular text mail?
- if (REQUEST_POST('html') == "Y") {
+ if (REQUEST_POST('html') == 'Y') {
// Chek for valid HTML tags
REQUEST_SET_POST('text', HTML_CHECK_TAGS(REQUEST_POST('text')));
// Maybe invalid tags found?
- if (!REQUEST_ISSET_POST(('text'))) $URL = "modules.php?module=login&what=order&msg=".getCode('INVALID_TAGS')."&id=".$id;
+ if (!REQUEST_ISSET_POST(('text'))) $URL = 'modules.php?module=login&what=order&msg=' . getCode('INVALID_TAGS')."&id=".$id;
} else {
// Remove any HTML code
REQUEST_SET_POST('text', str_replace("<", "{OPEN_HTML}", str_replace(">", "{CLOSE_HTML}", REQUEST_POST('text'))));
}
} elseif (!IS_ADMIN()) {
// He has already sent a mail within a specific time
- $URL = "modules.php?module=login&what=order&msg=".getCode('URL_TLOCK')."&id=".$id;
+ $URL = 'modules.php?module=login&what=order&msg=' . getCode('URL_TLOCK')."&id=".$id;
}
// Still no error?
if (empty($URL)) {
// Check if category and number of receivers is okay
- $add = "";
- if ((getConfig('order_multi_page') == "Y") && (REQUEST_ISSET_POST(('zip')))) {
+ $add = '';
+ if ((getConfig('order_multi_page') == 'Y') && (REQUEST_ISSET_POST('zip'))) {
// Choose recipients by ZIP code
$add = " AND d.zip LIKE '".bigintval(REQUEST_POST('zip'))."{PER}'";
} // END - if
if (SQL_NUMROWS($result) >= REQUEST_POST('receiver')) {
// Check for holiday extensions
$HOLIDAY = false;
- if (GET_EXT_VERSION("holiday") >= "0.1.3") {
+ if (GET_EXT_VERSION('holiday') >= '0.1.3') {
// Include checking for users in holiday
$HOLIDAY = true;
} // END - if
SQL_FREERESULT($result);
// Implode array into string for the sending pool
- $RECEIVER = implode($TEST, ";");
+ $RECEIVER = implode($TEST, ';');
// Count array for maximum sent
$MAX_SEND = count($TEST);
// Update receiver list
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET receive_mails=receive_mails-1 WHERE userid IN (%s) LIMIT %s",
- array(str_replace(";", ", ", $RECEIVER), $MAX_SEND), __FILE__, __LINE__);
+ array(str_replace(';', ", ", $RECEIVER), $MAX_SEND), __FILE__, __LINE__);
// Is calculated max receivers larger than wanted receivers then reset it
if ($MAX_SEND > REQUEST_POST('receiver')) $MAX_SEND = REQUEST_POST('receiver');
$USED = $MAX_SEND * GET_PAY_POINTS(bigintval(REQUEST_POST('type')));
// Fix empty zip code
- if (!REQUEST_ISSET_POST(('zip'))) REQUEST_SET_POST('zip', "0");
+ if (!REQUEST_ISSET_POST('zip')) REQUEST_SET_POST('zip', "0");
// Check if he has enougth points for this order and selected more than 0 receivers
if (($USED > 0) && ($USED <= $total) && ($MAX_SEND > 0)) {
if (($id == "0") || ($type != "TEMP")) {
// New order
$id = 0;
- if (EXT_IS_ACTIVE("html_mail")) {
+ if (EXT_IS_ACTIVE('html_mail')) {
// HTML extension is active
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_pool` (sender, subject, text, receivers, payment_id, data_type, timestamp, url, cat_id, target_send, zip, html_msg)
VALUES ('%s','%s','%s','%s','%s','TEMP','%s','%s','%s','%s','%s','%s')",
}
} else {
// Change current order
- if (EXT_IS_ACTIVE("html_mail")) {
+ if (EXT_IS_ACTIVE('html_mail')) {
// HTML extension is active
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET
subject='%s',
$URL = "modules.php?module=frametester&order=".$id."";
} elseif ($MAX_SEND == 0) {
// Not enougth receivers found which can receive mails
- $URL = "modules.php?module=login&what=order&msg=".getCode('MORE_RECEIVERS2');
+ $URL = 'modules.php?module=login&what=order&msg=' . getCode('MORE_RECEIVERS2');
} else {
// No enougth points left!
- $URL = "modules.php?module=login&what=order&msg=".getCode('MORE_POINTS');
+ $URL = 'modules.php?module=login&what=order&msg=' . getCode('MORE_POINTS');
}
} else {
// Ordered more mails than he can send in this category
- $URL = "modules.php?module=login&what=order&msg=".getCode('NO_RECS_LEFT');
+ $URL = 'modules.php?module=login&what=order&msg=' . getCode('NO_RECS_LEFT');
}
}
} elseif (REQUEST_POST('receiver') == "0") {
// Not enougth receivers selected
- $URL = "modules.php?module=login&what=order&msg=".getCode('MORE_RECEIVERS1');
-} elseif (($ALLOWED == 0) && (getConfig('order_max_full') == "ORDER")) {
+ $URL = 'modules.php?module=login&what=order&msg=' . getCode('MORE_RECEIVERS1');
+} elseif (($ALLOWED == 0) && (getConfig('order_max_full') == 'ORDER')) {
// No more mail orders allowed
- LOAD_TEMPLATE("admin_settings_saved", false, getMessage('MEMBER_ORDER_ALLOWED_EXHAUSTED'));
+ LOAD_TEMPLATE('admin_settings_saved', false, getMessage('MEMBER_ORDER_ALLOWED_EXHAUSTED'));
} elseif (($links < getConfig('unconfirmed')) && ($mmails == "1")) {
// Display order form
$result_cats = SQL_QUERY("SELECT id, cat FROM `{!_MYSQL_PREFIX!}_cats`".$whereStatement." ORDER BY `sort`", __FILE__, __LINE__);
);
// Enable HTML checking
- $HTML = ""; $HOLIDAY = false; $HOL_STRING = "";
- if ((EXT_IS_ACTIVE("html_mail")) && (REQUEST_POST('html') == "Y")) $HTML = " AND html='Y'";
- if (GET_EXT_VERSION("holiday") >= "0.1.3") {
+ $HTML = ''; $HOLIDAY = false; $HOL_STRING = '';
+ if ((EXT_IS_ACTIVE('html_mail')) && (REQUEST_POST('html') == 'Y')) $HTML = " AND html='Y'";
+ if (GET_EXT_VERSION('holiday') >= '0.1.3') {
// Extension's version is fine
$HOLIDAY = true; $HOL_STRING = " AND holiday_active='N'";
} // END - if
$result_ver = SQL_QUERY_ESC("SELECT zip FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s".$HTML." AND receive_mails > 0 AND `status`='CONFIRMED' LIMIT 1",
array(bigintval($ucat)), __FILE__, __LINE__);
- if ((SQL_NUMROWS($result_ver) == 1) && (REQUEST_ISSET_POST(('zip'))) && (getConfig('order_multi_page') == "Y")) {
+ if ((SQL_NUMROWS($result_ver) == 1) && (REQUEST_ISSET_POST('zip')) && (getConfig('order_multi_page') == 'Y')) {
list($zip) = SQL_FETCHROW($result_ver);
SQL_FREERESULT($result_ver);
if (substr($zip, 0, strlen(REQUEST_POST('zip'))) == REQUEST_POST('zip')) {
$typeS = array();
if (SQL_NUMROWS($result) > 0) {
// Check for message ID in URL
- $message = "";
+ $message = '';
switch (REQUEST_GET('msg'))
{
case getCode('URL_TLOCK'):
if (!empty($message)) {
// We got system message so we drop it out to the user
- LOAD_TEMPLATE("admin_settings_saved", false, $message);
+ LOAD_TEMPLATE('admin_settings_saved', false, $message);
} // END - if
// Load all email types...
// Check how many mail orders he has placed today and how many he's allowed to send
switch (getConfig('order_max_full'))
{
- case "MAX": // He is allowed to send as much as possible
+ case 'MAX': // He is allowed to send as much as possible
define('ORDER_MAX_VALUE', getMessage('ORDER_ALLOWED_MAX'));
break;
- case "ORDER": // He is allowed to send as much as he setup the receiving value
+ case 'ORDER': // He is allowed to send as much as he setup the receiving value
define('ORDER_MAX_VALUE', sprintf(getMessage('ORDER_ALLOWED_RECEIVE'), $ALLOWED, $MAXI));
break;
LOAD_TEMPLATE("member_order_points", false, $total);
// Reset variables
- $OLD_ORDER = false; $subject = ""; $text = ""; $target = "";
+ $OLD_ORDER = false; $subject = ''; $text = ''; $target = '';
// Check if we already have an order placed and make it editable
$result = SQL_QUERY_ESC("SELECT subject, text, payment_id, timestamp, url, target_send, cat_id, zip FROM `{!_MYSQL_PREFIX!}_pool` WHERE sender=%s AND data_type='TEMP' LIMIT 1",
SQL_FREERESULT($result);
// 01 2 21 12 2 23 443 3 3210
- if ((REQUEST_ISSET_POST(('data'))) || ((getConfig('order_multi_page') != "Y") && ((!IS_ADMIN()) && (!EXT_IS_ACTIVE("html_mail"))))) {
+ if ((REQUEST_ISSET_POST(('data'))) || ((getConfig('order_multi_page') != "Y") && ((!IS_ADMIN()) && (!EXT_IS_ACTIVE('html_mail'))))) {
// Pre-output categories
- $CAT = "";
+ $CAT = '';
foreach ($CATS['id'] as $key => $value) {
$CAT .= " <option value=\"".$value."\"";
if (($OLD_ORDER) && ($content['cat'] == $value)) $CAT .= " selected=\"selected\"";
} // END - foreach
// Mail type
- $type = "";
+ $type = '';
foreach ($typeS as $key => $value) {
$P = TRANSLATE_COMMA($typeS[$key][1]);
if (is_array($value)) {
define('TEXT', COMPILE_CODE($text));
define('T_URL', $url);
- if (REQUEST_ISSET_POST(('zip'))) {
+ if (REQUEST_ISSET_POST('zip')) {
// Output entered ZIP code
define('ZIP_OUTPUT', LOAD_TEMPLATE("member_order-zip2", true, REQUEST_POST('zip')));
} else {
}
// HTML extension
- if ((EXT_IS_ACTIVE("html_mail")) && (REQUEST_POST('html') == "Y")) {
+ if ((EXT_IS_ACTIVE('html_mail')) && (REQUEST_POST('html') == 'Y')) {
// Extension is active so output valid HTML tags
define('MEMBER_HTML_EXTENSION', LOAD_TEMPLATE("member_order-html_ext", true, HTML_ADD_VALID_TAGS()));
} else {
LOAD_TEMPLATE("member_order_page2");
} else {
// Remember maybe entered ZIP code in constant
- $add = "";
- if (EXT_IS_ACTIVE("html_mail")) {
+ $add = '';
+ if (EXT_IS_ACTIVE('html_mail')) {
// Add some content when html extension is active
- if ((getConfig('order_multi_page') == "Y") || (IS_ADMIN())) $add = "<tr><td colspan=\"2\" class=\"seperator bottom2\" height=\"5\"> </td></tr>\n";
+ if ((getConfig('order_multi_page') == 'Y') || (IS_ADMIN())) $add = "<tr><td colspan=\"2\" class=\"seperator bottom2\" height=\"5\"> </td></tr>\n";
define('MEMBER_HTML_EXTENSION', LOAD_TEMPLATE("member_order-html_intro", true));
} else {
// No HTML extension installed
}
// Do we want ZIP code or not?
- if ((getConfig('order_multi_page') == "Y") || (IS_ADMIN())) {
+ if ((getConfig('order_multi_page') == 'Y') || (IS_ADMIN())) {
// Yes
if (REQUEST_POST('zip') > 0) {
$content = array(
define('MEMBER_ZIP_CONTENT', LOAD_TEMPLATE("member_order-zip1", true, $content));
} else {
// No
- define('MEMBER_ZIP_CONTENT', "");
+ define('MEMBER_ZIP_CONTENT', '');
}
// Output form for page 1 (ZIP code or HTML)
}
} else {
// No mail types defined
- LOAD_TEMPLATE("admin_settings_saved", false, "<span class=\"member_failed\">{--MEMBER_NO_PAYMENTS--}</span>");
+ LOAD_TEMPLATE('admin_settings_saved', false, "<span class=\"member_failed\">{--MEMBER_NO_PAYMENTS--}</span>");
}
} else {
// No points left
- LOAD_TEMPLATE("admin_settings_saved", false, "<span class=\"member_failed\">{--MEMBER_NO_POINTS--}</span>");
+ LOAD_TEMPLATE('admin_settings_saved', false, "<span class=\"member_failed\">{--MEMBER_NO_POINTS--}</span>");
}
} else {
// No cateogries are defined yet
- LOAD_TEMPLATE("admin_settings_saved", false, "<span class=\"member_failed\">{--MEMBER_NO_CATS--}</span>");
+ LOAD_TEMPLATE('admin_settings_saved', false, "<span class=\"member_failed\">{--MEMBER_NO_CATS--}</span>");
}
} elseif ($mmails == "0") {
// Please set more than 0 mails per day
- LOAD_TEMPLATE("admin_settings_saved", false, getMessage('MEMBER_HAS_ZERO_MMAILS'));
+ LOAD_TEMPLATE('admin_settings_saved', false, getMessage('MEMBER_HAS_ZERO_MMAILS'));
} else {
// Please confirm some mails first
- LOAD_TEMPLATE("admin_settings_saved", false, sprintf(getMessage('MEMBER_LINKS_LEFT'), $links, getConfig('unconfirmed')));
+ LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('MEMBER_LINKS_LEFT'), $links, getConfig('unconfirmed')));
}
if (!empty($URL)) {