| Current Path : /home/digilove/public_html/41423/ |
| Current File : //home/digilove/public_html/41423/Input.tar |
Cli.php 0000644 00000010262 15234434233 0005770 0 ustar 00 <?php
/**
* Joomla! Content Management System
*
* @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\CMS\Input;
defined('JPATH_PLATFORM') or die;
use Joomla\CMS\Filter\InputFilter;
/**
* Joomla! Input CLI Class
*
* @since 1.7.0
* @deprecated 5.0 Use Joomla\Input\Cli instead
*/
class Cli extends Input
{
/**
* The executable that was called to run the CLI script.
*
* @var string
* @since 1.7.0
* @deprecated 5.0 Use Joomla\Input\Cli instead
*/
public $executable;
/**
* The additional arguments passed to the script that are not associated
* with a specific argument name.
*
* @var array
* @since 1.7.0
* @deprecated 5.0 Use Joomla\Input\Cli instead
*/
public $args = array();
/**
* Constructor.
*
* @param array $source Source data (Optional, default is $_REQUEST)
* @param array $options Array of configuration parameters (Optional)
*
* @since 1.7.0
* @deprecated 5.0 Use Joomla\Input\Cli instead
*/
public function __construct(array $source = null, array $options = array())
{
if (isset($options['filter']))
{
$this->filter = $options['filter'];
}
else
{
$this->filter = InputFilter::getInstance();
}
// Get the command line options
$this->parseArguments();
// Set the options for the class.
$this->options = $options;
}
/**
* Method to serialize the input.
*
* @return string The serialized input.
*
* @since 3.0.0
* @deprecated 5.0 Use Joomla\Input\Cli instead
*/
public function serialize()
{
// Load all of the inputs.
$this->loadAllInputs();
// Remove $_ENV and $_SERVER from the inputs.
$inputs = $this->inputs;
unset($inputs['env']);
unset($inputs['server']);
// Serialize the executable, args, options, data, and inputs.
return serialize(array($this->executable, $this->args, $this->options, $this->data, $inputs));
}
/**
* Method to unserialize the input.
*
* @param string $input The serialized input.
*
* @return Input The input object.
*
* @since 3.0.0
* @deprecated 5.0 Use Joomla\Input\Cli instead
*/
public function unserialize($input)
{
// Unserialize the executable, args, options, data, and inputs.
list($this->executable, $this->args, $this->options, $this->data, $this->inputs) = unserialize($input);
// Load the filter.
if (isset($this->options['filter']))
{
$this->filter = $this->options['filter'];
}
else
{
$this->filter = InputFilter::getInstance();
}
}
/**
* Initialise the options and arguments
*
* Not supported: -abc c-value
*
* @return void
*
* @since 1.7.0
* @deprecated 5.0 Use Joomla\Input\Cli instead
*/
protected function parseArguments()
{
$argv = $_SERVER['argv'];
$this->executable = array_shift($argv);
$out = array();
for ($i = 0, $j = count($argv); $i < $j; $i++)
{
$arg = $argv[$i];
// --foo --bar=baz
if (substr($arg, 0, 2) === '--')
{
$eqPos = strpos($arg, '=');
// --foo
if ($eqPos === false)
{
$key = substr($arg, 2);
// --foo value
if ($i + 1 < $j && $argv[$i + 1][0] !== '-')
{
$value = $argv[$i + 1];
$i++;
}
else
{
$value = isset($out[$key]) ? $out[$key] : true;
}
$out[$key] = $value;
}
// --bar=baz
else
{
$key = substr($arg, 2, $eqPos - 2);
$value = substr($arg, $eqPos + 1);
$out[$key] = $value;
}
}
elseif (substr($arg, 0, 1) === '-')
// -k=value -abc
{
// -k=value
if (substr($arg, 2, 1) === '=')
{
$key = substr($arg, 1, 1);
$value = substr($arg, 3);
$out[$key] = $value;
}
else
// -abc
{
$chars = str_split(substr($arg, 1));
foreach ($chars as $char)
{
$key = $char;
$value = isset($out[$key]) ? $out[$key] : true;
$out[$key] = $value;
}
// -a a-value
if ((count($chars) === 1) && ($i + 1 < $j) && ($argv[$i + 1][0] !== '-'))
{
$out[$key] = $argv[$i + 1];
$i++;
}
}
}
else
{
// Plain-arg
$this->args[] = $arg;
}
}
$this->data = $out;
}
}
Cookie.php 0000644 00000010426 15234434233 0006474 0 ustar 00 <?php
/**
* Joomla! Content Management System
*
* @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\CMS\Input;
defined('JPATH_PLATFORM') or die;
use Joomla\CMS\Filter\InputFilter;
/**
* Joomla! Input Cookie Class
*
* @since 1.7.0
* @deprecated 5.0 Use Joomla\Input\Cookie instead
*/
class Cookie extends Input
{
/**
* Constructor.
*
* @param array $source Ignored.
* @param array $options Array of configuration parameters (Optional)
*
* @since 1.7.0
* @deprecated 5.0 Use Joomla\Input\Cookie instead
*/
public function __construct(array $source = null, array $options = array())
{
if (isset($options['filter']))
{
$this->filter = $options['filter'];
}
else
{
$this->filter = InputFilter::getInstance();
}
// Set the data source.
$this->data = & $_COOKIE;
// Set the options for the class.
$this->options = $options;
}
/**
* Sets a value
*
* @param string $name Name of the value to set.
* @param mixed $value Value to assign to the input.
* @param integer $expire The time the cookie expires. This is a Unix timestamp so is in number
* of seconds since the epoch. In other words, you'll most likely set this
* with the time() function plus the number of seconds before you want it
* to expire. Or you might use mktime(). time()+60*60*24*30 will set the
* cookie to expire in 30 days. If set to 0, or omitted, the cookie will
* expire at the end of the session (when the browser closes).
* @param string $path The path on the server in which the cookie will be available on. If set
* to '/', the cookie will be available within the entire domain. If set to
* '/foo/', the cookie will only be available within the /foo/ directory and
* all sub-directories such as /foo/bar/ of domain. The default value is the
* current directory that the cookie is being set in.
* @param string $domain The domain that the cookie is available to. To make the cookie available
* on all subdomains of example.com (including example.com itself) then you'd
* set it to '.example.com'. Although some browsers will accept cookies without
* the initial ., RFC 2109 requires it to be included. Setting the domain to
* 'www.example.com' or '.www.example.com' will make the cookie only available
* in the www subdomain.
* @param boolean $secure Indicates that the cookie should only be transmitted over a secure HTTPS
* connection from the client. When set to TRUE, the cookie will only be set
* if a secure connection exists. On the server-side, it's on the programmer
* to send this kind of cookie only on secure connection (e.g. with respect
* to $_SERVER["HTTPS"]).
* @param boolean $httpOnly When TRUE the cookie will be made accessible only through the HTTP protocol.
* This means that the cookie won't be accessible by scripting languages, such
* as JavaScript. This setting can effectively help to reduce identity theft
* through XSS attacks (although it is not supported by all browsers).
*
* @return void
*
* @link http://www.ietf.org/rfc/rfc2109.txt
* @see setcookie()
* @since 1.7.0
* @deprecated 5.0 Use Joomla\Input\Cookie instead
*/
public function set($name, $value, $expire = 0, $path = '', $domain = '', $secure = false, $httpOnly = false)
{
if (is_array($value))
{
foreach ($value as $key => $val)
{
setcookie($name . "[$key]", $val, $expire, $path, $domain, $secure, $httpOnly);
}
}
else
{
setcookie($name, $value, $expire, $path, $domain, $secure, $httpOnly);
}
$this->data[$name] = $value;
}
}
Files.php 0000644 00000006420 15234434233 0006324 0 ustar 00 <?php
/**
* Joomla! Content Management System
*
* @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\CMS\Input;
defined('JPATH_PLATFORM') or die;
use Joomla\CMS\Filter\InputFilter;
/**
* Joomla! Input Files Class
*
* @since 1.7.0
* @deprecated 5.0 Use Joomla\Input\Files instead
*/
class Files extends Input
{
/**
* The pivoted data from a $_FILES or compatible array.
*
* @var array
* @since 1.7.0
* @deprecated 5.0 Use Joomla\Input\Files instead
*/
protected $decodedData = array();
/**
* The class constructor.
*
* @param array $source The source argument is ignored. $_FILES is always used.
* @param array $options An optional array of configuration options:
* filter : a custom JFilterInput object.
*
* @since 3.0.0
* @deprecated 5.0 Use Joomla\Input\Files instead
*/
public function __construct(array $source = null, array $options = array())
{
if (isset($options['filter']))
{
$this->filter = $options['filter'];
}
else
{
$this->filter = InputFilter::getInstance();
}
// Set the data source.
$this->data = & $_FILES;
// Set the options for the class.
$this->options = $options;
}
/**
* Gets a value from the input data.
*
* @param string $name The name of the input property (usually the name of the files INPUT tag) to get.
* @param mixed $default The default value to return if the named property does not exist.
* @param string $filter The filter to apply to the value.
*
* @return mixed The filtered input value.
*
* @see JFilterInput::clean()
* @since 1.7.0
* @deprecated 5.0 Use Joomla\Input\Files instead
*/
public function get($name, $default = null, $filter = 'cmd')
{
if (isset($this->data[$name]))
{
$results = $this->decodeData(
array(
$this->data[$name]['name'],
$this->data[$name]['type'],
$this->data[$name]['tmp_name'],
$this->data[$name]['error'],
$this->data[$name]['size'],
)
);
// Prevent returning an unsafe file unless specifically requested
if (strtoupper($filter) !== 'RAW')
{
$isSafe = InputFilter::isSafeFile($results);
if (!$isSafe)
{
return $default;
}
}
return $results;
}
return $default;
}
/**
* Method to decode a data array.
*
* @param array $data The data array to decode.
*
* @return array
*
* @since 1.7.0
* @deprecated 5.0 Use Joomla\Input\Files instead
*/
protected function decodeData(array $data)
{
$result = array();
if (is_array($data[0]))
{
foreach ($data[0] as $k => $v)
{
$result[$k] = $this->decodeData(array($data[0][$k], $data[1][$k], $data[2][$k], $data[3][$k], $data[4][$k]));
}
return $result;
}
return array('name' => $data[0], 'type' => $data[1], 'tmp_name' => $data[2], 'error' => $data[3], 'size' => $data[4]);
}
/**
* Sets a value.
*
* @param string $name The name of the input property to set.
* @param mixed $value The value to assign to the input property.
*
* @return void
*
* @since 1.7.0
* @deprecated 5.0 Use Joomla\Input\Files instead
*/
public function set($name, $value)
{
}
}
Input.php 0000644 00000011073 15234434233 0006361 0 ustar 00 <?php
/**
* @package FOF
* @copyright Copyright (c)2010-2019 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU GPL version 2 or later
*/
namespace FOF30\Input;
defined('_JEXEC') or die;
class Input extends \JInput
{
/**
* Public constructor. Overridden to allow specifying the global input array
* to use as a string and instantiate from an object holding variables.
*
* @param array|string|object|null $source Source data; set null to use $_REQUEST
* @param array $options Filter options
*/
public function __construct($source = null, array $options = array())
{
$hash = null;
if (is_string($source))
{
$hash = strtoupper($source);
switch ($hash)
{
case 'GET':
$source = $_GET;
break;
case 'POST':
$source = $_POST;
break;
case 'FILES':
$source = $_FILES;
break;
case 'COOKIE':
$source = $_COOKIE;
break;
case 'ENV':
$source = $_ENV;
break;
case 'SERVER':
$source = $_SERVER;
break;
default:
$source = $_REQUEST;
$hash = 'REQUEST';
break;
}
}
elseif (is_object($source) && ($source instanceof Input))
{
$source = $source->getData();
}
elseif (is_object($source) && ($source instanceof \JInput))
{
$serialised = $source->serialize();
list ($xOptions, $xData, $xInput) = unserialize($serialised);
unset ($xOptions);
unset ($xInput);
unset ($source);
$source = $xData;
unset ($xData);
}
elseif (is_object($source))
{
try
{
$source = (array) $source;
}
catch (\Exception $exc)
{
$source = null;
}
}
elseif (is_array($source))
{
// Nothing, it's already an array
}
else
{
// Any other case
$source = null;
}
// If we are not sure use the REQUEST array
if (empty($source))
{
$source = $_REQUEST;
$hash = 'REQUEST';
}
// Magic quotes GPC handling (something JInput simply can't handle at all)
// @codeCoverageIgnoreStart
if (($hash == 'REQUEST') && get_magic_quotes_gpc() && class_exists('\\JRequest', true))
{
$source = \JRequest::get('REQUEST', 2);
}
// @codeCoverageIgnoreEnd
parent::__construct($source, $options);
}
/**
* Gets a value from the input data. Overridden to allow specifying a filter
* mask.
*
* @param string $name Name of the value to get.
* @param mixed $default Default value to return if variable does not exist.
* @param string $filter Filter to apply to the value.
* @param int $mask The filter mask
*
* @return mixed The filtered input value.
*/
public function get($name, $default = null, $filter = 'cmd', $mask = 0)
{
if (isset($this->data[$name]))
{
return $this->_cleanVar($this->data[$name], $mask, $filter);
}
return $default;
}
/**
* Returns a copy of the raw data stored in the class
*
* @return array
*/
public function getData()
{
return $this->data;
}
/**
* Magic method to get filtered input data.
*
* @param mixed $name Name of the value to get.
* @param string $arguments [0] The name of the variable [1] The default value [2] Mask
*
* @return boolean The filtered boolean input value.
*/
public function __call($name, $arguments)
{
if (substr($name, 0, 3) == 'get')
{
$filter = substr($name, 3);
$default = null;
$mask = 0;
if (isset($arguments[1]))
{
$default = $arguments[1];
}
if (isset($arguments[2]))
{
$mask = $arguments[2];
}
return $this->get($arguments[0], $default, $filter, $mask);
}
}
/**
* Custom filter implementation. Works better with arrays and allows the use
* of a filter mask.
*
* @param mixed $var The variable (value) to clean
* @param integer $mask The clean mask
* @param string $type The variable type
*
* @return mixed
*/
protected function _cleanVar($var, $mask = 0, $type = null)
{
if (is_array($var))
{
$temp = array();
foreach ($var as $k => $v)
{
$temp[$k] = self::_cleanVar($v, $mask);
}
return $temp;
}
// If the no trim flag is not set, trim the variable
if (!($mask & 1) && is_string($var))
{
$var = trim($var);
}
// Now we handle input filtering
if ($mask & 2)
{
// If the allow raw flag is set, do not modify the variable
}
elseif ($mask & 4)
{
// If the allow HTML flag is set, apply a safe HTML filter to the variable
$safeHtmlFilter = \JFilterInput::getInstance(null, null, 1, 1);
$var = $safeHtmlFilter->clean($var, $type);
}
else
{
$var = $this->filter->clean($var, $type);
}
return $var;
}
}
Json.php 0000644 00000003342 15234434233 0006173 0 ustar 00 <?php
/**
* Joomla! Content Management System
*
* @copyright (C) 2012 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\CMS\Input;
defined('JPATH_PLATFORM') or die;
use Joomla\CMS\Filter\InputFilter;
/**
* Joomla! Input JSON Class
*
* This class decodes a JSON string from the raw request data and makes it available via
* the standard JInput interface.
*
* @since 3.0.1
* @deprecated 5.0 Use Joomla\Input\Json instead
*/
class Json extends Input
{
/**
* @var string The raw JSON string from the request.
* @since 3.0.1
* @deprecated 5.0 Use Joomla\Input\Json instead
*/
private $_raw;
/**
* Constructor.
*
* @param array $source Source data (Optional, default is the raw HTTP input decoded from JSON)
* @param array $options Array of configuration parameters (Optional)
*
* @since 3.0.1
* @deprecated 5.0 Use Joomla\Input\Json instead
*/
public function __construct(array $source = null, array $options = array())
{
if (isset($options['filter']))
{
$this->filter = $options['filter'];
}
else
{
$this->filter = InputFilter::getInstance();
}
if (is_null($source))
{
$this->_raw = file_get_contents('php://input');
$this->data = json_decode($this->_raw, true);
if (!is_array($this->data))
{
$this->data = array();
}
}
else
{
$this->data = &$source;
}
$this->options = $options;
}
/**
* Gets the raw JSON string from the request.
*
* @return string The raw JSON string from the request.
*
* @since 3.0.1
* @deprecated 5.0 Use Joomla\Input\Json instead
*/
public function getRaw()
{
return $this->_raw;
}
}