From daefa5dc8ffd7773e0c2556a5dcf33fa52196180 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 12 Sep 2008 11:56:39 +0000 Subject: [PATCH] Database columns changed in birthday, wernis news feed added --- inc/databases.php | 2 +- inc/extensions/ext-birthday.php | 16 +++++++++--- inc/extensions/ext-wernis.php | 8 ++++-- inc/modules/guest/action-main.php | 2 +- inc/modules/guest/action-online.php | 13 +++------- inc/modules/guest/action-sponsor.php | 3 +-- inc/modules/guest/what-wernis_portal.php | 2 +- ref.php | 31 +++++++++--------------- 8 files changed, 38 insertions(+), 39 deletions(-) diff --git a/inc/databases.php b/inc/databases.php index 5c25e944ac..79e97ff2e4 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -114,7 +114,7 @@ define('USAGE_BASE', "usage"); define('SERVER_URL', "http://www.mxchange.org"); // This current patch level -define('CURR_SVN_REVISION', "304"); +define('CURR_SVN_REVISION', "305"); // Take a prime number which is long (if you know a longer one please try it out!) define('_PRIME', 591623); diff --git a/inc/extensions/ext-birthday.php b/inc/extensions/ext-birthday.php index 3e8d6d8a96..661e55e8b3 100644 --- a/inc/extensions/ext-birthday.php +++ b/inc/extensions/ext-birthday.php @@ -39,13 +39,13 @@ if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF']))) } // Version number -$EXT_VERSION = "0.3.8"; +$EXT_VERSION = "0.3.9"; // Auto-set extension version if (empty($EXT_VER)) $EXT_VER = $EXT_VERSION; // Version history array (add more with , "0.1" and so on) -$EXT_VER_HISTORY = array("0.0", "0.1", "0.2", "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"); +$EXT_VER_HISTORY = array("0.0", "0.1", "0.2", "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"); switch ($EXT_LOAD_MODE) { @@ -179,6 +179,15 @@ PRIMARY KEY(id) // Update notes (these will be set as task text!) $UPDATE_NOTES = "Hash-Erstellung von md5() auf bessere Funktion generateHash() umgestellt."; break; + + case "0.3.9": // SQL queries for v0.3.8 + $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` CHANGE `birth_day` `birth_day` SMALLINT(2) UNSIGNED ZEROFILL NOT NULL DEFAULT '01', +CHANGE `birth_month` `birth_month` SMALLINT(2) UNSIGNED ZEROFILL NOT NULL DEFAULT '01', +CHANGE `birth_year` `birth_year` SMALLINT(4) UNSIGNED ZEROFILL NOT NULL DEFAULT '1970'"; + + // Update notes (these will be set as task text!) + $UPDATE_NOTES = "Datenbankspalten umgestellt auf SMALLINT() UNSIGNED ZEROFILL."; + break; } break; @@ -191,8 +200,7 @@ default: // Do stuff when extension is loaded // Save some RAM... unset($dummy); - if ((isBooleanConstantAndTrue('__DAILY_RESET')) && ($_CONFIG['birthday_points'] > 0)) - { + if ((isBooleanConstantAndTrue('__DAILY_RESET')) && ($_CONFIG['birthday_points'] > 0)) { // Daily reset was run and we shall pay points so we start checking for members who // has a birthday for today $INC_POOL[] = sprintf("%sinc/mails/birthday_mails.php", PATH); diff --git a/inc/extensions/ext-wernis.php b/inc/extensions/ext-wernis.php index 6ad1238c10..bc2c925691 100644 --- a/inc/extensions/ext-wernis.php +++ b/inc/extensions/ext-wernis.php @@ -82,14 +82,18 @@ PRIMARY KEY(id) $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES('wernis', 'list_wernis', 'Wernis-Anfragen auflisten', 'Listet alle Wernis-Auszahlungsanfragen Ihrer Mitglieder auf.', 2)"; // Member menu - $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (action, what, title, visible, locked, sort) VALUES('main', 'wernis', 'Wernis-Ein-/Auszahlungen', 'N', 'N', '11')"; + $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (action, what, title, visible, locked, sort) VALUES('main', 'wernis', 'Wernis-Ein-/Auszahlungen', 'N', 'N', 11)"; + + // Guest menu + $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_guest_menu (action, what, title, visible, locked, sort) VALUES('main', 'wernis_portal', 'WDS66-News', 'N', 'N', 7)"; break; case "remove": // Do stuff when removing extension // SQL commands to run $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_user_wernis"; $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admin_menu WHERE action='wernis'"; - $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_member_menu WHERE action='main' AND what='wernis' LIMIT 1"; + $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_member_menu WHERE what='wernis' LIMIT 1"; + $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_guest_menu WHERE what='wernis_portal' LIMIT 1"; break; case "activate": // Do stuff when admin activates this extension diff --git a/inc/modules/guest/action-main.php b/inc/modules/guest/action-main.php index 4c89048ccd..e4f4562c8f 100644 --- a/inc/modules/guest/action-main.php +++ b/inc/modules/guest/action-main.php @@ -45,7 +45,7 @@ ADD_DESCR("guest", basename(__FILE__)); $INC = sprintf("%sinc/modules/guest/what-%s.php", PATH, $GLOBALS['what']); $IS_VALID = WHAT_IS_VALID(GET_ACTION("guest", $GLOBALS['what']), $GLOBALS['what'], "guest"); -if (FILE_READABLE($INC)) && ($IS_VALID)) { +if ((FILE_READABLE($INC)) && ($IS_VALID)) { // Ok, we finally load the guest action module require_once($INC); } elseif ($IS_VALID) { diff --git a/inc/modules/guest/action-online.php b/inc/modules/guest/action-online.php index ec2317cbb5..5d7ba831d4 100644 --- a/inc/modules/guest/action-online.php +++ b/inc/modules/guest/action-online.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("online")) -{ +} elseif (!EXT_IS_ACTIVE("online")) { // Just skip this extension return; } @@ -49,8 +46,7 @@ $result_admins = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_online WHERE is_ad // Total visitors online $total = SQL_NUMROWS($result_guests) + SQL_NUMROWS($result_members) + SQL_NUMROWS($result_admins); -if ($_CONFIG['mad_counter'] < $total) -{ +if ($_CONFIG['mad_counter'] < $total) { // Update counter UPDATE_CONFIG(array("mad_timestamp", "mad_count"), array(time(), $total)); $_CONFIG['mad_counter'] = $total; @@ -65,8 +61,7 @@ define('ADMINS_ONLINE_CNT' , SQL_NUMROWS($result_admins)); // Output table LOAD_TEMPLATE("online_now"); -if (EXT_IS_ACTIVE("active")) -{ +if (EXT_IS_ACTIVE("active")) { // Add link to "we were active today" page LOAD_TEMPLATE("guest_menu_bottom", false, "".$_CONFIG['menu_blur_spacer'].GUEST_ACTIVE_LINK.""); } diff --git a/inc/modules/guest/action-sponsor.php b/inc/modules/guest/action-sponsor.php index 52d06df863..70c3f925e7 100644 --- a/inc/modules/guest/action-sponsor.php +++ b/inc/modules/guest/action-sponsor.php @@ -31,8 +31,7 @@ ************************************************************************/ // 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); } diff --git a/inc/modules/guest/what-wernis_portal.php b/inc/modules/guest/what-wernis_portal.php index 7cd8ea8ab4..7a5df0860e 100644 --- a/inc/modules/guest/what-wernis_portal.php +++ b/inc/modules/guest/what-wernis_portal.php @@ -53,7 +53,7 @@ $rdf->set_Options( array( "textinput" => "hidden", "sitelink" => "http://www.wds66.com", - "refid" => "10437", + "refid" => bigintval($_CONFIG['wernis_refid']), "reflink" => "/ref.php?refid=", ) ); diff --git a/ref.php b/ref.php index 7edc3ed7d0..d733f53f89 100644 --- a/ref.php +++ b/ref.php @@ -45,8 +45,7 @@ $GLOBALS['module'] = "ref"; $CSS = -1; require ("inc/config.php"); // Redirect only to registration page when this script is installed -if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_installed'))) -{ +if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_installed'))) { // Base URL for redirection switch ($_CONFIG['refid_target']) { @@ -61,19 +60,17 @@ if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_install // Get referral ID from ref or refid variable if (!empty($_GET['ref'])) $ref = secureString($_GET['ref']); - elseif (!empty($_GET['refid'])) $ref = bigintval($_GET['refid']); + elseif (!empty($_GET['refid'])) $ref = secureString($_GET['refid']); - if (!empty($ref)) - { - // Test if nickname ($test == "0") or ID - $test = "".round($ref).""; - if ((EXT_IS_ACTIVE("nickname")) && ($test != $ref)) - { + if (!empty($ref)) { + // Test if nickname or numeric id + if ((EXT_IS_ACTIVE("nickname")) && ($ref != "".bigintval($ref)."")) { // Nickname in URL, so load the ID - $result = SQL_QUERY_ESC("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE nickname='%s' LIMIT 1", array($ref), __FILE__, __LINE__); + $result = SQL_QUERY_ESC("SELECT userid FROM "._MYSQL_PREFIX."_user_data WHERE nickname='%s' LIMIT 1", + array($ref), __FILE__, __LINE__); list($ref) = SQL_FETCHROW($result); SQL_FREERESULT($result); - } + } // END - if // Also edit this 0 ! if (empty($ref)) $ref = "0"; @@ -83,19 +80,15 @@ if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_install // Update ref counter $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET ref_clicks=ref_clicks+1 WHERE userid=%s LIMIT 1", - array(bigintval($ref)), __FILE__, __LINE__); - } - else - { + array(bigintval($ref)), __FILE__, __LINE__); + } else { // No refid and we add our refid (don't forget to set $def_refid!) $URL = URL."/index.php"; } + // Load the URL LOAD_URL($URL); - // Redirection should be done here -} - else -{ +} else { // You have to configure first! LOAD_URL("install.php"); } -- 2.39.5