From c45b1827a16928c65ecc1aea6a9d7a504c4874d4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 8 Sep 2008 18:39:37 +0000 Subject: [PATCH] - Daily/weekly/monthly reset completely rewritten - 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 --- .gitattributes | 13 +- doubler.php | 11 +- inc/db/lib-mysql3.php | 25 ++- inc/doubler_send.php | 12 +- inc/extensions.php | 34 ++-- inc/extensions/ext- | 2 +- inc/extensions/ext-beg.php | 24 +-- inc/extensions/ext-bonus.php | 9 - inc/extensions/ext-holiday.php | 7 - inc/extensions/ext-newsletter.php | 2 - inc/extensions/ext-sql_patches.php | 12 +- inc/extensions/ext-surfbar.php | 39 +++- inc/extensions/ext-yoomedia.php | 2 +- inc/functions.php | 148 +++++++++----- inc/gen_sql_patches.php | 9 +- inc/language/surfbar_de.php | 7 + inc/libs/cache_functions.php | 3 +- inc/libs/output_functions.php | 2 +- inc/libs/surfbar_functions.php | 185 +++++++++++++++--- inc/load_extensions.php | 125 ++++++------ inc/mails/beg_mails.php | 2 +- inc/mails/bonus_mails.php | 2 +- inc/modules/admin.php | 6 +- inc/modules/admin/action- | 2 +- inc/modules/admin/action-surfbar.php | 2 +- inc/modules/admin/admin-inc.php | 2 +- inc/modules/admin/what- | 2 +- inc/modules/admin/what-config_home.php | 9 +- inc/modules/admin/what-config_surfbar.php | 6 +- inc/modules/admin/what-list_beg.php | 5 +- inc/modules/admin/what-list_bonus.php | 32 ++- .../admin/what-list_surfbar_reflvl.php | 2 +- inc/modules/admin/what-list_surfbar_urls.php | 2 +- inc/modules/admin/what-maintenance.php | 11 +- .../admin/what-unlock_surfbar_urls.php | 44 +++++ inc/modules/admin/what-user_contct.php | 2 +- inc/modules/guest/action- | 2 +- inc/modules/guest/action-online.php | 5 +- inc/modules/login.php | 7 +- inc/modules/member/action- | 2 +- inc/modules/member/action-surfbar.php | 2 +- inc/modules/member/what- | 2 +- inc/modules/member/what-mydata.php | 7 +- inc/modules/member/what-surfbar_book.php | 83 ++++++++ inc/modules/member/what-surfbar_start.php | 16 +- inc/monthly/monthly_ | 34 ++-- inc/monthly/monthly_beg.php | 19 +- inc/monthly/monthly_bonus.php | 10 +- inc/monthly/monthly_newsletter.php | 8 +- .../monthly_surfbar.php} | 38 ++-- inc/mysql-connect.php | 31 +-- inc/mysql-manager.php | 76 +++++-- inc/patch-system.php | 19 +- inc/reset/reset_ | 41 ++-- inc/reset/reset_beg.php | 9 +- inc/reset/reset_daily.php | 14 +- inc/reset/reset_holiday.php | 13 +- inc/reset/reset_surfbar.php | 51 +++++ inc/theme-manager.php | 2 +- inc/weekly/.htaccess | 1 + inc/weekly/weekly_ | 47 +++++ inc/weekly/weekly_surfbar.php | 51 +++++ surfbar.php | 29 ++- .../de/emails/admin/admin_surfbar_url_reg.tpl | 28 +++ .../emails/admin/admin_surfbar_url_unlock.tpl | 2 +- .../emails/member/member_surfbar_url_reg.tpl | 19 ++ .../de/html/admin/admin_config_surfbar.tpl | 9 + .../member/member_surfbar_book_dynamic.tpl | 26 +++ .../member/member_surfbar_book_static.tpl | 26 +++ .../de/html/surfbar/surfbar_frame_stats.tpl | 21 ++ .../de/html/surfbar/surfbar_frame_top.tpl | 11 +- .../de/html/surfbar/surfbar_frameset.tpl | 3 +- templates/de/html/surfbar/surfbar_stopped.tpl | 2 +- 73 files changed, 1056 insertions(+), 512 deletions(-) create mode 100644 inc/modules/admin/what-unlock_surfbar_urls.php create mode 100644 inc/modules/member/what-surfbar_book.php rename inc/{monthly_newsletter.php => monthly/monthly_surfbar.php} (63%) create mode 100644 inc/reset/reset_surfbar.php create mode 100644 inc/weekly/.htaccess create mode 100644 inc/weekly/weekly_ create mode 100644 inc/weekly/weekly_surfbar.php create mode 100644 templates/de/emails/admin/admin_surfbar_url_reg.tpl create mode 100644 templates/de/emails/member/member_surfbar_url_reg.tpl create mode 100644 templates/de/html/member/member_surfbar_book_dynamic.tpl create mode 100644 templates/de/html/member/member_surfbar_book_static.tpl create mode 100644 templates/de/html/surfbar/surfbar_frame_stats.tpl diff --git a/.gitattributes b/.gitattributes index 57e22a6f05..f075887980 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/doubler.php b/doubler.php index ca2934f7b6..53ee068260 100644 --- a/doubler.php +++ b/doubler.php @@ -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 diff --git a/inc/db/lib-mysql3.php b/inc/db/lib-mysql3.php index 44bcbdcb92..f8eceec4b3 100644 --- a/inc/db/lib-mysql3.php +++ b/inc/db/lib-mysql3.php @@ -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 diff --git a/inc/doubler_send.php b/inc/doubler_send.php index a0d6ee8404..71685ced4e 100644 --- a/inc/doubler_send.php +++ b/inc/doubler_send.php @@ -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 diff --git a/inc/extensions.php b/inc/extensions.php index fa5e463b8f..5c15cdf857 100644 --- a/inc/extensions.php +++ b/inc/extensions.php @@ -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; } // diff --git a/inc/extensions/ext- b/inc/extensions/ext- index ca956b8af3..3b7509a073 100644 --- a/inc/extensions/ext- +++ b/inc/extensions/ext- @@ -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 * diff --git a/inc/extensions/ext-beg.php b/inc/extensions/ext-beg.php index ab6b8826f8..76b1042c10 100644 --- a/inc/extensions/ext-beg.php +++ b/inc/extensions/ext-beg.php @@ -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); } diff --git a/inc/extensions/ext-bonus.php b/inc/extensions/ext-bonus.php index b0bad4d91d..2e6798241f 100644 --- a/inc/extensions/ext-bonus.php +++ b/inc/extensions/ext-bonus.php @@ -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 inc/monthly_bonus.php haben dafür gesorgt, dass die monatliche Aktiv-Rallye nicht ausgeschüttet wurde. Mit diesem Update wurde die Ausschüttung initialisiert. Ihre Mitglieder bekommen voraussichtlicht nichts doppelt vergütet."; break; diff --git a/inc/extensions/ext-holiday.php b/inc/extensions/ext-holiday.php index a5937ff225..a7210a86e3 100644 --- a/inc/extensions/ext-holiday.php +++ b/inc/extensions/ext-holiday.php @@ -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; } diff --git a/inc/extensions/ext-newsletter.php b/inc/extensions/ext-newsletter.php index 4b625bc6d6..14fdc39073 100644 --- a/inc/extensions/ext-newsletter.php +++ b/inc/extensions/ext-newsletter.php @@ -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 html_mail können Sie auch HTML-Mails versenden."; break; diff --git a/inc/extensions/ext-sql_patches.php b/inc/extensions/ext-sql_patches.php index 2d7ea00271..b332e0d9b9 100644 --- a/inc/extensions/ext-sql_patches.php +++ b/inc/extensions/ext-sql_patches.php @@ -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üssel in Admin-, Gast- und Mitgliedsmenü 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äglichen/wöchentlichen/monatlichen Reset verbessert."; + break; } break; diff --git a/inc/extensions/ext-surfbar.php b/inc/extensions/ext-surfbar.php index 7a09feec6e..739272cfe8 100644 --- a/inc/extensions/ext-surfbar.php +++ b/inc/extensions/ext-surfbar.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 * @@ -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 ä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; diff --git a/inc/extensions/ext-yoomedia.php b/inc/extensions/ext-yoomedia.php index 4004f16d93..93461af485 100644 --- a/inc/extensions/ext-yoomedia.php +++ b/inc/extensions/ext-yoomedia.php @@ -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 * diff --git a/inc/functions.php b/inc/functions.php index 7db231cb3a..8875dc134d 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -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&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 +} // ////////////////////////////////////////////////// // // diff --git a/inc/gen_sql_patches.php b/inc/gen_sql_patches.php index 5876e3d5fd..2abce585f8 100644 --- a/inc/gen_sql_patches.php +++ b/inc/gen_sql_patches.php @@ -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."
Cookie: ".get_session('u_hash')."
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; diff --git a/inc/language/surfbar_de.php b/inc/language/surfbar_de.php index a49c8dc23f..54a81ee1f7 100644 --- a/inc/language/surfbar_de.php +++ b/inc/language/surfbar_de.php @@ -51,6 +51,7 @@ define('ADMIN_CONFIG_SURFBAR_DYNAMIC_PERCENT', "Prozent auf dynamische Vergü 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ür die Surfbar eingestellt.
\nBitte installieren Sie die Erweiterung surfbar neu."); @@ -67,6 +68,12 @@ define('ADMIN_SURFBAR_DEL_URL', "URL löschen"); define('ADMIN_SURFBAR_UNLOCK_URL', "URL ent-/sperren"); define('ADMIN_CONFIG_SURFBAR_NOTE', "(*): Es sind auch die Übertragungen der URLs aus der Mailbuchung einbezogen. Es wird empfohlen, die Ruhezeit etwas länger als die Reload-Sperre einzustellen."); +// General member text +define('MEMBER_SURFBAR_URL_ADDED', "URL hinzugefügt und wartet auf Freischaltung."); +define('MEMBER_SURFBAR_URL_NOT_ADDED', "URL konnte nicht hinzugefügt werden, da ein Fehler vorliegt."); +define('MEMBER_SURFBAR_ADD_URL', "URL in Surfbar buchen"); +define('MEMBER_SURFBAR_NO_MORE_ALLOWED', "Sie kö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"); diff --git a/inc/libs/cache_functions.php b/inc/libs/cache_functions.php index 9e5202d558..619579d537 100644 --- a/inc/libs/cache_functions.php +++ b/inc/libs/cache_functions.php @@ -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"; diff --git a/inc/libs/output_functions.php b/inc/libs/output_functions.php index c439128434..fb245f9b70 100644 --- a/inc/libs/output_functions.php +++ b/inc/libs/output_functions.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 * diff --git a/inc/libs/surfbar_functions.php b/inc/libs/surfbar_functions.php index 72b8c8bb17..4c931566ad 100644 --- a/inc/libs/surfbar_functions.php +++ b/inc/libs/surfbar_functions.php @@ -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(); diff --git a/inc/load_extensions.php b/inc/load_extensions.php index 1ca104512e..c66ba0da31 100644 --- a/inc/load_extensions.php +++ b/inc/load_extensions.php @@ -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."*
"; - - // 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."
\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 + // ?> diff --git a/inc/mails/beg_mails.php b/inc/mails/beg_mails.php index 44991df0be..ca5adfa470 100644 --- a/inc/mails/beg_mails.php +++ b/inc/mails/beg_mails.php @@ -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? diff --git a/inc/mails/bonus_mails.php b/inc/mails/bonus_mails.php index 43a382dbea..44ab9f5717 100644 --- a/inc/mails/bonus_mails.php +++ b/inc/mails/bonus_mails.php @@ -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? diff --git a/inc/modules/admin.php b/inc/modules/admin.php index 604abdf9b4..a117d14b89 100644 --- a/inc/modules/admin.php +++ b/inc/modules/admin.php @@ -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 diff --git a/inc/modules/admin/action- b/inc/modules/admin/action- index c68fa7661e..4f657c6940 100644 --- a/inc/modules/admin/action- +++ b/inc/modules/admin/action- @@ -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 * diff --git a/inc/modules/admin/action-surfbar.php b/inc/modules/admin/action-surfbar.php index 5ac0fe9348..d4964c6321 100644 --- a/inc/modules/admin/action-surfbar.php +++ b/inc/modules/admin/action-surfbar.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 * diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index 7ef2e0aa55..6b22d9ba5d 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -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 diff --git a/inc/modules/admin/what- b/inc/modules/admin/what- index f5e1bd3796..209036a08c 100644 --- a/inc/modules/admin/what- +++ b/inc/modules/admin/what- @@ -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 * diff --git a/inc/modules/admin/what-config_home.php b/inc/modules/admin/what-config_home.php index 2f52640474..28f5952201 100644 --- a/inc/modules/admin/what-config_home.php +++ b/inc/modules/admin/what-config_home.php @@ -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 diff --git a/inc/modules/admin/what-config_surfbar.php b/inc/modules/admin/what-config_surfbar.php index c986d658fe..1cd75f1270 100644 --- a/inc/modules/admin/what-config_surfbar.php +++ b/inc/modules/admin/what-config_surfbar.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 * @@ -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 diff --git a/inc/modules/admin/what-list_beg.php b/inc/modules/admin/what-list_beg.php index 67926c0983..afc6135273 100644 --- a/inc/modules/admin/what-list_beg.php +++ b/inc/modules/admin/what-list_beg.php @@ -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("
"); } @@ -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)); diff --git a/inc/modules/admin/what-list_bonus.php b/inc/modules/admin/what-list_bonus.php index 721ee92dd8..caefd309c9 100644 --- a/inc/modules/admin/what-list_bonus.php +++ b/inc/modules/admin/what-list_bonus.php @@ -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("
"); } - 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 = ""; $WIN2 = ""; } + + // 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)); diff --git a/inc/modules/admin/what-list_surfbar_reflvl.php b/inc/modules/admin/what-list_surfbar_reflvl.php index 0ec2e773d9..839bce00b9 100644 --- a/inc/modules/admin/what-list_surfbar_reflvl.php +++ b/inc/modules/admin/what-list_surfbar_reflvl.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 * diff --git a/inc/modules/admin/what-list_surfbar_urls.php b/inc/modules/admin/what-list_surfbar_urls.php index 9c3c176e4f..02c0b65f19 100644 --- a/inc/modules/admin/what-list_surfbar_urls.php +++ b/inc/modules/admin/what-list_surfbar_urls.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 * diff --git a/inc/modules/admin/what-maintenance.php b/inc/modules/admin/what-maintenance.php index 3b0bd4378b..e2d3e6a9b8 100644 --- a/inc/modules/admin/what-maintenance.php +++ b/inc/modules/admin/what-maintenance.php @@ -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 index 0000000000..c1d2d52c98 --- /dev/null +++ b/inc/modules/admin/what-unlock_surfbar_urls.php @@ -0,0 +1,44 @@ + diff --git a/inc/modules/admin/what-user_contct.php b/inc/modules/admin/what-user_contct.php index 4475fed1d5..ef1104eda2 100644 --- a/inc/modules/admin/what-user_contct.php +++ b/inc/modules/admin/what-user_contct.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 * diff --git a/inc/modules/guest/action- b/inc/modules/guest/action- index c10ba15b5a..38264c411f 100644 --- a/inc/modules/guest/action- +++ b/inc/modules/guest/action- @@ -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 * diff --git a/inc/modules/guest/action-online.php b/inc/modules/guest/action-online.php index a030f9eff2..ec2317cbb5 100644 --- a/inc/modules/guest/action-online.php +++ b/inc/modules/guest/action-online.php @@ -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 diff --git a/inc/modules/login.php b/inc/modules/login.php index 8178d82f09..8c493c055b 100644 --- a/inc/modules/login.php +++ b/inc/modules/login.php @@ -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)); diff --git a/inc/modules/member/action- b/inc/modules/member/action- index 033f7eed5d..456ce52d26 100644 --- a/inc/modules/member/action- +++ b/inc/modules/member/action- @@ -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 * diff --git a/inc/modules/member/action-surfbar.php b/inc/modules/member/action-surfbar.php index 8c80afd0de..27fc07b6f7 100644 --- a/inc/modules/member/action-surfbar.php +++ b/inc/modules/member/action-surfbar.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 * diff --git a/inc/modules/member/what- b/inc/modules/member/what- index 9a3c1104f4..92b7347bac 100644 --- a/inc/modules/member/what- +++ b/inc/modules/member/what- @@ -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 * diff --git a/inc/modules/member/what-mydata.php b/inc/modules/member/what-mydata.php index 97554795d5..646a0a8b1c 100644 --- a/inc/modules/member/what-mydata.php +++ b/inc/modules/member/what-mydata.php @@ -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 index 0000000000..13c765104d --- /dev/null +++ b/inc/modules/member/what-surfbar_book.php @@ -0,0 +1,83 @@ + 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); +} + +// +?> diff --git a/inc/modules/member/what-surfbar_start.php b/inc/modules/member/what-surfbar_start.php index b90d08d338..65dddf0dc4 100644 --- a/inc/modules/member/what-surfbar_start.php +++ b/inc/modules/member/what-surfbar_start.php @@ -1,7 +1,7 @@ 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"); diff --git a/inc/monthly/monthly_ b/inc/monthly/monthly_ index 67c5a7f081..2dd861a40c 100644 --- a/inc/monthly/monthly_ +++ b/inc/monthly/monthly_ @@ -12,23 +12,23 @@ * -------------------------------------------------------------------- * * * * -------------------------------------------------------------------- * - * 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... diff --git a/inc/monthly/monthly_beg.php b/inc/monthly/monthly_beg.php index d5afb1cd3c..579f4de62c 100644 --- a/inc/monthly/monthly_beg.php +++ b/inc/monthly/monthly_beg.php @@ -32,25 +32,22 @@ ************************************************************************/ // 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 } + // ?> diff --git a/inc/monthly/monthly_bonus.php b/inc/monthly/monthly_bonus.php index b555dd3238..f4e465fb58 100644 --- a/inc/monthly/monthly_bonus.php +++ b/inc/monthly/monthly_bonus.php @@ -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 } + // ?> diff --git a/inc/monthly/monthly_newsletter.php b/inc/monthly/monthly_newsletter.php index a23eea936a..ed7eb9205b 100644 --- a/inc/monthly/monthly_newsletter.php +++ b/inc/monthly/monthly_newsletter.php @@ -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_newsletter.php b/inc/monthly/monthly_surfbar.php similarity index 63% rename from inc/monthly_newsletter.php rename to inc/monthly/monthly_surfbar.php index 018f57fdd3..cdcf1606ec 100644 --- a/inc/monthly_newsletter.php +++ b/inc/monthly/monthly_surfbar.php @@ -1,14 +1,14 @@ 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__); +// Do not execute when script is in CSS mode or no daily reset +if (($CSS == 1) || (defined('__DAILY_RESET'))) return; - // 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']); - } -} +// Reset surfbar counter +UPDATE_CONFIG("surfbar_monthly_counter", "0"); +$_CONFIG['surfbar_monthly_counter'] = 0; // ?> diff --git a/inc/mysql-connect.php b/inc/mysql-connect.php index 9cd96c8fa4..0bc771cb16 100644 --- a/inc/mysql-connect.php +++ b/inc/mysql-connect.php @@ -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)) { diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index f87c4c4c0d..a519c798b1 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -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."
"; @@ -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 +} // ?> diff --git a/inc/patch-system.php b/inc/patch-system.php index 984103c8b0..e3ec443cd3 100644 --- a/inc/patch-system.php +++ b/inc/patch-system.php @@ -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 // ?> diff --git a/inc/reset/reset_ b/inc/reset/reset_ index 6d6f0c0041..98eaa943fe 100644 --- a/inc/reset/reset_ +++ b/inc/reset/reset_ @@ -12,33 +12,30 @@ * -------------------------------------------------------------------- * * * * -------------------------------------------------------------------- * - * 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; } diff --git a/inc/reset/reset_beg.php b/inc/reset/reset_beg.php index e8fb34aecb..c668ba3b2e 100644 --- a/inc/reset/reset_beg.php +++ b/inc/reset/reset_beg.php @@ -32,19 +32,16 @@ ************************************************************************/ // 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", diff --git a/inc/reset/reset_daily.php b/inc/reset/reset_daily.php index 9df8158716..d18d2fbd62 100644 --- a/inc/reset/reset_daily.php +++ b/inc/reset/reset_daily.php @@ -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()); // ?> diff --git a/inc/reset/reset_holiday.php b/inc/reset/reset_holiday.php index 93397faf1a..45e8b9fd48 100644 --- a/inc/reset/reset_holiday.php +++ b/inc/reset/reset_holiday.php @@ -32,13 +32,10 @@ ************************************************************************/ // 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 index 0000000000..4fc2f6b741 --- /dev/null +++ b/inc/reset/reset_surfbar.php @@ -0,0 +1,51 @@ + diff --git a/inc/theme-manager.php b/inc/theme-manager.php index 5a3f843988..d03bbfa7c2 100644 --- a/inc/theme-manager.php +++ b/inc/theme-manager.php @@ -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 index 0000000000..14249c50bd --- /dev/null +++ b/inc/weekly/.htaccess @@ -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 index 0000000000..80ccc6be2e --- /dev/null +++ b/inc/weekly/weekly_ @@ -0,0 +1,47 @@ + diff --git a/inc/weekly/weekly_surfbar.php b/inc/weekly/weekly_surfbar.php new file mode 100644 index 0000000000..74ce5f6aa6 --- /dev/null +++ b/inc/weekly/weekly_surfbar.php @@ -0,0 +1,51 @@ + diff --git a/surfbar.php b/surfbar.php index 703e39be1f..8202188438 100644 --- a/surfbar.php +++ b/surfbar.php @@ -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 index 0000000000..1d86efc8a1 --- /dev/null +++ b/templates/de/emails/admin/admin_surfbar_url_reg.tpl @@ -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ütung/Aufruf: $content[reward] {!POINTS!} +------------------------------------------ +Status: $content[status] +------------------------------------------ +ID in der Surfbar: $content[insert_id] +------------------------------------------ + +{--ADMIN_THANX--} + {--YOUR--} {!MAIN_TITLE!} {--SCRIPT--} + +{!URL!}/admin.php diff --git a/templates/de/emails/admin/admin_surfbar_url_unlock.tpl b/templates/de/emails/admin/admin_surfbar_url_unlock.tpl index 1a7ac084a0..d02553d28c 100644 --- a/templates/de/emails/admin/admin_surfbar_url_unlock.tpl +++ b/templates/de/emails/admin/admin_surfbar_url_unlock.tpl @@ -15,7 +15,7 @@ $content[frametester] ------------------------------------------ User-ID: $content[uid] ------------------------------------------ -Vergütung: $content[reward] {!POINTS!} +Vergü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 index 0000000000..bef971efeb --- /dev/null +++ b/templates/de/emails/member/member_surfbar_url_reg.tpl @@ -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!}) diff --git a/templates/de/html/admin/admin_config_surfbar.tpl b/templates/de/html/admin/admin_config_surfbar.tpl index bb9ffa5c89..1f8f34b160 100644 --- a/templates/de/html/admin/admin_config_surfbar.tpl +++ b/templates/de/html/admin/admin_config_surfbar.tpl @@ -68,6 +68,15 @@ +   + + + {--ADMIN_CONFIG_SURFBAR_STATS_RELOAD--} + + + + +   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 index 0000000000..7336c0d7b5 --- /dev/null +++ b/templates/de/html/member/member_surfbar_book_dynamic.tpl @@ -0,0 +1,26 @@ +
+
+
+ URL in Surfbar buchen: +
+ +
+ URL eingeben: +
+ +
+ Jeder Seiten-Aufruf durch andere Mitglieder kostet Ihnen mindestens $content[costs] {!POINTS!}. Surfen Sie mit + der Surfbar erhalten Sie mindestens $content[reward] + {!POINTS!} auf Ihr Konto gutgeschrieben.
+
+ Sie haben bereits $content[curr_order] von maximal + $content[max_order] erlaubten URLs gebucht. +
+ +
+  * + +
+
+
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 index 0000000000..49385e17ce --- /dev/null +++ b/templates/de/html/member/member_surfbar_book_static.tpl @@ -0,0 +1,26 @@ +
+
+
+ URL in Surfbar buchen: +
+ +
+ URL eingeben: +
+ +
+ Jeder Seiten-Aufruf durch andere Mitglieder kostet Ihnen $content[costs] {!POINTS!}. Surfen Sie mit + der Surfbar erhalten Sie $content[reward] + {!POINTS!} auf Ihr Konto gutgeschrieben.
+
+ Sie haben bereits $content[curr_order] von maximal + $content[max_order] erlaubten URLs gebucht. +
+ +
+  * + +
+
+
diff --git a/templates/de/html/surfbar/surfbar_frame_stats.tpl b/templates/de/html/surfbar/surfbar_frame_stats.tpl new file mode 100644 index 0000000000..0e0ca5a329 --- /dev/null +++ b/templates/de/html/surfbar/surfbar_frame_stats.tpl @@ -0,0 +1,21 @@ + + + + +
+ »Guthaben: $content[points] {!POINTS!}« - + »Jetzt Online: $content[online]« - + »Seitenaufrufe: Heute:$content[c_today] - + Woche:$content[c_week] - + Monat:$content[c_month] - + Gesamt:$content[c_total]« +
+ \ No newline at end of file diff --git a/templates/de/html/surfbar/surfbar_frame_top.tpl b/templates/de/html/surfbar/surfbar_frame_top.tpl index da821e07dc..5da82c3da3 100644 --- a/templates/de/html/surfbar/surfbar_frame_top.tpl +++ b/templates/de/html/surfbar/surfbar_frame_top.tpl @@ -5,14 +5,13 @@ X Sekunden« »$content[curr_reload] von $content[max_urls] im Reload« »Guthaben: - $content[points] {!POINTS!}«
+ class="surfbar_max">$content[max_urls] im Reload«
»Aktuelle Seite in neuem - Fenster öffnen« [Loginbereich|Ausloggen|Schliessen]
+ Fenster öffnen« [Loginbereich|Ausloggen|Schliessen]
»{!MAIN_TITLE!} ist für den Inhalt nicht verantwortlich!« diff --git a/templates/de/html/surfbar/surfbar_frameset.tpl b/templates/de/html/surfbar/surfbar_frameset.tpl index a8abfa1bbe..e5e49ad8f2 100644 --- a/templates/de/html/surfbar/surfbar_frameset.tpl +++ b/templates/de/html/surfbar/surfbar_frameset.tpl @@ -5,12 +5,13 @@ if (top.frames.length > 0) { } //--> - + + Ihr Browser unterst&uuml;tzt keine Frames! diff --git a/templates/de/html/surfbar/surfbar_stopped.tpl b/templates/de/html/surfbar/surfbar_stopped.tpl index d08da48a3f..41bee3adfa 100644 --- a/templates/de/html/surfbar/surfbar_stopped.tpl +++ b/templates/de/html/surfbar/surfbar_stopped.tpl @@ -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 () { -- 2.30.2