svn:eol-style got murdered on some files for whatever reason so it gets resurrected now, also set some svn:keywords
This commit is contained in:
@@ -1,43 +1,43 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
function array_merge_prefix($array1, $key_prefix, $array2)
|
||||
{
|
||||
if(is_array($array1) && is_array($array2))
|
||||
{
|
||||
if($key_prefix != '')
|
||||
{
|
||||
foreach($array2 as $key => $value)
|
||||
{
|
||||
$array1[$key_prefix . '_' . $key] = $value;
|
||||
unset($array2[$key]);
|
||||
}
|
||||
unset($array2);
|
||||
return $array1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return array_merge($array1, $array2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return $array1;
|
||||
}
|
||||
}
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
function array_merge_prefix($array1, $key_prefix, $array2)
|
||||
{
|
||||
if(is_array($array1) && is_array($array2))
|
||||
{
|
||||
if($key_prefix != '')
|
||||
{
|
||||
foreach($array2 as $key => $value)
|
||||
{
|
||||
$array1[$key_prefix . '_' . $key] = $value;
|
||||
unset($array2[$key]);
|
||||
}
|
||||
unset($array2);
|
||||
return $array1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return array_merge($array1, $array2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return $array1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,46 +1,46 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns Array, whose elements have been checked whether thay are empty or not
|
||||
*
|
||||
* @param array The array to trim
|
||||
* @return array The trim'med array
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
*/
|
||||
|
||||
function array_trim($source)
|
||||
{
|
||||
$returnval = array();
|
||||
|
||||
if(is_array($source))
|
||||
{
|
||||
while(list($var, $val) = each($source))
|
||||
{
|
||||
if($val != ' '
|
||||
&& $val != '')$returnval[$var] = $val;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$returnval = $source;
|
||||
}
|
||||
|
||||
return $returnval;
|
||||
}
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns Array, whose elements have been checked whether thay are empty or not
|
||||
*
|
||||
* @param array The array to trim
|
||||
* @return array The trim'med array
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
*/
|
||||
|
||||
function array_trim($source)
|
||||
{
|
||||
$returnval = array();
|
||||
|
||||
if(is_array($source))
|
||||
{
|
||||
while(list($var, $val) = each($source))
|
||||
{
|
||||
if($val != ' '
|
||||
&& $val != '')$returnval[$var] = $val;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$returnval = $source;
|
||||
}
|
||||
|
||||
return $returnval;
|
||||
}
|
||||
|
||||
@@ -1,40 +1,40 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns a double of the given value which isn't negative.
|
||||
* Returns -1 if the given value was -1.
|
||||
*
|
||||
* @param any The value
|
||||
* @return double The positive value
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
*/
|
||||
|
||||
function doubleval_ressource($the_value)
|
||||
{
|
||||
$the_value = doubleval($the_value);
|
||||
|
||||
if($the_value < 0
|
||||
&& $the_value != '-1')
|
||||
{
|
||||
$the_value*= - 1;
|
||||
}
|
||||
|
||||
return $the_value;
|
||||
}
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns a double of the given value which isn't negative.
|
||||
* Returns -1 if the given value was -1.
|
||||
*
|
||||
* @param any The value
|
||||
* @return double The positive value
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
*/
|
||||
|
||||
function doubleval_ressource($the_value)
|
||||
{
|
||||
$the_value = doubleval($the_value);
|
||||
|
||||
if($the_value < 0
|
||||
&& $the_value != '-1')
|
||||
{
|
||||
$the_value*= - 1;
|
||||
}
|
||||
|
||||
return $the_value;
|
||||
}
|
||||
|
||||
@@ -1,69 +1,69 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Wrapper around html_entity_decode to handle arrays, with the advantage that you
|
||||
* can select which fields should be handled by htmlentities and with advantage,
|
||||
* that you can eliminate all html entities by setting complete=true
|
||||
*
|
||||
* @param array The subject array
|
||||
* @param string The fields which should be checked for, separated by spaces
|
||||
* @param bool Select true to use html_entity_decode_complete instead of html_entity_decode
|
||||
* @param int See php documentation about this
|
||||
* @param string See php documentation about this
|
||||
* @return array The array with html_entity_decode'd strings
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
*/
|
||||
|
||||
function html_entity_decode_array($subject, $fields = '', $complete = false, $quote_style = ENT_COMPAT, $charset = 'ISO-8859-1')
|
||||
{
|
||||
if(is_array($subject))
|
||||
{
|
||||
if(!is_array($fields))
|
||||
{
|
||||
$fields = array_trim(explode(' ', $fields));
|
||||
}
|
||||
|
||||
foreach($subject as $field => $value)
|
||||
{
|
||||
if((!is_array($fields) || empty($fields))
|
||||
|| (is_array($fields) && !empty($fields) && in_array($field, $fields)))
|
||||
{
|
||||
/**
|
||||
* Just call ourselve to manage multi-dimensional arrays
|
||||
*/
|
||||
|
||||
$subject[$field] = html_entity_decode_array($subject[$field], $fields, $complete, $quote_style, $charset);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($complete == true)
|
||||
{
|
||||
$subject = html_entity_decode_complete($subject, $quote_style, $charset);
|
||||
}
|
||||
else
|
||||
{
|
||||
$subject = html_entity_decode($subject, $quote_style, $charset);
|
||||
}
|
||||
}
|
||||
|
||||
return $subject;
|
||||
}
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Wrapper around html_entity_decode to handle arrays, with the advantage that you
|
||||
* can select which fields should be handled by htmlentities and with advantage,
|
||||
* that you can eliminate all html entities by setting complete=true
|
||||
*
|
||||
* @param array The subject array
|
||||
* @param string The fields which should be checked for, separated by spaces
|
||||
* @param bool Select true to use html_entity_decode_complete instead of html_entity_decode
|
||||
* @param int See php documentation about this
|
||||
* @param string See php documentation about this
|
||||
* @return array The array with html_entity_decode'd strings
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
*/
|
||||
|
||||
function html_entity_decode_array($subject, $fields = '', $complete = false, $quote_style = ENT_COMPAT, $charset = 'ISO-8859-1')
|
||||
{
|
||||
if(is_array($subject))
|
||||
{
|
||||
if(!is_array($fields))
|
||||
{
|
||||
$fields = array_trim(explode(' ', $fields));
|
||||
}
|
||||
|
||||
foreach($subject as $field => $value)
|
||||
{
|
||||
if((!is_array($fields) || empty($fields))
|
||||
|| (is_array($fields) && !empty($fields) && in_array($field, $fields)))
|
||||
{
|
||||
/**
|
||||
* Just call ourselve to manage multi-dimensional arrays
|
||||
*/
|
||||
|
||||
$subject[$field] = html_entity_decode_array($subject[$field], $fields, $complete, $quote_style, $charset);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($complete == true)
|
||||
{
|
||||
$subject = html_entity_decode_complete($subject, $quote_style, $charset);
|
||||
}
|
||||
else
|
||||
{
|
||||
$subject = html_entity_decode($subject, $quote_style, $charset);
|
||||
}
|
||||
}
|
||||
|
||||
return $subject;
|
||||
}
|
||||
|
||||
@@ -1,36 +1,36 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Calls html_entity_decode in a loop until the result doesn't differ from original anymore
|
||||
*
|
||||
* @param string The string in which the html entities should be eliminated.
|
||||
* @return string The cleaned string
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
*/
|
||||
|
||||
function html_entity_decode_complete($string)
|
||||
{
|
||||
while($string != html_entity_decode($string))
|
||||
{
|
||||
$string = html_entity_decode($string);
|
||||
}
|
||||
|
||||
return $string;
|
||||
}
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Calls html_entity_decode in a loop until the result doesn't differ from original anymore
|
||||
*
|
||||
* @param string The string in which the html entities should be eliminated.
|
||||
* @return string The cleaned string
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
*/
|
||||
|
||||
function html_entity_decode_complete($string)
|
||||
{
|
||||
while($string != html_entity_decode($string))
|
||||
{
|
||||
$string = html_entity_decode($string);
|
||||
}
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
@@ -1,60 +1,60 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Wrapper around htmlentities to handle arrays, with the advantage that you
|
||||
* can select which fields should be handled by htmlentities
|
||||
*
|
||||
* @param array The subject array
|
||||
* @param string The fields which should be checked for, separated by spaces
|
||||
* @param int See php documentation about this
|
||||
* @param string See php documentation about this
|
||||
* @return array The array with htmlentitie'd strings
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
*/
|
||||
|
||||
function htmlentities_array($subject, $fields = '', $quote_style = ENT_COMPAT, $charset = 'ISO-8859-1')
|
||||
{
|
||||
if(is_array($subject))
|
||||
{
|
||||
if(!is_array($fields))
|
||||
{
|
||||
$fields = array_trim(explode(' ', $fields));
|
||||
}
|
||||
|
||||
foreach($subject as $field => $value)
|
||||
{
|
||||
if((!is_array($fields) || empty($fields))
|
||||
|| (is_array($fields) && !empty($fields) && in_array($field, $fields)))
|
||||
{
|
||||
/**
|
||||
* Just call ourselve to manage multi-dimensional arrays
|
||||
*/
|
||||
|
||||
$subject[$field] = htmlentities_array($subject[$field], $fields, $quote_style, $charset);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$subject = htmlentities($subject, $quote_style, $charset);
|
||||
}
|
||||
|
||||
return $subject;
|
||||
}
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Wrapper around htmlentities to handle arrays, with the advantage that you
|
||||
* can select which fields should be handled by htmlentities
|
||||
*
|
||||
* @param array The subject array
|
||||
* @param string The fields which should be checked for, separated by spaces
|
||||
* @param int See php documentation about this
|
||||
* @param string See php documentation about this
|
||||
* @return array The array with htmlentitie'd strings
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
*/
|
||||
|
||||
function htmlentities_array($subject, $fields = '', $quote_style = ENT_COMPAT, $charset = 'ISO-8859-1')
|
||||
{
|
||||
if(is_array($subject))
|
||||
{
|
||||
if(!is_array($fields))
|
||||
{
|
||||
$fields = array_trim(explode(' ', $fields));
|
||||
}
|
||||
|
||||
foreach($subject as $field => $value)
|
||||
{
|
||||
if((!is_array($fields) || empty($fields))
|
||||
|| (is_array($fields) && !empty($fields) && in_array($field, $fields)))
|
||||
{
|
||||
/**
|
||||
* Just call ourselve to manage multi-dimensional arrays
|
||||
*/
|
||||
|
||||
$subject[$field] = htmlentities_array($subject[$field], $fields, $quote_style, $charset);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$subject = htmlentities($subject, $quote_style, $charset);
|
||||
}
|
||||
|
||||
return $subject;
|
||||
}
|
||||
|
||||
@@ -1,40 +1,40 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns an integer of the given value which isn't negative.
|
||||
* Returns -1 if the given value was -1.
|
||||
*
|
||||
* @param any The value
|
||||
* @return int The positive value
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
*/
|
||||
|
||||
function intval_ressource($the_value)
|
||||
{
|
||||
$the_value = intval($the_value);
|
||||
|
||||
if($the_value < 0
|
||||
&& $the_value != '-1')
|
||||
{
|
||||
$the_value*= - 1;
|
||||
}
|
||||
|
||||
return $the_value;
|
||||
}
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns an integer of the given value which isn't negative.
|
||||
* Returns -1 if the given value was -1.
|
||||
*
|
||||
* @param any The value
|
||||
* @return int The positive value
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
*/
|
||||
|
||||
function intval_ressource($the_value)
|
||||
{
|
||||
$the_value = intval($the_value);
|
||||
|
||||
if($the_value < 0
|
||||
&& $the_value != '-1')
|
||||
{
|
||||
$the_value*= - 1;
|
||||
}
|
||||
|
||||
return $the_value;
|
||||
}
|
||||
|
||||
@@ -1,58 +1,58 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Replaces all occurences of variables defined in the second argument
|
||||
* in the first argument with their values.
|
||||
*
|
||||
* @param string The string that should be searched for variables
|
||||
* @param array The array containing the variables with their values
|
||||
* @return string The submitted string with the variables replaced.
|
||||
* @author Michael Duergner
|
||||
*/
|
||||
|
||||
function replace_variables($text, $vars)
|
||||
{
|
||||
$pattern = "/\{([a-zA-Z0-9\-_]+)\}/";
|
||||
|
||||
// --- martin @ 08.08.2005 -------------------------------------------------------
|
||||
// fixing usage of uninitialised variable
|
||||
|
||||
$matches = array();
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
|
||||
if(count($vars) > 0
|
||||
&& preg_match_all($pattern, $text, $matches))
|
||||
{
|
||||
for ($i = 0;$i < count($matches[1]);$i++)
|
||||
{
|
||||
$current = $matches[1][$i];
|
||||
|
||||
if(isset($vars[$current]))
|
||||
{
|
||||
$var = $vars[$current];
|
||||
$text = str_replace("{" . $current . "}", $var, $text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$text = str_replace('\n', "\n", $text);
|
||||
return $text;
|
||||
}
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Replaces all occurences of variables defined in the second argument
|
||||
* in the first argument with their values.
|
||||
*
|
||||
* @param string The string that should be searched for variables
|
||||
* @param array The array containing the variables with their values
|
||||
* @return string The submitted string with the variables replaced.
|
||||
* @author Michael Duergner
|
||||
*/
|
||||
|
||||
function replace_variables($text, $vars)
|
||||
{
|
||||
$pattern = "/\{([a-zA-Z0-9\-_]+)\}/";
|
||||
|
||||
// --- martin @ 08.08.2005 -------------------------------------------------------
|
||||
// fixing usage of uninitialised variable
|
||||
|
||||
$matches = array();
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
|
||||
if(count($vars) > 0
|
||||
&& preg_match_all($pattern, $text, $matches))
|
||||
{
|
||||
for ($i = 0;$i < count($matches[1]);$i++)
|
||||
{
|
||||
$current = $matches[1][$i];
|
||||
|
||||
if(isset($vars[$current]))
|
||||
{
|
||||
$var = $vars[$current];
|
||||
$text = str_replace("{" . $current . "}", $var, $text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$text = str_replace('\n', "\n", $text);
|
||||
return $text;
|
||||
}
|
||||
|
||||
@@ -1,52 +1,52 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Replaces Strings in an array, with the advantage that you
|
||||
* can select which fields should be str_replace'd
|
||||
*
|
||||
* @param mixed String or array of strings to search for
|
||||
* @param mixed String or array to replace with
|
||||
* @param array The subject array
|
||||
* @param string The fields which should be checked for, separated by spaces
|
||||
* @return array The str_replace'd array
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
*/
|
||||
|
||||
function str_replace_array($search, $replace, $subject, $fields = '')
|
||||
{
|
||||
if(is_array($subject))
|
||||
{
|
||||
$fields = array_trim(explode(' ', $fields));
|
||||
foreach($subject as $field => $value)
|
||||
{
|
||||
if((!is_array($fields) || empty($fields))
|
||||
|| (is_array($fields) && !empty($fields) && in_array($field, $fields)))
|
||||
{
|
||||
$subject[$field] = str_replace($search, $replace, $subject[$field]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$subject = str_replace($search, $replace, $subject);
|
||||
}
|
||||
|
||||
return $subject;
|
||||
}
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Replaces Strings in an array, with the advantage that you
|
||||
* can select which fields should be str_replace'd
|
||||
*
|
||||
* @param mixed String or array of strings to search for
|
||||
* @param mixed String or array to replace with
|
||||
* @param array The subject array
|
||||
* @param string The fields which should be checked for, separated by spaces
|
||||
* @return array The str_replace'd array
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
*/
|
||||
|
||||
function str_replace_array($search, $replace, $subject, $fields = '')
|
||||
{
|
||||
if(is_array($subject))
|
||||
{
|
||||
$fields = array_trim(explode(' ', $fields));
|
||||
foreach($subject as $field => $value)
|
||||
{
|
||||
if((!is_array($fields) || empty($fields))
|
||||
|| (is_array($fields) && !empty($fields) && in_array($field, $fields)))
|
||||
{
|
||||
$subject[$field] = str_replace($search, $replace, $subject[$field]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$subject = str_replace($search, $replace, $subject);
|
||||
}
|
||||
|
||||
return $subject;
|
||||
}
|
||||
|
||||
@@ -1,69 +1,69 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Wrapper around stripslashes to handle arrays, with the advantage that you
|
||||
* can select which fields should be handled by htmlentities and with advantage,
|
||||
* that you can eliminate all slashes by setting complete=true
|
||||
*
|
||||
* @param array The subject array
|
||||
* @param int See php documentation about this
|
||||
* @param string See php documentation about this
|
||||
* @param string The fields which should be checked for, separated by spaces
|
||||
* @param bool Select true to use stripslashes_complete instead of stripslashes
|
||||
* @return array The array with stripslashe'd strings
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
*/
|
||||
|
||||
function stripslashes_array($subject, $fields = '', $complete = false)
|
||||
{
|
||||
if(is_array($subject))
|
||||
{
|
||||
if(!is_array($fields))
|
||||
{
|
||||
$fields = array_trim(explode(' ', $fields));
|
||||
}
|
||||
|
||||
foreach($subject as $field => $value)
|
||||
{
|
||||
if((!is_array($fields) || empty($fields))
|
||||
|| (is_array($fields) && !empty($fields) && in_array($field, $fields)))
|
||||
{
|
||||
/**
|
||||
* Just call ourselve to manage multi-dimensional arrays
|
||||
*/
|
||||
|
||||
$subject[$field] = stripslashes_array($subject[$field], $fields, $complete);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($complete == true)
|
||||
{
|
||||
$subject = stripslashes_complete($subject);
|
||||
}
|
||||
else
|
||||
{
|
||||
$subject = stripslashes($subject);
|
||||
}
|
||||
}
|
||||
|
||||
return $subject;
|
||||
}
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Wrapper around stripslashes to handle arrays, with the advantage that you
|
||||
* can select which fields should be handled by htmlentities and with advantage,
|
||||
* that you can eliminate all slashes by setting complete=true
|
||||
*
|
||||
* @param array The subject array
|
||||
* @param int See php documentation about this
|
||||
* @param string See php documentation about this
|
||||
* @param string The fields which should be checked for, separated by spaces
|
||||
* @param bool Select true to use stripslashes_complete instead of stripslashes
|
||||
* @return array The array with stripslashe'd strings
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
*/
|
||||
|
||||
function stripslashes_array($subject, $fields = '', $complete = false)
|
||||
{
|
||||
if(is_array($subject))
|
||||
{
|
||||
if(!is_array($fields))
|
||||
{
|
||||
$fields = array_trim(explode(' ', $fields));
|
||||
}
|
||||
|
||||
foreach($subject as $field => $value)
|
||||
{
|
||||
if((!is_array($fields) || empty($fields))
|
||||
|| (is_array($fields) && !empty($fields) && in_array($field, $fields)))
|
||||
{
|
||||
/**
|
||||
* Just call ourselve to manage multi-dimensional arrays
|
||||
*/
|
||||
|
||||
$subject[$field] = stripslashes_array($subject[$field], $fields, $complete);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($complete == true)
|
||||
{
|
||||
$subject = stripslashes_complete($subject);
|
||||
}
|
||||
else
|
||||
{
|
||||
$subject = stripslashes($subject);
|
||||
}
|
||||
}
|
||||
|
||||
return $subject;
|
||||
}
|
||||
|
||||
@@ -1,36 +1,36 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Calls stripslashes in a loop until the result doesn't differ from original anymore
|
||||
*
|
||||
* @param string The string in which the slashes should be eliminated.
|
||||
* @return string The cleaned string
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
*/
|
||||
|
||||
function stripslashes_complete($string)
|
||||
{
|
||||
while($string != stripslashes($string))
|
||||
{
|
||||
$string = stripslashes($string);
|
||||
}
|
||||
|
||||
return $string;
|
||||
}
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Calls stripslashes in a loop until the result doesn't differ from original anymore
|
||||
*
|
||||
* @param string The string in which the slashes should be eliminated.
|
||||
* @return string The cleaned string
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
*/
|
||||
|
||||
function stripslashes_complete($string)
|
||||
{
|
||||
while($string != stripslashes($string))
|
||||
{
|
||||
$string = stripslashes($string);
|
||||
}
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user