mango r183 - in trunk: . lib www



Author: ovitters
Date: Sun Jun  1 14:14:14 2008
New Revision: 183
URL: http://svn.gnome.org/viewvc/mango?rev=183&view=rev

Log:
	Fix loads of E_STRICT errors and convert a few things to PHP5 style
	classes.
	* lib/account.php:
	* lib/authtoken.php:
	* lib/foundationmember.php:
	* lib/ftpmirror.php:
	* lib/ldap.php:
	* lib/module.php:
	* lib/page.php:
	* lib/user.php:
	* www/common.php:
	* www/index.php:
	* www/list_accounts.php:
	* www/list_foundationmembers.php:
	* www/list_ftpmirrors.php:
	* www/list_modules.php:
	* www/list_users.php:
	* www/login.php:
	* www/new_account.php:
	* www/new_foundationmember.php:
	* www/new_ftpmirror.php:
	* www/new_module.php:
	* www/new_user.php:
	* www/update_foundationmember.php:
	* www/update_ftpmirror.php:
	* www/update_module.php:
	* www/update_user.php:



Modified:
   trunk/ChangeLog
   trunk/lib/account.php
   trunk/lib/authtoken.php
   trunk/lib/foundationmember.php
   trunk/lib/ftpmirror.php
   trunk/lib/ldap.php
   trunk/lib/module.php
   trunk/lib/page.php
   trunk/lib/user.php
   trunk/www/common.php
   trunk/www/index.php
   trunk/www/list_accounts.php
   trunk/www/list_foundationmembers.php
   trunk/www/list_ftpmirrors.php
   trunk/www/list_modules.php
   trunk/www/list_users.php
   trunk/www/login.php
   trunk/www/new_account.php
   trunk/www/new_foundationmember.php
   trunk/www/new_ftpmirror.php
   trunk/www/new_module.php
   trunk/www/new_user.php
   trunk/www/update_foundationmember.php
   trunk/www/update_ftpmirror.php
   trunk/www/update_module.php
   trunk/www/update_user.php

Modified: trunk/lib/account.php
==============================================================================
--- trunk/lib/account.php	(original)
+++ trunk/lib/account.php	Sun Jun  1 14:14:14 2008
@@ -76,7 +76,7 @@
             $this->is_mail_verified = 'N';
             $this->is_new_account = 'Y';
             $this->status = 'M';
-            $this->timestamp = date ('Y-m-d H:m:s');
+            $this->timestamp = gmdate ('Y-m-d H:m:s');
             $this->abilities = array ();
             $this->mail_token = $this->create_token();
         }
@@ -91,7 +91,7 @@
         $random_file = fopen("/dev/urandom", "r");
         $random_bytes = base64_encode(fgets($random_file, 20));
         fclose($random_file);
-        return sha1('mango'.date('c').$salt.$random_bytes);
+        return sha1('mango'.gmdate('c').$salt.$random_bytes);
     }
     
     function add_account () { 
@@ -371,7 +371,7 @@
         return $result;
     }
     
-    function get_accountsteam_actions($keyword, $status) { 
+    static function get_accountsteam_actions($keyword, $status) { 
         global $config;
 
         if (empty($status)) $status = 'S';
@@ -389,7 +389,7 @@
         return $return;
     }
     
-    function get_pending_actions ($vouch_group = 'gnomecvs') { 
+    static public function get_pending_actions ($vouch_group = 'gnomecvs') { 
         global $config;
         
         $return = array ();

Modified: trunk/lib/authtoken.php
==============================================================================
--- trunk/lib/authtoken.php	(original)
+++ trunk/lib/authtoken.php	Sun Jun  1 14:14:14 2008
@@ -224,7 +224,7 @@
 "YEAR", "YELL", "YOGA", "YOKE");
 
 class AuthToken {
-    function extract(&$bytes, $start, $bits) {
+    static function extract(&$bytes, $start, $bits) {
         $i = $start / 8;
         $res = 0;
 
@@ -240,7 +240,7 @@
         return $res;
     }
 
-    function pad(&$bytes) {
+    static function pad(&$bytes) {
         $parity = 0;
         for($i = 0; $i < 32; $i++) {
             $parity += AuthToken::extract($bytes, $i * 2, 2);
@@ -249,7 +249,7 @@
         return $bytes .= chr(($parity << 6) % 256);
     }
 
-    function read_key() {
+    static function read_key() {
         $f = fopen("/dev/random", "r");
         $key = fread($f, 8);
         fclose($f);
@@ -257,7 +257,7 @@
         return $key;
     }
 
-    function generate() {
+    static function generate() {
         global $WORDS;
 
         $bytes = AuthToken::read_key();

Modified: trunk/lib/foundationmember.php
==============================================================================
--- trunk/lib/foundationmember.php	(original)
+++ trunk/lib/foundationmember.php	Sun Jun  1 14:14:14 2008
@@ -7,18 +7,19 @@
 
 class FoundationMember {
     // Main attributes
-    var $id;
-    var $firstname;
-    var $lastname;
-    var $email;
-    var $userid;            // GNOME userid
-    var $comments;
-    var $renew;             // denotes that member's membership is renewed.
-    var $first_added;
-    var $need_to_renew;
-    var $last_renewed_on;
-    var $last_update;
-    var $resigned_on;   // denotes time when a member retired
+    public
+        $id,
+        $firstname,
+        $lastname,
+        $email,
+        $userid,            // GNOME userid
+        $comments,
+        $renew,             // denotes that member's membership is renewed.
+        $first_added,
+        $need_to_renew,
+        $last_renewed_on,
+        $last_update,
+        $resigned_on;   // denotes time when a member retired
         
     function absorb($record) {
         $member = new FoundationMember();
@@ -43,7 +44,7 @@
         return $member;
     }
     
-    function listmembers(&$results) {
+    static function listmembers(&$results) {
         global $config;
         
         // If no results...
@@ -117,7 +118,7 @@
         return true;
     }
 
-    function fetchmember($id) {
+    static function fetchmember($id) {
         global $config;
         
         // Get database connection
@@ -149,7 +150,7 @@
         /* Get old record */
         $oldrec = FoundationMember::fetchmember($this->id);
         if(PEAR::isError($oldrec)) return $oldrec;
-        if(!is_a($oldrec, "FoundationMember")) {
+        if(! $oldrec instanceof FoundationMember) {
             return PEAR::raiseError("No Foundation member exists for the id '".$this->id."'");
         }
 

Modified: trunk/lib/ftpmirror.php
==============================================================================
--- trunk/lib/ftpmirror.php	(original)
+++ trunk/lib/ftpmirror.php	Sun Jun  1 14:14:14 2008
@@ -4,15 +4,16 @@
 
 class FTPMirror {
 	// Main attributes
-	var $id;
-	var $name;
-	var $url;
-	var $location;
-	var $email;
-	var $comments;
-	var $description;
-	var $active;
-	var $last_update;
+    private
+	    $id,
+	    $name,
+	    $url,
+	    $location,
+	    $email,
+	    $comments,
+	    $description,
+	    $active,
+	    $last_update;
 		
 	function absorb($record) {
 		$mirror = new FTPMirror();
@@ -28,7 +29,7 @@
 		return $mirror;
 	}
 	
-	function listmirrors(&$results) {
+	static function listmirrors(&$results) {
 		global $config;
 		
 		// If no results...
@@ -95,7 +96,7 @@
 		return true;
 	}
 
-	function fetchmirror($id) {
+	static function fetchmirror($id) {
 		global $config;
 		
         // Get database connection
@@ -127,7 +128,7 @@
 		/* Get old record */
 		$oldrec = FTPMirror::fetchmirror($this->id);
 		if(PEAR::isError($oldrec)) return $oldrec;
-		if(!is_a($oldrec, "FTPMirror")) {
+		if(!$oldrec instanceof FTPMirror) {
 			return PEAR::raiseError("No FTP mirror exists for the id '".$this->id."'");
 		}
 

Modified: trunk/lib/ldap.php
==============================================================================
--- trunk/lib/ldap.php	(original)
+++ trunk/lib/ldap.php	Sun Jun  1 14:14:14 2008
@@ -73,7 +73,7 @@
         trigger_error('Clone is not allowed.', E_USER_ERROR);
     }
 
-    function ldap_quote($str) {
+    static function ldap_quote($str) {
         return str_replace(
             array( '\\', ' ', '*', '(', ')' ),
             array( '\\5c', '\\20', '\\2a', '\\28', '\\29' ),

Modified: trunk/lib/module.php
==============================================================================
--- trunk/lib/module.php	(original)
+++ trunk/lib/module.php	Sun Jun  1 14:14:14 2008
@@ -5,18 +5,17 @@
 
 class Module {
     // Main attributes
-    var $cn;
-    var $description;
+    public
+        $cn,
+        $description,
         
-    // Details of the maintainers for this module
-    var $maintainerUids;
+        $maintainerUids,     // Details of the maintainers for this module
 
-    // Has 'localizationModule' objectclass set?
-    var $localizationModule;
-    var $localizationTeam;
-    var $mailingList;
+        $localizationModule, // Has 'localizationModule' objectclass set?
+        $localizationTeam,
+        $mailingList;
         
-    function Module() {
+    function __construct() {
         $this->maintainerUids = array();
         $this->localizationModule = false;
     }
@@ -44,7 +43,7 @@
         return $module;
     }
     
-    function listmodule(&$results, $moduletype = "all") {
+    static function listmodule(&$results, $moduletype = "all") {
         global $config;
         
         // Process list of CNs into an LDAP search criteria
@@ -93,7 +92,7 @@
         $entries = ldap_get_entries($ldap, $result);
         
         return $entries;
-    }           
+    }
     
     function addmodule() {
         global $config;
@@ -175,7 +174,7 @@
         // Pull up existing record for comparison
         $oldmodule = Module::fetchmodule($this->cn);
         if(PEAR::isError($oldmodule)) return $oldmodule;
-        if(!is_a($oldmodule, "Module")) {
+        if(!$oldmodule instanceof Module) {
             return PEAR::raiseError("No module (".$this->cn.") found!");
         }
         

Modified: trunk/lib/page.php
==============================================================================
--- trunk/lib/page.php	(original)
+++ trunk/lib/page.php	Sun Jun  1 14:14:14 2008
@@ -24,7 +24,7 @@
                 $this->result->appendChild($node);
 	}
 
-	public function validate_post() {
+	static public function validate_post() {
 		// SECURITY: Protect against CSRF (POST only)
 		// Based upon the method used by Michal Cihar (michal cihar com), phpMyAdmin (GPL)
 		if($_SERVER['REQUEST_METHOD'] == 'POST') {
@@ -117,13 +117,13 @@
 		$pagenode->setAttribute("support", $config->support_email);
 
 		/* Add page generation date */
-		$pagenode->setAttribute("date", strftime("%d %B %y %T %Z"));
+		$pagenode->setAttribute("date", gmstrftime("%d %B %y %T %Z"));
 
 		/* If user registered in session, add info */
 		if (isset ($_SESSION['user']))
 			$user = $_SESSION['user'];
 			
-		if(isset($user) && is_a($user, "User") && !isset($_REQUEST['logout'])) {
+		if(isset($user) && $user instanceof User && !isset($_REQUEST['logout'])) {
 			$pagenode->appendChild($usernode = $dom->createElement("user"));
 			$usernode->appendChild($node = $dom->createElement("cn"));
 			$node->appendChild($dom->createTextNode($user->cn));
@@ -169,7 +169,7 @@
 	 * @access public
 	 * @since 1.0
 	 */
-	public function generate_token() {
+	static function generate_token() {
 		if (!isset($_SESSION[' token_bits '])) {
 			$_SESSION[' token_bits '] = sha1(uniqid(rand(), true));
 		}

Modified: trunk/lib/user.php
==============================================================================
--- trunk/lib/user.php	(original)
+++ trunk/lib/user.php	Sun Jun  1 14:14:14 2008
@@ -29,7 +29,7 @@
         $this->pubkeyauthenticationuser = false;
     }
 
-    function absorb($entry) {
+    static function absorb($entry) {
         $user = new User();
         $user->uid = $entry['uid'][0];
         $user->cn = $entry['cn'][0];
@@ -52,7 +52,7 @@
         return $user;
     }
     
-    function listusers(&$results) {
+    static function listusers(&$results) {
         global $config;
         
         // Process list of UIDs into an LDAP search criteria
@@ -82,7 +82,7 @@
         return $entries;
     }           
     
-    function adduser() {
+    public function adduser() {
         global $config;
         
         // Connect to LDAP server
@@ -156,7 +156,7 @@
 
     // by default this searches for 'uid', but can handle other things as well
     // NOTE: will always pick the first user returned!
-    function fetchuser($search_for, $attribute = "uid") {
+    static function fetchuser($search_for, $attribute = "uid") {
         global $config;
         
         // Connect to LDAP server
@@ -200,7 +200,7 @@
         return $user;
     }
     
-    function update() {
+    public function update() {
         global $config;
         
         // Connect to LDAP server
@@ -213,7 +213,7 @@
         // Pull up existing record for comparison
         $olduser = User::fetchuser($this->uid);
         if(PEAR::isError($olduser)) return $olduser;
-        if(!is_a($olduser, "User")) {
+        if(!$olduser instanceof User) {
             return PEAR::raiseError("No user (".$this->uid.") found!");
         }
         

Modified: trunk/www/common.php
==============================================================================
--- trunk/www/common.php	(original)
+++ trunk/www/common.php	Sun Jun  1 14:14:14 2008
@@ -6,7 +6,7 @@
 /* Check permissions */
 function check_permissions(&$dom, &$pagenode, $group) {
 	$user = $_SESSION['user'];
-	if(!$user || !is_a($user, "User")) {
+	if(!$user || !$user instanceof User) {
 		$pagenode->appendChild($dom->createElement("notloggedin"));
                 $pagenode->setAttribute("title", "Login required");
 		return false;

Modified: trunk/www/index.php
==============================================================================
--- trunk/www/index.php	(original)
+++ trunk/www/index.php	Sun Jun  1 14:14:14 2008
@@ -16,7 +16,7 @@
 // Check if user is a maintainer of a module or language
 $is_maintainer = false; 
 $is_coordinator = false;
-if (isset($_SESSION['user']) && is_a ($_SESSION['user'], 'User')) { 
+if (isset($_SESSION['user']) && $_SESSION['user'] instanceof User) { 
     $rootnode->setAttribute("title", "Main page");
 
     $vouchers = array();

Modified: trunk/www/list_accounts.php
==============================================================================
--- trunk/www/list_accounts.php	(original)
+++ trunk/www/list_accounts.php	Sun Jun  1 14:14:14 2008
@@ -28,10 +28,10 @@
     }
     
     
-    function main() {
+   static function main() {
         // Check session for previous instance
-        $container = $_SESSION[SESSIONID];
-        if(!is_a($container, "ListAccounts") || isset($_REQUEST['reload'])) {
+        $container = isset($_SESSION[SESSIONID]) ? $_SESSION[SESSIONID] : null;
+        if(!$container instanceof ListAccounts || isset($_REQUEST['reload'])) {
             $container = new ListAccounts();
             $container->reload();
             $_SESSION[SESSIONID] = $container;

Modified: trunk/www/list_foundationmembers.php
==============================================================================
--- trunk/www/list_foundationmembers.php	(original)
+++ trunk/www/list_foundationmembers.php	Sun Jun  1 14:14:14 2008
@@ -81,12 +81,12 @@
         $this->foundationmembers = new PagedResults($results);
     }
     
-    function main() {
+   static function main() {
         global $config;
 
         // Check session for previous instance
-        $container = $_SESSION[SESSIONID];
-        if(!is_a($container, "ListFoundationMembers") || isset($_REQUEST['reload'])) {
+        $container = isset($_SESSION[SESSIONID]) ? $_SESSION[SESSIONID] : null;
+        if(!$container instanceof ListFoundationMembers || isset($_REQUEST['reload'])) {
             $container = new ListFoundationMembers();
             $container->reload();
             $_SESSION[SESSIONID] = $container;
@@ -134,7 +134,7 @@
         // ...other filters...
         if (isset($_POST['renew'])) {
             $foundationmember = FoundationMember::fetchmember($_POST['renew']);
-            if(!is_a($foundationmember, "FoundationMember")) {
+            if(!$foundationmember instanceof FoundationMember) {
                 $this->error = $foundationmember;
             } else {
                 $buffer = $foundationmember->renew();

Modified: trunk/www/list_ftpmirrors.php
==============================================================================
--- trunk/www/list_ftpmirrors.php	(original)
+++ trunk/www/list_ftpmirrors.php	Sun Jun  1 14:14:14 2008
@@ -59,12 +59,12 @@
 		$this->ftpmirrors = new PagedResults($results);
 	}
 	
-	function main() {
+       static function main() {
 		global $config;
 
 		// Check session for previous instance
-		$container = $_SESSION[SESSIONID];
-		if(!is_a($container, "ListFTPMirrors") || isset($_REQUEST['reload'])) {
+		$container = isset($_SESSION[SESSIONID]) ? $_SESSION[SESSIONID] : null;
+		if(!$container instanceof ListFTPMirrors || isset($_REQUEST['reload'])) {
 			$container = new ListFTPMirrors();
 			$container->reload();
 			$_SESSION[SESSIONID] = $container;

Modified: trunk/www/list_modules.php
==============================================================================
--- trunk/www/list_modules.php	(original)
+++ trunk/www/list_modules.php	Sun Jun  1 14:14:14 2008
@@ -70,12 +70,12 @@
 		$this->modules = new PagedResults($results);
 	}
 	
-	function main() {
+       static function main() {
 		global $config;
 
 		// Check session for previous instance
-		$container = $_SESSION[SESSIONID];
-		if(!is_a($container, "ListModules") || isset($_REQUEST['reload'])) {
+		$container = isset($_SESSION[SESSIONID]) ? $_SESSION[SESSIONID] : null;
+		if(!$container instanceof ListModules || isset($_REQUEST['reload'])) {
 			$container = new ListModules();
 			$container->reload();
 			$_SESSION[SESSIONID] = $container;

Modified: trunk/www/list_users.php
==============================================================================
--- trunk/www/list_users.php	(original)
+++ trunk/www/list_users.php	Sun Jun  1 14:14:14 2008
@@ -71,12 +71,12 @@
 		$this->users = new PagedResults($results);
 	}
 	
-	function main() {
+	static function main() {
 		global $config;
 
 		// Check session for previous instance
-		$container = $_SESSION[SESSIONID];
-		if(!is_a($container, "ListUsers") || isset($_REQUEST['reload'])) {
+		$container = isset($_SESSION[SESSIONID]) ? $_SESSION[SESSIONID] : null;
+		if(!$container instanceof ListUsers || isset($_REQUEST['reload'])) {
 			$container = new ListUsers();
 			$container->reload();
 			$_SESSION[SESSIONID] = $container;

Modified: trunk/www/login.php
==============================================================================
--- trunk/www/login.php	(original)
+++ trunk/www/login.php	Sun Jun  1 14:14:14 2008
@@ -7,7 +7,7 @@
 define('STYLESHEET', 'login.xsl');
 
 class Login {
-	function loginform($failed, $pe = NULL) {
+	static function loginform($failed, $pe = NULL) {
 		$page = new Page(STYLESHEET);
 		$dom =& $page->result;
 		$rootnode = $dom->createElement("page");
@@ -26,7 +26,7 @@
 		return;
 	}
 
-	function logoutform() {
+	static function logoutform() {
 		$page = new Page(STYLESHEET);
 		$dom =& $page->result;
 		$rootnode = $dom->appendChild($dom->createElement("page"));
@@ -36,7 +36,7 @@
 		return;
 	}
 
-	function loggedin() {
+	static function loggedin() {
 		global $config;
 
 		if(isset($_REQUEST['redirect'])) {
@@ -48,7 +48,7 @@
 		return;
 	}
 
-	function main() {
+	static function main() {
 		global $config;
 
 		/* Logout? */
@@ -60,10 +60,10 @@
 		}
                 
                 // Already logged in? Show loggedin form
-                if (isset($_SESSION['user']) && is_a ($_SESSION['user'], 'User'))
+                if (isset($_SESSION['user']) && $_SESSION['user'] instanceof User)
                     Login::loggedin();
 
-		if($_REQUEST['action'] == "login") {
+		if(isset($_REQUEST['action']) && $_REQUEST['action'] == "login") {
 			if(!isset($_POST['login']) || !isset($_POST['password'])) {
 				Login::loginform(false);
 				return;
@@ -138,7 +138,7 @@
 		Login::loginform(false);
 	}
 
-	function connectToLDAP($uid, $password) {
+	static function connectToLDAP($uid, $password) {
 		global $config;
 
 		/* Extract the hostname */

Modified: trunk/www/new_account.php
==============================================================================
--- trunk/www/new_account.php	(original)
+++ trunk/www/new_account.php	Sun Jun  1 14:14:14 2008
@@ -24,10 +24,10 @@
 	}
 
 	
-	function main() {
+       static function main() {
 		// Check session for previous instance
-		$container = $_SESSION[SESSIONID];
-		if(!is_a($container, "NewAccount") || isset($_REQUEST['reload'])) {
+		$container = isset($_SESSION[SESSIONID]) ? $_SESSION[SESSIONID] : null;
+		if(!$container instanceof NewAccount || isset($_REQUEST['reload'])) {
 			$container = new NewAccount();
 			$_SESSION[SESSIONID] = $container;
 		}

Modified: trunk/www/new_foundationmember.php
==============================================================================
--- trunk/www/new_foundationmember.php	(original)
+++ trunk/www/new_foundationmember.php	Sun Jun  1 14:14:14 2008
@@ -17,10 +17,10 @@
         $this->foundationmember = new FoundationMember();
     }
         
-    function main() {
+   static function main() {
         // Check session for previous instance
-        $container = $_SESSION[SESSIONID];
-        if(!is_a($container, "NewFoundationMember") || isset($_REQUEST['reload'])) {
+        $container = isset($_SESSION[SESSIONID]) ? $_SESSION[SESSIONID] : null;
+        if(!$container instanceof NewFoundationMember || isset($_REQUEST['reload'])) {
             $container = new NewFoundationMember();
             $_SESSION[SESSIONID] = $container;
         }

Modified: trunk/www/new_ftpmirror.php
==============================================================================
--- trunk/www/new_ftpmirror.php	(original)
+++ trunk/www/new_ftpmirror.php	Sun Jun  1 14:14:14 2008
@@ -16,10 +16,10 @@
 		$this->ftpmirror = new FTPMirror();
 	}
 		
-	function main() {
+       static function main() {
 		// Check session for previous instance
-		$container = $_SESSION[SESSIONID];
-		if(!is_a($container, "NewFTPMirror") || isset($_REQUEST['reload'])) {
+		$container = isset($_SESSION[SESSIONID]) ? $_SESSION[SESSIONID] : null;
+		if(!$container instanceof NewFTPMirror || isset($_REQUEST['reload'])) {
 			$container = new NewFTPMirror();
 			$_SESSION[SESSIONID] = $container;
 		}

Modified: trunk/www/new_module.php
==============================================================================
--- trunk/www/new_module.php	(original)
+++ trunk/www/new_module.php	Sun Jun  1 14:14:14 2008
@@ -16,10 +16,10 @@
 		$this->module = new Module();
 	}
 		
-	function main() {
+       static function main() {
 		// Check session for previous instance
-		$container = $_SESSION[SESSIONID];
-		if(!is_a($container, "NewModule") || isset($_REQUEST['reload'])) {
+		$container = isset($_SESSION[SESSIONID]) ? $_SESSION[SESSIONID] : null;
+		if(!$container instanceof NewModule || isset($_REQUEST['reload'])) {
 			$container = new NewModule();
 			$_SESSION[SESSIONID] = $container;
 		}

Modified: trunk/www/new_user.php
==============================================================================
--- trunk/www/new_user.php	(original)
+++ trunk/www/new_user.php	Sun Jun  1 14:14:14 2008
@@ -24,19 +24,13 @@
 class NewUser {
     // Stage
 
-    // Details for the user being created
-    var $user;
+    private
+        $user,      // Details for the user being created
+        $account,   // Details of the account request
+        $savedKeys, // Remember existing SSH keys between requests
+        $mailbody;  // Mail template to use
 
-    // Details of the account request
-    var $account;
-
-    // Remember existing SSH keys between requests
-    var $savedKeys;
-    
-    // Mail template to use
-    var $mailbody;
-
-    function NewUser($accountid = null) {
+    function __construct($accountid = null) {
         $this->user = new User();
         $this->savedKeys = array();
         $this->sendemail = true;
@@ -50,10 +44,10 @@
         }
     }
 
-    function main() {
+    static function main() {
         // Check session for previous instance
-        $container = $_SESSION[SESSIONID];
-        if(!is_a($container, "NewUser") || isset($_REQUEST['reload'])) {
+        $container = isset($_SESSION[SESSIONID]) ? $_SESSION[SESSIONID] : null;
+        if(!$container instanceof NewUser || isset($_REQUEST['reload'])) {
             $container = isset($_REQUEST['account']) ?
                          new NewUser($_REQUEST['account']) : new NewUser();
             $_SESSION[SESSIONID] = $container;
@@ -72,7 +66,7 @@
         $_SESSION[SESSIONID] = $container;
     }
     
-    function service(&$dom) {
+    public function service(&$dom) {
         // A page node is mandatory
         $dom->appendChild($pagenode = $dom->createElement("page"));
         $pagenode->setAttribute("title", "New User");
@@ -102,7 +96,7 @@
         return;
     }
 
-    function process(&$dom, &$formnode) {   
+    public function process(&$dom, &$formnode) {   
         // Read form and validate
         $formerrors = $this->readform();
         if(count($formerrors) > 0) {
@@ -141,7 +135,7 @@
         return;
     }
     
-    function readform() {
+    public function readform() {
         global $AFFECTEDGROUPS;
 
         // Save any keys from the last form     
@@ -169,7 +163,7 @@
         if($_FILES['keyfile']['tmp_name']) {
             $keyfile = file_get_contents($_FILES['keyfile']['tmp_name']);
         }
-        $newkeylist = $keyfile."\n".$_POST['newkeys'];
+        $newkeylist = $keyfile . "\n" . $_POST['newkeys'];
         $newkeys = split("\n", $newkeylist);
         foreach($newkeys as $key) {
             if(empty($key) || substr($key, 0, 3) != "ssh") continue;

Modified: trunk/www/update_foundationmember.php
==============================================================================
--- trunk/www/update_foundationmember.php	(original)
+++ trunk/www/update_foundationmember.php	Sun Jun  1 14:14:14 2008
@@ -17,7 +17,7 @@
         
     function UpdateFoundationMember($id) {
         $foundationmember = FoundationMember::fetchmember($id);
-        if(!is_a($foundationmember, "FoundationMember")) {
+        if(!$foundationmember instanceof FoundationMember) {
             $this->error = $foundationmember;
             return;
         }
@@ -25,10 +25,10 @@
         $this->foundationmember = $foundationmember;
     }
         
-    function main() {
+   static function main() {
         // Check session for previous instance
-        $container = $_SESSION[SESSIONID];
-        if(!is_a($container, "UpdateFoundationMember") || isset($_REQUEST['id'])) {
+        $container = isset($_SESSION[SESSIONID]) ? $_SESSION[SESSIONID] : null;
+        if(!$container instanceof UpdateFoundationMember || isset($_REQUEST['id'])) {
             $id = $_REQUEST['id'];
             $container = new UpdateFoundationMember($id);
             $_SESSION[SESSIONID] = $container;
@@ -80,7 +80,7 @@
         $idcheck = $_POST['idcheck'];
         if($this->foundationmember->id != $idcheck) {
             $foundationmember = FoundationMember::fetchmember($idcheck);
-            if(!is_a($foundationmember, "FoundationMember")) {
+            if(!$foundationmember instanceof FoundationMember) {
                 $this->error = $foundationmember;
                 return;
             }

Modified: trunk/www/update_ftpmirror.php
==============================================================================
--- trunk/www/update_ftpmirror.php	(original)
+++ trunk/www/update_ftpmirror.php	Sun Jun  1 14:14:14 2008
@@ -16,7 +16,7 @@
 		
 	function UpdateFTPMirror($id) {
 		$ftpmirror = FTPMirror::fetchmirror($id);
-		if(!is_a($ftpmirror, "FTPMirror")) {
+		if(!$ftpmirror instanceof FTPMirror) {
 			$this->error = $ftpmirror;
 			return;
 		}
@@ -24,10 +24,10 @@
 		$this->ftpmirror = $ftpmirror;
 	}
 		
-	function main() {
+       static function main() {
 		// Check session for previous instance
-		$container = $_SESSION[SESSIONID];
-		if(!is_a($container, "UpdateFTPMirror") || isset($_REQUEST['id'])) {
+		$container = isset($_SESSION[SESSIONID]) ? $_SESSION[SESSIONID] : null;
+		if(!$container instanceof UpdateFTPMirror || isset($_REQUEST['id'])) {
 			$id = $_REQUEST['id'];
 			$container = new UpdateFTPMirror($id);
 			$_SESSION[SESSIONID] = $container;
@@ -79,7 +79,7 @@
 		$idcheck = $_POST['idcheck'];
 		if($this->ftpmirror->id != $idcheck) {
 			$ftpmirror = FTPMirror::fetchmirror($idcheck);
-			if(!is_a($ftpmirror, "FTPMirror")) {
+			if(!$ftpmirror instanceof FTPMirror) {
 				$this->error = $ftpmirror;
 				return;
 			}

Modified: trunk/www/update_module.php
==============================================================================
--- trunk/www/update_module.php	(original)
+++ trunk/www/update_module.php	Sun Jun  1 14:14:14 2008
@@ -18,7 +18,7 @@
 	function UpdateModule($cn) {
 
 		$module = Module::fetchmodule($cn);
-		if(!is_a($module, "Module")) {
+		if(!$module instanceof Module) {
 			$this->error = $module;
 			return;
 		}
@@ -26,10 +26,10 @@
 		$this->module = $module;
 	}
 		
-	function main() {
+       static function main() {
 		// Check session for previous instance
-		$container = $_SESSION[SESSIONID];
-		if(!is_a($container, "UpdateModule") || isset($_REQUEST['cn'])) {
+		$container = isset($_SESSION[SESSIONID]) ? $_SESSION[SESSIONID] : null;
+		if(!$container instanceof UpdateModule || isset($_REQUEST['cn'])) {
 			$cn = $_REQUEST['cn'];
 			$container = new UpdateModule($cn);
 			if($container->error) {

Modified: trunk/www/update_user.php
==============================================================================
--- trunk/www/update_user.php	(original)
+++ trunk/www/update_user.php	Sun Jun  1 14:14:14 2008
@@ -42,7 +42,7 @@
         global $AFFECTEDGROUPS;
 
         $user = User::fetchuser($uid);
-        if(!is_a($user, "User")) {
+        if(!$user instanceof User) {
             $this->error = $user;
             return;
         }
@@ -51,10 +51,10 @@
         $this->othergroups = array_diff($user->groups, $AFFECTEDGROUPS);
     }
         
-    function main() {
+    static function main() {
         // Check session for previous instance
-        $container = $_SESSION[SESSIONID];
-        if(!is_a($container, "UpdateUser") || isset($_REQUEST['uid'])) {
+        $container = isset($_SESSION[SESSIONID]) ? $_SESSION[SESSIONID] : null;
+        if(!$container instanceof UpdateUser || isset($_REQUEST['uid'])) {
             $uid = $_REQUEST['uid'];
             $container = new UpdateUser($uid);
             if($container->error) {
@@ -112,7 +112,7 @@
         $uidcheck = $_POST['uidcheck'];
         if($this->user->uid != $uidcheck) {
             $user = User::fetchuser($uidcheck);
-            if(!is_a($user, "User")) {
+            if(!$user instanceof User) {
                 $this->error = $user;
                 return;
             }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]