external link icons removed, personal toolbar cleanup, relative paths
[lhc/web/wiklou.git] / includes / Block.php
index 13cb657..d98b07b 100644 (file)
@@ -1,4 +1,4 @@
-<?
+<?php
 # Blocks and bans object
 #
 #TODO: This could be used everywhere, but it isn't.
@@ -8,7 +8,7 @@
 #
 # To use delete(), you only need to fill $mAddress
 
-# Globals used: $wgIPBlockCache, $wgAutoblockExpiry
+# Globals used: $wgBlockCache, $wgAutoblockExpiry
 
 class Block
 {
@@ -179,7 +179,11 @@ class Block
 
        function isExpired() 
        {       
-               return wfTimestampNow() > $this->mExpiry;
+               if ( !$this->mExpiry ) {
+                       return false;
+               } else {
+                       return wfTimestampNow() > $this->mExpiry;
+               }
        }
 
        function isValid() 
@@ -187,17 +191,19 @@ class Block
                return $this->mAddress != "";
        }
        
-       function updateTimestamp() {
-               
-               $this->mTimestamp = wfTimestampNow();
-               $this->mExpiry = Block::getAutoblockExpiry( $this->mTimestamp );
-
-               wfQuery( "UPDATE ipblocks SET " .
-                       "ipb_timestamp='" . $this->mTimestamp . "', " .
-                       "ipb_expiry='" . $this->mExpiry . "' " .
-                       "WHERE ipb_address='" . wfStrencode( $this->mAddress ) . "'", DB_WRITE, "Block::updateTimestamp" );
-               
-               $this->clearCache();
+       function updateTimestamp() 
+       {
+               if ( $this->mAuto ) {
+                       $this->mTimestamp = wfTimestampNow();
+                       $this->mExpiry = Block::getAutoblockExpiry( $this->mTimestamp );
+
+                       wfQuery( "UPDATE ipblocks SET " .
+                               "ipb_timestamp='" . $this->mTimestamp . "', " .
+                               "ipb_expiry='" . $this->mExpiry . "' " .
+                               "WHERE ipb_address='" . wfStrencode( $this->mAddress ) . "'", DB_WRITE, "Block::updateTimestamp" );
+                       
+                       $this->clearCache();
+               }
        }
 
        /* private */ function clearCache()