]> git.mxchange.org Git - mailer.git/commitdiff
Fixes for broken order page and themes
authorRoland Häder <roland@mxchange.org>
Wed, 28 Oct 2009 21:22:27 +0000 (21:22 +0000)
committerRoland Häder <roland@mxchange.org>
Wed, 28 Oct 2009 21:22:27 +0000 (21:22 +0000)
inc/language/order_de.php
inc/modules/guest/action-themes.php
inc/modules/member/action-themes.php
inc/modules/member/what-order.php

index a75de0d35e60082ce30d958acf8d8a48e328b9f9..ec3c5673c747636d97763c3b8223b7f2e4b3edbc 100644 (file)
@@ -70,6 +70,8 @@ addMessages(array(
        'ORDER_SELECT_COLUMN_TOTAL_LOGINS' => "Gesamtlogins",
        'ORDER_SELECT_COLUMN_MAIL_ORDERS' => "Heutige Mailbuchungen",
 
+       'ORDER_DEFAULT_SUBJECT' => "Betreffzeile in allen Mails",
+       'ORDER_DEFAULT_TEXT'    => "Geben Sie hier Ihren Werbetext ein.",
        'ADMIN_AUTOSEND_INACTIVE' => "Der Auto-Versand ist in Ihrem {?mt_word?} derzeit deaktiviert. Bitte loggen Sie sich in den Admin-Bereich ein und schalten Sie diese Mailbuchung frei!",
        'ADMIN_AUTOSEND_ACTIVE' => "Der Auto-Versand ist in Ihrem {?mt_word?} derzeit aktiviert. Die Mailbuchung wird aktiviert und dann automatisch versand.",
        'MEMBER_AUTOSEND_INACTIVE' => "Der Auto-Versand ist in unserem {?mt_word?} derzeit deaktiviert. Ihre Mailbuchung wird bald von einem Administrator ueberprueft und dann freigegeben.",
index 00b6bf45f5685e14790427b412cc5ecbbdfaa10c..b239377473165473b8fbdc69e15c49a67c125ff1 100644 (file)
@@ -67,7 +67,7 @@ if ($num_themes > 1) {
        $OUT = loadTemplate('theme_one', true, getCurrentThemeName());
 } elseif (isAdmin()) {
        // If there is no theme installed and there's an admin notify him!
-       $OUT = loadTemplate('admin_settings_saved', true, "<div class=\"admin_note\">{--ADMIN_NO_THEME_INSTALLED_WARNING--}</div>");
+       $OUT = '{--ADMIN_NO_THEME_INSTALLED_WARNING--}';
 }
 
 // Load final box template
index 7dadc2abda6f14e8914f1332b27e45a3de0dc9ad..22a22725ce689e01582105319a2daabe5a464118 100644 (file)
@@ -68,7 +68,7 @@ if ($num_themes > 1) {
        $OUT = loadTemplate('theme_one', true, getCurrentThemeName());
 } elseif (isAdmin()) {
        // If there is no theme installed and there's an admin notify him!
-       $OUT = loadTemplate('admin_settings_saved', true, "<div class=\"admin_note\">{--ADMIN_NO_THEME_INSTALLED_WARNING--}</div>");
+       $OUT = '{--ADMIN_NO_THEME_INSTALLED_WARNING--}';
 }
 
 // Load final box template
index 491160aa2d8c248099366f935e07c035f04d93b2..b214a719c614beb8a81c0a429909c4784ef17b04 100644 (file)
@@ -63,22 +63,26 @@ $content['min'] = getConfig('order_min');
 // Count unconfirmed mails
 $links = countSumTotalData(getUserId(), 'user_links', 'id', 'userid', true);
 
-// Does the user has more than 0 mails per day set?
-$HOLIDAY = 'userid';
+// Do we have ext-holiday installed?
+$HOLIDAY = 'serid';
 if ((isExtensionActive('holiday')) && (getExtensionVersion('holiday') >= '0.1.3')) {
        // Fetch also holiday activation data
-       $HOLIDAY = '`holiday_active`';
+       $HOLIDAY = 'holiday_active';
 } // END - if
 
-$result_mmails = SQL_QUERY_ESC("SELECT `userid`, `receive_mails`, `mail_orders`, ".$HOLIDAY."
+$result_mmails = SQL_QUERY_ESC("SELECT `userid`, `receive_mails`, `mail_orders`, `".$HOLIDAY."`
 FROM `{?_MYSQL_PREFIX?}_user_data`
 WHERE `userid`=%s AND `max_mails` > 0 LIMIT 1",
        array(getUserId()), __FILE__, __LINE__);
 
 $mmails = SQL_NUMROWS($result_mmails);
 list($DMY, $MAXI, $ORDERS, $HOLIDAY) = SQL_FETCHROW($result_mmails);
+
+// Free result
 SQL_FREERESULT($result_mmails);
-if ($HOLIDAY == $DMY) $HOLIDAY='N';
+
+// Fix non-existent ext-holidy
+if ($HOLIDAY == $DMY) $HOLIDAY = 'N';
 
 $ALLOWED = $MAXI - $ORDERS;
 if (getConfig('order_max_full') == 'MAX') $ALLOWED = $MAXI;
@@ -89,7 +93,7 @@ $total = countSumTotalData(getUserId(), 'user_points', 'points') - countSumTotal
 if (($HOLIDAY == 'Y') && (getExtensionVersion('holiday') >= '0.1.3')) {
        // Holiday is active!
        loadTemplate('admin_settings_saved', false, getMessage('HOLIDAY_ORDER_NOT_POSSIBLE'));
-} elseif ((isPostRequestElementSet(('frametester'))) && ($ALLOWED > 0) && (postRequestElement('receiver') > 0)) {
+} elseif ((isPostRequestElementSet('frametester')) && ($ALLOWED > 0) && (postRequestElement('receiver') > 0)) {
        // Continue with the frametester, we first need to store the data temporary in the pool
        //
        // First we would like to store the data and get it's pool position back...
@@ -97,7 +101,9 @@ if (($HOLIDAY == 'Y') && (getExtensionVersion('holiday') >= '0.1.3')) {
 FROM
        `{?_MYSQL_PREFIX?}_pool`
 WHERE
-       `sender`=%s AND `url`='%s' AND `timestamp` > (UNIX_TIMESTAMP() - %s)
+       `sender`=%s AND
+       `url`='%s' AND
+       `timestamp` > (UNIX_TIMESTAMP() - %s)
 LIMIT 1",
                array(
                        getUserId(),
@@ -234,7 +240,7 @@ ORDER BY
 
                        // Load receivers from database
                        $TEST = array(); $cnt = 0;
-                       while ($content = SQL_FETCHARRAY($result)) {
+                       while ($holidayContent = SQL_FETCHARRAY($result)) {
                                if ($HOLIDAY) {
                                        // Check for his holiday status
                                        $result_holiday = SQL_QUERY_ESC("SELECT
@@ -244,16 +250,16 @@ FROM
 WHERE
        `userid`=%s AND `holiday_start` < UNIX_TIMESTAMP() AND `holiday_end` > UNIX_TIMESTAMP()
 LIMIT 1",
-                                               array(bigintval($content['userid'])), __FILE__, __LINE__);
-                                       if (SQL_NUMROWS($result_holiday) == 1) $content['userid'] = 0; // Exclude user who are in holiday
+                                               array($holidayContent['userid']), __FILE__, __LINE__);
+                                       if (SQL_NUMROWS($result_holiday) == 1) $holidayContent['userid'] = 0; // Exclude user who are in holiday
 
                                        // Free memory
                                        SQL_FREERESULT($result_holiday);
                                } // END - if
 
-                               if ($content['userid'] > 0) {
+                               if ($holidayContent['userid'] > 0) {
                                        // Add receiver
-                                       $TEST[] = $content['userid'];
+                                       $TEST[] = $holidayContent['userid'];
                                        $cnt++;
                                } // END - if
                        } // END - while
@@ -265,59 +271,56 @@ LIMIT 1",
                        $RECEIVER = implode($TEST, ';');
 
                        // Count array for maximum sent
-                       $MAX_SEND = count($TEST);
+                       $content['target_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), $content['target_send']), __FILE__, __LINE__);
 
                        // Is calculated max receivers larger than wanted receivers then reset it
-                       if ($MAX_SEND > postRequestElement('receiver')) $MAX_SEND = bigintval(postRequestElement('receiver'));
+                       if ($content['target_send'] > postRequestElement('receiver')) $content['target_send'] = bigintval(postRequestElement('receiver'));
 
                        // Calculate used points
-                       $USED = $MAX_SEND * getPaymentPoints(bigintval(postRequestElement('type')));
+                       $USED = $content['target_send'] * getPaymentPoints(bigintval(postRequestElement('type')));
 
                        // Fix empty zip code
                        if (!isPostRequestElementSet('zip')) setRequestPostElement('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 (($USED > 0) && ($USED <= $total) && ($content['target_send'] > 0)) {
                                // Gettings points is okay, so we can add $USED later from
-                               $TIME = time();
                                if (($id == '0') || ($type != 'TEMP')) {
                                        // New order
                                        $id = 0;
                                        if (isExtensionActive('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')",
+ VALUES ('%s','%s','%s','%s','%s','TEMP',UNIX_TIMESTAMP(),'%s','%s','%s','%s','%s')",
                                                        array(
                                                                getUserId(),
                                                                postRequestElement('subject'),
                                                                postRequestElement('text'),
                                                                $RECEIVER,
                                                                bigintval(postRequestElement('type')),
-                                                               $TIME,
                                                                postRequestElement('url'),
                                                                bigintval(postRequestElement('cat')),
-                                                               $MAX_SEND,
+                                                               $content['target_send'],
                                                                bigintval(postRequestElement('zip')),
                                                                postRequestElement('html')
                                                        ), __FILE__, __LINE__);
                                        } else {
                                                // No 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`)
- VALUES ('%s','%s','%s','%s','%s','TEMP','%s','%s','%s','%s','%s')",
+ VALUES ('%s','%s','%s','%s','%s','TEMP',UNIX_TIMESTAMP(),'%s','%s','%s','%s')",
                                                        array(
                                                                getUserId(),
                                                                postRequestElement('subject'),
                                                                postRequestElement('text'),
                                                                $RECEIVER,
                                                                bigintval(postRequestElement('type')),
-                                                               $TIME,
                                                                postRequestElement('url'),
                                                                bigintval(postRequestElement('cat')),
-                                                               $MAX_SEND,
+                                                               $content['target_send'],
                                                                bigintval(postRequestElement('zip')),
                                                        ), __FILE__, __LINE__);
                                        }
@@ -348,7 +351,7 @@ LIMIT 1",
                                                                bigintval(postRequestElement('type')),
                                                                postRequestElement('url'),
                                                                bigintval(postRequestElement('cat')),
-                                                               $MAX_SEND,
+                                                               $content['target_send'],
                                                                bigintval(postRequestElement('zip')),
                                                                postRequestElement('html'),
                                                                bigintval($id)
@@ -377,7 +380,7 @@ LIMIT 1",
                                                                bigintval(postRequestElement('type')),
                                                                postRequestElement('url'),
                                                                bigintval(postRequestElement('cat')),
-                                                               $MAX_SEND,
+                                                               $content['target_send'],
                                                                bigintval(postRequestElement('zip')),
                                                                bigintval($id)
                                                        ), __FILE__, __LINE__);
@@ -387,21 +390,23 @@ 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`=%s LIMIT 1",
+                                       $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(
                                                        getUserId(),
                                                        postRequestElement('subject'),
-                                                       bigintval(postRequestElement('type')),
-                                                       $TIME
+                                                       bigintval(postRequestElement('type'))
                                                ), __FILE__, __LINE__);
 
+                                       // Get pool id
                                        list($id) = SQL_FETCHROW($result);
+
+                                       // Free result
                                        SQL_FREERESULT($result);
-                               }
+                               } // END - if
 
                                // 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&amp;order=' . $id;
-                       } elseif ($MAX_SEND == 0) {
+                       } elseif ($content['target_send'] == 0) {
                                // Not enougth receivers found which can receive mails
                                $URL = 'modules.php?module=login&amp;what=order&amp;code=' . getCode('MORE_RECEIVERS2');
                        } else {
@@ -431,7 +436,7 @@ ORDER BY
        if (SQL_NUMROWS($result_cats) > 0) {
                if ($total > 0) {
                        // Initialize array...
-                       $CATS = array(
+                       $categories = array(
                                'id'      => array(),
                                'name'    => array(),
                                'userids' => array()
@@ -447,13 +452,13 @@ ORDER BY
                        } // END - if
 
                        // ... and begin loading stuff
-                       while ($content = SQL_FETCHARRAY($result_cats)) {
-                               $CATS['id'][]   = bigintval($content['id']);
-                               $CATS['name'][] = $content['cat'];
+                       while ($categoriesContent = SQL_FETCHARRAY($result_cats)) {
+                               $categories['id'][]   = bigintval($categoriesContent['id']);
+                               $categories['name'][] = $categoriesContent['cat'];
 
                                // Select users in current category
                                $result_userids = SQL_QUERY_ESC("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_cats` WHERE `cat_id`=%s AND `userid` != '%s' ORDER BY `userid` ASC",
-                                       array(bigintval($content['id']), getUserId()), __FILE__, __LINE__);
+                                       array(bigintval($categoriesContent['id']), getUserId()), __FILE__, __LINE__);
 
                                $userid_cnt = 0;
                                while (list($ucat) = SQL_FETCHROW($result_userids)) {
@@ -486,8 +491,8 @@ LIMIT 1",
                                                        array(bigintval($ucat)), __FILE__, __LINE__);
 
                                                if ((SQL_NUMROWS($result_ver) == 1) && (isPostRequestElementSet('zip')) && (getConfig('order_multi_page') == 'Y')) {
+                                                       // Get zip code
                                                        list($zip) = SQL_FETCHROW($result_ver);
-                                                       SQL_FREERESULT($result_ver);
                                                        if (substr($zip, 0, strlen(postRequestElement('zip'))) == postRequestElement('zip')) {
                                                                // Ok, ZIP part is found
                                                                $userid_cnt++;
@@ -496,12 +501,15 @@ LIMIT 1",
                                                        // Count numbers up!
                                                        $userid_cnt += SQL_NUMROWS($result_ver);
                                                }
+
+                                               // Free result
+                                               SQL_FREERESULT($result_ver);
                                        } // END - if
                                } // END - while
 
                                // Free memory
                                SQL_FREERESULT($result_userids);
-                               $CATS['userids'][] = $userid_cnt;
+                               $categories['userids'][] = $userid_cnt;
                        } // END - while
 
                        // Free memory
@@ -510,7 +518,7 @@ LIMIT 1",
                        // 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__);
 
-                       $typeS = array();
+                       $types = array();
                        if (SQL_NUMROWS($result) > 0) {
                                // Check for message ID in URL
                                $message = getMessageFromErrorCode(getRequestElement('code'));
@@ -521,7 +529,7 @@ LIMIT 1",
                                } // END - if
 
                                // Load all email types...
-                               while ($typeS[] = SQL_FETCHROW($result)) {
+                               while ($types[] = SQL_FETCHROW($result)) {
                                        // Nothing to do here... ;-)
                                } // END - while
 
@@ -562,22 +570,29 @@ LIMIT 1",
 FROM
        `{?_MYSQL_PREFIX?}_pool`
 WHERE
-       `sender`=%s AND `data_type`='TEMP'
+       `sender`=%s AND
+       `data_type`='TEMP'
 LIMIT 1",
                                        array(getUserId()), __FILE__, __LINE__);
 
                                if (SQL_NUMROWS($result) == 1) {
                                        // Old order found
-                                       $content = SQL_FETCHARRAY($result);
+                                       $content = merge_array($content, SQL_FETCHARRAY($result));
 
                                        // Fix max receivers when it is too much
-                                       if ((isset($CATS['userids'][$content['cat_id']])) && ($content['target_send'] > $CATS['userids'][$content['cat_id']])) $content['target_send'] = $CATS['userids'][$content['cat_id']];
+                                       if ((isset($categories['userids'][$content['cat_id']])) && ($content['target_send'] > $categories['userids'][$content['cat_id']])) {
+                                               // Fix it
+                                               $content['target_send'] = $categories['userids'][$content['cat_id']];
+                                       } // END - if
 
                                        // Old order is grabbed
                                        $OLD_ORDER = true;
                                } else {
                                        // Default output for that your members don't forget it...
-                                       $content['url'] = 'http://';
+                                       $content['url']         = 'http://';
+                                       $content['target_send'] = $content['min'];
+                                       $content['subject']     = '{--ORDER_DEFAULT_SUBJECT--}';
+                                       $content['text']        = '{--ORDER_DEFAULT_TEXT--}';
                                }
 
                                // Free result
@@ -585,29 +600,25 @@ LIMIT 1",
 
                                if ((isPostRequestElementSet('data')) || ((getConfig('order_multi_page') != 'Y') && ((!isAdmin()) && (!isExtensionActive('html_mail'))))) {
                                        // Pre-output categories
-                                       $CAT = '';
-                                       foreach ($CATS['id'] as $key => $value) {
-                                               $CAT .= "      <option value=\"".$value."\"";
-                                               if (($OLD_ORDER) && ($content['cat_id'] == $value)) $CAT .= ' selected="selected"';
-                                               $CAT .= ">".$CATS['name'][$key]." (".$CATS['userids'][$key]." {--USER_IN_CAT--})</option>\n";
+                                       $content['category_selection'] = '';
+                                       foreach ($categories['id'] as $key => $value) {
+                                               $content['category_selection'] .= "      <option value=\"".$value."\"";
+                                               if (($OLD_ORDER) && ($content['cat_id'] == $value)) $content['category_selection'] .= ' selected="selected"';
+                                               $content['category_selection'] .= ">".$categories['name'][$key]." (".$categories['userids'][$key]." {--USER_IN_CAT--})</option>\n";
                                        } // END - foreach
 
                                        // Mail type
-                                       $type = '';
-                                       foreach ($typeS as $key => $value) {
-                                               $P = translateComma($typeS[$key][1]);
+                                       $content['type_selection'] = '';
+                                       foreach ($types as $key => $value) {
+                                               $P = translateComma($types[$key][1]);
                                                if (is_array($value)) {
                                                        // Output option line
-                                                       $type .= "      <option value=\"".$typeS[$key][0]."\"";
-                                                       if (($OLD_ORDER) && ($content['payment_id'] == $typeS[$key][0])) $type .= ' selected="selected"';
-                                                       $type .= ">".$P." {--PER_MAIL--} - ".$typeS[$key][3]." - ".round($typeS[$key][2])." {--PAYMENT--}</option>\n";
+                                                       $content['type_selection'] .= "      <option value=\"".$types[$key][0]."\"";
+                                                       if (($OLD_ORDER) && ($content['payment_id'] == $types[$key][0])) $content['type_selection'] .= ' selected="selected"';
+                                                       $content['type_selection'] .= ">".$P." {--PER_MAIL--} - ".$types[$key][3]." - ".round($types[$key][2])." {--PAYMENT--}</option>\n";
                                                } // END - if
                                        } // END - foreach
 
-                                       // Put all in constants for the template
-                                       $content['category_selection'] = $CAT;
-                                       $content['type_selection']     = $type;
-
                                        if (isPostRequestElementSet('zip')) {
                                                // Output entered ZIP code
                                                $content['zip_content'] = loadTemplate('member_order-zip', true, postRequestElement('zip'));
@@ -621,11 +632,11 @@ LIMIT 1",
                                                $content['html_extension'] = loadTemplate('member_order-html_ext', true, addValidHtmlTags());
                                        } else {
                                                // Extension not active and/or class not uploaded
-                                               $content['html_extension'] = "<tr><td colspan=\"5\"><input type=\"hidden\" name=\"html\" value=\"N\"> /</td></tr>";
+                                               $content['html_extension'] = "<tr><td colspan=\"5\"><input type=\"hidden\" name=\"html\" value=\"N\" /></td></tr>";
                                        }
 
                                        // Output form for page 2
-                                       loadTemplate('member_order_page2');
+                                       loadTemplate('member_order_page2', false, $content);
                                } else {
                                        // Remember maybe entered ZIP code in constant
                                        $add = '';