]> git.mxchange.org Git - mailer.git/commitdiff
Surfbar fixed, more fixes in core, templates fixed
authorRoland Häder <roland@mxchange.org>
Sat, 6 Sep 2008 16:52:48 +0000 (16:52 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 6 Sep 2008 16:52:48 +0000 (16:52 +0000)
.gitattributes
inc/extensions/ext-surfbar.php
inc/libs/surfbar_functions.php
modules.php
surfbar.php
templates/de/html/surfbar/surfbar_frame_start.tpl [new file with mode: 0644]
templates/de/html/surfbar/surfbar_frame_top.tpl
templates/de/html/surfbar/surfbar_frameset.tpl

index 07bdc740c28cb23f69822a50329fd540986ab15f..fc15bfe11ab2df57465ca230a2caf7a6da161471 100644 (file)
@@ -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/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
 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
index 29ebfff5efde624b8cefeb72998ce07863ba6695..f990cb8173f85d555bddfbdddf84eaee17d2e731 100644 (file)
@@ -77,9 +77,21 @@ UNIQUE KEY `userid_url` (`userid`, `url`)
 `last_surfed` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
 PRIMARY KEY(`id`),
 INDEX (`userid`),
 `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'";
 
 ) 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` (
        // 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_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;
        $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;
index b4364a6a49675a517a35558cf8c4bb57573cdea4..58def20ec59c91c1fab5e2658712cf578fa336c1 100644 (file)
@@ -222,9 +222,10 @@ function SURFBAR_DETERMINE_TEMPLATE_NAME() {
        // Return result
        return $templateName;
 }
        // 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() {
 function SURFBAR_CHECK_RELOAD_FULL() {
-       global $SURFBAR_DATA, $_CONFIG;
+       global $SURFBAR_CACHE, $_CONFIG;
 
        // Default is full!
        $isFull = true;
 
        // 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
        // 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
 
                // 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
                );
 
                // Fetch row
-               list($SURFBAR_DATA['user_locks']) = SQL_FETCHROW($result);
+               list($SURFBAR_CACHE['user_locks']) = SQL_FETCHROW($result);
 
                // Is it null?
 
                // Is it null?
-               if (is_null($SURFBAR_DATA['user_locks'])) {
+               if (is_null($SURFBAR_CACHE['user_locks'])) {
                        // Then fix it to zero!
                        // Then fix it to zero!
-                       $SURFBAR_DATA['user_locks'] = 0;
+                       $SURFBAR_CACHE['user_locks'] = 0;
                } // END - if
 
                // Free result
                } // 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!
                $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}<br />\n";
+               $isFull = ((SURFBAR_GET_DATA('user_locks') == $total) && ($total > 0));
        } else {
                // Dynamic model...
                die("DYNAMIC not yet implemented!");
        } 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="") {
 }
 // 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 = "";
 
        // 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
                // 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!
                } else {
                        // Use this as salt!
-                       $SURFBAR_DATA['salt'] = $salt;
+                       $SURFBAR_CACHE['salt'] = $salt;
                }
                }
-               //* DEBUG: */ echo "*".$SURFBAR_DATA['salt']."*<br />\n";
+               //* DEBUG: */ echo __FUNCTION__.":".SURFBAR_GET_SALT()."*<br />\n";
 
                // ... and now the validation code
 
                // ... and now the validation code
-               $valCode = GEN_RANDOM_CODE($_CONFIG['code_length'], sha1(SURFBAR_GET_DATA('salt').":".$id), $GLOBALS['userid']);
-               //* DEBUG: */ echo "valCode={$valCode}<br />\n";
+               $valCode = GEN_RANDOM_CODE($_CONFIG['code_length'], sha1(SURFBAR_GET_SALT().":".$id), $GLOBALS['userid']);
+               //* DEBUG: */ echo __FUNCTION__.":valCode={$valCode}<br />\n";
        } // END - while
 
        // Hash it with md5() and salt it with the random string
        } // 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) {
 
        // 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);
 
        // 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
        $code = SURFBAR_GENERATE_VALIDATION_CODE($id, $salt);
 
        // Return result of checking hashes and salts
-       //* DEBUG: */ echo "--- ".$code."<br />\n--- ".$check."<br />\n";
-       //* DEBUG: */ echo "+++ ".$salt."<br />\n+++ ".SURFBAR_GET_DATA('last_salt')."<br />\n";
+       //* DEBUG: */ echo __FUNCTION__.":---".$code."---<br />\n---".$check."---<br />\n";
+       //* DEBUG: */ echo __FUNCTION__.":+++".$salt."+++<br />\n+++".SURFBAR_GET_DATA('last_salt')."+++<br />\n";
        return (($code == $check) && ($salt == SURFBAR_GET_DATA('last_salt')));
 }
 // Lockdown the userid/id combination (reload lock)
 function SURFBAR_LOCKDOWN_ID ($id) {
        return (($code == $check) && ($salt == SURFBAR_GET_DATA('last_salt')));
 }
 // Lockdown the userid/id combination (reload lock)
 function SURFBAR_LOCKDOWN_ID ($id) {
+       //* DEBUG: */ print "LOCK!<br />\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__);
        // 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) {
 }
 // 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";
 
        // 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
        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() {
 }
 // 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...
 
        // 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);
 }
 
        // 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}<br />\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}<br />\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) {
 // 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!
 
        // 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;
 
 
        // 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
 
                // 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}<br />\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
 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
 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
 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
 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__
                );
 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
        // Is there an id number?
        if (SQL_NUMROWS($result) == 1) {
                // Load/cache data
-               //* DEBUG: */ echo "*".count($SURFBAR_DATA)."*<br />\n";
-               $SURFBAR_DATA = merge_array($SURFBAR_DATA, SQL_FETCHARRAY($result));
-               //* DEBUG: */ echo "*".count($SURFBAR_DATA)."*<br />\n";
+               //* DEBUG: */ echo __FUNCTION__.":".count($SURFBAR_CACHE)."*<br />\n";
+               $SURFBAR_CACHE = merge_array($SURFBAR_CACHE, SQL_FETCHARRAY($result));
+               //* DEBUG: */ echo __FUNCTION__.":".count($SURFBAR_CACHE)."*<br />\n";
 
                // Is the time there?
 
                // 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!
                        // Then repair it wit the static!
-                       $SURFBAR_DATA['time'] = $_CONFIG['surfbar_static_time'];
+                       $SURFBAR_CACHE['last_salt'] = "";
                } // END - if
 
                // Fix missing last_surfed
                } // 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
                        // 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!
                } // 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
                } 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
                }
 
                // Now get the id
-               $nextId = SURFBAR_GET_DATA('id');
+               $nextId = SURFBAR_GET_ID();
        } // END - if
 
        // Free result
        SQL_FREERESULT($result);
 
        // Return result
        } // END - if
 
        // Free result
        SQL_FREERESULT($result);
 
        // Return result
-       //* DEBUG: */ echo "nextId={$nextId}<br />\n";
+       //* DEBUG: */ echo __FUNCTION__.":nextId={$nextId}<br />\n";
        return $nextId;
 }
 // ----------------------------------------------------------------------------
 // PLEASE DO NOT ADD ANY OTHER FUNCTIONS BELOW THIS LINE ELSE THEY "WRAP" THE
        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) {
 // ----------------------------------------------------------------------------
 // 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?
 
        // Default is null
        $data = null;
 
        // Is the entry there?
-       if (isset($SURFBAR_DATA[$element])) {
+       if (isset($SURFBAR_CACHE[$element])) {
                // Then take it
                // Then take it
-               $data = $SURFBAR_DATA[$element];
+               $data = $SURFBAR_CACHE[$element];
        } else { // END - if
                print("<pre>");
        } else { // END - if
                print("<pre>");
-               print_r($SURFBAR_DATA);
+               print_r($SURFBAR_CACHE);
                debug_print_backtrace();
                die("</pre>");
        }
                debug_print_backtrace();
                die("</pre>");
        }
@@ -479,6 +531,16 @@ function SURFBAR_GET_URL () {
        // Get data element and return its contents
        return SURFBAR_GET_DATA('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
 // Getter for user reload locks
 function SURFBAR_GET_USER_RELOAD_LOCK () {
        // Get data element and return its contents
index 53a8e0ff41e62c6d3b18344e89625acac042623f..5850e441720b2acc798e9fc2345df95222e01025 100644 (file)
@@ -86,13 +86,10 @@ include (PATH."inc/header.php");
 
 // Modules are by default not valid!
 $MOD_VALID = false; $check = "failed";
 
 // 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);
        // 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)
        // 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?
                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;
                        // 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
                        // 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;
                        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);
 }
 
        ADD_FATAL(MYSQL_ERRORS);
 }
 
-if ($MOD_VALID)
-{
+if ($MOD_VALID) {
        /////////////////////////////////////////////
        // Main including line DO NOT REMOVE/EDIT! //
        /////////////////////////////////////////////
        /////////////////////////////////////////////
        // Main including line DO NOT REMOVE/EDIT! //
        /////////////////////////////////////////////
index 3bfe6552794ce3ba8d39242a91c887bb570e4c85..d2f943308d0dfe495eaeb5b11ab45b8b8b5887dd 100644 (file)
@@ -35,8 +35,8 @@
 require_once("inc/libs/security_functions.php");
 
 // Init "action" and "what"
 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'] = "";
 
 $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?
        } // 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']);
 
                // 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']);
                        // 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 = "";
        } 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),
                                $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(),
                                        '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 (file)
index 0000000..b893818
--- /dev/null
@@ -0,0 +1,31 @@
+<div align="center">
+       <div class="member_table dashed" style="width:500px">
+               <div class="member_title2 bottom2">
+                       <strong>{!POINTS!}-Surfbar von {!MAIN_TITLE!}</strong>
+               </div>
+
+               <div style="padding:3px">
+                       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.
+               </div>
+       </div>
+
+       <div class="member_table dashed" style="width:500px;margin-top:5px">
+               <div class="member_title2 bottom2">
+                       <strong>Tipp von uns:</strong>
+               </div>
+
+               <div style="padding:3px">
+                       Laden Sie sich den kostenlosen [<a href="http://www.mozilla-europe.org/de/"
+                        target="_blank">Firefox-Browser</a>] herunter und dazu die ebenfalls
+                       kostenlose Erweiterung [<a href="http://www.noscript.net/"
+                        target="_blank">NoScript!</a>] Dort k&ouml;nnen Sie JavaScript z.B.
+                       generell verbieten und nur f&uuml;r geziehlte Seiten - z.b. diese -
+                       freigeben! Zudem haben Sie besseren Schutz gegen XSS-Attacken
+                       [<A href="http://de.wikipedia.org/wiki/Cross-Site_Scripting"
+                        target="_blank">Cross-Site-Scripting</a>] und vieles mehr.
+               </div>
+       </div>
+</div>
index 8038a14cadd969f06c672038758d8db8697bdafe..e85e74463850d1bfd81f851419f4d34738038082 100644 (file)
@@ -32,6 +32,10 @@ function Confirm() {
        parent.surfbar_url.location="{!URL!}/surfbar.php?id=$content[id]&check=$content[check]&salt=$content[salt]";
 }
 
        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;
 function StartCounter() {
        if (currCounter < 1) {
                return false;
@@ -43,7 +47,7 @@ function StartCounter() {
        if (currCounter == 0) {
                clearInterval(countDown);
                Confirm();
        if (currCounter == 0) {
                clearInterval(countDown);
                Confirm();
-               this.location.reload();
+               window.setTimeout("ReloadThis()", 500);
        }
 }
 
        }
 }
 
index 8ab7566cf16b1ce7ff0402b44bf730b3e3e05e4a..a8abfa1bbe1eb92fe54643f34452d82bb48bf098 100644 (file)
@@ -10,7 +10,7 @@ if (top.frames.length > 0) {
                <frame name="surfbar_top" src="{!URL!}/surfbar.php?frame=top" frameborder="no" scrolling="no" noresize>
                <frame name="surfbar_banner" src="{!URL!}/surfbar.php?frame=banner" frameborder="no" scrolling="no" noresize>
        </frameset>
                <frame name="surfbar_top" src="{!URL!}/surfbar.php?frame=top" frameborder="no" scrolling="no" noresize>
                <frame name="surfbar_banner" src="{!URL!}/surfbar.php?frame=banner" frameborder="no" scrolling="no" noresize>
        </frameset>
-       <frame name="surfbar_url" src="about:blank" frameborder="no" scrolling="no" noresize>
+       <frame name="surfbar_url" src="{!URL!}/surfbar.php?frame=start" frameborder="no" scrolling="no" noresize>
 </frameset>
 <noframes>
        Ihr Browser unterst&uuml;tzt keine Frames!
 </frameset>
 <noframes>
        Ihr Browser unterst&uuml;tzt keine Frames!