Source for file system.inc.php
Documentation is available at system.inc.php
* This file is part of the VCL for PHP project
* Copyright (c) 2004-2007 qadram software <support@qadram.com>
* Checkout AUTHORS file for more information on the developers
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* EPropertyNotFound exception
* Exception thrown when trying to access a property not defined
$message= sprintf("Error using a property, not defined as a member [%s]", $message);
// make sure everything is assigned properly
parent::__construct($message, $code);
* All objects must inherit from this class
* Global input object, easily accessible without declaring global
//Assign the global input object so it can be used from inside
* Returns the name of the object class
* Check if the object is from a specific class
* @param string $name Name to compare
* Check if a method exists
* @param string $method Method name to check
* Returns the parent class of the object
* Check if the object inherits from a specific class
* @param string $class Class name to check
* Reads a property from the streams
* @param string $propertyname Name of the property to read
* @param string $valuename Value name to read
* @param string $stream Stream to read from
function readProperty($propertyname,$valuename,$stream= 'post')
//TODO: Use also get array
//TODO: Use the input object
if (isset ($_POST[$valuename]))
$value= $_POST[$valuename];
$this->$propertyname= $value;
* To virtualize properties
* @param string $nm Property name
//Search first for get$nm
return ($this->$method());
return ($this->$method());
//If not, search a component owned by it, with that name
reset($this->components->items);
while (list ($k,$v)= each($this->components->items))
* To virtualize properties
* @param string $nm Property name
* @param mixed $val Property value
function __set($nm, $val)
* Native Input Filter, not working yet
* Process user input to be clean
* @param string $input Input to be cleaned
//TODO: Our own input filtering class in native PHP code
//NOTE: Comment this line to don't raise the exception an get the unfiltered input
throw new Exception("The Input Filter PHP extension is not setup on this PHP installation, so the contents returned by Input is *not* filtered");
* Represents an input parameter from the user, it doesn't inherit from Object to
* be faster and smaller. Objects of this type are returned from the Input object.
* @param $name Key of the stream to look form
* @param $stream Stream to look for
//Checkout if filter extension has been installer or not
//If not, creates the native filter
//TODO: Use a global native filter to reduce overhead
//Set the stream to look for
* Creates the native Input Filter to be used when there is no available extension
//TODO: Add filtering without the filtering extension installed
* Returns the input filtered as a string
return(filter_data($this->stream[$this->name],FILTER_SANITIZE_STRING));
* Returns the input filtered as a string array
while (list ($k,$v)= each($data))
$result[filter_data($k,FILTER_SANITIZE_STRING)]= filter_data($v,FILTER_SANITIZE_STRING);
//TODO: Filter using a native library
* Returns the input filtered as a integer
return(filter_data($this->stream[$this->name],FILTER_SANITIZE_NUMBER_INT));
* Returns the input filtered as a boolean
return(filter_data($this->stream[$this->name],FILTER_VALIDATE_BOOLEAN));
* Returns the input filtered as a float
return(filter_data($this->stream[$this->name],FILTER_SANITIZE_NUMBER_FLOAT, $flags));
* Returns the input filtered as a regular expression
return(filter_data($this->stream[$this->name],FILTER_VALIDATE_REGEXP));
* Returns the input filtered as an URL
return(filter_data($this->stream[$this->name],FILTER_SANITIZE_URL));
* Returns the input filtered as an email address
return(filter_data($this->stream[$this->name],FILTER_SANITIZE_EMAIL));
* Returns the input filtered as an IP address
return(filter_data($this->stream[$this->name],FILTER_VALIDATE_IP));
* Returns the input filtered as an string
return(filter_data($this->stream[$this->name],FILTER_SANITIZE_STRIPPED));
* URL-encode string, optionally strip or encode special characters.
return(filter_data($this->stream[$this->name],FILTER_SANITIZE_ENCODED));
* HTML-escape '"<>& and characters with ASCII value less than 32, optionally strip or encode other special characters.
return(filter_data($this->stream[$this->name],FILTER_SANITIZE_SPECIAL_CHARS));
* Do nothing, optionally strip or encode special characters.
return(filter_data($this->stream[$this->name],FILTER_SANITIZE_UNSAFE_RAW));
* Input class, offers an easy way to get filtered input from the user
* $action=$input->action;
* if (is_object($action))
* $toperform=$action->asString();
* Magic method to search for the input from the user,
* checkout the order in which the variable is searched for:
* $_GET, $_POST, $_REQUEST, $_COOKIES, $_SERVER
* @return InputParam object or null if it's not found
if (isset ($_REQUEST[$nm]))
if (isset ($_COOKIES[$nm]))
if (isset ($_SERVER[$nm]))
* Global $input variable, use it to get filtered/sanitized input from the user
|