egroupware_official/phpgwapi/inc/class.validator.inc.php

203 lines
4.9 KiB
PHP
Raw Normal View History

2001-03-12 14:17:38 +01:00
<?php
2001-10-02 07:10:14 +02:00
/**************************************************************************\
* phpGroupWare API - Validator *
* This file written by Dave Hall <skwashd@phpgroupware.org> *
* Copyright (C) 2003 Free Software Foundation *
2001-10-02 07:10:14 +02:00
* -------------------------------------------------------------------------*
* This library is part of the phpGroupWare API *
* http://www.phpgroupware.org/api *
* ------------------------------------------------------------------------ *
* 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 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 USA *
\**************************************************************************/
/* $Id$ */
/*
The code that used to be here was non-free code from www.thewebmasters.net
This file has been stubbed and will soon be removed from phpGW
2001-10-02 07:10:14 +02:00
*/
2001-03-12 14:17:38 +01:00
class validator
{
var $error;
2001-03-12 14:17:38 +01:00
function clear_error ()
{
$this->nonfree_call();
2001-03-12 14:17:38 +01:00
}
2001-10-02 07:10:14 +02:00
/* check if string contains any whitespace */
2001-03-12 14:17:38 +01:00
function has_space ($text)
{
return ereg('( |\n|\t|\r)+', $text);
2001-03-12 14:17:38 +01:00
}
2001-10-02 07:10:14 +02:00
2001-03-12 14:17:38 +01:00
function chconvert ($fragment)
{
$this->nonfree_call();
2001-10-02 07:10:14 +02:00
}
function get_perms ($fileName)
2001-03-12 14:17:38 +01:00
{
$this->nonfree_call();
2001-03-12 14:17:38 +01:00
}
2001-10-02 07:10:14 +02:00
2001-03-12 14:17:38 +01:00
function is_sane ($filename)
{
$this->nonfree_call();
2001-03-12 14:17:38 +01:00
}
2001-10-02 07:10:14 +02:00
/* strips all whitespace from a string */
2001-03-12 14:17:38 +01:00
function strip_space ($text)
{
return ereg('( |\n|\t|\r)+', '', $text);
2001-03-12 14:17:38 +01:00
}
2001-10-02 07:10:14 +02:00
2001-03-12 14:17:38 +01:00
function is_allnumbers ($text)
{
$this->nonfree_call();
2001-03-12 14:17:38 +01:00
}
2001-10-02 07:10:14 +02:00
2001-03-12 14:17:38 +01:00
function strip_numbers ($text)
{
$this->nonfree_call();
2001-03-12 14:17:38 +01:00
}
2001-10-02 07:10:14 +02:00
2001-03-12 14:17:38 +01:00
function is_allletters ($text)
{
$this->nonfree_call();
2001-03-12 14:17:38 +01:00
}
2001-10-02 07:10:14 +02:00
2001-03-12 14:17:38 +01:00
function strip_letters ($text)
{
$this->nonfree_call();
2001-03-12 14:17:38 +01:00
}
2001-10-02 07:10:14 +02:00
function has_html ($text='')
2001-03-12 14:17:38 +01:00
{
return ($text != $this->strip_html($text));
2001-03-12 14:17:38 +01:00
}
2001-10-02 07:10:14 +02:00
function strip_html ($text='')
2001-03-12 14:17:38 +01:00
{
return strip_tags($text);
2001-03-12 14:17:38 +01:00
}
2001-10-02 07:10:14 +02:00
function has_metas ($text='')
2001-03-12 14:17:38 +01:00
{
return ($text != $this->strip_metas($text));
2001-03-12 14:17:38 +01:00
}
2001-10-02 07:10:14 +02:00
2001-03-12 14:17:38 +01:00
function strip_metas ($text = "")
{
$metas = array('$','^','*','(',')','+','[',']','.','?');
return str_replace($metas, '', stripslashes($text));
2001-03-12 14:17:38 +01:00
}
2001-10-02 07:10:14 +02:00
2001-03-12 14:17:38 +01:00
function custom_strip ($Chars, $text = "")
{
$this->nonfree_call();
2001-03-12 14:17:38 +01:00
}
2001-10-02 07:10:14 +02:00
function array_echo ($array, $name='Array')
2001-03-12 14:17:38 +01:00
{
echo '<pre>';
print_r($array);
echo '<pre>';
2001-03-12 14:17:38 +01:00
}
2001-10-02 07:10:14 +02:00
function is_email ($Address='')
2001-03-12 14:17:38 +01:00
{
$this->nonfree_call();
2001-03-12 14:17:38 +01:00
}
2001-10-02 07:10:14 +02:00
function is_url ($Url='')
2001-03-12 14:17:38 +01:00
{
$this->nonfree_call();
2001-03-12 14:17:38 +01:00
}
2001-10-02 07:10:14 +02:00
function url_responds ($Url='')
2001-03-12 14:17:38 +01:00
{
$this->nonfree_call();
2001-03-12 14:17:38 +01:00
}
2001-10-02 07:10:14 +02:00
function is_phone ($Phone='')
2001-03-12 14:17:38 +01:00
{
$this->nonfree_call();
2001-03-12 14:17:38 +01:00
}
2001-10-02 07:10:14 +02:00
function is_hostname ($hostname='')
2001-03-12 14:17:38 +01:00
{
$this->nonfree_call();
2001-03-12 14:17:38 +01:00
}
2001-10-02 07:10:14 +02:00
2001-03-12 14:17:38 +01:00
function is_bigfour ($tld)
{
$this->nonfree_call();
2001-03-12 14:17:38 +01:00
}
2001-10-02 07:10:14 +02:00
function is_host ($hostname='', $type='ANY')
2001-03-12 14:17:38 +01:00
{
$this->nonfree_call();
2001-03-12 14:17:38 +01:00
}
2001-10-02 07:10:14 +02:00
function is_ipaddress ($IP='')
2001-03-12 14:17:38 +01:00
{
$this->nonfree_call();
}
2001-10-02 07:10:14 +02:00
function ip_resolves ($IP='')
2001-03-12 14:17:38 +01:00
{
$this->nonfree_call();
2001-03-12 14:17:38 +01:00
}
2001-10-02 07:10:14 +02:00
2001-03-12 14:17:38 +01:00
function browser_gen ()
{
$this->nonfree_call();
2001-03-12 14:17:38 +01:00
}
2001-10-02 07:10:14 +02:00
2001-03-12 14:17:38 +01:00
function is_state ($State = "")
{
$this->nonfree_call();
2001-03-12 14:17:38 +01:00
}
2001-10-02 07:10:14 +02:00
2001-03-12 14:17:38 +01:00
function is_zip ($zipcode = "")
{
$this->nonfree_call();
2001-03-12 14:17:38 +01:00
}
2001-10-02 07:10:14 +02:00
function is_country ($countrycode='')
2001-03-12 14:17:38 +01:00
{
$this->nonfree_call();
}
function nonfree_call()
{
echo 'class.validator.inc.php used to contain code that was not Free ';
echo 'Software (<a href="(http://www.gnu.org/philosophy/free-sw.html">see ';
echo 'definition</a> , therefore it has been removed. <br><br>';
echo 'If you are a application maintainer, please update your app. ';
echo 'If you are a user, please file a bug report on ';
echo '<a href="https://savannah.gnu.org/bugs/?group=phpgroupware">';
echo 'our project page at savannah.gnu.org</a>. Please copy and paste ';
echo 'the following information into the bug report:<br>';
echo '<b>Summary<b>: ' . $GLOBALS['phpgw_info']['flags']['currentapp'];
echo 'calls class.validator.inc.php';
echo 'Information:<br> The call was found when calling: ' . $_SERVER['QUERY_STRING'];
echo '<br><br>This application will now halt!<br><br>';
echo '<a href="'. $GLOBALS['phpgw']->link('/home.php') .'">Return to Home Screen</a>';
exit;
}
}
2001-10-02 07:10:14 +02:00
?>