From 105acbe19037f756a0902e990836133bcd993d13 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 6 Sep 2008 16:52:48 +0000 Subject: [PATCH] Surfbar fixed, more fixes in core, templates fixed --- .gitattributes | 1 + inc/extensions/ext-surfbar.php | 15 +- inc/libs/surfbar_functions.php | 170 ++++++++++++------ modules.php | 23 +-- surfbar.php | 39 ++-- .../de/html/surfbar/surfbar_frame_start.tpl | 31 ++++ .../de/html/surfbar/surfbar_frame_top.tpl | 6 +- .../de/html/surfbar/surfbar_frameset.tpl | 2 +- 8 files changed, 199 insertions(+), 88 deletions(-) create mode 100644 templates/de/html/surfbar/surfbar_frame_start.tpl diff --git a/.gitattributes b/.gitattributes index 07bdc740c2..fc15bfe11a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1290,6 +1290,7 @@ templates/de/html/sponsor/sponsor_welcome.tpl -text templates/de/html/sponsor/sponsor_what.tpl -text templates/de/html/surfbar/.htaccess -text templates/de/html/surfbar/surfbar_frame_banner.tpl -text +templates/de/html/surfbar/surfbar_frame_start.tpl -text templates/de/html/surfbar/surfbar_frame_top.tpl -text templates/de/html/surfbar/surfbar_frameset.tpl -text templates/de/html/surfbar/surfbar_stopped.tpl -text diff --git a/inc/extensions/ext-surfbar.php b/inc/extensions/ext-surfbar.php index 29ebfff5ef..f990cb8173 100644 --- a/inc/extensions/ext-surfbar.php +++ b/inc/extensions/ext-surfbar.php @@ -77,9 +77,21 @@ UNIQUE KEY `userid_url` (`userid`, `url`) `last_surfed` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY(`id`), INDEX (`userid`), -INDEX (`url_id`), +INDEX (`url_id`) ) TYPE=MyISAM COMMENT='Surfbar reload locks'"; + // Surfbar salts + $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_salts`"; + $SQLs[] = "CREATE TABLE `"._MYSQL_PREFIX."_surfbar_salts` ( +`id` BIGINT(20) NOT NULL AUTO_INCREMENT, +`userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0', +`url_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0', +`last_salt` VARCHAR(255) NOT NULL DEFAULT '', +PRIMARY KEY(`id`), +INDEX (`userid`), +INDEX (`url_id`) +) TYPE=MyISAM COMMENT='Surfbar last used salts'"; + // Reload locks $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_reflevels`"; $SQLs[] = "CREATE TABLE `"._MYSQL_PREFIX."_surfbar_reflevels` ( @@ -123,6 +135,7 @@ case "remove": // Do stuff when removing extension $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_urls`"; $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_locks`"; $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_reflevels`"; + $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_salts`"; $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_member_menu` WHERE `action`='surfbar' LIMIT 3"; $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE action='surfbar' LIMIT 5"; break; diff --git a/inc/libs/surfbar_functions.php b/inc/libs/surfbar_functions.php index b4364a6a49..58def20ec5 100644 --- a/inc/libs/surfbar_functions.php +++ b/inc/libs/surfbar_functions.php @@ -222,9 +222,10 @@ function SURFBAR_DETERMINE_TEMPLATE_NAME() { // Return result return $templateName; } -// Check if the "reload lock" of the current user is full +// 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() { - global $SURFBAR_DATA, $_CONFIG; + global $SURFBAR_CACHE, $_CONFIG; // Default is full! $isFull = true; @@ -232,7 +233,7 @@ function SURFBAR_CHECK_RELOAD_FULL() { // Do we have static or dynamic mode? if ($_CONFIG['surfbar_pay_model'] == "STATIC") { // Cache static reload lock - $SURFBAR_DATA['surf_lock'] = $_CONFIG['surfbar_static_lock']; + $SURFBAR_CACHE['surf_lock'] = $_CONFIG['surfbar_static_lock']; // Ask the database $result = SQL_QUERY_ESC("SELECT COUNT(id) AS cnt FROM "._MYSQL_PREFIX."_surfbar_locks @@ -242,12 +243,12 @@ LIMIT 1", ); // Fetch row - list($SURFBAR_DATA['user_locks']) = SQL_FETCHROW($result); + list($SURFBAR_CACHE['user_locks']) = SQL_FETCHROW($result); // Is it null? - if (is_null($SURFBAR_DATA['user_locks'])) { + if (is_null($SURFBAR_CACHE['user_locks'])) { // Then fix it to zero! - $SURFBAR_DATA['user_locks'] = 0; + $SURFBAR_CACHE['user_locks'] = 0; } // END - if // Free result @@ -257,7 +258,8 @@ LIMIT 1", $total = SURFBAR_GET_TOTAL_URLS(); // Do we have some URLs in lock? Admins can always surf on own URLs! - $isFull = (($SURFBAR_DATA['user_locks'] == $total) && ($total > 0)); + //* DEBUG: */ echo __FUNCTION__.":userLocks=".SURFBAR_GET_DATA('user_locks').",total={$total}
\n"; + $isFull = ((SURFBAR_GET_DATA('user_locks') == $total) && ($total > 0)); } else { // Dynamic model... die("DYNAMIC not yet implemented!"); @@ -286,7 +288,7 @@ WHERE userid != %d AND status='%s'", } // Generate a validation code for the given id number function SURFBAR_GENERATE_VALIDATION_CODE ($id, $salt="") { - global $_CONFIG, $SURFBAR_DATA; + global $_CONFIG, $SURFBAR_CACHE; // Generate a code until the length matches $valCode = ""; @@ -294,27 +296,27 @@ function SURFBAR_GENERATE_VALIDATION_CODE ($id, $salt="") { // Is the salt set? if (empty($salt)) { // Generate random hashed string - $SURFBAR_DATA['salt'] = sha1(GEN_PASS(255)); + $SURFBAR_CACHE['salt'] = sha1(GEN_PASS(255)); } else { // Use this as salt! - $SURFBAR_DATA['salt'] = $salt; + $SURFBAR_CACHE['salt'] = $salt; } - //* DEBUG: */ echo "*".$SURFBAR_DATA['salt']."*
\n"; + //* DEBUG: */ echo __FUNCTION__.":".SURFBAR_GET_SALT()."*
\n"; // ... and now the validation code - $valCode = GEN_RANDOM_CODE($_CONFIG['code_length'], sha1(SURFBAR_GET_DATA('salt').":".$id), $GLOBALS['userid']); - //* DEBUG: */ echo "valCode={$valCode}
\n"; + $valCode = GEN_RANDOM_CODE($_CONFIG['code_length'], sha1(SURFBAR_GET_SALT().":".$id), $GLOBALS['userid']); + //* DEBUG: */ echo __FUNCTION__.":valCode={$valCode}
\n"; } // END - while // Hash it with md5() and salt it with the random string - $hashedCode = generateHash(md5($valCode), SURFBAR_GET_DATA('salt')); + $hashedCode = generateHash(md5($valCode), SURFBAR_GET_SALT()); // Finally encrypt it PGP-like and return it return generatePassString($hashedCode); } // Check validation code function SURFBAR_CHECK_VALIDATION_CODE ($id, $check, $salt) { - global $SURFBAR_DATA; + global $SURFBAR_CACHE; // Secure id number $id = bigintval($id); @@ -323,19 +325,25 @@ function SURFBAR_CHECK_VALIDATION_CODE ($id, $check, $salt) { $code = SURFBAR_GENERATE_VALIDATION_CODE($id, $salt); // Return result of checking hashes and salts - //* DEBUG: */ echo "--- ".$code."
\n--- ".$check."
\n"; - //* DEBUG: */ echo "+++ ".$salt."
\n+++ ".SURFBAR_GET_DATA('last_salt')."
\n"; + //* DEBUG: */ echo __FUNCTION__.":---".$code."---
\n---".$check."---
\n"; + //* DEBUG: */ echo __FUNCTION__.":+++".$salt."+++
\n+++".SURFBAR_GET_DATA('last_salt')."+++
\n"; return (($code == $check) && ($salt == SURFBAR_GET_DATA('last_salt'))); } // Lockdown the userid/id combination (reload lock) function SURFBAR_LOCKDOWN_ID ($id) { + //* DEBUG: */ print "LOCK!
\n"; + //* DEBUG: */ return; // Just add it to the database SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_surfbar_locks (userid, url_id) VALUES(%s, %s)", array($GLOBALS['userid'], bigintval($id)), __FILE__, __LINE__); + + // Remove the salt from database + SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_surfbar_salts WHERE url_id=%s AND userid=%s LIMIT 1", + array(bigintval($id), $GLOBALS['userid']), __FILE__, __LINE__); } // Pay points to the user and remove it from the sender function SURFBAR_PAY_POINTS ($id) { - global $SURFBAR_DATA, $_CONFIG; + global $SURFBAR_CACHE, $_CONFIG; // Re-configure ref-system to surfbar levels $_CONFIG['db_percents'] = "percent"; @@ -345,54 +353,92 @@ function SURFBAR_PAY_POINTS ($id) { ADD_POINTS_REFSYSTEM($GLOBALS['userid'], SURFBAR_GET_DATA('reward')); // Remove it from the URL owner - SUB_POINTS($SURFBAR_DATA['userid'], SURFBAR_GET_DATA('costs')); + SUB_POINTS($SURFBAR_CACHE['userid'], SURFBAR_GET_DATA('costs')); } // Update the salt for validation function SURFBAR_UPDATE_SALT() { - global $SURFBAR_DATA; + // Update views_total + SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_surfbar_urls SET views_total=views_total+1 WHERE id=%s LIMIT 1", + array(SURFBAR_GET_ID()), __FILE__, __LINE__); // Simply store the salt from cache away in database... - SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_surfbar_urls SET last_salt='%s', views_total=views_total+1 WHERE id=%s LIMIT 1", - array(SURFBAR_GET_DATA('salt'), SURFBAR_GET_DATA('id')), __FILE__, __LINE__); + SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_surfbar_salts SET last_salt='%s' WHERE url_id=%s AND userid=%s LIMIT 1", + array(SURFBAR_GET_SALT(), SURFBAR_GET_ID(), $GLOBALS['userid']), __FILE__, __LINE__); + + // Was that okay? + if (SQL_AFFECTEDROWS() == 0) { + // Insert missing entry! + SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_surfbar_salts (url_id,userid,last_salt) VALUES(%s, %s, '%s')", + array(SURFBAR_GET_ID(), $GLOBALS['userid'], SURFBAR_GET_SALT()), __FILE__, __LINE__); + } // END - if // Return if the update was okay return (SQL_AFFECTEDROWS() == 1); } +// Check if the reload lock is active for given id +function SURFBAR_CHECK_RELOAD_LOCK ($id) { + //* DEBUG: */ echo __FUNCTION__.":id={$id}
\n"; + // Ask the database + $result = SQL_QUERY_ESC("SELECT COUNT(id) AS cnt +FROM "._MYSQL_PREFIX."_surfbar_locks +WHERE userid=%s AND url_id=%s AND (UNIX_TIMESTAMP() - ".SURFBAR_GET_DATA('surf_lock').") >= UNIX_TIMESTAMP(last_surfed) +LIMIT 1", + array($GLOBALS['userid'], bigintval($id)), __FILE__, __LINE__ + ); + + // Fetch counter + list($cnt) = SQL_FETCHROW($result); + + // Free result + SQL_FREERESULT($result); + + // Return check + //* DEBUG: */ echo __FUNCTION__.":cnt={$cnt}
\n"; + return ($cnt == 0); +} // Determine next id for surfbar view, always call this before you call other // getters below this function!!! function SURFBAR_GET_NEXT_ID ($id = 0) { - global $SURFBAR_DATA, $_CONFIG; + global $SURFBAR_CACHE, $_CONFIG; // Default is no id! - $nextId = 0; + $nextId = 0; $randNum = 0; // Is the ID set? if ($id == 0) { // Set max random factor to total URLs minus 1 $maxRand = SURFBAR_GET_TOTAL_URLS() - 1; - // Generate random number - $randNum = mt_rand(0, $maxRand); + // If more than one URL can be called generate the random number! + if ($maxRand > 1) { + // Generate random number + $randNum = mt_rand(0, $maxRand); + } // END - if // And query the database - $result = SQL_QUERY_ESC("SELECT sb.id, sb.userid, sb.url, sb.last_salt, sb.reward, sb.costs, sb.views_total, p.time, UNIX_TIMESTAMP(l.last_surfed) AS last_surfed -FROM "._MYSQL_PREFIX."_surfbar_urls AS sb + //* DEBUG: */ echo __FUNCTION__.":randNum={$randNum},maxRand={$maxRand}
\n"; + $result = SQL_QUERY_ESC("SELECT sbu.id, sbu.userid, sbu.url, sbs.last_salt, sbu.reward, sbu.costs, sbu.views_total, p.time, UNIX_TIMESTAMP(l.last_surfed) AS last_surfed +FROM "._MYSQL_PREFIX."_surfbar_urls AS sbu LEFT JOIN "._MYSQL_PREFIX."_payments AS p -ON sb.payment_id=p.id +ON sbu.payment_id=p.id +LEFT JOIN "._MYSQL_PREFIX."_surfbar_salts AS sbs +ON sbu.id=sbs.url_id LEFT JOIN "._MYSQL_PREFIX."_surfbar_locks AS l -ON sb.id=l.url_id -WHERE sb.userid != %d AND sb.status='CONFIRMED' AND (l.last_surfed IS NULL OR (UNIX_TIMESTAMP() - ".SURFBAR_GET_DATA('surf_lock').") >= UNIX_TIMESTAMP(l.last_surfed)) -ORDER BY l.last_surfed DESC, sb.last_salt ASC, sb.id ASC +ON sbu.id=l.url_id +WHERE sbu.userid != %d AND sbu.status='CONFIRMED' AND (l.last_surfed IS NULL OR (UNIX_TIMESTAMP() - ".SURFBAR_GET_DATA('surf_lock').") >= UNIX_TIMESTAMP(l.last_surfed)) +ORDER BY l.last_surfed DESC, sbs.last_salt ASC, sbu.id ASC LIMIT %d,1", array($GLOBALS['userid'], $randNum), __FILE__, __LINE__ ); } else { // Get data from specified id number - $result = SQL_QUERY_ESC("SELECT sb.id, sb.userid, sb.url, sb.last_salt, sb.reward, sb.costs, sb.views_total, p.time -FROM "._MYSQL_PREFIX."_surfbar_urls AS sb + $result = SQL_QUERY_ESC("SELECT sbu.id, sbu.userid, sbu.url, sbs.last_salt, sbu.reward, sbu.costs, sbu.views_total, p.time +FROM "._MYSQL_PREFIX."_surfbar_urls AS sbu LEFT JOIN "._MYSQL_PREFIX."_payments AS p -ON sb.payment_id=p.id -WHERE sb.userid != %s AND sb.status='CONFIRMED' AND sb.id=%s +ON sbu.payment_id=p.id +LEFT JOIN "._MYSQL_PREFIX."_surfbar_salts AS sbs +ON sbu.id=sbs.url_id +WHERE sbu.userid != %s AND sbu.status='CONFIRMED' AND sbu.id=%s LIMIT 1", array($GLOBALS['userid'], bigintval($id)), __FILE__, __LINE__ ); @@ -401,62 +447,68 @@ LIMIT 1", // Is there an id number? if (SQL_NUMROWS($result) == 1) { // Load/cache data - //* DEBUG: */ echo "*".count($SURFBAR_DATA)."*
\n"; - $SURFBAR_DATA = merge_array($SURFBAR_DATA, SQL_FETCHARRAY($result)); - //* DEBUG: */ echo "*".count($SURFBAR_DATA)."*
\n"; + //* DEBUG: */ echo __FUNCTION__.":".count($SURFBAR_CACHE)."*
\n"; + $SURFBAR_CACHE = merge_array($SURFBAR_CACHE, SQL_FETCHARRAY($result)); + //* DEBUG: */ echo __FUNCTION__.":".count($SURFBAR_CACHE)."*
\n"; // Is the time there? - if (is_null($SURFBAR_DATA['time'])) { + if (is_null($SURFBAR_CACHE['time'])) { + // Then repair it wit the static! + $SURFBAR_CACHE['time'] = $_CONFIG['surfbar_static_time']; + } // END - if + + // Is the last salt there? + if (is_null($SURFBAR_CACHE['last_salt'])) { // Then repair it wit the static! - $SURFBAR_DATA['time'] = $_CONFIG['surfbar_static_time']; + $SURFBAR_CACHE['last_salt'] = ""; } // END - if // Fix missing last_surfed - if ((!isset($SURFBAR_DATA['last_surfed'])) || (is_null($SURFBAR_DATA['last_surfed']))) { + if ((!isset($SURFBAR_CACHE['last_surfed'])) || (is_null($SURFBAR_CACHE['last_surfed']))) { // Fix it here - $SURFBAR_DATA['last_surfed'] = "0"; + $SURFBAR_CACHE['last_surfed'] = "0"; } // END - if // Are we in static mode? if ($_CONFIG['surfbar_pay_model'] == "STATIC") { // Then use static reward/costs! - $SURFBAR_DATA['reward'] = $_CONFIG['surfbar_static_reward']; - $SURFBAR_DATA['costs'] = $_CONFIG['surfbar_static_costs']; + $SURFBAR_CACHE['reward'] = $_CONFIG['surfbar_static_reward']; + $SURFBAR_CACHE['costs'] = $_CONFIG['surfbar_static_costs']; } else { // Calculate dynamic reward/costs and add it - $SURFBAR_DATA['reward'] += SURFBAR_CALCULATE_DYNAMIC_REWARD_ADD(); - $SURFBAR_DATA['costs'] += SURFBAR_CALCULATE_DYNAMIC_COSTS_ADD(); + $SURFBAR_CACHE['reward'] += SURFBAR_CALCULATE_DYNAMIC_REWARD_ADD(); + $SURFBAR_CACHE['costs'] += SURFBAR_CALCULATE_DYNAMIC_COSTS_ADD(); } // Now get the id - $nextId = SURFBAR_GET_DATA('id'); + $nextId = SURFBAR_GET_ID(); } // END - if // Free result SQL_FREERESULT($result); // Return result - //* DEBUG: */ echo "nextId={$nextId}
\n"; + //* DEBUG: */ echo __FUNCTION__.":nextId={$nextId}
\n"; return $nextId; } // ---------------------------------------------------------------------------- // PLEASE DO NOT ADD ANY OTHER FUNCTIONS BELOW THIS LINE ELSE THEY "WRAP" THE -// $SURFBAR_DATA ARRAY! +// $SURFBAR_CACHE ARRAY! // ---------------------------------------------------------------------------- // Private getter for data elements function SURFBAR_GET_DATA ($element) { - global $SURFBAR_DATA; + global $SURFBAR_CACHE; // Default is null $data = null; // Is the entry there? - if (isset($SURFBAR_DATA[$element])) { + if (isset($SURFBAR_CACHE[$element])) { // Then take it - $data = $SURFBAR_DATA[$element]; + $data = $SURFBAR_CACHE[$element]; } else { // END - if print("
");
-		print_r($SURFBAR_DATA);
+		print_r($SURFBAR_CACHE);
 		debug_print_backtrace();
 		die("
"); } @@ -479,6 +531,16 @@ function SURFBAR_GET_URL () { // Get data element and return its contents return SURFBAR_GET_DATA('url'); } +// Getter for salt from cache +function SURFBAR_GET_SALT () { + // Get data element and return its contents + return SURFBAR_GET_DATA('salt'); +} +// Getter for id from cache +function SURFBAR_GET_ID () { + // Get data element and return its contents + return SURFBAR_GET_DATA('id'); +} // Getter for user reload locks function SURFBAR_GET_USER_RELOAD_LOCK () { // Get data element and return its contents diff --git a/modules.php b/modules.php index 53a8e0ff41..5850e44172 100644 --- a/modules.php +++ b/modules.php @@ -86,13 +86,10 @@ include (PATH."inc/header.php"); // Modules are by default not valid! $MOD_VALID = false; $check = "failed"; -if ((!empty($_CONFIG['maintenance'])) && ($_CONFIG['maintenance'] == "Y") && (!IS_ADMIN()) && ($GLOBALS['module'] != "admin")) -{ +if ((!empty($_CONFIG['maintenance'])) && ($_CONFIG['maintenance'] == "Y") && (!IS_ADMIN()) && ($GLOBALS['module'] != "admin")) { // Maintain mode is active and you are no admin ADD_FATAL(LANG_DOWN_MAINTAINCE); -} - elseif (($link) && ($db) && (sizeof($FATAL) == 0)) -{ +} elseif (($link) && ($db) && (sizeof($FATAL) == 0)) { // Did we found the module listed in allowed modules and are we successfully connected? $check = CHECK_MODULE($GLOBALS['module']); switch ($check) @@ -104,18 +101,13 @@ if ((!empty($_CONFIG['maintenance'])) && ($_CONFIG['maintenance'] == "Y") && (!I define('__MODULE', sprintf("%sinc/modules/%s.php", PATH, $GLOBALS['module'])); // Does the module exists on local file system? - if (((file_exists(__MODULE)) || (!empty($URL))) && (sizeof($FATAL) == 0)) - { + if (((file_exists(__MODULE)) && (is_readable(__MODULE))) && (sizeof($FATAL) == 0)) { // Module is valid, active and located on the local disc... $MOD_VALID = true; - } - elseif (!empty($URL)) - { + } elseif (!empty($URL)) { // An URL was specified so we load the de-referrer module - include (PATH."inc/loader.php"); - } - elseif (sizeof($FATAL) == 0) - { + LOAD_URL(DEREFERER($URL)); + } elseif (sizeof($FATAL) == 0) { ADD_FATAL(LANG_MOD_REG_404_1.$GLOBALS['module'].LANG_MOD_REG_404_2); } break; @@ -144,8 +136,7 @@ if ((!empty($_CONFIG['maintenance'])) && ($_CONFIG['maintenance'] == "Y") && (!I ADD_FATAL(MYSQL_ERRORS); } -if ($MOD_VALID) -{ +if ($MOD_VALID) { ///////////////////////////////////////////// // Main including line DO NOT REMOVE/EDIT! // ///////////////////////////////////////////// diff --git a/surfbar.php b/surfbar.php index 3bfe655279..d2f943308d 100644 --- a/surfbar.php +++ b/surfbar.php @@ -35,8 +35,8 @@ require_once("inc/libs/security_functions.php"); // Init "action" and "what" -global $what, $action, $startTime, $SURFBAR_DATA; -$SURFBAR_DATA = array(); +global $what, $action, $startTime, $SURFBAR_CACHE; +$SURFBAR_CACHE = array(); $GLOBALS['startTime'] = microtime(true); $GLOBALS['what'] = ""; $GLOBALS['action'] = ""; @@ -58,28 +58,37 @@ if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_install } // END - if // Is there a check value? - if ((isset($_GET['check'])) && (isset($_GET['id'])) && (isset($_GET['salt']))) { + if (SURFBAR_CHECK_RELOAD_FULL()) { + // Reload-lock is full, surfbar stopped so... + // Load header + require_once(PATH."inc/header.php"); + + // Load template + LOAD_TEMPLATE("surfbar_stopped"); + } elseif ((isset($_GET['check'])) && (isset($_GET['id'])) && (isset($_GET['salt']))) { // Dummy next id get SURFBAR_GET_NEXT_ID($_GET['id']); - // Check validation code - if (SURFBAR_CHECK_VALIDATION_CODE($_GET['id'], $_GET['check'], $_GET['salt'])) { + // Check reload lock and validation code + if ((SURFBAR_CHECK_RELOAD_LOCK($_GET['id'])) && (SURFBAR_CHECK_VALIDATION_CODE($_GET['id'], $_GET['check'], $_GET['salt']))) { // Lock the URL (id) down SURFBAR_LOCKDOWN_ID($_GET['id']); // Code is valid so pay points here SURFBAR_PAY_POINTS($_GET['id']); - } // END - if - // Set footer (fixes notice) - $footer = 1; - } elseif (SURFBAR_CHECK_RELOAD_FULL()) { - // Reload-lock is full, surfbar stopped so... - // Load header - require_once(PATH."inc/header.php"); + // Check if reload is full + if (SURFBAR_CHECK_RELOAD_FULL()) { + // Then load waiting page + LOAD_URL("surfbar.php?frame=start"); + } // END - if + } else { + // Reload to start frame! + LOAD_URL("surfbar.php?frame=start"); + } - // Load template - LOAD_TEMPLATE("surfbar_stopped"); + // All done, so fix notice for footer.php + $footer = 1; } else { // Prepare content $content = ""; @@ -98,7 +107,7 @@ if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_install $content = array( 'id' => $nextId, 'check' => SURFBAR_GENERATE_VALIDATION_CODE($nextId), - 'salt' => $SURFBAR_DATA['salt'], + 'salt' => SURFBAR_GET_SALT(), 'reward' => TRANSLATE_COMMA(SURFBAR_GET_REWARD($nextId)), 'url' => SURFBAR_GET_URL($nextId), 'curr_reload' => SURFBAR_GET_USER_RELOAD_LOCK(), diff --git a/templates/de/html/surfbar/surfbar_frame_start.tpl b/templates/de/html/surfbar/surfbar_frame_start.tpl new file mode 100644 index 0000000000..b89381826f --- /dev/null +++ b/templates/de/html/surfbar/surfbar_frame_start.tpl @@ -0,0 +1,31 @@ +
+
+
+ {!POINTS!}-Surfbar von {!MAIN_TITLE!} +
+ +
+ Sie haben die Surfbar von {!MAIN_TITLE!} aufgerufen. Sehen Sie diesen + Text, ist vielleicht kein JavaScript in Ihrem Browser aktiviert oder + die Surfbar ist angehalten. Bitte versuchen Sie in ein paar Minuten + den Neustart und schalten Sie JavaScript ein. +
+
+ +
+
+ Tipp von uns: +
+ +
+ Laden Sie sich den kostenlosen [Firefox-Browser] herunter und dazu die ebenfalls + kostenlose Erweiterung [NoScript!] Dort können Sie JavaScript z.B. + generell verbieten und nur für geziehlte Seiten - z.b. diese - + freigeben! Zudem haben Sie besseren Schutz gegen XSS-Attacken + [Cross-Site-Scripting] und vieles mehr. +
+
+
diff --git a/templates/de/html/surfbar/surfbar_frame_top.tpl b/templates/de/html/surfbar/surfbar_frame_top.tpl index 8038a14cad..e85e744638 100644 --- a/templates/de/html/surfbar/surfbar_frame_top.tpl +++ b/templates/de/html/surfbar/surfbar_frame_top.tpl @@ -32,6 +32,10 @@ function Confirm() { parent.surfbar_url.location="{!URL!}/surfbar.php?id=$content[id]&check=$content[check]&salt=$content[salt]"; } +function ReloadThis() { + this.location.reload(); +} + function StartCounter() { if (currCounter < 1) { return false; @@ -43,7 +47,7 @@ function StartCounter() { if (currCounter == 0) { clearInterval(countDown); Confirm(); - this.location.reload(); + window.setTimeout("ReloadThis()", 500); } } diff --git a/templates/de/html/surfbar/surfbar_frameset.tpl b/templates/de/html/surfbar/surfbar_frameset.tpl index 8ab7566cf1..a8abfa1bbe 100644 --- a/templates/de/html/surfbar/surfbar_frameset.tpl +++ b/templates/de/html/surfbar/surfbar_frameset.tpl @@ -10,7 +10,7 @@ if (top.frames.length > 0) { - + Ihr Browser unterst&uuml;tzt keine Frames! -- 2.39.5