- Templates for surfbar (admin/member) added when URL got added while unlocking
authorRoland Häder <roland@mxchange.org>
Wed, 3 Sep 2008 23:21:40 +0000 (23:21 +0000)
committerRoland Häder <roland@mxchange.org>
Wed, 3 Sep 2008 23:21:40 +0000 (23:21 +0000)
  the mail order
- Minor fix to footer.php
- URLs got now compressed with gzcompress() to and then BASE64-encoded in
  frametester and dereferer
- More surfbar functions added (still incomplete extension!)

.gitattributes
inc/footer.php
inc/functions.php
inc/libs/surfbar_functions.php
inc/modules/admin/what-unlock_emails.php
inc/modules/frametester.php
inc/modules/loader.php
templates/de/emails/admin/admin_surfbar_url_unlock.tpl [new file with mode: 0644]
templates/de/emails/member/member_surfbar_url_unlock.tpl [new file with mode: 0644]

index ac8b497..7ef8ff9 100644 (file)
@@ -593,6 +593,7 @@ templates/de/emails/admin/admin_support-order.tpl -text
 templates/de/emails/admin/admin_support-ordr.tpl -text
 templates/de/emails/admin/admin_support-reflink.tpl -text
 templates/de/emails/admin/admin_support-unconfirmed.tpl -text
+templates/de/emails/admin/admin_surfbar_url_unlock.tpl -text
 templates/de/emails/admin/admin_transfer_ap.tpl -text
 templates/de/emails/admin/admin_transfer_points.tpl -text
 templates/de/emails/admin/admin_wernis_request.tpl -text
@@ -656,6 +657,7 @@ templates/de/emails/member/member_support-order.tpl -text
 templates/de/emails/member/member_support-ordr.tpl -text
 templates/de/emails/member/member_support-reflink.tpl -text
 templates/de/emails/member/member_support-unconfirmed.tpl -text
+templates/de/emails/member/member_surfbar_url_unlock.tpl -text
 templates/de/emails/member/member_transfer_recipient.tpl -text
 templates/de/emails/member/member_transfer_sender.tpl -text
 templates/de/emails/member/member_wernis_accepted.tpl -text
index 69b37d9..bbb91a4 100644 (file)
@@ -38,25 +38,25 @@ global $link, $frame, $CSS, $header;
 if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
-}
+} // END - if
 
 if (($footer != "1") && ($footer != "2") && ($CSS != "1")) {
        // Output the generated HTML code or do nothing in direct-mode
        if (!empty($FATAL[0])) {
                // Output fatal error messages
                require_once(PATH."inc/fatal_errors.php");
-       }
+       } // END - if
 
        // Shall we display the copyright notice?
-       if ((empty($frame)) && (empty($_GET['frame'])) && (basename($_SERVER['PHP_SELF']) != "mailid_top.php") && (isBooleanConstantAndTrue('WRITE_FOOTER'))) {
+       if ((empty($frame)) && (empty($_GET['frame'])) && (basename($_SERVER['PHP_SELF']) != "mailid_top.php") && (isBooleanConstantAndTrue('WRITE_FOOTER')) && ($header == "2")) {
                LOAD_TEMPLATE("copyright");
-       }
+       } // END - if
 
        // Shall we display the parsing time and number of queries?
-       if ((isset($_CONFIG['show_timings'])) && ($_CONFIG['show_timings'] == "Y") && (empty($_GET['frame']))) {
+       if ((isset($_CONFIG['show_timings'])) && ($_CONFIG['show_timings'] == "Y") && (empty($_GET['frame'])) && ($header == "2")) {
                // Then display it here
                DISPLAY_PARSING_TIME_FOOTER();
-       }
+       } // END - if
 
        // Load page footer
        LOAD_TEMPLATE("page_footer");
index 3a379eb..7a08291 100644 (file)
@@ -418,7 +418,11 @@ function SEND_RAW_EMAIL ($to, $subject, $msg, $from) {
                $mail->Port       = 25;
                $mail->Username   = SMTP_USER;
                $mail->Password   = SMTP_PASSWORD;
-               $mail->From       = $from;
+               if (empty($from)) {
+                       $mail->From = WEBMASTER;
+               } else {
+                       $mail->From = $from;
+               }
                $mail->FromName   = MAIN_TITLE;
                $mail->Subject    = $subject;
                if ((EXT_IS_ACTIVE("html_mail")) && (strip_tags($msg) != $msg)) {
@@ -560,7 +564,7 @@ function TRANSLATE_COMMA($dotted, $cut=true) {
 
 //
 function DEREFERER($URL) {
-       $URL = URL."/modules.php?module=loader&amp;url=".urlencode(base64_encode(COMPILE_CODE($URL)));
+       $URL = URL."/modules.php?module=loader&amp;url=".urlencode(base64_encode(gzcompress(COMPILE_CODE($URL))));
        return $URL;
 }
 
@@ -594,7 +598,7 @@ function FRAMETESTER($URL) {
        // Prepare frametester URL
        $frametesterUrl = sprintf("%s/modules.php?module=frametester&amp;url=%s",
                URL,
-               urlencode(base64_encode(COMPILE_CODE($URL)))
+               urlencode(base64_encode(gzcompress(COMPILE_CODE($URL))))
        );
        return $frametesterUrl;
 }
index 64c65b5..6f84494 100644 (file)
@@ -137,16 +137,14 @@ function SURFBAR_REGISTER_URL ($url, $uid, $reward, $status="PENDING", $addMode=
 // Inserts an url by given data array and return the insert id
 function SURFBAR_INSERT_URL_BY_ARRAY ($urlData) {
        // Just run the insert query for now
-       /*
        SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_surfbar_urls (userid, url, reward, status) VALUES(%s, '%s', %s, '%s')",
                array(
-                       bigintval($urlData['userid']),
+                       bigintval($urlData['uid']),
                        bigintval($urlData['url']),
                        (float)$urlData['reward'],
                        $urlData['status']
                ), __FILE__, __LINE__
        );
-       */
 
        // Return insert id
        return SQL_INSERTID();
index 3947745..663d9ae 100644 (file)
@@ -55,8 +55,8 @@ if ((SQL_NUMROWS($result_main) > 0) || (isset($_POST['lock']))) {
                if (count($_POST['sel']) > 0) {
                        // Count now... We use an own function for now
                        $SEL = SELECTION_COUNT($_POST['sel']);
-               }
-       }
+               } // END - if
+       } // END - if
 
        if (isset($_POST['accept'])) {
                if ($SEL > 0) {
@@ -66,10 +66,12 @@ if ((SQL_NUMROWS($result_main) > 0) || (isset($_POST['lock']))) {
                                $id = bigintval($id);
 
                                // Unlock selected email
-                               //$result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_pool SET data_type='NEW' WHERE id=%d AND data_type='ADMIN' LIMIT 1",
-                               // array($id), __FILE__, __LINE__);
+                               $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_pool SET data_type='NEW' WHERE id=%d AND data_type='ADMIN' LIMIT 1",
+                                array($id), __FILE__, __LINE__);
+
+                               // Update wents fine?
                                if (SQL_AFFECTEDROWS($link, __FILE__, __LINE__) == 1) {
-                                       // Order placed in queue...
+                                       // Order placed in queue...        0         1           2           3
                                        $result = SQL_QUERY_ESC("SELECT po.url, po.subject, po.sender, pay.payment
 FROM "._MYSQL_PREFIX."_pool AS po
 INNER JOIN "._MYSQL_PREFIX."_payments AS pay
@@ -77,14 +79,18 @@ ON po.payment_id=pay.id
 WHERE po.id=%d
 LIMIT 1",
                                         array($id), __FILE__, __LINE__);
-                                       $DATA = SQL_FETCHROW($result);
+
+                                       // Load data
+                                       $DATA = SQL_FETCHARRAY($result);
+
+                                       // Free result
                                        SQL_FREERESULT($result);
 
                                        // Check for bonus extension version >= 0.4.4 for the order bonus
                                        if ((GET_EXT_VERSION("bonus") >= "0.4.4") && ($_CONFIG['bonus_active'] == "Y")) {
                                                // Add points directly
                                                $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET bonus_order=bonus_order+".$_CONFIG['bonus_order']." WHERE userid=%d LIMIT 1",
-                                                array(bigintval($DATA[2])), __FILE__, __LINE__);
+                                                array(bigintval($DATA['sender'])), __FILE__, __LINE__);
 
                                                // Subtract bonus points from system
                                                BONUS_POINTS_HANDLER($_CONFIG['bonus_order']);
@@ -93,17 +99,17 @@ LIMIT 1",
                                        // Check for surfbar extension
                                        if (EXT_IS_ACTIVE("surfbar")) {
                                                // Add the url
-                                               $insertId = SURFBAR_ADMIN_ADD_URL($DATA[0], $DATA[2], $DATA[3]);
+                                               $insertId = SURFBAR_ADMIN_ADD_URL($DATA['url'], $DATA['sender'], $DATA['payment']);
 
                                                // Load email template
-                                               $msg_user = LOAD_EMAIL_TEMPLATE("order_accept_sb", $insertId, $DATA[2]);
+                                               $msg_user = LOAD_EMAIL_TEMPLATE("order_accept_sb", $insertId, $DATA['sender']);
                                        } else {
                                                // Load email template
-                                               $msg_user = LOAD_EMAIL_TEMPLATE("order-accept", "", $DATA[2]);
+                                               $msg_user = LOAD_EMAIL_TEMPLATE("order-accept", "", $DATA['sender']);
                                        }
 
                                        // Send email
-                                       SEND_EMAIL($DATA[2], MEMBER_ORDER_ACCEPTED, $msg_user);
+                                       SEND_EMAIL($DATA['sender'], MEMBER_ORDER_ACCEPTED, $msg_user);
                                }
                        }
 
@@ -127,12 +133,16 @@ LIMIT 1",
                                // Load URL and subject from pool
                                $result = SQL_QUERY_ESC("SELECT url, subject, sender FROM "._MYSQL_PREFIX."_pool WHERE id=%d LIMIT 1",
                                 array($id), __FILE__, __LINE__);
-                               $DATA = SQL_FETCHROW($result);
+
+                               // Load data
+                               $DATA = SQL_FETCHARRAY($result);
+
+                               // Free result
                                SQL_FREERESULT($result);
 
                                // Load email template and send it away
-                               $msg_user = LOAD_EMAIL_TEMPLATE("order-reject", "", $DATA[2]);
-                               SEND_EMAIL($DATA[2], MEMBER_ORDER_REJECTED, $msg_user);
+                               $msg_user = LOAD_EMAIL_TEMPLATE("order-reject", "", $DATA['sender']);
+                               SEND_EMAIL($DATA['sender'], MEMBER_ORDER_REJECTED, $msg_user);
 
                                // If you do not enter an URL to redirect to, your URL will be set!
                                if ((empty($_POST['redirect'])) || ($_POST['redirect'] == "http://")) $_POST['redirect'] = URL;
index 2f44bef..48ff5cc 100644 (file)
@@ -75,7 +75,7 @@ if ((!empty($_POST['url'])) || (!empty($_GET['url'])) || (!empty($_GET['frame'])
        if (!empty($_POST['url'])) $url = $_POST['url'];
 
        // Decode URL if set
-       if (!empty($_GET['url']))  $url = base64_decode(urldecode(COMPILE_CODE($_GET['url'])));
+       if (!empty($_GET['url']))  $url = COMPILE_CODE(gzuncompress(base64_decode(urldecode($_GET['url']))));
 
        // Add missing element
        $frame = "";
index 96e1bc8..c8c62dd 100644 (file)
  ************************************************************************/
 
 // Some security stuff...
-if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))
-{
+if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
 
-if (!empty($_GET['url']))
-{
-       $url = base64_decode(urldecode(COMPILE_CODE($_GET['url'])));
-       if (VALIDATE_URL($url))
-       {
+if (!empty($_GET['url'])) {
+       // Decode URL
+       $url = COMPILE_CODE(@gzuncompress(base64_decode(urldecode($_GET['url']))));
+
+       // Validate the URL
+       if (VALIDATE_URL($url)) {
                // Prepare data for the template
                define('__URL', $url);
 
                // Generate a JavaScript that redirects us
                LOAD_TEMPLATE("loader");
-       }
-        else
-       {
+       } else {
                // URL invalid
                LOAD_URL("index.php");
        }
-}
- else
-{
+} else {
        // Invalid or no URL entered!
        LOAD_URL("index.php");
 }
+
 //
 ?>
diff --git a/templates/de/emails/admin/admin_surfbar_url_unlock.tpl b/templates/de/emails/admin/admin_surfbar_url_unlock.tpl
new file mode 100644 (file)
index 0000000..1a7ac08
--- /dev/null
@@ -0,0 +1,28 @@
+{--HELLO_ADMIN--},
+
+Ein Administrator hat soeben eine Mail freigegeben. Dabei wurde die URL in der Surfbar registriert und sofort freigeschaltet.
+
+Hier sind alle Daten aus der Mail:
+------------------------------------------
+Gebuchte URL: $content[url]
+------------------------------------------
+Betreff: $DATA[subject]
+------------------------------------------
+Email: $DATA[email]
+------------------------------------------
+Framekiller-Test:
+$content[frametester]
+------------------------------------------
+User-ID: $content[uid]
+------------------------------------------
+Verg&uuml;tung: $content[reward] {!POINTS!}
+------------------------------------------
+Status: $content[status]
+------------------------------------------
+ID in der Surfbar: $content[insert_id]
+------------------------------------------
+
+{--ADMIN_THANX--}
+  {--YOUR--} {!MAIN_TITLE!} {--SCRIPT--}
+
+{!URL!}/admin.php
diff --git a/templates/de/emails/member/member_surfbar_url_unlock.tpl b/templates/de/emails/member/member_surfbar_url_unlock.tpl
new file mode 100644 (file)
index 0000000..19433a2
--- /dev/null
@@ -0,0 +1,19 @@
+{--HELLO--} Mitglied,
+
+Ihre gebuchte URL wurde soeben in unsere Surfbar aufgenommen.
+
+Hier sind alle Daten:
+------------------------------------------
+Gebuchte URL: $content[url]
+------------------------------------------
+Ihre User-ID: $content[uid]
+------------------------------------------
+Status: $content[status]
+------------------------------------------
+ID in der Surfbar: $content[insert_id]
+------------------------------------------
+
+Mit freundlichem Gruss,
+  Ihr {!MAIN_TITLE!} Team
+
+{!URL!} ({!WEBMASTER!})