]> git.mxchange.org Git - mailer.git/commitdiff
Rewrites/fixes for surfbar
authorquix0r <quix0r@mxchange.org>
Tue, 29 Jun 2010 13:20:38 +0000 (13:20 +0000)
committerquix0r <quix0r@mxchange.org>
Tue, 29 Jun 2010 13:20:38 +0000 (13:20 +0000)
inc/expression-functions.php
inc/js/js-surfbar_frame_top.php [new file with mode: 0644]
inc/libs/surfbar_functions.php
surfbar.php
templates/de/html/js/js_surfbar_frame_top.tpl [new file with mode: 0644]
templates/de/html/surfbar/surfbar_frame_top.tpl

index 458dd1792c3a244f790bc723f3aca25b71d662a4..bb7a1807a240dd1541cfea378f2b36881db3c1ec 100644 (file)
@@ -175,7 +175,7 @@ function doExpressionPipe ($data) {
        // Do we have a call-back? Should always be there!
        if (!empty($data['callback'])) {
                // Parse it through this function
-               $replacer = '{DQUOTE} . ' . $data['callback'] . "('" . $replacer . "') . {DQUOTE}";
+               $replacer = '{DQUOTE} . ' . $data['extra_func'] . '(' . $data['callback'] . "('" . $replacer . "')) . {DQUOTE}";
        } // END - if
 
        // Replace the config entry
diff --git a/inc/js/js-surfbar_frame_top.php b/inc/js/js-surfbar_frame_top.php
new file mode 100644 (file)
index 0000000..25b3c3a
--- /dev/null
@@ -0,0 +1,68 @@
+<?php
+/************************************************************************
+ * Mailer v0.2.1-FINAL                                Start: 10/20/2009 *
+ * ===================                          Last change: 10/20/2009 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : js-surfbar_stopped.php                           *
+ * -------------------------------------------------------------------- *
+ * Short description : JavaScript tag for ext-surfbar.php               *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : JavaScript-Tag fuer ext-surfbar.php              *
+ * -------------------------------------------------------------------- *
+ * $Revision:: 1910                                                   $ *
+ * $Date:: 2010-06-29 06:00:23 +0200 (Tue, 29 Jun 2010)               $ *
+ * $Tag:: 0.2.1-FINAL                                                 $ *
+ * $Author:: quix0r                                                   $ *
+ * Needs to be in all Files and every File needs "svn propset           *
+ * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2009 by Roland Haeder                           *
+ * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
+ * For more information visit: http://www.mxchange.org                  *
+ *                                                                      *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or    *
+ * (at your option) any later version.                                  *
+ *                                                                      *
+ * This program is distributed in the hope that it will be useful,      *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
+ * GNU General Public License for more details.                         *
+ *                                                                      *
+ * You should have received a copy of the GNU General Public License    *
+ * along with this program; if not, write to the Free Software          *
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
+ * MA  02110-1301  USA                                                  *
+ ************************************************************************/
+
+// Some security stuff...
+if (!defined('__SECURITY')) {
+       die();
+} elseif (!isExtensionActive('surfbar')) {
+       return;
+}
+
+// Init surfbar
+SURFBAR_INIT();
+
+// Init data
+SURFBAR_DETERMINE_NEXT_ID(getRequestParameter('url_id'));
+
+// Check reload-locks
+SURFBAR_CHECK_RELOAD_FULL();
+
+// Update stats
+SURFBAR_UPDATE_SALT_STATS();
+
+// Prepare content
+$content = array(
+       'url_id' => bigintval(getRequestParameter('url_id'))
+);
+
+// Load template
+loadTemplate('js_surfbar_frame_top', false, $content);
+
+// [EOF]
+?>
index 02c9c01cfa3d1c417ab83f8512ee2414c627d16a..fff246464e3198be72592df85b9687939d99d476 100644 (file)
@@ -807,7 +807,7 @@ function SURFBAR_DETERMINE_TEMPLATE_NAME() {
 
 // Check if the "reload lock" of the current user is full, call this function
 // before you call SURFBAR_CHECK_RELOAD_LOCK().
-function SURFBAR_CHECK_RELOAD_FULL() {
+function SURFBAR_CHECK_RELOAD_FULL () {
        // Default is full!
        $isFull = true;
 
@@ -899,6 +899,9 @@ LIMIT 1",
        // Free result
        SQL_FREERESULT($result);
 
+       // Debug message
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'cnt=' . $cnt);
+
        // Return result
        return $cnt;
 }
@@ -1076,6 +1079,9 @@ function SURFBAR_UPDATE_SALT_STATS () {
        // Update statistics record
        SURFBAR_UPDATE_INSERT_STATS_RECORD();
 
+       // Update salt
+       SURFBAR_GENERATE_VALIDATION_CODE(SURFBAR_GET_ID());
+
        // Simply store the salt from cache away in database...
        SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_surfbar_salts` SET `salts_last_salt`='%s' WHERE `salts_url_id`=%s AND `salts_userid`=%s LIMIT 1",
                array(
index d65986193579c31409ff9397d53c0c4cabba1839..63facf329f15a92886fa1e1fabc9bd9c8fb0a6d7 100644 (file)
@@ -194,8 +194,8 @@ if ((SURFBAR_CHECK_RELOAD_FULL()) || ((isGetRequestParameterSet('frame')) && (in
                if ($nextId > 0) {
                        // Then prepare other content
                        $content = array(
-                               'url_id'      => $nextId,
-                               'xxx'         => str_repeat('X', strlen(SURFBAR_GET_RELOAD_TIME($nextId)))
+                               'url_id' => $nextId,
+                               'xxx'    => str_repeat('X', strlen(SURFBAR_GET_RELOAD_TIME($nextId))),
                        );
 
                        // Update salt (double-call lock!) and statistics
@@ -213,7 +213,7 @@ if ((SURFBAR_CHECK_RELOAD_FULL()) || ((isGetRequestParameterSet('frame')) && (in
        loadIncludeOnce('inc/header.php');
 
        // Load that template
-       //* DEBUG: */ die("templateName={$templateName}<br />\n<strong>content</strong>=<pre>".print_r($content, true)."</pre>");
+       //* DEBUG: */ die('templateName=' . $templateName . '<br /><strong>content</strong>=<pre>' . print_r($content, true) . '</pre>');
        loadTemplate($templateName, false, $content);
 }
 
diff --git a/templates/de/html/js/js_surfbar_frame_top.tpl b/templates/de/html/js/js_surfbar_frame_top.tpl
new file mode 100644 (file)
index 0000000..b5cabc4
--- /dev/null
@@ -0,0 +1,78 @@
+var currCounter = "{%pipe,SURFBAR_GET_RELOAD_TIME=$content[url_id]%}";
+var maxCounter  = "{%pipe,SURFBAR_GET_RELOAD_TIME=$content[url_id]%}";
+var counter     = document.getElementById("surfbar_counter");
+var points      = document.getElementById("surfbar_points");
+var reload      = document.getElementById("surfbar_reload");
+var max         = document.getElementById("surfbar_max");
+var countDown   = null;
+
+function startStopCounter () {
+       if (countDown == null) {
+               // Start counter
+               document.getElementById("start").innerHTML = "{--MEMBER_SURFBAR_ACTION_PAUSE_SUBMIT--}";
+               countDown = window.setInterval("startCounter()", 1000);
+       } else {
+               document.getElementById("start").innerHTML = "{--MEMBER_SURFBAR_ACTION_UNPAUSE_SUBMIT--}";
+               window.clearInterval(countDown);
+               countDown = null;
+       }
+       return false;
+}
+
+function init () {
+       countDown = window.setInterval("startCounter()", 1000);
+       window.setTimeout("initCounter()", 500);
+}
+
+function confirm () {
+       if (parent.surfbar_url != null) {
+               // Is in right frameset
+               parent.surfbar_url.location.href = "{%url=surfbar.php?id=$content[url_id]&check={%pipe,SURFBAR_GENERATE_VALIDATION_CODE=$content[url_id]%}&salt={%pipe,SURFBAR_GET_SALT%}%}";
+       } else {
+               // Called frame=top directly
+               window.location.href = "{%url=surfbar.php%}";
+       }
+}
+
+function reloadSurfbar () {
+       if (parent.surfbar_stats != null) {
+               // Is in right frameset
+               parent.surfbar_stats.location.reload();
+       } else {
+               // Called frame=top directly
+               window.location.href = "{%url=surfbar.php%}";
+       }
+       this.location.reload();
+}
+
+function initCounter () {
+       if (parent.surfbar_url != null) {
+               // Is in right frameset
+               parent.surfbar_url.location.href = '{%pipe,SURFBAR_GET_URL=$content[url_id]%}';
+       } else {
+               // Called frame=top directly
+               window.location.href = "{%url=surfbar.php%}";
+       }
+
+       counter.innerHTML = "{%pipe,SURFBAR_GET_RELOAD_TIME=$content[url_id]%}";
+       points.innerHTML  = "{%pipe,SURFBAR_GET_REWARD,translateComma=$content[url_id]%}";
+       reload.innerHTML  = "{%pipe,SURFBAR_GET_USER_LOCKS%}";
+       max.innerHTML     = "{%pipe,SURFBAR_GET_TOTAL_URLS%}";
+}
+
+function startCounter () {
+       if (currCounter < 1) {
+               return false;
+       }
+
+       currCounter--;
+       counter.innerHTML = currCounter;
+
+       if (currCounter == 0) {
+               clearInterval(countDown);
+               confirm();
+               window.setTimeout("reloadSurfbar()", 500);
+       }
+}
+
+init();
index 6574dedf7fc41b79ff97819bc1a2b5677869d927..f73f4fa6e92abe65d50d24cccc9921f579a41239 100644 (file)
@@ -3,8 +3,8 @@
 <tr>
        <td id="surfbar_td">
                <div>
-               &raquo;<span id="surfbar_points">$content[xxx]=$content[xxx] {?POINTS?}</span> in
-               <span class="surfbar_counter">$content[xxx]</span>
+               &raquo;<span id="surfbar_points">$content[xxx]</span> {?POINTS?} in
+               <span id="surfbar_counter" class="surfbar_counter">$content[xxx]</span>
                <span id="surfbar_counter_word">Sekunden</span>&laquo;
                &raquo;<span id="surfbar_reload">X</span> von
                <span id="surfbar_max">X</span> im Reload&laquo;
@@ -14,7 +14,7 @@
                &raquo;<a href="{%pipe,SURFBAR_GET_URL=$content[url_id]%}" target="_blank">Aktuelle Seite in neuem
                Fenster &ouml;ffnen</a>&laquo;
                <span id="surfbar_navi">[<a href="#" onclick="return startStopCounter();"
-                id="start">Anhalten</a>|<a target="_parent"
+                id="start">{--MEMBER_SURFBAR_ACTION_PAUSE_SUBMIT--}</a>|<a target="_parent"
                 href="{%url=login.php%}">Loginbereich</a>|<a target="_parent"
                 href="{%url=modules.php?module=login&amp;what=logout%}">Ausloggen</a>|<a
                 href="javascript:window.close()">Schliessen</a>]</span>
 </tr>
 </table>
 </div>
-<script type="text/javascript">
-<!--
-// @TODO Try to rewrite this JavaScript to js.php?js=surfbar_frame_top (wouldn't be easy)
-var currCounter = "$content[reload]";
-var maxCounter = "$content[reload]";
-var counter = document.getElementById("surfbar_counter");
-var points = document.getElementById("surfbar_points");
-var reload = document.getElementById("surfbar_reload");
-var max = document.getElementById("surfbar_max");
-var countDown = null;
 
-function startStopCounter () {
-       if (countDown == null) {
-               // Start counter
-               document.getElementById("start").innerHTML = "Anhalten";
-               countDown = window.setInterval("startCounter()", 1000);
-       } else {
-               document.getElementById("start").innerHTML = "Weiter";
-               window.clearInterval(countDown);
-               countDown = null;
-       }
-       return false;
-}
-
-function init () {
-       countDown = window.setInterval("startCounter()", 1000);
-       window.setTimeout("initCounter()", 500);
-}
-
-function confirm () {
-       parent.surfbar_url.location="{%url=surfbar.php?id=$content[url_id]&check={%pipe,SURFBAR_GENERATE_VALIDATION_CODE=$content[url_id]%}&salt={%pipe,SURFBAR_GET_SALT%}%}";
-}
-
-function reloadSurfbar () {
-       parent.surfbar_stats.location.reload();
-       this.location.reload();
-}
-
-function initCounter () {
-       parent.surfbar_url.location.href = '{%pipe,SURFBAR_GET_URL=$content[url_id]%}';
-       counter.innerHTML = '{%pipe,SURFBAR_GET_RELOAD_TIME=$content[url_id]%}';
-       points.innerHTML  = '{%pipe,SURFBAR_GET_REWARD,translateComma=$content[url_id]%}';
-       reload.innerHTML  = '{%pipe,SURFBAR_GET_USER_LOCKS%}';
-       max.innerHTML     = '{%pipe,SURFBAR_GET_TOTAL_URLS%}';
-}
-
-function startCounter () {
-       if (currCounter < 1) {
-               return false;
-       }
-
-       currCounter--;
-       counter.innerHTML = currCounter;
-
-       if (currCounter == 0) {
-               clearInterval(countDown);
-               confirm();
-               window.setTimeout("reloadSurfbar()", 500);
-       }
-}
-
-init();
-
-//-->
-</script>
+<script type="text/javascript"
+ src="{%url=js.php?js=surfbar_frame_top&amp;url_id=$content[url_id]%}"></script>