2 /************************************************************************
3 * MXChange v0.2.1 Start: 10/19/2003 *
4 * =============== Last change: 08/26/2004 *
6 * -------------------------------------------------------------------- *
7 * File : what-order.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Order mails here *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Hier koennen Ihre Mitglieder Mails buchen *
12 * -------------------------------------------------------------------- *
14 * -------------------------------------------------------------------- *
15 * Copyright (c) 2003 - 2008 by Roland Haeder *
16 * For more information visit: http://www.mxchange.org *
18 * This program is free software; you can redistribute it and/or modify *
19 * it under the terms of the GNU General Public License as published by *
20 * the Free Software Foundation; either version 2 of the License, or *
21 * (at your option) any later version. *
23 * This program is distributed in the hope that it will be useful, *
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
26 * GNU General Public License for more details. *
28 * You should have received a copy of the GNU General Public License *
29 * along with this program; if not, write to the Free Software *
30 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
32 ************************************************************************/
34 // Some security stuff...
35 if (!defined('__SECURITY')) {
36 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
38 } elseif (!IS_MEMBER()) {
39 LOAD_URL("modules.php?module=index");
40 } elseif ((!EXT_IS_ACTIVE("order")) && (!IS_ADMIN())) {
41 ADD_FATAL(EXTENSION_PROBLEM_EXT_INACTIVE, "order");
45 // Add description as navigation point
46 ADD_DESCR("member", __FILE__);
49 $whereStatement = " WHERE visible='Y'";
51 // Set undefined array elements
52 if (empty($_GET['msg'])) $_GET['msg'] = "";
53 if (empty($_POST['zip'])) $_POST['zip'] = "";
54 if (empty($_POST['html'])) $_POST['html'] = "";
55 if (empty($_POST['receiver'])) $_POST['receiver'] = "";
56 if (IS_ADMIN()) $whereStatement = "";
58 // Minimum mails / order
59 define('__MIN_VALUE', $_CONFIG['order_min']);
61 // Count unconfirmed mails
62 $result_links = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_user_links WHERE userid=%s",
63 array($GLOBALS['userid']), __FILE__, __LINE__);
64 $links = SQL_NUMROWS($result_links);
65 SQL_FREERESULT($result_links);
67 // Does the user has more than 0 mails per day set?
69 if (GET_EXT_VERSION("holiday") >= "0.1.3") {
70 // Fetch also holiday activation data
71 $HOLIDAY = "holiday_active";
74 $result_mmails = SQL_QUERY_ESC("SELECT userid, receive_mails, mail_orders, ".$HOLIDAY."
75 FROM "._MYSQL_PREFIX."_user_data
76 WHERE userid=%s AND max_mails > 0 LIMIT 1",
77 array($GLOBALS['userid']), __FILE__, __LINE__);
79 $mmails = SQL_NUMROWS($result_mmails);
80 list($DMY, $MAXI, $ORDERS, $HOLIDAY) = SQL_FETCHROW($result_mmails);
81 SQL_FREERESULT($result_mmails);
82 if ($HOLIDAY == $DMY) $HOLIDAY='N';
84 $ALLOWED = $MAXI - $ORDERS;
85 if ($_CONFIG['order_max_full'] == "MAX") $ALLOWED = $MAXI;
87 // Check HTML extension
88 $HTML_EXT = EXT_IS_ACTIVE("html_mail");
90 // Now check his points amount
91 $TOTAL = GET_TOTAL_DATA($GLOBALS['userid'], "user_points", "points");
94 // And subtract his used points...
95 $TOTAL -= GET_TOTAL_DATA($GLOBALS['userid'], "user_data", "used_points");
97 // Add (maybe) missing three zeros
98 if (!ereg(".", $TOTAL)) $TOTAL .= ".00000";
101 if (($HOLIDAY == "Y") && (GET_EXT_VERSION("holiday") >= "0.1.3")) {
102 // Holiday is active!
103 SQL_FREERESULT($result_p);
104 LOAD_TEMPLATE("admin_settings_saved", false, HOLIDAY_ORDER_NOT_POSSIBLE);
105 } elseif ((!empty($_POST['frametester'])) && ($ALLOWED > 0) && ($_POST['receiver'] > 0)) {
106 // Continue with the frametester, we first need to store the data temporary in the pool
108 // First we would like to store the data and get it's pool position back...
109 $result = SQL_QUERY_ESC("SELECT id, data_type
110 FROM "._MYSQL_PREFIX."_pool
111 WHERE sender=%s AND url='%s' AND timestamp > (UNIX_TIMESTAMP() - %s) LIMIT 1",
112 array($GLOBALS['userid'], $_POST['url'], $_CONFIG['url_tlock']), __FILE__, __LINE__);
114 $type = "TEMP"; $id = 0;
115 if (SQL_NUMROWS($result) == 1) {
116 list($id, $type) = SQL_FETCHROW($result);
120 SQL_FREERESULT($result);
122 if ($type == "TEMP") {
123 // No entry found, so we need to check out the stats table as well... :)
124 // We have to add that suff here, now we continue WITHOUT checking and check the text and subject against some filters
126 if ($_CONFIG['test_text'] == "Y") {
127 // Test submitted text against some filters (length, URLs in text etc.)
128 if ((strpos(strtolower($_POST['text']), "https://") > -1) || (strpos(strtolower($_POST['text']), "http://") > -1) || (strpos(strtolower($_POST['text']), "www") > -1)) {
130 $URL = URL."/modules.php?module=login&what=order&msg=".CODE_URL_FOUND;
133 // Remove new-line and carriage-return characters
134 $TEST = str_replace("\n", "", str_replace("\r", "", $_POST['text']));
136 // Text length within allowed length?
137 if (strlen($TEST) > $_CONFIG['max_tlength']) {
139 $URL = URL."/modules.php?module=login&what=order&msg=".CODE_OVERLENGTH;
143 // Shall I test the subject line against URLs?
144 if ($_CONFIG['test_subj'] == "Y") {
145 // Check the subject line for issues
146 $_POST['subject'] = str_replace("\\", "[nl]", substr($_POST['subject'], 0, 200));
147 if ((strpos(strtolower($_POST['subject']), "http://") > -1) || (strpos(strtolower($_POST['subject']), "www") > -1)) {
148 // URL in subject found
149 $URL = URL."/modules.php?module=login&what=order&msg=".CODE_SUBJ_URL;
153 // And shall I check that his URL is not in the black list?
154 if ($_CONFIG['url_blacklist'] == "Y") {
155 // Ok, I do that for you know...
156 $result = SQL_QUERY_ESC("SELECT timestamp FROM "._MYSQL_PREFIX."_url_blist WHERE url='%s' LIMIT 1",
157 array($_POST['url']), __FILE__, __LINE__);
159 if (SQL_NUMROWS($result) == 1) {
160 // Jupp, we got one listed
161 list($blist) = SQL_FETCHROW($result);
162 SQL_FREERESULT($result);
163 $URL = URL."/modules.php?module=login&what=order&msg=".CODE_BLIST_URL."&blist=".$blist;
167 // Enougth receivers entered?
168 if (($_POST['receiver'] < $_CONFIG['order_min']) && (!IS_ADMIN())) {
169 // Less than allowed receivers entered!
170 $URL = URL."/modules.php?module=login&what=order&msg=".CODE_MORE_RECEIVERS3;
174 if (!VALIDATE_URL($_POST['url'])) {
176 $URL = URL."/modules.php?module=login&what=order&msg=".CODE_INVALID_URL;
179 // Probe for HTML extension
181 // HTML or regular text mail?
182 if ($_POST['html'] == "Y") {
183 // Chek for valid HTML tags
184 $_POST['text'] = HTML_CHECK_TAGS($_POST['text']);
186 // Maybe invalid tags found?
187 if (empty($_POST['text'])) $URL = URL."/modules.php?module=login&what=order&msg=".CODE_INVALID_TAGS."&id=".$id;
189 // Remove any HTML code
190 $_POST['text'] = str_replace("<", "{OPEN_HTML}", str_replace(">", "{CLOSE_HTML}", $_POST['text']));
193 } elseif (!IS_ADMIN()) {
194 // He has already sent a mail within a specific time
195 $URL = URL."/modules.php?module=login&what=order&msg=".CODE_URL_TLOCK."&id=".$id;
200 // Check if category and number of receivers is okay
202 if (($_CONFIG['order_multi_page'] == "Y") && (!empty($_POST['zip']))) {
203 // Choose recipients by ZIP code
204 $ADD = " AND d.zip LIKE '".bigintval($_POST['zip'])."{PER}'";
208 $result = SQL_QUERY_ESC("SELECT DISTINCT c.userid FROM "._MYSQL_PREFIX."_user_cats AS c
209 LEFT JOIN "._MYSQL_PREFIX."_user_data AS d
211 WHERE c.cat_id=%s AND c.userid != '%s' AND d.status='CONFIRMED' AND d.receive_mails > 0".$ADD."
214 bigintval($_POST['cat']),
216 $_CONFIG['order_select'],
217 $_CONFIG['order_mode'],
218 ), __FILE__, __LINE__);
220 // Do we enougth receivers left?
221 if (SQL_NUMROWS($result) >= $_POST['receiver']) {
222 // Check for holiday extensions
224 if (GET_EXT_VERSION("holiday") >= "0.1.3") {
225 // Include checking for users in holiday
229 // Load receivers from database
230 $TEST = array(); $cnt = 0;
231 while (list($REC) = SQL_FETCHROW($result)) {
233 // Check for his holiday status
234 $result_holiday = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_user_holidays
235 WHERE userid=%s AND holiday_start < UNIX_TIMESTAMP() AND holiday_end > UNIX_TIMESTAMP() LIMIT 1",
236 array(bigintval($REC)), __FILE__, __LINE__);
237 if (SQL_NUMROWS($result_holiday) == 1) $REC = 0; // Exclude user who are in holiday
240 SQL_FREERESULT($result_holiday);
251 SQL_FREERESULT($result);
253 // Implode array into string for the sending pool
254 $RECEIVER = implode($TEST, ";");
256 // Count array for maximum sent
257 $MAX_SEND = count($TEST);
259 // Update receiver list
260 $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET receive_mails=receive_mails-1 WHERE userid IN (%s) LIMIT %s",
261 array(str_replace(";", ", ", $RECEIVER), $MAX_SEND), __FILE__, __LINE__);
263 // Is calculated max receivers larger than wanted receivers then reset it
264 if ($MAX_SEND > $_POST['receiver']) $MAX_SEND = $_POST['receiver'];
266 // Calculate used points
267 $USED = $MAX_SEND * GET_PAY_POINTS(bigintval($_POST['type']));
269 // Fix empty zip code
270 if (empty($_POST['zip'])) $_POST['zip'] = "0";
272 // Check if he has enougth points for this order and selected more than 0 receivers
273 if (($USED > 0) && ($USED <= $TOTAL) && ($MAX_SEND > 0)) {
274 // Gettings points is okay, so we can add $USED later from
276 if (($id == "0") || ($type != "TEMP")) {
280 // HTML extension is active
281 $result = 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)
282 VALUES ('%s','%s','%s','%s','%s','TEMP','%s','%s','%s','%s','%s','%s')",
288 bigintval($_POST['type']),
291 bigintval($_POST['cat']),
293 bigintval($_POST['zip']),
295 ), __FILE__, __LINE__);
297 // No HTML extension is active
298 $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_pool (sender, subject, text, receivers, payment_id, data_type, timestamp, url, cat_id, target_send, zip)
299 VALUES ('%s','%s','%s','%s','%s','TEMP','%s','%s','%s','%s','%s')",
305 bigintval($_POST['type']),
308 bigintval($_POST['cat']),
310 bigintval($_POST['zip']),
311 ), __FILE__, __LINE__);
314 // Change current order
316 // HTML extension is active
317 $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_pool SET
322 timestamp=UNIX_TIMESTAMP(),
328 WHERE id=%s LIMIT 1",
333 bigintval($_POST['type']),
335 bigintval($_POST['cat']),
337 bigintval($_POST['zip']),
340 ), __FILE__, __LINE__);
342 // No HTML extension is active
343 $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_pool SET
348 timestamp=UNIX_TIMESTAMP(),
353 WHERE id=%s LIMIT 1",
358 bigintval($_POST['type']),
360 bigintval($_POST['cat']),
362 bigintval($_POST['zip']),
364 ), __FILE__, __LINE__);
368 // Do we need to get the ID number?
370 // Order is placed as temporary. We need to get it's id for the frametester
371 $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=%s LIMIT 1",
375 bigintval($_POST['type']),
377 ), __FILE__, __LINE__);
379 list($id) = SQL_FETCHROW($result);
380 SQL_FREERESULT($result);
383 // ID is received so we can redirect the user, used points will be added when he send's out the mail
384 $URL = URL."/modules.php?module=frametester&order=".$id."";
385 } elseif ($MAX_SEND == 0) {
386 // Not enougth receivers found which can receive mails
387 $URL = URL."/modules.php?module=login&what=order&msg=".CODE_MORE_RECEIVERS2;
389 // No enougth points left!
390 $URL = URL."/modules.php?module=login&what=order&msg=".CODE_MORE_POINTS;
393 // Ordered more mails than he can send in this category
394 $URL = URL."/modules.php?module=login&what=order&msg=".CODE_NO_RECS_LEFT;
397 } elseif ($_POST['receiver'] == "0") {
398 // Not enougth receivers selected
399 $URL = URL."/modules.php?module=login&what=order&msg=".CODE_MORE_RECEIVERS1;
400 } elseif (($ALLOWED == 0) && ($_CONFIG['order_max_full'] == "ORDER")) {
401 // No more mail orders allowed
402 LOAD_TEMPLATE("admin_settings_saved", false, MEMBER_ORDER_ALLOWED_EXHAUSTED);
403 } elseif (($links < $_CONFIG['unconfirmed']) && ($mmails == "1")) {
404 // Display order form
405 $result_cats = SQL_QUERY("SELECT id, cat FROM "._MYSQL_PREFIX."_cats".$whereStatement." ORDER BY sort", __FILE__, __LINE__);
406 if (SQL_NUMROWS($result_cats) > 0) {
408 // Initialize array...
415 // Enable HTML checking
416 $HTML = ""; $HOLIDAY = false; $HOL_STRING = "";
417 if (($HTML_EXT) && ($_POST['html'] == "Y")) $HTML = " AND html='Y'";
418 if (GET_EXT_VERSION("holiday") >= "0.1.3") {
419 // Extension's version is fine
420 $HOLIDAY = true; $HOL_STRING = " AND holiday_active='N'";
423 // ... and begin loading stuff
424 while (list($id, $cat) = SQL_FETCHROW($result_cats)) {
425 $CATS['id'][] = bigintval($id);
426 $CATS['name'][] = $cat;
428 // Select users in current category
429 $result_uids = SQL_QUERY_ESC("SELECT userid FROM "._MYSQL_PREFIX."_user_cats WHERE cat_id=%s AND userid != '%s' ORDER BY userid",
430 array(bigintval($id), $GLOBALS['userid']), __FILE__, __LINE__);
433 while (list($ucat) = SQL_FETCHROW($result_uids)) {
434 // Check for holiday system
437 // Check user's holiday status
438 $result_holiday = SQL_QUERY_ESC("SELECT DISTINCT d.userid FROM "._MYSQL_PREFIX."_user_data AS d
439 LEFT JOIN "._MYSQL_PREFIX."_user_holidays AS h
441 WHERE d.userid=%s AND d.receive_mails > 0 AND d.status='CONFIRMED' AND d.holiday_active='Y'
442 AND h.holiday_start < UNIX_TIMESTAMP() AND h.holiday_end > UNIX_TIMESTAMP()
443 LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__);
444 if (SQL_NUMROWS($result_holiday) == 1) {
445 // Holiday is active!
450 SQL_FREERESULT($result_holiday);
454 // Check if the user want's to receive mails?
455 $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",
456 array(bigintval($ucat)), __FILE__, __LINE__);
458 if ((SQL_NUMROWS($result_ver) == 1) && (!empty($_POST['zip'])) && ($_CONFIG['order_multi_page'] == "Y")) {
459 list($zip) = SQL_FETCHROW($result_ver);
460 SQL_FREERESULT($result_ver);
461 if (substr($zip, 0, strlen($_POST['zip'])) == $_POST['zip']) {
462 // Ok, ZIP part is found
467 $uid_cnt += SQL_NUMROWS($result_ver);
473 SQL_FREERESULT($result_uids);
474 $CATS['uids'][] = $uid_cnt;
478 SQL_FREERESULT($result_cats);
480 // Now we need to load the mail types...
481 $result = SQL_QUERY("SELECT id, price, payment, mail_title FROM "._MYSQL_PREFIX."_payments ORDER BY payment", __FILE__, __LINE__);
484 if (SQL_NUMROWS($result) > 0) {
485 // Check for message ID in URL
487 switch ($_GET['msg'])
490 $result = SQL_QUERY_ESC("SELECT timestamp FROM "._MYSQL_PREFIX."_pool WHERE id=%s LIMIT 1",
491 array(bigintval($_GET['id'])), __FILE__, __LINE__);
493 // Load timestamp from last order
494 list($LORDER) = SQL_FETCHROW($result);
495 $LORDER = MAKE_DATETIME($LORDER, "1");
498 SQL_FREERESULT($result);
500 // Calculate hours...
501 $STD = round($_CONFIG['url_tlock'] / 60 / 60);
504 $MIN = round(($_CONFIG['url_tlock'] - $STD * 60 * 60) / 60);
507 $SEC = $_CONFIG['url_tlock'] - $STD * 60 * 60 - $MIN * 60;
509 // Finally contruct the message
510 $MSG = MEMBER_URL_TIME_LOCK."<br />".CONFIG_URL_TLOCK." ".$STD." ".
511 _HOURS.", ".$MIN." "._MINUTES." "._AND." ".$SEC." "._SECONDS."<br />".
512 MEMBER_LAST_TLOCK.": ".$LORDER;
515 case CODE_OVERLENGTH:
516 $MSG = MEMBER_TEXT_OVERLENGTH;
520 $MSG = MEMBER_TEXT_CONTAINS_URL;
524 $MSG = MEMBER_SUBJ_CONTAINS_URL;
528 $MSG = MEMBER_URL_BLACK_LISTED."<br />\n".MEMBER_BLIST_TIME.": ".MAKE_DATETIME($_GET['blist'], "0");
531 case CODE_NO_RECS_LEFT:
532 $MSG = MEMBER_SELECTED_MORE_RECS;
535 case CODE_INVALID_TAGS:
536 $MSG = MEMBER_HTML_INVALID_TAGS;
539 case CODE_MORE_POINTS:
540 $MSG = MEMBER_MORE_POINTS_NEEDED;
543 case CODE_MORE_RECEIVERS1:
544 $MSG = MEMBER_ENTER_MORE_RECEIVERS;
547 case CODE_MORE_RECEIVERS2:
548 $MSG = MEMBER_NO_MORE_RECEIVERS_FOUND;
551 case CODE_MORE_RECEIVERS3:
552 $MSG = MEMBER_ENTER_MORE_MIN_RECEIVERS_1.$_CONFIG['order_min'].MEMBER_ENTER_MORE_MIN_RECEIVERS_2;
555 case CODE_INVALID_URL:
556 $MSG = MEMBER_ENTER_INVALID_URL;
559 case "": // When no error code is included in the URL we do not need to output an error message as well...
563 DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown error code %s detected.", $_GET['msg']));
564 $MSG = UNKNOWN_CODE_1.$_GET['msg'].UNKNOWN_CODE_2;
569 // We got system message so we drop it out to the user
570 LOAD_TEMPLATE("admin_settings_saved", false, $MSG);
573 // Load all email types...
574 while ($typeS[] = SQL_FETCHROW($result)) {
575 // Nothing to do here... ;-)
579 SQL_FREERESULT($result);
581 // Output user's points
582 $TOTAL = TRANSLATE_COMMA($TOTAL);
584 // Check how many mail orders he has placed today and how many he's allowed to send
585 switch ($_CONFIG['order_max_full'])
587 case "MAX": // He is allowed to send as much as possible
588 define('ORDER_MAX_VALUE', ORDER_ALLOED_MAX);
591 case "ORDER": // He is allowed to send as much as he setup the receiving value
592 define('ORDER_MAX_VALUE', ORDER_ALLOWED_RECEIVE_1.$ALLOWED.ORDER_ALLOWED_RECEIVE_2.$MAXI.ORDER_ALLOWED_RECEIVE_3);
595 default: // Unknown/invalid
596 DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown order_mas_full config detected.", $_CONFIG['order_max_full']));
597 define('ORDER_MAX_VALUE', ORDER_ALLOED_UNKNOWN);
601 // Load final template
602 LOAD_TEMPLATE("member_order_points", false, $TOTAL);
605 $OLD_ORDER = false; $subject = ""; $text = ""; $target = "";
607 // Check if we already have an order placed and make it editable
608 $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",
609 array($GLOBALS['userid']), __FILE__, __LINE__);
611 if (SQL_NUMROWS($result) == 1) {
613 list($subject, $text, $payment, $tstamp, $url, $target, $cat, $zip) = SQL_FETCHROW($result);
614 SQL_FREERESULT($result);
616 // Fix max receivers when it is too much
617 if ($target > $CATS['uids'][$cat]) $target = $CATS['uids'][$cat];
619 // Old order is grabbed
622 // Default output for that your members don't forget it...
626 // 01 2 21 12 2 23 443 3 3210
627 if ((!empty($_POST['data'])) || (($_CONFIG['order_multi_page'] == "N") && ((!IS_ADMIN()) && (!$HTML_EXT)))) {
628 // Pre-output categories
630 foreach ($CATS['id'] as $key => $value) {
631 $CAT .= " <OPTION value=\"".$value."\"";
632 if (($OLD_ORDER) && ($cat == $value)) $CAT .= " selected=\"selected\"";
633 $CAT .= ">".$CATS['name'][$key]." (".$CATS['uids'][$key]." ".USER_IN_CAT.")</OPTION>\n";
638 foreach ($typeS as $key => $value) {
639 $P = TRANSLATE_COMMA($typeS[$key][1]);
640 if (is_array($value)) {
641 // Output option line
642 $type .= " <OPTION value=\"".$typeS[$key][0]."\"";
643 if (($OLD_ORDER) && ($payment == $typeS[$key][0])) $type .= " selected=\"selected\"";
644 $type .= ">".$P." ".PER_MAIL." - ".$typeS[$key][3]." - ".round($typeS[$key][2])." ".PAYMENT."</OPTION>\n";
648 // Put all in constants for the template
649 define('CATEGORY_SELECTION', $CAT);
650 define('TYPE_SELECTION', $type);
651 define('TARGET', $target);
652 define('SUBJECT', $subject);
653 define('TEXT', COMPILE_CODE($text));
654 define('T_URL', $url);
656 if (!empty($_POST['zip'])) {
657 // Output entered ZIP code
658 define('ZIP_OUTPUT', LOAD_TEMPLATE("member_order-zip2", true, $_POST['zip']));
660 define('ZIP_OUTPUT', "<TR><TD colspan=\"5\" height=\"5\" class=\"seperator\"> </TD></TR>");
664 if (($HTML_EXT) && ($_POST['html'] == "Y")) {
665 // Extension is active so output valid HTML tags
666 define('MEMBER_HTML_EXTENSION', LOAD_TEMPLATE("member_order-html_ext", true, HTML_ADD_VALID_TAGS()));
668 // Extension not active and/or class not uploaded
669 define('MEMBER_HTML_EXTENSION', "<TR><TD colspan=\"5\"><INPUT type=\"hidden\" name=\"html\" value=\"N\"></TD></TR>");
672 // Output form for page 2
673 LOAD_TEMPLATE("member_order_page2");
675 // Remember maybe entered ZIP code in constant
678 // Add some content when html extension is active
679 if (($_CONFIG['order_multi_page'] == "Y") || (IS_ADMIN())) $ADD = "<TR><TD colspan=\"2\" class=\"seperator bottom2\" height=\"5\"> </TD></TR>\n";
680 define('MEMBER_HTML_EXTENSION', LOAD_TEMPLATE("member_order-html_intro", true));
682 // No HTML extension installed
683 define('MEMBER_HTML_EXTENSION', "<TR><TD colspan=\"2\"><INPUT type=\"hidden\" name=\"html\" value=\"N\"></TD></TR>");
686 // Do we want ZIP code or not?
687 if (($_CONFIG['order_multi_page'] == "Y") || (IS_ADMIN())) {
690 'zip' => $_POST['zip'],
693 define('MEMBER_ZIP_CONTENT', LOAD_TEMPLATE("member_order-zip1", true, $content));
696 define('MEMBER_ZIP_CONTENT', "");
699 // Output form for page 1 (ZIP code or HTML)
700 LOAD_TEMPLATE("member_order_page1");
703 // No mail types defined
704 OUTPUT_HTML("<STRONG><SPAN class=\"member_failed\">".MEMBER_NO_PAYMENTS."</SPAN></STRONG>");
708 OUTPUT_HTML("<STRONG><SPAN class=\"member_failed\">".MEMBER_NO_POINTS."</SPAN></STRONG>");
711 // No cateogries are defined yet
712 OUTPUT_HTML("<STRONG><SPAN class=\"member_failed\">".MEMBER_NO_CATS."</SPAN></STRONG>");
714 } elseif ($mmails == "0") {
715 // Please set more than 0 mails per day!
716 LOAD_TEMPLATE("admin_settings_saved", false, MEMBER_HAS_ZERO_MMAILS);
718 // Please confirm some mails first!
719 LOAD_TEMPLATE("admin_settings_saved", false, MEMBER_LINKS_LEFT_1.$links.MEMBER_LINKS_LEFT_2.$_CONFIG['unconfirmed'].MEMBER_LINKS_LEFT_3);
723 // Redirect to requested URL