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_list.php -text
inc/modules/member/what-surfbar_start.php -text
inc/modules/member/what-surfbar_stats.php -text
inc/modules/member/what-themes.php -text
// Add more includes
$INC_POOL = RESET_ADD_INCLUDES();
+ // Is this not an array?
+ if (!is_array($INC_POOL)) {
+ // Log the error
+ DEBUG_LOG(basename(__FILE__).":INC_POOL is no array!");
+
+ // Skip further executions
+ return;
+ } // END - if
+
// Run the full reset scripts
foreach ($INC_POOL as $incFile) {
require_once($incFile);
define('SERVER_URL', "http://www.mxchange.org");
// This current patch level
-define('CURR_SVN_REVISION', "354");
+define('CURR_SVN_REVISION', "355");
// Take a prime number which is long (if you know a longer one please try it out!)
define('_PRIME', 591623);
foreach ($EXT_VER_HISTORY as $EXT_VER)
{
require($file);
- if (((GET_EXT_VERSION("sql_patches") != '') && ($_CONFIG['verbose_sql'] == "Y")) || (!EXT_IS_ACTIVE("sql_patches")))
- {
- if (!empty($UPDATE_NOTES))
- {
+ if (((GET_EXT_VERSION("sql_patches") != "") && ($_CONFIG['verbose_sql'] == "Y")) || (!EXT_IS_ACTIVE("sql_patches"))) {
+ if (!empty($UPDATE_NOTES)) {
// Update notes found
$NOTES .= "<STRONG>v".$EXT_VER.":</STRONG><br />".$UPDATE_NOTES."<br /><br />\n";
$UPDATE_NOTES = "";
- }
- elseif (($EXT_VER == "0.0") || ($EXT_VER == "0.0.0"))
- {
+ } elseif (($EXT_VER == "0.0") || ($EXT_VER == "0.0.0")) {
// Initial release
$NOTES .= "<STRONG>v".$EXT_VER.":</STRONG><br />".INITIAL_RELEASE."<br /><br />\n";
- }
- else
- {
+ } else {
+ // No update notes found!
$NOTES .= "<STRONG>v".$EXT_VER.":</STRONG><br /><I>".NO_UPDATE_NOTES."</I><br /><br />\n";
}
}
$S = false; $SW = 2; $i = 1;
$OUT = "";
- if ((is_array($SQLs)) && (GET_EXT_VERSION("sql_patches")) && ($_CONFIG['verbose_sql'] == "Y")) {
+ if ((is_array($SQLs)) && (GET_EXT_VERSION("sql_patches") >= "0.0.7") && ($_CONFIG['verbose_sql'] == "Y")) {
$OUT = "<DIV align=\"center\">
<TABLE border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"".$WIDTH."\" align=\"center\"".$dashed.">
<TR>
}
}
- if ((!$S) && (GET_EXT_VERSION("sql_patches")) && ($_CONFIG['verbose_sql'] == "Y")) {
+ if ((!$S) && (GET_EXT_VERSION("sql_patches") >= "0.0.7") && ($_CONFIG['verbose_sql'] == "Y")) {
// No addional SQL commands to run
$OUT .= "<TR>
<TD colspan=\"2\" align=\"center\" class=\"switch_sw2 bottom2\" height=\"24\">
EXTENSION_RUN_SQLS(GET_EXT_ID($ext_name), "activate");
} // END - if
}
+// Checks wether the extension is older than given
+function EXT_VERSION_IS_OLDER ($ext_name, $ext_ver) {
+ // Get current extension version
+ $currVersion = GET_EXT_VERSION($ext_name);
+
+ // Remove all dots from both versions
+ $currVersion = str_replace(".", "", $currVersion);
+ $ext_ver = str_replace(".", "", $ext_ver);
+
+ // Now compare both and return the result
+ return ($currVersion < $ext_ver);
+}
//
?>
$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','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)";
+ $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES ('surfbar','surfbar_list','URL-Verwaltung','Y','Y',3)";
+ $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES ('surfbar','surfbar_stats','URL-Statistiken','Y','Y',4)";
// Admin menus
$SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('surfbar',NULL,'Surfbar','URLs in der Surfbar verwalten, Einstellungen ändern und vieles mehr.',7)";
$SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_locks`";
$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 4";
+ $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_member_menu` WHERE `action`='surfbar' LIMIT 5";
$SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE action='surfbar' LIMIT 6";
break;
// Load email template
$msg = LOAD_EMAIL_TEMPLATE($template, $content, $UID);
- if (GET_EXT_VERSION("admins") < "0.4.0") {
+ if (EXT_VERSION_IS_OLDER("admins", "0.4.0")) {
// Older version detected!
return SEND_ADMIN_EMAILS($subj, $msg);
- }
+ } // END - if
// Check which admin shall receive this mail
$result = SQL_QUERY_ESC("SELECT DISTINCT admin_id FROM "._MYSQL_PREFIX."_admins_mails WHERE mail_template='%s' ORDER BY admin_id",
global $_CONFIG, $_SERVER;
// Is the required extension "sql_patches" there and a salt is not given?
- if (((GET_EXT_VERSION("sql_patches") < "0.3.6") || (GET_EXT_VERSION("sql_patches") == "")) && (empty($salt))) {
+ if (((EXT_VERSION_IS_OLDER("sql_patches", "0.3.6")) || (GET_EXT_VERSION("sql_patches") == "")) && (empty($salt))) {
// Extension sql_patches is missing/outdated so we return the plain text
return $plainText;
} // END - if
global $_CONFIG;
// Is the reset set or old sql_patches?
- if ((!isBooleanConstantAndTrue('__DAILY_RESET')) || (GET_EXT_VERSION("sql_patches") < "0.4.5")) {
+ if ((!isBooleanConstantAndTrue('__DAILY_RESET')) || (EXT_VERSION_IS_OLDER("sql_patches", "0.4.5"))) {
// Then abort here
- return;
+ return array();
} // END - if
// Get more daily reset scripts
}
// Check for version of sql_patches
-if (GET_EXT_VERSION("sql_patches") < "0.3.6") return false;
+if (EXT_VERSION_IS_OLDER("sql_patches", "0.3.6")) return false;
// Check if there is no scrambling string
if (empty($_CONFIG['pass_scramble'])) {
function SURFBAR_DETERMINE_REWARD () {
global $_CONFIG;
+ // Static values are default
+ $reward = $_CONFIG['surfbar_static_reward'];
+
// 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!");
- }
+ if ($_CONFIG['surfbar_pay_model'] == "DYNAMIC") {
+ // "Calculate" dynamic reward
+ $reward += SURFBAR_CALCULATE_DYNAMIC_ADD();
+ } // END - if
// Return reward
return $reward;
}
+// "Calculate" dynamic add
+function SURFBAR_CALCULATE_DYNAMIC_ADD () {
+ // Get min/max values
+ $min = SURFBAR_CALCULATE_DYNAMIC_MIN_VALUE();
+ $max = SURFBAR_CALCULATE_DYNAMIC_MAX_VALUE();
+
+ // "Calculate" dynamic part and return it
+ return mt_rand($min, $max);
+}
// Determine costs
function SURFBAR_DETERMINE_COSTS () {
global $_CONFIG;
+ // Static costs is default
+ $costs = $_CONFIG['surfbar_static_costs'];
+
// 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!");
- }
+ if ($_CONFIG['surfbar_pay_model'] == "DYNAMIC") {
+ // "Calculate" dynamic costs
+ $costs += SURFBAR_CALCULATE_DYNAMIC_ADD();
+ } // END - if
// Return costs
return $costs;
// Default is full!
$isFull = true;
- // Do we have static or dynamic mode?
- if ($_CONFIG['surfbar_pay_model'] == "STATIC") {
- // Cache static reload lock
- $SURFBAR_CACHE['surf_lock'] = $_CONFIG['surfbar_static_lock'];
- //DEBUG_LOG(__FUNCTION__.":Fixed surf lock is ".$_CONFIG['surfbar_static_lock']."");
+ // Cache static reload lock
+ $SURFBAR_CACHE['surf_lock'] = $_CONFIG['surfbar_static_lock'];
+ //DEBUG_LOG(__FUNCTION__.":Fixed surf lock is ".$_CONFIG['surfbar_static_lock']."");
+
+ // Do we have dynamic model?
+ if ($_CONFIG['surfbar_pay_model'] == "DYNAMIC") {
+ // "Calculate" dynamic lock
+ $SURFBAR_CACHE['surf_lock'] += SURFBAR_CALCULATE_DYNAMIC_ADD();
+ } // END - if
- // Ask the database
- $result = SQL_QUERY_ESC("SELECT COUNT(id) AS cnt FROM "._MYSQL_PREFIX."_surfbar_locks
+ // Ask the database
+ $result = SQL_QUERY_ESC("SELECT COUNT(id) AS cnt FROM "._MYSQL_PREFIX."_surfbar_locks
WHERE userid=%s AND (UNIX_TIMESTAMP() - ".SURFBAR_GET_DATA('surf_lock').") < UNIX_TIMESTAMP(last_surfed)
LIMIT 1",
- array($GLOBALS['userid']), __FILE__, __LINE__
- );
+ array($GLOBALS['userid']), __FILE__, __LINE__
+ );
- // Fetch row
- list($SURFBAR_CACHE['user_locks']) = SQL_FETCHROW($result);
+ // Fetch row
+ list($SURFBAR_CACHE['user_locks']) = SQL_FETCHROW($result);
- // Is it null?
- if (is_null($SURFBAR_CACHE['user_locks'])) {
- // Then fix it to zero!
- $SURFBAR_CACHE['user_locks'] = 0;
- } // END - if
+ // Is it null?
+ if (is_null($SURFBAR_CACHE['user_locks'])) {
+ // Then fix it to zero!
+ $SURFBAR_CACHE['user_locks'] = 0;
+ } // END - if
- // Free result
- SQL_FREERESULT($result);
+ // Free result
+ SQL_FREERESULT($result);
- // Get total URLs
- $total = SURFBAR_GET_TOTAL_URLS();
+ // Get total URLs
+ $total = SURFBAR_GET_TOTAL_URLS();
- // Do we have some URLs in lock? Admins can always surf on own URLs!
- //DEBUG_LOG(__FUNCTION__.":userLocks=".SURFBAR_GET_DATA('user_locks').",total={$total}");
- $isFull = ((SURFBAR_GET_DATA('user_locks') == $total) && ($total > 0));
- } else {
- // Dynamic model...
- die("DYNAMIC not yet implemented!");
- }
+ // Do we have some URLs in lock? Admins can always surf on own URLs!
+ //DEBUG_LOG(__FUNCTION__.":userLocks=".SURFBAR_GET_DATA('user_locks').",total={$total}");
+ $isFull = ((SURFBAR_GET_DATA('user_locks') == $total) && ($total > 0));
// Return result
return $isFull;
}
// Get total amount of URLs of given status for current user or of CONFIRMED URLs by default
-function SURFBAR_GET_TOTAL_URLS ($status="CONFIRMED") {
+function SURFBAR_GET_TOTAL_URLS ($status="CONFIRMED", $excludeUserId="") {
// Determine depleted user account
$UIDs = SURFBAR_DETERMINE_DEPLETED_USERIDS();
+ // Is the exlude userid set?
+ if ($excludeUserId !== "") {
+ // Then add it
+ $UIDs[] = $excludeUserId;
+ } // END - if
+
// Get amount from database
$result = SQL_QUERY_ESC("SELECT COUNT(id) AS cnt
FROM "._MYSQL_PREFIX."_surfbar_urls
return ((($uid == 0) && (IS_ADMIN())) || (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) {
+function SURFBAR_GET_TOTAL_USER_URLS ($uid=0, $status="") {
global $_CONFIG;
// Is the user 0 and user is logged in?
return ($_CONFIG['surfbar_max_order'] + 1);
}
+ // Default is all URLs
+ $ADD = "";
+
+ // Is the status set?
+ if (!empty($status)) {
+ $ADD = sprintf(" AND status='%s'", $status);
+ } // END - if
+
// Get amount from database
$result = SQL_QUERY_ESC("SELECT COUNT(id) AS cnt
FROM "._MYSQL_PREFIX."_surfbar_urls
-WHERE userid=%s
+WHERE userid=%s".$ADD."
LIMIT %s",
array($uid, $_CONFIG['surfbar_max_order']), __FILE__, __LINE__
);
function SURFBAR_DETERMINE_WAIT_TIME () {
global $_CONFIG;
- // Init time
- $time = 0;
+ // Static time is default
+ $time = $_CONFIG['surfbar_static_time'];
// Which payment model do we have?
- if ($_CONFIG['surfbar_pay_model'] == "STATIC") {
- // Static model
- $time = $_CONFIG['surfbar_static_time'];
- } else {
- // Dynamic
- die("DYNAMIC payment model not yet finished!");
- }
+ if ($_CONFIG['surfbar_pay_model'] == "DYNAMIC") {
+ // "Calculate" dynamic time
+ $time += SURFBAR_CALCULATE_DYNAMIC_ADD();
+ } // END - if
// Return value
return $time;
$addon += abs(log($onlineUsers / $totalUsers + 1) * $percent * $totalUsers);
// Get total URLs
- $totalUrls = SURFBAR_GET_TOTAL_URLS();
+ $totalUrls = SURFBAR_GET_TOTAL_URLS("CONFIRMED", "0");
// Get user's total URLs
- $userUrls = SURFBAR_GET_TOTAL_USER_URLS();
+ $userUrls = SURFBAR_GET_TOTAL_USER_URLS(0, "CONFIRMED");
// Calculate addon
- $addon += abs(log($userUrls / $totalUrls + 1) * $percent * $totalUrls);
+ if ($totalUrls > 0) {
+ $addon += abs(log($userUrls / $totalUrls + 1) * $percent * $totalUrls);
+ } else {
+ $addon += abs(log($userUrls / 1 + 1) * $percent * $totalUrls);
+ }
// Return addon
return $addon;
$addon += abs($max * $percent * $totalUsers);
// Get total URLs
- $totalUrls = SURFBAR_GET_TOTAL_URLS();
+ $totalUrls = SURFBAR_GET_TOTAL_URLS("CONFIRMED", "0");
// Calculate addon
$addon += abs($max * $percent * $totalUrls);
$onlineUsers = SURFBAR_DETERMINE_TOTAL_ONLINE();
// Calculate lock
- $addon = abs(log($onlineUsers / $addon +1));
+ $addon = abs(log($onlineUsers / $addon + 1));
// Return value
return $addon;
// 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();
+ $SURFBAR_CACHE['reward'] += SURFBAR_CALCULATE_DYNAMIC_ADD();
+ $SURFBAR_CACHE['costs'] += SURFBAR_CALCULATE_DYNAMIC_ADD();
//DEBUG_LOG(__FUNCTION__.":DYNAMIC+ - reward=".SURFBAR_GET_REWARD()."|costs=".SURFBAR_GET_COSTS()."");
} // END - if
$data['password'] = generateHash($password);
// Is the sql_patches not installed, than we cannot have a valid hashed password here!
- if (($ret == "pass") && ((GET_EXT_VERSION("sql_patches") < "0.3.6") || (GET_EXT_VERSION("sql_patches") == ""))) $ret = "done";
- } elseif ((GET_EXT_VERSION("sql_patches") < "0.3.6") || (GET_EXT_VERSION("sql_patches") == "")) {
+ if (($ret == "pass") && ((EXT_VERSION_IS_OLDER("sql_patches", "0.3.6")) || (GET_EXT_VERSION("sql_patches") == ""))) $ret = "done";
+ } elseif ((EXT_VERSION_IS_OLDER("sql_patches", "0.3.6")) || (GET_EXT_VERSION("sql_patches") == "")) {
// Old hashing way
return $ret;
} elseif (!isset($data['password'])) {
global $cacheInstance;
// Reset failture counter on matching admins version
- if ((GET_EXT_VERSION("admins") >= "0.7.0") && ((GET_EXT_VERSION("sql_patches") < "0.3.6") || (GET_EXT_VERSION("sql_patches") == ""))) {
+ if ((GET_EXT_VERSION("admins") >= "0.7.0") && ((EXT_VERSION_IS_OLDER("sql_patches", "0.3.6")) || (GET_EXT_VERSION("sql_patches") == ""))) {
// Reset counter on out-dated sql_patches version
SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_admins SET login_failtures=0,last_failture='0000-00-00 00:00:00' WHERE login='%s' LIMIT 1",
array($adminLogin), __FILE__, __LINE__);
define('__TLOCK_VALUE', TRANSLATE_COMMA($TLOCK));
// Fixes a bug when there is no bonus extension installed
-if (GET_EXT_VERSION("bonus") < "0.4.4") $_CONFIG['bonus_active'] = "X";
+if (EXT_VERSION_IS_OLDER("bonus", "0.4.4")) $_CONFIG['bonus_active'] = "X";
// Display login bonus and turbo-click bonus
if ((GET_EXT_VERSION("bonus") >= "0.2.2") && (EXT_IS_ACTIVE("bonus")) && ($_CONFIG['bonus_active'] == "Y")) {
} elseif ($_CONFIG['bonus_active'] == "N") {
// Bonus active rallye deactivated
define('__SPECIAL_ROWS', LOAD_TEMPLATE("member_points_bonus_disabled", true));
-} elseif ((IS_ADMIN()) && (GET_EXT_VERSION("bonus") < "0.2.2") && (EXT_IS_ACTIVE("bonus"))) {
+} elseif ((IS_ADMIN()) && (EXT_VERSION_IS_OLDER("bonus", "0.2.2")) && (EXT_IS_ACTIVE("bonus"))) {
// Please upgrade your bonus extension to v0.2.2 or newer!
define('__SPECIAL_ROWS', LOAD_TEMPLATE("member_points_upgrade"));
} else {
--- /dev/null
+<?php
+/************************************************************************
+ * MXChange v0.2.1 Start: 09/17/2008 *
+ * ================ Last change: 09/17/2008 *
+ * *
+ * -------------------------------------------------------------------- *
+ * File : what-surfbar_list.php *
+ * -------------------------------------------------------------------- *
+ * Short description : Surfbar URL statistics *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung : Surfbar-Statistiken *
+ * -------------------------------------------------------------------- *
+ * *
+ * -------------------------------------------------------------------- *
+ * 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 (!defined('__SECURITY')) {
+ $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
+ require($INC);
+} elseif (!IS_MEMBER()) {
+ LOAD_URL(URL."/modules.php?module=index");
+}
+
+// Add description as navigation point
+ADD_DESCR("member", basename(__FILE__));
+
+//
+?>
<?php
/************************************************************************
- * MXChange v0.2.1 Start: 09/10/2004 *
+ * MXChange v0.2.1 Start: 09/10/2008 *
* ================ Last change: 09/10/2008 *
* *
* -------------------------------------------------------------------- *
} elseif (!empty($GLOBALS['action'])) {
// Get it directly from URL
return $GLOBALS['action'];
- } else {
- // Everything else will be touched after checking the module has a menu assigned
}
//* DEBUG: */ echo __LINE__."*".$ret."*<br />\n";
- if (MODULE_HAS_MENU($MODE))
- {
+ if (MODULE_HAS_MENU($MODE)) {
// Rewriting modules to menu
- switch ($MODE)
- {
+ switch ($MODE) {
case "index": $MODE = "guest"; break;
case "login": $MODE = "member"; break;
- break;
- }
+ } // END - switch
// Guest and member menu is "main" as the default
if (empty($ret)) $ret = "main";
if (SQL_NUMROWS($result) == 1) {
// Load action value and pray that this one is the right you want... ;-)
list($ret) = SQL_FETCHROW($result);
- }
+ } // END - if
// Free memory
SQL_FREERESULT($result);
- }
+ } // END - if
// Return action value
return $ret;
// Is the category id set?
if (!empty($cid)) {
-
- // Lookup the category
+ // Lookup the category in database
$result = SQL_QUERY_ESC("SELECT cat FROM "._MYSQL_PREFIX."_cats WHERE id=%s LIMIT 1",
array(bigintval($cid)), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {