From a05706f3f5f5e6ae26c2114d2fd3ede01d5fe093 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 3 Sep 2008 23:21:40 +0000 Subject: [PATCH] - Templates for surfbar (admin/member) added when URL got added while unlocking 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 | 2 + inc/footer.php | 12 +++--- inc/functions.php | 10 +++-- inc/libs/surfbar_functions.php | 4 +- inc/modules/admin/what-unlock_emails.php | 38 ++++++++++++------- inc/modules/frametester.php | 2 +- inc/modules/loader.php | 23 +++++------ .../emails/admin/admin_surfbar_url_unlock.tpl | 28 ++++++++++++++ .../member/member_surfbar_url_unlock.tpl | 19 ++++++++++ 9 files changed, 98 insertions(+), 40 deletions(-) create mode 100644 templates/de/emails/admin/admin_surfbar_url_unlock.tpl create mode 100644 templates/de/emails/member/member_surfbar_url_unlock.tpl diff --git a/.gitattributes b/.gitattributes index ac8b497136..7ef8ff9fc1 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/inc/footer.php b/inc/footer.php index 69b37d9c7f..bbb91a4a20 100644 --- a/inc/footer.php +++ b/inc/footer.php @@ -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"); diff --git a/inc/functions.php b/inc/functions.php index 3a379ebb58..7a08291573 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -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&url=".urlencode(base64_encode(COMPILE_CODE($URL))); + $URL = URL."/modules.php?module=loader&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&url=%s", URL, - urlencode(base64_encode(COMPILE_CODE($URL))) + urlencode(base64_encode(gzcompress(COMPILE_CODE($URL)))) ); return $frametesterUrl; } diff --git a/inc/libs/surfbar_functions.php b/inc/libs/surfbar_functions.php index 64c65b5032..6f8449488b 100644 --- a/inc/libs/surfbar_functions.php +++ b/inc/libs/surfbar_functions.php @@ -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(); diff --git a/inc/modules/admin/what-unlock_emails.php b/inc/modules/admin/what-unlock_emails.php index 3947745f46..663d9ae4ea 100644 --- a/inc/modules/admin/what-unlock_emails.php +++ b/inc/modules/admin/what-unlock_emails.php @@ -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; diff --git a/inc/modules/frametester.php b/inc/modules/frametester.php index 2f44befb0a..48ff5cc346 100644 --- a/inc/modules/frametester.php +++ b/inc/modules/frametester.php @@ -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 = ""; diff --git a/inc/modules/loader.php b/inc/modules/loader.php index 96e1bc8a3a..c8c62dd353 100644 --- a/inc/modules/loader.php +++ b/inc/modules/loader.php @@ -32,33 +32,30 @@ ************************************************************************/ // 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 index 0000000000..1a7ac084a0 --- /dev/null +++ b/templates/de/emails/admin/admin_surfbar_url_unlock.tpl @@ -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ü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 index 0000000000..19433a2ac1 --- /dev/null +++ b/templates/de/emails/member/member_surfbar_url_unlock.tpl @@ -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!}) -- 2.39.5