X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fmember%2Fwhat-order.php;h=0078fc0a25b3abaf731a5bcc3aac2e2ac3bd4cd6;hb=acea81e3c47cceb7287758af74ebc5d95b04227b;hp=a44255e8acd9c33f61eadf0d3560a1fa403ad89d;hpb=2df8c1757b41f35e7c5b6a92c52ca96ab1b0bcb8;p=mailer.git diff --git a/inc/modules/member/what-order.php b/inc/modules/member/what-order.php index a44255e8ac..0078fc0a25 100644 --- a/inc/modules/member/what-order.php +++ b/inc/modules/member/what-order.php @@ -100,7 +100,7 @@ LIMIT 1", } // END - if // Remove new-line and carriage-return characters - $TEST = str_replace(array(chr(10), chr(13)), array('', ''), postRequestElement('text')); + $TEST = str_replace(array(PHP_EOL, chr(13)), array('', ''), postRequestElement('text')); // Text length within allowed length? if (strlen($TEST) > getConfig('max_tlength')) { @@ -120,21 +120,9 @@ LIMIT 1", } // END - if // And shall I check that his URL is not in the black list? - if (isUrlBlacklistEnabled()) { - // 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(postRequestElement('url')), __FILE__, __LINE__); - - if (SQL_NUMROWS($result) == 1) { - // Jupp, we got one listed - list($blist) = SQL_FETCHROW($result); - - // Create redirect-URL - $url = 'modules.php?module=login&what=order&code=' . getCode('BLIST_URL') . '&blist=' . $blist; - } // END - if - - // Free result - SQL_FREERESULT($result); + if (isUrlBlacklisted(postRequestElement('url'))) { + // Create redirect-URL + $url = 'modules.php?module=login&what=order&code=' . getCode('BLIST_URL') . '&blist=' . $GLOBALS['blacklist_data'][postRequestElement('url')]['timestamp']; } // END - if // Enougth receivers entered? @@ -198,7 +186,7 @@ ORDER BY getMemberId() ), __FILE__, __LINE__); - // Do we enougth receivers left? + // Are there still receivers left? if (SQL_NUMROWS($result) >= postRequestElement('receiver')) { // Load receivers from database $TEST = array(); $count = '0'; @@ -253,7 +241,7 @@ LIMIT 1", } // END - if // Calculate used points - $usedPoints = $content['target_send'] * getPaymentPoints(bigintval(postRequestElement('mail_type'))); + $usedPoints = $content['target_send'] * getPaymentData(bigintval(postRequestElement('mail_type'))); // Fix empty zip code if (!isPostRequestElementSet('zip')) { @@ -306,7 +294,7 @@ LIMIT 1", postRequestElement('url'), bigintval(postRequestElement('cat')), bigintval($content['target_send']), - bigintval(postRequestElement('zip'), true, false), + bigintval(postRequestElement('zip'), TRUE, FALSE), postRequestElement('html') ), __FILE__, __LINE__); } else { @@ -347,9 +335,12 @@ LIMIT 1", postRequestElement('url'), bigintval(postRequestElement('cat')), bigintval($content['target_send']), - bigintval(postRequestElement('zip'), true, false), + bigintval(postRequestElement('zip'), TRUE, FALSE), ), __FILE__, __LINE__); } + + // Get insert id + $id = SQL_INSERTID(); } else { // Change current order if (isExtensionActive('html_mail')) { @@ -413,24 +404,10 @@ LIMIT 1", } } - // Do we need to get the id number? - if ($id == '0') { - // Order is placed as temporary. We need to get it's id for the frametester - $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_pool` WHERE `sender`=%s AND `subject`='%s' AND `payment_id`=%s AND `data_type`='TEMP' AND `timestamp`=UNIX_TIMESTAMP() LIMIT 1", - array( - getMemberId(), - postRequestElement('subject'), - bigintval(postRequestElement('mail_type')) - ), __FILE__, __LINE__); - - // Get pool id - list($id) = SQL_FETCHROW($result); - - // Free result - SQL_FREERESULT($result); - } // END - if + // Make sure only valid id numbers can pass + assert((!is_bool($id)) && ($id > 0)); - // id is received so we can redirect the user, used points will be added when he send's out the mail + // Id is received so we can redirect the user, used points will be added when he send's out the mail $url = 'modules.php?module=frametester&order=' . $id; } elseif ($content['target_send'] == '0') { // Not enougth receivers found which can receive mails @@ -501,7 +478,7 @@ ORDER BY $userid_cnt = '0'; while (list($userid) = SQL_FETCHROW($result_userids)) { // Check for holiday system - $isHolidayActive = false; + $isHolidayActive = FALSE; if (isExtensionInstalledAndNewer('holiday', '0.1.3')) { // Check user's holiday status $result_holiday = SQL_QUERY_ESC("SELECT @@ -532,7 +509,7 @@ LIMIT 1", $isHolidayActive = ($count == 1); } // END - if - if ($isHolidayActive === false) { + if ($isHolidayActive === FALSE) { // Check if the user want's to receive mails? $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($userid)), __FILE__, __LINE__); @@ -563,7 +540,7 @@ LIMIT 1", SQL_FREERESULT($result_cats); // Now we need to load the mail types... - $result = SQL_QUERY("SELECT `id`,`price`,`payment`,`mail_title` FROM `{?_MYSQL_PREFIX?}_payments` ORDER BY `payment` ASC", __FILE__, __LINE__); + $result = SQL_QUERY("SELECT `id`, `price`, `payment`, `mail_title` FROM `{?_MYSQL_PREFIX?}_payments` ORDER BY `payment` ASC", __FILE__, __LINE__); $types = array(); if (!SQL_HASZERONUMS($result)) { @@ -601,10 +578,10 @@ LIMIT 1", } // END - switch // Load final template - loadTemplate('member_order_points', false, $content); + loadTemplate('member_order_points', FALSE, $content); // Reset variables - $OLD_ORDER = false; + $OLD_ORDER = FALSE; $subject = ''; $text = ''; $target = ''; @@ -638,7 +615,7 @@ LIMIT 1", } // END - if // Old order is grabbed - $OLD_ORDER = true; + $OLD_ORDER = TRUE; } else { // Default output for that your members don't forget it... $content['url'] = 'http://'; @@ -670,7 +647,7 @@ LIMIT 1", if (isPostRequestElementSet('zip')) { // Output entered ZIP code - $content['zip_content'] = loadTemplate('member_order_zip2', true, postRequestElement('zip')); + $content['zip_content'] = loadTemplate('member_order_zip2', TRUE, postRequestElement('zip')); } // END - if // No HTML extension installed by default @@ -679,11 +656,11 @@ LIMIT 1", // HTML extension if ((isExtensionActive('html_mail')) && (postRequestElement('html') == 'Y')) { // Extension is active so output valid HTML tags - $content['html_extension'] = loadTemplate('member_order_html_ext', true); + $content['html_extension'] = loadTemplate('member_order_html_ext', TRUE); } // END - if // Output form for page 2 - loadTemplate('member_order_page2', false, $content); + loadTemplate('member_order_page2', FALSE, $content); } else { // No HTML extension installed by default $content['html_extension'] = ''; @@ -691,7 +668,7 @@ LIMIT 1", // Remember maybe entered ZIP code in constant if (isExtensionActive('html_mail')) { // Add some content when html extension is active - $content['html_extension'] = loadTemplate('member_order_html_intro', true); + $content['html_extension'] = loadTemplate('member_order_html_intro', TRUE); } // END - if // Default is no ZIP code @@ -709,11 +686,11 @@ LIMIT 1", 'zip' => '' ); } - $content['zip_content'] = loadTemplate('member_order_zip1', true, $data); + $content['zip_content'] = loadTemplate('member_order_zip1', TRUE, $data); } // END - if // Output form for page 1 (ZIP code or HTML) - loadTemplate('member_order_page1', false, $content); + loadTemplate('member_order_page1', FALSE, $content); } } else { // No mail types defined