- Daily/weekly/monthly reset completely rewritten
authorRoland Häder <roland@mxchange.org>
Mon, 8 Sep 2008 18:39:37 +0000 (18:39 +0000)
committerRoland Häder <roland@mxchange.org>
Mon, 8 Sep 2008 18:39:37 +0000 (18:39 +0000)
- Saving of non-admin config entries rewritten
- Statistics added to surfbar bottom frame
- GET_EXT_ID() and GET_EXT_NAME() rewritten due to load-extensions.php is
  rewritten too!
- Double close of database link fixed (causes double write of config)
- Several minor improvments/fixes
- Obsolete inc/monthly_newsletter.php removed

74 files changed:
.gitattributes
doubler.php
inc/db/lib-mysql3.php
inc/doubler_send.php
inc/extensions.php
inc/extensions/ext-
inc/extensions/ext-beg.php
inc/extensions/ext-bonus.php
inc/extensions/ext-holiday.php
inc/extensions/ext-newsletter.php
inc/extensions/ext-sql_patches.php
inc/extensions/ext-surfbar.php
inc/extensions/ext-yoomedia.php
inc/functions.php
inc/gen_sql_patches.php
inc/language/surfbar_de.php
inc/libs/cache_functions.php
inc/libs/output_functions.php
inc/libs/surfbar_functions.php
inc/load_extensions.php
inc/mails/beg_mails.php
inc/mails/bonus_mails.php
inc/modules/admin.php
inc/modules/admin/action-
inc/modules/admin/action-surfbar.php
inc/modules/admin/admin-inc.php
inc/modules/admin/what-
inc/modules/admin/what-config_home.php
inc/modules/admin/what-config_surfbar.php
inc/modules/admin/what-list_beg.php
inc/modules/admin/what-list_bonus.php
inc/modules/admin/what-list_surfbar_reflvl.php
inc/modules/admin/what-list_surfbar_urls.php
inc/modules/admin/what-maintenance.php
inc/modules/admin/what-unlock_surfbar_urls.php [new file with mode: 0644]
inc/modules/admin/what-user_contct.php
inc/modules/guest/action-
inc/modules/guest/action-online.php
inc/modules/login.php
inc/modules/member/action-
inc/modules/member/action-surfbar.php
inc/modules/member/what-
inc/modules/member/what-mydata.php
inc/modules/member/what-surfbar_book.php [new file with mode: 0644]
inc/modules/member/what-surfbar_start.php
inc/monthly/monthly_
inc/monthly/monthly_beg.php
inc/monthly/monthly_bonus.php
inc/monthly/monthly_newsletter.php
inc/monthly/monthly_surfbar.php [new file with mode: 0644]
inc/monthly_newsletter.php [deleted file]
inc/mysql-connect.php
inc/mysql-manager.php
inc/patch-system.php
inc/reset/reset_
inc/reset/reset_beg.php
inc/reset/reset_daily.php
inc/reset/reset_holiday.php
inc/reset/reset_surfbar.php [new file with mode: 0644]
inc/theme-manager.php
inc/weekly/.htaccess [new file with mode: 0644]
inc/weekly/weekly_ [new file with mode: 0644]
inc/weekly/weekly_surfbar.php [new file with mode: 0644]
surfbar.php
templates/de/emails/admin/admin_surfbar_url_reg.tpl [new file with mode: 0644]
templates/de/emails/admin/admin_surfbar_url_unlock.tpl
templates/de/emails/member/member_surfbar_url_reg.tpl [new file with mode: 0644]
templates/de/html/admin/admin_config_surfbar.tpl
templates/de/html/member/member_surfbar_book_dynamic.tpl [new file with mode: 0644]
templates/de/html/member/member_surfbar_book_static.tpl [new file with mode: 0644]
templates/de/html/surfbar/surfbar_frame_stats.tpl [new file with mode: 0644]
templates/de/html/surfbar/surfbar_frame_top.tpl
templates/de/html/surfbar/surfbar_frameset.tpl
templates/de/html/surfbar/surfbar_stopped.tpl

index 57e22a6..f075887 100644 (file)
@@ -363,6 +363,7 @@ inc/modules/admin/what-theme_edit.php -text
 inc/modules/admin/what-theme_import.php -text
 inc/modules/admin/what-unlock_emails.php -text
 inc/modules/admin/what-unlock_sponsor.php -text
+inc/modules/admin/what-unlock_surfbar_urls.php -text
 inc/modules/admin/what-updates.php -text
 inc/modules/admin/what-usage.php -text
 inc/modules/admin/what-user_contct.php -text
@@ -441,6 +442,7 @@ inc/modules/member/what-reflinks.php -text
 inc/modules/member/what-sponsor.php -text
 inc/modules/member/what-stats.php -text
 inc/modules/member/what-support.php -text
+inc/modules/member/what-surfbar_book.php -text
 inc/modules/member/what-surfbar_start.php -text
 inc/modules/member/what-themes.php -text
 inc/modules/member/what-transfer.php -text
@@ -460,7 +462,7 @@ inc/monthly/monthly_ -text
 inc/monthly/monthly_beg.php -text
 inc/monthly/monthly_bonus.php -text
 inc/monthly/monthly_newsletter.php -text
-inc/monthly_newsletter.php -text
+inc/monthly/monthly_surfbar.php -text
 inc/mysql-connect.php -text
 inc/mysql-manager.php -text
 inc/patch-system.php -text
@@ -536,12 +538,16 @@ inc/reset/reset_bonus.php -text
 inc/reset/reset_daily.php -text
 inc/reset/reset_engine.php -text
 inc/reset/reset_holiday.php -text
+inc/reset/reset_surfbar.php -text
 inc/security.php -text
 inc/session.php -text
 inc/sql_error.php -text
 inc/stats_bonus.php -text
 inc/stylesheet.php -text
 inc/theme-manager.php -text
+inc/weekly/.htaccess -text
+inc/weekly/weekly_ -text
+inc/weekly/weekly_surfbar.php -text
 /index.php -text
 /install.php -text
 install/menu-de.sql -text
@@ -594,6 +600,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_reg.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
@@ -658,6 +665,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_reg.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
@@ -1240,6 +1248,8 @@ templates/de/html/member/member_stats_table.tpl -text
 templates/de/html/member/member_support_contacted.tpl -text
 templates/de/html/member/member_support_contcted.tpl -text
 templates/de/html/member/member_support_form.tpl -text
+templates/de/html/member/member_surfbar_book_dynamic.tpl -text
+templates/de/html/member/member_surfbar_book_static.tpl -text
 templates/de/html/member/member_surfbar_link.tpl -text
 templates/de/html/member/member_surfbar_start_static.tpl -text
 templates/de/html/member/member_themes.tpl -text
@@ -1291,6 +1301,7 @@ 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_stats.tpl -text
 templates/de/html/surfbar/surfbar_frame_top.tpl -text
 templates/de/html/surfbar/surfbar_frameset.tpl -text
 templates/de/html/surfbar/surfbar_start_banner.tpl -text
index ca2934f..53ee068 100644 (file)
@@ -138,16 +138,9 @@ if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_install
 
                                        // Add points to "total payed" including charge
                                        $points = $_POST['points'] - $_POST['points'] * $_CONFIG['doubler_charge'];
-                                       $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET doubler_points=doubler_points+%s WHERE config=0 LIMIT 1",
-                                        array($points), __FILE__, __LINE__);
+                                       UPDATE_CONFIG("doubler_points", $points, "+");
                                        $_CONFIG['doubler_points'] += $points;
 
-                                       // Destroy cache
-                                       if (GET_EXT_VERSION("cache") >= "0.1.2")
-                                       {
-                                               if ($cacheInstance->cache_file("config", true)) $cacheInstance->cache_destroy();
-                                       }
-
                                        // Add second line for the referral but only when uid != refid
                                        if (($GLOBALS['refid'] > 0) && ($GLOBALS['refid'] != $uid))
                                        {
@@ -159,7 +152,7 @@ if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_install
                                        }
 
                                        // Update usage counter
-                                       $result = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_config SET doubler_counter=doubler_counter+1 WHERE config=0 LIMIT 1", __FILE__, __LINE__);
+                                       UPDATE_CONFIG("doubler_counter", 1, "+");
                                        $_CONFIG['doubler_counter']++;
 
                                        // Set constant
index 44bcbdc..f8eceec 100644 (file)
@@ -177,25 +177,22 @@ function SQL_SELECT_DB($dbName, $link, $F, $L) {
        return $select;
 }
 // SQL close link
-function SQL_CLOSE($link, $F, $L) {
+function SQL_CLOSE(&$link, $F, $L) {
+       // Is there still a valid link?
+       if (!is_resource($link)) {
+               // Skip double close
+               return false;
+       } // END - if
+
        global $_CONFIG, $cacheInstance, $cacheArray;
        if ((GET_EXT_VERSION("cache") >= "0.0.7") && (isset($_CONFIG['db_hits'])) && (isset($_CONFIG['cache_hits'])) && (is_object($cacheInstance))) {
                // Update counter for db/cache
-               $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET db_hits=%s, cache_hits=%s WHERE config=0 LIMIT 1",
-                       array(bigintval($_CONFIG['db_hits']), bigintval($_CONFIG['cache_hits'])), __FILE__, __LINE__);
-
-               // Update cache here
-               if (GET_EXT_VERSION("cache") >= "0.1.2") {
-                       if ($cacheInstance->cache_file("config", true)) {
-                               // Replace data
-                               $cacheInstance->cache_replace("cache_hits", $_CONFIG['cache_hits'], "0", $cacheArray);
-                               $cacheInstance->cache_replace("db_hits"   , $_CONFIG['db_hits']   , "0", $cacheArray);
-                       }
-               }
-       }
+               UPDATE_CONFIG(array("db_hits", "cache_hits"), array(bigintval($_CONFIG['db_hits']), bigintval($_CONFIG['cache_hits'])));
+       } // END - if
 
-       // Close database link
+       // Close database link and forget the link
        $close = @mysql_close($link) or ADD_FATAL($F." (".$L."):".mysql_error());
+       $link = null;
        return $close;
 }
 // SQL free result
index a0d6ee8..71685ce 100644 (file)
@@ -148,17 +148,9 @@ if (((SQL_NUMROWS($result_total) > 0) && ($_CONFIG['doubler_sent_all'] == "Y"))
                        }
 
                        // Update doubler's account only when others are not updated
-                       if (!$OK)
-                       {
+                       if (!$OK) {
                                // Add points to used doubler points
-                               $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET doubler_used=doubler_used+%s WHERE config=0 LIMIT 1",
-                                array($points), __FILE__, __LINE__);
-
-                               // Destroy cache
-                               if (GET_EXT_VERSION("cache") >= "0.1.2")
-                               {
-                                       if ($cacheInstance->cache_file("config", true)) $cacheInstance->cache_destroy();
-                               }
+                               UPDATE_CONFIG("douber_used", $points, "+");
                        }
 
                        // Update variables to prevent errors
index fa5e463..5c15cdf 100644 (file)
@@ -471,7 +471,7 @@ function EXTENSION_UPDATE($file, $ext, $EXT_VER, $dry_run=false)
                        {
                                // Task not created so it's a brand-new extension which we need to register and create a task for!
                                $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_task_system (assigned_admin, userid, status, task_type, subject, text, task_created) VALUES ('%s', '0', 'NEW', 'EXTENSION_UPDATE', '%s', '%s', UNIX_TIMESTAMP())",
-                                array(GET_ADMIN_ID(SQL_ESCAPE(get_session('admin_login'))), $ext_subj, addslashes($NOTES)), __FILE__, __LINE__);
+                                array(GET_ADMIN_ID(get_session('admin_login')), $ext_subj, addslashes($NOTES)), __FILE__, __LINE__);
                        }
 
                        // Free memory
@@ -547,21 +547,17 @@ function EXTENSION_VERBOSE_TABLE($SQLs, $title = ADMIN_SQLS_EXECUTED_ON_REMOVAL,
        // Return output
        return $OUT;
 }
-//
-function GET_EXT_NAME($id)
-{
+// Get extension name from id
+function GET_EXT_NAME ($id) {
        $ret = "";
        global $cacheArray, $_CONFIG;
-       if (!empty($cacheArray['extensions']['ext_id'][$id]))
-       {
+       if (!empty($cacheArray['extensions']['ext_name'][$id])) {
                // Load from cache
-               $ret = $cacheArray['extensions']['ext_id'][$id];
+               $ret = $cacheArray['extensions']['ext_name'][$id];
 
                // Count cache hits
                $_CONFIG['cache_hits']++;
-       }
-        else
-       {
+       } elseif (!EXT_IS_ACTIVE("cache")) {
                // Load from database
                $result = SQL_QUERY_ESC("SELECT ext_name FROM "._MYSQL_PREFIX."_extensions WHERE id=%s LIMIT 1",
                 array(bigintval($id)), __FILE__, __LINE__);
@@ -570,27 +566,25 @@ function GET_EXT_NAME($id)
        }
        return $ret;
 }
-//
-function GET_EXT_ID($name)
-{
-       $ret = "0";
+// Get extension id from name
+function GET_EXT_ID($name) {
+       $ret = 0;
        global $cacheArray, $_CONFIG;
-       if ((isset($cacheArray['extensions']['ext_id'])) && (is_array($cacheArray['extensions']['ext_id'])))
-       {
+       if (isset($cacheArray['extensions']['ext_id'][$name])) {
                // Load from cache
-               $ret = array_search($name, $cacheArray['extensions']['ext_id']);
+               $ret = $cacheArray['extensions']['ext_id'][$name];
 
                // Count cache hits
                $_CONFIG['cache_hits']++;
-       }
-        else
-       {
+       } elseif (!EXT_IS_ACTIVE("cache")) {
                // Load from database
                $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_extensions WHERE ext_name='%s' LIMIT 1",
                 array($name), __FILE__, __LINE__);
                list($ret) = SQL_FETCHROW($result);
                SQL_FREERESULT($result);
        }
+
+       // Return value
        return $ret;
 }
 //
index ca956b8..3b7509a 100644 (file)
@@ -12,7 +12,7 @@
  * -------------------------------------------------------------------- *
  *                                                                      *
  * -------------------------------------------------------------------- *
- * Copyright (c) 2003, 2004, 2005, 2006, 2007 by Roland Haeder          *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
index ab6b882..76b1042 100644 (file)
@@ -154,14 +154,8 @@ case "update": // Update an extension
                break;
 
        case "0.1.2":
-               // Get current month
-               $curr = date("m", time());
-               if (strlen($curr) == 1) $curr = "0".$curr;
-               if ($curr == "00") $curr = "12";
-
                // SQL queries for v0.1.2
                $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD beg_mode ENUM('DIRECT', 'REF') NOT NULL DEFAULT 'REF'";
-               $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD beg_month CHAR(2) NOT NULL DEFAULT '".$curr."'";
                $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD beg_ranks TINYINT(3) NOT NULL DEFAULT '10'";
                $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD beg_active ENUM('Y', 'N') NOT NULL DEFAULT 'N'";
                $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD beg_rallye ENUM('Y', 'N') NOT NULL DEFAULT 'N'";
@@ -268,24 +262,8 @@ default: // Do stuff when extension is loaded
        if ($_CONFIG['beg_uid_timeout'] > $OLD) $OLD = $_CONFIG['beg_uid_timeout'];
        $result_ext = SQL_QUERY("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_beg_ips WHERE timeout < ".(time() - $OLD - 60*60), __FILE__, __LINE__);
 
-       if (isBooleanConstantAndTrue('__DAILY_RESET') && (!DEBUG_MODE) && ($CSS != 1))
-       {
-               // Daily reset was run so let's check if begging rallye is active
-               if ($_CONFIG['beg_rallye'] == "Y")
-               {
-                       // Check for our winers
-                       $INC_POOL[] = sprintf("%sinc/monthly/monthly_beg.php", PATH);
-               }
-                else
-               {
-                       // Reset begging points
-                       $INC_POOL[] = sprintf("inc/reset/reset_beg.php", PATH);
-               }
-       }
-
        // Check for beg rallye is active and send mails out
-       if (($_CONFIG['beg_rallye'] == "Y") && ($_CONFIG['beg_new_mem_notify'] == "Y"))
-       {
+       if (($_CONFIG['beg_rallye'] == "Y") && ($_CONFIG['beg_new_mem_notify'] == "Y")) {
                // Include file for sending out mails
                $INC_POOL[] = sprintf("%sinc/mails/beg_mails.php", PATH);
        }
index b0bad4d..2e67982 100644 (file)
@@ -130,7 +130,6 @@ case "update": // Update an extension
                $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD turbo_rates VARCHAR(255) NOT NULL DEFAULT '50;20;10'";
                $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD bonus_ranks TINYINT(3) NOT NULL DEFAULT '10'";
                // Use actual month for this update
-               $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD last_bonus_month CHAR(2) NOT NULL DEFAULT '".date("m", time())."'";
                $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data ADD login_bonus DOUBLE(20,3) NOT NULL DEFAULT '0.000'";
                $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data ADD turbo_bonus DOUBLE(20,3) NOT NULL DEFAULT '0.000'";
                $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_stats ADD bonus_stats ENUM('Y', 'N') NOT NULL DEFAULT 'N'";
@@ -353,14 +352,6 @@ KEY userid (userid)
                break;
 
        case "0.5.5": // SQL queries for v0.5.5
-               // Get previous month
-               $prev = date("m", time()) - 1;
-               if (strlen($prev) == 1) $prev = "0".$prev;
-               if ($prev == "00") $prev = "12";
-
-               // Reset monthly active rallye
-               $SQLs[] = "UPDATE "._MYSQL_PREFIX."_config SET last_bonus_month='".$prev."' WHERE config=0 LIMIT 1";
-
                // Update notes (these will be set as task text!)
                $UPDATE_NOTES = "Weitere Variablenfehler in <STRONG>inc/monthly_bonus.php</STRONG> haben daf&uuml;r gesorgt, dass die monatliche Aktiv-Rallye nicht ausgesch&uuml;ttet wurde. Mit diesem Update wurde die Aussch&uuml;ttung initialisiert. Ihre Mitglieder bekommen voraussichtlicht nichts doppelt verg&uuml;tet.";
                break;
index a5937ff..a7210a8 100644 (file)
@@ -227,13 +227,6 @@ default: // Do stuff when extension is loaded
        $dummy = LOAD_CONFIG();
        $_CONFIG = merge_array($_CONFIG, $dummy);
        unset($dummy);
-
-       // Do we have a daily-reset-run?
-       if (((isBooleanConstantAndTrue('__DAILY_RESET')) && ($_CONFIG['holiday_mode'] == "RESET")) || ($_CONFIG['holiday_mode'] == "DIRECT"))
-       {
-               // Ok, let's check for finished holidays and unlock those accounts
-               $INC_POOL[] = sprintf("%sinc/reset/reset_holiday.php", PATH);
-       }
        break;
 }
 
index 4b625bc..14fdc39 100644 (file)
@@ -129,8 +129,6 @@ case "update": // Update an extension
                break;
 
        case "0.1.0": // SQL queries for v0.2.1
-               $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD nl_month CHAR(2) NOT NULL DEFAULT '".date("m", time())."'";
-
                // Update notes (these will be set as task text!)
                $UPDATE_NOTES = "Nur bei installierter Erweiterung <STRONG>html_mail</STRONG> k&ouml;nnen Sie auch HTML-Mails versenden.";
                break;
index 2d7ea00..b332e0d 100644 (file)
@@ -38,13 +38,13 @@ if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF']))) {
 }
 
 // Version number
-$EXT_VERSION = "0.4.4";
+$EXT_VERSION = "0.4.5";
 
 // Auto-set extension version
 if (!isset($EXT_VER)) $EXT_VER = $EXT_VERSION;
 
 // Version history array (add more with , "0.1" and so on)
-$EXT_VER_HISTORY = array("0.0", "0.0.1", "0.0.2", "0.0.3", "0.0.4", "0.0.5", "0.0.6", "0.0.7", "0.0.8", "0.0.9", "0.1.0", "0.1.1", "0.1.2", "0.1.3", "0.1.4", "0.1.5", "0.1.6", "0.1.7", "0.1.8", "0.1.9", "0.2.0", "0.2.1", "0.2.2", "0.2.3", "0.2.4", "0.2.5", "0.2.6", "0.2.7", "0.2.8", "0.2.9", "0.3.0", "0.3.1", "0.3.2", "0.3.3", "0.3.4", "0.3.5", "0.3.6", "0.3.7", "0.3.8", "0.3.9", "0.4.0", "0.4.1", "0.4.2", "0.4.3", "0.4.4");
+$EXT_VER_HISTORY = array("0.0", "0.0.1", "0.0.2", "0.0.3", "0.0.4", "0.0.5", "0.0.6", "0.0.7", "0.0.8", "0.0.9", "0.1.0", "0.1.1", "0.1.2", "0.1.3", "0.1.4", "0.1.5", "0.1.6", "0.1.7", "0.1.8", "0.1.9", "0.2.0", "0.2.1", "0.2.2", "0.2.3", "0.2.4", "0.2.5", "0.2.6", "0.2.7", "0.2.8", "0.2.9", "0.3.0", "0.3.1", "0.3.2", "0.3.3", "0.3.4", "0.3.5", "0.3.6", "0.3.7", "0.3.8", "0.3.9", "0.4.0", "0.4.1", "0.4.2", "0.4.3", "0.4.4", "0.4.5");
 
 switch ($EXT_LOAD_MODE)
 {
@@ -557,6 +557,14 @@ PRIMARY KEY (id)
                // Update notes (these will be set as task text!)
                $UPDATE_NOTES = "Schl&uuml;ssel in Admin-, Gast- und Mitgliedsmen&uuml; verbessert.";
                break;
+
+       case "0.4.5": // SQL queries for v0.4.5
+               $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD last_month CHAR(2) NOT NULL DEFAULT '00'";
+               $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD last_week CHAR(2) NOT NULL DEFAULT '00'";
+
+               // Update notes (these will be set as task text!)
+               $UPDATE_NOTES = "T&auml;glichen/w&ouml;chentlichen/monatlichen Reset verbessert.";
+               break;
        }
        break;
 
index 7a09fee..739272c 100644 (file)
@@ -12,7 +12,7 @@
  * -------------------------------------------------------------------- *
  *                                                                      *
  * -------------------------------------------------------------------- *
- * Copyright (c) 2003, 2004, 2005, 2006, 2007 by Roland Haeder          *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -101,25 +101,43 @@ INDEX (`url_id`)
 PRIMARY KEY(`id`)
 ) TYPE=MyISAM COMMENT='Surfbar referal levels'";
 
+       // Statistics
+       $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_stats`";
+       $SQLs[] = "CREATE TABLE `"._MYSQL_PREFIX."_surfbar_stats` (
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`url_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`count` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`last_online` TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+PRIMARY KEY (`id`),
+INDEX (`userid`,`url_id`)
+) TYPE=MyISAM COMMENT='Surfbar Statistics'";
+
        // Add default referal level 0 with 100%
        $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_surfbar_reflevels` (`level`, `percent`) VALUES (0, 100)";
 
        // Config entries
        $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_pay_model` ENUM('STATIC','DYNAMIC') NOT NULL DEFAULT 'STATIC'";
-       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_static_reward` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT '0.25000'";
-       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_static_costs` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT '1.00000'";
-       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_static_time` SMALLINT(6) UNSIGNED NOT NULL DEFAULT '60'";
-       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_static_lock` SMALLINT(6) UNSIGNED NOT NULL DEFAULT '".(60*5)."'";
+       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_static_reward` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.25000";
+       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_static_costs` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 1.00000";
+       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_static_time` SMALLINT(6) UNSIGNED NOT NULL DEFAULT 60";
+       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_static_lock` SMALLINT(6) UNSIGNED NOT NULL DEFAULT ".(60*5)."";
        $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_notify_admin_unlock` ENUM('N','Y') NOT NULL DEFAULT 'N'";
-       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_dynamic_percent` FLOAT(10,5) UNSIGNED NOT NULL DEFAULT '10.00000'";
-       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_max_order` INT(7) UNSIGNED NOT NULL DEFAULT '10'";
-       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_restart_time` BIGINT(20) UNSIGNED NOT NULL DEFAULT '".(60*6)."'";
+       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_dynamic_percent` FLOAT(10,5) UNSIGNED NOT NULL DEFAULT 10.00000";
+       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_max_order` INT(7) UNSIGNED NOT NULL DEFAULT 10";
+       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_restart_time` BIGINT(20) UNSIGNED NOT NULL DEFAULT ".(60*6)."";
        $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_autostart` ENUM('Y','N') NOT NULL DEFAULT 'Y'";
+       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_total_counter` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
+       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_daily_counter` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
+       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_weekly_counter` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
+       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_monthly_counter` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
+       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_stats_reload` BIGINT(20) UNSIGNED NOT NULL DEFAULT 30";
 
        // Member menus
-       $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES ('surfbar',NULL,'Surfbar','Y','Y',5)";
+       $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES ('surfbar',NULL,'Surfbar','Y','Y',4)";
        $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES ('surfbar','surfbar_start','Surfbar starten','Y','Y',1)";
-       $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES ('surfbar','surfbar_book','Surfbar buchen','Y','Y',2)";
+       $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES ('surfbar','surfbar_book','URL buchen','Y','Y',2)";
+       $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES ('surfbar','surfbar_stats','URL-Statistiken','Y','Y',3)";
 
        // Admin menus
        $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('surfbar','','Surfbar','URLs in der Surfbar verwalten, Einstellungen &auml;ndern und vieles mehr.',7)";
@@ -138,6 +156,7 @@ case "remove": // Do stuff when removing extension
        $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[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_stats`";
        $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 4004f16..93461af 100644 (file)
@@ -13,7 +13,7 @@
  * -------------------------------------------------------------------- *
  *                                                                      *
  * -------------------------------------------------------------------- *
- * Copyright (c) 2003, 2004, 2005, 2006, 2007 by Roland Haeder          *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
index 7db231c..8875dc1 100644 (file)
@@ -474,7 +474,7 @@ function GEN_PASS($LEN = 0) {
        return $PASS;
 }
 //
-function MAKE_DATETIME($time, $mode="0")
+function MAKE_DATETIME ($time, $mode="0")
 {
        if ($time == 0) {
                // Never happend
@@ -487,8 +487,7 @@ function MAKE_DATETIME($time, $mode="0")
        switch (GET_LANGUAGE())
        {
        case "de": // German date / time format
-               switch ($mode)
-               {
+               switch ($mode) {
                        case "0": $ret = date("d.m.Y \u\m H:i \U\h\\r", $time); break;
                        case "1": $ret = strtolower(date("d.m.Y - H:i", $time)); break;
                        case "2": $ret = date("d.m.Y|H:i", $time); break;
@@ -497,8 +496,7 @@ function MAKE_DATETIME($time, $mode="0")
                break;
 
        default:        // Default is the US date / time format!
-               switch ($mode)
-               {
+               switch ($mode) {
                        case "0": $ret = date("r", $time); break;
                        case "1": $ret = date("Y-m-d - g:i A", $time); break;
                        case "2": $ret = date("y-m-d|H:i", $time); break;
@@ -509,69 +507,55 @@ function MAKE_DATETIME($time, $mode="0")
 }
 
 // Translates the american decimal dot into a german comma
-function TRANSLATE_COMMA($dotted, $cut=true) {
+function TRANSLATE_COMMA ($dotted, $cut=true) {
        global $_CONFIG;
+
        // Default is 3 you can change this in admin area "Misc -> Misc Options"
        if (empty($_CONFIG['max_comma'])) $_CONFIG['max_comma'] = "3";
-       if (!ereg("\.", $dotted)) $dotted .= ".".str_repeat("0", $_CONFIG['max_comma']);
-       if ($cut) {
-               // Remove trailing zeros
-               $dot = str_replace(".", "x", $dotted);
-               while(substr($dot, -1, 1) == "0") {
-                       $dot = substr($dot, 0, -1);
-               }
+       $maxComma = $_CONFIG['max_comma'];
 
-               if (substr($dot, -1, 1) == "x") {
-                       // Last char is the 'x'
-                       $dotted = substr($dot, 0, -1);
+       // Cut zeros off?
+       if ($cut) {
+               // Test for commata if in cut-mode
+               $com = explode(".", $dotted);
+               if (count($com) > 1) {
+                       // Commata found, so only zeros?
+                       if ($com[1] == str_repeat("0", strlen($com[1]))) {
+                               // Only zeros, so don't display them
+                               $maxComma = 0;
+                       } // END - if
                } else {
-                       // Last char is a number
-                       $dotted = str_replace("x", ".", $dot);
+                       // Don't display commatas even if there are none... ;-)
+                       $maxComma = 0;
                }
-       }
+       } // END - if
+
+       // Debug log
+       //DEBUG_LOG(__FUNCTION__.":dotted={$dotted},maxComma={$maxComma}");
 
        // Translate it now
        switch (GET_LANGUAGE()) {
        case "de":
-               $pos = strpos($dotted, ".");
-               if ($pos > 0) {
-                       if ($cut) {
-                               // Cut x numbers behind comma
-                               $dotted = str_replace(".", ",", substr($dotted, 0, ($pos + $_CONFIG['max_comma'] + 1)));
-                       } else {
-                               // Replace comma with dot
-                               $dotted = str_replace(".", ",", $dotted);
-                       }
-               } elseif (!$cut) {
-                       if (empty($pos)) {
-                               $dotted = "0,".str_repeat("0", $_CONFIG['max_comma']);
-                       } else {
-                               $dotted .= ",".str_repeat("0", $_CONFIG['max_comma']);
-                       }
-               }
+               $dotted = number_format($dotted, $maxComma, ",", ".");
                break;
 
        default:
-               if (!$cut) {
-                       if ($pos > 0) {
-                               $dotted = substr($dotted, 0, ($pos + $_CONFIG['max_comma'] + 1));
-                       } else {
-                               $dotted .= ".".str_repeat("0", $_CONFIG['max_comma']);
-                       }
-               }
+               $dotted = number_format($dotted, $maxComma, ".", ",");
                break;
        }
+
+       // Return translated value
        return $dotted;
 }
 
 //
-function DEREFERER($URL) {
+function DEREFERER ($URL) {
        $URL = URL."/modules.php?module=loader&amp;url=".urlencode(base64_encode(gzcompress(COMPILE_CODE($URL))));
        return $URL;
 }
 
 //
-function TRANSLATE_SEX($sex) {
+function TRANSLATE_SEX ($sex) {
        switch ($sex)
        {
                case "M": $ret = SEX_M; break;
@@ -695,7 +679,7 @@ function LOAD_EMAIL_TEMPLATE($template, $content="", $UID="0") {
        if (isSessionVariableSet('admin_login')) {
                // Load Admin data
                $result = SQL_QUERY_ESC("SELECT email FROM "._MYSQL_PREFIX."_admins WHERE login='%s' LIMIT 1",
-                       array(SQL_ESCAPE(get_session('admin_login'))), __FILE__, __LINE__);
+                       array(get_session('admin_login')), __FILE__, __LINE__);
                list($ADMIN) = SQL_FETCHROW($result);
                SQL_FREERESULT($result);
        }
@@ -2224,7 +2208,7 @@ function get_session($var) {
        if (isSessionVariableSet($var)) {
                // Then  get it secured!
                $value = SQL_ESCAPE($_SESSION[$var]);
-       }
+       } // END - if
 
        // Return the value
        return $value;
@@ -2271,6 +2255,78 @@ function DEBUG_LOG ($message) {
                fclose($fp);
        } // END - if
 }
+// Reads a directory with PHP files in and gets only files back
+function GET_DIR_AS_ARRAY ($baseDir, $prefix) {
+       $INCs = array();
+
+       // Open directory
+       $dirPointer = opendir($baseDir) or mxchange_die("Cannot read ".basename($baseDir)." path!");
+
+       // Read all entries
+       while ($baseFile = readdir($dirPointer)) {
+               // Load file only if extension is active
+               // Make full path
+               $file = $baseDir.$baseFile;
+
+               // Is this a valid reset file?
+               if ((is_file($file)) && (is_readable($file)) && (substr($baseFile, 0, strlen($prefix)) == $prefix) && (substr($baseFile, -4, 4) == ".php")) {
+                       // Remove both for extension name
+                       $extName = substr($baseFile, strlen($prefix), -4);
+
+                       // Try to find it
+                       $extId = GET_EXT_ID($extName);
+
+                       // Is the extension valid and active?
+                       if (($extId > 0) && (EXT_IS_ACTIVE($extName))) {
+                               // Then add this file
+                               $INCs[] = $file;
+                       }
+               } // END - if
+       } // END - while
+
+       // Close directory
+       closedir($dirPointer);
+
+       // Return array with include files
+       return $INCs;
+}
+// Load more reset scripts
+function RESET_ADD_INCLUDES () {
+       global $_CONFIG, $INC_POOL;
+
+       // Is the reset set or old sql_patches?
+       if ((!isBooleanConstantAndTrue('__DAILY_RESET')) || (GET_EXT_VERSION("sql_patches") < "0.4.5")) {
+               // Then abort here
+               return;
+       } // END - if
+
+       // Get more daily reset scripts
+       $INC_POOL = array_merge($INC_POOL, GET_DIR_AS_ARRAY(PATH."inc/reset/", "reset_"));
+
+       // Create current week mark
+       $currWeek = date("W", time());
+
+       // Has it changed?
+       if ($_CONFIG['last_week'] != $currWeek) {
+               // Include weekly reset scripts
+               $INC_POOL = array_merge($INC_POOL, GET_DIR_AS_ARRAY(PATH."inc/weekly/", "weekly_"));
+
+               // Update config
+               UPDATE_CONFIG("last_week", $currWeek);
+       } // END - if
+
+       // Create current month mark
+       $currMonth = date("m", time());
+
+       // Has it changed?
+       if ($_CONFIG['last_month'] != $currMonth) {
+               // Include monthly reset scripts
+               $INC_POOL = array_merge($INC_POOL, GET_DIR_AS_ARRAY(PATH."inc/monthly/", "monthly_"));
+
+               // Update config
+               UPDATE_CONFIG("last_month", $currMonth);
+       } // END - if
+}
 //
 //////////////////////////////////////////////////
 //                                              //
index 5876e3d..2abce58 100644 (file)
@@ -46,8 +46,7 @@ if (empty($_CONFIG['pass_scramble'])) {
        $scrambleString = genScrambleString(40);
 
        // ... and store it there for future usage
-       $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET pass_scramble='%s' WHERE config=0 LIMIT 1",
-        array($scrambleString), __FILE__, __LINE__);
+       UPDATE_CONFIG("pass_scramble", $scrambleString);
 
        // Also remember it in config
        $_CONFIG['pass_scramble'] = $scrambleString;
@@ -61,8 +60,7 @@ if (empty($_CONFIG['master_salt'])) {
        $masterSalt = scrambleString(substr(generateHash(GEN_PASS(rand(128, 256))), 0, -40));
 
        // ... and store it there for future usage
-       $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET master_salt='%s' WHERE config=0 LIMIT 1",
-        array($masterSalt), __FILE__, __LINE__);
+       UPDATE_CONFIG("master_salt", $masterSalt);
 
        // Also remember it in config
        $_CONFIG['master_salt'] = $masterSalt;
@@ -96,8 +94,7 @@ if (empty($_CONFIG['file_hash'])) {
                //* DEBUG: */ die("Secret-Key: ".$secretKey."<br>Cookie: ".get_session('u_hash')."<br>Test: ".$test);
 
                // Write $file_hash to database
-               $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET file_hash='%s' WHERE config=0 LIMIT 1",
-                array($file_hash), __FILE__, __LINE__);
+               UPDATE_CONFIG("file_hash", $file_hash);
 
                // Also update configuration
                $_CONFIG['secret_key'] = $secretKey;
index a49c8dc..54a81ee 100644 (file)
@@ -51,6 +51,7 @@ define('ADMIN_CONFIG_SURFBAR_DYNAMIC_PERCENT', "Prozent auf dynamische Verg&uuml
 define('ADMIN_CONFIG_SURFBAR_MAX_ORDER', "Maximal durch Mitglied in Surfbar buchbare URLs:(*)");
 define('ADMIN_CONFIG_SURFBAR_RESTART_TIME', "Ruhezeit der Surfbar, wenn alle URLs in Reload-Lock sind:");
 define('ADMIN_CONFIG_SURFBAR_AUTOSTART', "Surfbar soll nach Ruhezeit automatisch starten?");
+define('ADMIN_CONFIG_SURFBAR_STATS_RELOAD', "Reload-Zeit der Statistik unterhalb der beworbenen Seite:");
 define('ADMIN_SURFBAR_NOTIFY_UNLOCK_YES', "Ja, Admin(s) informieren.");
 define('ADMIN_SURFBAR_NOTIFY_UNLOCK_NO', "Nein, nicht informieren.");
 define('ADMIN_SURFBAR_NO_REF_LEVELS_FOUND', "Zur Zeit sind keine Referal-Ebenen f&uuml;r die Surfbar eingestellt.<br />\nBitte installieren Sie die Erweiterung <strong>surfbar</strong> neu.");
@@ -67,6 +68,12 @@ define('ADMIN_SURFBAR_DEL_URL', "URL l&ouml;schen");
 define('ADMIN_SURFBAR_UNLOCK_URL', "URL ent-/sperren");
 define('ADMIN_CONFIG_SURFBAR_NOTE', "(*): Es sind auch die &Uuml;bertragungen der URLs aus der Mailbuchung einbezogen. Es wird empfohlen, die Ruhezeit etwas l&auml;nger als die Reload-Sperre einzustellen.");
 
+// General member text
+define('MEMBER_SURFBAR_URL_ADDED', "URL hinzugef&uuml;gt und wartet auf Freischaltung.");
+define('MEMBER_SURFBAR_URL_NOT_ADDED', "URL konnte nicht hinzugef&uuml;gt werden, da ein Fehler vorliegt.");
+define('MEMBER_SURFBAR_ADD_URL', "URL in Surfbar buchen");
+define('MEMBER_SURFBAR_NO_MORE_ALLOWED', "Sie k&ouml;nnen leider nicht mehr URLs in der Surfbar buchen, da Sie das Maximum erreicht haben.");
+
 // Subject lines for admins
 define('ADMIN_SURFBAR_NOTIFY_URL_UNLOCK_SUBJECT', "URL in Surfbar gebucht");
 define('ADMIN_SURFBAR_NOTIFY_URL_REG_SUBJECT', "Mitglied hat URL in Surfbar gebucht");
index 9e5202d..619579d 100644 (file)
@@ -68,8 +68,7 @@ class mxchange_cache
                                // Is there a .htaccess file?
                                if (file_exists($path.".htaccess")) {
                                        // Update database that we have tested it
-                                       $result = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_config SET cache_tested='1' WHERE config=0 LIMIT 1", __FILE__, __LINE__);
-                                       $this->ret="done";
+                                       UPDATE_CONFIG("cache_tested", 1);
 
                                        // All done!
                                        return "done";
index c439128..fb245f9 100644 (file)
@@ -12,7 +12,7 @@
  * -------------------------------------------------------------------- *
  *                                                                      *
  * -------------------------------------------------------------------- *
- * Copyright (c) 2003, 2004, 2005, 2006, 2007 by Roland Haeder          *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
index 72b8c8b..4c93156 100644 (file)
@@ -39,21 +39,50 @@ if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) {
 
 // Admin has added an URL with given user id
 function SURFBAR_ADMIN_ADD_URL ($url, $uid, $reward, $costs, $paymentId) {
-       // Is this really an admin?
+       // Do some pre-checks
        if (!IS_ADMIN()) {
-               // Then leave here
+               // Not an admin
                return false;
-       } // END - if
-
-       // Check if that URL does not exist
-       if (SURFBAR_LOOKUP_BY_URL($url, $uid)) {
-               // Already found!
+       } elseif (!VALIDATE_URL($url)) {
+               // URL invalid
                return false;
-       } // END - if
+       } elseif (SURFBAR_LOOKUP_BY_URL($url, $uid)) {
+               // URL already found in surfbar!
+               return false;
+       } elseif (!SURFBAR_IF_USER_BOOK_MORE_URLS($uid)) {
+               // No more allowed!
+               return false;
+       }
 
        // Register the new URL
        return SURFBAR_REGISTER_URL($url, $uid, $reward, $costs, $paymentId, "CONFIRMED", "unlock");
 }
+// Member has added an URL
+function SURFBAR_MEMBER_ADD_URL ($url) {
+       global $_CONFIG;
+
+       // Do some pre-checks
+       if (!IS_LOGGED_IN()) {
+               // Not a member
+               return false;
+       } elseif (!VALIDATE_URL($url)) {
+               // URL invalid
+               return false;
+       } elseif (SURFBAR_LOOKUP_BY_URL($url, $GLOBALS['userid'])) {
+               // URL already found in surfbar!
+               return false;
+       } elseif (!SURFBAR_IF_USER_BOOK_MORE_URLS()) {
+               // No more allowed!
+               return false;
+       }
+
+       // Do we have fixed or dynamic payment model?
+       $reward = SURFBAR_DETERMINE_REWARD();
+       $costs  = SURFBAR_DETERMINE_COSTS();
+
+       // Register the new URL
+       return SURFBAR_REGISTER_URL($url, $GLOBALS['userid'], $reward, $costs);
+}
 // Looks up by an URL
 function SURFBAR_LOOKUP_BY_URL ($url) {
        // Now lookup that given URL by itself
@@ -104,7 +133,7 @@ ORDER BY %s %s",
        return $lastUrlData;
 }
 // Registers an URL with the surfbar. You should have called SURFBAR_LOOKUP_BY_URL() first!
-function SURFBAR_REGISTER_URL ($url, $uid, $reward, $paymentId, $costs, $status="PENDING", $addMode="reg") {
+function SURFBAR_REGISTER_URL ($url, $uid, $reward, $costs, $paymentId=0, $status="PENDING", $addMode="reg") {
        global $_CONFIG;
 
        // Make sure by the user registered URLs are always pending
@@ -144,7 +173,7 @@ function SURFBAR_REGISTER_URL ($url, $uid, $reward, $paymentId, $costs, $status=
 // 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, costs, payment_id, status) VALUES(%s, '%s', %s, %s, %s, '%s')",
+       SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_surfbar_urls (userid, url, reward, costs, payment_id, status) VALUES(%s, '%s', %s, %s, %d, '%s')",
                array(
                        bigintval($urlData['uid']),
                        $urlData['url'],
@@ -206,6 +235,37 @@ function SURFBAR_TRANSLATE_STATUS ($status) {
        // Return result
        return $statusTranslated;
 }
+// Determine reward
+function SURFBAR_DETERMINE_REWARD () {
+       global $_CONFIG;
+
+       // Do we have static or dynamic?
+       if ($_CONFIG['surfbar_pay_model'] == "STATIC") {
+               // Static model, so choose static values
+               $reward = $_CONFIG['surfbar_static_reward'];
+       } else {
+               // Dynamic model, so calculate values
+               die("DYNAMIC payment model not yet supported!");
+       }
+
+       // Return reward
+       return $reward;
+}
+// Determine costs
+function SURFBAR_DETERMINE_COSTS () {
+       global $_CONFIG;
+
+       // Do we have static or dynamic?
+       if ($_CONFIG['surfbar_pay_model'] == "STATIC") {
+               $costs  = $_CONFIG['surfbar_static_costs'];
+       } else {
+               // Dynamic model, so calculate values
+               die("DYNAMIC payment model not yet supported!");
+       }
+
+       // Return costs
+       return $costs;
+}
 // Determine right template name
 function SURFBAR_DETERMINE_TEMPLATE_NAME() {
        // Default is the frameset
@@ -290,6 +350,43 @@ WHERE userid NOT IN (".implode(",", $UIDs).") AND status='%s'",
        // Return result
        return $cnt;
 }
+// Check wether the user is allowed to book more URLs
+function SURFBAR_IF_USER_BOOK_MORE_URLS ($uid=0) {
+       global $_CONFIG;
+
+       // Simply check it out
+       return (SURFBAR_GET_TOTAL_USER_URLS($uid) < $_CONFIG['surfbar_max_order']);
+}
+// Get total amount of URLs of given status for current user
+function SURFBAR_GET_TOTAL_USER_URLS ($uid=0) {
+       global $_CONFIG;
+
+       // Is the user 0 and user is logged in?
+       if (($uid == 0) && (IS_LOGGED_IN())) {
+               // Then use this userid
+               $uid = $GLOBALS['userid'];
+       } elseif ($uid == 0) {
+               // Error!
+               return ($_CONFIG['surfbar_max_order'] + 1);
+       }
+
+       // Get amount from database
+       $result = SQL_QUERY_ESC("SELECT COUNT(id) AS cnt
+FROM "._MYSQL_PREFIX."_surfbar_urls
+WHERE userid=%s
+LIMIT %s",
+               array($uid, $_CONFIG['surfbar_max_order']), __FILE__, __LINE__
+       );
+
+       // Fetch row
+       list($cnt) = SQL_FETCHROW($result);
+
+       // Free result
+       SQL_FREERESULT($result);
+
+       // Return result
+       return $cnt;
+}
 // Generate a validation code for the given id number
 function SURFBAR_GENERATE_VALIDATION_CODE ($id, $salt="") {
        global $_CONFIG, $SURFBAR_CACHE;
@@ -364,12 +461,39 @@ function SURFBAR_PAY_POINTS ($id) {
        //DEBUG_LOG(__FUNCTION__.":uid=".$GLOBALS['userid'].",reward=".SURFBAR_GET_REWARD()."");
        ADD_POINTS_REFSYSTEM($GLOBALS['userid'], SURFBAR_GET_DATA('reward'));
 }
-// Update the salt for validation
-function SURFBAR_UPDATE_SALT() {
+// Updates the statistics of current URL/userid
+function SURFBAR_UPDATE_INSERT_STATS_RECORD () {
+       global $_CONFIG;
+
        // 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__);
 
+       // Update the stats entry
+       SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_surfbar_stats SET count=count+1 WHERE userid=%s AND url_id=%s LIMIT 1",
+               array($GLOBALS['userid'], SURFBAR_GET_ID()), __FILE__, __LINE__);
+
+       // Was that update okay?
+       if (SQL_AFFECTEDROWS() == 0) {
+               // No, then insert entry
+               SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_surfbar_stats (userid,url_id,count) VALUES(%s,%s,1)",
+                       array($GLOBALS['userid'], SURFBAR_GET_ID()), __FILE__, __LINE__);
+       } // END - if
+
+       // Update total/daily/weekly/monthly counter
+       $_CONFIG['surfbar_total_counter']++;
+       $_CONFIG['surfbar_daily_counter']++;
+       $_CONFIG['surfbar_weekly_counter']++;
+       $_CONFIG['surfbar_monthly_counter']++;
+
+       // Update config as well
+       UPDATE_CONFIG(array("surfbar_total_counter", "surfbar_daily_counter", "surfbar_weekly_counter", "surfbar_monthly_counter"), array(1,1,1,1), "+");
+}
+// Update the salt for validation and statistics
+function SURFBAR_UPDATE_SALT_STATS () {
+       // Update statistics record
+       SURFBAR_UPDATE_INSERT_STATS_RECORD();
+
        // Simply store the salt from cache away in database...
        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__);
@@ -445,8 +569,8 @@ ORDER BY userid ASC", __FILE__, __LINE__);
                // Shall we add this to ignore?
                if ($points <= 0) {
                        // Ignore this one!
-                       $UIDs[] = $uid;
                        //DEBUG_LOG(__FUNCTION__.":uid={$uid} has depleted points amount!");
+                       $UIDs[] = $uid;
                } // END - if
        } // END - while
 
@@ -459,6 +583,23 @@ ORDER BY userid ASC", __FILE__, __LINE__);
        // Return result
        return $UIDs;
 }
+// Determine how many users are Online in surfbar
+function SURFBAR_DETERMINE_TOTAL_ONLINE () {
+       global $_CONFIG;
+
+       // Count all users in surfbar modue and return the value
+       $result = SQL_QUERY_ESC("SELECT COUNT(id) FROM "._MYSQL_PREFIX."_surfbar_stats WHERE (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(last_online)) >= %s",
+               array($_CONFIG['online_timeout']), __FILE__, __LINE__);
+
+       // Fetch count
+       list($cnt) = SQL_FETCHROW($result);
+
+       // Free result
+       SQL_FREERESULT($result);
+
+       // Return result
+       return $cnt;
+}
 // Determine next id for surfbar view, always call this before you call other
 // getters below this function!!!
 function SURFBAR_GET_NEXT_ID ($id = 0) {
@@ -606,18 +747,18 @@ LIMIT 1",
                        $SURFBAR_CACHE['last_surfed'] = "0";
                } // END - if
 
-               // Are we in static mode?
-               if ($_CONFIG['surfbar_pay_model'] == "STATIC") {
-                       // Then use static reward/costs!
-                       $SURFBAR_CACHE['reward'] = $_CONFIG['surfbar_static_reward'];
-                       $SURFBAR_CACHE['costs']  = $_CONFIG['surfbar_static_costs'];
-                       //DEBUG_LOG(__FUNCTION__.":FIXED - reward=".SURFBAR_GET_REWARD()."|costs=".SURFBAR_GET_COSTS()."");
-               } else {
+               // Get base/fixed reward and costs
+               $SURFBAR_CACHE['reward'] = SURFBAR_DETERMINE_REWARD();
+               $SURFBAR_CACHE['costs']  = SURFBAR_DETERMINE_COSTS();
+               //DEBUG_LOG(__FUNCTION__.":BASE/STATIC - reward=".SURFBAR_GET_REWARD()."|costs=".SURFBAR_GET_COSTS()."");
+
+               // Only in dynamic model add the dynamic bonus!
+               if ($_CONFIG['surfbar_pay_model'] == "DYNAMIC") {
                        // Calculate dynamic reward/costs and add it
                        $SURFBAR_CACHE['reward'] += SURFBAR_CALCULATE_DYNAMIC_REWARD_ADD();
                        $SURFBAR_CACHE['costs']  += SURFBAR_CALCULATE_DYNAMIC_COSTS_ADD();
-                       //DEBUG_LOG(__FUNCTION__.":DYNAMIC - reward=".SURFBAR_GET_REWARD()."|costs=".SURFBAR_GET_COSTS()."");
-               }
+                       //DEBUG_LOG(__FUNCTION__.":DYNAMIC+ - reward=".SURFBAR_GET_REWARD()."|costs=".SURFBAR_GET_COSTS()."");
+               } // END - if
 
                // Now get the id
                $nextId = SURFBAR_GET_ID();
index 1ca1045..c66ba0d 100644 (file)
@@ -75,6 +75,7 @@ if (EXT_IS_ACTIVE("cache")) {
        // Load language
        if ($cacheMode == "load") include(PATH."inc/language/cache_".GET_LANGUAGE().".php");
 } else {
+       // Cache extension not active
        $cacheMode = "no";
 }
 
@@ -87,15 +88,18 @@ if ($cacheMode == "load") {
 
        // Load extension data from cache file
        $EXT_DUMMY = $cacheInstance->cache_load();
+       $EXT_NAMES = array();
        foreach ($EXT_DUMMY['ext_name'] as $k=>$name) {
                // Load functions file
-               if ($EXT_DUMMY['ext_funcs'][$k] == "Y") require_once(PATH."inc/libs/".$name."_functions.php");
+               if ($EXT_DUMMY['ext_funcs'][$k] == "Y") {
+                       require_once(PATH."inc/libs/".$name."_functions.php");
+               } // END - if
 
                // Load Language file
                if ($EXT_DUMMY['ext_lang'][$k] == "Y") {
                        $INC = sprintf("%sinc/language/%s_%s.php", PATH, $name, GET_LANGUAGE());
                        if (file_exists($INC)) require_once($INC);
-               }
+               } // END - if
 
                // Load CSS file
                if ($EXT_DUMMY['ext_css'][$k] == "Y") $EXT_CSS_FILES[] = "".$name.".css";
@@ -103,26 +107,38 @@ if ($cacheMode == "load") {
                // Load extension file itself
                if (($EXT_DUMMY['ext_active'][$k] == "Y") || ($EXT_DUMMY['ext_keep'][$k] == "Y") || (IS_ADMIN())) {
                        require_once(PATH."inc/extensions/ext-".$name.".php");
-               }
+               } // END - if
 
-               // Transfer version number and active status
+               // Version number
                $EXT_DUMMY['ext_version'][$name] = $EXT_DUMMY['ext_version'][$k];
                unset($EXT_DUMMY['ext_version'][$k]);
+               // Extension is active
                $EXT_DUMMY['ext_active'][$name] = $EXT_DUMMY['ext_active'][$k];
                unset($EXT_DUMMY['ext_active'][$k]);
+               // Ext menu
                $EXT_DUMMY['ext_menu'][$name] = $EXT_DUMMY['ext_menu'][$k];
                unset($EXT_DUMMY['ext_menu'][$k]);
+               // Extension id
+               $EXT_DUMMY['ext_id'][$name] = $EXT_DUMMY['ext_id'][$k];
+               $id = $EXT_DUMMY['ext_id'][$name];
+               unset($EXT_DUMMY['ext_id'][$k]);
+
+               // Add ext name
+               $EXT_NAMES[$id] = $name;
+
+               // Mark it as active extension
                $cacheArray['active_extensions']['$name'] = $EXT_DUMMY['ext_keep'][$k];
                unset($EXT_DUMMY['ext_keep'][$k]);
-               $k2 = $EXT_DUMMY['ext_id'][$k];
-               $EXT_DUMMY['ext_id'][$k2] = $name;
-               if ($k2 != $k) unset($EXT_DUMMY['ext_id'][$k]);
 
                // Remove unneccessary data from memory
                unset($EXT_DUMMY['ext_lang'][$k]);
                unset($EXT_DUMMY['ext_css'][$k]);
                unset($EXT_DUMMY['ext_funcs'][$k]);
-       }
+       } // END - foreach
+
+       // Write dummy array back
+       $EXT_DUMMY['ext_name'] = $EXT_NAMES;
+       unset($EXT_NAMES);
 
        // Close cache file
        $cacheInstance->cache_close();
@@ -159,8 +175,7 @@ ORDER BY ext_name", __FILE__, __LINE__);
 $DEL = array();
 
 // At least one found?
-if ((SQL_NUMROWS($res_ext_crt) > 0) && (($cacheMode == "init") || ($cacheMode == "no")) && ($CSS != "1") && ($CSS != "-1"))
-{
+if ((SQL_NUMROWS($res_ext_crt) > 0) && (($cacheMode == "init") || ($cacheMode == "no")) && ($CSS != "1") && ($CSS != "-1")) {
        // Load theme management
        require_once(PATH."inc/theme-manager.php");
 
@@ -168,16 +183,12 @@ if ((SQL_NUMROWS($res_ext_crt) > 0) && (($cacheMode == "init") || ($cacheMode ==
        if ($cacheMode == "init") $cacheInstance->cache_init("EXTENSIONS");
 
        // Extensions are registered so we load them
-       while (list($EXT_ID, $name, $lang, $css, $active, $version) = SQL_FETCHROW($res_ext_crt))
-       {
+       while (list($EXT_ID, $name, $lang, $css, $active, $version) = SQL_FETCHROW($res_ext_crt)) {
                // Get menu entry
-               $result_menu = SQL_QUERY_ESC("SELECT has_menu FROM "._MYSQL_PREFIX."_mod_reg WHERE module='%s' LIMIT 1",
-                array($name), __FILE__, __LINE__);
-               list($menu) = SQL_FETCHROW($result_menu);
-               //* DEBUG: */ echo "*".$name."/".$menu."*<br>";
-
-               // An empty menu entry will be interpreted as N (no menu) to avoid problems
-               if (empty($menu)) $menu = "N";
+               $menu = "N";
+               if (MODULE_HAS_MENU($name)) {
+                       $menu = "Y";
+               } // END - if
 
                // Load extensions
                $file1 = sprintf("%sinc/extensions/ext-%s.php", PATH, $name);
@@ -185,71 +196,57 @@ if ((SQL_NUMROWS($res_ext_crt) > 0) && (($cacheMode == "init") || ($cacheMode ==
 
                // Special functions file
                $file3 = sprintf("%sinc/libs/%s_functions.php", PATH, $name);
+               echo $file3."<br />\n";
 
                // Does the extension file exists?
-               if (file_exists($file1) && is_readable($file1))
-               {
+               if (file_exists($file1) && is_readable($file1)) {
                        // If there's no language file specified we don't need to load one... ;-)
                        if (!empty($lang)) {
                                // Create language file
                                $file2 = sprintf("%sinc/language/%s_%s.php", PATH, $lang, GET_LANGUAGE());
                        }
 
-                       if (file_exists($file3) && is_readable($file3))
-                       {
+                       if (file_exists($file3) && is_readable($file3)) {
                                // Special functions file
                                $funcs = "Y";
                                require_once($file3);
-                       }
-                        else
-                       {
+                       } else {
                                // Don't load functions file
                                $funcs = "N";
                        }
 
                        // Do we need a language file?
-                       if (($file1 != $file2) && (file_exists($file2)) && (is_readable($file2)))
-                       {
+                       if (($file1 != $file2) && (file_exists($file2)) && (is_readable($file2))) {
                                // Load language file
                                $lang = "Y";
                                include($file2);
-                       }
-                        else
-                       {
+                       } else {
                                // Don't load language file
                                $lang = "N";
                        }
 
                        // Load extension
-                       if ($name != "sql_patches")
-                       {
+                       if ($name != "sql_patches")     {
                                // Load extension's file
                                include_once($file1);
-                       }
-                        else
-                       {
+                       } else {
                                // KEEP sql_patches ALWAYS ACTIVE!
                                $EXT_ALWAYS_ACTIVE = "Y";
                        }
 
-                       if ($css == "Y")
-                       {
+                       if ($css == "Y") {
                                $CSS_FILE = sprintf("%stheme/%s/css/%s.css", PATH, GET_CURR_THEME(), $name);
-                               if (file_exists($CSS_FILE))
-                               {
+                               if (file_exists($CSS_FILE)) {
                                        // CSS file for extension was found (use only relative path for now!)
                                        $EXT_CSS_FILES[] = $name.".css";
-                               }
-                                else
-                               {
+                               } else {
                                        // Don't load CSS file
                                        $css = "N";
                                }
-                       }
+                       } // END - if
 
                        // Add cache row
-                       if ($cacheMode == "init")
-                       {
+                       if ($cacheMode == "init") {
                                $cacheInstance->add_row(array(
                                        'ext_id'      => $EXT_ID,
                                        'ext_name'    => $name,
@@ -261,48 +258,39 @@ if ((SQL_NUMROWS($res_ext_crt) > 0) && (($cacheMode == "init") || ($cacheMode ==
                                        'ext_version' => $version,
                                        'ext_keep'    => $EXT_ALWAYS_ACTIVE,
                                ));
-                       }
-                        elseif ($cacheMode == "no")
-                       {
+                       } elseif ($cacheMode == "no") {
                                // Remember this value for later usage
                                $cacheArray['active_extensions'][$name] = $EXT_ALWAYS_ACTIVE;
                        }
-               }
-                elseif (!file_exists($file1))
-               {
+               } elseif (!file_exists($file1)) {
                        // Deleted extension file so we mark it for removal from DB
                        $DEL[] = $name;
                }
-       }
+       } // END - while
 
-       if ($cacheMode == "init")
-       {
+       if ($cacheMode == "init") {
                // Close cache file
                $cacheInstance->cache_close();
 
                // Load more cache files (like admins)
                require_once(PATH."inc/load_cache.php");
-       }
+       } // END - if
 }
 
 // Free memory
 SQL_FREERESULT($res_ext_crt);
 
 // Load include files
-if (!empty($INC_POOL[0]))
-{
-       foreach ($INC_POOL as $inc)
-       {
+if (!empty($INC_POOL[0])) {
+       foreach ($INC_POOL as $inc) {
                require_once($inc);
-       }
-}
+       } // END - foreach
+} // END - if
 
 // Uninstall extensions that are no longer in our system
-if (!empty($DEL[0]))
-{
+if (!empty($DEL[0])) {
        // Remove extensions from two tables: extension registry and tasks table
-       foreach ($DEL as $name)
-       {
+       foreach ($DEL as $name) {
                // First remove entry from extensions table
                $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_extensions WHERE ext_name='%s' LIMIT 1",
                 array($name), __FILE__, __LINE__);
@@ -310,10 +298,11 @@ if (!empty($DEL[0]))
                // Remove (maybe?) found tasks (main task and possible updates
                $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_task_system WHERE subject LIKE '[%s:] %' AND (task_type='EXTENSION' OR task_type='EXTENSION_UPDATE')",
                 array($name), __FILE__, __LINE__);
-       }
+       } // END - foreach
 
        // I think it's not neccessary to run the optimization function here
        // because we didn't delete so much data from database. Can you aggree?
-}
+} // END - if
+
 //
 ?>
index 44991df..ca5adfa 100644 (file)
@@ -47,7 +47,7 @@ if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))
 if ($CSS == 1) return;
 
 // Create timemark from saved month
-$mark = mktime(0, 0, 0, $_CONFIG['beg_month'], date("d", time()), date('Y', time()));
+$mark = mktime(0, 0, 0, $_CONFIG['last_month'], date("d", time()), date('Y', time()));
 $SQL = ""; $MODE = "";
 
 // Shall I sent activation or deactivation mail?
index 43a382d..44ab9f5 100644 (file)
@@ -47,7 +47,7 @@ if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))
 if ($CSS == 1) return;
 
 // Create timemark from saved month
-$mark = mktime(0, 0, 0, $_CONFIG['bonus_month'], date("d", time()), date('Y', time()));
+$mark = mktime(0, 0, 0, $_CONFIG['last_month'], date("d", time()), date('Y', time()));
 $SQL = ""; $MODE = "";
 
 // Shall I sent activation or deactivation mail?
index 604abdf..a117d14 100644 (file)
@@ -150,7 +150,7 @@ if (!isBooleanConstantAndTrue('admin_registered')) {
                LOAD_TEMPLATE("admin_settings_saved", false, $OUT);
        } elseif (!empty($_GET['hash'])) {
                // Output form for hash validation
-               LOAD_TEMPLATE("admin_validate_reset_hash_form", false, SQL_ESCAPE($_GET['hash']));
+               LOAD_TEMPLATE("admin_validate_reset_hash_form", false, $_GET['hash']);
        } elseif ((isset($_POST['validate_hash'])) && (!empty($_POST['login'])) && (!empty($_POST['hash']))) {
                // Validate the login data and hash
                $valid = ADMIN_VALIDATE_RESET_LINK_HASH_LOGIN($_POST['hash'], $_POST['login']);
@@ -333,12 +333,12 @@ if (!isBooleanConstantAndTrue('admin_registered')) {
        }
 } else {
        // Maybe an Admin want's to login?
-       $ret = CHECK_ADMIN_COOKIES(SQL_ESCAPE(get_session('admin_login')), SQL_ESCAPE(get_session('admin_md5')));
+       $ret = CHECK_ADMIN_COOKIES(get_session('admin_login'), get_session('admin_md5'));
        switch ($ret)
        {
        case "done":
                // Cookie-Data accepted
-               if ((set_session("admin_md5", SQL_ESCAPE(get_session('admin_md5')))) && (set_session("admin_login", SQL_ESCAPE(get_session('admin_login')))) && (set_session("admin_last", time())) && (set_session("admin_to", bigintval(get_session('admin_to'))))) {
+               if ((set_session("admin_md5", get_session('admin_md5'))) && (set_session("admin_login", get_session('admin_login'))) && (set_session("admin_last", time())) && (set_session("admin_to", bigintval(get_session('admin_to'))))) {
                        // Ok, Cookie-Update done
                        if ((EXT_IS_ACTIVE("admins")) && (GET_EXT_VERSION("admins") > "0.2")) {
                                // Check if action GET variable was set
index c68fa76..4f657c6 100644 (file)
@@ -12,7 +12,7 @@
  * -------------------------------------------------------------------- *
  *                                                                      *
  * -------------------------------------------------------------------- *
- * Copyright (c) 2003, 2004, 2005, 2006, 2007 by Roland Haeder          *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
index 5ac0fe9..d4964c6 100644 (file)
@@ -12,7 +12,7 @@
  * -------------------------------------------------------------------- *
  *                                                                      *
  * -------------------------------------------------------------------- *
- * Copyright (c) 2003, 2004, 2005, 2006, 2007 by Roland Haeder          *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
index 7ef2e0a..6b22d9b 100644 (file)
@@ -283,7 +283,7 @@ function ADMIN_DO_ACTION($wht)
        $act = GET_ACTION($GLOBALS['module'], $wht);
 
        // Define admin login name and ID number
-       define('__ADMIN_LOGIN', SQL_ESCAPE(get_session('admin_login')));
+       define('__ADMIN_LOGIN', get_session('admin_login'));
        define('__ADMIN_ID'   , GET_ADMIN_ID(get_session('admin_login')));
 
        // Preload templates
index f5e1bd3..209036a 100644 (file)
@@ -12,7 +12,7 @@
  * -------------------------------------------------------------------- *
  *                                                                      *
  * -------------------------------------------------------------------- *
- * Copyright (c) 2003, 2004, 2005, 2006, 2007 by Roland Haeder          *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
index 2f52640..28f5952 100644 (file)
@@ -68,12 +68,11 @@ case "settings": // Settings related to the index page
        break;
 
 case "target": // Set which what-file will be placed in home-page (only modules.php?module=index)
-       if (isset($_GET['home']))
-       {
+       if (isset($_GET['home'])) {
                // Set new home
-               $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET index_home='%s' WHERE config=0 LIMIT 1", array($_GET['home']), __FILE__, __LINE__);
-               $_CONFIG['index_home'] = $_GET['home'];
-       }
+               UPDATE_CONFIG("index_home", $_GET['home']);
+               $_CONFIG['index_home'] = SQL_ESCAPE($_GET['home']);
+       } // END - if
 
        // Load all what menu points
        $result = SQL_QUERY("SELECT id, what, title
index c986d65..1cd75f1 100644 (file)
@@ -12,7 +12,7 @@
  * -------------------------------------------------------------------- *
  *                                                                      *
  * -------------------------------------------------------------------- *
- * Copyright (c) 2003, 2004, 2005, 2006, 2007 by Roland Haeder          *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -59,7 +59,9 @@ if (isset($_POST['ok'])) {
                'surfbar_restart_time'    => $_CONFIG['surfbar_restart_time'],
                'surfbar_static_lock'     => $_CONFIG['surfbar_static_lock'],
                'surfbar_dynamic_percent' => TRANSLATE_COMMA($_CONFIG['surfbar_dynamic_percent']),
-               'surfbar_max_order'       => $_CONFIG['surfbar_max_order']
+               'surfbar_max_order'       => $_CONFIG['surfbar_max_order'],
+               // @TODO Rewrite this to tiny selection boxes
+               'surfbar_stats_reload'    => $_CONFIG['surfbar_stats_reload']
        );
 
        // Prepare payment model for template
index 67926c0..afc6135 100644 (file)
@@ -48,8 +48,7 @@ if ($_CONFIG['beg_rallye'] == "Y")
                // Okay, let's prepare...
                $curr = date("m", time()) - 1;
                if (strlen($curr) == 1) $curr = "0".$curr;
-               $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET beg_month='%s' WHERE config=0 LIMIT 1",
-                array($curr), __FILE__, __LINE__);
+               UPDATE_CONFIG("last_month", $curr);
                LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_BEG_WITHDRAW_PREPARED);
                OUTPUT_HTML("<br />");
        }
@@ -106,7 +105,7 @@ ORDER BY beg_points DESC, last_online DESC, userid",
                define('__TOTAL', TRANSLATE_COMMA($total));
 
                // Check if we need to display form or not with manuel withdraw
-               if ($_CONFIG['beg_month'] == date("m", time()))
+               if ($_CONFIG['last_month'] == date("m", time()))
                {
                        // Load form
                        define('__BEG_WITHDRAW_FORM', LOAD_TEMPLATE("admin_list_beg_form", true));
index 721ee92..caefd30 100644 (file)
@@ -40,22 +40,18 @@ if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!is_admin()))
 // Add description as navigation point
 ADD_DESCR("admin", basename(__FILE__));
 
-if ($_CONFIG['bonus_active'] == "Y")
-{
+if ($_CONFIG['bonus_active'] == "Y") {
        // Shall I withdraw now?
-       if (isset($_POST['withdraw']))
-       {
+       if (isset($_POST['withdraw'])) {
                // Okay, let's prepare...
                $curr = date("m", time()) - 1;
                if (strlen($curr) == 1) $curr = "0".$curr;
-               $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET last_bonus_month='%s' WHERE config=0 LIMIT 1",
-                array($curr), __FILE__, __LINE__);
+               UPDATE_CONFIG("last_month", $curr);
                LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_BONUS_WITHDRAW_PREPARED);
                OUTPUT_HTML("<br />");
        }
 
-       if (GET_EXT_VERSION("bonus") >= "0.6.9")
-       {
+       if (GET_EXT_VERSION("bonus") >= "0.6.9") {
                // Add more bonus points here
                $USE = "(0";
                if ($_CONFIG['bonus_click_yn'] == "Y") $USE .= " + turbo_bonus";
@@ -64,17 +60,14 @@ if ($_CONFIG['bonus_active'] == "Y")
                if ($_CONFIG['bonus_stats_yn'] == "Y") $USE .= " + bonus_stats";
                if ($_CONFIG['bonus_ref_yn']   == "Y") $USE .= " + bonus_ref";
                $USE .= ")";
-       }
-        else
-       {
+       } else {
                // Old version ???
                $USE = "turbo_bonus";
        }
 
        // Autopurge installed?
        $LAST = "%s"; $ONLINE = "";
-       if (EXT_IS_ACTIVE("autopurge"))
-       {
+       if (EXT_IS_ACTIVE("autopurge")) {
                // Use last online timestamp to keep inactive members away from here
                $LAST   = " AND last_online >= %s";
                $ONLINE = bigintval(time() - $_CONFIG['ap_in_since']);
@@ -87,20 +80,19 @@ WHERE status='CONFIRMED' AND ".$USE." > 0".$LAST."
 ORDER BY active_bonus DESC, last_online DESC, userid",
         array($ONLINE), __FILE__, __LINE__);
 
-       if (SQL_NUMROWS($result) > 0)
-       {
+       if (SQL_NUMROWS($result) > 0) {
                // List users
                $OUT = "";$SW = 2; $cnt = 1; $total = 0;
-               while(list($uid, $email, $sex, $sname, $fname, $turbo, $last) = SQL_FETCHROW($result))
-               {
+               while(list($uid, $email, $sex, $sname, $fname, $turbo, $last) = SQL_FETCHROW($result)) {
                        // Generate array fore the dynamic template
                        $WIN1 = ""; $WIN2 = "";
-                       if ($cnt <= $_CONFIG['bonus_ranks'])
-                       {
+                       if ($cnt <= $_CONFIG['bonus_ranks']) {
                                // Maybe he can win his active bonus?
                                $WIN1 = "<STRONG>";
                                $WIN2 = "</STRONG>";
                        }
+
+                       // Prepare content
                        $content = array(
                                'uid'   => $uid,
                                'email' => CREATE_EMAIL_LINK($email, "user_data"),
@@ -123,7 +115,7 @@ ORDER BY active_bonus DESC, last_online DESC, userid",
                define('__TOTAL', TRANSLATE_COMMA($total));
 
                // Check if we need to display form or not with manuel withdraw
-               if ($_CONFIG['bonus_month'] == date("m", time()))
+               if ($_CONFIG['last_month'] == date("m", time()))
                {
                        // Load form
                        define('__BONUS_WITHDRAW_FORM', LOAD_TEMPLATE("admin_list_bonus_form", true));
index 0ec2e77..839bce0 100644 (file)
@@ -12,7 +12,7 @@
  * -------------------------------------------------------------------- *
  *                                                                      *
  * -------------------------------------------------------------------- *
- * Copyright (c) 2003, 2004, 2005, 2006, 2007 by Roland Haeder          *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
index 9c3c176..02c0b65 100644 (file)
@@ -12,7 +12,7 @@
  * -------------------------------------------------------------------- *
  *                                                                      *
  * -------------------------------------------------------------------- *
- * Copyright (c) 2003, 2004, 2005, 2006, 2007 by Roland Haeder          *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
index 3b0bd43..e2d3e6a 100644 (file)
@@ -32,8 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN()))
-{
+if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN())) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
@@ -58,14 +57,11 @@ if (isset($_POST['ok']))
        }
 
        // Update config
-       $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET maintenance='%s' WHERE config=0 LIMIT 1",
-        array($target_mode), __FILE__, __LINE__);
+       UPDATE_CONFIG("maintenance", $target_mode);
 
        // Load template
        LOAD_TEMPLATE("admin_settings_saved", false, $out);
-}
- else
-{
+} else {
        switch ($_CONFIG['maintenance'])
        {
        case 'Y': // Maintenance mode is active
@@ -79,5 +75,6 @@ if (isset($_POST['ok']))
        // Display form
        LOAD_TEMPLATE("admin_maintenance_form");
 }
+
 //
 ?>
diff --git a/inc/modules/admin/what-unlock_surfbar_urls.php b/inc/modules/admin/what-unlock_surfbar_urls.php
new file mode 100644 (file)
index 0000000..c1d2d52
--- /dev/null
@@ -0,0 +1,44 @@
+<?php
+/************************************************************************
+ * MXChange v0.2.1                                    Start: 09/08/2008 *
+ * ================                             Last change: 09/08/2008 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : what-unlock_surfbar_urls.php                     *
+ * -------------------------------------------------------------------- *
+ * Short description : Unlock pending URLs for surfbar                  *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : Wartende URLs in der Surfbar freigeben           *
+ * -------------------------------------------------------------------- *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
+ * 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 ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!is_admin())) {
+       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
+       require($INC);
+}
+
+// Add description as navigation point
+ADD_DESCR("admin", basename(__FILE__));
+
+//
+?>
index 4475fed..ef1104e 100644 (file)
@@ -12,7 +12,7 @@
  * -------------------------------------------------------------------- *
  *                                                                      *
  * -------------------------------------------------------------------- *
- * Copyright (c) 2003, 2004, 2005, 2006, 2007 by Roland Haeder          *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
index c10ba15..38264c4 100644 (file)
@@ -12,7 +12,7 @@
  * -------------------------------------------------------------------- *
  *                                                                      *
  * -------------------------------------------------------------------- *
- * Copyright (c) 2003, 2004, 2005, 2006, 2007 by Roland Haeder          *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
index a030f9e..ec2317c 100644 (file)
@@ -52,12 +52,9 @@ $total      = SQL_NUMROWS($result_guests) + SQL_NUMROWS($result_members) + SQL_N
 if ($_CONFIG['mad_counter'] < $total)
 {
        // Update counter
+       UPDATE_CONFIG(array("mad_timestamp", "mad_count"), array(time(), $total));
        $_CONFIG['mad_counter'] = $total;
        $_CONFIG['last_mad']    = time();
-       $result_mad = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET mad_timestamp=%s, mad_count='%s' WHERE config=0 LIMIT 1",
-        array($_CONFIG['last_mad'], $_CONFIG['mad_counter']), __FILE__, __LINE__);
-
-       // Destroy cache
 }
 
 // Put all values in constants for the template
index 8178d82..8c493c0 100644 (file)
@@ -59,14 +59,13 @@ if ($status != "CONFIRMED") {
        }
        $URL = URL."/modules.php?module=index&login=".$ERROR;
        LOAD_URL($URL);
-}
+} // END - if
 
 // Recheck if he got logged out because bad cookies
-if (!IS_LOGGED_IN())
-{
+if (!IS_LOGGED_IN()) {
        $URL = URL."/modules.php?module=index";
        LOAD_URL($URL);
-}
+} // END - if
 
 // Load adverstising template
 define('__MEMBER_ADVERT', LOAD_TEMPLATE("member_banner", true));
index 033f7ee..456ce52 100644 (file)
@@ -12,7 +12,7 @@
  * -------------------------------------------------------------------- *
  *                                                                      *
  * -------------------------------------------------------------------- *
- * Copyright (c) 2003, 2004, 2005, 2006, 2007 by Roland Haeder          *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
index 8c80afd..27fc07b 100644 (file)
@@ -12,7 +12,7 @@
  * -------------------------------------------------------------------- *
  *                                                                      *
  * -------------------------------------------------------------------- *
- * Copyright (c) 2003, 2004, 2005, 2006, 2007 by Roland Haeder          *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
index 9a3c110..92b7347 100644 (file)
@@ -12,7 +12,7 @@
  * -------------------------------------------------------------------- *
  *                                                                      *
  * -------------------------------------------------------------------- *
- * Copyright (c) 2003, 2004, 2005, 2006, 2007 by Roland Haeder          *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
index 9755479..646a0a8 100644 (file)
@@ -111,15 +111,12 @@ case "show": // Show his data
        break;
 
 case "edit": // Edit data
-       if (EXT_IS_ACTIVE("country", true))
-       {
+       if (EXT_IS_ACTIVE("country", true)) {
                // New way                         0        1         2          3         4     5     6        7           8            9       10      11           12           13
                $result = SQL_QUERY_ESC("SELECT surname, family, street_nr, country_code, zip, city, email, birth_day, birth_month, birth_year, sex, max_mails, receive_mails, last_update
 FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1",
                 array(UID_VALUE), __FILE__, __LINE__);
-       }
-        else
-       {
+       } else {
                // Old way                         0        1         2        3      4     5     6        7           8            9       10      11           12           13
                $result = SQL_QUERY_ESC("SELECT surname, family, street_nr, country, zip, city, email, birth_day, birth_month, birth_year, sex, max_mails, receive_mails, last_update
 FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1",
diff --git a/inc/modules/member/what-surfbar_book.php b/inc/modules/member/what-surfbar_book.php
new file mode 100644 (file)
index 0000000..13c7651
--- /dev/null
@@ -0,0 +1,83 @@
+<?php
+/************************************************************************
+ * MXChange v0.2.1                                    Start: 09/08/2008 *
+ * ================                             Last change: 09/08/2008 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : what-surfbar_book.php                            *
+ * -------------------------------------------------------------------- *
+ * Short description : Members can book new URLs here                   *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : Mitglieder koennen URLs buchen                   *
+ * -------------------------------------------------------------------- *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
+ * 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 (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) {
+       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
+       require($INC);
+} elseif (!IS_LOGGED_IN()) {
+       // Redirect
+       LOAD_URL(URL."/modules.php?module=index");
+} elseif (!EXT_IS_ACTIVE("surfbar")) {
+       // Extension "surfbar" is not active
+       ADD_FATAL(EXTENSION_PROBLEM_EXT_INACTIVE, "surfbar");
+       return;
+}
+
+// Add description as navigation point
+ADD_DESCR("member", basename(__FILE__));
+
+// Still allowed to book more URLs?
+if (!SURFBAR_IF_USER_BOOK_MORE_URLS()) {
+       // No more URLs allowed to book!
+       LOAD_TEMPLATE("admin_settings_saved", false, MEMBER_SURFBAR_NO_MORE_ALLOWED);
+} elseif (isset($_POST['ok'])) {
+       // Register the new URL
+       $insertId = SURFBAR_MEMBER_ADD_URL($_POST['url']);
+
+       // Was this fine?
+       if ($insertId > 0) {
+               // URL added and waiting for unlock
+               $msg = MEMBER_SURFBAR_URL_ADDED;
+       } else {
+               // Something went wrong!
+               $msg = MEMBER_SURFBAR_URL_NOT_ADDED;
+       }
+
+       // Load message template
+       LOAD_TEMPLATE("admin_settings_saved", false, $msg);
+} else {
+       // Prepare some content
+       $content = array(
+               'reward'     => TRANSLATE_COMMA(SURFBAR_DETERMINE_REWARD()),
+               'costs'      => TRANSLATE_COMMA(SURFBAR_DETERMINE_COSTS()),
+               'max_order'  => $_CONFIG['surfbar_max_order'],
+               'curr_order' => SURFBAR_GET_TOTAL_USER_URLS()
+       );
+
+       // Load surfbar order form
+       LOAD_TEMPLATE(sprintf("member_surfbar_book_%s", strtolower($_CONFIG['surfbar_pay_model'])), false, $content);
+}
+
+//
+?>
index b90d08d..65dddf0 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /************************************************************************
  * MXChange v0.2.1                                    Start: 09/05/2008 *
- * ================                             Last change: 09/05/2008 *
+ * ================                             Last change: 09/08/2008 *
  *                                                                      *
  * -------------------------------------------------------------------- *
  * File              : what-surfbar_start.php                           *
@@ -12,7 +12,7 @@
  * -------------------------------------------------------------------- *
  *                                                                      *
  * -------------------------------------------------------------------- *
- * Copyright (c) 2003, 2004, 2005, 2006, 2007 by Roland Haeder          *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -36,7 +36,12 @@ if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 } elseif (!IS_LOGGED_IN()) {
-       LOAD_URL(URL."/modules.php?module=index");
+       // Not logged in
+       LOAD_URL("modules.php?module=index");
+} elseif (!EXT_IS_ACTIVE("surfbar")) {
+       // Extension "surfbar" is not active
+       ADD_FATAL(EXTENSION_PROBLEM_EXT_INACTIVE, "surfbar");
+       return;
 }
 
 // Add description as navigation point
@@ -50,11 +55,8 @@ $content = array(
        'surfbar_dynamic_percent' => TRANSLATE_COMMA($_CONFIG['surfbar_dynamic_percent'])
 );
 
-// Construct template name
-$templateName = "member_".substr(basename(__FILE__), 5, -4)."_".strtolower($_CONFIG['surfbar_pay_model']);
-
 // Load the template
-LOAD_TEMPLATE($templateName, false, $content);
+LOAD_TEMPLATE("member_start_".strtolower($_CONFIG['surfbar_pay_model']), false, $content);
 
 // Load surfbar link template
 LOAD_TEMPLATE("member_surfbar_link");
index 67c5a7f..2dd861a 100644 (file)
  * -------------------------------------------------------------------- *
  *                                                                      *
  * -------------------------------------------------------------------- *
- * Copyright (c) 2003, 2004, 2005, 2006, 2007 by Roland Haeder          *                                
- * 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                                                  *                                
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
+ * 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...
index d5afb1c..579f4de 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);
-}
- elseif ((!EXT_IS_ACTIVE("beg")) && (!IS_ADMIN()))
-{
+} elseif ((!EXT_IS_ACTIVE("beg")) && (!IS_ADMIN())) {
        ADD_FATAL(EXTENSION_PROBLEM_EXT_INACTIVE, "beg");
        return;
 }
 
 // Do not execute when script is in CSS mode or no daily reset
-if (($CSS == 1) || (!isBooleanConstantAndTrue('__DAILY_RESET'))) return;
+if (($CSS == 1) || (!isBooleanConstantAndTrue('__DAILY_RESET')) || ($_CONFIG['beg_rallye'] == "N")) return;
 
 // Get current month (2 digits)
 $curr = date("m", time());
 
 // Check if month is done
-if (($curr != $_CONFIG['beg_month']) && ($_CONFIG['beg_month'] > 0) && ($_CONFIG['beg_ranks'] > 0) && ($CSS != 1))
+if (($curr != $_CONFIG['last_month']) && ($_CONFIG['last_month'] > 0) && ($_CONFIG['beg_ranks'] > 0) && ($CSS != 1))
 {
        // Extension "autopurge" is inactive or purging of inactive accounts is deactivated
        $whereStatement1 = "";
@@ -113,13 +110,7 @@ SET points=points+%s WHERE ref_depth=0 AND userid=%s LIMIT 1",
 
        // Free memory
        SQL_FREERESULT($result_main);
-
-       // Finally update database and config array
-       $_CONFIG['beg_month'] = $curr;
-       $result_update = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET beg_month='%s' WHERE config=0 LIMIT 1",
-        array($curr), __FILE__, __LINE__);
-
-       // Destroy cache
 }
+
 //
 ?>
index b555dd3..f4e465f 100644 (file)
@@ -49,7 +49,7 @@ if (($CSS == 1) || (!isBooleanConstantAndTrue('__DAILY_RESET'))) return;
 // Get current month (2 digits)
 $curr = date("m", time());
 
-if (($curr != $_CONFIG['bonus_month']) && ($_CONFIG['bonus_ranks'] > 0) && ($CSS != 1))
+if (($curr != $_CONFIG['last_month']) && ($_CONFIG['bonus_ranks'] > 0) && ($CSS != 1))
 {
        // Extension "autopurge" is inactive or purging of inactive accounts is deactivated
        $whereStatement1 = "WHERE status='CONFIRMED'";
@@ -126,13 +126,7 @@ SET turbo_bonus=0, login_bonus=0, bonus_order=0, bonus_stats=0, bonus_ref=0", __
 
        // Free memory
        SQL_FREERESULT($result_main);
-
-       // Finally update database and config array
-       $_CONFIG['bonus_month'] = $curr;
-       $result_update = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET last_bonus_month='%s' WHERE config=0 LIMIT 1",
-        array($curr), __FILE__, __LINE__);
-
-       // Destroy cache
 }
+
 //
 ?>
index a23eea9..ed7eb92 100644 (file)
@@ -49,7 +49,7 @@ if (($CSS == 1) || (!isBooleanConstantAndTrue('__DAILY_RESET'))) return;
 // Get current month (2 digits)
 $curr = date("m", time());
 
-if ($_CONFIG['nl_month'] != $curr)
+if ($_CONFIG['last_month'] != $curr)
 {
        // Check for unsubscribed members
        $result = SQL_QUERY("SELECT userid, nl_until FROM "._MYSQL_PREFIX."_user_data WHERE nl_receive='N' ORDER BY userid", __FILE__, __LINE__);
@@ -72,12 +72,6 @@ if ($_CONFIG['nl_month'] != $curr)
 
                // Free memory
                SQL_FREERESULT($result);
-
-               // Update last month
-               $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_config SET nl_month='%s' WHERE config=0 LIMIT 1",
-                array($curr), __FILE__, __LINE__);
-
-               // Destroy cache
        }
 }
 
diff --git a/inc/monthly/monthly_surfbar.php b/inc/monthly/monthly_surfbar.php
new file mode 100644 (file)
index 0000000..cdcf160
--- /dev/null
@@ -0,0 +1,51 @@
+<?php
+/************************************************************************
+ * MXChange v0.2.1                                    Start: 09/08/2008 *
+ * ===============                              Last change: 09/08/2008 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : monthly_surfbar.php                              *
+ * -------------------------------------------------------------------- *
+ * Short description :                                                  *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  :                                                  *
+ * -------------------------------------------------------------------- *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
+ * 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 (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) {
+       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
+       require($INC);
+} elseif ((!EXT_IS_ACTIVE("surfbar")) && (!IS_ADMIN())) {
+       ADD_FATAL(EXTENSION_PROBLEM_EXT_INACTIVE);
+       return;
+}
+
+// Do not execute when script is in CSS mode or no daily reset
+if (($CSS == 1) || (defined('__DAILY_RESET'))) return;
+
+// Reset surfbar counter
+UPDATE_CONFIG("surfbar_monthly_counter", "0");
+$_CONFIG['surfbar_monthly_counter'] = 0;
+
+//
+?>
diff --git a/inc/monthly_newsletter.php b/inc/monthly_newsletter.php
deleted file mode 100644 (file)
index 018f57f..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-/************************************************************************
- * MXChange v0.2.1                                    Start: 03/04/2005 *
- * ===============                              Last change: 03/04/2005 *
- *                                                                      *
- * -------------------------------------------------------------------- *
- * File              : monthly_newsletter.php                           *
- * -------------------------------------------------------------------- *
- * Short description : Monthly check for newsletter unsubscriptions     *
- * -------------------------------------------------------------------- *
- * Kurzbeschreibung  : Monatlicher Test auf Newsletter-Abmeldungen      *
- * -------------------------------------------------------------------- *
- *                                                                      *
- * -------------------------------------------------------------------- *
- * Copyright (c) 2003 - 2008 by Roland Haeder                           *
- * 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 (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))
-{
-       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
-       require($INC);
-}
-
-// Check for unsubscribed members
-$result = SQL_QUERY("SELECT userid, nl_until FROM "._MYSQL_PREFIX."_user_data WHERE nl_receive='N' ORDER BY userid", __FILE__, __LINE__);
-if (SQL_NUMROWS($result) > 0)
-{
-       // Some unsubscriptions are found so we reset them to receive newsletters
-       while(list($uid, $until) = SQL_FETCHROW($result))
-       {
-               // Update account
-               $result = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_user_data SET nl_receive='Y', nl_until='0' WHERE userid='".$uid."' LIMIT 1", __FILE__, __LINE__);
-
-               // Send email to him
-               $msg = LOAD_EMAIL_TEMPLATE("member_newsletter_reset", true, $uid);
-               SEND_EMAIL($uid, NL_MEMBER_RESET_SUBJECT, $msg);
-
-               // Send email to admin
-               SEND_ADMIN_NOTIFICATION(NL_ADMIN_SUBJECT, "admin_newsletter_reset", "", $GLOBALS['userid']);
-       }
-}
-
-//
-?>
index 9cd96c8..0bc771c 100644 (file)
@@ -106,7 +106,7 @@ LIMIT 1", __FILE__, __LINE__);
                                                // Something went wrong
                                                ADD_FATAL(FATAL_CANNOT_LOAD_CONFIG);
                                                return;
-                                       }
+                                       } // END - if
 
                                        // Load the configuration
                                        $_CONFIG = array_merge($_CONFIG, SQL_FETCHARRAY($result));
@@ -114,15 +114,6 @@ LIMIT 1", __FILE__, __LINE__);
                                        // Initialize include-file-pool
                                        $INC_POOL = array();
 
-                                       // Run daily reset
-                                       if ((date("d", $_CONFIG['last_update']) != date("d", time()) || ((isBooleanConstantAndTrue('DEBUG_MODE')))) && (!isBooleanConstantAndTrue('mxchange_installing')) && (isBooleanConstantAndTrue('mxchange_installed')) && (isBooleanConstantAndTrue('admin_registered')) && (!isset($_GET['register'])) && ($CSS != 1)) {
-                                               // Do daily things in external PHP file but only when script is completely setup
-                                               $INC_POOL[] = sprintf("%sinc/reset/reset_daily.php", PATH);
-
-                                               // Daily reset was run!
-                                               define('__DAILY_RESET', "1");
-                                       }
-
                                        // Load "databases" aka static arrays
                                        require_once(PATH."inc/databases.php");
 
@@ -132,11 +123,29 @@ LIMIT 1", __FILE__, __LINE__);
                                        // Functions which are related to themes
                                        require_once(PATH."inc/theme-manager.php");
 
+                                       // Run daily reset
+                                       if ((date("d", $_CONFIG['last_update']) != date("d", time()) || ((isBooleanConstantAndTrue('DEBUG_MODE')))) && (!isBooleanConstantAndTrue('mxchange_installing')) && (isBooleanConstantAndTrue('mxchange_installed')) && (isBooleanConstantAndTrue('admin_registered')) && (!isset($_GET['register'])) && ($CSS != 1)) {
+                                               // Do daily things in external PHP file but only when script is completely setup
+                                               $INC_POOL = array();
+                                               $INC_POOL[] = sprintf("%sinc/reset/reset_daily.php", PATH);
+
+                                               // Daily reset was run!
+                                               define('__DAILY_RESET', true);
+
+                                               // Add more includes
+                                               RESET_ADD_INCLUDES();
+
+                                               // Run the full reset scripts
+                                               foreach ($INC_POOL as $incFile) {
+                                                       require_once($incFile);
+                                               } // END - foreach
+                                       } // END - if
+
                                        // Load admin include file if he is admin
                                        if (IS_ADMIN()) {
                                                // Administrative functions
                                                require_once(PATH."inc/modules/admin/admin-inc.php");
-                                       }
+                                       } // END - if
 
                                        // Get all values
                                        if (($CSS != 1) && ($CSS != -1)) {
index f87c4c4..a519c79 100644 (file)
@@ -400,8 +400,8 @@ function IS_ADMIN($admin="")
        // If admin login is not given take current from cookies...
        if ((empty($admin)) && (isSessionVariableSet('admin_login')) && (isSessionVariableSet('admin_md5'))) {
                // Get admin login and password from session/cookies
-               $admin = SQL_ESCAPE(get_session('admin_login'));
-               $passCookie = SQL_ESCAPE(get_session('admin_md5'));
+               $admin = get_session('admin_login');
+               $passCookie = get_session('admin_md5');
        }
        //* DEBUG: */ echo __LINE__."ADMIN:".$admin."/".$passCookie."<br />";
 
@@ -629,7 +629,7 @@ function UPDATE_LOGIN_DATA ($UPDATE=true) {
                // Maybe first login time?
                if (empty($mod)) $mod = "login";
 
-               if (set_session("userid", $GLOBALS['userid'], $newl, COOKIE_PATH) && set_session("u_hash", SQL_ESCAPE(get_session('u_hash')), $newl, COOKIE_PATH) && set_session("lifetime", bigintval(get_session('lifetime')), $newl, COOKIE_PATH)) {
+               if (set_session("userid", $GLOBALS['userid'], $newl, COOKIE_PATH) && set_session("u_hash", get_session('u_hash'), $newl, COOKIE_PATH) && set_session("lifetime", bigintval(get_session('lifetime')), $newl, COOKIE_PATH)) {
                        // This will be displayed on welcome page! :-)
                        if (empty($LAST['module'])) {
                                $LAST['module'] = $mod; $LAST['online'] = $onl;
@@ -1375,12 +1375,11 @@ function activateExchange() {
                );
 
                // Run SQLs
-               foreach ($SQLs as $sql)
-               {
+               foreach ($SQLs as $sql) {
                        $result = SQL_QUERY($sql, __FILE__, __LINE__);
                }
 
-               // Destroy cache
+               // @TODO Destroy cache
        }
 }
 //
@@ -1392,8 +1391,7 @@ FROM "._MYSQL_PREFIX."_user_points AS p
 LEFT JOIN "._MYSQL_PREFIX."_user_data AS d
 ON p.userid=d.userid
 WHERE p.userid=%s", array(bigintval($uid)), __FILE__, __LINE__);
-       if (SQL_NUMROWS($result) == 1)
-       {
+       if (SQL_NUMROWS($result) == 1) {
                // Save his points to add them to the jackpot
                list($points) = SQL_FETCHROW($result);
                SQL_FREERESULT($result);
@@ -1402,8 +1400,7 @@ WHERE p.userid=%s", array(bigintval($uid)), __FILE__, __LINE__);
                $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_points WHERE userid=%s", array(bigintval($uid)), __FILE__, __LINE__);
 
                // Update mediadata as well
-               if (GET_EXT_VERSION("mediadata") >= "0.0.4")
-               {
+               if (GET_EXT_VERSION("mediadata") >= "0.0.4") {
                        // Update database
                        MEDIA_UPDATE_ENTRY(array("total_points"), "sub", $points);
                }
@@ -1417,8 +1414,7 @@ WHERE p.userid=%s", array(bigintval($uid)), __FILE__, __LINE__);
         array(bigintval($uid)), __FILE__, __LINE__);
 
        // Remove from rallye if found
-       if (EXT_IS_ACTIVE("rallye"))
-       {
+       if (EXT_IS_ACTIVE("rallye")) {
                $result = SQL_QUERY("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_rallye_users WHERE userid=%s",
                 array(bigintval($uid)), __FILE__, __LINE__);
        }
@@ -1559,8 +1555,7 @@ function MODULE_HAS_MENU($mod)
 
        // All is false by default
        $ret = false;
-       if (GET_EXT_VERSION("cache") >= "0.1.2")
-       {
+       if (GET_EXT_VERSION("cache") >= "0.1.2") {
                if (isset($cacheArray['modules']['has_menu'][$mod]))
                {
                        // Check module cache and count hit
@@ -1574,22 +1569,21 @@ function MODULE_HAS_MENU($mod)
                        $_CONFIG['cache_hits']++;
                }
        }
-       if ((GET_EXT_VERSION("sql_patches") >= "0.3.6") && ($ret === false))
-       {
+
+       if ((GET_EXT_VERSION("sql_patches") >= "0.3.6") && ($ret === false)) {
                // Check database for entry
                $result = SQL_QUERY_ESC("SELECT has_menu FROM "._MYSQL_PREFIX."_mod_reg WHERE module='%s' LIMIT 1",
                 array($mod), __FILE__, __LINE__);
-               if (SQL_NUMROWS($result) == 1)
-               {
+               if (SQL_NUMROWS($result) == 1) {
                        list($has_menu) = SQL_FETCHROW($result);
-                       if ($has_menu == "Y") $ret = true;
+                       $ret = ($has_menu == "Y");
                }
 
                // Free memory
                SQL_FREERESULT($result);
        } elseif (GET_EXT_VERSION("sql_patches") == "") {
                // No sql_patches installed, so maybe in admin area?
-               if ((IS_ADMIN()) && ($mod == "admin")) return true; // Then there is a menu!
+               $ret = ((IS_ADMIN()) && ($mod == "admin")); // Then there is a menu!
        }
 
        // Return status
@@ -1607,6 +1601,48 @@ function SUB_POINTS ($uid, $points) {
                MEDIA_UPDATE_ENTRY(array("total_points"), "sub", $points);
        } // END - if
 }
+// Update config entries
+function UPDATE_CONFIG ($entries, $values, $updateMode="") {
+       // Do we have multiple entries?
+       if (is_array($entries)) {
+               // Walk through all
+               $all = "";
+               foreach ($entries as $idx => $entry) {
+                       // Update mode set?
+                       if (!empty($updateMode)) {
+                               // Update entry
+                               $all .= sprintf("%s=%s%s%s,", $entry, $entry, $updateMode, (float)$values[$idx]);
+                       } else {
+                               // Check if string or number
+                               if (($values[$idx] + 0) === $values[$idx]) {
+                                       // Number detected
+                                       $all .= sprintf("%s=%s,", $entry, (float)$values[$idx]);
+                               } else {
+                                       // String detected
+                                       $all .= sprintf("%s='%s',", $entry, SQL_ESCAPE($values[$idx]));
+                               }
+                       }
+               } // END - foreach
 
+               // Remove last comma
+               $entries = substr($all, 0, -1);
+       } elseif (!empty($updateMode)) {
+               // Update mode set
+               $entries .= sprintf("=%s%s%s", $entries, $updateMode, (float)$value);
+       } else {
+               // Regular entry to update
+               $entries .= sprintf("='%s'", SQL_ESCAPE($values));
+       }
+
+       // Run database update
+       //* DEBUG: */ DEBUG_LOG(__FUNCTION__.":entries={$entries}");
+       SQL_QUERY("UPDATE "._MYSQL_PREFIX."_config SET ".$entries." WHERE config=0 LIMIT 1", __FILE__, __LINE__);
+
+       // Destroy cache
+       if ((GET_EXT_VERSION("cache") >= "0.1.2") && (SQL_AFFECTEDROWS() == 1)) {
+               global $cacheInstance;
+               if ($cacheInstance->cache_file("config", true)) $cacheInstance->cache_destroy();
+       } // END - if
+}
 //
 ?>
index 984103c..e3ec443 100644 (file)
@@ -39,25 +39,12 @@ if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))
 }
 
 // Check for patch level differences between databases and current hard-coded
-if (CURR_PATCH_LEVEL > $_CONFIG['patch_level'])
-{
+if (CURR_PATCH_LEVEL > $_CONFIG['patch_level']) {
        // Update database and CONFIG array
-       $result = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_config SET patch_level='".CURR_PATCH_LEVEL."', patch_ctime=UNIX_TIMESTAMP() WHERE config=0 LIMIT 1",
-        __FILE__, __LINE__);
+       UPDATE_CONFIG(array("patch_level", "path_ctime"), array(CURR_PATH_LEVEL, "UNIX_TIMESTAMP()"));
        $_CONFIG['patch_level'] = CURR_PATCH_LEVEL;
        $_CONFIG['patch_ctime'] = time();
-
-       // Destroy cache
-       if (GET_EXT_VERSION("cache") >= "0.1.2")
-       {
-               if ($cacheInstance->cache_file("config", true))
-               {
-                       // Replace data
-                       $cacheInstance->cache_replace("patch_level", $_CONFIG['patch_level'], "0", $cacheArray);
-                       $cacheInstance->cache_replace("patch_ctime", $_CONFIG['patch_ctime'], "0", $cacheArray);
-               }
-       }
-}
+} // END - if
 
 //
 ?>
index 6d6f0c0..98eaa94 100644 (file)
  * -------------------------------------------------------------------- *
  *                                                                      *
  * -------------------------------------------------------------------- *
- * Copyright (c) 2003, 2004, 2005, 2006, 2007 by Roland Haeder          *                                
- * 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                                                  *                                
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
+ * 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 (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);
-}
- elseif ((!EXT_IS_ACTIVE("")) && (!IS_ADMIN()))
-{
+} elseif ((!EXT_IS_ACTIVE("")) && (!IS_ADMIN())) {
        ADD_FATAL(EXTENSION_PROBLEM_EXT_INACTIVE);
        return;
 }
index e8fb34a..c668ba3 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);
-}
- elseif ((!EXT_IS_ACTIVE("beg")) && (!IS_ADMIN()))
-{
+} elseif ((!EXT_IS_ACTIVE("beg")) && (!IS_ADMIN())) {
        ADD_FATAL(EXTENSION_PROBLEM_EXT_INACTIVE, "beg");
        return;
 }
 
 // Do not execute when script is in CSS mode or no daily reset
-if (($CSS == 1) || (!isBooleanConstantAndTrue('__DAILY_RESET'))) return;
+if (($CSS == 1) || (!isBooleanConstantAndTrue('__DAILY_RESET')) || ($_CONFIG['beg_rallye'] == "Y")) return;
 
 // Reset accounts
 $result = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_user_data SET beg_points=0.00000 WHERE beg_points > 0",
index 9df8158..d18d2fb 100644 (file)
@@ -88,19 +88,7 @@ SQL_FREERESULT($result_daily);
 $_CONFIG['last_update'] = time();
 
 // Update database
-$result_daily = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_config
-SET last_update=UNIX_TIMESTAMP()
-WHERE config=0 AND last_update != UNIX_TIMESTAMP()
-LIMIT 1", __FILE__, __LINE__);
-
-// Destroy cache
-if ((GET_EXT_VERSION("cache") >= "0.1.2") && (SQL_AFFECTEDROWS() == 1))
-{
-       if ($cacheInstance->cache_file("config", true))
-       {
-               $cacheInstance->cache_replace("last_update", time(), "0", $cacheArray);
-       }
-}
+UPDATE_CONFIG("last_update", time());
 
 //
 ?>
index 93397fa..45e8b9f 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);
-}
- elseif ((!EXT_IS_ACTIVE("holiday")) && (!IS_ADMIN()))
-{
+} elseif ((!EXT_IS_ACTIVE("holiday")) && (!IS_ADMIN())) {
        ADD_FATAL(EXTENSION_PROBLEM_EXT_INACTIVE, "holiday");
        return;
 }
@@ -50,11 +47,9 @@ if (($CSS == 1) || ((!isBooleanConstantAndTrue('__DAILY_RESET')) && ($_CONFIG['h
 $result_main = SQL_QUERY("SELECT userid, holiday_activated FROM "._MYSQL_PREFIX."_user_data
 WHERE holiday_activated > 0 AND holiday_activated < ".time()." AND holiday_active='N'
 ORDER BY holiday_activated", __FILE__, __LINE__);
-if (SQL_NUMROWS($result_main) > 0)
-{
+if (SQL_NUMROWS($result_main) > 0) {
        // We have found at least one useraccount so let's check it...
-       while(list($uid, $activated) = SQL_FETCHROW($result_main))
-       {
+       while(list($uid, $activated) = SQL_FETCHROW($result_main)) {
                // Check if his holiday can be activated
                $result_holiday = SQL_QUERY_ESC("SELECT holiday_start, holiday_end FROM "._MYSQL_PREFIX."_user_holidays
 WHERE userid=%s AND holiday_start <= ".time()." AND holiday_end > ".time()." LIMIT 1",
diff --git a/inc/reset/reset_surfbar.php b/inc/reset/reset_surfbar.php
new file mode 100644 (file)
index 0000000..4fc2f6b
--- /dev/null
@@ -0,0 +1,51 @@
+<?php
+/************************************************************************
+ * MXChange v0.2.1                                    Start: 09/08/2008 *
+ * ===============                              Last change: 09/08/2008 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : reset_surfbar.php                                *
+ * -------------------------------------------------------------------- *
+ * Short description : Things to be done on daily reset                 *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : Dinge, die beim taeglichen Reset erledigt werden *
+ * -------------------------------------------------------------------- *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
+ * 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 (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) {
+       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
+       require($INC);
+} elseif ((!EXT_IS_ACTIVE("")) && (!IS_ADMIN())) {
+       ADD_FATAL(EXTENSION_PROBLEM_EXT_INACTIVE);
+       return;
+}
+
+// Do not execute when script is in CSS mode or no daily reset
+if (($CSS == 1) || (defined('__DAILY_RESET'))) return;
+
+// Reset surfbar counter
+UPDATE_CONFIG("surfbar_daily_counter", "0");
+$_CONFIG['surfbar_daily_counter'] = 0;
+
+//
+?>
index 5a3f843..d03bbfa 100644 (file)
@@ -41,7 +41,7 @@ if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))
 // Always make sure the session management is initialized first
 require_once(PATH."inc/session.php");
 
-//
+// Get current theme name
 function GET_CURR_THEME() {
        global $INC_POOL, $_CONFIG, $CSS;
 
diff --git a/inc/weekly/.htaccess b/inc/weekly/.htaccess
new file mode 100644 (file)
index 0000000..14249c5
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
\ No newline at end of file
diff --git a/inc/weekly/weekly_ b/inc/weekly/weekly_
new file mode 100644 (file)
index 0000000..80ccc6b
--- /dev/null
@@ -0,0 +1,47 @@
+<?php
+/************************************************************************
+ * MXChange v0.2.1                                    Start: 09/08/2008 *
+ * ===============                              Last change: 09/08/2008 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : weekly_                                          *
+ * -------------------------------------------------------------------- *
+ * Short description :                                                  *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  :                                                  *
+ * -------------------------------------------------------------------- *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
+ * 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 (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) {
+       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
+       require($INC);
+} elseif ((!EXT_IS_ACTIVE("")) && (!IS_ADMIN())) {
+       ADD_FATAL(EXTENSION_PROBLEM_EXT_INACTIVE);
+       return;
+}
+
+// Do not execute when script is in CSS mode or no daily reset
+if (($CSS == 1) || (!defined('__DAILY_RESET'))) return;
+
+//
+?>
diff --git a/inc/weekly/weekly_surfbar.php b/inc/weekly/weekly_surfbar.php
new file mode 100644 (file)
index 0000000..74ce5f6
--- /dev/null
@@ -0,0 +1,51 @@
+<?php
+/************************************************************************
+ * MXChange v0.2.1                                    Start: 09/08/2008 *
+ * ===============                              Last change: 09/08/2008 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : weekly_surfbar.php                               *
+ * -------------------------------------------------------------------- *
+ * Short description :                                                  *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  :                                                  *
+ * -------------------------------------------------------------------- *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
+ * 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 (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) {
+       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
+       require($INC);
+} elseif ((!EXT_IS_ACTIVE("surfbar")) && (!IS_ADMIN())) {
+       ADD_FATAL(EXTENSION_PROBLEM_EXT_INACTIVE);
+       return;
+}
+
+// Do not execute when script is in CSS mode or no daily reset
+if (($CSS == 1) || (!defined('__DAILY_RESET'))) return;
+
+// Reset the surfbar counter
+UPDATE_CONFIG("surfbar_weekly_counter", "0");
+$_CONFIG['surfbar_weekly_counter'] = 0;
+
+//
+?>
index 703e39b..8202188 100644 (file)
@@ -61,7 +61,7 @@ if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_install
        }
 
        // Is there a check value?
-       if ((SURFBAR_CHECK_RELOAD_FULL()) || ((isset($_GET['frame'])) && (($_GET['frame'] == "stop") || ($_GET['frame'] == "stop2")))) {
+       if ((SURFBAR_CHECK_RELOAD_FULL()) || ((isset($_GET['frame'])) && (in_array($_GET['frame'], array("stop", "stop2", "stats"))))) {
                // Reload-lock is full, surfbar stopped so...
                // Load header
                require_once(PATH."inc/header.php");
@@ -77,6 +77,23 @@ if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_install
 
                        // This makes the footer appear again
                        unset($_GET['frame']);
+               } elseif ((isset($_GET['frame'])) && ($_GET['frame'] == "stats")) {
+                       // Get total points amount
+                       $points = GET_TOTAL_DATA($GLOBALS['userid'], "user_points", "points") - GET_TOTAL_DATA($GLOBALS['userid'], "user_data", "used_points");
+
+                       // Prepare content
+                       $content = array(
+                               'points'  => TRANSLATE_COMMA($points),
+                               'online'  => SURFBAR_DETERMINE_TOTAL_ONLINE(),
+                               'reload'  => ($_CONFIG['surfbar_stats_reload'] * 1000),
+                               'c_total' => TRANSLATE_COMMA($_CONFIG['surfbar_total_counter']),
+                               'c_today' => TRANSLATE_COMMA($_CONFIG['surfbar_daily_counter']),
+                               'c_week'  => TRANSLATE_COMMA($_CONFIG['surfbar_weekly_counter']),
+                               'c_month' => TRANSLATE_COMMA($_CONFIG['surfbar_monthly_counter']),
+                       );
+
+                       // Load template for "stats" page
+                       LOAD_TEMPLATE("surfbar_frame_stats", false, $content);
                } else {
                        // Prepare content
                        $content = array(
@@ -126,9 +143,6 @@ if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_install
 
                        // Is there a valid id?
                        if ($nextId > 0) {
-                               // Get total points amount
-                               $points = GET_TOTAL_DATA($GLOBALS['userid'], "user_points", "points") - GET_TOTAL_DATA($GLOBALS['userid'], "user_data", "used_points");
-
                                // Then prepare other content
                                $content = array(
                                        'id'          => $nextId,
@@ -138,12 +152,11 @@ if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_install
                                        'url'         => SURFBAR_GET_URL($nextId),
                                        'curr_reload' => SURFBAR_GET_USER_RELOAD_LOCK(),
                                        'max_urls'    => SURFBAR_GET_TOTAL_URLS(),
-                                       'reload'      => SURFBAR_GET_RELOAD_TIME($nextId),
-                                       'points'      => TRANSLATE_COMMA($points)
+                                       'reload'      => SURFBAR_GET_RELOAD_TIME($nextId)
                                );
 
-                               // Update salt (double-call lock!)
-                               SURFBAR_UPDATE_SALT();
+                               // Update salt (double-call lock!) and statistics
+                               SURFBAR_UPDATE_SALT_STATS();
                        } else {
                                // Load new URL
                                LOAD_URL("surfbar.php?frame=stop2");
diff --git a/templates/de/emails/admin/admin_surfbar_url_reg.tpl b/templates/de/emails/admin/admin_surfbar_url_reg.tpl
new file mode 100644 (file)
index 0000000..1d86efc
--- /dev/null
@@ -0,0 +1,28 @@
+{--HELLO_ADMIN--},
+
+ein Mitglied hat soeben eine URL in der Surfbar gebucht.
+
+Hier sind alle dazu:
+------------------------------------------
+Gebuchte URL: $content[url]
+------------------------------------------
+Email: $DATA[email]
+------------------------------------------
+Framekiller-Test:
+$content[frametester]
+------------------------------------------
+User-ID: $content[uid]
+------------------------------------------
+Kosten/Aufruf: $content[costs] {!POINTS!}
+------------------------------------------
+Verg&uuml;tung/Aufruf: $content[reward] {!POINTS!}
+------------------------------------------
+Status: $content[status]
+------------------------------------------
+ID in der Surfbar: $content[insert_id]
+------------------------------------------
+
+{--ADMIN_THANX--}
+  {--YOUR--} {!MAIN_TITLE!} {--SCRIPT--}
+
+{!URL!}/admin.php
index 1a7ac08..d02553d 100644 (file)
@@ -15,7 +15,7 @@ $content[frametester]
 ------------------------------------------
 User-ID: $content[uid]
 ------------------------------------------
-Verg&uuml;tung: $content[reward] {!POINTS!}
+Verg&uuml;tung/Aufruf: $content[reward] {!POINTS!}
 ------------------------------------------
 Status: $content[status]
 ------------------------------------------
diff --git a/templates/de/emails/member/member_surfbar_url_reg.tpl b/templates/de/emails/member/member_surfbar_url_reg.tpl
new file mode 100644 (file)
index 0000000..bef971e
--- /dev/null
@@ -0,0 +1,19 @@
+{--HELLO--} Mitglied,
+
+Sie haben soeben eine URL in der Surfbar gebucht.
+
+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!})
index bb9ffa5..1f8f34b 100644 (file)
                        <INPUT type="text" name="surfbar_restart_time" size="6" maxlength="20" value="$content[surfbar_restart_time]" />
                </TD>
        </TR>
+       <TR><TD height="3" colspan="2" class="seperator">&nbsp;</TD></TR>
+       <TR>
+               <TD height="30" align="right" style="padding-right:5px">
+                       {--ADMIN_CONFIG_SURFBAR_STATS_RELOAD--}
+               </TD>
+               <TD>
+                       <INPUT type="text" name="surfbar_stats_reload" size="6" maxlength="20" value="$content[surfbar_stats_reload]" />
+               </TD>
+       </TR>
        <TR><TD height="8" colspan="2" class="seperator bottom2">&nbsp;</TD></TR>
        <TR>
                <TD align="center" colspan="2" class="admin_footer bottom2">
diff --git a/templates/de/html/member/member_surfbar_book_dynamic.tpl b/templates/de/html/member/member_surfbar_book_dynamic.tpl
new file mode 100644 (file)
index 0000000..7336c0d
--- /dev/null
@@ -0,0 +1,26 @@
+<form action="{!URL!}/modules.php?module=login&amp;what=surfbar_book" method="post">
+<div class="member_table dashed" style="width:600px;margin-top:10px">
+       <div class="member_title2 bottom2" style="padding-top:5px;padding-bottom:5px">
+               <strong>URL in Surfbar buchen:</strong>
+       </div>
+
+       <div class="member_input" style="padding-top:5px;padding-bottom:5px">
+               URL eingeben: <input type="text" name="url" size="20" maxlength="255" value="http://" />
+       </div>
+
+       <div class="member_input" style="padding-top:5px;padding-bottom:5px">
+               Jeder Seiten-Aufruf durch andere Mitglieder kostet Ihnen mindestens <span
+                class="surfbar_points">$content[costs] {!POINTS!}</span>. Surfen Sie mit
+               der Surfbar erhalten Sie mindestens <span class="surfbar_points">$content[reward]
+               {!POINTS!}</span> auf Ihr Konto gutgeschrieben.<br />
+               <br />
+               Sie haben bereits <strong>$content[curr_order]</strong> von maximal
+               <strong>$content[max_order]</strong> erlaubten URLs gebucht.
+       </div>
+
+       <div class="member_title2 top2" style="padding-top:5px;padding-bottom:5px">
+               <input type="reset" class="member_reset" value="{--CLEAR_FORM--}" />&nbsp;*
+               <input type="submit" class="member_submit" name="ok" value="{--MEMBER_SURFBAR_ADD_URL--}" />
+       </div>
+</div>
+</form>
diff --git a/templates/de/html/member/member_surfbar_book_static.tpl b/templates/de/html/member/member_surfbar_book_static.tpl
new file mode 100644 (file)
index 0000000..49385e1
--- /dev/null
@@ -0,0 +1,26 @@
+<form action="{!URL!}/modules.php?module=login&amp;what=surfbar_book" method="post">
+<div class="member_table dashed" style="width:600px;margin-top:10px">
+       <div class="member_title2 bottom2" style="padding-top:5px;padding-bottom:5px">
+               <strong>URL in Surfbar buchen:</strong>
+       </div>
+
+       <div class="member_input" style="padding-top:5px;padding-bottom:5px">
+               URL eingeben: <input type="text" name="url" size="20" maxlength="255" value="http://" />
+       </div>
+
+       <div class="member_input" style="padding-top:5px;padding-bottom:5px">
+               Jeder Seiten-Aufruf durch andere Mitglieder kostet Ihnen <span
+                class="surfbar_points">$content[costs] {!POINTS!}</span>. Surfen Sie mit
+               der Surfbar erhalten Sie <span class="surfbar_points">$content[reward]
+               {!POINTS!}</span> auf Ihr Konto gutgeschrieben.<br />
+               <br />
+               Sie haben bereits <strong>$content[curr_order]</strong> von maximal
+               <strong>$content[max_order]</strong> erlaubten URLs gebucht.
+       </div>
+
+       <div class="member_title2 top2" style="padding-top:5px;padding-bottom:5px">
+               <input type="reset" class="member_reset" value="{--CLEAR_FORM--}" />&nbsp;*
+               <input type="submit" class="member_submit" name="ok" value="{--MEMBER_SURFBAR_ADD_URL--}" />
+       </div>
+</div>
+</form>
diff --git a/templates/de/html/surfbar/surfbar_frame_stats.tpl b/templates/de/html/surfbar/surfbar_frame_stats.tpl
new file mode 100644 (file)
index 0000000..0e0ca5a
--- /dev/null
@@ -0,0 +1,21 @@
+<table border="0" cellspacing="0" cellpadding="0" width="100%" class="surfbar_table">
+<tr>
+       <td class="surfbar_td">
+               &raquo;Guthaben: <span class="surfbar_points">$content[points]&nbsp;{!POINTS!}</span>&laquo;&nbsp;-
+               &raquo;Jetzt Online: <span class="surfbar_counter">$content[online]</span>&laquo;&nbsp;-
+               &raquo;Seitenaufrufe: Heute:<span class="surfbar_counter">$content[c_today]</span>&nbsp;-
+               Woche:<span class="surfbar_counter">$content[c_week]</span>&nbsp;-
+               Monat:<span class="surfbar_counter">$content[c_month]</span>&nbsp;-
+               Gesamt:<span class="surfbar_counter">$content[c_total]</span>&laquo;
+       </td>
+</tr>
+</table>
+<script language="JavaScript" type="text/javascript">
+<!--
+function Reload() {
+       this.location.reload();
+}
+
+window.setTimeout("Reload()", $content[reload]);
+//-->
+</script>
\ No newline at end of file
index da821e0..5da82c3 100644 (file)
@@ -5,14 +5,13 @@
                <span id="surfbar_counter">X</span>&nbsp;<span
                 id="counter_word">Sekunden</span>&laquo;&nbsp;&raquo;<span
                 class="surfbar_reload">$content[curr_reload]</span> von <span
-                class="surfbar_max">$content[max_urls]</span> im Reload&laquo;&nbsp;&raquo;Guthaben:
-               <span class="surfbar_points">$content[points]&nbsp;{!POINTS!}</span>&laquo;<br />
+                class="surfbar_max">$content[max_urls]</span> im Reload&laquo;<br />
 
                &raquo;<a href="$content[url]" target="_blank">Aktuelle Seite in neuem
-               Fenster &ouml;ffnen</a>&laquo;&nbsp;[<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>]<br />
+               Fenster &ouml;ffnen</a>&laquo;&nbsp;<span class="surfbar_navi">[<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><br />
 
                &raquo;{!MAIN_TITLE!} ist f&uuml;r den Inhalt nicht verantwortlich!&laquo;
        </td>
index a8abfa1..e5e49ad 100644 (file)
@@ -5,12 +5,13 @@ if (top.frames.length > 0) {
 }
 //-->
 </script>
-<frameset rows="62,*" frameborder="no" border="0" framespacing="0">
+<frameset rows="62,*,18" frameborder="no" border="0" framespacing="0">
        <frameset cols="*,469" frameborder="no" border="0" framespacing="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_url" src="{!URL!}/surfbar.php?frame=start" frameborder="no" scrolling="no" noresize>
+       <frame name="surfbar_stats" src="{!URL!}/surfbar.php?frame=stats" frameborder="no" scrolling="no" noresize>
 </frameset>
 <noframes>
        Ihr Browser unterst&uuml;tzt keine Frames!
index d08da48..41bee3a 100644 (file)
@@ -23,7 +23,7 @@ function Restart () {
 }
 
 function ShowButton () {
-       buttonDiv.innerHTML = "<form action='{!URL!}/surfbar.php' target='_parent' method='GET'><input type='submit' class='member_submit' value='Surfbar erneut starten' /></form>";
+       buttonDiv.innerHTML = "<form action='{!URL!}/surfbar.php' target='_self' method='GET'><input type='hidden' name='frame' value='top' /><input type='submit' class='member_submit' value='Surfbar erneut starten' /></form>";
 }
 
 function Counter () {