PMCORE-3843
This commit is contained in:
@@ -38,6 +38,7 @@ rbac/engine/xmlform
|
||||
rbac/public_html/skins/JSForms.js
|
||||
virtualhost.conf.example
|
||||
workflow/engine/classes/class.jrml.php
|
||||
workflow/engine/classes/class.webdav.php
|
||||
workflow/engine/classes/entities/AppSolrQueue.php
|
||||
workflow/engine/classes/entities/Base.php
|
||||
workflow/engine/classes/entities/FacetGroup.php
|
||||
@@ -134,4 +135,47 @@ workflow/public_html/skins/ajax.js
|
||||
thirdparty/geshi
|
||||
thirdparty/libchart
|
||||
thirdparty/lime
|
||||
thirdparty/pear/Benchmark
|
||||
thirdparty/pear/Console
|
||||
thirdparty/pear/HTTP
|
||||
thirdparty/pear/Net
|
||||
thirdparty/pear/Numbers
|
||||
thirdparty/pear/OLE
|
||||
thirdparty/pear/SOAP
|
||||
thirdparty/pear/Spreadsheet
|
||||
thirdparty/pear/XML
|
||||
thirdparty/pear/DB/dbase.php
|
||||
thirdparty/pear/DB/fbsql.php
|
||||
thirdparty/pear/DB/ibase.php
|
||||
thirdparty/pear/DB/ifx.php
|
||||
thirdparty/pear/DB/msql.php
|
||||
thirdparty/pear/DB/mssql.php
|
||||
thirdparty/pear/DB/mysql.php
|
||||
thirdparty/pear/DB/sqlite.php
|
||||
thirdparty/pear/DB/storage.php
|
||||
thirdparty/pear/DB/sybase.php
|
||||
thirdparty/pear/Log/sqlite.php
|
||||
thirdparty/pear/catalog
|
||||
thirdparty/pear/CODING_STANDARDS
|
||||
thirdparty/pear/class.soap_fault.php
|
||||
thirdparty/pear/class.soap_parser.php
|
||||
thirdparty/pear/class.soap_server.php
|
||||
thirdparty/pear/class.soap_transport_http.php
|
||||
thirdparty/pear/class.soap_val.php
|
||||
thirdparty/pear/class.wsdl.php
|
||||
thirdparty/pear/class.wsdlcache.php
|
||||
thirdparty/pear/class.xmlschema.php
|
||||
thirdparty/pear/CMD.php
|
||||
thirdparty/pear/install-pear.php
|
||||
thirdparty/pear/install-pear.txt
|
||||
thirdparty/pear/nusoap.colosa.php
|
||||
thirdparty/pear/nusoap.php
|
||||
thirdparty/pear/nusoapmime.php
|
||||
thirdparty/pear/package-Archive_Tar.xml
|
||||
thirdparty/pear/package-Console_Getopt.xml
|
||||
thirdparty/pear/package.dtd
|
||||
thirdparty/pear/package-PEAR.xml
|
||||
thirdparty/pear/README
|
||||
thirdparty/pear/template.spec
|
||||
thirdparty/pear/UDDI.php
|
||||
thirdparty/tcpdf
|
||||
167
thirdparty/pear/Benchmark/Iterate.php
vendored
167
thirdparty/pear/Benchmark/Iterate.php
vendored
@@ -1,167 +0,0 @@
|
||||
<?php
|
||||
//
|
||||
// +------------------------------------------------------------------------+
|
||||
// | PEAR :: Benchmark |
|
||||
// +------------------------------------------------------------------------+
|
||||
// | Copyright (c) 2001-2006 Sebastian Bergmann <sb@sebastian-bergmann.de>. |
|
||||
// +------------------------------------------------------------------------+
|
||||
// | This source file is subject to the New BSD license, That is bundled |
|
||||
// | with this package in the file LICENSE, and is available through |
|
||||
// | the world-wide-web at |
|
||||
// | http://www.opensource.org/licenses/bsd-license.php |
|
||||
// | If you did not receive a copy of the new BSDlicense and are unable |
|
||||
// | to obtain it through the world-wide-web, please send a note to |
|
||||
// | license@php.net so we can mail you a copy immediately. |
|
||||
// +------------------------------------------------------------------------+
|
||||
//
|
||||
// $Id: Iterate.php,v 1.1 2007/05/24 05:17:56 anant Exp $
|
||||
//
|
||||
|
||||
require_once 'Benchmark/Timer.php';
|
||||
|
||||
/**
|
||||
* Provides timing and profiling information.
|
||||
*
|
||||
* Example 1
|
||||
*
|
||||
* <code>
|
||||
* <?php
|
||||
* require_once 'Benchmark/Iterate.php';
|
||||
*
|
||||
* $benchmark = new Benchmark_Iterate;
|
||||
*
|
||||
* function foo($string) {
|
||||
* print $string . '<br>';
|
||||
* }
|
||||
*
|
||||
* $benchmark->run(100, 'foo', 'test');
|
||||
* $result = $benchmark->get();
|
||||
* ?>
|
||||
* </code>
|
||||
*
|
||||
* Example 2
|
||||
*
|
||||
* <code>
|
||||
* <?php
|
||||
* require_once 'Benchmark/Iterate.php';
|
||||
*
|
||||
* $benchmark = new Benchmark_Iterate;
|
||||
*
|
||||
* class MyClass {
|
||||
* function foo($string) {
|
||||
* print $string . '<br>';
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* $benchmark->run(100, 'myclass::foo', 'test');
|
||||
* $result = $benchmark->get();
|
||||
* ?>
|
||||
* </code>
|
||||
*
|
||||
* Example 3
|
||||
*
|
||||
* <code>
|
||||
* <?php
|
||||
* require_once 'Benchmark/Iterate.php';
|
||||
*
|
||||
* $benchmark = new Benchmark_Iterate;
|
||||
*
|
||||
* class MyClass {
|
||||
* function foo($string) {
|
||||
* print $string . '<br>';
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* $o = new MyClass();
|
||||
*
|
||||
* $benchmark->run(100, 'o->foo', 'test');
|
||||
* $result = $benchmark->get();
|
||||
* ?>
|
||||
* </code>
|
||||
*
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright Copyright © 2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.php.net/license/3_0.txt The PHP License, Version 3.0
|
||||
* @category Benchmarking
|
||||
* @package Benchmark
|
||||
*/
|
||||
class Benchmark_Iterate extends Benchmark_Timer {
|
||||
/**
|
||||
* Benchmarks a function or method.
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function run() {
|
||||
$arguments = func_get_args();
|
||||
$iterations = array_shift($arguments);
|
||||
$function_name = array_shift($arguments);
|
||||
|
||||
if (strstr($function_name, '::')) {
|
||||
$function_name = explode('::', $function_name);
|
||||
$objectmethod = $function_name[1];
|
||||
}
|
||||
|
||||
if (strstr($function_name, '->')) {
|
||||
$function_name = explode('->', $function_name);
|
||||
$objectname = $function_name[0];
|
||||
|
||||
$object = $GLOBALS[$objectname];
|
||||
$objectmethod = $function_name[1];
|
||||
|
||||
for ($i = 1; $i <= $iterations; $i++) {
|
||||
$this->setMarker('start_' . $i);
|
||||
call_user_func_array(array($object, $function_name[1]), $arguments);
|
||||
$this->setMarker('end_' . $i);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
for ($i = 1; $i <= $iterations; $i++) {
|
||||
$this->setMarker('start_' . $i);
|
||||
call_user_func_array($function_name, $arguments);
|
||||
$this->setMarker('end_' . $i);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns benchmark result.
|
||||
*
|
||||
* $result[x ] = execution time of iteration x
|
||||
* $result['mean' ] = mean execution time
|
||||
* $result['iterations'] = number of iterations
|
||||
*
|
||||
* @return array
|
||||
* @access public
|
||||
*/
|
||||
function get($simple_output = false) {
|
||||
$result = array();
|
||||
$total = 0;
|
||||
|
||||
$iterations = count($this->markers)/2;
|
||||
|
||||
for ($i = 1; $i <= $iterations; $i++) {
|
||||
$time = $this->timeElapsed('start_'.$i , 'end_'.$i);
|
||||
|
||||
if (extension_loaded('bcmath')) {
|
||||
$total = bcadd($total, $time, 6);
|
||||
} else {
|
||||
$total = $total + $time;
|
||||
}
|
||||
|
||||
if (!$simple_output) {
|
||||
$result[$i] = $time;
|
||||
}
|
||||
}
|
||||
|
||||
if (extension_loaded('bcmath')) {
|
||||
$result['mean'] = bcdiv($total, $iterations, 6);
|
||||
} else {
|
||||
$result['mean'] = $total / $iterations;
|
||||
}
|
||||
|
||||
$result['iterations'] = $iterations;
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
447
thirdparty/pear/Benchmark/Profiler.php
vendored
447
thirdparty/pear/Benchmark/Profiler.php
vendored
File diff suppressed because it is too large
Load Diff
321
thirdparty/pear/Benchmark/Timer.php
vendored
321
thirdparty/pear/Benchmark/Timer.php
vendored
File diff suppressed because it is too large
Load Diff
285
thirdparty/pear/CMD.php
vendored
285
thirdparty/pear/CMD.php
vendored
@@ -1,285 +0,0 @@
|
||||
<?php
|
||||
//
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP Version 4 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1997-2003 The PHP Group |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to version 2.02 of the PHP license, |
|
||||
// | that is bundled with this package in the file LICENSE, and is |
|
||||
// | available at through the world-wide-web at |
|
||||
// | http://www.php.net/license/2_02.txt. |
|
||||
// | If you did not receive a copy of the PHP license and are unable to |
|
||||
// | obtain it through the world-wide-web, please send a note to |
|
||||
// | license@php.net so we can mail you a copy immediately. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Author: Anders Johannsen <anders@johannsen.com> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
define('CMD_RCSID', '$Id: CMD.php,v 1.5 2002/12/31 16:18:22 sebastian Exp $');
|
||||
|
||||
/**
|
||||
* The Cmd:: class implements an abstraction for various ways
|
||||
* of executing commands (directly using the backtick operator,
|
||||
* as a background task after the script has terminated using
|
||||
* register_shutdown_function() or as a detached process using nohup).
|
||||
*
|
||||
* @author Anders Johannsen <anders@johannsen.com>
|
||||
* @version $Revision: 1.5 $
|
||||
**/
|
||||
|
||||
require_once 'PEAR.php';
|
||||
|
||||
|
||||
class Cmd extends PEAR
|
||||
{
|
||||
var $arrSetting = array();
|
||||
var $arrConstant = array();
|
||||
var $arrCommand = array();
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*
|
||||
* Defines all necessary constants and sets defaults
|
||||
*
|
||||
* @author Anders Johannsen <anders@johannsen.com>
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
**/
|
||||
|
||||
function Cmd ()
|
||||
{
|
||||
// Defining constants
|
||||
$this->arrConstant = array ("CMD_SEQUENCE",
|
||||
"CMD_SHUTDOWN",
|
||||
"CMD_SHELL",
|
||||
"CMD_OUTPUT",
|
||||
"CMD_NOHUP",
|
||||
"CMD_VERBOSE"
|
||||
);
|
||||
|
||||
foreach ($this->arrConstant as $key => $value) {
|
||||
if (!defined($value)) {
|
||||
define($value, $key);
|
||||
}
|
||||
}
|
||||
|
||||
// Setting default values
|
||||
$this->arrSetting[CMD_SEQUENCE] = true;
|
||||
$this->arrSetting[CMD_SHUTDOWN] = false;
|
||||
$this->arrSetting[CMD_OUTPUT] = false;
|
||||
$this->arrSetting[CMD_NOHUP] = false;
|
||||
$this->arrSetting[CMD_VERBOSE] = false;
|
||||
|
||||
$arrShell = array ("sh", "bash", "zsh", "tcsh", "csh", "ash", "sash", "esh", "ksh");
|
||||
|
||||
foreach ($arrShell as $shell) {
|
||||
if ($this->arrSetting[CMD_SHELL] = $this->which($shell)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($this->arrSetting[CMD_SHELL])) {
|
||||
$this->raiseError("No shell found");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets any option
|
||||
*
|
||||
* The options are currently:
|
||||
* CMD_SHUTDOWN : Execute commands via a shutdown function
|
||||
* CMD_SHELL : Path to shell
|
||||
* CMD_OUTPUT : Output stdout from process
|
||||
* CMD_NOHUP : Use nohup to detach process
|
||||
* CMD_VERBOSE : Print errors to stdout
|
||||
*
|
||||
* @param $option is a constant, which corresponds to the
|
||||
* option that should be changed
|
||||
*
|
||||
* @param $setting is the value of the option currently
|
||||
* being toggled.
|
||||
*
|
||||
* @return bool true if succes, else false
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @author Anders Johannsen <anders@johannsen.com>
|
||||
*
|
||||
**/
|
||||
|
||||
function setOption ($option, $setting)
|
||||
{
|
||||
if (empty($this->arrConstant[$option])) {
|
||||
$this->raiseError("No such option: $option");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
switch ($option) {
|
||||
case CMD_OUTPUT:
|
||||
case CMD_SHUTDOWN:
|
||||
case CMD_VERBOSE:
|
||||
case CMD_SEQUENCE:
|
||||
$this->arrSetting[$option] = $setting;
|
||||
return true;
|
||||
break;
|
||||
|
||||
case CMD_SHELL:
|
||||
if (is_executable($setting)) {
|
||||
$this->arrSetting[$option] = $setting;
|
||||
return true;
|
||||
} else {
|
||||
$this->raiseError("No such shell: $setting");
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case CMD_NOHUP:
|
||||
if (empty($setting)) {
|
||||
$this->arrSetting[$option] = false;
|
||||
|
||||
} else if ($location = $this->which("nohup")) {
|
||||
$this->arrSetting[$option] = true;
|
||||
|
||||
} else {
|
||||
$this->raiseError("Nohup was not found on your system");
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add command for execution
|
||||
*
|
||||
* @param $command accepts both arrays and regular strings
|
||||
*
|
||||
* @return bool true if succes, else false
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @author Anders Johannsen <anders@johannsen.com>
|
||||
*
|
||||
**/
|
||||
|
||||
function command($command)
|
||||
{
|
||||
if (is_array($command)) {
|
||||
foreach ($command as $key => $value) {
|
||||
$this->arrCommand[] = $value;
|
||||
}
|
||||
return true;
|
||||
|
||||
} else if (is_string($command)) {
|
||||
$this->arrCommand[] = $command;
|
||||
return true;
|
||||
}
|
||||
|
||||
$this->raiseError("Argument not valid");
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the code according to given options
|
||||
*
|
||||
* @return bool true if succes, else false
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @author Anders Johannsen <anders@johannsen.com>
|
||||
*
|
||||
**/
|
||||
|
||||
function exec()
|
||||
{
|
||||
// Warning about impossible mix of options
|
||||
if (!empty($this->arrSetting[CMD_OUTPUT])) {
|
||||
if (!empty($this->arrSetting[CMD_SHUTDOWN]) || !empty($this->arrSetting[CMD_NOHUP])) {
|
||||
$this->raiseError("Error: Commands executed via shutdown functions or nohup cannot return output");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Building command
|
||||
$strCommand = implode(";", $this->arrCommand);
|
||||
|
||||
$strExec = "echo '$strCommand' | ".$this->arrSetting[CMD_SHELL];
|
||||
|
||||
if (empty($this->arrSetting[CMD_OUTPUT])) {
|
||||
$strExec = $strExec . ' > /dev/null';
|
||||
}
|
||||
|
||||
if (!empty($this->arrSetting[CMD_NOHUP])) {
|
||||
$strExec = 'nohup ' . $strExec;
|
||||
}
|
||||
|
||||
// Executing
|
||||
if (!empty($this->arrSetting[CMD_SHUTDOWN])) {
|
||||
$line = "system(\"$strExec\");";
|
||||
$function = create_function('', $line);
|
||||
register_shutdown_function($function);
|
||||
return true;
|
||||
} else {
|
||||
return `$strExec`;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Errorhandler. If option CMD_VERBOSE is true,
|
||||
* the error is printed to stdout, otherwise it
|
||||
* is avaliable in lastError
|
||||
*
|
||||
* @return bool always returns true
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @author Anders Johannsen <anders@johannsen.com>
|
||||
**/
|
||||
|
||||
function raiseError($strError)
|
||||
{
|
||||
if (!empty($this->arrSetting[CMD_VERBOSE])) {
|
||||
echo $strError;
|
||||
} else {
|
||||
$this->lastError = $strError;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Functionality similiar to unix 'which'. Searches the path
|
||||
* for the specified program.
|
||||
*
|
||||
* @param $cmd name of the executable to search for
|
||||
*
|
||||
* @return string returns the full path if found,
|
||||
* false if not
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @author Anders Johannsen <anders@johannsen.com>
|
||||
**/
|
||||
|
||||
function which($cmd)
|
||||
{
|
||||
global $HTTP_ENV_VARS;
|
||||
|
||||
$arrPath = explode(":", $HTTP_ENV_VARS['PATH']);
|
||||
|
||||
foreach ($arrPath as $path) {
|
||||
$location = $path . "/" . $cmd;
|
||||
|
||||
if (is_executable($location)) {
|
||||
return $location;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
8
thirdparty/pear/CODING_STANDARDS
vendored
8
thirdparty/pear/CODING_STANDARDS
vendored
@@ -1,8 +0,0 @@
|
||||
===========================================================================
|
||||
|| PEAR Coding Standards ||
|
||||
===========================================================================
|
||||
|
||||
$Id: CODING_STANDARDS,v 1.14 2002/01/24 15:02:05 cox Exp $
|
||||
|
||||
This document is no longer maintained, see
|
||||
http://pear.php.net/manual/ instead.
|
||||
251
thirdparty/pear/Console/Getopt.php
vendored
251
thirdparty/pear/Console/Getopt.php
vendored
@@ -1,251 +0,0 @@
|
||||
<?php
|
||||
/* vim: set expandtab tabstop=4 shiftwidth=4: */
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP Version 4 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1997-2003 The PHP Group |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to version 3.0 of the PHP license, |
|
||||
// | that is bundled with this package in the file LICENSE, and is |
|
||||
// | available through the world-wide-web at the following url: |
|
||||
// | http://www.php.net/license/3_0.txt. |
|
||||
// | If you did not receive a copy of the PHP license and are unable to |
|
||||
// | obtain it through the world-wide-web, please send a note to |
|
||||
// | license@php.net so we can mail you a copy immediately. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Author: Andrei Zmievski <andrei@php.net> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id: Getopt.php 6820 2007-06-20 13:35:30Z kevin_fourie $
|
||||
|
||||
require_once 'PEAR.php';
|
||||
|
||||
/**
|
||||
* Command-line options parsing class.
|
||||
*
|
||||
* @author Andrei Zmievski <andrei@php.net>
|
||||
*
|
||||
*/
|
||||
class Console_Getopt {
|
||||
/**
|
||||
* Parses the command-line options.
|
||||
*
|
||||
* The first parameter to this function should be the list of command-line
|
||||
* arguments without the leading reference to the running program.
|
||||
*
|
||||
* The second parameter is a string of allowed short options. Each of the
|
||||
* option letters can be followed by a colon ':' to specify that the option
|
||||
* requires an argument, or a double colon '::' to specify that the option
|
||||
* takes an optional argument.
|
||||
*
|
||||
* The third argument is an optional array of allowed long options. The
|
||||
* leading '--' should not be included in the option name. Options that
|
||||
* require an argument should be followed by '=', and options that take an
|
||||
* option argument should be followed by '=='.
|
||||
*
|
||||
* The return value is an array of two elements: the list of parsed
|
||||
* options and the list of non-option command-line arguments. Each entry in
|
||||
* the list of parsed options is a pair of elements - the first one
|
||||
* specifies the option, and the second one specifies the option argument,
|
||||
* if there was one.
|
||||
*
|
||||
* Long and short options can be mixed.
|
||||
*
|
||||
* Most of the semantics of this function are based on GNU getopt_long().
|
||||
*
|
||||
* @param array $args an array of command-line arguments
|
||||
* @param string $short_options specifies the list of allowed short options
|
||||
* @param array $long_options specifies the list of allowed long options
|
||||
*
|
||||
* @return array two-element array containing the list of parsed options and
|
||||
* the non-option arguments
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
*/
|
||||
public static function getopt2($args, $short_options, $long_options = null)
|
||||
{
|
||||
return Console_Getopt::doGetopt(2, $args, $short_options, $long_options);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function expects $args to start with the script name (POSIX-style).
|
||||
* Preserved for backwards compatibility.
|
||||
* @see getopt2()
|
||||
*/
|
||||
function getopt($args, $short_options, $long_options = null)
|
||||
{
|
||||
return Console_Getopt::doGetopt(1, $args, $short_options, $long_options);
|
||||
}
|
||||
|
||||
/**
|
||||
* The actual implementation of the argument parsing code.
|
||||
*/
|
||||
public static function doGetopt($version, $args, $short_options, $long_options = null)
|
||||
{
|
||||
// in case you pass directly readPHPArgv() as the first arg
|
||||
if (PEAR::isError($args)) {
|
||||
return $args;
|
||||
}
|
||||
if (empty($args)) {
|
||||
return array(array(), array());
|
||||
}
|
||||
$opts = array();
|
||||
$non_opts = array();
|
||||
|
||||
settype($args, 'array');
|
||||
|
||||
if ($long_options) {
|
||||
sort($long_options);
|
||||
}
|
||||
|
||||
/*
|
||||
* Preserve backwards compatibility with callers that relied on
|
||||
* erroneous POSIX fix.
|
||||
*/
|
||||
if ($version < 2) {
|
||||
if (isset($args[0]{0}) && $args[0]{0} != '-') {
|
||||
array_shift($args);
|
||||
}
|
||||
}
|
||||
|
||||
reset($args);
|
||||
while (list($i, $arg) = each($args)) {
|
||||
|
||||
/* The special element '--' means explicit end of
|
||||
options. Treat the rest of the arguments as non-options
|
||||
and end the loop. */
|
||||
if ($arg == '--') {
|
||||
$non_opts = array_merge($non_opts, array_slice($args, $i + 1));
|
||||
break;
|
||||
}
|
||||
|
||||
if ($arg{0} != '-' || (strlen($arg) > 1 && $arg{1} == '-' && !$long_options)) {
|
||||
$non_opts = array_merge($non_opts, array_slice($args, $i));
|
||||
break;
|
||||
} elseif (strlen($arg) > 1 && $arg{1} == '-') {
|
||||
$error = Console_Getopt::_parseLongOption(substr($arg, 2), $long_options, $opts, $args);
|
||||
if (PEAR::isError($error))
|
||||
return $error;
|
||||
} else {
|
||||
$error = Console_Getopt::_parseShortOption(substr($arg, 1), $short_options, $opts, $args);
|
||||
if (PEAR::isError($error))
|
||||
return $error;
|
||||
}
|
||||
}
|
||||
|
||||
return array($opts, $non_opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @access private
|
||||
*
|
||||
*/
|
||||
public static function _parseShortOption($arg, $short_options, &$opts, &$args)
|
||||
{
|
||||
for ($i = 0; $i < strlen($arg); $i++) {
|
||||
$opt = $arg{$i};
|
||||
$opt_arg = null;
|
||||
|
||||
/* Try to find the short option in the specifier string. */
|
||||
if (($spec = strstr($short_options, $opt)) === false || $arg{$i} == ':')
|
||||
{
|
||||
return PEAR::raiseError("Console_Getopt: unrecognized option -- $opt");
|
||||
}
|
||||
|
||||
if (strlen($spec) > 1 && $spec{1} == ':') {
|
||||
if (strlen($spec) > 2 && $spec{2} == ':') {
|
||||
if ($i + 1 < strlen($arg)) {
|
||||
/* Option takes an optional argument. Use the remainder of
|
||||
the arg string if there is anything left. */
|
||||
$opts[] = array($opt, substr($arg, $i + 1));
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/* Option requires an argument. Use the remainder of the arg
|
||||
string if there is anything left. */
|
||||
if ($i + 1 < strlen($arg)) {
|
||||
$opts[] = array($opt, substr($arg, $i + 1));
|
||||
break;
|
||||
} else if (list(, $opt_arg) = each($args))
|
||||
/* Else use the next argument. */;
|
||||
else
|
||||
return PEAR::raiseError("Console_Getopt: option requires an argument -- $opt");
|
||||
}
|
||||
}
|
||||
|
||||
$opts[] = array($opt, $opt_arg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @access private
|
||||
*
|
||||
*/
|
||||
function _parseLongOption($arg, $long_options, &$opts, &$args)
|
||||
{
|
||||
@list($opt, $opt_arg) = explode('=', $arg);
|
||||
$opt_len = strlen($opt);
|
||||
|
||||
for ($i = 0; $i < count($long_options); $i++) {
|
||||
$long_opt = $long_options[$i];
|
||||
$opt_start = substr($long_opt, 0, $opt_len);
|
||||
|
||||
/* Option doesn't match. Go on to the next one. */
|
||||
if ($opt_start != $opt)
|
||||
continue;
|
||||
|
||||
$opt_rest = substr($long_opt, $opt_len);
|
||||
|
||||
/* Check that the options uniquely matches one of the allowed
|
||||
options. */
|
||||
if ($opt_rest != '' && $opt{0} != '=' &&
|
||||
$i + 1 < count($long_options) &&
|
||||
$opt == substr($long_options[$i+1], 0, $opt_len)) {
|
||||
return PEAR::raiseError("Console_Getopt: option --$opt is ambiguous");
|
||||
}
|
||||
|
||||
if (substr($long_opt, -1) == '=') {
|
||||
if (substr($long_opt, -2) != '==') {
|
||||
/* Long option requires an argument.
|
||||
Take the next argument if one wasn't specified. */;
|
||||
if (!strlen($opt_arg) && !(list(, $opt_arg) = each($args))) {
|
||||
return PEAR::raiseError("Console_Getopt: option --$opt requires an argument");
|
||||
}
|
||||
}
|
||||
} else if ($opt_arg) {
|
||||
return PEAR::raiseError("Console_Getopt: option --$opt doesn't allow an argument");
|
||||
}
|
||||
|
||||
$opts[] = array('--' . $opt, $opt_arg);
|
||||
return;
|
||||
}
|
||||
|
||||
return PEAR::raiseError("Console_Getopt: unrecognized option --$opt");
|
||||
}
|
||||
|
||||
/**
|
||||
* Safely read the $argv PHP array across different PHP configurations.
|
||||
* Will take care on register_globals and register_argc_argv ini directives
|
||||
*
|
||||
* @access public
|
||||
* @return mixed the $argv PHP array or PEAR error if not registered
|
||||
*/
|
||||
function readPHPArgv()
|
||||
{
|
||||
global $argv;
|
||||
if (!is_array($argv)) {
|
||||
if (!@is_array($_SERVER['argv'])) {
|
||||
if (!@is_array($GLOBALS['HTTP_SERVER_VARS']['argv'])) {
|
||||
return PEAR::raiseError("Console_Getopt: Could not read cmd args (register_argc_argv=Off?)");
|
||||
}
|
||||
return $GLOBALS['HTTP_SERVER_VARS']['argv'];
|
||||
}
|
||||
return $_SERVER['argv'];
|
||||
}
|
||||
return $argv;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
225
thirdparty/pear/DB/dbase.php
vendored
225
thirdparty/pear/DB/dbase.php
vendored
@@ -1,225 +0,0 @@
|
||||
<?php
|
||||
/* vim: set expandtab tabstop=4 shiftwidth=4 foldmethod=marker: */
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP Version 4 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1997-2004 The PHP Group |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to version 2.02 of the PHP license, |
|
||||
// | that is bundled with this package in the file LICENSE, and is |
|
||||
// | available at through the world-wide-web at |
|
||||
// | http://www.php.net/license/2_02.txt. |
|
||||
// | If you did not receive a copy of the PHP license and are unable to |
|
||||
// | obtain it through the world-wide-web, please send a note to |
|
||||
// | license@php.net so we can mail you a copy immediately. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Author: Tomas V.V.Cox <cox@idecnet.com> |
|
||||
// | Maintainer: Daniel Convissor <danielc@php.net> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id: dbase.php 3355 2005-06-11 22:14:40Z nbm $
|
||||
|
||||
|
||||
// XXX legend:
|
||||
// You have to compile your PHP with the --enable-dbase option
|
||||
|
||||
|
||||
require_once 'DB/common.php';
|
||||
|
||||
/**
|
||||
* Database independent query interface definition for PHP's dbase
|
||||
* extension.
|
||||
*
|
||||
* @package DB
|
||||
* @version $Id: dbase.php 3355 2005-06-11 22:14:40Z nbm $
|
||||
* @category Database
|
||||
* @author Stig Bakken <ssb@php.net>
|
||||
*/
|
||||
class DB_dbase extends DB_common
|
||||
{
|
||||
// {{{ properties
|
||||
|
||||
var $connection;
|
||||
var $phptype, $dbsyntax;
|
||||
var $prepare_tokens = array();
|
||||
var $prepare_types = array();
|
||||
var $res_row = array();
|
||||
var $result = 0;
|
||||
|
||||
// }}}
|
||||
// {{{ constructor
|
||||
|
||||
/**
|
||||
* DB_mysql constructor.
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function DB_dbase()
|
||||
{
|
||||
$this->DB_common();
|
||||
$this->phptype = 'dbase';
|
||||
$this->dbsyntax = 'dbase';
|
||||
$this->features = array(
|
||||
'prepare' => false,
|
||||
'pconnect' => false,
|
||||
'transactions' => false,
|
||||
'limit' => false
|
||||
);
|
||||
$this->errorcode_map = array();
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ connect()
|
||||
|
||||
function connect($dsninfo, $persistent = false)
|
||||
{
|
||||
if (!DB::assertExtension('dbase')) {
|
||||
return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
|
||||
}
|
||||
$this->dsn = $dsninfo;
|
||||
|
||||
$ini = ini_get('track_errors');
|
||||
if ($ini) {
|
||||
$conn = @dbase_open($dsninfo['database'], 0);
|
||||
} else {
|
||||
ini_set('track_errors', 1);
|
||||
$conn = @dbase_open($dsninfo['database'], 0);
|
||||
ini_set('track_errors', $ini);
|
||||
}
|
||||
if (!$conn) {
|
||||
return $this->raiseError(DB_ERROR_CONNECT_FAILED, null,
|
||||
null, null, strip_tags($php_errormsg));
|
||||
}
|
||||
$this->connection = $conn;
|
||||
return DB_OK;
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ disconnect()
|
||||
|
||||
function disconnect()
|
||||
{
|
||||
$ret = @dbase_close($this->connection);
|
||||
$this->connection = null;
|
||||
return $ret;
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ &query()
|
||||
|
||||
function &query($query = null)
|
||||
{
|
||||
// emulate result resources
|
||||
$this->res_row[(int)$this->result] = 0;
|
||||
$tmp =& new DB_result($this, $this->result++);
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ fetchInto()
|
||||
|
||||
/**
|
||||
* Fetch a row and insert the data into an existing array.
|
||||
*
|
||||
* Formating of the array and the data therein are configurable.
|
||||
* See DB_result::fetchInto() for more information.
|
||||
*
|
||||
* @param resource $result query result identifier
|
||||
* @param array $arr (reference) array where data from the row
|
||||
* should be placed
|
||||
* @param int $fetchmode how the resulting array should be indexed
|
||||
* @param int $rownum the row number to fetch
|
||||
*
|
||||
* @return mixed DB_OK on success, null when end of result set is
|
||||
* reached or on failure
|
||||
*
|
||||
* @see DB_result::fetchInto()
|
||||
* @access private
|
||||
*/
|
||||
function fetchInto($result, &$arr, $fetchmode, $rownum=null)
|
||||
{
|
||||
if ($rownum === null) {
|
||||
$rownum = $this->res_row[(int)$result]++;
|
||||
}
|
||||
if ($fetchmode & DB_FETCHMODE_ASSOC) {
|
||||
$arr = @dbase_get_record_with_names($this->connection, $rownum);
|
||||
if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
|
||||
$arr = array_change_key_case($arr, CASE_LOWER);
|
||||
}
|
||||
} else {
|
||||
$arr = @dbase_get_record($this->connection, $rownum);
|
||||
}
|
||||
if (!$arr) {
|
||||
return null;
|
||||
}
|
||||
if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
|
||||
$this->_rtrimArrayValues($arr);
|
||||
}
|
||||
if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
|
||||
$this->_convertNullArrayValuesToEmpty($arr);
|
||||
}
|
||||
return DB_OK;
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ numCols()
|
||||
|
||||
function numCols($foo)
|
||||
{
|
||||
return @dbase_numfields($this->connection);
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ numRows()
|
||||
|
||||
function numRows($foo)
|
||||
{
|
||||
return @dbase_numrecords($this->connection);
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ quoteSmart()
|
||||
|
||||
/**
|
||||
* Format input so it can be safely used in a query
|
||||
*
|
||||
* @param mixed $in data to be quoted
|
||||
*
|
||||
* @return mixed Submitted variable's type = returned value:
|
||||
* + null = the string <samp>NULL</samp>
|
||||
* + boolean = <samp>T</samp> if true or
|
||||
* <samp>F</samp> if false. Use the <kbd>Logical</kbd>
|
||||
* data type.
|
||||
* + integer or double = the unquoted number
|
||||
* + other (including strings and numeric strings) =
|
||||
* the data with single quotes escaped by preceeding
|
||||
* single quotes then the whole string is encapsulated
|
||||
* between single quotes
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
function quoteSmart($in)
|
||||
{
|
||||
if (is_int($in) || is_double($in)) {
|
||||
return $in;
|
||||
} elseif (is_bool($in)) {
|
||||
return $in ? 'T' : 'F';
|
||||
} elseif (is_null($in)) {
|
||||
return 'NULL';
|
||||
} else {
|
||||
return "'" . $this->escapeSimple($in) . "'";
|
||||
}
|
||||
}
|
||||
|
||||
// }}}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
|
||||
?>
|
||||
655
thirdparty/pear/DB/fbsql.php
vendored
655
thirdparty/pear/DB/fbsql.php
vendored
File diff suppressed because it is too large
Load Diff
784
thirdparty/pear/DB/ibase.php
vendored
784
thirdparty/pear/DB/ibase.php
vendored
File diff suppressed because it is too large
Load Diff
579
thirdparty/pear/DB/ifx.php
vendored
579
thirdparty/pear/DB/ifx.php
vendored
File diff suppressed because it is too large
Load Diff
242
thirdparty/pear/DB/msql.php
vendored
242
thirdparty/pear/DB/msql.php
vendored
@@ -1,242 +0,0 @@
|
||||
<?php
|
||||
/* vim: set expandtab tabstop=4 shiftwidth=4 foldmethod=marker: */
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP Version 4 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1997-2004 The PHP Group |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to version 2.02 of the PHP license, |
|
||||
// | that is bundled with this package in the file LICENSE, and is |
|
||||
// | available at through the world-wide-web at |
|
||||
// | http://www.php.net/license/2_02.txt. |
|
||||
// | If you did not receive a copy of the PHP license and are unable to |
|
||||
// | obtain it through the world-wide-web, please send a note to |
|
||||
// | license@php.net so we can mail you a copy immediately. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Author: Sterling Hughes <sterling@php.net> |
|
||||
// | Maintainer: Daniel Convissor <danielc@php.net> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id: msql.php 3355 2005-06-11 22:14:40Z nbm $
|
||||
|
||||
require_once 'DB/common.php';
|
||||
|
||||
/**
|
||||
* Database independent query interface definition for PHP's Mini-SQL
|
||||
* extension.
|
||||
*
|
||||
* @package DB
|
||||
* @version $Id: msql.php 3355 2005-06-11 22:14:40Z nbm $
|
||||
* @category Database
|
||||
* @author Sterling Hughes <sterling@php.net>
|
||||
*/
|
||||
class DB_msql extends DB_common
|
||||
{
|
||||
// {{{ properties
|
||||
|
||||
var $connection;
|
||||
var $phptype, $dbsyntax;
|
||||
var $prepare_tokens = array();
|
||||
var $prepare_types = array();
|
||||
|
||||
// }}}
|
||||
// {{{ constructor
|
||||
|
||||
function DB_msql()
|
||||
{
|
||||
$this->DB_common();
|
||||
$this->phptype = 'msql';
|
||||
$this->dbsyntax = 'msql';
|
||||
$this->features = array(
|
||||
'prepare' => false,
|
||||
'pconnect' => true,
|
||||
'transactions' => false,
|
||||
'limit' => 'emulate'
|
||||
);
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ connect()
|
||||
|
||||
function connect($dsninfo, $persistent = false)
|
||||
{
|
||||
if (!DB::assertExtension('msql')) {
|
||||
return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND);
|
||||
}
|
||||
|
||||
$this->dsn = $dsninfo;
|
||||
$dbhost = $dsninfo['hostspec'] ? $dsninfo['hostspec'] : 'localhost';
|
||||
|
||||
$connect_function = $persistent ? 'msql_pconnect' : 'msql_connect';
|
||||
|
||||
if ($dbhost && $dsninfo['username'] && $dsninfo['password']) {
|
||||
$conn = $connect_function($dbhost, $dsninfo['username'],
|
||||
$dsninfo['password']);
|
||||
} elseif ($dbhost && $dsninfo['username']) {
|
||||
$conn = $connect_function($dbhost, $dsninfo['username']);
|
||||
} else {
|
||||
$conn = $connect_function($dbhost);
|
||||
}
|
||||
if (!$conn) {
|
||||
$this->raiseError(DB_ERROR_CONNECT_FAILED);
|
||||
}
|
||||
if (!@msql_select_db($dsninfo['database'], $conn)){
|
||||
return $this->raiseError(DB_ERROR_NODBSELECTED);
|
||||
}
|
||||
$this->connection = $conn;
|
||||
return DB_OK;
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ disconnect()
|
||||
|
||||
function disconnect()
|
||||
{
|
||||
$ret = @msql_close($this->connection);
|
||||
$this->connection = null;
|
||||
return $ret;
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ simpleQuery()
|
||||
|
||||
function simpleQuery($query)
|
||||
{
|
||||
$this->last_query = $query;
|
||||
$query = $this->modifyQuery($query);
|
||||
$result = @msql_query($query, $this->connection);
|
||||
if (!$result) {
|
||||
return $this->raiseError();
|
||||
}
|
||||
// Determine which queries that should return data, and which
|
||||
// should return an error code only.
|
||||
return DB::isManip($query) ? DB_OK : $result;
|
||||
}
|
||||
|
||||
|
||||
// }}}
|
||||
// {{{ nextResult()
|
||||
|
||||
/**
|
||||
* Move the internal msql result pointer to the next available result
|
||||
*
|
||||
* @param a valid fbsql result resource
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @return true if a result is available otherwise return false
|
||||
*/
|
||||
function nextResult($result)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ fetchInto()
|
||||
|
||||
/**
|
||||
* Fetch a row and insert the data into an existing array.
|
||||
*
|
||||
* Formating of the array and the data therein are configurable.
|
||||
* See DB_result::fetchInto() for more information.
|
||||
*
|
||||
* @param resource $result query result identifier
|
||||
* @param array $arr (reference) array where data from the row
|
||||
* should be placed
|
||||
* @param int $fetchmode how the resulting array should be indexed
|
||||
* @param int $rownum the row number to fetch
|
||||
*
|
||||
* @return mixed DB_OK on success, null when end of result set is
|
||||
* reached or on failure
|
||||
*
|
||||
* @see DB_result::fetchInto()
|
||||
* @access private
|
||||
*/
|
||||
function fetchInto($result, &$arr, $fetchmode, $rownum=null)
|
||||
{
|
||||
if ($rownum !== null) {
|
||||
if (!@msql_data_seek($result, $rownum)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
if ($fetchmode & DB_FETCHMODE_ASSOC) {
|
||||
$arr = @msql_fetch_array($result, MSQL_ASSOC);
|
||||
if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
|
||||
$arr = array_change_key_case($arr, CASE_LOWER);
|
||||
}
|
||||
} else {
|
||||
$arr = @msql_fetch_row($result);
|
||||
}
|
||||
if (!$arr) {
|
||||
if ($error = @msql_error()) {
|
||||
return $this->raiseError($error);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
|
||||
$this->_rtrimArrayValues($arr);
|
||||
}
|
||||
if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
|
||||
$this->_convertNullArrayValuesToEmpty($arr);
|
||||
}
|
||||
return DB_OK;
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ freeResult()
|
||||
|
||||
function freeResult($result)
|
||||
{
|
||||
return @msql_free_result($result);
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ numCols()
|
||||
|
||||
function numCols($result)
|
||||
{
|
||||
$cols = @msql_num_fields($result);
|
||||
if (!$cols) {
|
||||
return $this->raiseError();
|
||||
}
|
||||
return $cols;
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ numRows()
|
||||
|
||||
function numRows($result)
|
||||
{
|
||||
$rows = @msql_num_rows($result);
|
||||
if (!$rows) {
|
||||
return $this->raiseError();
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ affected()
|
||||
|
||||
/**
|
||||
* Gets the number of rows affected by a query.
|
||||
*
|
||||
* @return number of rows affected by the last query
|
||||
*/
|
||||
function affectedRows()
|
||||
{
|
||||
return @msql_affected_rows($this->connection);
|
||||
}
|
||||
|
||||
// }}}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
|
||||
?>
|
||||
738
thirdparty/pear/DB/mssql.php
vendored
738
thirdparty/pear/DB/mssql.php
vendored
File diff suppressed because it is too large
Load Diff
916
thirdparty/pear/DB/mysql.php
vendored
916
thirdparty/pear/DB/mysql.php
vendored
File diff suppressed because it is too large
Load Diff
695
thirdparty/pear/DB/sqlite.php
vendored
695
thirdparty/pear/DB/sqlite.php
vendored
File diff suppressed because it is too large
Load Diff
495
thirdparty/pear/DB/storage.php
vendored
495
thirdparty/pear/DB/storage.php
vendored
File diff suppressed because it is too large
Load Diff
835
thirdparty/pear/DB/sybase.php
vendored
835
thirdparty/pear/DB/sybase.php
vendored
File diff suppressed because it is too large
Load Diff
343
thirdparty/pear/HTTP/HTTP.php
vendored
343
thirdparty/pear/HTTP/HTTP.php
vendored
File diff suppressed because it is too large
Load Diff
1205
thirdparty/pear/HTTP/Request.php
vendored
1205
thirdparty/pear/HTTP/Request.php
vendored
File diff suppressed because it is too large
Load Diff
2089
thirdparty/pear/HTTP/WebDAV/Server.php
vendored
2089
thirdparty/pear/HTTP/WebDAV/Server.php
vendored
File diff suppressed because it is too large
Load Diff
720
thirdparty/pear/HTTP/WebDAV/Server/Filesystem.php
vendored
720
thirdparty/pear/HTTP/WebDAV/Server/Filesystem.php
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,237 +0,0 @@
|
||||
<?php
|
||||
//
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP Version 4 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1997-2003 The PHP Group |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to version 2.02 of the PHP license, |
|
||||
// | that is bundled with this package in the file LICENSE, and is |
|
||||
// | available at through the world-wide-web at |
|
||||
// | http://www.php.net/license/2_02.txt. |
|
||||
// | If you did not receive a copy of the PHP license and are unable to |
|
||||
// | obtain it through the world-wide-web, please send a note to |
|
||||
// | license@php.net so we can mail you a copy immediately. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Authors: Hartmut Holzgraefe <hholzgra@php.net> |
|
||||
// | Christian Stocker <chregu@bitflux.ch> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id: _parse_lockinfo.php,v 1.2 2004/01/05 12:32:40 hholzgra Exp $
|
||||
//
|
||||
|
||||
/**
|
||||
* helper class for parsing LOCK request bodies
|
||||
*
|
||||
* @package HTTP_WebDAV_Server
|
||||
* @author Hartmut Holzgraefe <hholzgra@php.net>
|
||||
* @version 0.99.1dev
|
||||
*/
|
||||
class _parse_lockinfo
|
||||
{
|
||||
/**
|
||||
* success state flag
|
||||
*
|
||||
* @var bool
|
||||
* @access public
|
||||
*/
|
||||
var $success = false;
|
||||
|
||||
/**
|
||||
* lock type, currently only "write"
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
var $locktype = "";
|
||||
|
||||
/**
|
||||
* lock scope, "shared" or "exclusive"
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
var $lockscope = "";
|
||||
|
||||
/**
|
||||
* lock owner information
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
var $owner = "";
|
||||
|
||||
/**
|
||||
* flag that is set during lock owner read
|
||||
*
|
||||
* @var bool
|
||||
* @access private
|
||||
*/
|
||||
var $collect_owner = false;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
* @param string path of stream to read
|
||||
* @access public
|
||||
*/
|
||||
function _parse_lockinfo($path)
|
||||
{
|
||||
// we assume success unless problems occur
|
||||
$this->success = true;
|
||||
|
||||
// remember if any input was parsed
|
||||
$had_input = false;
|
||||
|
||||
// open stream
|
||||
$f_in = fopen($path, "r");
|
||||
if (!$f_in) {
|
||||
$this->success = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// create namespace aware parser
|
||||
$xml_parser = xml_parser_create_ns("UTF-8", " ");
|
||||
|
||||
// set tag and data handlers
|
||||
xml_set_element_handler($xml_parser,
|
||||
array(&$this, "_startElement"),
|
||||
array(&$this, "_endElement"));
|
||||
xml_set_character_data_handler($xml_parser,
|
||||
array(&$this, "_data"));
|
||||
|
||||
// we want a case sensitive parser
|
||||
xml_parser_set_option($xml_parser,
|
||||
XML_OPTION_CASE_FOLDING, false);
|
||||
|
||||
// parse input
|
||||
while($this->success && !feof($f_in)) {
|
||||
$line = fgets($f_in);
|
||||
if (is_string($line)) {
|
||||
$had_input = true;
|
||||
$this->success &= xml_parse($xml_parser, $line, false);
|
||||
}
|
||||
}
|
||||
|
||||
// finish parsing
|
||||
if($had_input) {
|
||||
$this->success &= xml_parse($xml_parser, "", true);
|
||||
}
|
||||
|
||||
// check if required tags where found
|
||||
$this->success &= !empty($this->locktype);
|
||||
$this->success &= !empty($this->lockscope);
|
||||
|
||||
// free parser resource
|
||||
xml_parser_free($xml_parser);
|
||||
|
||||
// close input stream
|
||||
fclose($f_in);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* tag start handler
|
||||
*
|
||||
* @param resource parser
|
||||
* @param string tag name
|
||||
* @param array tag attributes
|
||||
* @return void
|
||||
* @access private
|
||||
*/
|
||||
function _startElement($parser, $name, $attrs)
|
||||
{
|
||||
// namespace handling
|
||||
if (strstr($name, " ")) {
|
||||
list($ns, $tag) = explode(" ", $name);
|
||||
} else {
|
||||
$ns = "";
|
||||
$tag = $name;
|
||||
}
|
||||
|
||||
|
||||
if ($this->collect_owner) {
|
||||
// everything within the <owner> tag needs to be collected
|
||||
$ns_short = "";
|
||||
$ns_attr = "";
|
||||
if ($ns) {
|
||||
if ($ns == "DAV:") {
|
||||
$ns_short = "D:";
|
||||
} else {
|
||||
$ns_attr = " xmlns='$ns'";
|
||||
}
|
||||
}
|
||||
$this->owner .= "<$ns_short$tag$ns_attr>";
|
||||
} else if ($ns == "DAV:") {
|
||||
// parse only the essential tags
|
||||
switch ($tag) {
|
||||
case "write":
|
||||
$this->locktype = $tag;
|
||||
break;
|
||||
case "exclusive":
|
||||
case "shared":
|
||||
$this->lockscope = $tag;
|
||||
break;
|
||||
case "owner":
|
||||
$this->collect_owner = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* data handler
|
||||
*
|
||||
* @param resource parser
|
||||
* @param string data
|
||||
* @return void
|
||||
* @access private
|
||||
*/
|
||||
function _data($parser, $data)
|
||||
{
|
||||
// only the <owner> tag has data content
|
||||
if ($this->collect_owner) {
|
||||
$this->owner .= $data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* tag end handler
|
||||
*
|
||||
* @param resource parser
|
||||
* @param string tag name
|
||||
* @return void
|
||||
* @access private
|
||||
*/
|
||||
function _endElement($parser, $name)
|
||||
{
|
||||
// namespace handling
|
||||
if (strstr($name, " ")) {
|
||||
list($ns, $tag) = explode(" ", $name);
|
||||
} else {
|
||||
$ns = "";
|
||||
$tag = $name;
|
||||
}
|
||||
|
||||
// <owner> finished?
|
||||
if (($ns == "DAV:") && ($tag == "owner")) {
|
||||
$this->collect_owner = false;
|
||||
}
|
||||
|
||||
// within <owner> we have to collect everything
|
||||
if ($this->collect_owner) {
|
||||
$ns_short = "";
|
||||
$ns_attr = "";
|
||||
if ($ns) {
|
||||
if ($ns == "DAV:") {
|
||||
$ns_short = "D:";
|
||||
} else {
|
||||
$ns_attr = " xmlns='$ns'";
|
||||
}
|
||||
}
|
||||
$this->owner .= "</$ns_short$tag$ns_attr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,178 +0,0 @@
|
||||
<?php
|
||||
//
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP Version 4 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1997-2003 The PHP Group |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to version 2.02 of the PHP license, |
|
||||
// | that is bundled with this package in the file LICENSE, and is |
|
||||
// | available at through the world-wide-web at |
|
||||
// | http://www.php.net/license/2_02.txt. |
|
||||
// | If you did not receive a copy of the PHP license and are unable to |
|
||||
// | obtain it through the world-wide-web, please send a note to |
|
||||
// | license@php.net so we can mail you a copy immediately. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Authors: Hartmut Holzgraefe <hholzgra@php.net> |
|
||||
// | Christian Stocker <chregu@bitflux.ch> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id: _parse_propfind.php,v 1.2 2004/01/05 12:33:22 hholzgra Exp $
|
||||
//
|
||||
|
||||
/**
|
||||
* helper class for parsing PROPFIND request bodies
|
||||
*
|
||||
* @package HTTP_WebDAV_Server
|
||||
* @author Hartmut Holzgraefe <hholzgra@php.net>
|
||||
* @version 0.99.1dev
|
||||
*/
|
||||
class _parse_propfind
|
||||
{
|
||||
/**
|
||||
* success state flag
|
||||
*
|
||||
* @var bool
|
||||
* @access public
|
||||
*/
|
||||
var $success = false;
|
||||
|
||||
/**
|
||||
* found properties are collected here
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $props = false;
|
||||
|
||||
/**
|
||||
* internal tag nesting depth counter
|
||||
*
|
||||
* @var int
|
||||
* @access private
|
||||
*/
|
||||
var $depth = 0;
|
||||
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function _parse_propfind($path)
|
||||
{
|
||||
// success state flag
|
||||
$this->success = true;
|
||||
|
||||
// property storage array
|
||||
$this->props = array();
|
||||
|
||||
// internal tag depth counter
|
||||
$this->depth = 0;
|
||||
|
||||
// remember if any input was parsed
|
||||
$had_input = false;
|
||||
|
||||
// open input stream
|
||||
$f_in = fopen($path, "r");
|
||||
if (!$f_in) {
|
||||
$this->success = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// create XML parser
|
||||
$xml_parser = xml_parser_create_ns("UTF-8", " ");
|
||||
|
||||
// set tag and data handlers
|
||||
xml_set_element_handler($xml_parser,
|
||||
array(&$this, "_startElement"),
|
||||
array(&$this, "_endElement"));
|
||||
|
||||
// we want a case sensitive parser
|
||||
xml_parser_set_option($xml_parser,
|
||||
XML_OPTION_CASE_FOLDING, false);
|
||||
|
||||
|
||||
// parse input
|
||||
while($this->success && !feof($f_in)) {
|
||||
$line = fgets($f_in);
|
||||
if (is_string($line)) {
|
||||
$had_input = true;
|
||||
$this->success &= xml_parse($xml_parser, $line, false);
|
||||
}
|
||||
}
|
||||
|
||||
// finish parsing
|
||||
if($had_input) {
|
||||
$this->success &= xml_parse($xml_parser, "", true);
|
||||
}
|
||||
|
||||
// free parser
|
||||
xml_parser_free($xml_parser);
|
||||
|
||||
// close input stream
|
||||
fclose($f_in);
|
||||
|
||||
// if no input was parsed it was a request
|
||||
if(!count($this->props)) $this->props = "all"; // default
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* start tag handler
|
||||
*
|
||||
* @access private
|
||||
* @param resource parser
|
||||
* @param string tag name
|
||||
* @param array tag attributes
|
||||
*/
|
||||
function _startElement($parser, $name, $attrs)
|
||||
{
|
||||
// name space handling
|
||||
if (strstr($name, " ")) {
|
||||
list($ns, $tag) = explode(" ", $name);
|
||||
if ($ns == "")
|
||||
$this->success = false;
|
||||
} else {
|
||||
$ns = "";
|
||||
$tag = $name;
|
||||
}
|
||||
|
||||
// special tags at level 1: <allprop> and <propname>
|
||||
if ($this->depth == 1) {
|
||||
if ($tag == "allprop")
|
||||
$this->props = "all";
|
||||
|
||||
if ($tag == "propname")
|
||||
$this->props = "names";
|
||||
}
|
||||
|
||||
// requested properties are found at level 2
|
||||
if ($this->depth == 2) {
|
||||
$prop = array("name" => $tag);
|
||||
if ($ns)
|
||||
$prop["xmlns"] = $ns;
|
||||
$this->props[] = $prop;
|
||||
}
|
||||
|
||||
// increment depth count
|
||||
$this->depth++;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* end tag handler
|
||||
*
|
||||
* @access private
|
||||
* @param resource parser
|
||||
* @param string tag name
|
||||
*/
|
||||
function _endElement($parser, $name)
|
||||
{
|
||||
// here we only need to decrement the depth count
|
||||
$this->depth--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,214 +0,0 @@
|
||||
<?php
|
||||
//
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP Version 4 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1997-2003 The PHP Group |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to version 2.02 of the PHP license, |
|
||||
// | that is bundled with this package in the file LICENSE, and is |
|
||||
// | available at through the world-wide-web at |
|
||||
// | http://www.php.net/license/2_02.txt. |
|
||||
// | If you did not receive a copy of the PHP license and are unable to |
|
||||
// | obtain it through the world-wide-web, please send a note to |
|
||||
// | license@php.net so we can mail you a copy immediately. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Authors: Hartmut Holzgraefe <hholzgra@php.net> |
|
||||
// | Christian Stocker <chregu@bitflux.ch> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id: _parse_proppatch.php,v 1.3 2004/01/05 12:41:34 hholzgra Exp $
|
||||
//
|
||||
|
||||
/**
|
||||
* helper class for parsing PROPPATCH request bodies
|
||||
*
|
||||
* @package HTTP_WebDAV_Server
|
||||
* @author Hartmut Holzgraefe <hholzgra@php.net>
|
||||
* @version 0.99.1dev
|
||||
*/
|
||||
class _parse_proppatch
|
||||
{
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @var
|
||||
* @access
|
||||
*/
|
||||
var $success;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @var
|
||||
* @access
|
||||
*/
|
||||
var $props;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @var
|
||||
* @access
|
||||
*/
|
||||
var $depth;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @var
|
||||
* @access
|
||||
*/
|
||||
var $mode;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @var
|
||||
* @access
|
||||
*/
|
||||
var $current;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
* @param string path of input stream
|
||||
* @access public
|
||||
*/
|
||||
function _parse_proppatch($path)
|
||||
{
|
||||
$this->success = true;
|
||||
|
||||
$this->depth = 0;
|
||||
$this->props = array();
|
||||
$had_input = false;
|
||||
|
||||
$f_in = fopen($path, "r");
|
||||
if (!$f_in) {
|
||||
$this->success = false;
|
||||
return;
|
||||
}
|
||||
|
||||
$xml_parser = xml_parser_create_ns("UTF-8", " ");
|
||||
|
||||
xml_set_element_handler($xml_parser,
|
||||
array(&$this, "_startElement"),
|
||||
array(&$this, "_endElement"));
|
||||
|
||||
xml_set_character_data_handler($xml_parser,
|
||||
array(&$this, "_data"));
|
||||
|
||||
xml_parser_set_option($xml_parser,
|
||||
XML_OPTION_CASE_FOLDING, false);
|
||||
|
||||
while($this->success && !feof($f_in)) {
|
||||
$line = fgets($f_in);
|
||||
if (is_string($line)) {
|
||||
$had_input = true;
|
||||
$this->success &= xml_parse($xml_parser, $line, false);
|
||||
}
|
||||
}
|
||||
|
||||
if($had_input) {
|
||||
$this->success &= xml_parse($xml_parser, "", true);
|
||||
}
|
||||
|
||||
xml_parser_free($xml_parser);
|
||||
|
||||
fclose($f_in);
|
||||
}
|
||||
|
||||
/**
|
||||
* tag start handler
|
||||
*
|
||||
* @param resource parser
|
||||
* @param string tag name
|
||||
* @param array tag attributes
|
||||
* @return void
|
||||
* @access private
|
||||
*/
|
||||
function _startElement($parser, $name, $attrs)
|
||||
{
|
||||
if (strstr($name, " ")) {
|
||||
list($ns, $tag) = explode(" ", $name);
|
||||
if ($ns == "")
|
||||
$this->success = false;
|
||||
} else {
|
||||
$ns = "";
|
||||
$tag = $name;
|
||||
}
|
||||
|
||||
if ($this->depth == 1) {
|
||||
$this->mode = $tag;
|
||||
}
|
||||
|
||||
if ($this->depth == 3) {
|
||||
$prop = array("name" => $tag);
|
||||
$this->current = array("name" => $tag, "ns" => $ns, "status"=> 200);
|
||||
if ($this->mode == "set") {
|
||||
$this->current["val"] = ""; // default set val
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->depth >= 4) {
|
||||
$this->current["val"] .= "<$tag";
|
||||
foreach ($attr as $key => $val) {
|
||||
$this->current["val"] .= ' '.$key.'="'.str_replace('"','"', $val).'"';
|
||||
}
|
||||
$this->current["val"] .= ">";
|
||||
}
|
||||
|
||||
|
||||
|
||||
$this->depth++;
|
||||
}
|
||||
|
||||
/**
|
||||
* tag end handler
|
||||
*
|
||||
* @param resource parser
|
||||
* @param string tag name
|
||||
* @return void
|
||||
* @access private
|
||||
*/
|
||||
function _endElement($parser, $name)
|
||||
{
|
||||
if (strstr($name, " ")) {
|
||||
list($ns, $tag) = explode(" ", $name);
|
||||
if ($ns == "")
|
||||
$this->success = false;
|
||||
} else {
|
||||
$ns = "";
|
||||
$tag = $name;
|
||||
}
|
||||
|
||||
$this->depth--;
|
||||
|
||||
if ($this->depth >= 4) {
|
||||
$this->current["val"] .= "</$tag>";
|
||||
}
|
||||
|
||||
if ($this->depth == 3) {
|
||||
if (isset($this->current)) {
|
||||
$this->props[] = $this->current;
|
||||
unset($this->current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* input data handler
|
||||
*
|
||||
* @param resource parser
|
||||
* @param string data
|
||||
* @return void
|
||||
* @access private
|
||||
*/
|
||||
function _data($parser, $data) {
|
||||
if (isset($this->current)) {
|
||||
$this->current["val"] .= $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
239
thirdparty/pear/Log/sqlite.php
vendored
239
thirdparty/pear/Log/sqlite.php
vendored
@@ -1,239 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* $Header: /repository/pear/Log/Log/sqlite.php,v 1.5 2005/12/05 05:38:31 jon Exp $
|
||||
*
|
||||
* @version $Revision: 1.5 $
|
||||
* @package Log
|
||||
*/
|
||||
|
||||
/**
|
||||
* The Log_sqlite class is a concrete implementation of the Log::
|
||||
* abstract class which sends messages to an Sqlite database.
|
||||
* Each entry occupies a separate row in the database.
|
||||
*
|
||||
* This implementation uses PHP native Sqlite functions.
|
||||
*
|
||||
* CREATE TABLE log_table (
|
||||
* id INTEGER PRIMARY KEY NOT NULL,
|
||||
* logtime NOT NULL,
|
||||
* ident CHAR(16) NOT NULL,
|
||||
* priority INT NOT NULL,
|
||||
* message
|
||||
* );
|
||||
*
|
||||
* @author Bertrand Mansion <bmansion@mamasam.com>
|
||||
* @author Jon Parise <jon@php.net>
|
||||
* @since Log 1.8.3
|
||||
* @package Log
|
||||
*
|
||||
* @example sqlite.php Using the Sqlite handler.
|
||||
*/
|
||||
class Log_sqlite extends Log
|
||||
{
|
||||
/**
|
||||
* Array containing the connection defaults
|
||||
* @var array
|
||||
* @access private
|
||||
*/
|
||||
var $_options = array('mode' => 0666,
|
||||
'persistent' => false);
|
||||
|
||||
/**
|
||||
* Object holding the database handle.
|
||||
* @var object
|
||||
* @access private
|
||||
*/
|
||||
var $_db = null;
|
||||
|
||||
/**
|
||||
* Flag indicating that we're using an existing database connection.
|
||||
* @var boolean
|
||||
* @access private
|
||||
*/
|
||||
var $_existingConnection = false;
|
||||
|
||||
/**
|
||||
* String holding the database table to use.
|
||||
* @var string
|
||||
* @access private
|
||||
*/
|
||||
var $_table = 'log_table';
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new sql logging object.
|
||||
*
|
||||
* @param string $name The target SQL table.
|
||||
* @param string $ident The identification field.
|
||||
* @param mixed $conf Can be an array of configuration options used
|
||||
* to open a new database connection
|
||||
* or an already opened sqlite connection.
|
||||
* @param int $level Log messages up to and including this level.
|
||||
* @access public
|
||||
*/
|
||||
function Log_sqlite($name, $ident = '', &$conf, $level = PEAR_LOG_DEBUG)
|
||||
{
|
||||
$this->_id = $this->encryptOld(microtime());
|
||||
$this->_table = $name;
|
||||
$this->_ident = $ident;
|
||||
$this->_mask = Log::UPTO($level);
|
||||
|
||||
if (is_array($conf)) {
|
||||
foreach ($conf as $k => $opt) {
|
||||
$this->_options[$k] = $opt;
|
||||
}
|
||||
} else {
|
||||
// If an existing database connection was provided, use it.
|
||||
$this->_db =& $conf;
|
||||
$this->_existingConnection = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a connection to the database, if it has not already
|
||||
* been opened. This is implicitly called by log(), if necessary.
|
||||
*
|
||||
* @return boolean True on success, false on failure.
|
||||
* @access public
|
||||
*/
|
||||
function open()
|
||||
{
|
||||
if (is_resource($this->_db)) {
|
||||
$this->_opened = true;
|
||||
return $this->_createTable();
|
||||
} else {
|
||||
/* Set the connection function based on the 'persistent' option. */
|
||||
if (empty($this->_options['persistent'])) {
|
||||
$connectFunction = 'sqlite_open';
|
||||
} else {
|
||||
$connectFunction = 'sqlite_popen';
|
||||
}
|
||||
|
||||
/* Attempt to connect to the database. */
|
||||
if ($this->_db = $connectFunction($this->_options['filename'],
|
||||
(int)$this->_options['mode'],
|
||||
$error)) {
|
||||
$this->_opened = true;
|
||||
return $this->_createTable();
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_opened;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the connection to the database if it is still open and we were
|
||||
* the ones that opened it. It is the caller's responsible to close an
|
||||
* existing connection that was passed to us via $conf['db'].
|
||||
*
|
||||
* @return boolean True on success, false on failure.
|
||||
* @access public
|
||||
*/
|
||||
function close()
|
||||
{
|
||||
/* We never close existing connections. */
|
||||
if ($this->_existingConnection) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->_opened) {
|
||||
$this->_opened = false;
|
||||
sqlite_close($this->_db);
|
||||
}
|
||||
|
||||
return ($this->_opened === false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts $message to the currently open database. Calls open(),
|
||||
* if necessary. Also passes the message along to any Log_observer
|
||||
* instances that are observing this Log.
|
||||
*
|
||||
* @param mixed $message String or object containing the message to log.
|
||||
* @param string $priority The priority of the message. Valid
|
||||
* values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT,
|
||||
* PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING,
|
||||
* PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.
|
||||
* @return boolean True on success or false on failure.
|
||||
* @access public
|
||||
*/
|
||||
function log($message, $priority = null)
|
||||
{
|
||||
/* If a priority hasn't been specified, use the default value. */
|
||||
if ($priority === null) {
|
||||
$priority = $this->_priority;
|
||||
}
|
||||
|
||||
/* Abort early if the priority is above the maximum logging level. */
|
||||
if (!$this->_isMasked($priority)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* If the connection isn't open and can't be opened, return failure. */
|
||||
if (!$this->_opened && !$this->open()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Extract the string representation of the message.
|
||||
$message = $this->_extractMessage($message);
|
||||
|
||||
// Build the SQL query for this log entry insertion.
|
||||
$q = sprintf('INSERT INTO [%s] (logtime, ident, priority, message) ' .
|
||||
"VALUES ('%s', '%s', %d, '%s')",
|
||||
$this->_table,
|
||||
strftime('%Y-%m-%d %H:%M:%S', time()),
|
||||
sqlite_escape_string($this->_ident),
|
||||
$priority,
|
||||
sqlite_escape_string($message));
|
||||
if (!($res = @sqlite_unbuffered_query($this->_db, $q))) {
|
||||
return false;
|
||||
}
|
||||
$this->_announce(array('priority' => $priority, 'message' => $message));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the log table exists and creates it if necessary.
|
||||
*
|
||||
* @return boolean True on success or false on failure.
|
||||
* @access private
|
||||
*/
|
||||
function _createTable()
|
||||
{
|
||||
$q = "SELECT name FROM sqlite_master WHERE name='" . $this->_table .
|
||||
"' AND type='table'";
|
||||
|
||||
$res = sqlite_query($this->_db, $q);
|
||||
|
||||
if (sqlite_num_rows($res) == 0) {
|
||||
$q = 'CREATE TABLE [' . $this->_table . '] (' .
|
||||
'id INTEGER PRIMARY KEY NOT NULL, ' .
|
||||
'logtime NOT NULL, ' .
|
||||
'ident CHAR(16) NOT NULL, ' .
|
||||
'priority INT NOT NULL, ' .
|
||||
'message)';
|
||||
|
||||
if (!($res = sqlite_unbuffered_query($this->_db, $q))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function encryptOld($string)
|
||||
{
|
||||
if (!class_exists('G')) {
|
||||
$realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
|
||||
$docuroot = explode( '/', $realdocuroot );
|
||||
array_pop( $docuroot );
|
||||
$pathhome = implode( '/', $docuroot ) . '/';
|
||||
array_pop( $docuroot );
|
||||
$pathTrunk = implode( '/', $docuroot ) . '/';
|
||||
require_once($pathTrunk.'gulliver/system/class.g.php');
|
||||
}
|
||||
return G::encryptOld($string);
|
||||
}
|
||||
|
||||
}
|
||||
80
thirdparty/pear/Net/CheckIP.php
vendored
80
thirdparty/pear/Net/CheckIP.php
vendored
@@ -1,80 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (c) 2002-2006 Martin Jansen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* $Id: CheckIP.php,v 1.8 2006/12/15 17:42:26 mj Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class to validate the syntax of IPv4 adresses
|
||||
*
|
||||
* Usage:
|
||||
* <?php
|
||||
* require_once "Net/CheckIP.php";
|
||||
*
|
||||
* if (Net_CheckIP::check_ip("your_ip_goes_here")) {
|
||||
* // Syntax of the IP is ok
|
||||
* }
|
||||
* ?>
|
||||
*
|
||||
* @author Martin Jansen <mj@php.net>
|
||||
* @author Guido Haeger <gh-lists@ecora.de>
|
||||
* @package Net_CheckIP
|
||||
* @version 1.1
|
||||
* @access public
|
||||
*/
|
||||
class Net_CheckIP
|
||||
{
|
||||
|
||||
/**
|
||||
* Validate the syntax of the given IP adress
|
||||
*
|
||||
* This function splits the IP address in 4 pieces
|
||||
* (separated by ".") and checks for each piece
|
||||
* if it's an integer value between 0 and 255.
|
||||
* If all 4 parameters pass this test, the function
|
||||
* returns true.
|
||||
*
|
||||
* @param string $ip IP adress
|
||||
* @return bool true if syntax is valid, otherwise false
|
||||
*/
|
||||
function check_ip($ip)
|
||||
{
|
||||
$oct = explode('.', $ip);
|
||||
if (count($oct) != 4) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for ($i = 0; $i < 4; $i++) {
|
||||
if (!preg_match("/^[0-9]+$/", $oct[$i])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($oct[$i] < 0 || $oct[$i] > 255) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
?>
|
||||
876
thirdparty/pear/Net/Curl.php
vendored
876
thirdparty/pear/Net/Curl.php
vendored
File diff suppressed because it is too large
Load Diff
647
thirdparty/pear/Net/DIME.php
vendored
647
thirdparty/pear/Net/DIME.php
vendored
File diff suppressed because it is too large
Load Diff
2346
thirdparty/pear/Net/FTP.php
vendored
2346
thirdparty/pear/Net/FTP.php
vendored
File diff suppressed because it is too large
Load Diff
116
thirdparty/pear/Net/FTP/Observer.php
vendored
116
thirdparty/pear/Net/FTP/Observer.php
vendored
@@ -1,116 +0,0 @@
|
||||
<?php
|
||||
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
|
||||
|
||||
/**
|
||||
* Net_FTP observer.
|
||||
*
|
||||
* This class implements the Observer part of a Subject-Observer
|
||||
* design pattern. It listens to the events sent by a Net_FTP instance.
|
||||
* This module had many influences from the Log_observer code.
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* LICENSE: This source file is subject to version 3.0 of the PHP license
|
||||
* that is available through the world-wide-web at the following URI:
|
||||
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
|
||||
* the PHP License and are unable to obtain it through the web, please
|
||||
* send a note to license@php.net so we can mail you a copy immediately.
|
||||
*
|
||||
* @category Networking
|
||||
* @package FTP
|
||||
* @author Tobias Schlitt <toby@php.net>
|
||||
* @author Laurent Laville <pear@laurent-laville.org>
|
||||
* @author Chuck Hagenbuch <chuck@horde.org>
|
||||
* @copyright 1997-2008 The PHP Group
|
||||
* @license http://www.php.net/license/3_0.txt PHP License 3.0
|
||||
* @version CVS: $Id: Observer.php,v 1.4.2.1 2008/01/07 14:21:22 jschippers Exp $
|
||||
* @link http://pear.php.net/package/Net_FTP
|
||||
* @since File available since Release 0.0.1
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class implements the Observer part of a Subject-Observer
|
||||
* design pattern. It listens to the events sent by a Net_FTP instance.
|
||||
* This module had many influences from the Log_observer code.
|
||||
*
|
||||
* @category Networking
|
||||
* @package FTP
|
||||
* @author Laurent Laville <pear@laurent-laville.org>
|
||||
* @author Chuck Hagenbuch <chuck@horde.org>
|
||||
* @author Tobias Schlitt <toby@php.net>
|
||||
* @copyright 1997-2008 The PHP Group
|
||||
* @license http://www.php.net/license/3_0.txt PHP License 3.0
|
||||
* @version Release: 1.3.7
|
||||
* @link http://pear.php.net/package/Net_FTP
|
||||
* @since 1.3.0.0
|
||||
* @access public
|
||||
*
|
||||
* @example observer_upload.php An example of Net_FTP_Observer implementation.
|
||||
*/
|
||||
class Net_FTP_Observer
|
||||
{
|
||||
/**
|
||||
* Instance-specific unique identification number.
|
||||
*
|
||||
* @var integer
|
||||
* @since 1.3.0
|
||||
* @access private
|
||||
*/
|
||||
var $_id;
|
||||
|
||||
/**
|
||||
* Creates a new basic Net_FTP_Observer instance.
|
||||
*
|
||||
* @since 1.3.0
|
||||
* @access public
|
||||
*/
|
||||
function Net_FTP_Observer()
|
||||
{
|
||||
$this->_id = $this->encryptOld(microtime());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the listener's identifier
|
||||
*
|
||||
* @return string The listener's identifier
|
||||
* @since 1.3.0
|
||||
* @access public
|
||||
*/
|
||||
function getId()
|
||||
{
|
||||
return $this->_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a stub method to make sure that Net_FTP_Observer classes do
|
||||
* something when they are notified of a message. The default behavior
|
||||
* is to just do nothing.
|
||||
* You should override this method.
|
||||
*
|
||||
* @param mixed $event A hash describing the net event.
|
||||
*
|
||||
* @since 1.3.0
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function notify($event)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public function encryptOld($string)
|
||||
{
|
||||
if (!class_exists('G')) {
|
||||
$realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
|
||||
$docuroot = explode( '/', $realdocuroot );
|
||||
array_pop( $docuroot );
|
||||
$pathhome = implode( '/', $docuroot ) . '/';
|
||||
array_pop( $docuroot );
|
||||
$pathTrunk = implode( '/', $docuroot ) . '/';
|
||||
require_once($pathTrunk.'gulliver/system/class.g.php');
|
||||
}
|
||||
return G::encryptOld($string);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user