Fix for birthday timestamps < 0 (why this?)
[mailer.git] / inc / modules / admin / what-list_user.php
index 8618702c4d8e2d595d4f599bf55a9422a8a5c8bb..9e689ce6c4f681b95cf119af98289d26a960bade 100644 (file)
@@ -79,7 +79,10 @@ if (GET_EXT_VERSION("user") >= "0.3.4") {
 if (EXT_IS_ACTIVE("country")) {
        // Add country code
        $MORE .= ", country_code";
-} // END - if
+} else {
+       // Add direct value
+       $MORE .= ", country";
+}
 
 // Init unset data (bad that we change $_GET here!)
 if (empty($_GET['letter'])) { $_GET['letter'] = _ALL2;    }
@@ -115,8 +118,19 @@ LIMIT 1",
                if ($REFS > 0) $REFS = $BASE."&amp;what=list_refs&amp;u_id=".$uid."\">".$REFS."</A>]";
                if ($CATS > 0) $CATS = $BASE."&amp;what=list_cats&amp;u_id=".$uid."\">".$CATS."</A>]";
 
+               // Calculate timestamp for birthday
+               $stamp = MAKE_DATETIME(mktime(0, 0, 0, $DATA['birth_month'], $DATA['birth_day'], $DATA['birth_year']), "3");
+
+               // Is this above zero?
+               if ($stamp > 0) {
+                       // Then use it
+                       define('_BIRTHDAY', $stamp);
+               } else {
+                       // Zero or below so set zero!
+                       define('_BIRTHDAY', MAKE_DATETIME(0, "3"));
+               }
+
                // Prepare data for template
-               define('_BIRTHDAY', MAKE_DATETIME(mktime(0, 0, 0, $DATA['birth_month'], $DATA['birth_day'], $DATA['birth_year']), "3"));
                define('_REFS' , $REFS);
                define('_CATS' , $CATS);
                define('_LINKS', $LINKS);
@@ -222,16 +236,16 @@ LIMIT 1",
        $result_master = SQL_QUERY($SQL, __FILE__, __LINE__);
 
        // Calculate page count (0.5 fixes a bug with page count)
-       if ($_CONFIG['user_limit'] == 0) {
+       if (getConfig('user_limit') == 0) {
                $_CONFIG['user_limit'] = 100;
                LOAD_TEMPLATE("admin_settings_saved", false, EXTENSION_WARNING_USER_LIMIT);
        } // END - if
 
        // Activate the extension please!
-       $PAGES = round(SQL_NUMROWS($result_master) / $_CONFIG['user_limit'] + 0.5);
+       $PAGES = round(SQL_NUMROWS($result_master) / getConfig('user_limit') + 0.5);
 
        if (empty($_GET['page']))   $_GET['page']   = "1";
-       if (empty($_GET['offset'])) $_GET['offset'] = $_CONFIG['user_limit'];
+       if (empty($_GET['offset'])) $_GET['offset'] = getConfig('user_limit');
 
        // Add limitation to SQL string and run him again
        $SQL .= " LIMIT ".($_GET['offset'] * $_GET['page'] - $_GET['offset']).", ".$_GET['offset'];
@@ -259,7 +273,7 @@ LIMIT 1",
                }
 
                if ($PAGES > 1) {
-                       define('__PAGE_NAV', ADD_PAGENAV($PAGES, $_CONFIG['user_limit'], true, $colspan, true));
+                       define('__PAGE_NAV', ADD_PAGENAV($PAGES, getConfig('user_limit'), true, $colspan, true));
                } else {
                        // No page navigation is required
                        define('__PAGE_NAV', "");
@@ -323,7 +337,7 @@ LIMIT 1",
                        if (EXT_IS_ACTIVE("country")) {
                                // Then overwrite country information
                                $content['country'] = COUNTRY_GENERATE_INFO($content['country_code']);
-                       } elseif ($content['country'] == 0) {
+                       } elseif ($content['country'] == "") {
                                // Zero ID???
                                $content['country'] = "???";
                        }