Database columns changed in birthday, wernis news feed added
authorRoland Häder <roland@mxchange.org>
Fri, 12 Sep 2008 11:56:39 +0000 (11:56 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 12 Sep 2008 11:56:39 +0000 (11:56 +0000)
inc/databases.php
inc/extensions/ext-birthday.php
inc/extensions/ext-wernis.php
inc/modules/guest/action-main.php
inc/modules/guest/action-online.php
inc/modules/guest/action-sponsor.php
inc/modules/guest/what-wernis_portal.php
ref.php

index 5c25e944ac0d56d8d54cd7c7a205ec07045279f7..79e97ff2e48ac88f122e2e3b0d5c18a8df9c463e 100644 (file)
@@ -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);
index 3e8d6d8a9648decfcf85038a0b216366baa6f794..661e55e8b3e18a396cb3d0ea111d483aeeedd788 100644 (file)
@@ -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 <STRONG>md5()</STRONG> auf bessere Funktion <STRONG>generateHash()</STRONG> 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);
index 6ad1238c1029a267e64ce3ef947b9cc7e164df21..bc2c925691433f8bf43c4cdf34dca7d4c4fdd46a 100644 (file)
@@ -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
index 4c89048ccd56657555c6dd83e3050343d15bb011..e4f4562c8f20c63f1b2638e7658a60dc03ab3839 100644 (file)
@@ -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) {
index ec2317cbb5cc84d39afc0fb4b0960cee0836882d..5d7ba831d4d0a65166fca0047852496a5002955a 100644 (file)
  ************************************************************************/
 
 // Some security stuff...
-if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))
-{
+if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
-}
- elseif (!EXT_IS_ACTIVE("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, "<A class=\"menu_blur\" href=\"".URL."/modules.php?module=index&amp;what=active\">".$_CONFIG['menu_blur_spacer'].GUEST_ACTIVE_LINK."</A>");
 }
index 52d06df863f9e511dc9f31acbfefecff621199ad..70c3f925e74f73247d3e1efb005566a1136a5034 100644 (file)
@@ -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);
 }
index 7cd8ea8ab4e1d821247f4689bc35574ecdeeea1e..7a5df0860e8a4f84ddc36daeb0a966a620d3a72b 100644 (file)
@@ -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 7edc3ed7d09c6ac434b7110393415e529fb51ed6..d733f53f890d8728273b27f436b060d88761f03d 100644 (file)
--- 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");
 }