Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

Userdata.php

Go to the documentation of this file.
00001 <?php
00002 /* $Id: Userdata.php,v 1.1 2003/09/29 15:48:53 mikko Exp $ */
00003 /*
00004  * ImaComm - a web based photo album software
00005  * Copyright (C) 2003, Mikko Kokkonen
00006  *
00007  * This program is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or (at
00010  * your option) any later version.
00011  * 
00012  * This program is distributed in the hope that it will be useful, but
00013  * WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00020  */
00021 class Userdata
00022 {
00023         var $user;
00024         var $file;
00025         var $parameters;
00026         var $options;
00027         var $prefix;
00028 
00029         var $_module;
00030         var $_modulesrc;
00031         var $_class;
00032         var $_source;
00033 
00034         var $allok;
00035 
00036         function UserData($source = null, $module = null)
00037         {
00038                 $this->prefix = realpath(dirname(__FILE__)."/../");
00039                 // Get source module...
00040                 if ($source == null && $module == null)
00041                 {
00042                         list($source, $module) = generateModule("userdata");
00043                 }
00044                 $this->_source = $source;
00045                 if ($module != null)
00046                 {
00047                         $this->_modulesrc = $this->prefix."/modules/$module.php";
00048                         $this->_class = "Userdata_".strtoupper(substr(strstr($module, "_"), 1));
00049                 }
00050                 // Load module..
00051                 if (file_exists($this->_modulesrc))
00052                 {
00053                         require_once ($this->_modulesrc);
00054                         $this->_module = new $this->_class;
00055                 }
00056         }
00057 
00058         function parameter($name)
00059         {
00060                 return $this->parameters[$name];
00061         }
00062         
00063         function getClass()
00064         {
00065                 return $this->class;
00066         }
00067         
00068         function loadData($username, $password)
00069         {
00070                 // Load module...
00071                 $this->_module->loadData($this->_source, $username, $password);
00072                 $this->mergeVars();
00073         }
00074         
00075         function allOK()
00076         {
00077                 return $this->allok;
00078         }
00079         
00080         function createFile()
00081         {
00082                 // Load module...
00083                 if (get_class($this->_module) == strtolower($this->_class))
00084                 {
00085                         $this->_source = $this->_module->createFile($_REQUEST);
00086                         $this->mergeVars();
00087                 }
00088         }
00089 
00090         function addUser($username, $password, $class, $parameters = null, $options = null)
00091         {
00092                 $this->_module->addUser($username, $password, $class, $parameters, $options);
00093         }
00094 
00095         function mergeVars()
00096         {
00097                 $this->allok = $this->_module->allok;
00098                 $this->file = $this->_module->file;
00099                 $this->user = $this->_module->user;
00100                 $this->options = $this->_module->options;
00101                 $this->parameters = $this->_module->parameters;
00102                 $this->password = $this->_module->password;
00103                 $this->class = $this->_module->class;
00104         }
00105 }
00106 ?>

Generated on Sun Oct 19 11:08:01 2003 for ImaComm by doxygen1.3