diff --git a/.gitignore b/.gitignore index 71e3ec1baf9d4681b33d959119899643f13990fd..9cfb7a5861ed3f2487506b4714fbcf1fba17d262 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,5 @@ _darcs/* CVS/* .svn/* RCS/* +.kdev +*.kdev4 diff --git a/inc/COPYING-PHP b/3dparty/COPYING-PHP similarity index 100% rename from inc/COPYING-PHP rename to 3dparty/COPYING-PHP diff --git a/inc/COPYING-README b/3dparty/COPYING-README similarity index 100% rename from inc/COPYING-README rename to 3dparty/COPYING-README diff --git a/inc/Console/Getopt.php b/3dparty/Console/Getopt.php similarity index 99% rename from inc/Console/Getopt.php rename to 3dparty/Console/Getopt.php index 6f2f9c730791b66c8c4174aa20b65120a2a3ad75..aec980b34d571e1ff1a28a6ce7b0aabefb42e1a1 100644 --- a/inc/Console/Getopt.php +++ b/3dparty/Console/Getopt.php @@ -18,7 +18,7 @@ // // $Id: Getopt.php,v 1.21.4.7 2003/12/05 21:57:01 andrei Exp $ -oc_require_once( 'PEAR.php'); +require_once( 'PEAR.php'); /** * Command-line options parsing class. diff --git a/inc/HTTP/WebDAV/Server.php b/3dparty/HTTP/WebDAV/Server.php similarity index 99% rename from inc/HTTP/WebDAV/Server.php rename to 3dparty/HTTP/WebDAV/Server.php index c407d74c89f9310c85807b78bd31d99d6877baff..ceed7214e9314300921b6cd1fd5cb30507639e25 100644 --- a/inc/HTTP/WebDAV/Server.php +++ b/3dparty/HTTP/WebDAV/Server.php @@ -33,9 +33,9 @@ +----------------------------------------------------------------------+ */ -oc_require_once("HTTP/WebDAV/Tools/_parse_propfind.php"); -oc_require_once("HTTP/WebDAV/Tools/_parse_proppatch.php"); -oc_require_once("HTTP/WebDAV/Tools/_parse_lockinfo.php"); +require_once("HTTP/WebDAV/Tools/_parse_propfind.php"); +require_once("HTTP/WebDAV/Tools/_parse_proppatch.php"); +require_once("HTTP/WebDAV/Tools/_parse_lockinfo.php"); /** diff --git a/inc/HTTP/WebDAV/Tools/_parse_lockinfo.php b/3dparty/HTTP/WebDAV/Tools/_parse_lockinfo.php similarity index 100% rename from inc/HTTP/WebDAV/Tools/_parse_lockinfo.php rename to 3dparty/HTTP/WebDAV/Tools/_parse_lockinfo.php diff --git a/inc/HTTP/WebDAV/Tools/_parse_propfind.php b/3dparty/HTTP/WebDAV/Tools/_parse_propfind.php similarity index 100% rename from inc/HTTP/WebDAV/Tools/_parse_propfind.php rename to 3dparty/HTTP/WebDAV/Tools/_parse_propfind.php diff --git a/inc/HTTP/WebDAV/Tools/_parse_proppatch.php b/3dparty/HTTP/WebDAV/Tools/_parse_proppatch.php similarity index 100% rename from inc/HTTP/WebDAV/Tools/_parse_proppatch.php rename to 3dparty/HTTP/WebDAV/Tools/_parse_proppatch.php diff --git a/inc/MDB2.php b/3dparty/MDB2.php similarity index 96% rename from inc/MDB2.php rename to 3dparty/MDB2.php index faf405b4112117ba2ff97dea5eb2eb1096b473d6..30e564f14577965b150254516b9377f7db3343e3 100644 --- a/inc/MDB2.php +++ b/3dparty/MDB2.php @@ -52,7 +52,7 @@ * @author Lukas Smith <smith@pooteeweet.org> */ -oc_require_once('PEAR.php'); +require_once('PEAR.php'); // {{{ Error constants @@ -279,7 +279,7 @@ class MDB2 * * @access public */ - function setOptions(&$db, $options) + static function setOptions(&$db, $options) { if (is_array($options)) { foreach ($options as $option => $value) { @@ -304,7 +304,7 @@ class MDB2 * @static * @access public */ - function classExists($classname) + static function classExists($classname) { if (version_compare(phpversion(), "5.0", ">=")) { return class_exists($classname, false); @@ -325,14 +325,14 @@ class MDB2 * * @access public */ - function loadClass($class_name, $debug) + static function loadClass($class_name, $debug) { if (!MDB2::classExists($class_name)) { $file_name = str_replace('_', DIRECTORY_SEPARATOR, $class_name).'.php'; if ($debug) { - $include = oc_include_once($file_name); + $include = include_once($file_name); } else { - $include = oc_include_once($file_name); + $include = include_once($file_name); } if (!$include) { if (!MDB2::fileExists($file_name)) { @@ -340,7 +340,7 @@ class MDB2 } else { $msg = "unable to load class '$class_name' from file '$file_name'"; } - $err =& MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null, $msg); + $err =MDB2::raiseErrorStatic(MDB2_ERROR_NOT_FOUND, null, null, $msg); return $err; } } @@ -374,11 +374,11 @@ class MDB2 * * @access public */ - function &factory($dsn, $options = false) + static function factory($dsn, $options = false) { $dsninfo = MDB2::parseDSN($dsn); if (empty($dsninfo['phptype'])) { - $err =& MDB2::raiseError(MDB2_ERROR_NOT_FOUND, + $err =MDB2::raiseErrorStatic(MDB2_ERROR_NOT_FOUND, null, null, 'no RDBMS driver specified'); return $err; } @@ -390,7 +390,7 @@ class MDB2 return $err; } - $db =& new $class_name(); + $db =new $class_name(); $db->setDSN($dsninfo); $err = MDB2::setOptions($db, $options); if (PEAR::isError($err)) { @@ -433,7 +433,7 @@ class MDB2 */ function &connect($dsn, $options = false) { - $db =& MDB2::factory($dsn, $options); + $db =MDB2::factory($dsn, $options); if (PEAR::isError($db)) { return $db; } @@ -497,10 +497,10 @@ class MDB2 } } } elseif (is_array($GLOBALS['_MDB2_databases']) && reset($GLOBALS['_MDB2_databases'])) { - $db =& $GLOBALS['_MDB2_databases'][key($GLOBALS['_MDB2_databases'])]; + $db =$GLOBALS['_MDB2_databases'][key($GLOBALS['_MDB2_databases'])]; return $db; } - $db =& MDB2::factory($dsn, $options); + $db =MDB2::factory($dsn, $options); return $db; } @@ -516,7 +516,7 @@ class MDB2 * @param array $arr2 * @return boolean */ - function areEquals($arr1, $arr2) + static function areEquals($arr1, $arr2) { if (count($arr1) != count($arr2)) { return false; @@ -545,11 +545,11 @@ class MDB2 { $file_name = 'MDB2'.DIRECTORY_SEPARATOR.$file.'.php'; if (!MDB2::fileExists($file_name)) { - return MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null, + return $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null, 'unable to find: '.$file_name); } if (!include_once($file_name)) { - return MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null, + return $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null, 'unable to load driver class: '.$file_name); } return $file_name; @@ -597,7 +597,7 @@ class MDB2 * @access private * @see PEAR_Error */ - function &raiseError($code = null, + function raiseError($code = null, $mode = null, $options = null, $userinfo = null, @@ -605,7 +605,19 @@ class MDB2 $dummy2 = null, $dummy3 = false) { - $err =& PEAR::raiseError(null, $code, $mode, $options, $userinfo, 'MDB2_Error', true); + $err =PEAR::raiseError(null, $code, $mode, $options, $userinfo, 'MDB2_Error', true); + return $err; + } + static function raiseErrorStatic($code = null, + $mode = null, + $options = null, + $userinfo = null, + $dummy1 = null, + $dummy2 = null, + $dummy3 = false) + { + $pear=new PEAR(); + $err =$pear->raiseError(null, $code, $mode, $options, $userinfo, 'MDB2_Error', true); return $err; } @@ -625,7 +637,7 @@ class MDB2 * * @access public */ - function isError($data, $code = null) + static function isError($data, $code = null) { if (is_a($data, 'MDB2_Error')) { if (is_null($code)) { @@ -652,7 +664,7 @@ class MDB2 * * @access public */ - function isConnection($value) + static function isConnection($value) { return is_a($value, 'MDB2_Driver_Common'); } @@ -669,7 +681,7 @@ class MDB2 * * @access public */ - function isResult($value) + static function isResult($value) { return is_a($value, 'MDB2_Result'); } @@ -686,7 +698,7 @@ class MDB2 * * @access public */ - function isResultCommon($value) + static function isResultCommon($value) { return is_a($value, 'MDB2_Result_Common'); } @@ -703,7 +715,7 @@ class MDB2 * * @access public */ - function isStatement($value) + static function isStatement($value) { return is_a($value, 'MDB2_Statement_Common'); } @@ -723,7 +735,7 @@ class MDB2 * * @access public */ - function errorMessage($value = null) + static function errorMessage($value = null) { static $errorMessages; @@ -824,7 +836,7 @@ class MDB2 * @access public * @author Tomas V.V.Cox <cox@idecnet.com> */ - function parseDSN($dsn) + static function parseDSN($dsn) { $parsed = $GLOBALS['_MDB2_dsninfo_default']; @@ -954,7 +966,7 @@ class MDB2 * * @access public */ - function fileExists($file) + static function fileExists($file) { // safe_mode does notwork with is_readable() global $SERVERROOT; @@ -1000,7 +1012,7 @@ class MDB2_Error extends PEAR_Error * * @param mixed MDB2 error code, or string with error message. * @param int what 'error mode' to operate in - * @param int what error level to use for $mode & PEAR_ERROR_TRIGGER + * @param int what error level to use for $mode raPEAR_ERROR_TRIGGER * @param mixed additional debug info, such as the last query */ function MDB2_Error($code = MDB2_ERROR, $mode = PEAR_ERROR_RETURN, @@ -1352,17 +1364,6 @@ class MDB2_Driver_Common extends PEAR $this->db_index = $db_index; } - // }}} - // {{{ function MDB2_Driver_Common() - - /** - * PHP 4 Constructor - */ - function MDB2_Driver_Common() - { - $this->destructor_registered = false; - $this->__construct(); - } // }}} // {{{ destructor: function __destruct() @@ -1457,7 +1458,7 @@ class MDB2_Driver_Common extends PEAR * @access public * @see PEAR_Error */ - function &raiseError($code = null, + function raiseError($code = null, $mode = null, $options = null, $userinfo = null, @@ -1493,15 +1494,16 @@ class MDB2_Driver_Common extends PEAR if (!is_null($native_msg) && $native_msg !== '') { $userinfo.= "[Native message: ". strip_tags($native_msg) ."]\n"; } + echo $userinfo; if (!is_null($method)) { $userinfo = $method.': '.$userinfo; } } - $err =& PEAR::raiseError(null, $code, $mode, $options, $userinfo, 'MDB2_Error', true); + $err = PEAR::raiseError(null, $code, $mode, $options, $userinfo, 'MDB2_Error', true); if ($err->getMode() !== PEAR_ERROR_RETURN && isset($this->nested_transaction_counter) && !$this->has_transaction_error) { - $this->has_transaction_error =& $err; + $this->has_transaction_error =$err; } return $err; } @@ -1938,12 +1940,12 @@ class MDB2_Driver_Common extends PEAR } if (!MDB2::classExists($class_name)) { - $err =& $this->raiseError(MDB2_ERROR_LOADMODULE, null, null, + $err =$this->raiseError(MDB2_ERROR_LOADMODULE, null, null, "unable to load module '$module' into property '$property'", __FUNCTION__); return $err; } $this->{$property} = new $class_name($this->db_index); - $this->modules[$module] =& $this->{$property}; + $this->modules[$module] =$this->{$property}; if ($version) { // this will be used in the connect method to determine if the module // needs to be loaded with a different version if the server @@ -2097,7 +2099,7 @@ class MDB2_Driver_Common extends PEAR * @access public * @since 2.1.1 */ - function setTransactionIsolation($isolation, $options = array()) + static function setTransactionIsolation($isolation, $options = array()) { $this->debug('Setting transaction isolation level', __FUNCTION__, array('is_manip' => true)); return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, @@ -2447,7 +2449,7 @@ class MDB2_Driver_Common extends PEAR return $connection; } - $result =& $this->_doQuery($query, $is_manip, $connection, false); + $result =$this->_doQuery($query, $is_manip, $connection, false); if (PEAR::isError($result)) { return $result; } @@ -2456,7 +2458,7 @@ class MDB2_Driver_Common extends PEAR $affected_rows = $this->_affectedRows($connection, $result); return $affected_rows; } - $result =& $this->_wrapResult($result, $types, true, false, $limit, $offset); + $result =$this->_wrapResult($result, $types, true, false, $limit, $offset); return $result; } @@ -2504,7 +2506,7 @@ class MDB2_Driver_Common extends PEAR } $query = $result; } - $err =& $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, + $err =$this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 'method not implemented', __FUNCTION__); return $err; } @@ -2552,7 +2554,7 @@ class MDB2_Driver_Common extends PEAR return $connection; } - $result =& $this->_doQuery($query, true, $connection, $this->database_name); + $result =$this->_doQuery($query, true, $connection, $this->database_name); if (PEAR::isError($result)) { return $result; } @@ -2589,12 +2591,12 @@ class MDB2_Driver_Common extends PEAR return $connection; } - $result =& $this->_doQuery($query, false, $connection, $this->database_name); + $result =$this->_doQuery($query, false, $connection, $this->database_name); if (PEAR::isError($result)) { return $result; } - $result =& $this->_wrapResult($result, $types, $result_class, $result_wrap_class, $limit, $offset); + $result =$this->_wrapResult($result, $types, $result_class, $result_wrap_class, $limit, $offset); return $result; } @@ -2643,13 +2645,13 @@ class MDB2_Driver_Common extends PEAR if ($result_class) { $class_name = sprintf($result_class, $this->phptype); if (!MDB2::classExists($class_name)) { - $err =& $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null, + $err =$this->raiseError(MDB2_ERROR_NOT_FOUND, null, null, 'result class does not exist '.$class_name, __FUNCTION__); return $err; } - $result =& new $class_name($this, $result, $limit, $offset); + $result =new $class_name($this, $result, $limit, $offset); if (!MDB2::isResultCommon($result)) { - $err =& $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null, + $err =$this->raiseError(MDB2_ERROR_NOT_FOUND, null, null, 'result class is not extended from MDB2_Result_Common', __FUNCTION__); return $err; } @@ -2666,7 +2668,7 @@ class MDB2_Driver_Common extends PEAR } if ($result_wrap_class) { if (!MDB2::classExists($result_wrap_class)) { - $err =& $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null, + $err =$this->raiseError(MDB2_ERROR_NOT_FOUND, null, null, 'result wrap class does not exist '.$result_wrap_class, __FUNCTION__); return $err; } @@ -2877,7 +2879,7 @@ class MDB2_Driver_Common extends PEAR $condition = ' WHERE '.implode(' AND ', $condition); $query = 'DELETE FROM ' . $this->quoteIdentifier($table, true) . $condition; - $result =& $this->_doQuery($query, true, $connection); + $result =$this->_doQuery($query, true, $connection); if (!PEAR::isError($result)) { $affected_rows = $this->_affectedRows($connection, $result); $insert = ''; @@ -2886,7 +2888,7 @@ class MDB2_Driver_Common extends PEAR } $values = implode(', ', $values); $query = 'INSERT INTO '. $this->quoteIdentifier($table, true) . "($insert) VALUES ($values)"; - $result =& $this->_doQuery($query, true, $connection); + $result =$this->_doQuery($query, true, $connection); if (!PEAR::isError($result)) { $affected_rows += $this->_affectedRows($connection, $result);; } @@ -2996,7 +2998,7 @@ class MDB2_Driver_Common extends PEAR $regexp = '/^.{'.($position+1).'}('.$this->options['bindname_format'].').*$/s'; $parameter = preg_replace($regexp, '\\1', $query); if ($parameter === '') { - $err =& $this->raiseError(MDB2_ERROR_SYNTAX, null, null, + $err =$this->raiseError(MDB2_ERROR_SYNTAX, null, null, 'named parameter name must match "bindname_format" option', __FUNCTION__); return $err; } @@ -3054,7 +3056,7 @@ class MDB2_Driver_Common extends PEAR if ($ignore['end'] === "\n") { $end_quote = strlen($query) - 1; } else { - $err =& $this->raiseError(MDB2_ERROR_SYNTAX, null, null, + $err =$this->raiseError(MDB2_ERROR_SYNTAX, null, null, 'query with an unterminated text string specified', __FUNCTION__); return $err; } @@ -3446,22 +3448,12 @@ class MDB2_Result_Common extends MDB2_Result */ function __construct(&$db, &$result, $limit = 0, $offset = 0) { - $this->db =& $db; - $this->result =& $result; + $this->db =$db; + $this->result =$result; $this->offset = $offset; $this->limit = max(0, $limit - 1); } - // }}} - // {{{ function MDB2_Result_Common(&$db, &$result, $limit = 0, $offset = 0) - - /** - * PHP 4 Constructor - */ - function MDB2_Result_Common(&$db, &$result, $limit = 0, $offset = 0) - { - $this->__construct($db, $result, $limit, $offset); - } // }}} // {{{ function setResultTypes($types) @@ -3541,7 +3533,7 @@ class MDB2_Result_Common extends MDB2_Result */ function &fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null) { - $err =& $this->db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, + $err =$this->db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 'method not implemented', __FUNCTION__); return $err; } @@ -3846,7 +3838,7 @@ class MDB2_Result_Common extends MDB2_Result } $column = $column_names[$column]; } - $this->values[$column] =& $value; + $this->values[$column] =$value; if (!is_null($type)) { $this->types[$column] = $type; } @@ -3920,21 +3912,6 @@ class MDB2_Row $this->$key = &$row[$key]; } } - - // }}} - // {{{ function MDB2_Row(&$row) - - /** - * PHP 4 Constructor - * - * @param resource row data as array - */ - function MDB2_Row(&$row) - { - $this->__construct($row); - } - - // }}} } // }}} @@ -3969,8 +3946,8 @@ class MDB2_Statement_Common */ function __construct(&$db, &$statement, $positions, $query, $types, $result_types, $is_manip = false, $limit = null, $offset = null) { - $this->db =& $db; - $this->statement =& $statement; + $this->db =$db; + $this->statement =$statement; $this->positions = $positions; $this->query = $query; $this->types = (array)$types; @@ -3980,16 +3957,6 @@ class MDB2_Statement_Common $this->offset = $offset; } - // }}} - // {{{ function MDB2_Statement_Common(&$db, &$statement, $positions, $query, $types, $result_types, $is_manip = false, $limit = null, $offset = null) - - /** - * PHP 4 Constructor - */ - function MDB2_Statement_Common(&$db, &$statement, $positions, $query, $types, $result_types, $is_manip = false, $limit = null, $offset = null) - { - $this->__construct($db, $statement, $positions, $query, $types, $result_types, $is_manip, $limit, $offset); - } // }}} // {{{ function bindValue($parameter, &$value, $type = null) @@ -4085,7 +4052,7 @@ class MDB2_Statement_Common return $this->db->raiseError(MDB2_ERROR_NOT_FOUND, null, null, 'Unable to bind to missing placeholder: '.$parameter, __FUNCTION__); } - $this->values[$parameter] =& $value; + $this->values[$parameter] =$value; if (!is_null($type)) { $this->types[$parameter] = $type; } @@ -4152,7 +4119,7 @@ class MDB2_Statement_Common 'Binding Values failed with message: ' . $err->getMessage(), __FUNCTION__); } } - $result =& $this->_execute($result_class, $result_wrap_class); + $result =$this->_execute($result_class, $result_wrap_class); return $result; } @@ -4200,7 +4167,7 @@ class MDB2_Statement_Common if ($this->is_manip) { $result = $this->db->exec($query); } else { - $result =& $this->db->query($query, $this->result_types, $result_class, $result_wrap_class); + $result =$this->db->query($query, $this->result_types, $result_class, $result_wrap_class); } return $result; } @@ -4272,17 +4239,6 @@ class MDB2_Module_Common $this->db_index = $db_index; } - // }}} - // {{{ function MDB2_Module_Common($db_index) - - /** - * PHP 4 Constructor - */ - function MDB2_Module_Common($db_index) - { - $this->__construct($db_index); - } - // }}} // {{{ function &getDBInstance() @@ -4293,12 +4249,12 @@ class MDB2_Module_Common * * @access public */ - function &getDBInstance() + function getDBInstance() { if (isset($GLOBALS['_MDB2_databases'][$this->db_index])) { - $result =& $GLOBALS['_MDB2_databases'][$this->db_index]; + $result =$GLOBALS['_MDB2_databases'][$this->db_index]; } else { - $result =& MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null, + $result =$this->raiseError(MDB2_ERROR_NOT_FOUND, null, null, 'could not find MDB2 instance'); } return $result; @@ -4358,4 +4314,4 @@ function MDB2_defaultDebugOutput(&$db, $scope, $message, $context = array()) } // }}} -?> \ No newline at end of file +?> diff --git a/inc/MDB2/Date.php b/3dparty/MDB2/Date.php similarity index 100% rename from inc/MDB2/Date.php rename to 3dparty/MDB2/Date.php diff --git a/inc/MDB2/Driver/Datatype/Common.php b/3dparty/MDB2/Driver/Datatype/Common.php similarity index 98% rename from inc/MDB2/Driver/Datatype/Common.php rename to 3dparty/MDB2/Driver/Datatype/Common.php index 750dbb2477282c333b530b53980c639e7846031f..85a74f64fca85f3d06ae56284f248eb27428ecae 100644 --- a/inc/MDB2/Driver/Datatype/Common.php +++ b/3dparty/MDB2/Driver/Datatype/Common.php @@ -44,7 +44,7 @@ // // $Id: Common.php,v 1.139 2008/12/04 11:50:42 afz Exp $ -oc_require_once('MDB2/LOB.php'); +require_once('MDB2/LOB.php'); /** * @package MDB2 @@ -100,7 +100,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common function getValidTypes() { $types = $this->valid_default_values; - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -145,7 +145,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common $types = is_array($types) ? $types : array($types); foreach ($types as $key => $type) { if (!isset($this->valid_default_values[$type])) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -209,7 +209,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common return fopen('MDB2LOB://'.$lob_index.'@'.$this->db_index, 'r+'); } - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -235,7 +235,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common if (is_null($value)) { return null; } - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -338,7 +338,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common */ function getDeclaration($type, $name, $field) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -387,7 +387,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common */ function getTypeDeclaration($field) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -453,7 +453,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common */ function _getDeclaration($name, $field) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -501,7 +501,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common $default = ''; if (array_key_exists('default', $field)) { if ($field['default'] === '') { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -583,7 +583,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common function _getIntegerDeclaration($name, $field) { if (!empty($field['unsigned'])) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -651,7 +651,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common */ function _getCLOBDeclaration($name, $field) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -687,7 +687,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common */ function _getBLOBDeclaration($name, $field) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -875,7 +875,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common $type = !empty($current['type']) ? $current['type'] : null; if (!method_exists($this, "_compare{$type}Definition")) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1114,7 +1114,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common */ function quote($value, $type = null, $quote = true, $escape_wildcards = false) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1218,7 +1218,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common return $value; } - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1254,7 +1254,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common } if (is_resource($value)) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1369,7 +1369,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common function _quoteDate($value, $quote, $escape_wildcards) { if ($value === 'CURRENT_DATE') { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1398,7 +1398,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common function _quoteTimestamp($value, $quote, $escape_wildcards) { if ($value === 'CURRENT_TIMESTAMP') { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1427,7 +1427,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common function _quoteTime($value, $quote, $escape_wildcards) { if ($value === 'CURRENT_TIME') { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1517,7 +1517,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common */ function writeLOBToFile($lob, $file) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1681,7 +1681,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common */ function matchPattern($pattern, $operator = null, $field = null) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1755,7 +1755,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common */ function mapNativeDatatype($field) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1784,7 +1784,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common */ function _mapNativeDatatype($field) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1805,7 +1805,7 @@ class MDB2_Driver_Datatype_Common extends MDB2_Module_Common */ function mapPrepareDatatype($type) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } diff --git a/inc/MDB2/Driver/Datatype/mysql.php b/3dparty/MDB2/Driver/Datatype/mysql.php similarity index 98% rename from inc/MDB2/Driver/Datatype/mysql.php rename to 3dparty/MDB2/Driver/Datatype/mysql.php index 944248f57c3edd84d855da92298199b79bd7e224..93dd40524e6795ac4f2ee1a5a152df0d9fb22f63 100644 --- a/inc/MDB2/Driver/Datatype/mysql.php +++ b/3dparty/MDB2/Driver/Datatype/mysql.php @@ -46,7 +46,7 @@ // $Id: mysql.php,v 1.65 2008/02/22 19:23:49 quipo Exp $ // -oc_require_once('MDB2/Driver/Datatype/Common.php'); +require_once('MDB2/Driver/Datatype/Common.php'); /** * MDB2 MySQL driver @@ -116,7 +116,7 @@ class MDB2_Driver_Datatype_mysql extends MDB2_Driver_Datatype_Common */ function getTypeDeclaration($field) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -219,7 +219,7 @@ class MDB2_Driver_Datatype_mysql extends MDB2_Driver_Datatype_Common */ function _getIntegerDeclaration($name, $field) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -308,7 +308,7 @@ class MDB2_Driver_Datatype_mysql extends MDB2_Driver_Datatype_Common */ function _getDecimalDeclaration($name, $field) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -346,7 +346,7 @@ class MDB2_Driver_Datatype_mysql extends MDB2_Driver_Datatype_Common */ function matchPattern($pattern, $operator = null, $field = null) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -531,7 +531,7 @@ class MDB2_Driver_Datatype_mysql extends MDB2_Driver_Datatype_Common $length = null; break; default: - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } diff --git a/inc/MDB2/Driver/Datatype/pgsql.php b/3dparty/MDB2/Driver/Datatype/pgsql.php similarity index 98% rename from inc/MDB2/Driver/Datatype/pgsql.php rename to 3dparty/MDB2/Driver/Datatype/pgsql.php index fe18729c84f349592fd14f86477de1de85cdaa65..e72aa743b738cc722dab21b2bc3c81d7470ef138 100644 --- a/inc/MDB2/Driver/Datatype/pgsql.php +++ b/3dparty/MDB2/Driver/Datatype/pgsql.php @@ -44,7 +44,7 @@ // // $Id: pgsql.php,v 1.93 2008/08/28 20:32:57 afz Exp $ -oc_require_once('MDB2/Driver/Datatype/Common.php'); +require_once('MDB2/Driver/Datatype/Common.php'); /** * MDB2 PostGreSQL driver @@ -117,7 +117,7 @@ class MDB2_Driver_Datatype_pgsql extends MDB2_Driver_Datatype_Common */ function getTypeDeclaration($field) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -198,7 +198,7 @@ class MDB2_Driver_Datatype_pgsql extends MDB2_Driver_Datatype_Common */ function _getIntegerDeclaration($name, $field) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -262,7 +262,7 @@ class MDB2_Driver_Datatype_pgsql extends MDB2_Driver_Datatype_Common return $value; } if (version_compare(PHP_VERSION, '5.2.0RC6', '>=')) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -317,7 +317,7 @@ class MDB2_Driver_Datatype_pgsql extends MDB2_Driver_Datatype_Common */ function matchPattern($pattern, $operator = null, $field = null) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -366,7 +366,7 @@ class MDB2_Driver_Datatype_pgsql extends MDB2_Driver_Datatype_Common */ function patternEscapeString() { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -492,7 +492,7 @@ class MDB2_Driver_Datatype_pgsql extends MDB2_Driver_Datatype_Common $length = null; break; default: - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -519,7 +519,7 @@ class MDB2_Driver_Datatype_pgsql extends MDB2_Driver_Datatype_Common */ function mapPrepareDatatype($type) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } diff --git a/inc/MDB2/Driver/Datatype/sqlite.php b/3dparty/MDB2/Driver/Datatype/sqlite.php similarity index 98% rename from inc/MDB2/Driver/Datatype/sqlite.php rename to 3dparty/MDB2/Driver/Datatype/sqlite.php index 533d0e9510b8e669fee667a7f6112ccacb897edd..9e57e7e56783eb99714274209e0d26f7e41203ed 100644 --- a/inc/MDB2/Driver/Datatype/sqlite.php +++ b/3dparty/MDB2/Driver/Datatype/sqlite.php @@ -46,7 +46,7 @@ // $Id: sqlite.php,v 1.67 2008/02/22 19:58:06 quipo Exp $ // -oc_require_once('MDB2/Driver/Datatype/Common.php'); +require_once('MDB2/Driver/Datatype/Common.php'); /** * MDB2 SQLite driver @@ -101,7 +101,7 @@ class MDB2_Driver_Datatype_sqlite extends MDB2_Driver_Datatype_Common */ function getTypeDeclaration($field) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -199,7 +199,7 @@ class MDB2_Driver_Datatype_sqlite extends MDB2_Driver_Datatype_Common */ function _getIntegerDeclaration($name, $field) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -237,7 +237,7 @@ class MDB2_Driver_Datatype_sqlite extends MDB2_Driver_Datatype_Common */ function matchPattern($pattern, $operator = null, $field = null) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -388,7 +388,7 @@ class MDB2_Driver_Datatype_sqlite extends MDB2_Driver_Datatype_Common $length = null; break; default: - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } diff --git a/inc/MDB2/Driver/Function/Common.php b/3dparty/MDB2/Driver/Function/Common.php similarity index 100% rename from inc/MDB2/Driver/Function/Common.php rename to 3dparty/MDB2/Driver/Function/Common.php diff --git a/inc/MDB2/Driver/Function/mysql.php b/3dparty/MDB2/Driver/Function/mysql.php similarity index 99% rename from inc/MDB2/Driver/Function/mysql.php rename to 3dparty/MDB2/Driver/Function/mysql.php index aff531c9f3a35d5dc94be44cadd71fb73457e968..44183c3aa0674baf7f7b50f2f246cb571335bb3f 100644 --- a/inc/MDB2/Driver/Function/mysql.php +++ b/3dparty/MDB2/Driver/Function/mysql.php @@ -45,7 +45,7 @@ // $Id: mysql.php,v 1.12 2008/02/17 18:54:08 quipo Exp $ // -oc_require_once('MDB2/Driver/Function/Common.php'); +require_once('MDB2/Driver/Function/Common.php'); /** * MDB2 MySQL driver for the function modules diff --git a/inc/MDB2/Driver/Function/pgsql.php b/3dparty/MDB2/Driver/Function/pgsql.php similarity index 99% rename from inc/MDB2/Driver/Function/pgsql.php rename to 3dparty/MDB2/Driver/Function/pgsql.php index cb47ea57d9fa5ef85e9208310be7b342de316cf0..173bfc9149473d57b3641d1ea134b5bc0f4eda68 100644 --- a/inc/MDB2/Driver/Function/pgsql.php +++ b/3dparty/MDB2/Driver/Function/pgsql.php @@ -44,7 +44,7 @@ // // $Id: pgsql.php,v 1.11 2008/11/09 19:46:50 quipo Exp $ -oc_require_once('MDB2/Driver/Function/Common.php'); +require_once('MDB2/Driver/Function/Common.php'); /** * MDB2 MySQL driver for the function modules diff --git a/inc/MDB2/Driver/Function/sqlite.php b/3dparty/MDB2/Driver/Function/sqlite.php similarity index 99% rename from inc/MDB2/Driver/Function/sqlite.php rename to 3dparty/MDB2/Driver/Function/sqlite.php index f5499599dd5d552999edcd1c6d988b793b4c3044..8a5b7ec8fad628c4cfc9cdbe61e57c9dd309c871 100644 --- a/inc/MDB2/Driver/Function/sqlite.php +++ b/3dparty/MDB2/Driver/Function/sqlite.php @@ -45,7 +45,7 @@ // $Id: sqlite.php,v 1.10 2008/02/17 18:54:08 quipo Exp $ // -oc_require_once('MDB2/Driver/Function/Common.php'); +require_once('MDB2/Driver/Function/Common.php'); /** * MDB2 SQLite driver for the function modules diff --git a/inc/MDB2/Driver/Manager/Common.php b/3dparty/MDB2/Driver/Manager/Common.php similarity index 96% rename from inc/MDB2/Driver/Manager/Common.php rename to 3dparty/MDB2/Driver/Manager/Common.php index d7154d4eac06cf8b3e04333d2348316191bae880..9e16749bffc49b12d2c7ec296f40da06562b7bad 100644 --- a/inc/MDB2/Driver/Manager/Common.php +++ b/3dparty/MDB2/Driver/Manager/Common.php @@ -108,7 +108,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common */ function getFieldDeclarationList($fields) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -140,7 +140,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common */ function _fixSequenceName($sqn, $check = false) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -168,7 +168,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common */ function _fixIndexName($idx) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -195,7 +195,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common */ function createDatabase($database, $options = array()) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -218,7 +218,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common */ function alterDatabase($database, $options = array()) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -239,7 +239,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common */ function dropDatabase($database) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -263,7 +263,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common */ function _getCreateTableQuery($name, $fields, $options = array()) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -356,7 +356,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common if (PEAR::isError($query)) { return $query; } - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -379,7 +379,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common */ function dropTable($name) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -401,7 +401,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common */ function truncateTable($name) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -429,7 +429,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common */ function vacuum($table = null, $options = array()) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -533,7 +533,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common */ function alterTable($name, $changes, $check) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -553,7 +553,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common */ function listDatabases() { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -573,7 +573,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common */ function listUsers() { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -596,7 +596,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common */ function listViews($database = null) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -617,7 +617,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common */ function listTableViews($table) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -638,7 +638,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common */ function listTableTriggers($table = null) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -658,7 +658,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common */ function listFunctions() { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -681,7 +681,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common */ function listTables($database = null) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -702,7 +702,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common */ function listTableFields($table) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -748,7 +748,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common */ function createIndex($table, $name, $definition) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -777,7 +777,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common */ function dropIndex($table, $name) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -798,7 +798,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common */ function listTableIndexes($table) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -867,7 +867,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common */ function createConstraint($table, $name, $definition) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -912,7 +912,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common */ function dropConstraint($table, $name, $primary = false) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -934,7 +934,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common */ function listTableConstraints($table) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -956,7 +956,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common */ function createSequence($seq_name, $start = 1) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -977,7 +977,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common */ function dropSequence($name) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1000,7 +1000,7 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common */ function listSequences($database = null) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } diff --git a/inc/MDB2/Driver/Manager/mysql.php b/3dparty/MDB2/Driver/Manager/mysql.php similarity index 98% rename from inc/MDB2/Driver/Manager/mysql.php rename to 3dparty/MDB2/Driver/Manager/mysql.php index 7bd6a3623a32e2ea0d9605f0ea1ce0b1de771fe6..099ed48a84ffbb939face2c8c77f064daa99b486 100644 --- a/inc/MDB2/Driver/Manager/mysql.php +++ b/3dparty/MDB2/Driver/Manager/mysql.php @@ -45,7 +45,7 @@ // $Id: mysql.php,v 1.113 2008/11/23 20:30:29 quipo Exp $ // -oc_require_once('MDB2/Driver/Manager/Common.php'); +require_once('MDB2/Driver/Manager/Common.php'); /** * MDB2 MySQL driver for the management modules @@ -71,7 +71,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function createDatabase($name, $options = array()) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -101,7 +101,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function alterDatabase($name, $options = array()) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -128,7 +128,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function dropDatabase($name) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -204,7 +204,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function createTable($name, $fields, $options = array()) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -285,7 +285,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function dropTable($name) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -321,7 +321,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function truncateTable($name) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -349,7 +349,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function vacuum($table = null, $options = array()) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -474,7 +474,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function alterTable($name, $changes, $check) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -575,7 +575,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function listDatabases() { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -601,7 +601,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function listUsers() { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -620,7 +620,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function listFunctions() { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -653,7 +653,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function listTableTriggers($table = null) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -685,7 +685,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function listTables($database = null) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -725,7 +725,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function listViews($database = null) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -759,7 +759,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function listTableFields($table) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -815,7 +815,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function createIndex($table, $name, $definition) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -848,7 +848,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function dropIndex($table, $name) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -870,7 +870,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function listTableIndexes($table) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -934,7 +934,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function createConstraint($table, $name, $definition) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1008,7 +1008,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function dropConstraint($table, $name, $primary = false) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1058,7 +1058,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function _createFKTriggers($table, $foreign_keys) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1198,7 +1198,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function _dropFKTriggers($table, $fkname, $referenced_table) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1232,7 +1232,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function listTableConstraints($table) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1307,7 +1307,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function createSequence($seq_name, $start = 1, $options = array()) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1380,7 +1380,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function dropSequence($seq_name) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1401,7 +1401,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common */ function listSequences($database = null) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } diff --git a/inc/MDB2/Driver/Manager/pgsql.php b/3dparty/MDB2/Driver/Manager/pgsql.php similarity index 99% rename from inc/MDB2/Driver/Manager/pgsql.php rename to 3dparty/MDB2/Driver/Manager/pgsql.php index 1a7e851897c0feae25eaafb5e02d995bafbbc388..490f697aa5be715a55bcecdad0f6207811f13d06 100644 --- a/inc/MDB2/Driver/Manager/pgsql.php +++ b/3dparty/MDB2/Driver/Manager/pgsql.php @@ -44,7 +44,7 @@ // // $Id: pgsql.php,v 1.87 2008/11/29 14:09:59 afz Exp $ -oc_require_once('MDB2/Driver/Manager/Common.php'); +require_once('MDB2/Driver/Manager/Common.php'); /** * MDB2 MySQL driver for the management modules diff --git a/inc/MDB2/Driver/Manager/sqlite.php b/3dparty/MDB2/Driver/Manager/sqlite.php similarity index 97% rename from inc/MDB2/Driver/Manager/sqlite.php rename to 3dparty/MDB2/Driver/Manager/sqlite.php index 85751d39a3ff7422467ad3c2756119df4b6363da..5258cff891d1131c1d11a71b271cc488347a360f 100644 --- a/inc/MDB2/Driver/Manager/sqlite.php +++ b/3dparty/MDB2/Driver/Manager/sqlite.php @@ -46,7 +46,7 @@ // $Id: sqlite.php,v 1.76 2008/05/31 11:48:48 quipo Exp $ // -oc_require_once('MDB2/Driver/Manager/Common.php'); +require_once('MDB2/Driver/Manager/Common.php'); /** * MDB2 SQLite driver for the management modules @@ -71,7 +71,9 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function createDatabase($name, $options = array()) { - $db =& $this->getDBInstance(); + global $SERVERROOT; + $datadir=OC_CONFIG::getValue( "datadirectory", "$SERVERROOT/data" ); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -82,7 +84,8 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common 'database already exists', __FUNCTION__); } $php_errormsg = ''; - $handle = @sqlite_open($database_file, $db->dsn['mode'], $php_errormsg); + $database_file="$datadir/$database_file.db"; + $handle = sqlite_open($database_file, $db->dsn['mode'], $php_errormsg); if (!$handle) { return $db->raiseError(MDB2_ERROR_CANNOT_CREATE, null, null, (isset($php_errormsg) ? $php_errormsg : 'could not create the database file'), __FUNCTION__); @@ -107,7 +110,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function dropDatabase($name) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -174,7 +177,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function _getCreateTableQuery($name, $fields, $options = array()) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -236,7 +239,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common } // create triggers to enforce FOREIGN KEY constraints if (!empty($options['foreign_keys'])) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -384,7 +387,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function dropTable($name) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -427,7 +430,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function vacuum($table = null, $options = array()) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -534,7 +537,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function alterTable($name, $changes, $check, $options = array()) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -687,7 +690,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common $query = 'INSERT INTO '.$db->quoteIdentifier($name_new, true); $query.= '('.implode(', ', array_slice(array_keys($fields), 0, count($select_fields))).')'; $query.=' VALUES (?'.str_repeat(', ?', (count($select_fields) - 1)).')'; - $stmt =& $db->prepare($query, null, MDB2_PREPARE_MANIP); + $stmt =$db->prepare($query, null, MDB2_PREPARE_MANIP); if (PEAR::isError($stmt)) { return $stmt; } @@ -712,7 +715,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function listDatabases() { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -732,7 +735,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function listUsers() { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -750,9 +753,9 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common * @return mixed array of view names on success, a MDB2 error on failure * @access public */ - function listViews() + function listViews($dummy=null) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -780,7 +783,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function listTableViews($table) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -814,9 +817,9 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common * @return mixed array of table names on success, a MDB2 error on failure * @access public */ - function listTables() + function listTables($dummy=null) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -850,7 +853,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function listTableFields($table) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -898,7 +901,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function listTableTriggers($table = null) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -958,7 +961,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function createIndex($table, $name, $definition) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -998,7 +1001,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function dropIndex($table, $name) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1019,7 +1022,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function listTableIndexes($table) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1080,7 +1083,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function createConstraint($table, $name, $definition) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1133,7 +1136,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common return $this->alterTable($table, array(), false, array('primary' => null)); } - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1170,7 +1173,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function _dropFKTriggers($table, $fkname, $referenced_table) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1204,7 +1207,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function listTableConstraints($table) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1274,7 +1277,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function createSequence($seq_name, $start = 1) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1315,7 +1318,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common */ function dropSequence($seq_name) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -1333,9 +1336,9 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common * @return mixed array of sequence names on success, a MDB2 error on failure * @access public */ - function listSequences() + function listSequences($dummy=null) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } diff --git a/inc/MDB2/Driver/Native/Common.php b/3dparty/MDB2/Driver/Native/Common.php similarity index 100% rename from inc/MDB2/Driver/Native/Common.php rename to 3dparty/MDB2/Driver/Native/Common.php diff --git a/inc/MDB2/Driver/Native/mysql.php b/3dparty/MDB2/Driver/Native/mysql.php similarity index 100% rename from inc/MDB2/Driver/Native/mysql.php rename to 3dparty/MDB2/Driver/Native/mysql.php diff --git a/inc/MDB2/Driver/Native/pgsql.php b/3dparty/MDB2/Driver/Native/pgsql.php similarity index 100% rename from inc/MDB2/Driver/Native/pgsql.php rename to 3dparty/MDB2/Driver/Native/pgsql.php diff --git a/inc/MDB2/Driver/Native/sqlite.php b/3dparty/MDB2/Driver/Native/sqlite.php similarity index 100% rename from inc/MDB2/Driver/Native/sqlite.php rename to 3dparty/MDB2/Driver/Native/sqlite.php diff --git a/inc/MDB2/Driver/Reverse/Common.php b/3dparty/MDB2/Driver/Reverse/Common.php similarity index 98% rename from inc/MDB2/Driver/Reverse/Common.php rename to 3dparty/MDB2/Driver/Reverse/Common.php index 4a411fea6d26ec56db949052f9d78c21154a7484..c78d84f760a490a62ebcb858edbfe02c9b8f6b05 100644 --- a/inc/MDB2/Driver/Reverse/Common.php +++ b/3dparty/MDB2/Driver/Reverse/Common.php @@ -107,7 +107,7 @@ class MDB2_Driver_Reverse_Common extends MDB2_Module_Common */ function getTableFieldDefinition($table, $field) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -141,7 +141,7 @@ class MDB2_Driver_Reverse_Common extends MDB2_Module_Common */ function getTableIndexDefinition($table, $index) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -193,7 +193,7 @@ class MDB2_Driver_Reverse_Common extends MDB2_Module_Common */ function getTableConstraintDefinition($table, $index) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -220,7 +220,7 @@ class MDB2_Driver_Reverse_Common extends MDB2_Module_Common */ function getSequenceDefinition($sequence) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -273,7 +273,7 @@ class MDB2_Driver_Reverse_Common extends MDB2_Module_Common */ function getTriggerDefinition($trigger) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -407,7 +407,7 @@ class MDB2_Driver_Reverse_Common extends MDB2_Module_Common */ function tableInfo($result, $mode = null) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } diff --git a/inc/MDB2/Driver/Reverse/mysql.php b/3dparty/MDB2/Driver/Reverse/mysql.php similarity index 98% rename from inc/MDB2/Driver/Reverse/mysql.php rename to 3dparty/MDB2/Driver/Reverse/mysql.php index 40c62da3baaf0361987cbe28dacb7fd3eff240a9..6e366c22a5e09b78cbd351a3fd37e9953f8be290 100644 --- a/inc/MDB2/Driver/Reverse/mysql.php +++ b/3dparty/MDB2/Driver/Reverse/mysql.php @@ -45,7 +45,7 @@ // $Id: mysql.php,v 1.80 2008/03/26 21:15:37 quipo Exp $ // -oc_require_once('MDB2/Driver/Reverse/Common.php'); +require_once('MDB2/Driver/Reverse/Common.php'); /** * MDB2 MySQL driver for the schema reverse engineering module @@ -69,7 +69,7 @@ class MDB2_Driver_Reverse_mysql extends MDB2_Driver_Reverse_Common */ function getTableFieldDefinition($table_name, $field_name) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -181,7 +181,7 @@ class MDB2_Driver_Reverse_mysql extends MDB2_Driver_Reverse_Common */ function getTableIndexDefinition($table_name, $index_name) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -256,7 +256,7 @@ class MDB2_Driver_Reverse_mysql extends MDB2_Driver_Reverse_Common */ function getTableConstraintDefinition($table_name, $constraint_name) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -356,7 +356,7 @@ class MDB2_Driver_Reverse_mysql extends MDB2_Driver_Reverse_Common */ function _getTableFKConstraintDefinition($table, $constraint_name, $definition) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -424,7 +424,7 @@ class MDB2_Driver_Reverse_mysql extends MDB2_Driver_Reverse_Common */ function getTriggerDefinition($trigger) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -476,7 +476,7 @@ class MDB2_Driver_Reverse_mysql extends MDB2_Driver_Reverse_Common return parent::tableInfo($result, $mode); } - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } diff --git a/inc/MDB2/Driver/Reverse/pgsql.php b/3dparty/MDB2/Driver/Reverse/pgsql.php similarity index 99% rename from inc/MDB2/Driver/Reverse/pgsql.php rename to 3dparty/MDB2/Driver/Reverse/pgsql.php index d010292cd8c48e66f3e6a55ea47acb450453d361..649c1cad9ee629655faf00667937beae6e3cc287 100644 --- a/inc/MDB2/Driver/Reverse/pgsql.php +++ b/3dparty/MDB2/Driver/Reverse/pgsql.php @@ -45,7 +45,7 @@ // // $Id: pgsql.php,v 1.75 2008/08/22 16:36:20 quipo Exp $ -oc_require_once('MDB2/Driver/Reverse/Common.php'); +require_once('MDB2/Driver/Reverse/Common.php'); /** * MDB2 PostGreSQL driver for the schema reverse engineering module diff --git a/inc/MDB2/Driver/Reverse/sqlite.php b/3dparty/MDB2/Driver/Reverse/sqlite.php similarity index 97% rename from inc/MDB2/Driver/Reverse/sqlite.php rename to 3dparty/MDB2/Driver/Reverse/sqlite.php index 1b85aa71f9af1302d05b1c3989e480d7f5996bb5..60c686c418a1d54339897b08e101ea9f2e122889 100644 --- a/inc/MDB2/Driver/Reverse/sqlite.php +++ b/3dparty/MDB2/Driver/Reverse/sqlite.php @@ -46,7 +46,7 @@ // $Id: sqlite.php,v 1.80 2008/05/03 10:30:14 quipo Exp $ // -oc_require_once('MDB2/Driver/Reverse/Common.php'); +require_once('MDB2/Driver/Reverse/Common.php'); /** * MDB2 SQlite driver for the schema reverse engineering module @@ -63,7 +63,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common * @access private */ function _removeComments($sql) { - $lines = split("\n", $sql); + $lines = explode("\n", $sql); foreach ($lines as $k => $line) { $pieces = explode('--', $line); if (count($pieces) > 1 && (substr_count($pieces[0], '\'') % 2) == 0) { @@ -78,7 +78,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common */ function _getTableColumns($sql) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -88,7 +88,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common // replace the decimal length-places-separator with a colon $column_def = preg_replace('/(\d),(\d)/', '\1:\2', $column_def); $column_def = $this->_removeComments($column_def); - $column_sql = split(',', $column_def); + $column_sql = explode(',', $column_def); $columns = array(); $count = count($column_sql); if ($count == 0) { @@ -156,7 +156,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common */ function getTableFieldDefinition($table_name, $field_name) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -258,7 +258,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common */ function getTableIndexDefinition($table_name, $index_name) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -300,7 +300,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common $start_pos = strpos($sql, '('); $end_pos = strrpos($sql, ')'); $column_names = substr($sql, $start_pos+1, $end_pos-$start_pos-1); - $column_names = split(',', $column_names); + $column_names = explode(',', $column_names); if (preg_match("/^create unique/", $sql)) { return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null, @@ -341,7 +341,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common */ function getTableConstraintDefinition($table_name, $constraint_name) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -408,7 +408,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common if (preg_match("/\bPRIMARY\s+KEY\b\s*\(([^)]+)/i", $sql, $tmp)) { $definition['primary'] = true; $definition['fields'] = array(); - $column_names = split(',', $tmp[1]); + $column_names = explode(',', $tmp[1]); $colpos = 1; foreach ($column_names as $column_name) { $definition['fields'][trim($column_name)] = array( @@ -420,7 +420,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common if (preg_match("/\"([^\"]+)\"[^\,\"]+\bPRIMARY\s+KEY\b[^\,\)]*/i", $sql, $tmp)) { $definition['primary'] = true; $definition['fields'] = array(); - $column_names = split(',', $tmp[1]); + $column_names = explode(',', $tmp[1]); $colpos = 1; foreach ($column_names as $column_name) { $definition['fields'][trim($column_name)] = array( @@ -450,14 +450,14 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common $definition['onupdate'] = 'NO ACTION'; $definition['ondelete'] = 'NO ACTION'; $definition['references']['table'] = $tmp[2]; - $column_names = split(',', $tmp[1]); + $column_names = explode(',', $tmp[1]); $colpos = 1; foreach ($column_names as $column_name) { $definition['fields'][trim($column_name)] = array( 'position' => $colpos++ ); } - $referenced_cols = split(',', $tmp[3]); + $referenced_cols = explode(',', $tmp[3]); $colpos = 1; foreach ($referenced_cols as $column_name) { $definition['references']['fields'][trim($column_name)] = array( @@ -487,7 +487,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common $start_pos = strpos($sql, '('); $end_pos = strrpos($sql, ')'); $column_names = substr($sql, $start_pos+1, $end_pos-$start_pos-1); - $column_names = split(',', $column_names); + $column_names = explode(',', $column_names); if (!preg_match("/^create unique/", $sql)) { return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null, @@ -532,7 +532,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common */ function getTriggerDefinition($trigger) { - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } @@ -596,7 +596,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common return parent::tableInfo($result, $mode); } - $db =& $this->getDBInstance(); + $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; } diff --git a/inc/MDB2/Driver/mysql.php b/3dparty/MDB2/Driver/mysql.php similarity index 99% rename from inc/MDB2/Driver/mysql.php rename to 3dparty/MDB2/Driver/mysql.php index 091c479d1944f0bd74e45b24e587251bc7f28045..b9b46c0d762f445a384320a9fd6bc9b3870fc40d 100644 --- a/inc/MDB2/Driver/mysql.php +++ b/3dparty/MDB2/Driver/mysql.php @@ -462,7 +462,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common * @access public * @since 2.1.1 */ - function setTransactionIsolation($isolation) + static function setTransactionIsolation($isolation, $options = array()) { $this->debug('Setting transaction isolation level', __FUNCTION__, array('is_manip' => true)); if (!$this->supports('transactions')) { diff --git a/inc/MDB2/Driver/pgsql.php b/3dparty/MDB2/Driver/pgsql.php similarity index 99% rename from inc/MDB2/Driver/pgsql.php rename to 3dparty/MDB2/Driver/pgsql.php index 00a64865a726f3c0e9783c1791211d3496b17da1..6108f18dec16e69c4173531d90c6b357dc3e3d54 100644 --- a/inc/MDB2/Driver/pgsql.php +++ b/3dparty/MDB2/Driver/pgsql.php @@ -343,7 +343,7 @@ class MDB2_Driver_pgsql extends MDB2_Driver_Common * @access public * @since 2.1.1 */ - function setTransactionIsolation($isolation) + static function setTransactionIsolation($isolation, $options = array()) { $this->debug('Setting transaction isolation level', __FUNCTION__, array('is_manip' => true)); switch ($isolation) { diff --git a/inc/MDB2/Driver/sqlite.php b/3dparty/MDB2/Driver/sqlite.php similarity index 98% rename from inc/MDB2/Driver/sqlite.php rename to 3dparty/MDB2/Driver/sqlite.php index abde86d596b320160b9912b8b12d01f4aa987ac7..48f233167c702aee3025d0600e6c2d7d2e98057a 100644 --- a/inc/MDB2/Driver/sqlite.php +++ b/3dparty/MDB2/Driver/sqlite.php @@ -205,7 +205,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common register_shutdown_function('MDB2_closeOpenTransactions'); } $query = 'BEGIN TRANSACTION '.$this->options['base_transaction_name']; - $result =& $this->_doQuery($query, true); + $result =$this->_doQuery($query, true); if (PEAR::isError($result)) { return $result; } @@ -240,7 +240,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common } $query = 'COMMIT TRANSACTION '.$this->options['base_transaction_name']; - $result =& $this->_doQuery($query, true); + $result =$this->_doQuery($query, true); if (PEAR::isError($result)) { return $result; } @@ -275,7 +275,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common } $query = 'ROLLBACK TRANSACTION '.$this->options['base_transaction_name']; - $result =& $this->_doQuery($query, true); + $result =$this->_doQuery($query, true); if (PEAR::isError($result)) { return $result; } @@ -299,7 +299,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common * @access public * @since 2.1.1 */ - function setTransactionIsolation($isolation) + static function setTransactionIsolation($isolation,$options=array()) { $this->debug('Setting transaction isolation level', __FUNCTION__, array('is_manip' => true)); switch ($isolation) { @@ -347,6 +347,8 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common **/ function connect() { + global $SERVERROOT; + $datadir=OC_CONFIG::getValue( "datadirectory", "$SERVERROOT/data" ); $database_file = $this->_getDatabaseFile($this->database_name); if (is_resource($this->connection)) { //if (count(array_diff($this->connected_dsn, $this->dsn)) == 0 @@ -370,6 +372,9 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common } if ($database_file !== ':memory:') { + if(!strpos($database_file,'.db')){ + $database_file="$datadir/$database_file.db"; + } if (!file_exists($database_file)) { if (!touch($database_file)) { return $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null, @@ -405,7 +410,9 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common $php_errormsg = ''; if (version_compare('5.1.0', PHP_VERSION, '>')) { @ini_set('track_errors', true); + echo 1; $connection = @$connect_function($database_file); + echo 2; @ini_restore('track_errors'); } else { $connection = @$connect_function($database_file, 0666, $php_errormsg); @@ -538,7 +545,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common $this->_lasterror = $php_errormsg; if (!$result) { - $err =& $this->raiseError(null, null, null, + $err =$this->raiseError(null, null, null, 'Could not execute statement', __FUNCTION__); return $err; } @@ -753,7 +760,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common $table = $this->quoteIdentifier($table, true); $query = "REPLACE INTO $table ($query) VALUES ($values)"; - $result =& $this->_doQuery($query, true, $connection); + $result =$this->_doQuery($query, true, $connection); if (PEAR::isError($result)) { return $result; } @@ -781,7 +788,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common $query = "INSERT INTO $sequence_name ($seqcol_name) VALUES (NULL)"; $this->pushErrorHandling(PEAR_ERROR_RETURN); $this->expectError(MDB2_ERROR_NOSUCHTABLE); - $result =& $this->_doQuery($query, true); + $result =$this->_doQuery($query, true); $this->popExpect(); $this->popErrorHandling(); if (PEAR::isError($result)) { @@ -800,7 +807,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common $value = $this->lastInsertID(); if (is_numeric($value)) { $query = "DELETE FROM $sequence_name WHERE $seqcol_name < $value"; - $result =& $this->_doQuery($query, true); + $result =$this->_doQuery($query, true); if (PEAR::isError($result)) { $this->warnings[] = 'nextID: could not delete previous sequence table values from '.$seq_name; } @@ -896,7 +903,7 @@ class MDB2_Result_sqlite extends MDB2_Result_Common } if (!$row) { if ($this->result === false) { - $err =& $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, + $err =$this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); return $err; } diff --git a/inc/MDB2/Extended.php b/3dparty/MDB2/Extended.php similarity index 100% rename from inc/MDB2/Extended.php rename to 3dparty/MDB2/Extended.php diff --git a/inc/MDB2/Iterator.php b/3dparty/MDB2/Iterator.php similarity index 100% rename from inc/MDB2/Iterator.php rename to 3dparty/MDB2/Iterator.php diff --git a/inc/MDB2/LOB.php b/3dparty/MDB2/LOB.php similarity index 99% rename from inc/MDB2/LOB.php rename to 3dparty/MDB2/LOB.php index 2cdf67afa923334e979ad8b1ec4391c37a387f40..ae67224020e84d944a450b5e1c6be5010d1c3893 100644 --- a/inc/MDB2/LOB.php +++ b/3dparty/MDB2/LOB.php @@ -50,7 +50,7 @@ * @author Lukas Smith <smith@pooteeweet.org> */ -oc_require_once('MDB2.php'); +require_once('MDB2.php'); /** * MDB2_LOB: user land stream wrapper implementation for LOB support diff --git a/inc/MDB2/Schema.php b/3dparty/MDB2/Schema.php similarity index 99% rename from inc/MDB2/Schema.php rename to 3dparty/MDB2/Schema.php index 44518b32658bb1e41c0a827c956157919d9e3004..25818460a629b6a37f9d5c884429c2bbbb08d34b 100644 --- a/inc/MDB2/Schema.php +++ b/3dparty/MDB2/Schema.php @@ -237,7 +237,7 @@ class MDB2_Schema extends PEAR * @access public * @see MDB2::parseDSN */ - function &factory(&$db, $options = array()) + static function factory(&$db, $options = array()) { $obj =new MDB2_Schema(); $result = $obj->connect($db, $options); @@ -282,7 +282,7 @@ class MDB2_Schema extends PEAR } $this->disconnect(); if (!MDB2::isConnection($db)) { - $db =& MDB2::factory($db, $db_options); + $db =MDB2::factory($db, $db_options); } if (PEAR::isError($db)) { @@ -1338,15 +1338,15 @@ class MDB2_Schema extends PEAR if ($dbExists) { $this->db->debug('Database already exists: ' . $db_name, __FUNCTION__); - if (!empty($dbOptions)) { - $errorcodes = array(MDB2_ERROR_UNSUPPORTED, MDB2_ERROR_NO_PERMISSION); - $this->db->expectError($errorcodes); - $result = $this->db->manager->alterDatabase($db_name, $dbOptions); - $this->db->popExpect(); - if (PEAR::isError($result) && !MDB2::isError($result, $errorcodes)) { - return $result; - } - } +// if (!empty($dbOptions)) { +// $errorcodes = array(MDB2_ERROR_UNSUPPORTED, MDB2_ERROR_NO_PERMISSION); +// $this->db->expectError($errorcodes); +// $result = $this->db->manager->alterDatabase($db_name, $dbOptions); +// $this->db->popExpect(); +// if (PEAR::isError($result) && !MDB2::isError($result, $errorcodes)) { +// return $result; +// } +// } $create = false; } else { $this->db->expectError(MDB2_ERROR_UNSUPPORTED); @@ -2692,9 +2692,9 @@ class MDB2_Schema extends PEAR * @access public * @see PEAR_Error */ - function &raiseError($code = null, $mode = null, $options = null, $userinfo = null) + function raiseError($code = null, $mode = null, $options = null, $userinfo = null,$a=null,$b=null,$c=null) { - $err =& PEAR::raiseError(null, $code, $mode, $options, + $err =PEAR::raiseError(null, $code, $mode, $options, $userinfo, 'MDB2_Schema_Error', true); return $err; } @@ -2713,7 +2713,7 @@ class MDB2_Schema extends PEAR * @return bool true if parameter is an error * @access public */ - function isError($data, $code = null) + static function isError($data, $code = null) { if (is_a($data, 'MDB2_Schema_Error')) { if (is_null($code)) { diff --git a/inc/MDB2/Schema/Parser.php b/3dparty/MDB2/Schema/Parser.php similarity index 99% rename from inc/MDB2/Schema/Parser.php rename to 3dparty/MDB2/Schema/Parser.php index ed31ba03bdfdd883ab1673f8681886740978ed5b..bd7a96579325800bbdec2181557ad6eb62d9178b 100644 --- a/inc/MDB2/Schema/Parser.php +++ b/3dparty/MDB2/Schema/Parser.php @@ -54,8 +54,8 @@ */ -oc_require_once('XML/Parser.php'); -oc_require_once('MDB2/Schema/Validate.php'); +require_once('XML/Parser.php'); +require_once('MDB2/Schema/Validate.php'); /** * Parses an XML schema file @@ -120,7 +120,7 @@ class MDB2_Schema_Parser extends XML_Parser { // force ISO-8859-1 due to different defaults for PHP4 and PHP5 // todo: this probably needs to be investigated some more andcleaned up - parent::XML_Parser('ISO-8859-1'); + parent::__construct('ISO-8859-1'); $this->variables = $variables; $this->structure = $structure; @@ -503,7 +503,7 @@ class MDB2_Schema_Parser extends XML_Parser $this->element = implode('-', $this->elements); } - function &raiseError($msg = null, $xmlecode = 0, $xp = null, $ecode = MDB2_SCHEMA_ERROR_PARSE) + function &raiseError($msg = null, $xmlecode = 0, $xp = null, $ecode = MDB2_SCHEMA_ERROR_PARSE,$a=null,$b=null,$c=null) { if (is_null($this->error)) { $error = ''; diff --git a/inc/MDB2/Schema/Parser2.php b/3dparty/MDB2/Schema/Parser2.php similarity index 100% rename from inc/MDB2/Schema/Parser2.php rename to 3dparty/MDB2/Schema/Parser2.php diff --git a/inc/MDB2/Schema/Reserved/ibase.php b/3dparty/MDB2/Schema/Reserved/ibase.php similarity index 100% rename from inc/MDB2/Schema/Reserved/ibase.php rename to 3dparty/MDB2/Schema/Reserved/ibase.php diff --git a/inc/MDB2/Schema/Reserved/mssql.php b/3dparty/MDB2/Schema/Reserved/mssql.php similarity index 100% rename from inc/MDB2/Schema/Reserved/mssql.php rename to 3dparty/MDB2/Schema/Reserved/mssql.php diff --git a/inc/MDB2/Schema/Reserved/mysql.php b/3dparty/MDB2/Schema/Reserved/mysql.php similarity index 100% rename from inc/MDB2/Schema/Reserved/mysql.php rename to 3dparty/MDB2/Schema/Reserved/mysql.php diff --git a/inc/MDB2/Schema/Reserved/oci8.php b/3dparty/MDB2/Schema/Reserved/oci8.php similarity index 100% rename from inc/MDB2/Schema/Reserved/oci8.php rename to 3dparty/MDB2/Schema/Reserved/oci8.php diff --git a/inc/MDB2/Schema/Reserved/pgsql.php b/3dparty/MDB2/Schema/Reserved/pgsql.php similarity index 100% rename from inc/MDB2/Schema/Reserved/pgsql.php rename to 3dparty/MDB2/Schema/Reserved/pgsql.php diff --git a/inc/MDB2/Schema/Tool.php b/3dparty/MDB2/Schema/Tool.php similarity index 100% rename from inc/MDB2/Schema/Tool.php rename to 3dparty/MDB2/Schema/Tool.php diff --git a/inc/MDB2/Schema/Tool/ParameterException.php b/3dparty/MDB2/Schema/Tool/ParameterException.php similarity index 100% rename from inc/MDB2/Schema/Tool/ParameterException.php rename to 3dparty/MDB2/Schema/Tool/ParameterException.php diff --git a/inc/MDB2/Schema/Validate.php b/3dparty/MDB2/Schema/Validate.php similarity index 100% rename from inc/MDB2/Schema/Validate.php rename to 3dparty/MDB2/Schema/Validate.php diff --git a/inc/MDB2/Schema/Writer.php b/3dparty/MDB2/Schema/Writer.php similarity index 100% rename from inc/MDB2/Schema/Writer.php rename to 3dparty/MDB2/Schema/Writer.php diff --git a/inc/PEAR.php b/3dparty/PEAR.php similarity index 99% rename from inc/PEAR.php rename to 3dparty/PEAR.php index d5c9635a5017f0b9b07e77d2d2c47ffa19557210..9760b9d265a8437d9f196a26fb4e657a56e5ce99 100644 --- a/inc/PEAR.php +++ b/3dparty/PEAR.php @@ -247,7 +247,7 @@ class PEAR * @access public * @return bool true if parameter is an error */ - function isError($data, $code = null) + static function isError($data, $code = null) { if (is_a($data, 'PEAR_Error')) { if (is_null($code)) { diff --git a/inc/PEAR/Autoloader.php b/3dparty/PEAR/Autoloader.php similarity index 100% rename from inc/PEAR/Autoloader.php rename to 3dparty/PEAR/Autoloader.php diff --git a/inc/PEAR/Builder.php b/3dparty/PEAR/Builder.php similarity index 100% rename from inc/PEAR/Builder.php rename to 3dparty/PEAR/Builder.php diff --git a/inc/PEAR/Command.php b/3dparty/PEAR/Command.php similarity index 100% rename from inc/PEAR/Command.php rename to 3dparty/PEAR/Command.php diff --git a/inc/PEAR/Command/Auth.php b/3dparty/PEAR/Command/Auth.php similarity index 100% rename from inc/PEAR/Command/Auth.php rename to 3dparty/PEAR/Command/Auth.php diff --git a/inc/PEAR/Command/Build.php b/3dparty/PEAR/Command/Build.php similarity index 100% rename from inc/PEAR/Command/Build.php rename to 3dparty/PEAR/Command/Build.php diff --git a/inc/PEAR/Command/Common.php b/3dparty/PEAR/Command/Common.php similarity index 100% rename from inc/PEAR/Command/Common.php rename to 3dparty/PEAR/Command/Common.php diff --git a/inc/PEAR/Command/Config.php b/3dparty/PEAR/Command/Config.php similarity index 100% rename from inc/PEAR/Command/Config.php rename to 3dparty/PEAR/Command/Config.php diff --git a/inc/PEAR/Command/Install.php b/3dparty/PEAR/Command/Install.php similarity index 100% rename from inc/PEAR/Command/Install.php rename to 3dparty/PEAR/Command/Install.php diff --git a/inc/PEAR/Command/Mirror.php b/3dparty/PEAR/Command/Mirror.php similarity index 100% rename from inc/PEAR/Command/Mirror.php rename to 3dparty/PEAR/Command/Mirror.php diff --git a/inc/PEAR/Command/Package.php b/3dparty/PEAR/Command/Package.php similarity index 100% rename from inc/PEAR/Command/Package.php rename to 3dparty/PEAR/Command/Package.php diff --git a/inc/PEAR/Command/Registry.php b/3dparty/PEAR/Command/Registry.php similarity index 100% rename from inc/PEAR/Command/Registry.php rename to 3dparty/PEAR/Command/Registry.php diff --git a/inc/PEAR/Command/Remote.php b/3dparty/PEAR/Command/Remote.php similarity index 100% rename from inc/PEAR/Command/Remote.php rename to 3dparty/PEAR/Command/Remote.php diff --git a/inc/PEAR/Common.php b/3dparty/PEAR/Common.php similarity index 100% rename from inc/PEAR/Common.php rename to 3dparty/PEAR/Common.php diff --git a/inc/PEAR/Config.php b/3dparty/PEAR/Config.php similarity index 100% rename from inc/PEAR/Config.php rename to 3dparty/PEAR/Config.php diff --git a/inc/PEAR/Dependency.php b/3dparty/PEAR/Dependency.php similarity index 100% rename from inc/PEAR/Dependency.php rename to 3dparty/PEAR/Dependency.php diff --git a/inc/PEAR/Downloader.php b/3dparty/PEAR/Downloader.php similarity index 100% rename from inc/PEAR/Downloader.php rename to 3dparty/PEAR/Downloader.php diff --git a/inc/PEAR/ErrorStack.php b/3dparty/PEAR/ErrorStack.php similarity index 100% rename from inc/PEAR/ErrorStack.php rename to 3dparty/PEAR/ErrorStack.php diff --git a/inc/PEAR/Exception.php b/3dparty/PEAR/Exception.php similarity index 100% rename from inc/PEAR/Exception.php rename to 3dparty/PEAR/Exception.php diff --git a/inc/PEAR/Frontend/CLI.php b/3dparty/PEAR/Frontend/CLI.php similarity index 100% rename from inc/PEAR/Frontend/CLI.php rename to 3dparty/PEAR/Frontend/CLI.php diff --git a/inc/PEAR/Installer.php b/3dparty/PEAR/Installer.php similarity index 100% rename from inc/PEAR/Installer.php rename to 3dparty/PEAR/Installer.php diff --git a/inc/PEAR/Packager.php b/3dparty/PEAR/Packager.php similarity index 100% rename from inc/PEAR/Packager.php rename to 3dparty/PEAR/Packager.php diff --git a/inc/PEAR/Registry.php b/3dparty/PEAR/Registry.php similarity index 100% rename from inc/PEAR/Registry.php rename to 3dparty/PEAR/Registry.php diff --git a/inc/PEAR/Remote.php b/3dparty/PEAR/Remote.php similarity index 100% rename from inc/PEAR/Remote.php rename to 3dparty/PEAR/Remote.php diff --git a/inc/PEAR/RunTest.php b/3dparty/PEAR/RunTest.php similarity index 100% rename from inc/PEAR/RunTest.php rename to 3dparty/PEAR/RunTest.php diff --git a/inc/System.php b/3dparty/System.php similarity index 99% rename from inc/System.php rename to 3dparty/System.php index a9279ff687d84655cfb66307a13592f264da842c..97de96b14caea8c8d773ee9359fc48d4bff7be73 100644 --- a/inc/System.php +++ b/3dparty/System.php @@ -19,8 +19,8 @@ // $Id: System.php,v 1.36 2004/06/15 16:33:46 pajoye Exp $ // -oc_require_once( 'PEAR.php'); -oc_require_once( 'Console/Getopt.php'); +require_once( 'PEAR.php'); +require_once( 'Console/Getopt.php'); $GLOBALS['_System_temp_files'] = array(); diff --git a/inc/XML/Parser.php b/3dparty/XML/Parser.php similarity index 95% rename from inc/XML/Parser.php rename to 3dparty/XML/Parser.php index 6f77b5c66da83f05e142eab15b4b6e7e5b869588..38b4f8fe8a668055ecf77beb1e09c2d226b7dd2d 100644 --- a/inc/XML/Parser.php +++ b/3dparty/XML/Parser.php @@ -36,7 +36,7 @@ /** * uses PEAR's error handling */ -oc_require_once('PEAR.php'); +require_once('PEAR.php'); /** * resource could not be created @@ -164,26 +164,6 @@ class XML_Parser extends PEAR */ var $_handlerObj; - // }}} - // {{{ constructor - - /** - * Creates an XML parser. - * - * This is needed for PHP4 compatibility, it will - * call the constructor, when a new instance is created. - * - * @param string $srcenc source charset encoding, use NULL (default) to use - * whatever the document specifies - * @param string $mode how this parser object should work, "event" for - * startelement/endelement-type events, "func" - * to have it call functions named after elements - * @param string $tgenc a valid target encoding - */ - function XML_Parser($srcenc = null, $mode = 'event', $tgtenc = null) - { - XML_Parser::__construct($srcenc, $mode, $tgtenc); - } // }}} /** @@ -560,7 +540,11 @@ class XML_Parser extends PEAR * @param integer $ecode the error message code * @return XML_Parser_Error **/ - function raiseError($msg = null, $ecode = 0) + function raiseError($msg = null, $ecode = 0,$mode = null, + $options = null, + $userinfo = null, + $error_class = null, + $skipmsg = false) { $msg = !is_null($msg) ? $msg : $this->parser; $err = new XML_Parser_Error($msg, $ecode); @@ -606,7 +590,7 @@ class XML_Parser extends PEAR * * @abstract */ - function startHandler($xp, $elem, &$attribs) + function startHandler($xp, $elem, $attribs) { return NULL; } diff --git a/inc/XML/RPC.php b/3dparty/XML/RPC.php similarity index 100% rename from inc/XML/RPC.php rename to 3dparty/XML/RPC.php diff --git a/inc/XML/RPC/Server.php b/3dparty/XML/RPC/Server.php similarity index 100% rename from inc/XML/RPC/Server.php rename to 3dparty/XML/RPC/Server.php diff --git a/admin/ajax/changepassword.php b/admin/ajax/changepassword.php new file mode 100644 index 0000000000000000000000000000000000000000..a8f3af1517518ed53a552afe834b641b73a260dc --- /dev/null +++ b/admin/ajax/changepassword.php @@ -0,0 +1,26 @@ +<?php + +// Init owncloud +require_once('../../lib/base.php'); + +// We send json data +header( "Content-Type: application/jsonrequest" ); + +// Check if we are a user +if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){ + echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" ))); + exit(); +} + +$username = $_POST["username"]; +$password = $_POST["password"]; + +// Return Success story +if( OC_USER::setPassword( $username, $password )){ + echo json_encode( array( "status" => "success", "data" => array( "username" => $username ))); +} +else{ + echo json_encode( array( "status" => "error", "data" => array( "message" => "Unable to change password" ))); +} + +?> diff --git a/admin/ajax/creategroup.php b/admin/ajax/creategroup.php new file mode 100644 index 0000000000000000000000000000000000000000..eec27587930dcc0ae27a683c252d247a9c3df4ab --- /dev/null +++ b/admin/ajax/creategroup.php @@ -0,0 +1,31 @@ +<?php + +// Init owncloud +require_once('../../lib/base.php'); + +// We send json data +header( "Content-Type: application/jsonrequest" ); + +// Check if we are a user +if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){ + echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" ))); + exit(); +} + +$groupname = $_POST["groupname"]; + +// Does the group exist? +if( in_array( $groupname, OC_GROUP::getGroups())){ + echo json_encode( array( "status" => "error", "data" => array( "message" => "Group already exists" ))); + exit(); +} + +// Return Success story +if( OC_GROUP::createGroup( $groupname )){ + echo json_encode( array( "status" => "success", "data" => array( "groupname" => $groupname ))); +} +else{ + echo json_encode( array( "status" => "error", "data" => array( "message" => "Unable to add group" ))); +} + +?> diff --git a/admin/ajax/createuser.php b/admin/ajax/createuser.php new file mode 100644 index 0000000000000000000000000000000000000000..a6e4ec0e93d85ad1f1aabe5f56b616052a8a96a7 --- /dev/null +++ b/admin/ajax/createuser.php @@ -0,0 +1,39 @@ +<?php + +// Init owncloud +require_once('../../lib/base.php'); + +// We send json data +header( "Content-Type: application/jsonrequest" ); + +// Check if we are a user +if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){ + echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" ))); + exit(); +} + +$groups = array(); +if( isset( $_POST["groups"] )){ + $groups = $_POST["groups"]; +} +$username = $_POST["username"]; +$password = $_POST["password"]; + +// Does the group exist? +if( in_array( $username, OC_USER::getUsers())){ + echo json_encode( array( "status" => "error", "data" => array( "message" => "User already exists" ))); + exit(); +} + +// Return Success story +if( OC_USER::createUser( $username, $password )){ + foreach( $groups as $i ){ + OC_GROUP::addToGroup( $username, $i ); + } + echo json_encode( array( "status" => "success", "data" => array( "username" => $username, "groups" => implode( ", ", OC_GROUP::getUserGroups( $username ))))); +} +else{ + echo json_encode( array( "status" => "error", "data" => array( "message" => "Unable to add user" ))); +} + +?> diff --git a/admin/ajax/removegroup.php b/admin/ajax/removegroup.php new file mode 100644 index 0000000000000000000000000000000000000000..c7991ba5819ca81d5b470edca56b9fc28f925f5d --- /dev/null +++ b/admin/ajax/removegroup.php @@ -0,0 +1,25 @@ +<?php + +// Init owncloud +require_once('../../lib/base.php'); + +// We send json data +header( "Content-Type: application/jsonrequest" ); + +// Check if we are a user +if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){ + echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" ))); + exit(); +} + +$name = $_POST["groupname"]; + +// Return Success story +if( OC_GROUP::deleteGroup( $name )){ + echo json_encode( array( "status" => "success", "data" => array( "groupname" => $name ))); +} +else{ + echo json_encode( array( "status" => "error", "data" => array( "message" => "Unable to delete group" ))); +} + +?> diff --git a/admin/ajax/removeuser.php b/admin/ajax/removeuser.php new file mode 100644 index 0000000000000000000000000000000000000000..7e587f1605800b840535c06c395145bb6728c709 --- /dev/null +++ b/admin/ajax/removeuser.php @@ -0,0 +1,25 @@ +<?php + +// Init owncloud +require_once('../../lib/base.php'); + +// We send json data +header( "Content-Type: application/jsonrequest" ); + +// Check if we are a user +if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){ + echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" ))); + exit(); +} + +$username = $_POST["username"]; + +// Return Success story +if( OC_USER::deleteUser( $username )){ + echo json_encode( array( "status" => "success", "data" => array( "username" => $username ))); +} +else{ + echo json_encode( array( "status" => "error", "data" => array( "message" => "Unable to delete user" ))); +} + +?> diff --git a/admin/ajax/togglegroups.php b/admin/ajax/togglegroups.php new file mode 100644 index 0000000000000000000000000000000000000000..f821ae0bfaa61e0008850585ccef5a65b515c1a6 --- /dev/null +++ b/admin/ajax/togglegroups.php @@ -0,0 +1,40 @@ +<?php + +// Init owncloud +require_once('../../lib/base.php'); + +// We send json data +header( "Content-Type: application/jsonrequest" ); + +// Check if we are a user +if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){ + echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" ))); + exit(); +} + +$success = true; +$error = "add user to"; +$action = "add"; + +$username = $_POST["username"]; +$group = $_POST["group"]; + +// Toggle group +if( OC_GROUP::inGroup( $username, $group )){ + $action = "remove"; + $error = "remove user from"; + $success = OC_GROUP::removeFromGroup( $username, $group ); +} +else{ + $success = OC_GROUP::addToGroup( $username, $group ); +} + +// Return Success story +if( $success ){ + echo json_encode( array( "status" => "success", "data" => array( "username" => $username, "action" => $action, "groupname" => $group ))); +} +else{ + echo json_encode( array( "status" => "error", "data" => array( "message" => "Unable to $error group $group" ))); +} + +?> diff --git a/admin/appinfo/app.php b/admin/appinfo/app.php new file mode 100644 index 0000000000000000000000000000000000000000..e87013bd99309377b5aa0b90acdbb6888f5441a9 --- /dev/null +++ b/admin/appinfo/app.php @@ -0,0 +1,13 @@ +<?php + +OC_APP::register( array( "order" => 1, "id" => "admin", "name" => "Administration" )); + +OC_APP::addAdminPage( array( "id" => "core_system", "order" => 1, "href" => OC_HELPER::linkTo( "admin", "system.php" ), "name" =>"System", "icon" => OC_HELPER::imagePath( "admin", "administration.png" ))); +OC_APP::addAdminPage( array( "id" => "core_users", "order" => 2, "href" => OC_HELPER::linkTo( "admin", "users.php" ), "name" => "Users", "icon" => OC_HELPER::imagePath( "admin", "users.png" ))); +OC_APP::addAdminPage( array( "id" => "core_apps", "order" => 3, "href" => OC_HELPER::linkTo( "admin", "apps.php" ), "name" => "Apps", "icon" => OC_HELPER::imagePath( "admin", "apps.png" ))); +OC_APP::addAdminPage( array( "id" => "core_plugins", "order" => 4, "href" => OC_HELPER::linkTo( "admin", "plugins.php" ), "name" => "Plugins", "icon" => OC_HELPER::imagePath( "admin", "plugins.png" ))); + +// Add subentries for App installer +OC_APP::addNavigationSubEntry( "core_apps", array( "id" => "core_apps_installed", "order" => 4, "href" => OC_HELPER::linkTo( "admin", "apps.php?add=some¶meters=here" ), "name" => "Installed apps", "icon" => OC_HELPER::imagePath( "admin", "navicon.png" ))); + +?> diff --git a/admin/apps.php b/admin/apps.php new file mode 100644 index 0000000000000000000000000000000000000000..7ce3f4c419fb63f66040c2f846bac884daabf4e2 --- /dev/null +++ b/admin/apps.php @@ -0,0 +1,91 @@ +<?php + +/** +* ownCloud +* +* @author Frank Karlitschek +* @copyright 2010 Frank Karlitschek karlitschek@kde.org +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU AFFERO GENERAL PUBLIC LICENSE for more details. +* +* You should have received a copy of the GNU Affero General Public +* License along with this library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + +require_once('../lib/base.php'); +require( 'template.php' ); +if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){ + header( "Location: ".OC_HELPER::linkTo( "", "index.php" )); + exit(); +} + +// Load the files we need +OC_UTIL::addStyle( "admin", "apps" ); + + +if(isset($_GET['id'])) $id=$_GET['id']; else $id=0; +if(isset($_GET['cat'])) $cat=$_GET['cat']; else $cat=0; + +$categories=OC_OCSCLIENT::getCategories(); + +/* + +All +Installed Apps + + + +foreach($categories as $key=>$value) { +print_r($value); +} + + +*/ + +// OC_APP::setActiveNavigationEntry( "core_apps_installed" ); + + +if($id==0) { + OC_APP::setActiveNavigationEntry( "core_apps" ); + + if($cat==0){ + $numcats=array(); + foreach($categories as $key=>$value) $numcats[]=$key; + $apps=OC_OCSCLIENT::getApplications($numcats); + }else{ + $apps=OC_OCSCLIENT::getApplications($cat); + } + + // return template + $tmpl = new OC_TEMPLATE( "admin", "apps", "admin" ); + + $tmpl->assign( "categories", $categories ); + $tmpl->assign( "apps", $apps ); + $tmpl->printPage(); + unset($tmpl); + +}else{ + OC_APP::setActiveNavigationEntry( "core_apps" ); + + $app=OC_OCSCLIENT::getApplication($id); + + $tmpl = new OC_TEMPLATE( "admin", "app", "admin" ); + $tmpl->assign( "categories", $categories ); + $tmpl->assign( "app", $app ); + $tmpl->printPage(); + unset($tmpl); + +} + + +?> + diff --git a/admin/css/apps.css b/admin/css/apps.css new file mode 100644 index 0000000000000000000000000000000000000000..7063762204a87aa2570c95e6ae63700fe38a5ef5 --- /dev/null +++ b/admin/css/apps.css @@ -0,0 +1,49 @@ +/* APPS TABLE */ + +table td.date +{ + width: 5em; + padding: 0.5em 1em; + text-align: right; +} + +.preview +{ + padding: 3px; + text-align: left; +} + +table td.date +{ + width: 11em; + color: #555555; +} + +table td.selection, table th.selection, table td.fileaction +{ + width: 2em; + text-align: center; +} + +table td.name a +{ + padding: 6px; + text-decoration: none; + color: #555555; +} + +.type +{ + text-decoration: none; + color: #888888; + font-size: 0.8em; +} + +.description +{ + text-decoration: none; + color: #666666; + font-size: 0.9em; +} + + diff --git a/admin/img/administration.png b/admin/img/administration.png new file mode 100644 index 0000000000000000000000000000000000000000..8f4bb880aec783f7d8db565045f3c2777f04b8b3 Binary files /dev/null and b/admin/img/administration.png differ diff --git a/admin/img/apps.png b/admin/img/apps.png new file mode 100644 index 0000000000000000000000000000000000000000..ee3e8355e664219251542f04e6e4d5fbecc8859d Binary files /dev/null and b/admin/img/apps.png differ diff --git a/admin/img/plugins.png b/admin/img/plugins.png new file mode 100644 index 0000000000000000000000000000000000000000..1e6f16651c26da368234185e515f9a189472ae15 Binary files /dev/null and b/admin/img/plugins.png differ diff --git a/admin/img/users.png b/admin/img/users.png new file mode 100644 index 0000000000000000000000000000000000000000..ea2ed9e3335ea5be11896d705b6afaf92a691695 Binary files /dev/null and b/admin/img/users.png differ diff --git a/admin/js/users.js b/admin/js/users.js new file mode 100644 index 0000000000000000000000000000000000000000..1ef02c650a0a90d55e818b94bc66fd286a219350 --- /dev/null +++ b/admin/js/users.js @@ -0,0 +1,340 @@ +$(document).ready(function(){ + // Vars we need + var uid = ""; + var gid = ""; + var togglepassword = ""; + var togglegroup = ""; + + //######################################################################### + // Stuff I don't understand + //######################################################################### + + function doToggleGroup( group ){ + $("#changegroupgid").val(group); + + // Serialize the data + var post = $( "#changegroupsform" ).serialize(); + // Ajax foo + $.post( 'ajax/togglegroups.php', post, function(data){ + if( data.status == "success" ){ + var groups = []; + $("input[x-use='togglegroup']").each( function(index){ + if( $(this).attr("checked")){ + groups.push($(this).val()); + } + }); + if( groups.length == 0 ){ + $("#changegroups").prev().html( ' ' ); + } + else{ + $("#changegroups").prev().html( groups.join(", ")); + } + } + else{ + printError( data.data.message ); + } + }); + return false; + } + + function printError( message ){ + $("#errormessage").text( message ); + $("#errordialog").dialog( "open" ); + return false; + } + + //######################################################################### + // Functions for editing the dom after user manipulation + //######################################################################### + + // Manipulating the page after crteating a user + function userCreated( username, groups ){ + // We need at least a space for showing the div + if( groups == "" ){ + groups = ' '; + } + + // Add user to table + var newrow = '<tr x-uid="'+username+'"><td x-use="username"><div x-use="usernamediv">'+username+'</div></td>'; + newrow = newrow+'<td x-use="usergroups"><div x-use="usergroupsdiv">'+groups+'</td>'; + newrow = newrow+'<td><a class="removeuserbutton" href="">remove</a></td></tr>'; + $("#usertable").append( newrow ); + + // Clear forms + $("input[x-use='createuserfield']").val( "" ); + $("input[x-use='createusercheckbox']").attr( "checked", false ); + } + + function userRemoved( username ){ + $( "tr[x-uid='"+username+"']" ).remove(); + } + + function groupCreated( groupname ){ + var newrow = '<tr x-gid="'+groupname+'"><td>' + groupname + '</td>'; + newrow = newrow + '<td><a class="removegroupbutton" href="">remove</a></td></tr>'; + $("#grouptable").append( newrow ); + + // Delete form content + $("input[x-use='creategroupfield']").val( "" ); + + // Add group option to Create User and Edit User + var createuser = '<input x-use="createusercheckbox" x-gid="'+groupname+'" type="checkbox" name="groups[]" value="'+groupname+'" /> <span x-gid="'+groupname+'">'+groupname+'<br /></span>'; + $("#createusergroups").append( createuser ); + var changeuser = '<input x-use="togglegroup" x-gid="'+groupname+'" type="checkbox" name="groups[]" value="'+groupname+'" /> <span x-use="togglegroup" x-gid="'+groupname+'">'+groupname+'<br /></span>'; + $("#changegroupsform").append( changeuser ); + } + + function groupRemoved( groupname ){ + // Delete the options + $( "tr[x-gid='"+groupname+"']" ).remove(); + $( "span[x-gid='"+groupname+"']" ).remove(); + $( "input[x-gid='"+groupname+"']" ).remove(); + + // remove it from user list + $( "div[x-use='usergroupsdiv']" ).each(function(index){ + var content = $(this).text(); + var list = content.split( ", " ); + var newlist = []; + for( var i = 0; i < list.length; i++ ){ + var temp = list[i]; + if( temp != groupname ){ + newlist.push( temp ); + } + } + var newstring = newlist.join( ", " ); + $(this).html( newstring ) + }); + + } + + //######################################################################### + // Editing the users properties by clicking the cell + //######################################################################### + + // Password (clicking on user name) + $("div[x-use='usernamediv']").live( "click", function(){ + if( togglepassword == "" || $(this).parent().parent().attr("x-uid") != togglepassword ){ + togglepassword = $(this).parent().parent().attr("x-uid"); + // Set the username! + $("#changepassworduid").val(togglepassword); + $("#changepasswordpwd").val(""); + $(this).parent().append( $('#changepassword') ); + $('#changepassword').show(); + } + else{ + $('#changepassword').hide(); + togglepassword = ""; + } + }); + + $("#changepasswordbutton").click( function(){ + // Serialize the data + var post = $( "#changepasswordform" ).serialize(); + // Ajax foo + $.post( 'ajax/changepassword.php', post, function(data){ + if( data.status == "success" ){ + togglepassword = ""; + $('#changepassword').hide(); + } + else{ + printError( data.data.message ); + } + }); + return false; + }); + + // Groups + $("div[x-use='usergroupsdiv']").live( "click", function(){ + if( togglegroup == "" || $(this).parent().parent().attr("x-uid") != togglegroup){ + togglegroup = $(this).parent().parent().attr("x-uid"); + var groups = $(this).text(); + groups = groups.split(", "); + $("input[x-use='togglegroup']").each( function(index){ + var check = false; + // Group checked? + for( var i = 0; i < groups.length; i++ ){ + if( $(this).val() == groups[i] ){ + check = true; + } + } + + // Check/uncheck + if( check ){ + $(this).attr("checked","checked"); + } + else{ + $(this).removeAttr("checked"); + } + }); + $("#changegroupuid").val(togglegroup); + $(this).parent().append( $('#changegroups') ); + $('#changegroups').show(); + } + else{ + var groups = []; + $("input[x-use='togglegroup']").each( function(index){ + if( $(this).attr("checked")){ + groups.push($(this).val()); + } + }); + if( groups.length == 0 ){ + $("#changegroups").prev().html( ' ' ); + } + else{ + $("#changegroups").prev().html( groups.join(", ")); + } + $('#changegroups').hide(); + togglegroup = ""; + } + }); + + $("span[x-use='togglegroup']").live( "click", function(){ + if( $(this).prev().attr("checked")){ + $(this).prev().removeAttr("checked") + } + else{ + $(this).prev().attr("checked","checked") + } + doToggleGroup( $(this).attr("x-gid")); + }); + + $("input[x-use='togglegroup']").live( "click", function(){ + doToggleGroup( $(this).attr("x-gid")); + }); + //######################################################################### + // Clicking on buttons + //######################################################################### + + // Show the create user form + $( "#createuseroptionbutton" ) + .click(function(){ + $("#createuserform").show(); + $("#createuseroption").hide(); + return false; + }); + + // Create a new user + $( "#createuserbutton" ) + .click(function(){ + // Create the post data + var post = $( "#createuserdata" ).serialize(); + + // Ajax call + $.post( 'ajax/createuser.php', post, function(data){ + // If it says "success" then we are happy + if( data.status == "success" ){ + userCreated( data.data.username, data.data.groups ); + } + else{ + printError( data.data.message ); + } + }); + return false; + }); + + $( ".removeuserbutton" ).live( 'click', function() { + uid = $( this ).parent().parent().attr( 'x-uid' ); + $("#deleteuserusername").html(uid); + $("#deleteusernamefield").val(uid); + $("#removeuserform").dialog( "open" ); + return false; + }); + + $( "#creategroupbutton" ) + .click(function(){ + // Serialize the data + var post = $( "#creategroupdata" ).serialize(); + // Ajax foo + $.post( 'ajax/creategroup.php', post, function(data){ + if( data.status == "success" ){ + groupCreated( data.data.groupname ); + } + else{ + printError( data.data.message ); + } + }); + return false; + }); + + $( ".removegroupbutton" ).live( 'click', function(){ + gid = $( this ).parent().parent().attr( 'x-gid' ); + $("#removegroupgroupname").html(gid); + $("#removegroupnamefield").val(gid); + $("#removegroupform").dialog( "open" ); + return false; + }); + + //######################################################################### + // Dialogs + //######################################################################### + + // Removing users + $( "#errordialog" ).dialog({ + autoOpen: false, + modal: true, + buttons: { + OK: function() { + $( this ).dialog( "close" ); + } + } + }); + + // Removing users + $( "#removeuserform" ).dialog({ + autoOpen: false, + height: 300, + width: 350, + modal: true, + buttons: { + "Remove user": function() { + var post = $( "#removeuserdata" ).serialize(); + $.post( 'ajax/removeuser.php', post, function(data){ + if( data.status == "success" ){ + userRemoved( uid ); + } + else{ + printError( data.data.message ); + } + }); + $( this ).dialog( "close" ); + }, + Cancel: function() { + $( this ).dialog( "close" ); + } + }, + close: function() { + true; + } + }); + + + // Dialog for adding users + $( "#removegroupform" ).dialog({ + autoOpen: false, + height: 300, + width: 350, + modal: true, + buttons: { + "Remove group": function(){ + var post = $( "#removegroupdata" ).serialize(); + $.post( 'ajax/removegroup.php', post, function(data){ + if( data.status == "success" ){ + groupRemoved( gid ); + } + else{ + printError( data.data.message ); + } + }); + $( this ).dialog( "close" ); + }, + Cancel: function() { + $( this ).dialog( "close" ); + } + }, + close: function(){ + true; + } + }); + +} ); + diff --git a/admin/plugins.php b/admin/plugins.php new file mode 100644 index 0000000000000000000000000000000000000000..fd1933a7fa1f61b133802cdb762cad56a601c711 --- /dev/null +++ b/admin/plugins.php @@ -0,0 +1,52 @@ +<?php + +/** +* ownCloud +* +* @author Frank Karlitschek +* @copyright 2010 Frank Karlitschek karlitschek@kde.org +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU AFFERO GENERAL PUBLIC LICENSE for more details. +* +* You should have received a copy of the GNU Affero General Public +* License along with this library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + +require_once('../lib/base.php'); +require( 'template.php' ); +if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){ + header( "Location: ".OC_HELPER::linkTo( "index.php" )); + exit(); +} + +OC_APP::setActiveNavigationEntry( "core_plugins" ); +$plugins=array(); +$blacklist=OC_PLUGIN::loadBlackList(); + +foreach( OC_PLUGIN::listPlugins() as $i ){ + // Gather data about plugin + $data = OC_PLUGIN::getPluginData($plugin); + + // Is it enabled? + $data["enabled"] = ( array_search( $plugin, $blacklist ) === false ); + + // Add the data + $plugins[] = $data; +} + + +$tmpl = new OC_TEMPLATE( "admin", "plugins", "admin" ); +$tmpl->assign( "plugins", $plugins ); +$tmpl->printPage(); + +?> + diff --git a/admin/index.php b/admin/system.php similarity index 55% rename from admin/index.php rename to admin/system.php index 92c465e8d611b309346ca4dac1fa1b40d0e6351e..310979295f0db24e9cd008625ec6e029f8f70e26 100644 --- a/admin/index.php +++ b/admin/system.php @@ -3,39 +3,35 @@ /** * ownCloud * -* @author Frank Karlitschek -* @copyright 2010 Frank Karlitschek karlitschek@kde.org -* +* @author Frank Karlitschek +* @copyright 2010 Frank Karlitschek karlitschek@kde.org +* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either +* License as published by the Free Software Foundation; either * version 3 of the License, or any later version. -* +* * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public +* +* You should have received a copy of the GNU Affero General Public * License along with this library. If not, see <http://www.gnu.org/licenses/>. -* +* */ -$CONFIG_ERROR=''; - -require_once('../inc/lib_base.php'); +require_once('../lib/base.php'); +require( 'template.php' ); +if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){ + header( "Location: ".OC_HELPER::linkTo( "index.php" )); + exit(); +} +OC_APP::setActiveNavigationEntry( "administration" ); -OC_UTIL::showheader(); - -$FIRSTRUN=false; - -echo('<div class="center">'); -OC_CONFIG::showadminform(); -echo('</div>'); - - -OC_UTIL::showfooter(); +$tmpl = new OC_TEMPLATE( "admin", "system", "admin" ); +$tmpl->printPage(); ?> - + diff --git a/admin/templates/app.php b/admin/templates/app.php new file mode 100644 index 0000000000000000000000000000000000000000..1ea31bdecdeff01563fc1e82ffa02abb2507e58c --- /dev/null +++ b/admin/templates/app.php @@ -0,0 +1,27 @@ +<?php +/* + * Template for Apps + */ +$app=$_['app']; +?> +<h1><?php echo $app["name"]; ?></h1> +<?php echo('<span class="type">'.$app['typename'].'</span>'); ?><br /> +<span class="date"><?php echo OC_UTIL::formatdate($app["changed"]); ?></span><br /> + + +<table cellspacing="6" border="0" width="100%"> + <tr> + <td width="1" valign="top"> + <?php if($app["preview1"]<>"") { echo('<img class="preview" border="0" src="'.$app["preview1"].'" /><br />'); } ?> + <?php if($app["preview2"]<>"") { echo('<img class="preview" border="0" src="'.$app["preview2"].'" /><br />'); } ?> + <?php if($app["preview3"]<>"") { echo('<img class="preview" border="0" src="'.$app["preview3"].'" /><br />'); } ?> + </td> + <td class="description" valign="top"> + <?php echo $app["description"]; ?> + <br /> + <?php echo('<a class="description" target="_blank" href="'.$app["detailpage"].'">read more</a><br />'); ?> + </td> + <td width="1" valign="top"><a class="prettybutton" href="">INSTALL</a></td> + </tr> +</table> + diff --git a/admin/templates/apps.php b/admin/templates/apps.php new file mode 100644 index 0000000000000000000000000000000000000000..36a7cd53029bb1a043d8242a65c482cc72fa7a32 --- /dev/null +++ b/admin/templates/apps.php @@ -0,0 +1,27 @@ +<?php +/* + * Template for Apps + */ +?> +<h1>Apps Repository</h1> + + +<table cellspacing="0"> + <thead> + <tr> + <th></th> + <th>Name</th> + <th>Modified</th> + </tr> + </thead> + <tbody> + <?php foreach($_["apps"] as $app): ?> + <tr> + <td width="1"><?php if($app["preview"] <> "") { echo('<a href="'.OC_HELPER::linkTo( "admin", "apps.php" ).'?id='.$app['id'].'"><img class="preview" border="0" src="'.$app["preview"].'" /></a>'); } ?> </a></td> + <td class="name"><a href="<?php echo(OC_HELPER::linkTo( "admin", "apps.php" ).'?id='.$app['id']); ?>" title=""><?php echo $app["name"]; ?></a><br /><?php echo('<span class="type">'.$app['typename'].'</span>'); ?></td> + <td class="date"><?php echo OC_UTIL::formatdate($app["changed"]); ?></td> + </tr> + <?php endforeach; ?> + </tbody> +</table> + diff --git a/admin/templates/plugins.php b/admin/templates/plugins.php new file mode 100644 index 0000000000000000000000000000000000000000..8f5e87d3e809c78361775549aea2a3612f2e27cd --- /dev/null +++ b/admin/templates/plugins.php @@ -0,0 +1,28 @@ +<?php +/* + * Template for admin pages + */ +?> +<h1>Administration</h1> +<h2>Plugins</h2> + +<table> + <thead> + <tr> + <th>Name</th> + <th>Description</th> + <th>Version</th> + <th>Author</th> + <th></th> + </tr> + </thead> + <tbody> + <?php foreach($_["plugins"] as $plugin): ?> + <td><?php echo $plugin["info"]["id"]; ?></td> + <td><?php echo $plugin["info"]["version"]; ?></td> + <td><?php echo $plugin["info"]["name"]; ?></td> + <td><?php echo $plugin["info"]["author"]; ?></td> + <td>enable</td> + <?php endforeach; ?> + </tbody> +</table> diff --git a/admin/templates/system.php b/admin/templates/system.php new file mode 100644 index 0000000000000000000000000000000000000000..4087b40a483b7dd9cb6f009a5db2f60653ef01d9 --- /dev/null +++ b/admin/templates/system.php @@ -0,0 +1,8 @@ +<?php +/* + * Template for admin pages + */ +?> +<h1>Administration</h1> +<h2>System Settings</h2> +#TBD \ No newline at end of file diff --git a/admin/templates/users.php b/admin/templates/users.php new file mode 100644 index 0000000000000000000000000000000000000000..235df5bf829c681d29079d4d0358550799606da6 --- /dev/null +++ b/admin/templates/users.php @@ -0,0 +1,116 @@ +<h2>Users</h2> + +<table id="usertable"> + <thead> + <tr> + <th>Name</th> + <th>Groups</th> + <th></th> + </tr> + </thead> + <tfoot> + <tr id="createuseroption"> + <td><button id="createuseroptionbutton">Add user</button></td> + <td> </td> + <td> </td> + </tr> + <form id="createuserdata"> + <tr id="createuserform" style="display:none;"> + <td> + Name <input x-use="createuserfield" type="text" name="username" /><br> + Password <input x-use="createuserfield" type="password" name="password" /> + </td> + <td id="createusergroups"> + <?php foreach($_["groups"] as $i): ?> + <input x-use="createusercheckbox" x-gid="<? echo $i["name"]; ?>" type="checkbox" name="groups[]" value="<? echo $i["name"]; ?>" /> + <span x-gid="<? echo $i["name"]; ?>"><? echo $i["name"]; ?><br></span> + <?php endforeach; ?> + </td> + <td> + <button id="createuserbutton">Create user</button> + </td> + </tr> + </form> + </tfoot> + <tbody> + <?php foreach($_["users"] as $user): ?> + <tr x-uid="<?php echo $user["name"] ?>"> + <td x-use="username"><div x-use="usernamediv"><?php echo $user["name"]; ?></div></td> + <td x-use="usergroups"><div x-use="usergroupsdiv"><?php if( $user["groups"] ){ echo $user["groups"]; }else{echo " ";} ?></div></td> + <td><a class="removeuserbutton" href="">remove</a></td> + </tr> + <?php endforeach; ?> + </tbody> +</table> + +<h2>Groups</h2> +<table id="grouptable"> + <thead> + <tr> + <th>Name</th> + <th></th> + </tr> + </thead> + <tfoot> + <form id="creategroupdata"> + <tr> + <td><input x-use="creategroupfield" type="text" name="groupname" /></td> + <td><button id="creategroupbutton">Create group</button></td> + </tr> + </form> + </tfoot> + <tbody> + <?php foreach($_["groups"] as $group): ?> + <tr x-gid="<?php echo $group["name"]; ?>"> + <td><?php echo $group["name"] ?></td> + <td> + <?php if( $group["name"] != "admin" ): ?> + <a class="removegroupbutton" href="">remove</a> + <?php else: ?> + + <?php endif; ?> + </td> + </tr> + <?php endforeach; ?> + </tbody> +</table> + + + +<div id="changegroups" style="display:none"> + <form id="changegroupsform"> + <input id="changegroupuid" type="hidden" name="username" value="" /> + <input id="changegroupgid" type="hidden" name="group" value="" /> + <?php foreach($_["groups"] as $i): ?> + <input x-use="togglegroup" x-gid="<? echo $i["name"]; ?>" type="checkbox" name="groups[]" value="<? echo $i["name"]; ?>" /> + <span x-use="togglegroup" x-gid="<? echo $i["name"]; ?>"><? echo $i["name"]; ?><br></span> + <?php endforeach; ?> + </form> +</div> + +<div id="changepassword" style="display:none"> + <form id="changepasswordform"> + <input id="changepassworduid" type="hidden" name="username" value="" /> + Force new password: + <input id="changepasswordpwd" type="password" name="password" value="" /> + <button id="changepasswordbutton">Set</button> + </form> +</div> + +<div id="removeuserform" title="Remove user"> + <form id="removeuserdata"> + Do you really want to delete user <span id="deleteuserusername">$user</span>? + <input id="deleteusernamefield" type="hidden" name="username" value=""> + </form> +</div> + +<div id="removegroupform" title="Remove Group"> + <form id="removegroupdata"> + Do you really want to delete group <span id="removegroupgroupname">$group</span>? + <input id="removegroupnamefield" type="hidden" name="groupname" value=""> + </form> +</div> + +<div id="errordialog" title="Error"> + <span id="errormessage"></span> +</div> diff --git a/admin/users.php b/admin/users.php new file mode 100644 index 0000000000000000000000000000000000000000..e44feb40fe28d0a199d045083fed5aeeea9a5b7a --- /dev/null +++ b/admin/users.php @@ -0,0 +1,58 @@ +<?php + +/** +* ownCloud +* +* @author Frank Karlitschek +* @copyright 2010 Frank Karlitschek karlitschek@kde.org +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU AFFERO GENERAL PUBLIC LICENSE for more details. +* +* You should have received a copy of the GNU Affero General Public +* License along with this library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + +require_once('../lib/base.php'); +require( 'template.php' ); +if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){ + header( "Location: ".OC_HELPER::linkTo( "index.php" )); + exit(); +} + +// We have some javascript foo! +OC_UTIL::addScript( "admin", "users" ); +OC_APP::setActiveNavigationEntry( "core_users" ); + +$users = array(); +$groups = array(); + +foreach( OC_USER::getUsers() as $i ){ + // Do some more work here soon + $ingroups = array(); + foreach( OC_GROUP::getUserGroups( $i ) as $userGroup ){ + $ingroups[] = $userGroup; + } + $users[] = array( "name" => $i, "groups" => join( ", ", $ingroups )); +} + +foreach( OC_GROUP::getGroups() as $i ){ + // Do some more work here soon + $groups[] = array( "name" => $i ); +} + +$tmpl = new OC_TEMPLATE( "admin", "users", "admin" ); +$tmpl->assign( "users", $users ); +$tmpl->assign( "groups", $groups ); +$tmpl->printPage(); + +?> + diff --git a/apps/.gitkeep b/apps/.gitkeep new file mode 100644 index 0000000000000000000000000000000000000000..8d1c8b69c3fce7bea45c73efd06983e3c419a92f --- /dev/null +++ b/apps/.gitkeep @@ -0,0 +1 @@ + diff --git a/apps/files_publiclink/admin.php b/apps/files_publiclink/admin.php new file mode 100644 index 0000000000000000000000000000000000000000..a48076b4d42b5ea5ca0d7aeb1d76a7d837282768 --- /dev/null +++ b/apps/files_publiclink/admin.php @@ -0,0 +1,55 @@ +<?php + +/** +* ownCloud - ajax frontend +* +* @author Robin Appelman +* @copyright 2010 Robin Appelman icewind1991@gmail.com +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU AFFERO GENERAL PUBLIC LICENSE for more details. +* +* You should have received a copy of the GNU Affero General Public +* License along with this library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + + +// Init owncloud +require_once('../../lib/base.php'); +require_once( 'lib_public.php' ); +require( 'template.php' ); + + +// Check if we are a user +if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){ + header( "Location: ".OC_HELPER::linkTo( "index.php" )); + exit(); +} + +OC_APP::setActiveNavigationEntry( "files_publiclink_administration" ); + +OC_UTIL::addStyle( 'files_publiclink', 'admin' ); +OC_UTIL::addScript( 'files_publiclink', 'admin' ); + +if(isset($_SERVER['HTTPS'])) { + $baseUrl= "https://". $_SERVER['SERVER_NAME'] . OC_HELPER::linkTo('files_publiclink','get.php'); +}else{ + $baseUrl= "http://". $_SERVER['SERVER_NAME'] . OC_HELPER::linkTo('files_publiclink','get.php'); +} + + +// return template +$tmpl = new OC_TEMPLATE( "files_publiclink", "admin", "admin" ); +$tmpl->assign( 'links', OC_PublicLink::getLinks()); +$tmpl->assign('baseUrl',$baseUrl); +$tmpl->printPage(); + +?> diff --git a/apps/files_publiclink/ajax/deletelink.php b/apps/files_publiclink/ajax/deletelink.php new file mode 100644 index 0000000000000000000000000000000000000000..e2e4ff944a6b8467058735e623ebbfb910119b46 --- /dev/null +++ b/apps/files_publiclink/ajax/deletelink.php @@ -0,0 +1,11 @@ +<?php +$RUNTIME_NOAPPS=true; //no need to load the apps + +require_once '../../../lib/base.php'; + +require_once '../lib_public.php'; + +$token=$_GET['token']; + +OC_PublicLink::delete($token); +?> \ No newline at end of file diff --git a/apps/files_publiclink/ajax/makelink.php b/apps/files_publiclink/ajax/makelink.php new file mode 100644 index 0000000000000000000000000000000000000000..5abd1e829c57ac694a9f3099123ff18916df5a32 --- /dev/null +++ b/apps/files_publiclink/ajax/makelink.php @@ -0,0 +1,19 @@ +<?php +$RUNTIME_NOAPPS=true; //no need to load the apps + +require_once '../../../lib/base.php'; + +require_once '../lib_public.php'; + +$path=$_GET['path']; +$expire=(isset($_GET['expire']))?$_GET['expire']:0; +if($expire!==0){ + + $expire=strtotime($expire); +} +// echo $expire; +// die(); + +$link=new OC_PublicLink($path,$expire); +echo $link->getToken(); +?> \ No newline at end of file diff --git a/apps/files_publiclink/appinfo/app.php b/apps/files_publiclink/appinfo/app.php new file mode 100644 index 0000000000000000000000000000000000000000..894327e83d39501e7e6b4971eff529a43e7faed4 --- /dev/null +++ b/apps/files_publiclink/appinfo/app.php @@ -0,0 +1,6 @@ +<?php + +OC_APP::addSettingsPage( array( "id" => "files_publiclink_administration", "order" => 1, "href" => OC_HELPER::linkTo( "files_publiclink", "admin.php" ), "name" => "Public Links", "icon" => OC_HELPER::imagePath( "files_publiclink", "share.png" ))); + + +?> diff --git a/apps/files_publiclink/appinfo/database.xml b/apps/files_publiclink/appinfo/database.xml new file mode 100644 index 0000000000000000000000000000000000000000..de63b03f4453398f07cdc5d1be6efdbc0efab483 --- /dev/null +++ b/apps/files_publiclink/appinfo/database.xml @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="ISO-8859-1" ?> +<database> + <name>*dbname*</name> + <create>true</create> + <overwrite>false</overwrite> + <charset>latin1</charset> + <table> + <name>*dbprefix*publiclink</name> + <declaration> + <field> + <name>token</name> + <type>text</type> + <default></default> + <notnull>true</notnull> + <length>40</length> + </field> + <field> + <name>path</name> + <type>text</type> + <default></default> + <notnull>true</notnull> + <length>128</length> + </field> + <field> + <name>user</name> + <type>text</type> + <default> + </default> + <notnull>true</notnull> + <length>64</length> + </field> + <field> + <name>expire_time</name> + <type>timestamp</type> + <notnull>true</notnull> + </field> + <index> + <name>token</name> + <unique>true</unique> + <field> + <name>token</name> + <sorting>ascending</sorting> + </field> + </index> + </declaration> + </table> +</database> diff --git a/apps/files_publiclink/appinfo/info.xml b/apps/files_publiclink/appinfo/info.xml new file mode 100644 index 0000000000000000000000000000000000000000..1d41ea96662cbd63fd296b81b88cc1b0eb7e8aef --- /dev/null +++ b/apps/files_publiclink/appinfo/info.xml @@ -0,0 +1,10 @@ +<?xml version="1.0"?> +<info> + <id>files_publiclink</id> + <name>Share by Publiclink</name> + <description>Simple file sharing by creating a public link to a file</description> + <version>0.2</version> + <licence>AGPL</licence> + <author>Robin Appelman</author> + <require>2</require> +</info> \ No newline at end of file diff --git a/apps/files_publiclink/css/admin.css b/apps/files_publiclink/css/admin.css new file mode 100644 index 0000000000000000000000000000000000000000..f21b289f043459377a0961af3e0d681dc2d6c442 --- /dev/null +++ b/apps/files_publiclink/css/admin.css @@ -0,0 +1,2 @@ +td.path{min-width:200px} +td.expire{width:120px} \ No newline at end of file diff --git a/apps/files_publiclink/get.php b/apps/files_publiclink/get.php new file mode 100644 index 0000000000000000000000000000000000000000..60570ac224924722de49bb3ffe723dab12c53f08 --- /dev/null +++ b/apps/files_publiclink/get.php @@ -0,0 +1,84 @@ +<?php +$RUNTIME_NOAPPS=true; //no need to load the apps +$RUNTIME_NOSETUPFS=true; //don't setup the fs yet + +require_once '../../lib/base.php'; +require( 'template.php' ); + +require_once 'lib_public.php'; + +//get the path of the shared file +$token=$_GET['token']; +$path=OC_PublicLink::getPath($token); +$root=$path; + +if($path!==false){ + if(isset($_GET['path']) and !strstr($_GET['path'],'..')){ + $subPath=$_GET['path']; + }else{ + $subPath=''; + } + $path.=$subPath; + if(!OC_FILESYSTEM::file_exists($path)){ + header("HTTP/1.0 404 Not Found"); + $tmpl = new OC_TEMPLATE( '', '404', 'guest' ); + $tmpl->assign('file',$subPath); + $tmpl->printPage(); + exit; + } + if(OC_FILESYSTEM::is_dir($path)){ + $files = array(); + $rootLength=strlen($root); + foreach( OC_FILES::getdirectorycontent( $path ) as $i ){ + $i['date'] = OC_UTIL::formatDate($i['mtime'] ); + $i['directory']=substr($i['directory'],$rootLength); + if($i['directory']=='/'){ + $i['directory']=''; + } + $files[] = $i; + } + + // Make breadcrumb + $breadcrumb = array(); + $pathtohere = "/"; + foreach( explode( "/", $subPath ) as $i ){ + if( $i != "" ){ + $pathtohere .= "$i/"; + $breadcrumb[] = array( "dir" => $pathtohere, "name" => $i ); + } + } + + $breadcrumbNav = new OC_TEMPLATE( "files_publiclink", "breadcrumb", "" ); + $breadcrumbNav->assign( "breadcrumb", $breadcrumb ); + $breadcrumbNav->assign('token',$token); + + $list = new OC_TEMPLATE( 'files_publiclink', 'files', '' ); + $list->assign( 'files', $files ); + $list->assign('token',$token); + + $tmpl = new OC_TEMPLATE( 'files_publiclink', 'index', 'user' ); + $tmpl->assign('fileList', $list->fetchPage()); + $tmpl->assign( "breadcrumb", $breadcrumbNav->fetchPage() ); + $tmpl->printPage(); + }else{ + //get time mimetype and set the headers + $mimetype=OC_FILESYSTEM::getMimeType($path); + header('Content-Transfer-Encoding: binary'); + header('Content-Disposition: attachment; filename="'.basename($path).'"'); + header('Expires: 0'); + header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); + header('Pragma: public'); + header('Content-Type: ' . $mimetype); + header('Content-Length: ' . OC_FILESYSTEM::filesize($path)); + + //download the file + ob_clean(); + OC_FILESYSTEM::readfile($path); + } +}else{ + header("HTTP/1.0 404 Not Found"); + $tmpl = new OC_TEMPLATE( '', '404', 'guest' ); + $tmpl->printPage(); + die(); +} +?> \ No newline at end of file diff --git a/apps/files_publiclink/js/admin.js b/apps/files_publiclink/js/admin.js new file mode 100644 index 0000000000000000000000000000000000000000..017c62cb42ae23d2692a13bfac0fd97b58ca73e9 --- /dev/null +++ b/apps/files_publiclink/js/admin.js @@ -0,0 +1,52 @@ +$(document).ready(function() { + $( "#expire" ).datepicker({ + dateFormat:'MM d, yy', + altField: "#expire_time", + altFormat: "yy-mm-dd" + }); + $( "#path" ).autocomplete({ + source: "../../files/ajax/autocomplete.php", + minLength: 1 + }); + $("button.delete").live('click', function() { + event.preventDefault(); + var token=$(this).attr('data-token'); + var data="token="+token; + $.ajax({ + type: 'GET', + url: 'ajax/deletelink.php', + cache: false, + data: data, + success: function(){ + $('#'+token).remove(); + } + }); + }); + $('#newlink').submit(function(){ + event.preventDefault(); + var path=$('#path').val(); + var expire=$('#expire_time').val()||0; + var data='path='+path+'&expire='+expire; + $.ajax({ + type: 'GET', + url: 'ajax/makelink.php', + cache: false, + data: data, + success: function(token){ + if(token){ + var html="<tr class='link' id='"+token+"'>"; + html+="<td class='path'>"+path+"</td>"; + var expire=($('#expire').val())?$('#expire').val():'Never' + html+="<td class='expire'>"+expire+"</td>" + html+="<td class='link'><a href='get.php?token="+token+"'>"+$('#baseUrl').val()+"?token="+token+"</a></td>" + html+="<td><button class='delete fancybutton' data-token='"+token+"'>Delete</button></td>" + html+="</tr>" + $(html).insertBefore($('#newlink_row')); + $('#expire').val(''); + $('#expire_time').val(''); + $('#path').val(''); + } + } + }); + }) +}); \ No newline at end of file diff --git a/apps/files_publiclink/lib_public.php b/apps/files_publiclink/lib_public.php new file mode 100644 index 0000000000000000000000000000000000000000..aeef9212377ad31a57f1dcf7273213d4c6a801cd --- /dev/null +++ b/apps/files_publiclink/lib_public.php @@ -0,0 +1,80 @@ +<?php +class OC_PublicLink{ + /** + * create a new public link + * @param string path + * @param int (optional) expiretime time the link expires, as timestamp + */ + public function __construct($path,$expiretime=0){ + if($path and OC_FILESYSTEM::file_exists($path) and OC_FILESYSTEM::is_readable($path)){ + $user=$_SESSION['user_id']; + $token=sha1("$user-$path-$expiretime"); + $query=OC_DB::prepare("INSERT INTO *PREFIX*publiclink VALUES(?,?,?,?)"); + $result=$query->execute(array($token,$path,$user,$expiretime)); + if( PEAR::isError($result)) { + $entry = 'DB Error: "'.$result->getMessage().'"<br />'; + $entry .= 'Offending command was: '.$result->getDebugInfo().'<br />'; + error_log( $entry ); + die( $entry ); + } + $this->token=$token; + } + } + + /** + * get the path of that shared file + */ + public static function getPath($token){ + //remove expired links + $query=OC_DB::prepare("DELETE FROM *PREFIX*publiclink WHERE expire_time < NOW() AND expire_time!=0"); + $query->execute(); + + //get the path and the user + $query=OC_DB::prepare("SELECT user,path FROM *PREFIX*publiclink WHERE token=?"); + $result=$query->execute(array($token)); + $data=$result->fetchAll(); + if(count($data)>0){ + $path=$data[0]['path']; + $user=$data[0]['user']; + + //prepare the filesystem + OC_UTIL::setupFS($user); + + return $path; + }else{ + return false; + } + } + + /** + * get the token for the public link + * @return string + */ + public function getToken(){ + return $this->token; + } + + /** + * gets all public links + * @return array + */ + static public function getLinks(){ + $query=OC_DB::prepare("SELECT * FROM *PREFIX*publiclink WHERE user=?"); + return $query->execute(array($_SESSION['user_id']))->fetchAll(); + } + + /** + * delete a public link + */ + static public function delete($token){ + $query=OC_DB::prepare("SELECT user,path FROM *PREFIX*publiclink WHERE token=?"); + $result=$query->execute(array($token))->fetchAll(); + if(count($result)>0 and $result[0]['user']==$_SESSION['user_id']){ + $query=OC_DB::prepare("DELETE FROM *PREFIX*publiclink WHERE token=?"); + $query->execute(array($token)); + } + } + + private $token; +} +?> \ No newline at end of file diff --git a/apps/files_publiclink/templates/admin.php b/apps/files_publiclink/templates/admin.php new file mode 100644 index 0000000000000000000000000000000000000000..2483eef321a09d22f339606a8f9daa83f918d839 --- /dev/null +++ b/apps/files_publiclink/templates/admin.php @@ -0,0 +1,28 @@ +<input type='hidden' id='baseUrl' value='<?php echo $_['baseUrl'];?>'/> +<table id='linklist'> + <thead> + <tr> + <td class='path'>Path</td> + <td class='expire'>Expires</td> + <td class='link'>Link</td> + </tr> + </thead> + <tbody> + <?php foreach($_['links'] as $link):?> + <tr class='link' id='<?php echo $link['token'];?>'> + <td class='path'><?php echo $link['path'];?></td> + <td class='expire'><?php echo ($link['expire_time']==0)?'Never':OC_UTIL::formatdate($link['expire_time'],true);?></td> + <td class='link'><a href='get.php?token=<?php echo $link['token'];?>'><?php echo $_['baseUrl'];?>?token=<?php echo $link['token'];?></a></td> + <td><button class='delete fancybutton' data-token='<?php echo $link['token'];?>'>Delete</button></td> + </tr> + <?php endforeach;?> + <tr id='newlink_row'> + <form action='#' id='newlink'> + <input type='hidden' id='expire_time'/> + <td class='path'><input placeholder='Path' id='path'/></td> + <td class='expire'><input placeholder='Expires' id='expire'/></td> + <td><input type='submit' value='Share'/></td> + </form> + </tr> + </tbody> +</table> \ No newline at end of file diff --git a/apps/files_publiclink/templates/breadcrumb.php b/apps/files_publiclink/templates/breadcrumb.php new file mode 100644 index 0000000000000000000000000000000000000000..733531d9e1095c86df8290e76374005d5cbc9b29 --- /dev/null +++ b/apps/files_publiclink/templates/breadcrumb.php @@ -0,0 +1,4 @@ + <a href="<?php echo link_to("files_publiclink", "get.php?token=".$_['token']); ?>"><img src="<?php echo image_path("", "actions/go-home.png"); ?>" alt="Root" /></a> + <?php foreach($_["breadcrumb"] as $crumb): ?> + <a href="<?php echo link_to("files_publiclink", "get.php?token=".$_['token']."&path=".$crumb["dir"]); ?>"><?php echo htmlspecialchars($crumb["name"]); ?></a> + <?php endforeach; ?> \ No newline at end of file diff --git a/apps/files_publiclink/templates/files.php b/apps/files_publiclink/templates/files.php new file mode 100644 index 0000000000000000000000000000000000000000..b4ae17656c3e12afff167c9e3128e26436f88c95 --- /dev/null +++ b/apps/files_publiclink/templates/files.php @@ -0,0 +1,9 @@ + <?php foreach($_["files"] as $file): ?> + <tr> + <td class="selection"><input type="checkbox" /></td> + <td class="filename"><a style="background-image:url(<?php if($file["type"] == "dir") echo mimetype_icon("dir"); else echo mimetype_icon($file["mime"]); ?>)" href="<?php if($file["type"] == "dir") echo link_to("files_publiclink", "get.php?token=".$_['token']."&path=".$file["directory"]."/".$file["name"]); else echo link_to("files_publiclink", "get.php?token=".$_['token']."&path=".$file["directory"]."/".$file["name"]); ?>" title=""><?php echo htmlspecialchars($file["name"]); ?></a></td> + <td class="filesize"><?php echo human_file_size($file["size"]); ?></td> + <td class="date"><?php if($file["type"] != "dir") echo $file["date"]; ?></td> + <td class="fileaction"><a href="" title=""><img src="images/drop-arrow.png" alt="+" /></a></td> + </tr> + <?php endforeach; ?> \ No newline at end of file diff --git a/apps/files_publiclink/templates/index.php b/apps/files_publiclink/templates/index.php new file mode 100644 index 0000000000000000000000000000000000000000..9e238452603d81d4cb125bd6d09a0554c8a8eaec --- /dev/null +++ b/apps/files_publiclink/templates/index.php @@ -0,0 +1,17 @@ +<p class="nav"> + <?php echo($_['breadcrumb']); ?> +</p> +<table cellspacing="0"> + <thead> + <tr> + <th><input type="checkbox" id="select_all" /></th> + <th>Name</th> + <th>Size</th> + <th>Modified</th> + <th></th> + </tr> + </thead> + <tbody id="fileList"> + <?php echo($_['fileList']); ?> + </tbody> +</table> \ No newline at end of file diff --git a/config/config.sample.php b/config/config.sample.php index dc1a62f46e3df25b55092cab65d33e4a5f82ae9d..5575340bc1be27455f72fcfdbcc8836dbd6bbc37 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -1,12 +1,15 @@ -<?php -$CONFIG_ADMINLOGIN='admin-username'; -$CONFIG_ADMINPASSWORD='password'; -$CONFIG_DATADIRECTORY='write/absolute-drectory/path/here/'; -$CONFIG_HTTPFORCESSL=false; -$CONFIG_DATEFORMAT='j M Y G:i'; -$CONFIG_DBHOST='localhost'; -$CONFIG_DBNAME='owncloud-db-name'; -$CONFIG_DBUSER='user-name'; -$CONFIG_DBPASSWORD='password'; -$CONFIG_DBTABLEPREFIX = 'oc_'; +<?php + +$CONFIG = array( +"installed" => false, +"dbtype" => "sqlite", +"dbname" => "owncloud", +"dbuser" => "", +"dbpassword" => "", +"dbhost" => "", +"dbtableprefix" => "", +"forcessl" => false, +"enablebackup" => false, +// "datadirectory" => "" +); ?> diff --git a/css/default.php b/css/default.php deleted file mode 100644 index 1c7e6e7beeb064a9fe0272570cb2679123fa90ce..0000000000000000000000000000000000000000 --- a/css/default.php +++ /dev/null @@ -1,521 +0,0 @@ -<?php -header('Content-Type: text/css'); -// calculate the documentroot -$SERVERROOT=substr(__FILE__,0,-16); -$DOCUMENTROOT=realpath($_SERVER['DOCUMENT_ROOT']); -$SERVERROOT=str_replace("\\",'/',$SERVERROOT); -$SUBURI=substr(realpath($_SERVER["SCRIPT_FILENAME"]),strlen($SERVERROOT)); -$WEBROOT=substr($_SERVER["SCRIPT_NAME"],0,strlen($_SERVER["SCRIPT_NAME"])-strlen($SUBURI)); -?> -html, body { - background-color: #F9F9F9; - margin: 0px; - height: 100%; - width: 100%; - position: absolute; - font-size: 100%; -} -#mainlayout{ - width:100%; - height:100%; -} - -#mainlayout>div{ - position:absolute; - width:100%; - left:0px; -} - -#mainlayout>.head{ - height:175px; - top:0px; -} - -#mainlayout>.body{ - vertical-align:top; - top:175px; - bottom:75px; - overflow:auto; -} - -#mainlayout>.foot{ - height:75px; - bottom:0px; -} - -#mainlayout>.foot>.bar{ - background-color:#EEE; - position:absolute; - top:0px; - height:24px; - width:100%; -} - -body.error {background-color: #F0F0F0;} -td.error{color:#FF0000; text-align:center} -body,th,td,ul,li,a,div,p,pre {color:#333333; font-family:Verdana,"Bitstream Vera Sans",Arial,Helvetica,Sans,"Bitstream Vera Serif"; font-size: 0.95em;} - -a img { - border:none; -} - -h1 { - margin-bottom:1.5em; -} - -.center { - text-align:center; -} - -.body>.center { - height:100%; - width:100%; -} - -.center * { - margin-left:auto; - margin-right:auto; -} - -td { - text-align:left; -} - -div#nav { - width:100%; - background-color: #EEEEEE; - padding:0px; - margin:0px; - position:absolute; - bottom:0px; -} - -a#owncloud-logo { - margin-left:auto; - margin-right:auto; - display:block; - width:200px; - height:99px; - background: transparent url(<?php if(isset($WEBROOT)) echo($WEBROOT); ?>/img/owncloud-logo-small.png) no-repeat scroll 0 0; -} - -a#owncloud-logo span { - display:none; -} - -td.nametext{ - position:relative; - display:block; -} - -.nametext a, .breadcrumb a{color:#333333; font-size: 0.8em; font-weight:bold; text-decoration:none;} -.errortext {color:#CC3333; font-size: 0.95em; font-weight:bold; text-decoration:none;} -.highlighttext {color:#333333; font-size: 0.95em; font-weight:bold; text-decoration:none;} -.datetext {color:#333333; font-size: 0.7em;} -.sizetext{ - color:#333333; - font-size: 0.7em; -} -.footer {color:#999999; text-align:center; font-size: 0.95em; margin-top:4em;} -.footer a {color:#999999; text-decoration:none;} -.hint {color:#AAAAAA; text-align:center; font-size: 0.8em; margin-top:10px;} -.hint a{color:#AAAAAA; text-align:center; font-size: 0.8em;} - -.formstyle { - font-weight:normal; - font-size: 0.8em; - color: #555555; - background-color: #FFFFFF; - border: 1px solid #DDDDDD; - padding:0px; - margin:0px; -} - -.loginform { - background-color: #EEEEEE; -} - -.browser { - background-color: #EEEEEE; -} - -.browserline { - background-color: #EEEEEE; -} - -.browserline:hover { - background-color: #DDDDDD; -} - - -.navigationitem1 { - background-color: #EEEEEE; - color:#555555; - font-size: 0.95em; - font-weight:bold; -} - -.navigationitem1 a{ - text-decoration:none; - padding-right:15px; - background: transparent url(<?php if(isset($WEBROOT)) echo($WEBROOT); ?>/img/dots.png) no-repeat scroll center right; -} - -.navigationitem1 img { - border:none; -} - -.navigationitem1:hover { - background-color: #EEEEEE; -} - -.navigationitem { - background-color: #EEEEEE; -} - -.navigationitem:hover { - background-color: #DDDDDD; -} - -.navigationselected td { - background-color: #DDDDDD; -} - -.navigationitem a { - text-decoration:none; - color: #333333; - font-size: 0.8em; -} - -.navigationitemselected a { - text-decoration:none; - color: #333333; - font-size: 0.8em; - font-weight:bold; -} - -.hidden{ - height:0px; - width:0px; - margin:0px; - padding:0px; - border:0px; - position:absolute; - top:0px; - left:0px; - overflow:hidden; - /*do not use display:none here, it breaks iframes in some browsers*/ -} - -div.OCNotification{ - background:#0c285a; - color:white; - border:white solid 1px; - padding:1px; - margin:4px; - min-width:200px; -} -div.OCNotificationHolder{ - right:20px; - bottom:0px; - position:fixed; - color:white; -} - -td img.file_actions{ - cursor:pointer; - height:0px; - width:9px; -} - -td.nametext:hover img.file_actions{ - height:auto; -} - -div.breadcrumb{ - background-color: #F0F0F0; -} - -div.fileactionlist{ - z-index:50; - position:absolute; - top:20px; - background-color: #DDDDDD; - margin-top:5px; - border:1px black solid; -} - -div.fileactionlist td{ - cursor:pointer; -} - -div.fileactionlist td:hover{ - background-color: #CCCCCC; -} - -tr.breadcrumb{ - background-color: #CCCCCC; -} - -#content, div.browser{ - vertical-align:top; - /*min-height:200px;*/ - height:100%; -} - -table.browser{ - border: solid 3px #CCC; - height:100%; - border-spacing:0px; -} - -table.browser thead, table.browser tfoot{ - background-color:#CCC; - width:100%; -} - -td.sizetext{ - width:110px; - text-align:right; -} - - -input.fileSelector{ - margin-right:17px; - float:left; -} - -td.fileSelector, td.fileicon{ - width:16px; -} - -span.upload{ - float:right; - text-align:right; - margin:0px; - padding:0px; -} - -table.browser>tbody{ - vertical-align:top; -} - -table.browser>tbody>tr>td, table.browser>tbody>tr{ - padding:0px; - /*height:100%;*/ -} - -div.fileList{ - width:800px; - overflow:auto; - vertical-align:top; - height:100%; - min-height:200px; - top:0px; -<!-- border-bottom: 3px solid #CCC; --> -} - -div.fileList table{ - width:100%; - vertical-align:top; -} - -table.browser thead td,table.browser tfoot td{ - padding-left:6px; - padding-top:0px; - padding-bottom:0px; -} - -#imageframe{ - position:absolute; - top:0px; - left:0px; - height:100%; - width:100%; - background:rgb(20,20,20); - background:rgba(20,20,20,0.9); - text-align:center; -} - -#imageframe img{ - vertical-align:middle; - max-height:90%; - max-width:90%; - margin:10px; - border: black solid 3px; -} - -tr.hint, tr.hint td{ - background:transparent; -} - -#debug{ - position:fixed; - bottom:20px; - left:20px; - border:solid 1px black; -} - -.dragClone{ - position:absolute; -} - -div.breadcrumb{ - float:left; - background:transparent; -} - -div.moreActionsButton>p{ - padding:0px; - margin:0px; - width:100%; - height:100%; -} - -div.moreActionsButton{ - background-color:white; - display:inline; - border:1px solid black; - cursor:pointer; - padding-right:10px; - text-align:right; - width:90px; - height:19px; - float:right; - margin-top:2px !important; - right:2px; - position:absolute; - background:#DDD url(<?php if(isset($WEBROOT)) echo($WEBROOT); ?>/img/arrow_up.png) no-repeat scroll center right; -} - -td.moreActionsButtonClicked{ - background:#DDD url(<?php if(isset($WEBROOT)) echo($WEBROOT); ?>/img/arrow_down.png) no-repeat scroll center right !important -} - -tr.utilityline{ - height:24px; -} - -td.actionsSelected{ - position:absolute; - width:790px; -} - -div.moreActionsList{ - background:#EEE; - position:absolute; - bottom:19px; - right:-2px; - border:1px solid black; - min-width:330px; - text-align:right; - float:right; -} - -div.moreActionsList input{ -<!-- float:right; --> -} - -div.moreActionsList>table{ - width:100%; -} - -div.moreActionsList td{ - width:300px; - text-align:right; - padding-top:3px !important; - padding-bottom:3px !important; -} - -div.moreActionsList tr:hover{ - background-color:#DDD; -} - -#settingsNav{ - background-color:#EEEEEE; - left:0px; - top:0px; - height:100%; - width:150px; - overflow:auto; - position:absolute; - text-align:left; -} - -#settingsNav ul{ - padding-left:20px; - padding-right:20px; -} - -#settingsHolder{ - left:150px; - margin:0px; - right:0px; - position:absolute; - overflow:auto; - height:100%; -} - -table.userlist, table.pluginlist{ - margin:0px; - padding:0px; - width:100%; - border-spacing:0px; -} - -table.userlist>thead, table.pluginlist>thead{ - background-color:#DDD; - font-weight:bold; -} - -table.userlist td.sellect{ - width:18px; -} - -table.userlist td.name{ - width:200px; -} - -p.description{ - background-color:#DDD; - margin:0px; - padding-top:3px; - padding-bottom:3px; - width:100%; - font-weight:bold; -} - -#newUserForm, #newGroupForm{ - width:100%; - padding-top:3px; - padding-bottom:3px; -} - -div.settingsContent{ - background-color:#F2F2F2; - min-height:100%; -} - -#sellectedUsersActions>form{ - display:inline; -} - -#sellectedUsersActions{ - margin:0px; - text-align:left; - background-color:#DDD; - width:100%; -} - -table.pluginlist td.name{ - width:150px; -} - -table.pluginlist td.disable{ - width:50px; -} - -table.pluginlist td.version{ - width:60px; - text-align:center -} \ No newline at end of file diff --git a/css/images/no.png b/css/images/no.png new file mode 100644 index 0000000000000000000000000000000000000000..fdc0f42125585d0c99e64deddc1e1aaade72a873 Binary files /dev/null and b/css/images/no.png differ diff --git a/css/images/ui-bg_diagonals-thick_90_eeeeee_40x40.png b/css/images/ui-bg_diagonals-thick_90_eeeeee_40x40.png new file mode 100644 index 0000000000000000000000000000000000000000..6348115e6be09c044cd20ead0202c3ab5b2f9c19 Binary files /dev/null and b/css/images/ui-bg_diagonals-thick_90_eeeeee_40x40.png differ diff --git a/css/images/ui-bg_flat_15_cd0a0a_40x100.png b/css/images/ui-bg_flat_15_cd0a0a_40x100.png new file mode 100644 index 0000000000000000000000000000000000000000..7680b5437cf820615e472dc4f9a18fd0ba8b7881 Binary files /dev/null and b/css/images/ui-bg_flat_15_cd0a0a_40x100.png differ diff --git a/css/images/ui-bg_glass_100_e4f1fb_1x400.png b/css/images/ui-bg_glass_100_e4f1fb_1x400.png new file mode 100644 index 0000000000000000000000000000000000000000..705a32ea35d4d0012bfd3b6a3ffe17a2aaf21bb5 Binary files /dev/null and b/css/images/ui-bg_glass_100_e4f1fb_1x400.png differ diff --git a/css/images/ui-bg_glass_50_3baae3_1x400.png b/css/images/ui-bg_glass_50_3baae3_1x400.png new file mode 100644 index 0000000000000000000000000000000000000000..baabca6baaff94ade4ecd5ddad28e35f52ea3af7 Binary files /dev/null and b/css/images/ui-bg_glass_50_3baae3_1x400.png differ diff --git a/css/images/ui-bg_glass_80_d7ebf9_1x400.png b/css/images/ui-bg_glass_80_d7ebf9_1x400.png new file mode 100644 index 0000000000000000000000000000000000000000..d9387e9507ef5b48483315affdcf7e69a6a5cbd1 Binary files /dev/null and b/css/images/ui-bg_glass_80_d7ebf9_1x400.png differ diff --git a/css/images/ui-bg_highlight-hard_100_f2f5f7_1x100.png b/css/images/ui-bg_highlight-hard_100_f2f5f7_1x100.png new file mode 100644 index 0000000000000000000000000000000000000000..28b566c2c29cc0f849995be62c10d7c292697803 Binary files /dev/null and b/css/images/ui-bg_highlight-hard_100_f2f5f7_1x100.png differ diff --git a/css/images/ui-bg_highlight-hard_70_000000_1x100.png b/css/images/ui-bg_highlight-hard_70_000000_1x100.png new file mode 100644 index 0000000000000000000000000000000000000000..d58829780430e138704e956a850c2913039fd4d9 Binary files /dev/null and b/css/images/ui-bg_highlight-hard_70_000000_1x100.png differ diff --git a/css/images/ui-bg_highlight-soft_100_deedf7_1x100.png b/css/images/ui-bg_highlight-soft_100_deedf7_1x100.png new file mode 100644 index 0000000000000000000000000000000000000000..2289d3c7d7b8e0892f5921de1af87a44b7059eb2 Binary files /dev/null and b/css/images/ui-bg_highlight-soft_100_deedf7_1x100.png differ diff --git a/css/images/ui-bg_highlight-soft_25_ffef8f_1x100.png b/css/images/ui-bg_highlight-soft_25_ffef8f_1x100.png new file mode 100644 index 0000000000000000000000000000000000000000..54aff0cb974c7bbde9bed3eb8a05c3b24f140965 Binary files /dev/null and b/css/images/ui-bg_highlight-soft_25_ffef8f_1x100.png differ diff --git a/css/images/ui-icons_2694e8_256x240.png b/css/images/ui-icons_2694e8_256x240.png new file mode 100644 index 0000000000000000000000000000000000000000..9d192c2f65905cc05b66db64ee396b66299e8fc5 Binary files /dev/null and b/css/images/ui-icons_2694e8_256x240.png differ diff --git a/css/images/ui-icons_2e83ff_256x240.png b/css/images/ui-icons_2e83ff_256x240.png new file mode 100644 index 0000000000000000000000000000000000000000..09d1cdc856c292c4ab6dd818c7543ac0828bd616 Binary files /dev/null and b/css/images/ui-icons_2e83ff_256x240.png differ diff --git a/css/images/ui-icons_3d80b3_256x240.png b/css/images/ui-icons_3d80b3_256x240.png new file mode 100644 index 0000000000000000000000000000000000000000..f13b206645b11f97fc59feaa18002b2002b118fa Binary files /dev/null and b/css/images/ui-icons_3d80b3_256x240.png differ diff --git a/css/images/ui-icons_72a7cf_256x240.png b/css/images/ui-icons_72a7cf_256x240.png new file mode 100644 index 0000000000000000000000000000000000000000..0d20b7308331069ee2950fa64cb15f4a29ca55f3 Binary files /dev/null and b/css/images/ui-icons_72a7cf_256x240.png differ diff --git a/css/images/ui-icons_ffffff_256x240.png b/css/images/ui-icons_ffffff_256x240.png new file mode 100644 index 0000000000000000000000000000000000000000..42f8f992c727ddaa617da224a522e463df690387 Binary files /dev/null and b/css/images/ui-icons_ffffff_256x240.png differ diff --git a/css/jquery-ui-1.8.10.custom.css b/css/jquery-ui-1.8.10.custom.css new file mode 100644 index 0000000000000000000000000000000000000000..1f376ca99d3a07f0bc8dee9007b8b4d58543af1d --- /dev/null +++ b/css/jquery-ui-1.8.10.custom.css @@ -0,0 +1,573 @@ +/* + * jQuery UI CSS Framework 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Theming/API + */ + +/* Layout helpers +----------------------------------*/ +.ui-helper-hidden { display: none; } +.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); } +.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } +.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } +.ui-helper-clearfix { display: inline-block; } +/* required comment for clearfix to work in Opera \*/ +* html .ui-helper-clearfix { height:1%; } +.ui-helper-clearfix { display:block; } +/* end clearfix */ +.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } + + +/* Interaction Cues +----------------------------------*/ +.ui-state-disabled { cursor: default !important; } + + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; } + + +/* Misc visuals +----------------------------------*/ + +/* Overlays */ +.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } + + +/* + * jQuery UI CSS Framework 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Theming/API + * + * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Lucida%20Grande,%20Lucida%20Sans,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=6px&bgColorHeader=deedf7&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=100&borderColorHeader=aed0ea&fcHeader=222222&iconColorHeader=72a7cf&bgColorContent=f2f5f7&bgTextureContent=04_highlight_hard.png&bgImgOpacityContent=100&borderColorContent=dddddd&fcContent=362b36&iconColorContent=72a7cf&bgColorDefault=d7ebf9&bgTextureDefault=02_glass.png&bgImgOpacityDefault=80&borderColorDefault=aed0ea&fcDefault=2779aa&iconColorDefault=3d80b3&bgColorHover=e4f1fb&bgTextureHover=02_glass.png&bgImgOpacityHover=100&borderColorHover=74b2e2&fcHover=0070a3&iconColorHover=2694e8&bgColorActive=3baae3&bgTextureActive=02_glass.png&bgImgOpacityActive=50&borderColorActive=2694e8&fcActive=ffffff&iconColorActive=ffffff&bgColorHighlight=ffef8f&bgTextureHighlight=03_highlight_soft.png&bgImgOpacityHighlight=25&borderColorHighlight=f9dd34&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=cd0a0a&bgTextureError=01_flat.png&bgImgOpacityError=15&borderColorError=cd0a0a&fcError=ffffff&iconColorError=ffffff&bgColorOverlay=eeeeee&bgTextureOverlay=08_diagonals_thick.png&bgImgOpacityOverlay=90&opacityOverlay=80&bgColorShadow=000000&bgTextureShadow=04_highlight_hard.png&bgImgOpacityShadow=70&opacityShadow=30&thicknessShadow=7px&offsetTopShadow=-7px&offsetLeftShadow=-7px&cornerRadiusShadow=8px + */ + + +/* Component containers +----------------------------------*/ +.ui-widget { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1.1em; } +.ui-widget .ui-widget { font-size: 1em; } +.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1em; } +.ui-widget-content { border: 1px solid #dddddd; background: #f2f5f7 url(images/ui-bg_highlight-hard_100_f2f5f7_1x100.png) 50% top repeat-x; color: #362b36; } +.ui-widget-content a { color: #362b36; } +.ui-widget-header { border: 1px solid #aed0ea; background: #deedf7 url(images/ui-bg_highlight-soft_100_deedf7_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; } +.ui-widget-header a { color: #222222; } + +/* Interaction states +----------------------------------*/ +.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #aed0ea; background: #d7ebf9 url(images/ui-bg_glass_80_d7ebf9_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #2779aa; } +.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #2779aa; text-decoration: none; } +.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #74b2e2; background: #e4f1fb url(images/ui-bg_glass_100_e4f1fb_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #0070a3; } +.ui-state-hover a, .ui-state-hover a:hover { color: #0070a3; text-decoration: none; } +.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #2694e8; background: #3baae3 url(images/ui-bg_glass_50_3baae3_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #ffffff; } +.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #ffffff; text-decoration: none; } +.ui-widget :active { outline: none; } + +/* Interaction Cues +----------------------------------*/ +.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #f9dd34; background: #ffef8f url(images/ui-bg_highlight-soft_25_ffef8f_1x100.png) 50% top repeat-x; color: #363636; } +.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; } +.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #cd0a0a url(images/ui-bg_flat_15_cd0a0a_40x100.png) 50% 50% repeat-x; color: #ffffff; } +.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #ffffff; } +.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #ffffff; } +.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; } +.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; } +.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; } + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_72a7cf_256x240.png); } +.ui-widget-content .ui-icon {background-image: url(images/ui-icons_72a7cf_256x240.png); } +.ui-widget-header .ui-icon {background-image: url(images/ui-icons_72a7cf_256x240.png); } +.ui-state-default .ui-icon { background-image: url(images/ui-icons_3d80b3_256x240.png); } +.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_2694e8_256x240.png); } +.ui-state-active .ui-icon {background-image: url(images/ui-icons_ffffff_256x240.png); } +.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); } +.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_ffffff_256x240.png); } + +/* positioning */ +.ui-icon-carat-1-n { background-position: 0 0; } +.ui-icon-carat-1-ne { background-position: -16px 0; } +.ui-icon-carat-1-e { background-position: -32px 0; } +.ui-icon-carat-1-se { background-position: -48px 0; } +.ui-icon-carat-1-s { background-position: -64px 0; } +.ui-icon-carat-1-sw { background-position: -80px 0; } +.ui-icon-carat-1-w { background-position: -96px 0; } +.ui-icon-carat-1-nw { background-position: -112px 0; } +.ui-icon-carat-2-n-s { background-position: -128px 0; } +.ui-icon-carat-2-e-w { background-position: -144px 0; } +.ui-icon-triangle-1-n { background-position: 0 -16px; } +.ui-icon-triangle-1-ne { background-position: -16px -16px; } +.ui-icon-triangle-1-e { background-position: -32px -16px; } +.ui-icon-triangle-1-se { background-position: -48px -16px; } +.ui-icon-triangle-1-s { background-position: -64px -16px; } +.ui-icon-triangle-1-sw { background-position: -80px -16px; } +.ui-icon-triangle-1-w { background-position: -96px -16px; } +.ui-icon-triangle-1-nw { background-position: -112px -16px; } +.ui-icon-triangle-2-n-s { background-position: -128px -16px; } +.ui-icon-triangle-2-e-w { background-position: -144px -16px; } +.ui-icon-arrow-1-n { background-position: 0 -32px; } +.ui-icon-arrow-1-ne { background-position: -16px -32px; } +.ui-icon-arrow-1-e { background-position: -32px -32px; } +.ui-icon-arrow-1-se { background-position: -48px -32px; } +.ui-icon-arrow-1-s { background-position: -64px -32px; } +.ui-icon-arrow-1-sw { background-position: -80px -32px; } +.ui-icon-arrow-1-w { background-position: -96px -32px; } +.ui-icon-arrow-1-nw { background-position: -112px -32px; } +.ui-icon-arrow-2-n-s { background-position: -128px -32px; } +.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; } +.ui-icon-arrow-2-e-w { background-position: -160px -32px; } +.ui-icon-arrow-2-se-nw { background-position: -176px -32px; } +.ui-icon-arrowstop-1-n { background-position: -192px -32px; } +.ui-icon-arrowstop-1-e { background-position: -208px -32px; } +.ui-icon-arrowstop-1-s { background-position: -224px -32px; } +.ui-icon-arrowstop-1-w { background-position: -240px -32px; } +.ui-icon-arrowthick-1-n { background-position: 0 -48px; } +.ui-icon-arrowthick-1-ne { background-position: -16px -48px; } +.ui-icon-arrowthick-1-e { background-position: -32px -48px; } +.ui-icon-arrowthick-1-se { background-position: -48px -48px; } +.ui-icon-arrowthick-1-s { background-position: -64px -48px; } +.ui-icon-arrowthick-1-sw { background-position: -80px -48px; } +.ui-icon-arrowthick-1-w { background-position: -96px -48px; } +.ui-icon-arrowthick-1-nw { background-position: -112px -48px; } +.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; } +.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; } +.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; } +.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; } +.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; } +.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; } +.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; } +.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; } +.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; } +.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; } +.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; } +.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; } +.ui-icon-arrowreturn-1-w { background-position: -64px -64px; } +.ui-icon-arrowreturn-1-n { background-position: -80px -64px; } +.ui-icon-arrowreturn-1-e { background-position: -96px -64px; } +.ui-icon-arrowreturn-1-s { background-position: -112px -64px; } +.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; } +.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; } +.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; } +.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; } +.ui-icon-arrow-4 { background-position: 0 -80px; } +.ui-icon-arrow-4-diag { background-position: -16px -80px; } +.ui-icon-extlink { background-position: -32px -80px; } +.ui-icon-newwin { background-position: -48px -80px; } +.ui-icon-refresh { background-position: -64px -80px; } +.ui-icon-shuffle { background-position: -80px -80px; } +.ui-icon-transfer-e-w { background-position: -96px -80px; } +.ui-icon-transferthick-e-w { background-position: -112px -80px; } +.ui-icon-folder-collapsed { background-position: 0 -96px; } +.ui-icon-folder-open { background-position: -16px -96px; } +.ui-icon-document { background-position: -32px -96px; } +.ui-icon-document-b { background-position: -48px -96px; } +.ui-icon-note { background-position: -64px -96px; } +.ui-icon-mail-closed { background-position: -80px -96px; } +.ui-icon-mail-open { background-position: -96px -96px; } +.ui-icon-suitcase { background-position: -112px -96px; } +.ui-icon-comment { background-position: -128px -96px; } +.ui-icon-person { background-position: -144px -96px; } +.ui-icon-print { background-position: -160px -96px; } +.ui-icon-trash { background-position: -176px -96px; } +.ui-icon-locked { background-position: -192px -96px; } +.ui-icon-unlocked { background-position: -208px -96px; } +.ui-icon-bookmark { background-position: -224px -96px; } +.ui-icon-tag { background-position: -240px -96px; } +.ui-icon-home { background-position: 0 -112px; } +.ui-icon-flag { background-position: -16px -112px; } +.ui-icon-calendar { background-position: -32px -112px; } +.ui-icon-cart { background-position: -48px -112px; } +.ui-icon-pencil { background-position: -64px -112px; } +.ui-icon-clock { background-position: -80px -112px; } +.ui-icon-disk { background-position: -96px -112px; } +.ui-icon-calculator { background-position: -112px -112px; } +.ui-icon-zoomin { background-position: -128px -112px; } +.ui-icon-zoomout { background-position: -144px -112px; } +.ui-icon-search { background-position: -160px -112px; } +.ui-icon-wrench { background-position: -176px -112px; } +.ui-icon-gear { background-position: -192px -112px; } +.ui-icon-heart { background-position: -208px -112px; } +.ui-icon-star { background-position: -224px -112px; } +.ui-icon-link { background-position: -240px -112px; } +.ui-icon-cancel { background-position: 0 -128px; } +.ui-icon-plus { background-position: -16px -128px; } +.ui-icon-plusthick { background-position: -32px -128px; } +.ui-icon-minus { background-position: -48px -128px; } +.ui-icon-minusthick { background-position: -64px -128px; } +.ui-icon-close { background-position: -80px -128px; } +.ui-icon-closethick { background-position: -96px -128px; } +.ui-icon-key { background-position: -112px -128px; } +.ui-icon-lightbulb { background-position: -128px -128px; } +.ui-icon-scissors { background-position: -144px -128px; } +.ui-icon-clipboard { background-position: -160px -128px; } +.ui-icon-copy { background-position: -176px -128px; } +.ui-icon-contact { background-position: -192px -128px; } +.ui-icon-image { background-position: -208px -128px; } +.ui-icon-video { background-position: -224px -128px; } +.ui-icon-script { background-position: -240px -128px; } +.ui-icon-alert { background-position: 0 -144px; } +.ui-icon-info { background-position: -16px -144px; } +.ui-icon-notice { background-position: -32px -144px; } +.ui-icon-help { background-position: -48px -144px; } +.ui-icon-check { background-position: -64px -144px; } +.ui-icon-bullet { background-position: -80px -144px; } +.ui-icon-radio-off { background-position: -96px -144px; } +.ui-icon-radio-on { background-position: -112px -144px; } +.ui-icon-pin-w { background-position: -128px -144px; } +.ui-icon-pin-s { background-position: -144px -144px; } +.ui-icon-play { background-position: 0 -160px; } +.ui-icon-pause { background-position: -16px -160px; } +.ui-icon-seek-next { background-position: -32px -160px; } +.ui-icon-seek-prev { background-position: -48px -160px; } +.ui-icon-seek-end { background-position: -64px -160px; } +.ui-icon-seek-start { background-position: -80px -160px; } +/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */ +.ui-icon-seek-first { background-position: -80px -160px; } +.ui-icon-stop { background-position: -96px -160px; } +.ui-icon-eject { background-position: -112px -160px; } +.ui-icon-volume-off { background-position: -128px -160px; } +.ui-icon-volume-on { background-position: -144px -160px; } +.ui-icon-power { background-position: 0 -176px; } +.ui-icon-signal-diag { background-position: -16px -176px; } +.ui-icon-signal { background-position: -32px -176px; } +.ui-icon-battery-0 { background-position: -48px -176px; } +.ui-icon-battery-1 { background-position: -64px -176px; } +.ui-icon-battery-2 { background-position: -80px -176px; } +.ui-icon-battery-3 { background-position: -96px -176px; } +.ui-icon-circle-plus { background-position: 0 -192px; } +.ui-icon-circle-minus { background-position: -16px -192px; } +.ui-icon-circle-close { background-position: -32px -192px; } +.ui-icon-circle-triangle-e { background-position: -48px -192px; } +.ui-icon-circle-triangle-s { background-position: -64px -192px; } +.ui-icon-circle-triangle-w { background-position: -80px -192px; } +.ui-icon-circle-triangle-n { background-position: -96px -192px; } +.ui-icon-circle-arrow-e { background-position: -112px -192px; } +.ui-icon-circle-arrow-s { background-position: -128px -192px; } +.ui-icon-circle-arrow-w { background-position: -144px -192px; } +.ui-icon-circle-arrow-n { background-position: -160px -192px; } +.ui-icon-circle-zoomin { background-position: -176px -192px; } +.ui-icon-circle-zoomout { background-position: -192px -192px; } +.ui-icon-circle-check { background-position: -208px -192px; } +.ui-icon-circlesmall-plus { background-position: 0 -208px; } +.ui-icon-circlesmall-minus { background-position: -16px -208px; } +.ui-icon-circlesmall-close { background-position: -32px -208px; } +.ui-icon-squaresmall-plus { background-position: -48px -208px; } +.ui-icon-squaresmall-minus { background-position: -64px -208px; } +.ui-icon-squaresmall-close { background-position: -80px -208px; } +.ui-icon-grip-dotted-vertical { background-position: 0 -224px; } +.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; } +.ui-icon-grip-solid-vertical { background-position: -32px -224px; } +.ui-icon-grip-solid-horizontal { background-position: -48px -224px; } +.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; } +.ui-icon-grip-diagonal-se { background-position: -80px -224px; } + + +/* Misc visuals +----------------------------------*/ + +/* Corner radius */ +.ui-corner-tl { -moz-border-radius-topleft: 6px; -webkit-border-top-left-radius: 6px; border-top-left-radius: 6px; } +.ui-corner-tr { -moz-border-radius-topright: 6px; -webkit-border-top-right-radius: 6px; border-top-right-radius: 6px; } +.ui-corner-bl { -moz-border-radius-bottomleft: 6px; -webkit-border-bottom-left-radius: 6px; border-bottom-left-radius: 6px; } +.ui-corner-br { -moz-border-radius-bottomright: 6px; -webkit-border-bottom-right-radius: 6px; border-bottom-right-radius: 6px; } +.ui-corner-top { -moz-border-radius-topleft: 6px; -webkit-border-top-left-radius: 6px; border-top-left-radius: 6px; -moz-border-radius-topright: 6px; -webkit-border-top-right-radius: 6px; border-top-right-radius: 6px; } +.ui-corner-bottom { -moz-border-radius-bottomleft: 6px; -webkit-border-bottom-left-radius: 6px; border-bottom-left-radius: 6px; -moz-border-radius-bottomright: 6px; -webkit-border-bottom-right-radius: 6px; border-bottom-right-radius: 6px; } +.ui-corner-right { -moz-border-radius-topright: 6px; -webkit-border-top-right-radius: 6px; border-top-right-radius: 6px; -moz-border-radius-bottomright: 6px; -webkit-border-bottom-right-radius: 6px; border-bottom-right-radius: 6px; } +.ui-corner-left { -moz-border-radius-topleft: 6px; -webkit-border-top-left-radius: 6px; border-top-left-radius: 6px; -moz-border-radius-bottomleft: 6px; -webkit-border-bottom-left-radius: 6px; border-bottom-left-radius: 6px; } +.ui-corner-all { -moz-border-radius: 6px; -webkit-border-radius: 6px; border-radius: 6px; } + +/* Overlays */ +.ui-widget-overlay { background: #eeeeee url(images/ui-bg_diagonals-thick_90_eeeeee_40x40.png) 50% 50% repeat; opacity: .80;filter:Alpha(Opacity=80); } +.ui-widget-shadow { margin: -7px 0 0 -7px; padding: 7px; background: #000000 url(images/ui-bg_highlight-hard_70_000000_1x100.png) 50% top repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/* + * jQuery UI Resizable 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Resizable#theming + */ +.ui-resizable { position: relative;} +.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;} +.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; } +.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; } +.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; } +.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; } +.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; } +.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; } +.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; } +.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; } +.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* + * jQuery UI Selectable 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Selectable#theming + */ +.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; } +/* + * jQuery UI Accordion 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Accordion#theming + */ +/* IE/Win - Fix animation bug - #4615 */ +.ui-accordion { width: 100%; } +.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; } +.ui-accordion .ui-accordion-li-fix { display: inline; } +.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; } +.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; } +.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; } +.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; } +.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; } +.ui-accordion .ui-accordion-content-active { display: block; } +/* + * jQuery UI Autocomplete 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Autocomplete#theming + */ +.ui-autocomplete { position: absolute; cursor: default; } + +/* workarounds */ +* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */ + +/* + * jQuery UI Menu 1.8.10 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Menu#theming + */ +.ui-menu { + list-style:none; + padding: 2px; + margin: 0; + display:block; + float: left; +} +.ui-menu .ui-menu { + margin-top: -3px; +} +.ui-menu .ui-menu-item { + margin:0; + padding: 0; + zoom: 1; + float: left; + clear: left; + width: 100%; +} +.ui-menu .ui-menu-item a { + text-decoration:none; + display:block; + padding:.2em .4em; + line-height:1.5; + zoom:1; +} +.ui-menu .ui-menu-item a.ui-state-hover, +.ui-menu .ui-menu-item a.ui-state-active { + font-weight: normal; + margin: -1px; +} +/* + * jQuery UI Button 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Button#theming + */ +.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */ +.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */ +button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */ +.ui-button-icons-only { width: 3.4em; } +button.ui-button-icons-only { width: 3.7em; } + +/*button text element */ +.ui-button .ui-button-text { display: block; line-height: 1.4; } +.ui-button-text-only .ui-button-text { padding: .4em 1em; } +.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; } +.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; } +.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; } +.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; } +/* no icon support for input elements, provide padding by default */ +input.ui-button { padding: .4em 1em; } + +/*button icon element(s) */ +.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; } +.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; } +.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; } +.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } +.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } + +/*button sets*/ +.ui-buttonset { margin-right: 7px; } +.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; } + +/* workarounds */ +button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */ +/* + * jQuery UI Dialog 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Dialog#theming + */ +.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; } +.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; } +.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; } +.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; } +.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; } +.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; } +.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; } +.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; } +.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; } +.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; } +.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; } +.ui-draggable .ui-dialog-titlebar { cursor: move; } +/* + * jQuery UI Slider 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Slider#theming + */ +.ui-slider { position: relative; text-align: left; } +.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; } +.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; } + +.ui-slider-horizontal { height: .8em; } +.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; } +.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; } +.ui-slider-horizontal .ui-slider-range-min { left: 0; } +.ui-slider-horizontal .ui-slider-range-max { right: 0; } + +.ui-slider-vertical { width: .8em; height: 100px; } +.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; } +.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } +.ui-slider-vertical .ui-slider-range-min { bottom: 0; } +.ui-slider-vertical .ui-slider-range-max { top: 0; }/* + * jQuery UI Tabs 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Tabs#theming + */ +.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */ +.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; } +.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; } +.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; } +.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; } +.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; } +.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */ +.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; } +.ui-tabs .ui-tabs-hide { display: none !important; } +/* + * jQuery UI Datepicker 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Datepicker#theming + */ +.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; } +.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; } +.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; } +.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; } +.ui-datepicker .ui-datepicker-prev { left:2px; } +.ui-datepicker .ui-datepicker-next { right:2px; } +.ui-datepicker .ui-datepicker-prev-hover { left:1px; } +.ui-datepicker .ui-datepicker-next-hover { right:1px; } +.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; } +.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; } +.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; } +.ui-datepicker select.ui-datepicker-month-year {width: 100%;} +.ui-datepicker select.ui-datepicker-month, +.ui-datepicker select.ui-datepicker-year { width: 49%;} +.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; } +.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; } +.ui-datepicker td { border: 0; padding: 1px; } +.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; } +.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; } +.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; } +.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; } + +/* with multiple calendars */ +.ui-datepicker.ui-datepicker-multi { width:auto; } +.ui-datepicker-multi .ui-datepicker-group { float:left; } +.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; } +.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; } +.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; } +.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; } +.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; } +.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; } +.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; } +.ui-datepicker-row-break { clear:both; width:100%; } + +/* RTL support */ +.ui-datepicker-rtl { direction: rtl; } +.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; } +.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; } +.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; } +.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; } +.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; } +.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; } +.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; } +.ui-datepicker-rtl .ui-datepicker-group { float:right; } +.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; } +.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; } + +/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */ +.ui-datepicker-cover { + display: none; /*sorry for IE5*/ + display/**/: block; /*sorry for IE5*/ + position: absolute; /*must have*/ + z-index: -1; /*must have*/ + filter: mask(); /*must have*/ + top: -4px; /*must have*/ + left: -4px; /*must have*/ + width: 200px; /*must have*/ + height: 200px; /*must have*/ +}/* + * jQuery UI Progressbar 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Progressbar#theming + */ +.ui-progressbar { height:2em; text-align: left; } +.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; } \ No newline at end of file diff --git a/css/small.php b/css/small.php deleted file mode 100644 index 60f79f51be18dc89351406cb4ae1035874f57a04..0000000000000000000000000000000000000000 --- a/css/small.php +++ /dev/null @@ -1,440 +0,0 @@ -<?php -header('Content-Type: text/css'); -require_once('../inc/lib_base.php'); -?> - -/* css used for devices with small screen such as smartphones */ -html,body { - background-color: #F9F9F9; - margin:0px; - height:100%; - width:100%; - position:absolute; -} -#mainlayout{ - width:100%; - height:100%; -} - -#mainlayout>div{ - position:absolute; - width:100%; - left:0px; -} - -#mainlayout>.head{ - height:24px; - top:0px; -} - -#mainlayout>.body{ - vertical-align:top; - top:24px; - bottom:24px; - overflow:auto; -} - -#mainlayout>.foot{ - height:24px; - bottom:0px; -} - -#mainlayout>.foot>.bar{ - background-color:#EEE; - position:absolute; - top:0px; - height:24px; - width:100%; -} - -body.error {background-color: #F0F0F0;} -td.error{color:#FF0000; text-align:center} -body,th,td,ul,li,a,div,p,pre {color:#333333; font-family:Verdana,"Bitstream Vera Sans",Arial,Helvetica,Sans,"Bitstream Vera Serif"; font-size:9.0pt;} - -a img { - border:none; -} - -h1 { - margin-bottom:1.5em; -} - -.center { - text-align:center; -} - -.center * { - margin-left:auto; - margin-right:auto; -} - -td { - text-align:left; -} - -div#nav { - width:100%; - background-color: #EEEEEE; - padding:0px; - margin:0px; - position:absolute; - bottom:0px; -} - -a#owncloud-logo { - margin-left:auto; - margin-right:auto; - display:block; - width:200px; - height:99px; - background: transparent url(<?php if(isset($WEBROOT)) echo($WEBROOT); ?>/img/owncloud-logo-small.png) no-repeat scroll 0 0; -} - -a#owncloud-logo span { - display:none; -} - -td.nametext{ - white-space:nowrap; - display:block; - position:relative; - /*overflow:hidden;*/ - text-overflow: ellipsis; -} -td.nametext>img{ - float:left; - display:box; -} -td.nametext>a{ - display:block; - max-width:95%; - float:left; - overflow:hidden; - text-overflow: ellipsis; -} -.nametext a, .breadcrumb a{color:#333333; font-size:8pt; font-weight:bold; text-decoration:none;} -.errortext {color:#CC3333; font-size:9pt; font-weight:bold; text-decoration:none;} -.highlighttext {color:#333333; font-size:9pt; font-weight:bold; text-decoration:none;} -.datetext {color:#333333; font-size:7pt;} -.sizetext{ - color:#333333; - font-size:7pt; -} -.footer {color:#999999; text-align:center; font-size:9pt; margin-top:4px;} -.footer a {color:#999999; text-decoration:none;} -.hint {color:#AAAAAA; text-align:center; font-size:8pt; margin-top:10px;} -.hint a{color:#AAAAAA; text-align:center; font-size:8pt;} - -.formstyle { - font-weight:normal; - font-size: 8.0pt; - color: #555555; - background-color: #FFFFFF; - border: 1px solid #DDDDDD; - padding:0px; - margin:0px; -} - -.loginform { - background-color: #EEEEEE; -} - -.browser { - width:100%; - table-layout:fixed; - background-color: #EEEEEE; -} - -.browserline { - background-color: #EEEEEE; -} - -.browserline:hover { - background-color: #DDDDDD; -} - - -.navigationitem1 { - background-color: #EEEEEE; - color:#555555; - font-size:9pt; - font-weight:bold; -} - -.navigationitem1 a{ - text-decoration:none; -} - -.navigationitem1 img { - border:none; -} - -.navigationitem1:hover { - background-color: #EEEEEE; -} - -.navigationitem { - background-color: #EEEEEE; -} - -.navigationitem:hover { - background-color: #DDDDDD; -} - -.navigationselected td { - background-color: #DDDDDD; -} - -.navigationitem a { - text-decoration:none; - color: #333333; - font-size: 8.0pt; -} - -.navigationitemselected a { - text-decoration:none; - color: #333333; - font-size: 8.0pt; - font-weight:bold; -} - -.hidden{ - height:0px; - width:0px; - margin:0px; - padding:0px; - border:0px; - position:absolute; - top:0px; - left:0px; - overflow:hidden; - /*do not use display:none here, it breaks iframes in some browsers*/ -} - -div.OCNotification{ - background:#0c285a; - color:white; - border:white solid 1px; - padding:1px; - margin:4px; - min-width:200px; -} -div.OCNotificationHolder{ - right:20px; - bottom:0px; - position:fixed; - color:white; -} - -td img.file_actions{ - cursor:pointer; - height:0px; - width:9px; -} - -td.nametext:hover img.file_actions{ - height:auto; -} - -div.breadcrumb{ - background-color: #F0F0F0; -} - -div.fileactionlist{ - z-index:100; - position:absolute; - background-color: #DDDDDD; - margin-top:5px; - border:1px black solid; -} - -div.fileactionlist td{ - cursor:pointer; -} - -div.fileactionlist td:hover{ - background-color: #CCCCCC; -} - -tr.breadcrumb{ - background-color: #CCCCCC; -} - -#content, div.browser{ - vertical-align:top; - /*min-height:200px;*/ - height:100%; -} - -table.browser{ - border: solid 3px #CCC; - height:100%; - border-spacing:0px; -} - -table.browser thead, table.browser tfoot{ - background-color:#CCC; - width:100%; -} - -td.sizetext{ - width:70px; - float:right; - text-align:right; -} - - -input.fileSelector{ - margin-right:17px; - float:left; -} - -td.fileSelector, td.fileicon{ - width:20px; -} - -span.upload{ - float:right; - text-align:right; - margin:0px; - padding:0px; -} - -table.browser>tbody{ - vertical-align:top; -} - -table.browser>tbody>tr>td, table.browser>tbody>tr{ - padding:0px; - /*height:100%;*/ -} - -div.fileList{ - width:100%; - position:relative; - overflow:hidden; - vertical-align:top; - height:100%; - min-height:150px; - top:0px; -} - -div.fileactionlist table{ - table-layout:auto !important; -} - -div.fileList table{ - width:100%; - table-layout:fixed; - vertical-align:top; -} - -table.browser thead td,table.browser tfoot td{ - padding-left:6px; - padding-top:0px; - padding-bottom:0px; -} - -#imageframe{ - position:absolute; - top:0px; - left:0px; - height:100%; - width:100%; - background:rgb(20,20,20); - background:rgba(20,20,20,0.9); - text-align:center; -} - -#imageframe img{ - vertical-align:middle; - max-height:90%; - max-width:90%; - margin:10px; - border: black solid 3px; -} - -tr.hint, tr.hint td{ - background:transparent; -} - -#debug{ - position:fixed; - bottom:20px; - left:20px; - border:solid 1px black; -} - -.dragClone{ - position:absolute; -} - -div.breadcrumb{ - float:left; - background:transparent; -} - -div.moreActionsButton>p{ - padding:0px; - margin:0px; - width:100%; - height:100%; -} - -div.moreActionsButton{ - background-color:white; - display:inline; - border:1px solid black; - cursor:pointer; - padding-right:10px; - text-align:right; - width:90px; - height:19px; - float:right; - margin-top:2px !important; - right:2px; - position:absolute; - background:#DDD url(<?php if(isset($WEBROOT)) echo($WEBROOT); ?>/img/arrow_up.png) no-repeat scroll center right; -} - -td.moreActionsButtonClicked{ - background:#DDD url(<?php if(isset($WEBROOT)) echo($WEBROOT); ?>/img/arrow_down.png) no-repeat scroll center right !important -} - -tr.utilityline{ - height:24px; -} - -td.actionsSelected{ -<!-- position:absolute; --> -<!-- width:790px; --> -} - -div.moreActionsList{ - background:#EEE; - position:absolute; - bottom:19px; - right:-2px; - border:1px solid black; - text-align:right; - float:right; -} - -div.moreActionsList input{ -<!-- float:right; --> -} - -div.moreActionsList>table{ - width:100%; -} - -div.moreActionsList td{ - width:300px; - text-align:right; - padding-top:3px !important; - padding-bottom:3px !important; -} - -div.moreActionsList tr:hover{ - background-color:#DDD; -} \ No newline at end of file diff --git a/css/styles.css b/css/styles.css new file mode 100644 index 0000000000000000000000000000000000000000..2790c5c04923e500811f82abb28924a3539bfc24 --- /dev/null +++ b/css/styles.css @@ -0,0 +1,277 @@ +* { margin:0; padding:0; border:0; } +body { background:#fefefe url('../img/body_background.jpg') repeat-y left top; font:normal 80%/1.6em "Lucida Grande", Arial, Verdana, sans-serif; color:#000; } +#header { position:fixed; top:0; z-index:100; width:100%; height:5.5em; padding:0.5em 1.5em; background:url('../img/header-a.png') repeat-x left top; } +#body-settings #header { background-image:url('../img/header-settings-a.png'); } +#owncloud { float:left; margin:0 0 0 2em; } +h1 { margin:1em 3em 1em 0; border-bottom:1px solid #666; text-transform:uppercase; font-weight:normal; font-style:italic; color:#666; } +p.center { text-align:center; } + +form { margin:2em 2em 2em 3em; } +form#quota { max-width:600px; } +form#user_settings { max-width:600px; } +form#user_settings p label { display:block; float:left; width:35%; padding:0.4em 0.5em 0 0; text-align:right; } +form p { padding:0.5em 4em 0.5em 0.5em; text-align:left; } +form p.form_footer { margin:1em 0 0 0; text-align:right; } +form label { cursor:pointer; } +form input { padding:0.2em; border:1px solid #ddd; font-size:1.2em; } +form input[type="submit"] { padding:0.1em 1em; border:1px solid #999; font-weight:bold; font-size:0.9em; cursor:pointer; } +form input[type="submit"]:hover, form input[type="submit"]:focus { border:1px solid #999; background-color:#999; outline:0; } +form input[type="submit"]:active { outline:0; } +fieldset { padding:1em; background-color:#f7f7f7; border:1px solid #ddd; } +legend { padding:0 0.5em; font-size:1.2em; } + +div.controls { width:91%; margin:1em 1em 1em 2em; padding:0.5em 0; background-color:#f7f7f7; border:1px solid #eee; } + +/* LOG IN & INSTALLATION ------------------------------------------------------------ */ +#body-login { width:100%; background-image:none; background-color:#ddd; } +#body-login p.info { width:16em; margin:4em auto; padding:1em; background-color:#eee; border:1px solid #ccc; -moz-border-radius:10px; -webkit-border-radius:10px; border-radius:10px; } + +#login +{ + margin: 0 auto 0 auto; + padding: 2em 0 0 0; + background-image: url(../img/header-login.png); + background-position: left 0; + background-repeat: repeat-x; + background-color: #EEE; + border-bottom: 1px solid #FFF; + text-align: center; +} + +#login_form +{ + width: 20em; + margin: 4em auto; + padding: 0; +} + +#login_form fieldset +{ + background-color: transparent; + border: 0; +} + +#login_form fieldset p +{ + margin: 0.5em 0 0 0; + padding: 0; + text-align: left; +} + +#login_form fieldset p.submit +{ + margin: 2em 0 0 0; + padding: 1em 0 0 0; + border-top: 1px solid #DDD; + text-align: right; +} + +#login_form label +{ + font-size: 1em; + color: #666; +} + +#login_form input +{ + width: 100%; + margin: 0 0 0.5em 0; + padding: 0.5em; + border: 1px solid #DDD; + -moz-border-radius: 15px; + -webkit-border-radius: 15px; + border-radius: 15px; + font-size: 1.5em; + color: #333; + text-align: center; +} + +#login_form input[type=submit] +{ + width: auto; + margin: 1em 0 0 0.5em; + text-align: center; + border: 1px solid #DDD; + background-color: #FFF; + -moz-border-radius: 15px; + -webkit-border-radius: 15px; + border-radius: 15px; + font-size: 1.5em +} + +#login_form input[type=submit]:hover +{ + border: 1px solid #666; + background-color: #666; + color: #FFF; +} + + +#setup_form { + margin: 3em auto; + text-align: left; + width: 720px; +} + +#setup_form #use_mysql { + font-size: 0.9em; + margin: 0 0 0 1em; +} + +#setup_form p.intro { + color: #666; + font-size: 1.3em; + margin: 4em 0 3em 0; + padding: 0; + text-align: center; +} + +#setup_form ul.errors { + background-image: url(images/no.png); + background-position: 1em 1em; + background-repeat: no-repeat; + background-color: #FED7D7; + border: 1px solid #F00; + font-size: 1.2em; + list-style-indent: inside; + margin: 0 0 4em 0; + padding: 1em 1em 1em 5em; +} + +#setup_form fieldset { + margin: 0 0 3em 0; +} + +#setup_form p { + line-height: 1.8em; +} + +#setup_form legend { + font-weight: normal; +} + +#setup_form label { + cursor: pointer; + display: block; + float: left; + margin: 0 0 0.2em 0; + text-align: right; + width: 40%; +} + +#setup_form input[type='text'], +#setup_form input[type='password'] { + font-size: 1em; + margin: 0 0 0 0.5em; + padding: 0.3em; +} + +#setup_form input[type='radio'] { + margin: 0 0 0 1em; +} + +#setup_form input[type='submit'] { + background-color: #DDD; + border: 1px solid #999; + color: #666; + font-size: 1.2em; +} + +#setup_form input[type='submit']:hover { + border-color: #000; + color: #000; +} + +#setup_form p.submit { + padding: 0 0 1em 0; + text-align: center; +} + + + +.prettybutton { margin:0.1em; padding:0.2em 0.5em; border:1px solid #ddd; -moz-border-radius:15px; -webkit-border-radius:15px; border-radius:15px; font-size:1.5em; text-decoration:none; color:#666; background-color:#fff; } +.prettybutton:hover, .prettybutton:focus { background-color:#ccc; outline:0; } + +/* META NAVIGATION (Settings, Log out) ---------------------------------------------------------------- */ +#metanav { float:right; position:relative; top:1.5em; right:2.5em; list-style:none; margin:0; padding:0; } +#metanav li { display:inline; } +#metanav li a { margin:.1em; padding:1em; } +#metanav li a:hover, #metanav li a:focus { background:rgba(0,0,0,.5); -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; outline:0; box-shadow:#555 0 1px 0; -moz-box-shadow:#555 0 1px 0; -webkit-box-shadow:#555 0 1px 0; } +#metanav li a img { vertical-align:middle; } + +/* NAVIGATION ------------------------------------------------------------- */ +#plugins { position:fixed; top:7em; float:left; width:15.7em; padding:0; } +#plugins ul { list-style-type:none; border-top:1px solid #ccc; } +#plugins a { display:block; padding:0.5em 0.5em 0.5em 3em; background-position:1.5em center; background-repeat:no-repeat; border-bottom:1px solid #ddd; border-top:1px solid #fff; text-decoration:none; font-size:1.2em; color:#666; } +#plugins a.active, #plugins a:hover, #plugins a:focus, #plugins a.selected { background-color:#ccc; border-top:1px solid #ccc; border-bottom:1px solid #ccc; color:#000; outline:0; } +#plugins a:active { outline:0; } + +/* CONTENT ------------------------------------------------------------------ */ +#content { margin:7em 0 0 16em; } +table { margin:1em 5em 2em 3em; } +table tr.mouseOver td { background-color:#eee; } +table th, table td { padding:0; border-bottom:1px solid #ddd; text-align:left; font-style:italic; } +table th { padding:0.5em; } +table td { border-bottom:1px solid #eee; font-style:normal; } +table td.filesize, table td.date { width:5em; padding:0.5em 1em; text-align:right; } +table td.date { width:11em; } +table td.selection, table th.selection, table td.fileaction { width:2em; text-align:center; } +table td.filename a { display:block; background-image:url('../img/file.png'); text-decoration:none; } +table td.filename a, table td.login, table td.logout, table td.download, table td.upload, table td.create, table td.delete { padding:0.5em 0.5em 0.5em 3em; background-position:1em center; background-repeat:no-repeat; } +table td.filename a:hover, table td.filename a:focus { text-decoration:underline; outline:0; } +table td.filename a:active { outline:0; } +table em { font-weight:bold; } +table td.filename a.folder-up { background-image:url('../img/back.png'); font-style:italic; } +table td.filename a.folder { background-image:url('../img/folder.png'); } +table td.filename a.folder-home { background-image:url('../img/home.png'); } +table td.filename a.folder-music { background-image:url('../img/folder-music.png'); } +table td.filename a.folder-videos { background-image:url('../img/folder-video.png'); } +table td.filename a.folder-shared { background-image:url('../img/folder-shared.png'); } +table td.filename a.folder-images { background-image:url('../img/folder-image.png'); } +table td.filename a.file-txt { background-image:url('../img/file-txt.png'); } +table td.filename a.file-python { background-image:url('../img/file-python.png'); } +table td.filename a.file-php { background-image:url('../img/file.png'); } +table td.login { background-image:url('../img/login.png'); } +table td.logout { background-image:url('../img/logout.png'); } +table td.download { background-image:url('../img/download.png'); } +table td.upload { background-image:url('../img/upload.png'); } +table td.create { background-image:url('../img/folder-new.png'); } +table td.delete { background-image:url('../img/delete.png'); } +#fileList tr input[type=checkbox] { display:none; } +#fileList tr input[type=checkbox]:checked { display:inline; } +#fileList tr:hover input[type=checkbox] { display:inline; } + +/* NAVIGATION BAR */ +p.nav { margin:1em 0 0 2em; padding:0.8em; line-height:16px; font-weight:bold; } +p.nav a { padding:0.5em 1.5em 0.5em 0.5em; background-position:right center; background-repeat:no-repeat; background-image:url('../img/arrow.png'); text-decoration:none; } +p.nav a img { height:16px; vertical-align:text-top; } + +/* ACTIONS BAR */ +p.actions, div.actions { padding:0; } +p.actions a, div.actions a { padding:0.5em 0.5em 0.5em 3em; background-position:1em center; background-repeat:no-repeat; background-image:url('../img/action.png'); border-right:1px solid #eee; text-decoration:none; color:#333; } +p.actions a:hover, p.actions a:focus, div.actions a:hover, div.actions a:focus { background-color:#eee; color:#000; outline:0; } +p.actions a:active, div.actions a:active { outline:0; } +p.actions a.new-dir, div.actions a.new-dir { background-image:url('../img/folder-new.png'); } +p.actions a.download, div.actions a.download { background-image:url('../img/download.png'); } +p.actions a.delete, div.actions a.delete { background-image:url('../img/delete.png'); } + +/* USER SETTINGS ------------------------------------------------------------ */ +#quota_indicator { margin:0 4em 1em 0; padding:0; border:1px solid #ddd; border-radius:10px; -webkit-border-radius:10px; -moz-border-radius:10px; } +#quota_indicator div { background-color:#76A9EA; border-radius:10px; -webkit-border-radius:10px; -moz-border-radius:10px; } + +/* PAGER ------------------------------------------------------------ */ +.pager tr td { border-bottom:0px; } +.pager tr td a { text-decoration:none; color:#666666; font-size:0.9em; text-align:center; } + +/* LOGS --------------------------------------------------------------------- */ +#logs_options { width:auto; margin:0; } +#logs_options p { padding:0.5em; text-align:left; } +#logs_options span { margin:0 2em 0 0.5em; font-weight:bold; } +#logs_options label { margin:0 1em 0 0; } +#logs_options input[type="submit"] { float:right; margin:0 2em 0 0; } +#logs_options input[type="text"] { margin:0; padding:0; border:1px solid #ccc; text-align:right; } +li.error{ list-style:none; width:640px; margin:4em auto; padding:1em 1em 1em 4em; background-color:#fee; background-image:url('../img/task-attention.png'); background-position:0.8em 0.8em; background-repeat:no-repeat; border:1px solid #ccc; -moz-border-radius:10px; -webkit-border-radius:10px; border-radius:10px; } + +/* SEARCH --------------------------------------------------------------------- */ +form.searchbox{display:inline; position:fixed; top:1.5em; right:9em; margin:0; padding:0;}; +form.searchbox .prettybutton{font-size:1.5em !important}; \ No newline at end of file diff --git a/db_structure.xml b/db_structure.xml index 936afa43290eb8324e826beefe871a0c2dfc4b7f..599352c2a8dd22f507ec9f610ceafd8bd9f0543e 100644 --- a/db_structure.xml +++ b/db_structure.xml @@ -1,72 +1,115 @@ <?xml version="1.0" encoding="ISO-8859-1" ?> <database> - <name>*dbname*</name> + <name>*dbname*</name> <create>true</create> <overwrite>false</overwrite> - <charset>latin1</charset> + <charset>utf8</charset> <table> - <name>*dbprefix*privatedata</name> - <declaration> - <field> - <name>key</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - <field> - <name>app</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - <field> - <name>value</name> - <type>blob</type> - <length>65532</length> - <notnull>false</notnull> - </field> - <field> - <name>timestamp</name> - <type>timestamp</type> - <notnull>true</notnull> - </field> - <index> - <name>appkey</name> - <unique>true</unique> - <field> - <name>key</name> - <sorting>ascending</sorting> - </field> - <field> - <name>app</name> - <sorting>ascending</sorting> - </field> - </index> - </declaration> + + <name>*dbprefix*appconfig</name> + + <declaration> + + <field> + <name>appid</name> + <type>text</type> + <default></default> + <notnull>true</notnull> + <length>255</length> + </field> + + <field> + <name>configkey</name> + <type>text</type> + <default></default> + <notnull>true</notnull> + <length>255</length> + </field> + + <field> + <name>configvalue</name> + <type>text</type> + <default></default> + <notnull>true</notnull> + <length>255</length> + </field> + + </declaration> + </table> <table> - <name>*dbprefix*groups</name> + <name>*dbprefix*foldersize</name> <declaration> <field> - <name>group_id</name> + <name>path</name> + <type>text</type> + <default></default> + <notnull>true</notnull> + <length>128</length> + </field> + + <field> + <name>size</name> <type>integer</type> - <default>0</default> + <default></default> <notnull>true</notnull> - <autoincrement>1</autoincrement> <length>4</length> </field> + <index> + <name>foldersize_pKey</name> + <primary>true</primary> + <field> + <name>path</name> + <sorting>ascending</sorting> + </field> + </index> + + </declaration> + + </table> + + <table> + + <name>*dbprefix*group_user</name> + + <declaration> + + <field> + <name>gid</name> + <type>text</type> + <default></default> + <notnull>true</notnull> + <length>64</length> + </field> + + <field> + <name>uid</name> + <type>text</type> + <default></default> + <notnull>true</notnull> + <length>64</length> + </field> + + </declaration> + + </table> + + <table> + + <name>*dbprefix*groups</name> + + <declaration> + <field> - <name>group_name</name> + <name>gid</name> <type>text</type> <default></default> <notnull>true</notnull> @@ -74,10 +117,10 @@ </field> <index> - <name>group_name</name> - <unique>true</unique> + <name>groups_pKey</name> + <primary>true</primary> <field> - <name>group_name</name> + <name>gid</name> <sorting>ascending</sorting> </field> </index> @@ -88,7 +131,7 @@ <table> - <name>*dbprefix*locks</name> + <name>*dbprefix*locks</name> <declaration> @@ -164,6 +207,14 @@ <length>4</length> </field> + <index> + <name>path</name> + <field> + <name>path</name> + <sorting>ascending</sorting> + </field> + </index> + <index> <name>path_2</name> <field> @@ -216,7 +267,7 @@ <table> - <name>*dbprefix*log</name> + <name>*dbprefix*log</name> <declaration> @@ -226,15 +277,23 @@ <default>0</default> <notnull>true</notnull> <autoincrement>1</autoincrement> + <unsigned>true</unsigned> <length>4</length> </field> <field> - <name>timestamp</name> - <type>integer</type> + <name>moment</name> + <type>timestamp</type> + <default>0000-00-00 00:00:00</default> + <notnull>true</notnull> + </field> + + <field> + <name>appid</name> + <type>text</type> <default></default> <notnull>true</notnull> - <length>4</length> + <length>255</length> </field> <field> @@ -242,23 +301,63 @@ <type>text</type> <default></default> <notnull>true</notnull> - <length>250</length> + <length>255</length> + </field> + + <field> + <name>action</name> + <type>text</type> + <default></default> + <notnull>true</notnull> + <length>255</length> </field> <field> - <name>type</name> - <type>integer</type> + <name>info</name> + <type>clob</type> + <notnull>true</notnull> + </field> + + </declaration> + + </table> + + <table> + + <name>*dbprefix*preferences</name> + + <declaration> + + <field> + <name>userid</name> + <type>text</type> <default></default> <notnull>true</notnull> - <length>4</length> + <length>255</length> + </field> + + <field> + <name>appid</name> + <type>text</type> + <default></default> + <notnull>true</notnull> + <length>255</length> + </field> + + <field> + <name>configkey</name> + <type>text</type> + <default></default> + <notnull>true</notnull> + <length>255</length> </field> <field> - <name>message</name> + <name>configvalue</name> <type>text</type> <default></default> <notnull>true</notnull> - <length>250</length> + <length>255</length> </field> </declaration> @@ -267,7 +366,7 @@ <table> - <name>*dbprefix*properties</name> + <name>*dbprefix*properties</name> <declaration> @@ -301,14 +400,6 @@ <notnull>false</notnull> </field> - <index> - <name>path</name> - <field> - <name>path</name> - <sorting>ascending</sorting> - </field> - </index> - <index> <name>properties_pKey</name> <primary>true</primary> @@ -332,64 +423,12 @@ <table> - <name>*dbprefix*user_group</name> + <name>*dbprefix*users</name> <declaration> <field> - <name>user_group_id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <autoincrement>1</autoincrement> - <length>4</length> - </field> - - <field> - <name>user_id</name> - <type>integer</type> - <default></default> - <notnull>true</notnull> - <length>4</length> - </field> - - <field> - <name>group_id</name> - <type>integer</type> - <default></default> - <notnull>true</notnull> - <length>4</length> - </field> - - </declaration> - - </table> - - <table> - - <name>*dbprefix*users</name> - - <declaration> - - <field> - <name>user_id</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - <autoincrement>1</autoincrement> - <length>4</length> - </field> - - <field> - <name>user_name</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - - <field> - <name>user_name_clean</name> + <name>uid</name> <type>text</type> <default></default> <notnull>true</notnull> @@ -397,22 +436,18 @@ </field> <field> - <name>user_password</name> + <name>password</name> <type>text</type> <default></default> <notnull>true</notnull> - <length>340</length> + <length>255</length> </field> <index> - <name>user_name</name> - <unique>true</unique> - <field> - <name>user_name</name> - <sorting>ascending</sorting> - </field> + <name>users_pKey</name> + <primary>true</primary> <field> - <name>user_name_clean</name> + <name>uid</name> <sorting>ascending</sorting> </field> </index> diff --git a/docs/FAQs b/docs/FAQs deleted file mode 100644 index f1e6149c48c14982467e085b026f3f4f1d2022cd..0000000000000000000000000000000000000000 --- a/docs/FAQs +++ /dev/null @@ -1,8 +0,0 @@ -1. I am not able to upload large files. Is that not supported by ownCloud? - Ofcourse it is supported. The problem lies with the PHP configuration. If you have access to php.ini file (which resides in /etc/php5/apache2 folder) then you can fix this issue by changing the following lines : - ; Maximum allowed size for uploaded files. - upload_max_filesize = 2M - - Also look for the following line: - post_max_size= 2M - In place of 2M write the maximum size you want to be allowed. \ No newline at end of file diff --git a/docs/INSTALL b/docs/INSTALL deleted file mode 100644 index 970af77574c14716dec586ccf41e8762ed51a805..0000000000000000000000000000000000000000 --- a/docs/INSTALL +++ /dev/null @@ -1,30 +0,0 @@ -also see http://owncloud.org/index.php/Installation - -== PREREQUISITS == -php5 -sqlite or mysql - -== SETUP == -Place owncloud in a subdirectory of your web server. Go to that directory with -a web browser and the first run wizard should take it from there. -Check out config/config.sample.php for details if you want to set config.php manually. - -== Database == ---SQLite-- -When sqlite is chosen. If you are having trouble make sure that the line - -extension=sqlite.so - -appears in your php.ini - ---MySQL-- -when mysql is chosen, you can let ownCloud create the database and user when you have administrator credentials for mysql. - - -Please help improving this documentation! -Create merge requests at gitorious.org/owncloud . - -Read the FAQs for some common problems. -For support check out our IRC at Freenode : Channel #owncloud -Mailing list at https://mail.kde.org/mailman/listinfo/owncloud - diff --git a/docs/TODO b/docs/TODO index 0bbca7c2dab9cd84794146fc66024507df46f37c..1165ed7e72a6a5fa46aff7de098b32c310459567 100644 --- a/docs/TODO +++ b/docs/TODO @@ -1,16 +1,2 @@ -- internationalizing of the web gui - -- themed webgui to match plasma theme - -- plugin system - - store kde settings - - store my music collection - - integration with kolab server - -- create a versioning backend - -- create a usermanagement to share data - - - - +Database: + - Stored procedures! diff --git a/docs/owncloud.sql b/docs/owncloud.sql index 94e500bf00414ce2fcb10c00b51fc2ba165a773a..bef528596fb5d7d0ddd87c26f24a5528cda25676 100644 --- a/docs/owncloud.sql +++ b/docs/owncloud.sql @@ -1,3 +1,80 @@ +-- phpMyAdmin SQL Dump +-- version 3.3.7deb5 +-- http://www.phpmyadmin.net +-- +-- Host: localhost +-- Erstellungszeit: 16. April 2011 um 10:40 +-- Server Version: 5.1.49 +-- PHP-Version: 5.3.3-7+squeeze1 + +SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; + +-- +-- Datenbank: `owncloud` +-- + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `appconfig` +-- + +CREATE TABLE IF NOT EXISTS `appconfig` ( + `appid` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `configkey` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `configvalue` varchar(255) COLLATE utf8_unicode_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Daten für Tabelle `appconfig` +-- + + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `groups` +-- + +CREATE TABLE IF NOT EXISTS `groups` ( + `gid` varchar(64) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`gid`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Daten für Tabelle `groups` +-- + +INSERT INTO `groups` (`gid`) VALUES +('admin'); + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `group_user` +-- + +CREATE TABLE IF NOT EXISTS `group_user` ( + `gid` varchar(64) COLLATE utf8_unicode_ci NOT NULL, + `uid` varchar(64) COLLATE utf8_unicode_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Daten für Tabelle `group_user` +-- + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `locks` +-- + CREATE TABLE IF NOT EXISTS `locks` ( `token` varchar(255) NOT NULL DEFAULT '', `path` varchar(200) NOT NULL DEFAULT '', @@ -14,18 +91,58 @@ CREATE TABLE IF NOT EXISTS `locks` ( KEY `path_2` (`path`), KEY `path_3` (`path`,`token`), KEY `expires` (`expires`) -); +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Daten für Tabelle `locks` +-- + + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `log` +-- CREATE TABLE IF NOT EXISTS `log` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `timestamp` int(11) NOT NULL, - `user` varchar(250) NOT NULL, - `type` int(11) NOT NULL, - `message` varchar(250) NOT NULL, + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `moment` datetime NOT NULL, + `appid` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `user` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `action` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `info` text COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) -); +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; + +-- +-- Daten für Tabelle `log` +-- + + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `preferences` +-- + +CREATE TABLE IF NOT EXISTS `preferences` ( + `userid` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `appid` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `configkey` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `configvalue` varchar(255) COLLATE utf8_unicode_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Daten für Tabelle `preferences` +-- +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `properties` +-- + CREATE TABLE IF NOT EXISTS `properties` ( `path` varchar(255) NOT NULL DEFAULT '', `name` varchar(120) NOT NULL DEFAULT '', @@ -33,29 +150,35 @@ CREATE TABLE IF NOT EXISTS `properties` ( `value` text, PRIMARY KEY (`path`,`name`,`ns`), KEY `path` (`path`) -); - -CREATE TABLE IF NOT EXISTS `users` ( -`user_id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , -`user_name` VARCHAR( 64 ) NOT NULL , -`user_name_clean` VARCHAR( 64 ) NOT NULL , -`user_password` VARCHAR( 340) NOT NULL , -UNIQUE ( -`user_name` , -`user_name_clean` -) -); - -CREATE TABLE IF NOT EXISTS `groups` ( -`group_id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , -`group_name` VARCHAR( 64 ) NOT NULL , -UNIQUE ( -`group_name` -) -); - -CREATE TABLE IF NOT EXISTS `user_group` ( -`user_group_id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , -`user_id` VARCHAR( 64 ) NOT NULL , -`group_id` VARCHAR( 64 ) NOT NULL -) \ No newline at end of file +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Daten für Tabelle `properties` +-- + + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `users` +-- + +CREATE TABLE IF NOT EXISTS `users` ( + `uid` varchar(64) COLLATE utf8_unicode_ci NOT NULL, + `password` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`uid`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Daten für Tabelle `users` +-- + +-- +-- Table structure for table `foldersize` +-- + +CREATE TABLE IF NOT EXISTS `foldersize` ( + `path` varchar(512) NOT NULL, + `size` int(11) NOT NULL, + PRIMARY KEY (`path`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; \ No newline at end of file diff --git a/docs/skeleton/admin.php b/docs/skeleton/admin.php new file mode 100644 index 0000000000000000000000000000000000000000..aaf6136692dd6d71cf48bf57f2e2b1cbf33ef08d --- /dev/null +++ b/docs/skeleton/admin.php @@ -0,0 +1,56 @@ +<?php + +/** +* ownCloud - Sample application +* +* @author Jakob Sack +* @copyright 2011 Jakob Sack kde@jakobsack.de +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU AFFERO GENERAL PUBLIC LICENSE for more details. +* +* You should have received a copy of the GNU Affero General Public +* License along with this library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + +// Do not prepare the file system (for demonstration purpose) +// We HAVE TO set this var before including base.php +$RUNTIME_NOSETUPFS = true; + +// Init owncloud +require_once('../lib/base.php'); + +// We need the file system although we said do not load it! Do it by hand now +OC_UTIL::setupFS(); + +// We load OC_TEMPLATE, too. This one is not loaded by base +require( 'template.php' ); + +// The user should have admin rights. This is an admin page! +if( !OC_USER::isLoggedIn() || !OC_USER::ingroup( $_SESSION['username'], 'admin' )){ + // Bad boy! Go to the very first page of owncloud + header( "Location: ".OC_HELPER::linkTo( "index.php" )); + exit(); +} + +// Do some crazy Stuff over here +$myvar = 2; +$myarray = array( "foo" => array( 0, 1, 2 ), "bar" => "baz" ); + +// Preparing for output! +$tmpl = new OC_TEMPLATE( "skeleton", "admin", "admin" ); // Programname, template, mode +// Assign the vars +$tmpl->assign( "var", $myvar ); +$tmpl->assign( "array", $myarray ); +// Print page +$tmpl->printPage(); + +?> diff --git a/docs/skeleton/appinfo/app.sample.php b/docs/skeleton/appinfo/app.sample.php new file mode 100644 index 0000000000000000000000000000000000000000..12db7154c2baa5dd5d3cefdf2ad4f085b8edbeef --- /dev/null +++ b/docs/skeleton/appinfo/app.sample.php @@ -0,0 +1,15 @@ +<?php +/* + * This file is required. It makes owncloud aware of the app. + */ + +// Hello, we are here +OC_APP::register( array( "id" => "skeleton", "name" => "Files", "order" => 1000 )); + +// Add application to navigation +OC_UTIL::addNavigationEntry( array( "id" => "skeleton_index", "order" => 1000, "href" => OC_HELPER::linkTo( "skeleton", "index.php" ), "icon" => OC_HELPER::imagePath( "skeleton", "app.png" ), "name" => "Example app" )); + +// Add an admin page +OC_UTIL::addAdminPage( array( "order" => 1, "href" => OC_HELPER::linkTo( "skeleton", "admin.php" ), "name" => "Example app options" )); + +?> diff --git a/docs/skeleton/css/skeleton.css b/docs/skeleton/css/skeleton.css new file mode 100644 index 0000000000000000000000000000000000000000..aa68a8be86706bc2d10abc3329c7bbb7ca319353 --- /dev/null +++ b/docs/skeleton/css/skeleton.css @@ -0,0 +1,4 @@ +/* + * To include this css file, call "OC_UTIL::addStyle( "skeleton", "skeleton" )" + * in your app. (appname) (cssname) + */ \ No newline at end of file diff --git a/docs/skeleton/css/special.css b/docs/skeleton/css/special.css new file mode 100644 index 0000000000000000000000000000000000000000..8fd75917bf25994b15df107342d599ed2a4148d3 --- /dev/null +++ b/docs/skeleton/css/special.css @@ -0,0 +1,3 @@ +/* + * If you want to you can use more css files ... + */ diff --git a/docs/skeleton/img/put_images_here.txt b/docs/skeleton/img/put_images_here.txt new file mode 100644 index 0000000000000000000000000000000000000000..8d1c8b69c3fce7bea45c73efd06983e3c419a92f --- /dev/null +++ b/docs/skeleton/img/put_images_here.txt @@ -0,0 +1 @@ + diff --git a/docs/skeleton/index.php b/docs/skeleton/index.php new file mode 100644 index 0000000000000000000000000000000000000000..6d237ed615236ae56843f699f7fad2f7c42e56a2 --- /dev/null +++ b/docs/skeleton/index.php @@ -0,0 +1,64 @@ +<?php + +/** +* ownCloud - ajax frontend +* +* @author Robin Appelman +* @copyright 2010 Robin Appelman icewind1991@gmail.com +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU AFFERO GENERAL PUBLIC LICENSE for more details. +* +* You should have received a copy of the GNU Affero General Public +* License along with this library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + + +// Init owncloud +require_once('../lib/base.php'); +require( 'template.php' ); + +// Check if we are a user +if( !OC_USER::isLoggedIn()){ + header( "Location: ".OC_HELPER::linkTo( "index.php" )); + exit(); +} + +// Load the files we need +OC_UTIL::addStyle( "files", "files" ); +OC_UTIL::addScript( "files", "files" ); + +// Load the files +$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : ''; + +$files = array(); +foreach( OC_FILES::getdirectorycontent( $dir ) as $i ){ + $i["date"] = date( $CONFIG_DATEFORMAT, $i["mtime"] ); + $files[] = $i; +} + +// Make breadcrumb +$breadcrumb = array(); +$pathtohere = "/"; +foreach( explode( "/", $dir ) as $i ){ + if( $i != "" ){ + $pathtohere .= "$i/"; + $breadcrumb[] = array( "dir" => $pathtohere, "name" => $i ); + } +} + +// return template +$tmpl = new OC_TEMPLATE( "files", "index", "user" ); +$tmpl->assign( "files", $files ); +$tmpl->assign( "breadcrumb", $breadcrumb ); +$tmpl->printPage(); + +?> diff --git a/docs/skeleton/js/app.js b/docs/skeleton/js/app.js new file mode 100644 index 0000000000000000000000000000000000000000..5d5b668eeb5bb647da6c0b9c24a220bfe1a51c25 --- /dev/null +++ b/docs/skeleton/js/app.js @@ -0,0 +1,3 @@ +// Include this file whenever you need it. A simple +// "OC_UTIL::addScript( "skeleton", "app" )" will do this. +// Put your jquery-Stuff here diff --git a/docs/skeleton/templates/admin.php b/docs/skeleton/templates/admin.php new file mode 100644 index 0000000000000000000000000000000000000000..63fcd5cd39f88f4b4e4f4a20d1fdd84fd8aae375 --- /dev/null +++ b/docs/skeleton/templates/admin.php @@ -0,0 +1,8 @@ +<?php +/* + * Template for files admin page + * + * See index.php for details + */ +?> +<h1>Admin</h1> diff --git a/docs/skeleton/templates/index.php b/docs/skeleton/templates/index.php new file mode 100644 index 0000000000000000000000000000000000000000..fb0544e76ed6aad8bde10e61a99c1c2d4f8d5648 --- /dev/null +++ b/docs/skeleton/templates/index.php @@ -0,0 +1,12 @@ +<?php +/* + * Template for files + */ +?> +<h1>Skeleton</h1> + +<?php foreach($_["array"] as $item): ?> + <p><?php echo $item; ?></p> +<?php endforeach; ?> + +<?php echo $_["anothervar"]; ?> diff --git a/files/admin.php b/files/admin.php new file mode 100644 index 0000000000000000000000000000000000000000..59b822468ed44a2343fd90fa4806759e30c0fad6 --- /dev/null +++ b/files/admin.php @@ -0,0 +1,51 @@ +<?php + +/** +* ownCloud - ajax frontend +* +* @author Robin Appelman +* @copyright 2010 Robin Appelman icewind1991@gmail.com +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU AFFERO GENERAL PUBLIC LICENSE for more details. +* +* You should have received a copy of the GNU Affero General Public +* License along with this library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + + +// Init owncloud +require_once('../lib/base.php'); +require( 'template.php' ); + + +// Check if we are a user +if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )){ + header( "Location: ".OC_HELPER::linkTo( "index.php" )); + exit(); +} + +$htaccessWorking=(getenv('htaccessWorking')=='true'); +if(isset($_POST['maxUploadSize'])){ + $maxUploadFilesize=$_POST['maxUploadSize']; + OC_FILES::setUploadLimit(OC_HELPER::computerFileSize($maxUploadFilesize)); +}else{ + $maxUploadFilesize = ini_get('upload_max_filesize').'B'; +} + +OC_APP::setActiveNavigationEntry( "files_administration" ); +// return template +$tmpl = new OC_TEMPLATE( "files", "admin", "admin" ); +$tmpl->assign( 'htaccessWorking', $htaccessWorking ); +$tmpl->assign( 'uploadMaxFilesize', $maxUploadFilesize); +$tmpl->printPage(); + +?> diff --git a/files/ajax/autocomplete.php b/files/ajax/autocomplete.php new file mode 100644 index 0000000000000000000000000000000000000000..af235379800e5d4b959debd3b25674069ff2a547 --- /dev/null +++ b/files/ajax/autocomplete.php @@ -0,0 +1,61 @@ +<?php +//provide auto completion of paths for use with jquer ui autocomplete + + +// Init owncloud +require_once('../../lib/base.php'); + +// We send json data +// header( "Content-Type: application/jsonrequest" ); + +// Check if we are a user +if( !OC_USER::isLoggedIn()){ + echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" ))); + exit(); +} + +// Get data +$query = $_GET['term']; +$dirOnly=(isset($_GET['dironly']))?($_GET['dironly']=='true'):false; + +if($query[0]!='/'){ + $query='/'.$query; +} + +if(substr($query,-1,1)=='/'){ + $base=$query; +}else{ + $base=dirname($query); +} + +$query=substr($query,strlen($base)); + +if($base!='/'){ + $query=substr($query,1); +} +$queryLen=strlen($query); +$query=strtolower($query); + +// echo "$base - $query"; + +$files=array(); + +if(OC_FILESYSTEM::is_dir($base)){ + $dh = OC_FILESYSTEM::opendir($base); + if(substr($base,-1,1)!='/'){ + $base=$base.'/'; + } + while (($file = readdir($dh)) !== false) { + if ($file != "." && $file != ".."){ + if(substr(strtolower($file),0,$queryLen)==$query){ + $item=$base.$file; + if((!$dirOnly or OC_FILESYSTEM::is_dir($item))){ + $files[]=(object)array('id'=>$item,'label'=>$item,'name'=>$item); + } + } + } + } +} +echo json_encode($files); + +?> diff --git a/files/ajax/delete.php b/files/ajax/delete.php new file mode 100644 index 0000000000000000000000000000000000000000..79caf4d0bb2c37788574da480d7fde8aef66d14e --- /dev/null +++ b/files/ajax/delete.php @@ -0,0 +1,36 @@ +<?php + +// Init owncloud +require_once('../../lib/base.php'); + +// We send json data +header( "Content-Type: application/jsonrequest" ); + +// Check if we are a user +if( !OC_USER::isLoggedIn()){ + echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" ))); + exit(); +} + +// Get data +$dir = $_GET["dir"]; +$files = isset($_GET["file"]) ? $_GET["file"] : $_GET["files"]; + +$files = explode(';', $files); +$filesWithError = ''; +$status = 'success'; +//Now delete +foreach($files as $file) { + if( !OC_FILES::delete( $dir, $file )){ + $filesWithError .= $file . "\n"; + $status = 'error'; + } +} + +if($status == 'success') { + echo json_encode( array( "status" => $status, "data" => array( "dir" => $dir, "files" => $files ))); +} else { + echo json_encode( array( "status" => $status, "data" => array( "message" => "Could not delete:\n" . $filesWithError ))); +} + +?> diff --git a/js/ajax.js b/files/ajax/download.php similarity index 67% rename from js/ajax.js rename to files/ajax/download.php index c25f16fd38509e4327fd729597f1a26183449247..0b2f894a11ba1854f110a516b8b325e7f9b9c629 100644 --- a/js/ajax.js +++ b/files/ajax/download.php @@ -1,23 +1,37 @@ +<?php + /** * ownCloud - ajax frontend * * @author Robin Appelman * @copyright 2010 Robin Appelman icewind1991@gmail.com -* +* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either +* License as published by the Free Software Foundation; either * version 3 of the License, or any later version. -* +* * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public +* +* You should have received a copy of the GNU Affero General Public * License along with this library. If not, see <http://www.gnu.org/licenses/>. -* +* */ +// Init owncloud +require_once('../../lib/base.php'); + +// Check if we are a user +if( !OC_USER::isLoggedIn()){ + header( "Location: ".OC_HELPER::linkTo( "index.php" )); + exit(); +} + +$files = $_GET["files"]; +$dir = $_GET["dir"]; -OC_onload.add(OC_FILES.browser.showInitial); \ No newline at end of file +OC_FILES::get($dir,$files); +?> diff --git a/files/ajax/list.php b/files/ajax/list.php new file mode 100644 index 0000000000000000000000000000000000000000..ef43e72fcae4b0d71f9f1c25ac00bd0d8c5844c9 --- /dev/null +++ b/files/ajax/list.php @@ -0,0 +1,51 @@ +<?php + +// Init owncloud +require_once('../../lib/base.php'); +require_once('../../lib/template.php'); + +// We send json data +header( "Content-Type: application/jsonrequest" ); + +// Check if we are a user +if( !OC_USER::isLoggedIn()){ + echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" ))); + exit(); +} + +// Load the files +$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : ''; +$doBreadcrumb = isset( $_GET['breadcrumb'] ) ? true : false; +$data = array(); + +// Make breadcrumb +if($doBreadcrumb){ + $breadcrumb = array(); + $pathtohere = "/"; + foreach( explode( "/", $dir ) as $i ){ + if( $i != "" ){ + $pathtohere .= "$i/"; + $breadcrumb[] = array( "dir" => $pathtohere, "name" => $i ); + } + } + + $breadcrumbNav = new OC_TEMPLATE( "files", "part.breadcrumb", "" ); + $breadcrumbNav->assign( "breadcrumb", $breadcrumb ); + + $data['breadcrumb'] = $breadcrumbNav->fetchPage(); +} + +// make filelist +$files = array(); +foreach( OC_FILES::getdirectorycontent( $dir ) as $i ){ + $i["date"] = OC_UTIL::formatDate($i["mtime"] ); + $files[] = $i; +} + +$list = new OC_TEMPLATE( "files", "part.list", "" ); +$list->assign( "files", $files ); +$data = array('files' => $list->fetchPage()); + +echo json_encode( array( "status" => "success", "data" => $data)); + +?> diff --git a/files/ajax/newfolder.php b/files/ajax/newfolder.php new file mode 100644 index 0000000000000000000000000000000000000000..988e7f040121099e47309ab4ceca530e7fcb80bf --- /dev/null +++ b/files/ajax/newfolder.php @@ -0,0 +1,29 @@ +<?php + +// Init owncloud +require_once('../../lib/base.php'); + +// We send json data +header( "Content-Type: application/jsonrequest" ); + +// Check if we are a user +if( !OC_USER::isLoggedIn()){ + echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" ))); + exit(); +} + +// Get the params +$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : ''; +$foldername = isset( $_GET['foldername'] ) ? $_GET['foldername'] : ''; + +if($foldername == '') { + echo json_encode( array( "status" => "error", "data" => array( "message" => "Empty Foldername" ))); + exit(); +} +error_log('try to create ' . $foldername . ' in ' . $dir); +if(OC_FILES::newFile($dir, $foldername, 'dir')) { + echo json_encode( array( "status" => "success", "data" => array())); + exit(); +} + +echo json_encode( array( "status" => "error", "data" => array( "message" => "Error when creating the folder" ))); \ No newline at end of file diff --git a/files/ajax/rename.php b/files/ajax/rename.php new file mode 100644 index 0000000000000000000000000000000000000000..65763fceb94db16ecd167d1d28fc22225c93ee16 --- /dev/null +++ b/files/ajax/rename.php @@ -0,0 +1,28 @@ +<?php + +// Init owncloud +require_once('../lib/base.php'); + +// We send json data +header( "Content-Type: application/jsonrequest" ); + +// Check if we are a user +if( !OC_USER::isLoggedIn()){ + echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" ))); + exit(); +} + +// Get data +$dir = $_GET["dir"]; +$file = $_GET["file"]; +$newname = $_GET["newname"]; + +// Delete +if( OC_FILES::move( $dir, $file, $dir, $newname )) { + echo json_encode( array( "status" => "success", "data" => array( "dir" => $dir, "file" => $file, "newname" => $newname ))); +} +else{ + echo json_encode( array( "status" => "error", "data" => array( "message" => "Unable to rename file" ))); +} + +?> diff --git a/files/ajax/upload.php b/files/ajax/upload.php new file mode 100644 index 0000000000000000000000000000000000000000..0939ad0d097a004a315b00af231230dabb632975 --- /dev/null +++ b/files/ajax/upload.php @@ -0,0 +1,33 @@ +<?php + +// Init owncloud +require_once('../../lib/base.php'); + +// We send json data +// header( "Content-Type: application/json" ); +// Firefox and Konqueror tries to download application/json for me. --Arthur +header( "Content-Type: text/plain" ); + +// Check if we are a user +if( !OC_USER::isLoggedIn()){ + echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" ))); + exit(); +} + +$fileName=$_FILES['file']['name']; +$source=$_FILES['file']['tmp_name']; +$dir = $_POST['dir']; +if(!empty($dir)) $dir .= '/'; +$target='/' . stripslashes($dir) . $fileName; +if(strpos($dir,'..') === false){ + if(OC_FILESYSTEM::fromUploadedFile($source,$target)){ + echo json_encode(array( "status" => "success")); + exit(); + } +} + +$error = $_FILES['file']['error']; + +echo json_encode(array( 'status' => 'error', 'data' => array('error' => $error, "file" => $fileName))); + +?> diff --git a/files/api.php b/files/api.php deleted file mode 100644 index 08e1021af092340788efacaf70899c8373199671..0000000000000000000000000000000000000000 --- a/files/api.php +++ /dev/null @@ -1,101 +0,0 @@ -<?php - -/** -* ownCloud - ajax frontend -* -* @author Robin Appelman -* @copyright 2010 Robin Appelman icewind1991@gmail.com -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either -* version 3 of the License, or any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. -* -*/ -require_once('../inc/lib_base.php'); - -$arguments=$_POST; -if(!isset($_POST['action']) and isset($_GET['action'])){ - $arguments=$_GET; -} - -foreach($arguments as &$argument){ - $argument=stripslashes($argument); -} -global $CONFIG_DATADIRECTORY; -ob_clean(); -if($arguments['action']){ - switch($arguments['action']){ - case 'delete': - echo (OC_FILES::delete($arguments['dir'],$arguments['file']))?'true':'false'; - break; - case 'rename': - echo (OC_FILES::move($arguments['dir'],$arguments['file'],$arguments['dir'],$arguments['newname']))?'true':'false'; - break; - case 'new': - echo (OC_FILES::newfile($arguments['dir'],$arguments['name'],$arguments['type']))?'true':'false'; - break; - case 'move': - echo (OC_FILES::move($arguments['sourcedir'],$arguments['source'],$arguments['targetdir'],$arguments['target']))?'true':'false'; - break; - case 'copy': - echo (OC_FILES::copy($arguments['sourcedir'],$arguments['source'],$arguments['targetdir'],$arguments['target']))?'true':'false'; - break; - case 'get': - OC_FILES::get($arguments['dir'],$arguments['file']); - break; - case 'getfiles': - $max_upload=min(return_bytes(ini_get('post_max_size')),return_bytes(ini_get('upload_max_filesize'))); - $files=OC_FILES::getDirectoryContent($arguments['dir']); - $files['__max_upload']=$max_upload; - echo json_encode($files); - break; - case 'gettree': - echo json_encode(OC_FILES::getTree($arguments['dir'])); - break; - case 'find': - echo json_encode(OC_FILESYSTEM::find($arguments['path'])); - break; - case 'login': - if(OC_USER::login($arguments['username'],$arguments['password'])){ - echo 'true'; - }else{ - echo 'false'; - } - break; - case 'checklogin': - if(OC_USER::isLoggedIn()){ - echo 'true'; - }else{ - echo 'false'; - } - break; - case 'pull': - return OC_FILES::pull($arguments['source'],$arguments['token'],$arguments['dir'],$arguments['file']); - } -} - -function return_bytes($val) { - $val = trim($val); - $last = strtolower($val[strlen($val)-1]); - switch($last) { - // The 'G' modifier is available since PHP 5.1.0 - case 'g': - $val *= 1024; - case 'm': - $val *= 1024; - case 'k': - $val *= 1024; - } - - return $val; -} -?> diff --git a/files/appinfo/app.php b/files/appinfo/app.php new file mode 100644 index 0000000000000000000000000000000000000000..bf67812cf3834417803da61b355af80f52a4ce71 --- /dev/null +++ b/files/appinfo/app.php @@ -0,0 +1,12 @@ +<?php + +OC_APP::register( array( "order" => 2, "id" => "files", "name" => "Files" )); + +OC_APP::addNavigationEntry( array( "id" => "files_index", "order" => 1, "href" => OC_HELPER::linkTo( "files", "index.php" ), "icon" => OC_HELPER::imagePath( "files", "home.png" ), "name" => "Files" )); +OC_APP::addSettingsPage( array( "id" => "files_administration", "order" => 1, "href" => OC_HELPER::linkTo( "files", "admin.php" ), "name" => "Files", "icon" => OC_HELPER::imagePath( "files", "folder.png" ))); + + +// To add navigation sub entries use +// OC_APP::addNavigationSubEntry( "files_index", array( ... )); + +?> diff --git a/files/css/files.css b/files/css/files.css new file mode 100644 index 0000000000000000000000000000000000000000..c3f7d82aa6e8cc4e5166a27c2d8461662bb42524 --- /dev/null +++ b/files/css/files.css @@ -0,0 +1,86 @@ +/* FILE MENU */ + +#file_menu +{ + display: none; + position: absolute; + background-color: #EEE; +} + +#file_menu ul +{ + list-style-type: none; +} + +#file_menu li a +{ + display: block; + padding: 0.5em 5em 0.5em 2em; + text-decoration: none; +} + +#file_upload_form, #file_newfolder_form { + display: inline; +} + +#fileSelector, #file_upload_cancel, #file_newfolder_submit { + display: none; +} + +#file_upload_start, #file_newfolder_name { + background-repeat: no-repeat; + background-position: 0.5em 0; + padding-left: 2em; +} + +#file_upload_start {background-image:url(../../img/mimetypes/file.png);} + +#file_newfolder_name { + background-image:url(../../img/places/folder.png); font-weight: bold; + width: 14em; +} + +#file_newfolder_submit { + width: 3em; +} + +form input[type="button"], form input[type="text"]{ + /* this is a dirty wurgaround, Jan needs to fix it in global css*/ + font-size: 0.9em; +} + +#file_upload_target { + display: none; +} + +/* FILE TABLE */ + +table { + width: 90%; +} + +table td.filesize, table td.date +{ + width: 5em; + padding: 0.5em 1em; + text-align: right; +} + +table td.date +{ + width: 11em; +} + +table td.selection, table th.selection, table td.fileaction +{ + width: 2em; + text-align: center; +} + +table td.filename a +{ + display: block; + background-image: url(../img/file.png); + text-decoration: none; +} + diff --git a/files/open_file.php b/files/download.php similarity index 52% rename from files/open_file.php rename to files/download.php index ad91e3dad5c41a0f58f677e9f47eff81e515aad2..f7fbcd0f85724f561419912da1ff57b0f6281d39 100644 --- a/files/open_file.php +++ b/files/download.php @@ -1,47 +1,55 @@ <?php + /** * ownCloud - ajax frontend * * @author Robin Appelman * @copyright 2010 Robin Appelman icewind1991@gmail.com -* +* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either +* License as published by the Free Software Foundation; either * version 3 of the License, or any later version. -* +* * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public +* +* You should have received a copy of the GNU Affero General Public * License along with this library. If not, see <http://www.gnu.org/licenses/>. -* +* */ -//not this file is for getting files themselves, get_files.php is for getting a list of files. - -require_once('../inc/lib_base.php'); +// Init owncloud +require_once('../lib/base.php'); +require( 'template.php' ); -if(isset($_GET['path'])){ - $filename=$_GET['path']; -}else{ - $file=$_GET['file']; - $dir=(isset($_GET['dir']))?$_GET['dir']:''; - $filename=$dir.'/'.$file; +// Check if we are a user +if( !OC_USER::isLoggedIn()){ + header( "Location: ".OC_HELPER::linkTo( "index.php" )); + exit(); } -if(strstr($filename,'..')){ - die(); + +$filename = $_GET["file"]; + +if(!OC_FILESYSTEM::file_exists($filename)){ + header("HTTP/1.0 404 Not Found"); + $tmpl = new OC_TEMPLATE( '', '404', 'guest' ); + $tmpl->assign('file',$filename); + $tmpl->printPage(); + exit; } -$filename=stripslashes($filename); -$ftype=OC_FILESYSTEM::getMimeType($filename); -ob_end_clean(); -header('Content-Type: '.$ftype); + +$ftype=OC_FILESYSTEM::getMimeType( $filename ); + +header('Content-Type:'.$ftype); +header('Content-Disposition: attachment; filename="'.basename($filename).'"'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); -header('Content-Length: ' . OC_FILESYSTEM::filesize($filename)); +header('Content-Length: '.OC_FILESYSTEM::filesize($filename)); -OC_FILESYSTEM::readfile($filename); -?> \ No newline at end of file +ob_end_clean(); +OC_FILESYSTEM::readfile( $filename ); +?> diff --git a/files/get_files.php b/files/get_files.php deleted file mode 100644 index 45d2b626e654193dd40c0c6875c235b8e6520ab2..0000000000000000000000000000000000000000 --- a/files/get_files.php +++ /dev/null @@ -1,109 +0,0 @@ -<?php - -/** -* ownCloud - ajax frontend -* -* @author Robin Appelman -* @copyright 2010 Robin Appelman icewind1991@gmail.com -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either -* version 3 of the License, or any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. -* -*/ -require_once('../inc/lib_base.php'); - -function return_bytes($val) { - $val = trim($val); - $last = strtolower($val[strlen($val)-1]); - switch($last) { - // The 'G' modifier is available since PHP 5.1.0 - case 'g': - $val *= 1024; - case 'm': - $val *= 1024; - case 'k': - $val *= 1024; - } - - return $val; -} - -// header('Content-type: text/plain'); -header('Content-type: application/xml'); - -$dir=isset($_GET['dir'])?$_GET['dir']:''; -$files=OC_FILES::getdirectorycontent($dir); -$dirname=(isset($files[0]))?$files[0]['directory']:''; -$dirname=substr($dirname,strrpos($dirname,'/')); -$max_upload=min(return_bytes(ini_get('post_max_size')),return_bytes(ini_get('upload_max_filesize'))); -ob_clean(); -echo "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>\n"; -echo "<dir name='$dirname' max_upload='$max_upload'>\n"; -if(is_array($files)){ - foreach($files as $file){ - $attributes=''; - foreach($file as $name=>$data){ - $data=utf8_encode($data); - $data=utf8tohtml($data); - $data=str_replace("'",''',$data); - if (is_string($name)) $attributes.=" $name='$data'"; - } - $attributes.=' date=\''.date($CONFIG_DATEFORMAT,$file['mtime']).'\''; - echo "<file$attributes/>\n"; - } -} -echo "</dir>"; - -// converts a UTF8-string into HTML entities -// - $utf8: the UTF8-string to convert -// - $encodeTags: booloean. TRUE will convert "<" to "<" -// - return: returns the converted HTML-string -function utf8tohtml($utf8, $encodeTags=true) { - $result = ''; - for ($i = 0; $i < strlen($utf8); $i++) { - $char = $utf8[$i]; - $ascii = ord($char); - if ($ascii < 128) { - // one-byte character - $result .= ($encodeTags) ? htmlentities($char) : $char; - } else if ($ascii < 192) { - // non-utf8 character or not a start byte - } else if ($ascii < 224) { - // two-byte character - $result .= htmlentities(substr($utf8, $i, 2), ENT_QUOTES, 'UTF-8'); - $i++; - } else if ($ascii < 240) { - // three-byte character - $ascii1 = ord($utf8[$i+1]); - $ascii2 = ord($utf8[$i+2]); - $unicode = (15 & $ascii) * 4096 + - (63 & $ascii1) * 64 + - (63 & $ascii2); - $result .= "&#$unicode;"; - $i += 2; - } else if ($ascii < 248) { - // four-byte character - $ascii1 = ord($utf8[$i+1]); - $ascii2 = ord($utf8[$i+2]); - $ascii3 = ord($utf8[$i+3]); - $unicode = (15 & $ascii) * 262144 + - (63 & $ascii1) * 4096 + - (63 & $ascii2) * 64 + - (63 & $ascii3); - $result .= "&#$unicode;"; - $i += 3; - } - } - return $result; -} -?> \ No newline at end of file diff --git a/files/img/file.png b/files/img/file.png new file mode 100644 index 0000000000000000000000000000000000000000..4979044889708bf736aefaee7ade0b1f4462600e Binary files /dev/null and b/files/img/file.png differ diff --git a/files/img/folder.png b/files/img/folder.png new file mode 100644 index 0000000000000000000000000000000000000000..3edbe257a34cf50b5015f427138a67ea4debb5cf Binary files /dev/null and b/files/img/folder.png differ diff --git a/files/img/home.png b/files/img/home.png new file mode 100644 index 0000000000000000000000000000000000000000..b3fb9bbaf6fba02fa618187ba4ba03f0eeb21fc5 Binary files /dev/null and b/files/img/home.png differ diff --git a/files/index.php b/files/index.php index f2f7a48713ac3d2216d5804eef5004149a634fac..7ac3bce6051431cd82bd15117fcffac399f4e732 100644 --- a/files/index.php +++ b/files/index.php @@ -5,31 +5,73 @@ * * @author Robin Appelman * @copyright 2010 Robin Appelman icewind1991@gmail.com -* +* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either +* License as published by the Free Software Foundation; either * version 3 of the License, or any later version. -* +* * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public +* +* You should have received a copy of the GNU Affero General Public * License along with this library. If not, see <http://www.gnu.org/licenses/>. -* +* */ -//require_once('../../config/config.php'); -require_once('../inc/lib_base.php'); +// Init owncloud +require_once('../lib/base.php'); +require( 'template.php' ); + +// Check if we are a user +if( !OC_USER::isLoggedIn()){ + header( "Location: ".OC_HELPER::linkTo( '', 'index.php' )); + exit(); +} + +// Load the files we need +OC_UTIL::addStyle( "files", "files" ); +OC_UTIL::addScript( "files", "files" ); +OC_APP::setActiveNavigationEntry( "files_index" ); +// Load the files +$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : ''; + +$files = array(); +foreach( OC_FILES::getdirectorycontent( $dir ) as $i ){ + $i["date"] = OC_UTIL::formatDate($i["mtime"] ); + if($i['directory']=='/'){ + $i['directory']=''; + } + $files[] = $i; +} + +// Make breadcrumb +$breadcrumb = array(); +$pathtohere = "/"; +foreach( explode( "/", $dir ) as $i ){ + if( $i != "" ){ + $pathtohere .= "$i/"; + $breadcrumb[] = array( "dir" => $pathtohere, "name" => $i ); + } +} -OC_UTIL::addscript('/plugins/ajax/ajax.js'); +// make breadcrumb und filelist markup +$list = new OC_TEMPLATE( "files", "part.list", "" ); +$list->assign( "files", $files ); +$breadcrumbNav = new OC_TEMPLATE( "files", "part.breadcrumb", "" ); +$breadcrumbNav->assign( "breadcrumb", $breadcrumb ); -OC_UTIL::showheader(); +$maxUploadFilesize = OC_HELPER::computerFileSize(ini_get('upload_max_filesize')); -echo "<div id='content'></div>"; +$tmpl = new OC_TEMPLATE( "files", "index", "user" ); +$tmpl->assign( "fileList", $list->fetchPage() ); +$tmpl->assign( "breadcrumb", $breadcrumbNav->fetchPage() ); +$tmpl->assign( 'dir', $dir); +$tmpl->assign( 'uploadMaxFilesize', $maxUploadFilesize); +$tmpl->assign( 'uploadMaxHumanFilesize', OC_HELPER::humanFileSize($maxUploadFilesize)); +$tmpl->printPage(); -OC_UTIL::showfooter(); ?> diff --git a/files/js/files.js b/files/js/files.js new file mode 100644 index 0000000000000000000000000000000000000000..aed2d596272cf23aad1eeceb3f51734f98a2a067 --- /dev/null +++ b/files/js/files.js @@ -0,0 +1,324 @@ +$(document).ready(function() { + $('#file_action_panel').attr('activeAction', false); + $('#file_upload_start').attr('mode', 'menu'); + $('#file_upload_form').attr('uploading', false); + $('#file_newfolder_name').css('width', '14em'); + $('#file_newfolder_submit').css('width', '3em'); + + // Sets browser table behaviour : + $('.browser tr').hover( + function() { + $(this).addClass('mouseOver'); + }, + function() { + $(this).removeClass('mouseOver'); + } + ); + + // Sets logs table behaviour : + $('.logs tr').hover( + function() { + $(this).addClass('mouseOver'); + }, + function() { + $(this).removeClass('mouseOver'); + } + ); + + // Sets the file-action buttons behaviour : + $('td.fileaction a').click(function() { + $(this).parent().append($('#file_menu')); + $('#file_menu').slideToggle(250); + return false; + }); + + // Sets the select_all checkbox behaviour : + $('#select_all').click(function() { + + if($(this).attr('checked')) + // Check all + $('td.selection input:checkbox').attr('checked', true); + else + // Uncheck all + $('td.selection input:checkbox').attr('checked', false); + }); + + $('td.selection input:checkbox').click(function() { + if(!$(this).attr('checked')){ + $('#select_all').attr('checked',false); + }else{ + if($('td.selection input:checkbox:checked').length==$('td.selection input:checkbox').length){ + $('#select_all').attr('checked',true); + } + } + }); + + // Download current file + $('#download_single_file').click(function() { + filename = $('#file_menu').parents('tr:first').find('.filename:first').children('a:first').text(); + window.location='ajax/download.php?files='+filename+'&dir='+$('#dir').val(); + $('#file_menu').slideToggle(250); + return false; + }); + + // Delete current file + $('#delete_single_file').click(function() { + filename = $('#file_menu').parents('tr:first').find('.filename:first').children('a:first').text(); + $.ajax({ + url: 'ajax/delete.php', + data: "dir="+$('#dir').val()+"&file="+filename, + complete: function(data){ + boolOperationFinished(data, true, $('#file_menu').parents('tr:first')); + } + }); + return false; + }); + + $('#file_upload_start').click(function() { + if($('#file_upload_start').attr('mode') == 'menu') { + $('#file_upload_form')[0].reset(); + $('#fileSelector').change(function() { + //Chromium prepends C:\fakepath.... + bspos = $('#fileSelector').val().lastIndexOf('\\')+1; + filename = $('#fileSelector').val().substr(bspos); + + $('#file_upload_start').val('Upload ' + filename); + $('#fileSelector').hide(); + $('#file_upload_cancel').slideDown(250); + $('#file_upload_start').attr('mode', 'action'); + }); + $('#file_upload_start').focusin(function() { + if($('#fileSelector').val() == '') { + $('#fileSelector').hide(); + $('#file_upload_start').unbind('focusin'); + } + }); + $('#fileSelector').focusout(function() { + if($('#fileSelector').val() == '') { + $('#fileSelector').hide(); + } + }); + $('#fileSelector').show(); //needed for Chromium compatibility + //rekonq does not call change-event, when click() is executed by script + if(navigator.userAgent.indexOf('rekonq') == -1){ + $('#fileSelector').click(); + } + $('#fileSelector').focus(); + } else if($('#file_upload_start').attr('mode') == 'action') { + $('#file_upload_cancel').slideUp(250); + $('#file_upload_form').attr('uploading', true); + $('#file_upload_target').load(uploadFinished); + } + }); + + $('#file_upload_cancel').click(function() { + $('#file_upload_form')[0].reset(); + $('#file_upload_start').val('Upload ' + $('.max_human_file_size:first').val()); + $('#file_upload_start').attr('mode', 'menu'); + $('#file_upload_cancel').hide(); +// $('#file_action_panel').attr('activeAction', 'false'); +// $('#file_upload_form').hide(); +// $('p.actions a.upload:first').show(); + }); + + $('#file_new_dir_submit').click(function() { + $.ajax({ + url: 'ajax/newfolder.php', + data: "dir="+$('#dir').val()+"&foldername="+$('#file_new_dir_name').val(), + complete: function(data){boolOperationFinished(data, false);} + }); + }); + + $('#file_newfolder_name').click(function(){ + if($('#file_newfolder_name').val() == 'New Folder'){ + $('#file_newfolder_name').val(''); + } + }); + + $('#file_newfolder_name').bind('keyup', adjustNewFolderSize); + + $('#file_newfolder_submit').bind('vanish', function() { + $('#file_newfolder_name').bind('keyup', adjustNewFolderSize); + unsplitSize($('#file_newfolder_name'),$('#file_newfolder_submit')); + }); + + $('#file_newfolder_name').focusout(function(){ + if($('#file_newfolder_name').val() == '') { + $('#file_newfolder_form')[0].reset(); + $('#file_newfolder_submit').fadeOut(250).trigger('vanish'); + } + }); + + $('#file_newfolder_submit').click(function() { + if($('#file_newfolder_name').val() != '') { + $.ajax({ + url: 'ajax/newfolder.php', + data: "dir="+$('#dir').val()+"&foldername="+$('#file_newfolder_name').val(), + complete: function(data){ + boolOperationFinished(data, false); + $('#file_newfolder_form')[0].reset(); + } + }); + } + $('#file_newfolder_submit').fadeOut(250).trigger('vanish'); + }); + +// $('.upload').click(function(){ +// if($('#file_action_panel').attr('activeAction') != 'upload') { +// $('#file_action_panel').attr('activeAction', 'upload'); +// $('#fileSelector').replaceWith('<input type="file" name="file" id="fileSelector">'); +// $('#fileSelector').change(function() { +// $('#file_upload_start').val('Upload ' + $('#fileSelector').val()); +// $('p.actions a.upload:first').after($('#file_upload_form')); +// $('#file_upload_form').css('display', 'inline'); +// $('p.actions a.upload:first').hide(); +// $('#fileSelector').hide(); +// }); +// $('#file_action_panel form').slideUp(250); +// // $('#file_upload_form').slideDown(250); +// $('#fileSelector').click(); +// } else { +// $('#file_action_panel').attr('activeAction', 'false'); +// $('#file_upload_form').slideUp(250); +// } +// return false; +// }); + + + +// $('.new-dir').click(function(){ +// if($('#file_action_panel').attr('activeAction') != 'new-dir') { +// $('#file_action_panel').attr('activeAction', 'new-dir'); +// $('#file_new_dir_name').val(''); +// $('#file_action_panel form').slideUp(250); +// $('#file_newfolder_form').slideDown(250); +// } else { +// $('#file_newfolder_form').slideUp(250); +// $('#file_action_panel').attr('activeAction', false); +// } +// return false; +// }); + + $('.download').click(function(event) { + var files=''; + $('td.selection input:checkbox:checked').parent().parent().children('.filename').each(function(i,element){ + files+=';'+$(element).text(); + }); + files=files.substr(1);//remove leading ; + + //send the browser to the download location + var dir=$('#dir').val()||'/'; +// alert(files); + window.location='ajax/download.php?files='+files+'&dir='+dir; + return false; + }); + + $('.delete').click(function(event) { + var files=''; + $('td.selection input:checkbox:checked').parent().parent().children('.filename').each(function(i,element){ + files+=';'+$(element).text(); + }); + files=files.substr(1);//remove leading ; + + $.ajax({ + url: 'ajax/delete.php', + data: "dir="+$('#dir').val()+"&files="+files, + complete: function(data){ + boolOperationFinished(data, false); + } + }); + + return false; + }); +}); + +var adjustNewFolderSize = function() { + if($('#file_newfolder_name').val() != '') { + splitSize($('#file_newfolder_name'),$('#file_newfolder_submit')); + $('#file_newfolder_name').unbind('keyup', adjustNewFolderSize); + }; +} + +function splitSize(existingEl, appearingEl) { + nw = parseInt($(existingEl).css('width')) - parseInt($(appearingEl).css('width')); + $(existingEl).css('width', nw + 'px'); + $(appearingEl).fadeIn(250); +} + +function unsplitSize(stayingEl, vanishingEl) { + nw = parseInt($(stayingEl).css('width')) + parseInt($(vanishingEl).css('width')); + $(stayingEl).css('width', nw + 'px'); + $(vanishingEl).fadeOut(250); +} + +function uploadFinished() { + result = $('#file_upload_target').contents().text(); + result = eval("(" + result + ");"); + $('#file_upload_target').load(function(){}); + if(result.status == "error") { + if($('#file_upload_form').attr('uploading') == true) { + alert('An error occcured, upload failed.\nError code: ' + result.data.error + '\nFilename: ' + result.data.file); + } + } else { + dir = $('#dir').val(); + $.ajax({ + url: 'ajax/list.php', + data: "dir="+dir, + complete: function(data) { + refreshContents(data); +// $('#file_action_panel').prepend($('#file_upload_form')); +// $('#file_upload_form').css('display', 'block').hide(); +// $('p.actions a.upload:first').show(); + $('#file_upload_start').val('Upload ' + $('.max_human_file_size:first').val()); + $('#file_upload_start').attr('mode', 'menu'); + } + }); + } + $('#file_upload_form').attr('uploading', false); +} + +function resetFileActionPanel() { + $('#file_action_panel form').css({"display":"none"}); + $('#file_action_panel').attr('activeAction', false); +} + +function boolOperationFinished(data, single, el) { + result = eval("("+data.responseText+");"); + if(result.status == 'success'){ + if(single) { + $('#file_menu').slideToggle(0); + $('body').append($('#file_menu')); + $(el).remove(); + } else { + $.ajax({ + url: 'ajax/list.php', + data: "dir="+$('#dir').val(), + complete: refreshContents + }); + } + } else { + alert(result.data.message); + } +} + +function refreshContents(data) { + result = eval("("+data.responseText+");"); + if(typeof(result.data.breadcrumb) != 'undefined'){ + updateBreadcrumb(result.data.breadcrumb); + } + updateFileList(result.data.files); + $('td.fileaction a').click(function() { + $(this).parent().append($('#file_menu')); + $('#file_menu').slideToggle(250); + return false; + }); + resetFileActionPanel(); +} + +function updateBreadcrumb(breadcrumbHtml) { + $('p.nav').empty().html(breadcrumbHtml); +} + +function updateFileList(fileListHtml) { + $('#fileList').empty().html(fileListHtml); +} diff --git a/files/pull.php b/files/pull.php deleted file mode 100644 index 1cc82425845fa52413ab15a8ed3ea31a433a15e1..0000000000000000000000000000000000000000 --- a/files/pull.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php -$token=$_GET['token']; - -$file=sys_get_temp_dir().'/'.'remoteCloudFile'.$token; -if(file_exists($file) and is_readable($file) and is_writable($file)){ - readfile($file); - unlink($file); -}else{ - header("HTTP/1.0 404 Not Found"); -} -?> \ No newline at end of file diff --git a/files/settings.php b/files/settings.php new file mode 100644 index 0000000000000000000000000000000000000000..23aed4d1b866a0727b4530cc5e011b048b184486 --- /dev/null +++ b/files/settings.php @@ -0,0 +1,64 @@ +<?php + +/** +* ownCloud - ajax frontend +* +* @author Robin Appelman +* @copyright 2010 Robin Appelman icewind1991@gmail.com +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU AFFERO GENERAL PUBLIC LICENSE for more details. +* +* You should have received a copy of the GNU Affero General Public +* License along with this library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + + +// Init owncloud +require_once('../lib/base.php'); +require( 'template.php' ); + +// Check if we are a user +if( !OC_USER::isLoggedIn()){ + header( "Location: ".OC_HELPER::linkTo( "index.php" )); + exit(); +} + +// Load the files we need +OC_UTIL::addStyle( "files", "files" ); +OC_UTIL::addScript( "files", "files" ); + +// Load the files +$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : ''; + +$files = array(); +foreach( OC_FILES::getdirectorycontent( $dir ) as $i ){ + $i["date"] = date( $CONFIG_DATEFORMAT, $i["mtime"] ); + $files[] = $i; +} + +// Make breadcrumb +$breadcrumb = array(); +$pathtohere = "/"; +foreach( explode( "/", $dir ) as $i ){ + if( $i != "" ){ + $pathtohere .= "$i/"; + $breadcrumb[] = array( "dir" => $pathtohere, "name" => $i ); + } +} + +// return template +$tmpl = new OC_TEMPLATE( "files", "index", "user" ); +$tmpl->assign( 'files', $files ); +$tmpl->assign( "breadcrumb", $breadcrumb ); +$tmpl->printPage(); + +?> diff --git a/files/templates/admin.php b/files/templates/admin.php new file mode 100644 index 0000000000000000000000000000000000000000..f768931eb2f95895e113c5efd26d31b290aeeada --- /dev/null +++ b/files/templates/admin.php @@ -0,0 +1,16 @@ +<form action='#' method='post'> + <?php if($_['htaccessWorking']):?> + Maximum upload size <input name='maxUploadSize' value='<?php echo $_['uploadMaxFilesize'] ?>'/><br/> + <?php endif;?> + <input type="checkbox" /> Allow public folders<br> + + (if public is enabled)<br> + <input type="radio" name="sharingaim" checked="checked" /> separated from webdav storage<br> + <input type="radio" name="sharingaim" /> let the user decide<br> + <input type="radio" name="sharingaim" /> folder "/public" in webdav storage<br> + (endif)<br> + + <input type="checkbox" /> Allow downloading shared files<br> + <input type="checkbox" /> Allow uploading in shared directory<br> + <input type='submit' value='Save'/> +</form> diff --git a/files/templates/index.php b/files/templates/index.php new file mode 100644 index 0000000000000000000000000000000000000000..4d34222b9667a34ae1b123cbf0b2386d04e6fc0d --- /dev/null +++ b/files/templates/index.php @@ -0,0 +1,37 @@ +<div class="controls"> + <div class="actions"> + <form id="file_upload_form" action="ajax/upload.php" +method="post" enctype="multipart/form-data" target="file_upload_target"><input +type="hidden" name="MAX_FILE_SIZE" value="<?php echo $_["uploadMaxFilesize"] ?>" id="max_upload"><input +type="hidden" class="max_human_file_size" value="(max <?php echo $_["uploadMaxHumanFilesize"]; ?>)"><input type="hidden" name="dir" value="<?php echo $_["dir"] ?>" id="dir"><input class="prettybutton" type="submit" id="file_upload_start" value="Upload (max <?php echo $_["uploadMaxHumanFilesize"];?>)" /> <input class="prettybutton" type="button" id="file_upload_cancel" value="X" /><input type="file" name="file" id="fileSelector"><iframe id="file_upload_target" name="file_upload_target" src=""></iframe></form><form id="file_newfolder_form"><input type="text" class="prettybutton" name="file_newfolder_name" id="file_newfolder_name" value="New Folder" /> <input class="prettybutton" type="button" id="file_newfolder_submit" name="file_newfolder_submit" value="OK" /></form><a href="" title="" class="download">Download</a><a href="" title="" class="share">Share</a><a href="" title="" class="delete">Delete</a> + </div> + <div id="file_action_panel"> + </div> +</div> + +<p class="nav"> + <?php echo($_['breadcrumb']); ?> +</p> + +<table cellspacing="0"> + <thead> + <tr> + <th><input type="checkbox" id="select_all" /></th> + <th>Name</th> + <th>Size</th> + <th>Modified</th> + <th></th> + </tr> + </thead> + <tbody id="fileList"> + <?php echo($_['fileList']); ?> + </tbody> +</table> + +<div id="file_menu"> + <ul> + <li><a href="" title="" id="download_single_file">Download</a></li> + <li><a href="" title="">Share</a></li> + <li><a href="" title="" id="delete_single_file">Delete</a></li> + </ul> +</div> diff --git a/files/templates/part.breadcrumb.php b/files/templates/part.breadcrumb.php new file mode 100644 index 0000000000000000000000000000000000000000..da9544008b99137d8f46a1fe1558373c9636ef88 --- /dev/null +++ b/files/templates/part.breadcrumb.php @@ -0,0 +1,4 @@ + <a href="<?php echo link_to("files", "index.php?dir=/"); ?>"><img src="<?php echo image_path("", "actions/go-home.png"); ?>" alt="Root" /></a> + <?php foreach($_["breadcrumb"] as $crumb): ?> + <a href="<?php echo link_to("files", "index.php?dir=".$crumb["dir"]); ?>"><?php echo htmlspecialchars($crumb["name"]); ?></a> + <?php endforeach; ?> \ No newline at end of file diff --git a/files/templates/part.list.php b/files/templates/part.list.php new file mode 100644 index 0000000000000000000000000000000000000000..0d3355678c3ec80a86dcb63712979fad754a13ed --- /dev/null +++ b/files/templates/part.list.php @@ -0,0 +1,9 @@ + <?php foreach($_["files"] as $file): ?> + <tr> + <td class="selection"><input type="checkbox" /></td> + <td class="filename"><a style="background-image:url(<?php if($file["type"] == "dir") echo mimetype_icon("dir"); else echo mimetype_icon($file["mime"]); ?>)" href="<?php if($file["type"] == "dir") echo link_to("files", "index.php?dir=".$file["directory"]."/".$file["name"]); else echo link_to("files", "download.php?file=".$file["directory"]."/".$file["name"]); ?>" title=""><?php echo htmlspecialchars($file["name"]); ?></a></td> + <td class="filesize"><?php echo human_file_size($file["size"]); ?></td> + <td class="date"><?php echo $file["date"]; ?></td> + <td class="fileaction"><a href="" title="+" class='dropArrow'></a></td> + </tr> + <?php endforeach; ?> \ No newline at end of file diff --git a/files/upload.php b/files/upload.php deleted file mode 100644 index 08c89e7602421da821545b50e7bf2de858d0610a..0000000000000000000000000000000000000000 --- a/files/upload.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php - -/** -* ownCloud - ajax frontend -* -* @author Robin Appelman -* @copyright 2010 Robin Appelman icewind1991@gmail.com -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either -* version 3 of the License, or any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. -* -*/ -require_once('../inc/lib_base.php'); - -$fileName=$_FILES['file']['name']; -$source=$_FILES['file']['tmp_name']; -$target=stripslashes($_GET['dir']).'/'.$fileName; -if(isset($_SESSION['username']) and $_SESSION['username'] and strpos($_GET['dir'],'..')===false){ - if(OC_FILESYSTEM::fromTmpFile($source,$target)){ - echo 'true'; - }else{ - echo 'false'; - } -}else{ - echo 'false'; -} -?> \ No newline at end of file diff --git a/webdav/owncloud.php b/files/webdav.php similarity index 79% rename from webdav/owncloud.php rename to files/webdav.php index fc9efa66498cf676f8080b72c5eb24576d820c65..ac7a1a5567fc738fb017e528a3ad9721e1d449c3 100644 --- a/webdav/owncloud.php +++ b/files/webdav.php @@ -3,32 +3,32 @@ /** * ownCloud * -* @author Frank Karlitschek -* @copyright 2010 Frank Karlitschek karlitschek@kde.org -* +* @author Frank Karlitschek +* @copyright 2010 Frank Karlitschek karlitschek@kde.org +* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either +* License as published by the Free Software Foundation; either * version 3 of the License, or any later version. -* +* * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public +* +* You should have received a copy of the GNU Affero General Public * License along with this library. If not, see <http://www.gnu.org/licenses/>. -* +* */ -require_once('../inc/lib_base.php'); -oc_require_once('HTTP/WebDAV/Server/Filesystem.php'); +require_once('../lib/base.php'); +require_once('HTTP/WebDAV/Server/Filesystem.php'); ini_set('default_charset', 'UTF-8'); #ini_set('error_reporting', ''); -ob_clean(); +@ob_clean(); if(empty($_SERVER['PHP_AUTH_USER']) && empty($_SERVER['REDIRECT_REMOTE_USER'])) { header('WWW-Authenticate: Basic realm="ownCloud"'); @@ -41,9 +41,8 @@ $passwd=$_SERVER['PHP_AUTH_PW']; if(OC_USER::login($user,$passwd)){ OC_UTIL::setUpFS(); $server = new HTTP_WebDAV_Server_Filesystem(); - $server->db_name = $CONFIG_DBNAME; $server->ServeRequest($CONFIG_DATADIRECTORY); - + }else{ header('WWW-Authenticate: Basic realm="ownCloud"'); header('HTTP/1.0 401 Unauthorized'); @@ -52,4 +51,4 @@ if(OC_USER::login($user,$passwd)){ -?> \ No newline at end of file +?> diff --git a/help/appinfo/app.php b/help/appinfo/app.php new file mode 100644 index 0000000000000000000000000000000000000000..fd46085ef77f75e7ec4d3bab8e8226ba567ddb9a --- /dev/null +++ b/help/appinfo/app.php @@ -0,0 +1,14 @@ +<?php + +OC_APP::register( array( "order" => 1, "id" => "help", "name" => "Help" )); + +// Workaround for having help as the last entry always +$entry = array( "id" => "help", "order" => 1000, "href" => OC_HELPER::linkTo( "help", "index.php" ), "name" => "Help", "icon" => OC_HELPER::imagePath( "help", "help.png" )); +if( isset( $_SESSION["user_id"] ) && OC_GROUP::inGroup( $_SESSION["user_id"], "admin" )){ + OC_APP::addAdminPage( $entry ); +} +else{ + OC_APP::addSettingsPage( $entry ); +} + +?> diff --git a/help/css/help.css b/help/css/help.css new file mode 100644 index 0000000000000000000000000000000000000000..e46cf1120925629cc452bbf848855407fc674f4b --- /dev/null +++ b/help/css/help.css @@ -0,0 +1,48 @@ +/* APPS TABLE */ + +table td.date +{ + width: 5em; + padding: 0.5em 1em; + text-align: right; +} + +.preview +{ + padding: 3px; + text-align: left; +} + +table td.date +{ + width: 11em; + color: #555555; +} + +table td.selection, table th.selection, table td.fileaction +{ + width: 2em; + text-align: center; +} + +table td.name a +{ + padding: 6px; + text-decoration: none; + color: #555555; +} + +.type +{ + text-decoration: none; + color: #888888; + font-size: 0.8em; +} + +.description +{ + text-decoration: none; + color: #666666; + font-size: 0.9em; +} + diff --git a/help/img/help.png b/help/img/help.png new file mode 100644 index 0000000000000000000000000000000000000000..487c6e6fd9241ad9f5e106b2989d16771226d937 Binary files /dev/null and b/help/img/help.png differ diff --git a/help/index.php b/help/index.php new file mode 100644 index 0000000000000000000000000000000000000000..de461c2941239f7d685acb8376f440e1182af156 --- /dev/null +++ b/help/index.php @@ -0,0 +1,28 @@ +<?php + +require_once('../lib/base.php'); +require( 'template.php' ); +if( !OC_USER::isLoggedIn()){ + header( "Location: ".OC_HELPER::linkTo( "index.php" )); + exit(); +} + +//hardcode for testing +$pagecount=8; +$page=2; + + +// Load the files we need +OC_UTIL::addStyle( "help", "help" ); +OC_APP::setActiveNavigationEntry( "help" ); + +$kbe=OC_OCSCLIENT::getKnownledgebaseEntries(); + + +$tmpl = new OC_TEMPLATE( "help", "index", "admin" ); +$tmpl->assign( "kbe", $kbe ); +$tmpl->assign( "pagecount", $pagecount ); +$tmpl->assign( "page", $page ); +$tmpl->printPage(); + +?> diff --git a/help/templates/index.php b/help/templates/index.php new file mode 100644 index 0000000000000000000000000000000000000000..a117c3d5fb40195c4dc200a1d43a82be12a15f87 --- /dev/null +++ b/help/templates/index.php @@ -0,0 +1,23 @@ + +<h1>Questions and Answers</h1> + +<table cellspacing="0" width="100%"> + <tbody> + <?php foreach($_["kbe"] as $kb): ?> + <tr> + <td width="1"><?php if($kb["preview1"] <> "") { echo('<img class="preview" border="0" src="'.$kb["preview1"].'" />'); } ?> </a></td> + <td class="name"><?php echo $kb["name"]; ?><br /><?php echo('<span class="type">'.$kb['description'].'</span>'); ?><br /> + <?php if($kb['answer']<>'') echo('<br /><span class="type"><b>Answer:</b></span><br /><span class="type">'.$kb['answer'].'</span>');?> + </td> + </tr> + <?php endforeach; ?> + </tbody> +</table> +<?php + $url=OC_HELPER::linkTo( "help", "index.php" ).'?page='; + $pageNavi=OC_UTIL::getPageNavi($_['pagecount'],$_['page'],$url); + $pageNavi->printPage(); +?> +<a target="_blank" class="prettybutton" href="http://apps.owncloud.com/knowledgebase/editquestion.php?action=new">ASK A QUESTION</a> + + diff --git a/img/actions/arrow-down.png b/img/actions/arrow-down.png new file mode 100644 index 0000000000000000000000000000000000000000..03f201428ade2247beda4510d7d026239ce76e95 Binary files /dev/null and b/img/actions/arrow-down.png differ diff --git a/img/actions/arrow-left.png b/img/actions/arrow-left.png new file mode 100644 index 0000000000000000000000000000000000000000..b56cfee03dfefe9ff8f2c5e7e2a8a0bb0b15ba6e Binary files /dev/null and b/img/actions/arrow-left.png differ diff --git a/img/actions/arrow-right.png b/img/actions/arrow-right.png new file mode 100644 index 0000000000000000000000000000000000000000..0acee70bcdd2d9b0a95b2971713bd34ce923bc3e Binary files /dev/null and b/img/actions/arrow-right.png differ diff --git a/img/actions/arrow-up.png b/img/actions/arrow-up.png new file mode 100644 index 0000000000000000000000000000000000000000..5e423213fbd735f153563b7655bda918cafc868a Binary files /dev/null and b/img/actions/arrow-up.png differ diff --git a/img/actions/go-home.png b/img/actions/go-home.png new file mode 100644 index 0000000000000000000000000000000000000000..3802c98fc465bce1296799c41db28ba37c0756ae Binary files /dev/null and b/img/actions/go-home.png differ diff --git a/img/arrow.png b/img/arrow.png deleted file mode 100644 index 2d64bbdb7e6661aea1043defd51c9f58dccab1be..0000000000000000000000000000000000000000 Binary files a/img/arrow.png and /dev/null differ diff --git a/img/arrow_down.png b/img/arrow_down.png deleted file mode 100644 index ecbca6ef606a63a21ce50f01b095778fdbefd10f..0000000000000000000000000000000000000000 Binary files a/img/arrow_down.png and /dev/null differ diff --git a/img/arrow_up.png b/img/arrow_up.png deleted file mode 100644 index e2457c88838ed3c2ce28de117b80fc3597a4abf8..0000000000000000000000000000000000000000 Binary files a/img/arrow_up.png and /dev/null differ diff --git a/img/body_background.jpg b/img/body_background.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c3d0102f711d0b290c18082e53461ac8702f4eb2 Binary files /dev/null and b/img/body_background.jpg differ diff --git a/img/dots.png b/img/dots.png deleted file mode 100644 index 5a98627cf5f39e9b36146d29f0c26fbf0a5ff756..0000000000000000000000000000000000000000 Binary files a/img/dots.png and /dev/null differ diff --git a/img/drop-arrow.png b/img/drop-arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..315395d5d4240bb8c2372e92f0af90ce0c9450b4 Binary files /dev/null and b/img/drop-arrow.png differ diff --git a/img/favicon-touch.png b/img/favicon-touch.png new file mode 100644 index 0000000000000000000000000000000000000000..20af826523cfdb9da47ba1208c81df38ecb3973c Binary files /dev/null and b/img/favicon-touch.png differ diff --git a/img/favicon.png b/img/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..a7ee766dfa8931c9a707520176aa02aee76bb7b0 Binary files /dev/null and b/img/favicon.png differ diff --git a/img/header-a.png b/img/header-a.png new file mode 100644 index 0000000000000000000000000000000000000000..46fb0977ee2c49444c29312c48acacc4d826131f Binary files /dev/null and b/img/header-a.png differ diff --git a/img/header-login.png b/img/header-login.png new file mode 100644 index 0000000000000000000000000000000000000000..b0160e02d1f34172bd4c2e684f8716bdb71c4572 Binary files /dev/null and b/img/header-login.png differ diff --git a/img/header-settings-a.png b/img/header-settings-a.png new file mode 100644 index 0000000000000000000000000000000000000000..a72271be6a48d44a21a26e99f1e7d69dcbfd802e Binary files /dev/null and b/img/header-settings-a.png differ diff --git a/img/header-settings.png b/img/header-settings.png new file mode 100644 index 0000000000000000000000000000000000000000..7e6b70b5903bcdfb2422e225cf4c17bd2af8ca6e Binary files /dev/null and b/img/header-settings.png differ diff --git a/img/header.png b/img/header.png new file mode 100644 index 0000000000000000000000000000000000000000..d377f65186d24983acf78756db7deff093d566d4 Binary files /dev/null and b/img/header.png differ diff --git a/img/icons/COPYING b/img/icons/COPYING deleted file mode 100644 index e6d31d3e91790b98663eb53f43dac03fe8ff5f01..0000000000000000000000000000000000000000 --- a/img/icons/COPYING +++ /dev/null @@ -1,215 +0,0 @@ -The Oxygen Icon Theme - Copyright (C) 2007 David Vignoni <david@icon-king.com> - Copyright (C) 2007 Johann Ollivier Lapeyre <johann@oxygen-icons.org> - Copyright (C) 2007 Kenneth Wimer <kwwii@bootsplash.org> - Copyright (C) 2007 Nuno Pinheiro <nuno@oxygen-icons.org> - Copyright (C) 2007 Riccardo Iaconelli <riccardo@oxygen-icons.org> - Copyright (C) 2007 David Miller <miller@oxygen-icons.org> - -and others - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library. If not, see <http://www.gnu.org/licenses/>. - -Clarification: - - The GNU Lesser General Public License or LGPL is written for - software libraries in the first place. We expressly want the LGPL to - be valid for this artwork library too. - - KDE Oxygen theme icons is a special kind of software library, it is an - artwork library, it's elements can be used in a Graphical User Interface, or - GUI. - - Source code, for this library means: - - where they exist, SVG; - - otherwise, if applicable, the multi-layered formats xcf or psd, or - otherwise png. - - The LGPL in some sections obliges you to make the files carry - notices. With images this is in some cases impossible or hardly useful. - - With this library a notice is placed at a prominent place in the directory - containing the elements. You may follow this practice. - - The exception in section 5 of the GNU Lesser General Public License covers - the use of elements of this art library in a GUI. - - kde-artists [at] kde.org - ------ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. diff --git a/img/icons/delete.png b/img/icons/delete.png deleted file mode 100644 index d04a554ee17853a053c7c6a795d6aa20ed32aa9d..0000000000000000000000000000000000000000 Binary files a/img/icons/delete.png and /dev/null differ diff --git a/img/icons/folder.png b/img/icons/folder.png deleted file mode 100644 index 536da3d1c39096335080a97d29953d38e382c121..0000000000000000000000000000000000000000 Binary files a/img/icons/folder.png and /dev/null differ diff --git a/img/icons/loading.gif b/img/icons/loading.gif deleted file mode 100644 index 40efb9be59470e7727184d30f470221e463c935a..0000000000000000000000000000000000000000 Binary files a/img/icons/loading.gif and /dev/null differ diff --git a/img/icons/other.png b/img/icons/other.png deleted file mode 100644 index 98a0a42dc1efea8389e78fa8251ae5d2717457e4..0000000000000000000000000000000000000000 Binary files a/img/icons/other.png and /dev/null differ diff --git a/img/icons/rename.png b/img/icons/rename.png deleted file mode 100644 index 2323757e0e94760b6aec976d52da09ee2584bb7d..0000000000000000000000000000000000000000 Binary files a/img/icons/rename.png and /dev/null differ diff --git a/img/layout/back.png b/img/layout/back.png new file mode 100644 index 0000000000000000000000000000000000000000..86abbe0cabe37a4b47f32241b5f327bc346f98ce Binary files /dev/null and b/img/layout/back.png differ diff --git a/img/layout/logout.png b/img/layout/logout.png new file mode 100644 index 0000000000000000000000000000000000000000..74dcd33bee7b1bd0d502068f570e300fa0f4d9ce Binary files /dev/null and b/img/layout/logout.png differ diff --git a/img/layout/settings.png b/img/layout/settings.png new file mode 100644 index 0000000000000000000000000000000000000000..ff650ecb0b0eaa766a055ec8d5f31648539177d6 Binary files /dev/null and b/img/layout/settings.png differ diff --git a/img/mimetypes/file.png b/img/mimetypes/file.png new file mode 100644 index 0000000000000000000000000000000000000000..4979044889708bf736aefaee7ade0b1f4462600e Binary files /dev/null and b/img/mimetypes/file.png differ diff --git a/img/owncloud-icon.png b/img/owncloud-icon.png deleted file mode 100644 index af123f0cd529a925773d7e630c23d53ae1aa6f22..0000000000000000000000000000000000000000 Binary files a/img/owncloud-icon.png and /dev/null differ diff --git a/img/owncloud-logo-medium-white.png b/img/owncloud-logo-medium-white.png new file mode 100644 index 0000000000000000000000000000000000000000..d4d06fdd62d6a1cfe82170b3009fd8a9f36e0a1e Binary files /dev/null and b/img/owncloud-logo-medium-white.png differ diff --git a/img/owncloud-logo-small-white.png b/img/owncloud-logo-small-white.png new file mode 100644 index 0000000000000000000000000000000000000000..397ddf91341592b1a6a28824db55254a46dd84d5 Binary files /dev/null and b/img/owncloud-logo-small-white.png differ diff --git a/img/owncloud-logo-small.png b/img/owncloud-logo-small.png deleted file mode 100644 index 62dff2559bbaf3a97e526b35c3cfe8290ab2b8d9..0000000000000000000000000000000000000000 Binary files a/img/owncloud-logo-small.png and /dev/null differ diff --git a/img/owncloud-logo.png b/img/owncloud-logo.png deleted file mode 100644 index 4f42e4b8fb93427a8fd6106d0f06459c1e63605c..0000000000000000000000000000000000000000 Binary files a/img/owncloud-logo.png and /dev/null differ diff --git a/img/places/folder.png b/img/places/folder.png new file mode 100644 index 0000000000000000000000000000000000000000..3edbe257a34cf50b5015f427138a67ea4debb5cf Binary files /dev/null and b/img/places/folder.png differ diff --git a/img/weather-clear.png b/img/weather-clear.png new file mode 100644 index 0000000000000000000000000000000000000000..0acf7a9b2afd4ba9b8492f51d5204721f9e4559a Binary files /dev/null and b/img/weather-clear.png differ diff --git a/inc/Archive/Tar.php b/inc/Archive/Tar.php deleted file mode 100644 index d6e6e29350e3a2787fee9d02710027ec76e6f5f5..0000000000000000000000000000000000000000 --- a/inc/Archive/Tar.php +++ /dev/null @@ -1,1762 +0,0 @@ -<?php -/* vim: set ts=4 sw=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: Vincent Blavet <vincent@phpconcept.net> | -// +----------------------------------------------------------------------+ -// -// $Id: Tar.php,v 1.29 2005/03/17 21:02:31 vblavet Exp $ - -require_once 'PEAR.php'; - - -define ('ARCHIVE_TAR_ATT_SEPARATOR', 90001); - -/** -* Creates a (compressed) Tar archive -* -* @author Vincent Blavet <vincent@phpconcept.net> -* @version $Revision: 1.29 $ -* @package Archive -*/ -class Archive_Tar extends PEAR -{ - /** - * @var string Name of the Tar - */ - var $_tarname=''; - - /** - * @var boolean if true, the Tar file will be gzipped - */ - var $_compress=false; - - /** - * @var string Type of compression : 'none', 'gz' or 'bz2' - */ - var $_compress_type='none'; - - /** - * @var string Explode separator - */ - var $_separator=' '; - - /** - * @var file descriptor - */ - var $_file=0; - - /** - * @var string Local Tar name of a remote Tar (http:// or ftp://) - */ - var $_temp_tarname=''; - - // {{{ constructor - /** - * Archive_Tar Class constructor. This flavour of the constructor only - * declare a new Archive_Tar object, identifying it by the name of the - * tar file. - * If the compress argument is set the tar will be read or created as a - * gzip or bz2 compressed TAR file. - * - * @param string $p_tarname The name of the tar archive to create - * @param string $p_compress can be null, 'gz' or 'bz2'. This - * parameter indicates if gzip or bz2 compression - * is required. For compatibility reason the - * boolean value 'true' means 'gz'. - * @access public - */ - function Archive_Tar($p_tarname, $p_compress = null) - { - $this->PEAR(); - $this->_compress = false; - $this->_compress_type = 'none'; - if (($p_compress === null) || ($p_compress == '')) { - if (@file_exists($p_tarname)) { - if ($fp = @fopen($p_tarname, "rb")) { - // look for gzip magic cookie - $data = fread($fp, 2); - fclose($fp); - if ($data == "\37\213") { - $this->_compress = true; - $this->_compress_type = 'gz'; - // No sure it's enought for a magic code .... - } elseif ($data == "BZ") { - $this->_compress = true; - $this->_compress_type = 'bz2'; - } - } - } else { - // probably a remote file or some file accessible - // through a stream interface - if (substr($p_tarname, -2) == 'gz') { - $this->_compress = true; - $this->_compress_type = 'gz'; - } elseif ((substr($p_tarname, -3) == 'bz2') || - (substr($p_tarname, -2) == 'bz')) { - $this->_compress = true; - $this->_compress_type = 'bz2'; - } - } - } else { - if (($p_compress === true) || ($p_compress == 'gz')) { - $this->_compress = true; - $this->_compress_type = 'gz'; - } else if ($p_compress == 'bz2') { - $this->_compress = true; - $this->_compress_type = 'bz2'; - } else { - die("Unsupported compression type '$p_compress'\n". - "Supported types are 'gz' and 'bz2'.\n"); - return false; - } - } - $this->_tarname = $p_tarname; - if ($this->_compress) { // assert zlib or bz2 extension support - if ($this->_compress_type == 'gz') - $extname = 'zlib'; - else if ($this->_compress_type == 'bz2') - $extname = 'bz2'; - - if (!extension_loaded($extname)) { - PEAR::loadExtension($extname); - } - if (!extension_loaded($extname)) { - die("The extension '$extname' couldn't be found.\n". - "Please make sure your version of PHP was built ". - "with '$extname' support.\n"); - return false; - } - } - } - // }}} - - // {{{ destructor - function _Archive_Tar() - { - $this->_close(); - // ----- Look for a local copy to delete - if ($this->_temp_tarname != '') - @unlink($this->_temp_tarname); - $this->_PEAR(); - } - // }}} - - // {{{ create() - /** - * This method creates the archive file and add the files / directories - * that are listed in $p_filelist. - * If a file with the same name exist and is writable, it is replaced - * by the new tar. - * The method return false and a PEAR error text. - * The $p_filelist parameter can be an array of string, each string - * representing a filename or a directory name with their path if - * needed. It can also be a single string with names separated by a - * single blank. - * For each directory added in the archive, the files and - * sub-directories are also added. - * See also createModify() method for more details. - * - * @param array $p_filelist An array of filenames and directory names, or a - * single string with names separated by a single - * blank space. - * @return true on success, false on error. - * @see createModify() - * @access public - */ - function create($p_filelist) - { - return $this->createModify($p_filelist, '', ''); - } - // }}} - - // {{{ add() - /** - * This method add the files / directories that are listed in $p_filelist in - * the archive. If the archive does not exist it is created. - * The method return false and a PEAR error text. - * The files and directories listed are only added at the end of the archive, - * even if a file with the same name is already archived. - * See also createModify() method for more details. - * - * @param array $p_filelist An array of filenames and directory names, or a - * single string with names separated by a single - * blank space. - * @return true on success, false on error. - * @see createModify() - * @access public - */ - function add($p_filelist) - { - return $this->addModify($p_filelist, '', ''); - } - // }}} - - // {{{ extract() - function extract($p_path='') - { - return $this->extractModify($p_path, ''); - } - // }}} - - // {{{ listContent() - function listContent() - { - $v_list_detail = array(); - - if ($this->_openRead()) { - if (!$this->_extractList('', $v_list_detail, "list", '', '')) { - unset($v_list_detail); - $v_list_detail = 0; - } - $this->_close(); - } - - return $v_list_detail; - } - // }}} - - // {{{ createModify() - /** - * This method creates the archive file and add the files / directories - * that are listed in $p_filelist. - * If the file already exists and is writable, it is replaced by the - * new tar. It is a create and not an add. If the file exists and is - * read-only or is a directory it is not replaced. The method return - * false and a PEAR error text. - * The $p_filelist parameter can be an array of string, each string - * representing a filename or a directory name with their path if - * needed. It can also be a single string with names separated by a - * single blank. - * The path indicated in $p_remove_dir will be removed from the - * memorized path of each file / directory listed when this path - * exists. By default nothing is removed (empty path '') - * The path indicated in $p_add_dir will be added at the beginning of - * the memorized path of each file / directory listed. However it can - * be set to empty ''. The adding of a path is done after the removing - * of path. - * The path add/remove ability enables the user to prepare an archive - * for extraction in a different path than the origin files are. - * See also addModify() method for file adding properties. - * - * @param array $p_filelist An array of filenames and directory names, - * or a single string with names separated by - * a single blank space. - * @param string $p_add_dir A string which contains a path to be added - * to the memorized path of each element in - * the list. - * @param string $p_remove_dir A string which contains a path to be - * removed from the memorized path of each - * element in the list, when relevant. - * @return boolean true on success, false on error. - * @access public - * @see addModify() - */ - function createModify($p_filelist, $p_add_dir, $p_remove_dir='') - { - $v_result = true; - - if (!$this->_openWrite()) - return false; - - if ($p_filelist != '') { - if (is_array($p_filelist)) - $v_list = $p_filelist; - elseif (is_string($p_filelist)) - $v_list = explode($this->_separator, $p_filelist); - else { - $this->_cleanFile(); - $this->_error('Invalid file list'); - return false; - } - - $v_result = $this->_addList($v_list, $p_add_dir, $p_remove_dir); - } - - if ($v_result) { - $this->_writeFooter(); - $this->_close(); - } else - $this->_cleanFile(); - - return $v_result; - } - // }}} - - // {{{ addModify() - /** - * This method add the files / directories listed in $p_filelist at the - * end of the existing archive. If the archive does not yet exists it - * is created. - * The $p_filelist parameter can be an array of string, each string - * representing a filename or a directory name with their path if - * needed. It can also be a single string with names separated by a - * single blank. - * The path indicated in $p_remove_dir will be removed from the - * memorized path of each file / directory listed when this path - * exists. By default nothing is removed (empty path '') - * The path indicated in $p_add_dir will be added at the beginning of - * the memorized path of each file / directory listed. However it can - * be set to empty ''. The adding of a path is done after the removing - * of path. - * The path add/remove ability enables the user to prepare an archive - * for extraction in a different path than the origin files are. - * If a file/dir is already in the archive it will only be added at the - * end of the archive. There is no update of the existing archived - * file/dir. However while extracting the archive, the last file will - * replace the first one. This results in a none optimization of the - * archive size. - * If a file/dir does not exist the file/dir is ignored. However an - * error text is send to PEAR error. - * If a file/dir is not readable the file/dir is ignored. However an - * error text is send to PEAR error. - * - * @param array $p_filelist An array of filenames and directory - * names, or a single string with names - * separated by a single blank space. - * @param string $p_add_dir A string which contains a path to be - * added to the memorized path of each - * element in the list. - * @param string $p_remove_dir A string which contains a path to be - * removed from the memorized path of - * each element in the list, when - * relevant. - * @return true on success, false on error. - * @access public - */ - function addModify($p_filelist, $p_add_dir, $p_remove_dir='') - { - $v_result = true; - - if (!$this->_isArchive()) - $v_result = $this->createModify($p_filelist, $p_add_dir, - $p_remove_dir); - else { - if (is_array($p_filelist)) - $v_list = $p_filelist; - elseif (is_string($p_filelist)) - $v_list = explode($this->_separator, $p_filelist); - else { - $this->_error('Invalid file list'); - return false; - } - - $v_result = $this->_append($v_list, $p_add_dir, $p_remove_dir); - } - - return $v_result; - } - // }}} - - // {{{ addString() - /** - * This method add a single string as a file at the - * end of the existing archive. If the archive does not yet exists it - * is created. - * - * @param string $p_filename A string which contains the full - * filename path that will be associated - * with the string. - * @param string $p_string The content of the file added in - * the archive. - * @return true on success, false on error. - * @access public - */ - function addString($p_filename, $p_string) - { - $v_result = true; - - if (!$this->_isArchive()) { - if (!$this->_openWrite()) { - return false; - } - $this->_close(); - } - - if (!$this->_openAppend()) - return false; - - // Need to check the get back to the temporary file ? .... - $v_result = $this->_addString($p_filename, $p_string); - - $this->_writeFooter(); - - $this->_close(); - - return $v_result; - } - // }}} - - // {{{ extractModify() - /** - * This method extract all the content of the archive in the directory - * indicated by $p_path. When relevant the memorized path of the - * files/dir can be modified by removing the $p_remove_path path at the - * beginning of the file/dir path. - * While extracting a file, if the directory path does not exists it is - * created. - * While extracting a file, if the file already exists it is replaced - * without looking for last modification date. - * While extracting a file, if the file already exists and is write - * protected, the extraction is aborted. - * While extracting a file, if a directory with the same name already - * exists, the extraction is aborted. - * While extracting a directory, if a file with the same name already - * exists, the extraction is aborted. - * While extracting a file/directory if the destination directory exist - * and is write protected, or does not exist but can not be created, - * the extraction is aborted. - * If after extraction an extracted file does not show the correct - * stored file size, the extraction is aborted. - * When the extraction is aborted, a PEAR error text is set and false - * is returned. However the result can be a partial extraction that may - * need to be manually cleaned. - * - * @param string $p_path The path of the directory where the - * files/dir need to by extracted. - * @param string $p_remove_path Part of the memorized path that can be - * removed if present at the beginning of - * the file/dir path. - * @return boolean true on success, false on error. - * @access public - * @see extractList() - */ - function extractModify($p_path, $p_remove_path) - { - $v_result = true; - $v_list_detail = array(); - - if ($v_result = $this->_openRead()) { - $v_result = $this->_extractList($p_path, $v_list_detail, - "complete", 0, $p_remove_path); - $this->_close(); - } - - return $v_result; - } - // }}} - - // {{{ extractInString() - /** - * This method extract from the archive one file identified by $p_filename. - * The return value is a string with the file content, or NULL on error. - * @param string $p_filename The path of the file to extract in a string. - * @return a string with the file content or NULL. - * @access public - */ - function extractInString($p_filename) - { - if ($this->_openRead()) { - $v_result = $this->_extractInString($p_filename); - $this->_close(); - } else { - $v_result = NULL; - } - - return $v_result; - } - // }}} - - // {{{ extractList() - /** - * This method extract from the archive only the files indicated in the - * $p_filelist. These files are extracted in the current directory or - * in the directory indicated by the optional $p_path parameter. - * If indicated the $p_remove_path can be used in the same way as it is - * used in extractModify() method. - * @param array $p_filelist An array of filenames and directory names, - * or a single string with names separated - * by a single blank space. - * @param string $p_path The path of the directory where the - * files/dir need to by extracted. - * @param string $p_remove_path Part of the memorized path that can be - * removed if present at the beginning of - * the file/dir path. - * @return true on success, false on error. - * @access public - * @see extractModify() - */ - function extractList($p_filelist, $p_path='', $p_remove_path='') - { - $v_result = true; - $v_list_detail = array(); - - if (is_array($p_filelist)) - $v_list = $p_filelist; - elseif (is_string($p_filelist)) - $v_list = explode($this->_separator, $p_filelist); - else { - $this->_error('Invalid string list'); - return false; - } - - if ($v_result = $this->_openRead()) { - $v_result = $this->_extractList($p_path, $v_list_detail, "partial", - $v_list, $p_remove_path); - $this->_close(); - } - - return $v_result; - } - // }}} - - // {{{ setAttribute() - /** - * This method set specific attributes of the archive. It uses a variable - * list of parameters, in the format attribute code + attribute values : - * $arch->setAttribute(ARCHIVE_TAR_ATT_SEPARATOR, ','); - * @param mixed $argv variable list of attributes and values - * @return true on success, false on error. - * @access public - */ - function setAttribute() - { - $v_result = true; - - // ----- Get the number of variable list of arguments - if (($v_size = func_num_args()) == 0) { - return true; - } - - // ----- Get the arguments - $v_att_list = &func_get_args(); - - // ----- Read the attributes - $i=0; - while ($i<$v_size) { - - // ----- Look for next option - switch ($v_att_list[$i]) { - // ----- Look for options that request a string value - case ARCHIVE_TAR_ATT_SEPARATOR : - // ----- Check the number of parameters - if (($i+1) >= $v_size) { - $this->_error('Invalid number of parameters for ' - .'attribute ARCHIVE_TAR_ATT_SEPARATOR'); - return false; - } - - // ----- Get the value - $this->_separator = $v_att_list[$i+1]; - $i++; - break; - - default : - $this->_error('Unknow attribute code '.$v_att_list[$i].''); - return false; - } - - // ----- Next attribute - $i++; - } - - return $v_result; - } - // }}} - - // {{{ _error() - function _error($p_message) - { - // ----- To be completed - $this->raiseError($p_message); - } - // }}} - - // {{{ _warning() - function _warning($p_message) - { - // ----- To be completed - $this->raiseError($p_message); - } - // }}} - - // {{{ _isArchive() - function _isArchive($p_filename=NULL) - { - if ($p_filename == NULL) { - $p_filename = $this->_tarname; - } - clearstatcache(); - return @is_file($p_filename); - } - // }}} - - // {{{ _openWrite() - function _openWrite() - { - if ($this->_compress_type == 'gz') - $this->_file = @gzopen($this->_tarname, "wb9"); - else if ($this->_compress_type == 'bz2') - $this->_file = @bzopen($this->_tarname, "wb"); - else if ($this->_compress_type == 'none') - $this->_file = @fopen($this->_tarname, "wb"); - else - $this->_error('Unknown or missing compression type (' - .$this->_compress_type.')'); - - if ($this->_file == 0) { - $this->_error('Unable to open in write mode \'' - .$this->_tarname.'\''); - return false; - } - - return true; - } - // }}} - - // {{{ _openRead() - function _openRead() - { - if (strtolower(substr($this->_tarname, 0, 7)) == 'http://') { - - // ----- Look if a local copy need to be done - if ($this->_temp_tarname == '') { - $this->_temp_tarname = uniqid('tar').'.tmp'; - if (!$v_file_from = @fopen($this->_tarname, 'rb')) { - $this->_error('Unable to open in read mode \'' - .$this->_tarname.'\''); - $this->_temp_tarname = ''; - return false; - } - if (!$v_file_to = @fopen($this->_temp_tarname, 'wb')) { - $this->_error('Unable to open in write mode \'' - .$this->_temp_tarname.'\''); - $this->_temp_tarname = ''; - return false; - } - while ($v_data = @fread($v_file_from, 1024)) - @fwrite($v_file_to, $v_data); - @fclose($v_file_from); - @fclose($v_file_to); - } - - // ----- File to open if the local copy - $v_filename = $this->_temp_tarname; - - } else - // ----- File to open if the normal Tar file - $v_filename = $this->_tarname; - - if ($this->_compress_type == 'gz') - $this->_file = @gzopen($v_filename, "rb"); - else if ($this->_compress_type == 'bz2') - $this->_file = @bzopen($v_filename, "rb"); - else if ($this->_compress_type == 'none') - $this->_file = @fopen($v_filename, "rb"); - else - $this->_error('Unknown or missing compression type (' - .$this->_compress_type.')'); - - if ($this->_file == 0) { - $this->_error('Unable to open in read mode \''.$v_filename.'\''); - return false; - } - - return true; - } - // }}} - - // {{{ _openReadWrite() - function _openReadWrite() - { - if ($this->_compress_type == 'gz') - $this->_file = @gzopen($this->_tarname, "r+b"); - else if ($this->_compress_type == 'bz2') - $this->_file = @bzopen($this->_tarname, "r+b"); - else if ($this->_compress_type == 'none') - $this->_file = @fopen($this->_tarname, "r+b"); - else - $this->_error('Unknown or missing compression type (' - .$this->_compress_type.')'); - - if ($this->_file == 0) { - $this->_error('Unable to open in read/write mode \'' - .$this->_tarname.'\''); - return false; - } - - return true; - } - // }}} - - // {{{ _close() - function _close() - { - //if (isset($this->_file)) { - if (is_resource($this->_file)) { - if ($this->_compress_type == 'gz') - @gzclose($this->_file); - else if ($this->_compress_type == 'bz2') - @bzclose($this->_file); - else if ($this->_compress_type == 'none') - @fclose($this->_file); - else - $this->_error('Unknown or missing compression type (' - .$this->_compress_type.')'); - - $this->_file = 0; - } - - // ----- Look if a local copy need to be erase - // Note that it might be interesting to keep the url for a time : ToDo - if ($this->_temp_tarname != '') { - @unlink($this->_temp_tarname); - $this->_temp_tarname = ''; - } - - return true; - } - // }}} - - // {{{ _cleanFile() - function _cleanFile() - { - $this->_close(); - - // ----- Look for a local copy - if ($this->_temp_tarname != '') { - // ----- Remove the local copy but not the remote tarname - @unlink($this->_temp_tarname); - $this->_temp_tarname = ''; - } else { - // ----- Remove the local tarname file - @unlink($this->_tarname); - } - $this->_tarname = ''; - - return true; - } - // }}} - - // {{{ _writeBlock() - function _writeBlock($p_binary_data, $p_len=null) - { - if (is_resource($this->_file)) { - if ($p_len === null) { - if ($this->_compress_type == 'gz') - @gzputs($this->_file, $p_binary_data); - else if ($this->_compress_type == 'bz2') - @bzwrite($this->_file, $p_binary_data); - else if ($this->_compress_type == 'none') - @fputs($this->_file, $p_binary_data); - else - $this->_error('Unknown or missing compression type (' - .$this->_compress_type.')'); - } else { - if ($this->_compress_type == 'gz') - @gzputs($this->_file, $p_binary_data, $p_len); - else if ($this->_compress_type == 'bz2') - @bzwrite($this->_file, $p_binary_data, $p_len); - else if ($this->_compress_type == 'none') - @fputs($this->_file, $p_binary_data, $p_len); - else - $this->_error('Unknown or missing compression type (' - .$this->_compress_type.')'); - - } - } - return true; - } - // }}} - - // {{{ _readBlock() - function _readBlock() - { - $v_block = null; - if (is_resource($this->_file)) { - if ($this->_compress_type == 'gz') - $v_block = @gzread($this->_file, 512); - else if ($this->_compress_type == 'bz2') - $v_block = @bzread($this->_file, 512); - else if ($this->_compress_type == 'none') - $v_block = @fread($this->_file, 512); - else - $this->_error('Unknown or missing compression type (' - .$this->_compress_type.')'); - } - return $v_block; - } - // }}} - - // {{{ _jumpBlock() - function _jumpBlock($p_len=null) - { - if (is_resource($this->_file)) { - if ($p_len === null) - $p_len = 1; - - if ($this->_compress_type == 'gz') { - @gzseek($this->_file, @gztell($this->_file)+($p_len*512)); - } - else if ($this->_compress_type == 'bz2') { - // ----- Replace missing bztell() and bzseek() - for ($i=0; $i<$p_len; $i++) - $this->_readBlock(); - } else if ($this->_compress_type == 'none') - @fseek($this->_file, @ftell($this->_file)+($p_len*512)); - else - $this->_error('Unknown or missing compression type (' - .$this->_compress_type.')'); - - } - return true; - } - // }}} - - // {{{ _writeFooter() - function _writeFooter() - { - if (is_resource($this->_file)) { - // ----- Write the last 0 filled block for end of archive - $v_binary_data = pack("a512", ''); - $this->_writeBlock($v_binary_data); - } - return true; - } - // }}} - - // {{{ _addList() - function _addList($p_list, $p_add_dir, $p_remove_dir) - { - $v_result=true; - $v_header = array(); - - // ----- Remove potential windows directory separator - $p_add_dir = $this->_translateWinPath($p_add_dir); - $p_remove_dir = $this->_translateWinPath($p_remove_dir, false); - - if (!$this->_file) { - $this->_error('Invalid file descriptor'); - return false; - } - - if (sizeof($p_list) == 0) - return true; - - foreach ($p_list as $v_filename) { - if (!$v_result) { - break; - } - - // ----- Skip the current tar name - if ($v_filename == $this->_tarname) - continue; - - if ($v_filename == '') - continue; - - if (!file_exists($v_filename)) { - $this->_warning("File '$v_filename' does not exist"); - continue; - } - - // ----- Add the file or directory header - if (!$this->_addFile($v_filename, $v_header, $p_add_dir, $p_remove_dir)) - return false; - - if (@is_dir($v_filename)) { - if (!($p_hdir = opendir($v_filename))) { - $this->_warning("Directory '$v_filename' can not be read"); - continue; - } - while (false !== ($p_hitem = readdir($p_hdir))) { - if (($p_hitem != '.') && ($p_hitem != '..')) { - if ($v_filename != ".") - $p_temp_list[0] = $v_filename.'/'.$p_hitem; - else - $p_temp_list[0] = $p_hitem; - - $v_result = $this->_addList($p_temp_list, - $p_add_dir, - $p_remove_dir); - } - } - - unset($p_temp_list); - unset($p_hdir); - unset($p_hitem); - } - } - - return $v_result; - } - // }}} - - // {{{ _addFile() - function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir) - { - if (!$this->_file) { - $this->_error('Invalid file descriptor'); - return false; - } - - if ($p_filename == '') { - $this->_error('Invalid file name'); - return false; - } - - // ----- Calculate the stored filename - $p_filename = $this->_translateWinPath($p_filename, false);; - $v_stored_filename = $p_filename; - if (strcmp($p_filename, $p_remove_dir) == 0) { - return true; - } - if ($p_remove_dir != '') { - if (substr($p_remove_dir, -1) != '/') - $p_remove_dir .= '/'; - - if (substr($p_filename, 0, strlen($p_remove_dir)) == $p_remove_dir) - $v_stored_filename = substr($p_filename, strlen($p_remove_dir)); - } - $v_stored_filename = $this->_translateWinPath($v_stored_filename); - if ($p_add_dir != '') { - if (substr($p_add_dir, -1) == '/') - $v_stored_filename = $p_add_dir.$v_stored_filename; - else - $v_stored_filename = $p_add_dir.'/'.$v_stored_filename; - } - - $v_stored_filename = $this->_pathReduction($v_stored_filename); - - if ($this->_isArchive($p_filename)) { - if (($v_file = @fopen($p_filename, "rb")) == 0) { - $this->_warning("Unable to open file '".$p_filename - ."' in binary read mode"); - return true; - } - - if (!$this->_writeHeader($p_filename, $v_stored_filename)) - return false; - - while (($v_buffer = fread($v_file, 512)) != '') { - $v_binary_data = pack("a512", "$v_buffer"); - $this->_writeBlock($v_binary_data); - } - - fclose($v_file); - - } else { - // ----- Only header for dir - if (!$this->_writeHeader($p_filename, $v_stored_filename)) - return false; - } - - return true; - } - // }}} - - // {{{ _addString() - function _addString($p_filename, $p_string) - { - if (!$this->_file) { - $this->_error('Invalid file descriptor'); - return false; - } - - if ($p_filename == '') { - $this->_error('Invalid file name'); - return false; - } - - // ----- Calculate the stored filename - $p_filename = $this->_translateWinPath($p_filename, false);; - - if (!$this->_writeHeaderBlock($p_filename, strlen($p_string), - 0, 0, "", 0, 0)) - return false; - - $i=0; - while (($v_buffer = substr($p_string, (($i++)*512), 512)) != '') { - $v_binary_data = pack("a512", $v_buffer); - $this->_writeBlock($v_binary_data); - } - - return true; - } - // }}} - - // {{{ _writeHeader() - function _writeHeader($p_filename, $p_stored_filename) - { - if ($p_stored_filename == '') - $p_stored_filename = $p_filename; - $v_reduce_filename = $this->_pathReduction($p_stored_filename); - - if (strlen($v_reduce_filename) > 99) { - if (!$this->_writeLongHeader($v_reduce_filename)) - return false; - } - - $v_info = stat($p_filename); - $v_uid = sprintf("%6s ", DecOct($v_info[4])); - $v_gid = sprintf("%6s ", DecOct($v_info[5])); - $v_perms = sprintf("%6s ", DecOct(fileperms($p_filename))); - - $v_mtime = sprintf("%11s", DecOct(filemtime($p_filename))); - - if (@is_dir($p_filename)) { - $v_typeflag = "5"; - $v_size = sprintf("%11s ", DecOct(0)); - } else { - $v_typeflag = ''; - clearstatcache(); - $v_size = sprintf("%11s ", DecOct(filesize($p_filename))); - } - - $v_linkname = ''; - - $v_magic = ''; - - $v_version = ''; - - $v_uname = ''; - - $v_gname = ''; - - $v_devmajor = ''; - - $v_devminor = ''; - - $v_prefix = ''; - - $v_binary_data_first = pack("a100a8a8a8a12A12", - $v_reduce_filename, $v_perms, $v_uid, - $v_gid, $v_size, $v_mtime); - $v_binary_data_last = pack("a1a100a6a2a32a32a8a8a155a12", - $v_typeflag, $v_linkname, $v_magic, - $v_version, $v_uname, $v_gname, - $v_devmajor, $v_devminor, $v_prefix, ''); - - // ----- Calculate the checksum - $v_checksum = 0; - // ..... First part of the header - for ($i=0; $i<148; $i++) - $v_checksum += ord(substr($v_binary_data_first,$i,1)); - // ..... Ignore the checksum value and replace it by ' ' (space) - for ($i=148; $i<156; $i++) - $v_checksum += ord(' '); - // ..... Last part of the header - for ($i=156, $j=0; $i<512; $i++, $j++) - $v_checksum += ord(substr($v_binary_data_last,$j,1)); - - // ----- Write the first 148 bytes of the header in the archive - $this->_writeBlock($v_binary_data_first, 148); - - // ----- Write the calculated checksum - $v_checksum = sprintf("%6s ", DecOct($v_checksum)); - $v_binary_data = pack("a8", $v_checksum); - $this->_writeBlock($v_binary_data, 8); - - // ----- Write the last 356 bytes of the header in the archive - $this->_writeBlock($v_binary_data_last, 356); - - return true; - } - // }}} - - // {{{ _writeHeaderBlock() - function _writeHeaderBlock($p_filename, $p_size, $p_mtime=0, $p_perms=0, - $p_type='', $p_uid=0, $p_gid=0) - { - $p_filename = $this->_pathReduction($p_filename); - - if (strlen($p_filename) > 99) { - if (!$this->_writeLongHeader($p_filename)) - return false; - } - - if ($p_type == "5") { - $v_size = sprintf("%11s ", DecOct(0)); - } else { - $v_size = sprintf("%11s ", DecOct($p_size)); - } - - $v_uid = sprintf("%6s ", DecOct($p_uid)); - $v_gid = sprintf("%6s ", DecOct($p_gid)); - $v_perms = sprintf("%6s ", DecOct($p_perms)); - - $v_mtime = sprintf("%11s", DecOct($p_mtime)); - - $v_linkname = ''; - - $v_magic = ''; - - $v_version = ''; - - $v_uname = ''; - - $v_gname = ''; - - $v_devmajor = ''; - - $v_devminor = ''; - - $v_prefix = ''; - - $v_binary_data_first = pack("a100a8a8a8a12A12", - $p_filename, $v_perms, $v_uid, $v_gid, - $v_size, $v_mtime); - $v_binary_data_last = pack("a1a100a6a2a32a32a8a8a155a12", - $p_type, $v_linkname, $v_magic, - $v_version, $v_uname, $v_gname, - $v_devmajor, $v_devminor, $v_prefix, ''); - - // ----- Calculate the checksum - $v_checksum = 0; - // ..... First part of the header - for ($i=0; $i<148; $i++) - $v_checksum += ord(substr($v_binary_data_first,$i,1)); - // ..... Ignore the checksum value and replace it by ' ' (space) - for ($i=148; $i<156; $i++) - $v_checksum += ord(' '); - // ..... Last part of the header - for ($i=156, $j=0; $i<512; $i++, $j++) - $v_checksum += ord(substr($v_binary_data_last,$j,1)); - - // ----- Write the first 148 bytes of the header in the archive - $this->_writeBlock($v_binary_data_first, 148); - - // ----- Write the calculated checksum - $v_checksum = sprintf("%6s ", DecOct($v_checksum)); - $v_binary_data = pack("a8", $v_checksum); - $this->_writeBlock($v_binary_data, 8); - - // ----- Write the last 356 bytes of the header in the archive - $this->_writeBlock($v_binary_data_last, 356); - - return true; - } - // }}} - - // {{{ _writeLongHeader() - function _writeLongHeader($p_filename) - { - $v_size = sprintf("%11s ", DecOct(strlen($p_filename))); - - $v_typeflag = 'L'; - - $v_linkname = ''; - - $v_magic = ''; - - $v_version = ''; - - $v_uname = ''; - - $v_gname = ''; - - $v_devmajor = ''; - - $v_devminor = ''; - - $v_prefix = ''; - - $v_binary_data_first = pack("a100a8a8a8a12A12", - '././@LongLink', 0, 0, 0, $v_size, 0); - $v_binary_data_last = pack("a1a100a6a2a32a32a8a8a155a12", - $v_typeflag, $v_linkname, $v_magic, - $v_version, $v_uname, $v_gname, - $v_devmajor, $v_devminor, $v_prefix, ''); - - // ----- Calculate the checksum - $v_checksum = 0; - // ..... First part of the header - for ($i=0; $i<148; $i++) - $v_checksum += ord(substr($v_binary_data_first,$i,1)); - // ..... Ignore the checksum value and replace it by ' ' (space) - for ($i=148; $i<156; $i++) - $v_checksum += ord(' '); - // ..... Last part of the header - for ($i=156, $j=0; $i<512; $i++, $j++) - $v_checksum += ord(substr($v_binary_data_last,$j,1)); - - // ----- Write the first 148 bytes of the header in the archive - $this->_writeBlock($v_binary_data_first, 148); - - // ----- Write the calculated checksum - $v_checksum = sprintf("%6s ", DecOct($v_checksum)); - $v_binary_data = pack("a8", $v_checksum); - $this->_writeBlock($v_binary_data, 8); - - // ----- Write the last 356 bytes of the header in the archive - $this->_writeBlock($v_binary_data_last, 356); - - // ----- Write the filename as content of the block - $i=0; - while (($v_buffer = substr($p_filename, (($i++)*512), 512)) != '') { - $v_binary_data = pack("a512", "$v_buffer"); - $this->_writeBlock($v_binary_data); - } - - return true; - } - // }}} - - // {{{ _readHeader() - function _readHeader($v_binary_data, &$v_header) - { - if (strlen($v_binary_data)==0) { - $v_header['filename'] = ''; - return true; - } - - if (strlen($v_binary_data) != 512) { - $v_header['filename'] = ''; - $this->_error('Invalid block size : '.strlen($v_binary_data)); - return false; - } - - // ----- Calculate the checksum - $v_checksum = 0; - // ..... First part of the header - for ($i=0; $i<148; $i++) - $v_checksum+=ord(substr($v_binary_data,$i,1)); - // ..... Ignore the checksum value and replace it by ' ' (space) - for ($i=148; $i<156; $i++) - $v_checksum += ord(' '); - // ..... Last part of the header - for ($i=156; $i<512; $i++) - $v_checksum+=ord(substr($v_binary_data,$i,1)); - - $v_data = unpack("a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/" - ."a8checksum/a1typeflag/a100link/a6magic/a2version/" - ."a32uname/a32gname/a8devmajor/a8devminor", - $v_binary_data); - - // ----- Extract the checksum - $v_header['checksum'] = OctDec(trim($v_data['checksum'])); - if ($v_header['checksum'] != $v_checksum) { - $v_header['filename'] = ''; - - // ----- Look for last block (empty block) - if (($v_checksum == 256) && ($v_header['checksum'] == 0)) - return true; - - $this->_error('Invalid checksum for file "'.$v_data['filename'] - .'" : '.$v_checksum.' calculated, ' - .$v_header['checksum'].' expected'); - return false; - } - - // ----- Extract the properties - $v_header['filename'] = trim($v_data['filename']); - $v_header['mode'] = OctDec(trim($v_data['mode'])); - $v_header['uid'] = OctDec(trim($v_data['uid'])); - $v_header['gid'] = OctDec(trim($v_data['gid'])); - $v_header['size'] = OctDec(trim($v_data['size'])); - $v_header['mtime'] = OctDec(trim($v_data['mtime'])); - if (($v_header['typeflag'] = $v_data['typeflag']) == "5") { - $v_header['size'] = 0; - } - /* ----- All these fields are removed form the header because - they do not carry interesting info - $v_header[link] = trim($v_data[link]); - $v_header[magic] = trim($v_data[magic]); - $v_header[version] = trim($v_data[version]); - $v_header[uname] = trim($v_data[uname]); - $v_header[gname] = trim($v_data[gname]); - $v_header[devmajor] = trim($v_data[devmajor]); - $v_header[devminor] = trim($v_data[devminor]); - */ - - return true; - } - // }}} - - // {{{ _readLongHeader() - function _readLongHeader(&$v_header) - { - $v_filename = ''; - $n = floor($v_header['size']/512); - for ($i=0; $i<$n; $i++) { - $v_content = $this->_readBlock(); - $v_filename .= $v_content; - } - if (($v_header['size'] % 512) != 0) { - $v_content = $this->_readBlock(); - $v_filename .= $v_content; - } - - // ----- Read the next header - $v_binary_data = $this->_readBlock(); - - if (!$this->_readHeader($v_binary_data, $v_header)) - return false; - - $v_header['filename'] = $v_filename; - - return true; - } - // }}} - - // {{{ _extractInString() - /** - * This method extract from the archive one file identified by $p_filename. - * The return value is a string with the file content, or NULL on error. - * @param string $p_filename The path of the file to extract in a string. - * @return a string with the file content or NULL. - * @access private - */ - function _extractInString($p_filename) - { - $v_result_str = ""; - - While (strlen($v_binary_data = $this->_readBlock()) != 0) - { - if (!$this->_readHeader($v_binary_data, $v_header)) - return NULL; - - if ($v_header['filename'] == '') - continue; - - // ----- Look for long filename - if ($v_header['typeflag'] == 'L') { - if (!$this->_readLongHeader($v_header)) - return NULL; - } - - if ($v_header['filename'] == $p_filename) { - if ($v_header['typeflag'] == "5") { - $this->_error('Unable to extract in string a directory ' - .'entry {'.$v_header['filename'].'}'); - return NULL; - } else { - $n = floor($v_header['size']/512); - for ($i=0; $i<$n; $i++) { - $v_result_str .= $this->_readBlock(); - } - if (($v_header['size'] % 512) != 0) { - $v_content = $this->_readBlock(); - $v_result_str .= substr($v_content, 0, - ($v_header['size'] % 512)); - } - return $v_result_str; - } - } else { - $this->_jumpBlock(ceil(($v_header['size']/512))); - } - } - - return NULL; - } - // }}} - - // {{{ _extractList() - function _extractList($p_path, &$p_list_detail, $p_mode, - $p_file_list, $p_remove_path) - { - $v_result=true; - $v_nb = 0; - $v_extract_all = true; - $v_listing = false; - - $p_path = $this->_translateWinPath($p_path, false); - if ($p_path == '' || (substr($p_path, 0, 1) != '/' - && substr($p_path, 0, 3) != "../" && !strpos($p_path, ':'))) { - $p_path = "./".$p_path; - } - $p_remove_path = $this->_translateWinPath($p_remove_path); - - // ----- Look for path to remove format (should end by /) - if (($p_remove_path != '') && (substr($p_remove_path, -1) != '/')) - $p_remove_path .= '/'; - $p_remove_path_size = strlen($p_remove_path); - - switch ($p_mode) { - case "complete" : - $v_extract_all = TRUE; - $v_listing = FALSE; - break; - case "partial" : - $v_extract_all = FALSE; - $v_listing = FALSE; - break; - case "list" : - $v_extract_all = FALSE; - $v_listing = TRUE; - break; - default : - $this->_error('Invalid extract mode ('.$p_mode.')'); - return false; - } - - clearstatcache(); - - while (strlen($v_binary_data = $this->_readBlock()) != 0) - { - $v_extract_file = FALSE; - $v_extraction_stopped = 0; - - if (!$this->_readHeader($v_binary_data, $v_header)) - return false; - - if ($v_header['filename'] == '') { - continue; - } - - // ----- Look for long filename - if ($v_header['typeflag'] == 'L') { - if (!$this->_readLongHeader($v_header)) - return false; - } - - if ((!$v_extract_all) && (is_array($p_file_list))) { - // ----- By default no unzip if the file is not found - $v_extract_file = false; - - for ($i=0; $i<sizeof($p_file_list); $i++) { - // ----- Look if it is a directory - if (substr($p_file_list[$i], -1) == '/') { - // ----- Look if the directory is in the filename path - if ((strlen($v_header['filename']) > strlen($p_file_list[$i])) - && (substr($v_header['filename'], 0, strlen($p_file_list[$i])) - == $p_file_list[$i])) { - $v_extract_file = TRUE; - break; - } - } - - // ----- It is a file, so compare the file names - elseif ($p_file_list[$i] == $v_header['filename']) { - $v_extract_file = TRUE; - break; - } - } - } else { - $v_extract_file = TRUE; - } - - // ----- Look if this file need to be extracted - if (($v_extract_file) && (!$v_listing)) - { - if (($p_remove_path != '') - && (substr($v_header['filename'], 0, $p_remove_path_size) - == $p_remove_path)) - $v_header['filename'] = substr($v_header['filename'], - $p_remove_path_size); - if (($p_path != './') && ($p_path != '/')) { - while (substr($p_path, -1) == '/') - $p_path = substr($p_path, 0, strlen($p_path)-1); - - if (substr($v_header['filename'], 0, 1) == '/') - $v_header['filename'] = $p_path.$v_header['filename']; - else - $v_header['filename'] = $p_path.'/'.$v_header['filename']; - } - if (file_exists($v_header['filename'])) { - if ( (@is_dir($v_header['filename'])) - && ($v_header['typeflag'] == '')) { - $this->_error('File '.$v_header['filename'] - .' already exists as a directory'); - return false; - } - if ( ($this->_isArchive($v_header['filename'])) - && ($v_header['typeflag'] == "5")) { - $this->_error('Directory '.$v_header['filename'] - .' already exists as a file'); - return false; - } - if (!is_writeable($v_header['filename'])) { - $this->_error('File '.$v_header['filename'] - .' already exists and is write protected'); - return false; - } - if (filemtime($v_header['filename']) > $v_header['mtime']) { - // To be completed : An error or silent no replace ? - } - } - - // ----- Check the directory availability and create it if necessary - elseif (($v_result - = $this->_dirCheck(($v_header['typeflag'] == "5" - ?$v_header['filename'] - :dirname($v_header['filename'])))) != 1) { - $this->_error('Unable to create path for '.$v_header['filename']); - return false; - } - - if ($v_extract_file) { - if ($v_header['typeflag'] == "5") { - if (!@file_exists($v_header['filename'])) { - if (!@mkdir($v_header['filename'], 0777)) { - $this->_error('Unable to create directory {' - .$v_header['filename'].'}'); - return false; - } - } - } else { - if (($v_dest_file = @fopen($v_header['filename'], "wb")) == 0) { - $this->_error('Error while opening {'.$v_header['filename'] - .'} in write binary mode'); - return false; - } else { - $n = floor($v_header['size']/512); - for ($i=0; $i<$n; $i++) { - $v_content = $this->_readBlock(); - fwrite($v_dest_file, $v_content, 512); - } - if (($v_header['size'] % 512) != 0) { - $v_content = $this->_readBlock(); - fwrite($v_dest_file, $v_content, ($v_header['size'] % 512)); - } - - @fclose($v_dest_file); - - // ----- Change the file mode, mtime - @touch($v_header['filename'], $v_header['mtime']); - // To be completed - //chmod($v_header[filename], DecOct($v_header[mode])); - } - - // ----- Check the file size - clearstatcache(); - if (filesize($v_header['filename']) != $v_header['size']) { - $this->_error('Extracted file '.$v_header['filename'] - .' does not have the correct file size \'' - .filesize($v_header['filename']) - .'\' ('.$v_header['size'] - .' expected). Archive may be corrupted.'); - return false; - } - } - } else { - $this->_jumpBlock(ceil(($v_header['size']/512))); - } - } else { - $this->_jumpBlock(ceil(($v_header['size']/512))); - } - - /* TBC : Seems to be unused ... - if ($this->_compress) - $v_end_of_file = @gzeof($this->_file); - else - $v_end_of_file = @feof($this->_file); - */ - - if ($v_listing || $v_extract_file || $v_extraction_stopped) { - // ----- Log extracted files - if (($v_file_dir = dirname($v_header['filename'])) - == $v_header['filename']) - $v_file_dir = ''; - if ((substr($v_header['filename'], 0, 1) == '/') && ($v_file_dir == '')) - $v_file_dir = '/'; - - $p_list_detail[$v_nb++] = $v_header; - } - } - - return true; - } - // }}} - - // {{{ _openAppend() - function _openAppend() - { - if (filesize($this->_tarname) == 0) - return $this->_openWrite(); - - if ($this->_compress) { - $this->_close(); - - if (!@rename($this->_tarname, $this->_tarname.".tmp")) { - $this->_error('Error while renaming \''.$this->_tarname - .'\' to temporary file \''.$this->_tarname - .'.tmp\''); - return false; - } - - if ($this->_compress_type == 'gz') - $v_temp_tar = @gzopen($this->_tarname.".tmp", "rb"); - elseif ($this->_compress_type == 'bz2') - $v_temp_tar = @bzopen($this->_tarname.".tmp", "rb"); - - if ($v_temp_tar == 0) { - $this->_error('Unable to open file \''.$this->_tarname - .'.tmp\' in binary read mode'); - @rename($this->_tarname.".tmp", $this->_tarname); - return false; - } - - if (!$this->_openWrite()) { - @rename($this->_tarname.".tmp", $this->_tarname); - return false; - } - - if ($this->_compress_type == 'gz') { - $v_buffer = @gzread($v_temp_tar, 512); - - // ----- Read the following blocks but not the last one - if (!@gzeof($v_temp_tar)) { - do{ - $v_binary_data = pack("a512", $v_buffer); - $this->_writeBlock($v_binary_data); - $v_buffer = @gzread($v_temp_tar, 512); - - } while (!@gzeof($v_temp_tar)); - } - - @gzclose($v_temp_tar); - } - elseif ($this->_compress_type == 'bz2') { - $v_buffered_lines = array(); - $v_buffered_lines[] = @bzread($v_temp_tar, 512); - - // ----- Read the following blocks but not the last one - while (strlen($v_buffered_lines[] - = @bzread($v_temp_tar, 512)) > 0) { - $v_binary_data = pack("a512", - array_shift($v_buffered_lines)); - $this->_writeBlock($v_binary_data); - } - - @bzclose($v_temp_tar); - } - - if (!@unlink($this->_tarname.".tmp")) { - $this->_error('Error while deleting temporary file \'' - .$this->_tarname.'.tmp\''); - } - - } else { - // ----- For not compressed tar, just add files before the last - // 512 bytes block - if (!$this->_openReadWrite()) - return false; - - clearstatcache(); - $v_size = filesize($this->_tarname); - fseek($this->_file, $v_size-512); - } - - return true; - } - // }}} - - // {{{ _append() - function _append($p_filelist, $p_add_dir='', $p_remove_dir='') - { - if (!$this->_openAppend()) - return false; - - if ($this->_addList($p_filelist, $p_add_dir, $p_remove_dir)) - $this->_writeFooter(); - - $this->_close(); - - return true; - } - // }}} - - // {{{ _dirCheck() - - /** - * Check if a directory exists and create it (including parent - * dirs) if not. - * - * @param string $p_dir directory to check - * - * @return bool TRUE if the directory exists or was created - */ - function _dirCheck($p_dir) - { - if ((@is_dir($p_dir)) || ($p_dir == '')) - return true; - - $p_parent_dir = dirname($p_dir); - - if (($p_parent_dir != $p_dir) && - ($p_parent_dir != '') && - (!$this->_dirCheck($p_parent_dir))) - return false; - - if (!@mkdir($p_dir, 0777)) { - $this->_error("Unable to create directory '$p_dir'"); - return false; - } - - return true; - } - - // }}} - - // {{{ _pathReduction() - - /** - * Compress path by changing for example "/dir/foo/../bar" to "/dir/bar", - * rand emove double slashes. - * - * @param string $p_dir path to reduce - * - * @return string reduced path - * - * @access private - * - */ - function _pathReduction($p_dir) - { - $v_result = ''; - - // ----- Look for not empty path - if ($p_dir != '') { - // ----- Explode path by directory names - $v_list = explode('/', $p_dir); - - // ----- Study directories from last to first - for ($i=sizeof($v_list)-1; $i>=0; $i--) { - // ----- Look for current path - if ($v_list[$i] == ".") { - // ----- Ignore this directory - // Should be the first $i=0, but no check is done - } - else if ($v_list[$i] == "..") { - // ----- Ignore it and ignore the $i-1 - $i--; - } - else if ( ($v_list[$i] == '') - && ($i!=(sizeof($v_list)-1)) - && ($i!=0)) { - // ----- Ignore only the double '//' in path, - // but not the first and last / - } else { - $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?'/' - .$v_result:''); - } - } - } - $v_result = strtr($v_result, '\\', '/'); - return $v_result; - } - - // }}} - - // {{{ _translateWinPath() - function _translateWinPath($p_path, $p_remove_disk_letter=true) - { - if (OS_WINDOWS) { - // ----- Look for potential disk letter - if ( ($p_remove_disk_letter) - && (($v_position = strpos($p_path, ':')) != false)) { - $p_path = substr($p_path, $v_position+1); - } - // ----- Change potential windows directory separator - if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0,1) == '\\')) { - $p_path = strtr($p_path, '\\', '/'); - } - } - return $p_path; - } - // }}} - -} -?> diff --git a/inc/Log.php b/inc/Log.php deleted file mode 100644 index 8f084640bc9a6375b894c36314d72a8dd8693ad4..0000000000000000000000000000000000000000 --- a/inc/Log.php +++ /dev/null @@ -1,635 +0,0 @@ -<?php -/** - * $Header: /repository/pear/Log/Log.php,v 1.46 2004/09/09 02:42:22 jon Exp $ - * $Horde: horde/lib/Log.php,v 1.15 2000/06/29 23:39:45 jon Exp $ - * - * @version $Revision: 1.46 $ - * @package Log - */ - -define('PEAR_LOG_EMERG', 0); /** System is unusable */ -define('PEAR_LOG_ALERT', 1); /** Immediate action required */ -define('PEAR_LOG_CRIT', 2); /** Critical conditions */ -define('PEAR_LOG_ERR', 3); /** Error conditions */ -define('PEAR_LOG_WARNING', 4); /** Warning conditions */ -define('PEAR_LOG_NOTICE', 5); /** Normal but significant */ -define('PEAR_LOG_INFO', 6); /** Informational */ -define('PEAR_LOG_DEBUG', 7); /** Debug-level messages */ - -define('PEAR_LOG_ALL', bindec('11111111')); /** All messages */ -define('PEAR_LOG_NONE', bindec('00000000')); /** No message */ - -/* Log types for PHP's native error_log() function. */ -define('PEAR_LOG_TYPE_SYSTEM', 0); /** Use PHP's system logger */ -define('PEAR_LOG_TYPE_MAIL', 1); /** Use PHP's mail() function */ -define('PEAR_LOG_TYPE_DEBUG', 2); /** Use PHP's debugging connection */ -define('PEAR_LOG_TYPE_FILE', 3); /** Append to a file */ - -/** - * The Log:: class implements both an abstraction for various logging - * mechanisms and the Subject end of a Subject-Observer pattern. - * - * @author Chuck Hagenbuch <chuck@horde.org> - * @author Jon Parise <jon@php.net> - * @since Horde 1.3 - * @package Log - */ -class Log -{ - /** - * Indicates whether or not the log can been opened / connected. - * - * @var boolean - * @access private - */ - var $_opened = false; - - /** - * Instance-specific unique identification number. - * - * @var integer - * @access private - */ - var $_id = 0; - - /** - * The label that uniquely identifies this set of log messages. - * - * @var string - * @access private - */ - var $_ident = ''; - - /** - * The default priority to use when logging an event. - * - * @var integer - * @access private - */ - var $_priority = PEAR_LOG_INFO; - - /** - * The bitmask of allowed log levels. - * @var integer - * @access private - */ - var $_mask = PEAR_LOG_ALL; - - /** - * Holds all Log_observer objects that wish to be notified of new messages. - * - * @var array - * @access private - */ - var $_listeners = array(); - - - /** - * Attempts to return a concrete Log instance of type $handler. - * - * @param string $handler The type of concrete Log subclass to return. - * Attempt to dynamically include the code for - * this subclass. Currently, valid values are - * 'console', 'syslog', 'sql', 'file', and 'mcal'. - * - * @param string $name The name of the actually log file, table, or - * other specific store to use. Defaults to an - * empty string, with which the subclass will - * attempt to do something intelligent. - * - * @param string $ident The identity reported to the log system. - * - * @param array $conf A hash containing any additional configuration - * information that a subclass might need. - * - * @param int $level Log messages up to and including this level. - * - * @return object Log The newly created concrete Log instance, or an - * false on an error. - * @access public - * @since Log 1.0 - */ - function &factory($handler, $name = '', $ident = '', $conf = array(), - $level = PEAR_LOG_DEBUG) - { - $handler = strtolower($handler); - $class = 'Log_' . $handler; - $classfile = 'Log/' . $handler . '.php'; - - /* - * Attempt to include our version of the named class, but don't treat - * a failure as fatal. The caller may have already included their own - * version of the named class. - */ - @include_once $classfile; - - /* If the class exists, return a new instance of it. */ - if (class_exists($class)) { - return new $class($name, $ident, $conf, $level); - } - - return false; - } - - /** - * Attempts to return a reference to a concrete Log instance of type - * $handler, only creating a new instance if no log instance with the same - * parameters currently exists. - * - * You should use this if there are multiple places you might create a - * logger, you don't want to create multiple loggers, and you don't want to - * check for the existance of one each time. The singleton pattern does all - * the checking work for you. - * - * <b>You MUST call this method with the $var = &Log::singleton() syntax. - * Without the ampersand (&) in front of the method name, you will not get - * a reference, you will get a copy.</b> - * - * @param string $handler The type of concrete Log subclass to return. - * Attempt to dynamically include the code for - * this subclass. Currently, valid values are - * 'console', 'syslog', 'sql', 'file', and 'mcal'. - * - * @param string $name The name of the actually log file, table, or - * other specific store to use. Defaults to an - * empty string, with which the subclass will - * attempt to do something intelligent. - * - * @param string $ident The identity reported to the log system. - * - * @param array $conf A hash containing any additional configuration - * information that a subclass might need. - * - * @param int $level Log messages up to and including this level. - * - * @return object Log The newly created concrete Log instance, or an - * false on an error. - * @access public - * @since Log 1.0 - */ - function &singleton($handler, $name = '', $ident = '', $conf = array(), - $level = PEAR_LOG_DEBUG) - { - static $instances; - if (!isset($instances)) $instances = array(); - - $signature = serialize(array($handler, $name, $ident, $conf, $level)); - if (!isset($instances[$signature])) { - $instances[$signature] = &Log::factory($handler, $name, $ident, - $conf, $level); - } - - return $instances[$signature]; - } - - /** - * Abstract implementation of the open() method. - * @since Log 1.0 - */ - function open() - { - return false; - } - - /** - * Abstract implementation of the close() method. - * @since Log 1.0 - */ - function close() - { - return false; - } - - /** - * Abstract implementation of the flush() method. - * @since Log 1.8.2 - */ - function flush() - { - return false; - } - - /** - * Abstract implementation of the log() method. - * @since Log 1.0 - */ - function log($message, $priority = null) - { - return false; - } - - /** - * A convenience function for logging a emergency event. It will log a - * message at the PEAR_LOG_EMERG log level. - * - * @param mixed $message String or object containing the message - * to log. - * - * @return boolean True if the message was successfully logged. - * - * @access public - * @since Log 1.7.0 - */ - function emerg($message) - { - return $this->log($message, PEAR_LOG_EMERG); - } - - /** - * A convenience function for logging an alert event. It will log a - * message at the PEAR_LOG_ALERT log level. - * - * @param mixed $message String or object containing the message - * to log. - * - * @return boolean True if the message was successfully logged. - * - * @access public - * @since Log 1.7.0 - */ - function alert($message) - { - return $this->log($message, PEAR_LOG_ALERT); - } - - /** - * A convenience function for logging a critical event. It will log a - * message at the PEAR_LOG_CRIT log level. - * - * @param mixed $message String or object containing the message - * to log. - * - * @return boolean True if the message was successfully logged. - * - * @access public - * @since Log 1.7.0 - */ - function crit($message) - { - return $this->log($message, PEAR_LOG_CRIT); - } - - /** - * A convenience function for logging a error event. It will log a - * message at the PEAR_LOG_ERR log level. - * - * @param mixed $message String or object containing the message - * to log. - * - * @return boolean True if the message was successfully logged. - * - * @access public - * @since Log 1.7.0 - */ - function err($message) - { - return $this->log($message, PEAR_LOG_ERR); - } - - /** - * A convenience function for logging a warning event. It will log a - * message at the PEAR_LOG_WARNING log level. - * - * @param mixed $message String or object containing the message - * to log. - * - * @return boolean True if the message was successfully logged. - * - * @access public - * @since Log 1.7.0 - */ - function warning($message) - { - return $this->log($message, PEAR_LOG_WARNING); - } - - /** - * A convenience function for logging a notice event. It will log a - * message at the PEAR_LOG_NOTICE log level. - * - * @param mixed $message String or object containing the message - * to log. - * - * @return boolean True if the message was successfully logged. - * - * @access public - * @since Log 1.7.0 - */ - function notice($message) - { - return $this->log($message, PEAR_LOG_NOTICE); - } - - /** - * A convenience function for logging a information event. It will log a - * message at the PEAR_LOG_INFO log level. - * - * @param mixed $message String or object containing the message - * to log. - * - * @return boolean True if the message was successfully logged. - * - * @access public - * @since Log 1.7.0 - */ - function info($message) - { - return $this->log($message, PEAR_LOG_INFO); - } - - /** - * A convenience function for logging a debug event. It will log a - * message at the PEAR_LOG_DEBUG log level. - * - * @param mixed $message String or object containing the message - * to log. - * - * @return boolean True if the message was successfully logged. - * - * @access public - * @since Log 1.7.0 - */ - function debug($message) - { - return $this->log($message, PEAR_LOG_DEBUG); - } - - /** - * Returns the string representation of the message data. - * - * If $message is an object, _extractMessage() will attempt to extract - * the message text using a known method (such as a PEAR_Error object's - * getMessage() method). If a known method, cannot be found, the - * serialized representation of the object will be returned. - * - * If the message data is already a string, it will be returned unchanged. - * - * @param mixed $message The original message data. This may be a - * string or any object. - * - * @return string The string representation of the message. - * - * @access private - */ - function _extractMessage($message) - { - /* - * If we've been given an object, attempt to extract the message using - * a known method. If we can't find such a method, default to the - * "human-readable" version of the object. - * - * We also use the human-readable format for arrays. - */ - if (is_object($message)) { - if (method_exists($message, 'getmessage')) { - $message = $message->getMessage(); - } else if (method_exists($message, 'tostring')) { - $message = $message->toString(); - } else if (method_exists($message, '__tostring')) { - $message = (string)$message; - } else { - $message = print_r($message, true); - } - } else if (is_array($message)) { - if (isset($message['message'])) { - $message = $message['message']; - } else { - $message = print_r($message, true); - } - } - - /* Otherwise, we assume the message is a string. */ - return $message; - } - - /** - * Returns the string representation of a PEAR_LOG_* integer constant. - * - * @param int $priority A PEAR_LOG_* integer constant. - * - * @return string The string representation of $level. - * - * @since Log 1.0 - */ - function priorityToString($priority) - { - $levels = array( - PEAR_LOG_EMERG => 'emergency', - PEAR_LOG_ALERT => 'alert', - PEAR_LOG_CRIT => 'critical', - PEAR_LOG_ERR => 'error', - PEAR_LOG_WARNING => 'warning', - PEAR_LOG_NOTICE => 'notice', - PEAR_LOG_INFO => 'info', - PEAR_LOG_DEBUG => 'debug' - ); - - return $levels[$priority]; - } - - /** - * Calculate the log mask for the given priority. - * - * @param integer $priority The priority whose mask will be calculated. - * - * @return integer The calculated log mask. - * - * @access public - * @since Log 1.7.0 - */ - function MASK($priority) - { - return (1 << $priority); - } - - /** - * Calculate the log mask for all priorities up to the given priority. - * - * @param integer $priority The maximum priority covered by this mask. - * - * @return integer The calculated log mask. - * - * @access public - * @since Log 1.7.0 - */ - function UPTO($priority) - { - return ((1 << ($priority + 1)) - 1); - } - - /** - * Set and return the level mask for the current Log instance. - * - * @param integer $mask A bitwise mask of log levels. - * - * @return integer The current level mask. - * - * @access public - * @since Log 1.7.0 - */ - function setMask($mask) - { - $this->_mask = $mask; - - return $this->_mask; - } - - /** - * Returns the current level mask. - * - * @return interger The current level mask. - * - * @access public - * @since Log 1.7.0 - */ - function getMask() - { - return $this->_mask; - } - - /** - * Check if the given priority is included in the current level mask. - * - * @param integer $priority The priority to check. - * - * @return boolean True if the given priority is included in the current - * log mask. - * - * @access private - * @since Log 1.7.0 - */ - function _isMasked($priority) - { - return (Log::MASK($priority) & $this->_mask); - } - - /** - * Returns the current default priority. - * - * @return integer The current default priority. - * - * @access public - * @since Log 1.8.4 - */ - function getPriority() - { - return $this->_priority; - } - - /** - * Sets the default priority to the specified value. - * - * @param integer $priority The new default priority. - * - * @access public - * @since Log 1.8.4 - */ - function setPriority($priority) - { - $this->_priority = $priority; - } - - /** - * Adds a Log_observer instance to the list of observers that are listening - * for messages emitted by this Log instance. - * - * @param object $observer The Log_observer instance to attach as a - * listener. - * - * @param boolean True if the observer is successfully attached. - * - * @access public - * @since Log 1.0 - */ - function attach(&$observer) - { - if (!is_a($observer, 'Log_observer')) { - return false; - } - - $this->_listeners[$observer->_id] = &$observer; - - return true; - } - - /** - * Removes a Log_observer instance from the list of observers. - * - * @param object $observer The Log_observer instance to detach from - * the list of listeners. - * - * @param boolean True if the observer is successfully detached. - * - * @access public - * @since Log 1.0 - */ - function detach($observer) - { - if (!is_a($observer, 'Log_observer') || - !isset($this->_listeners[$observer->_id])) { - return false; - } - - unset($this->_listeners[$observer->_id]); - - return true; - } - - /** - * Informs each registered observer instance that a new message has been - * logged. - * - * @param array $event A hash describing the log event. - * - * @access private - */ - function _announce($event) - { - foreach ($this->_listeners as $id => $listener) { - if ($event['priority'] <= $this->_listeners[$id]->_priority) { - $this->_listeners[$id]->notify($event); - } - } - } - - /** - * Indicates whether this is a composite class. - * - * @return boolean True if this is a composite class. - * - * @access public - * @since Log 1.0 - */ - function isComposite() - { - return false; - } - - /** - * Sets this Log instance's identification string. - * - * @param string $ident The new identification string. - * - * @access public - * @since Log 1.6.3 - */ - function setIdent($ident) - { - $this->_ident = $ident; - } - - /** - * Returns the current identification string. - * - * @return string The current Log instance's identification string. - * - * @access public - * @since Log 1.6.3 - */ - function getIdent() - { - return $this->_ident; - } -} - -?> diff --git a/inc/Log/composite.php b/inc/Log/composite.php deleted file mode 100644 index 104c8966c42bdac17f64777154d545049649c9d7..0000000000000000000000000000000000000000 --- a/inc/Log/composite.php +++ /dev/null @@ -1,196 +0,0 @@ -<?php -/** - * $Header: /repository/pear/Log/Log/composite.php,v 1.23 2004/08/09 06:04:11 jon Exp $ - * $Horde: horde/lib/Log/composite.php,v 1.2 2000/06/28 21:36:13 jon Exp $ - * - * @version $Revision: 1.23 $ - * @package Log - */ - -/** - * The Log_composite:: class implements a Composite pattern which - * allows multiple Log implementations to receive the same events. - * - * @author Chuck Hagenbuch <chuck@horde.org> - * @author Jon Parise <jon@php.net> - * - * @since Horde 1.3 - * @since Log 1.0 - * @package Log - * - * @example composite.php Using the composite handler. - */ -class Log_composite extends Log -{ - /** - * Array holding all of the Log instances to which log events should be - * sent. - * - * @var array - * @access private - */ - var $_children = array(); - - - /** - * Constructs a new composite Log object. - * - * @param boolean $name This parameter is ignored. - * @param boolean $ident This parameter is ignored. - * @param boolean $conf This parameter is ignored. - * @param boolean $level This parameter is ignored. - * - * @access public - */ - function Log_composite($name = false, $ident = false, $conf = false, - $level = PEAR_LOG_DEBUG) - { - } - - /** - * Opens the child connections. - * - * @access public - */ - function open() - { - if (!$this->_opened) { - foreach ($this->_children as $id => $child) { - $this->_children[$id]->open(); - } - $this->_opened = true; - } - } - - /** - * Closes any child instances. - * - * @access public - */ - function close() - { - if ($this->_opened) { - foreach ($this->_children as $id => $child) { - $this->_children[$id]->close(); - } - $this->_opened = false; - } - } - - /** - * Flushes all open child instances. - * - * @access public - * @since Log 1.8.2 - */ - function flush() - { - if ($this->_opened) { - foreach ($this->_children as $id => $child) { - $this->_children[$id]->flush(); - } - } - } - - /** - * Sends $message and $priority to each child of this composite. - * - * @param mixed $message String or object containing the message - * to log. - * @param string $priority (optional) 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 if the entry is successfully logged. - * - * @access public - */ - function log($message, $priority = null) - { - /* If a priority hasn't been specified, use the default value. */ - if ($priority === null) { - $priority = $this->_priority; - } - - foreach ($this->_children as $id => $child) { - $this->_children[$id]->log($message, $priority); - } - - $this->_announce(array('priority' => $priority, 'message' => $message)); - - return true; - } - - /** - * Returns true if this is a composite. - * - * @return boolean True if this is a composite class. - * - * @access public - */ - function isComposite() - { - return true; - } - - /** - * Sets this identification string for all of this composite's children. - * - * @param string $ident The new identification string. - * - * @access public - * @since Log 1.6.7 - */ - function setIdent($ident) - { - foreach ($this->_children as $id => $child) { - $this->_children[$id]->setIdent($ident); - } - } - - /** - * Adds a Log instance to the list of children. - * - * @param object $child The Log instance to add. - * - * @return boolean True if the Log instance was successfully added. - * - * @access public - */ - function addChild(&$child) - { - /* Make sure this is a Log instance. */ - if (!is_a($child, 'Log')) { - return false; - } - - $this->_children[$child->_id] = &$child; - - return true; - } - - /** - * Removes a Log instance from the list of children. - * - * @param object $child The Log instance to remove. - * - * @return boolean True if the Log instance was successfully removed. - * - * @access public - */ - function removeChild($child) - { - if (!is_a($child, 'Log') || !isset($this->_children[$child->_id])) { - return false; - } - - unset($this->_children[$child->_id]); - - return true; - } -} - -?> diff --git a/inc/Log/console.php b/inc/Log/console.php deleted file mode 100644 index 62032e7964435f6edfc73a364d847d49a297921b..0000000000000000000000000000000000000000 --- a/inc/Log/console.php +++ /dev/null @@ -1,190 +0,0 @@ -<?php -/** - * $Header: /repository/pear/Log/Log/console.php,v 1.19 2004/01/19 08:02:40 jon Exp $ - * - * @version $Revision: 1.19 $ - * @package Log - */ - -/** - * The Log_console class is a concrete implementation of the Log:: - * abstract class which writes message to the text console. - * - * @author Jon Parise <jon@php.net> - * @since Log 1.1 - * @package Log - * - * @example console.php Using the console handler. - */ -class Log_console extends Log -{ - /** - * Handle to the current output stream. - * @var resource - * @access private - */ - var $_stream = STDOUT; - - /** - * Should the output be buffered or displayed immediately? - * @var string - * @access private - */ - var $_buffering = false; - - /** - * String holding the buffered output. - * @var string - * @access private - */ - var $_buffer = ''; - - /** - * String containing the format of a log line. - * @var string - * @access private - */ - var $_lineFormat = '%1$s %2$s [%3$s] %4$s'; - - /** - * String containing the timestamp format. It will be passed directly to - * strftime(). Note that the timestamp string will generated using the - * current locale. - * @var string - * @access private - */ - var $_timeFormat = '%b %d %H:%M:%S'; - - /** - * Hash that maps canonical format keys to position arguments for the - * "line format" string. - * @var array - * @access private - */ - var $_formatMap = array('%{timestamp}' => '%1$s', - '%{ident}' => '%2$s', - '%{priority}' => '%3$s', - '%{message}' => '%4$s', - '%\{' => '%%{'); - - /** - * Constructs a new Log_console object. - * - * @param string $name Ignored. - * @param string $ident The identity string. - * @param array $conf The configuration array. - * @param int $level Log messages up to and including this level. - * @access public - */ - function Log_console($name, $ident = '', $conf = array(), - $level = PEAR_LOG_DEBUG) - { - $this->_id = md5(microtime()); - $this->_ident = $ident; - $this->_mask = Log::UPTO($level); - - if (!empty($conf['stream'])) { - $this->_stream = $conf['stream']; - } - - if (isset($conf['buffering'])) { - $this->_buffering = $conf['buffering']; - } - - if (!empty($conf['lineFormat'])) { - $this->_lineFormat = str_replace(array_keys($this->_formatMap), - array_values($this->_formatMap), - $conf['lineFormat']); - } - - if (!empty($conf['timeFormat'])) { - $this->_timeFormat = $conf['timeFormat']; - } - - /* - * If output buffering has been requested, we need to register a - * shutdown function that will dump the buffer upon termination. - */ - if ($this->_buffering) { - register_shutdown_function(array(&$this, '_Log_console')); - } - } - - /** - * Destructor - */ - function _Log_console() - { - $this->flush(); - } - - /** - * Flushes all pending ("buffered") data to the output stream. - * - * @access public - * @since Log 1.8.2 - */ - function flush() - { - /* - * If output buffering is enabled, dump the contents of the buffer to - * the output stream. - */ - if ($this->_buffering && (strlen($this->_buffer) > 0)) { - fwrite($this->_stream, $this->_buffer); - $this->_buffer = ''; - } - - return fflush($this->_stream); - } - - /** - * Writes $message to the text console. 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; - } - - /* Extract the string representation of the message. */ - $message = $this->_extractMessage($message); - - /* Build the string containing the complete log line. */ - $line = sprintf($this->_lineFormat, strftime($this->_timeFormat), - $this->_ident, $this->priorityToString($priority), - $message) . "\n"; - - /* - * If buffering is enabled, append this line to the output buffer. - * Otherwise, print the line to the output stream immediately. - */ - if ($this->_buffering) { - $this->_buffer .= $line; - } else { - fwrite($this->_stream, $line); - } - - /* Notify observers about this log message. */ - $this->_announce(array('priority' => $priority, 'message' => $message)); - - return true; - } -} - -?> diff --git a/inc/Log/daemon.php b/inc/Log/daemon.php deleted file mode 100644 index 739270c9a32c902ca9210b81470d067fe9a7b7ae..0000000000000000000000000000000000000000 --- a/inc/Log/daemon.php +++ /dev/null @@ -1,229 +0,0 @@ -<?php -// $Id: daemon.php,v 1.1 2004/12/21 06:55:38 jon Exp $ - -/** - * The Log_daemon class is a concrete implementation of the Log:: - * abstract class which sends messages to syslog daemon on UNIX-like machines. - * This class uses the syslog protocol: http://www.ietf.org/rfc/rfc3164.txt - * - * @author Bart van der Schans <schans@dds.nl> - * @version $Revision: 1.1 $ - * @package Log - */ -class Log_daemon extends Log { - - /** - * Integer holding the log facility to use. - * @var string - */ - var $_name = LOG_DAEMON; - - /** - * Var holding the resource pointer to the socket - * @var resource - */ - var $_socket; - - /** - * The ip address or servername - * @see http://www.php.net/manual/en/transports.php - * @var string - */ - var $_ip = '127.0.0.1'; - - /** - * Protocol to use (tcp, udp, etc.) - * @see http://www.php.net/manual/en/transports.php - * @var string - */ - var $_proto = 'udp'; - - /** - * Port to connect to - * @var int - */ - var $_port = 514; - - /** - * Maximum message length in bytes - * @var int - */ - var $_maxsize = 4096; - - /** - * Socket timeout in seconds - * @var int - */ - var $_timeout = 1; - - - /** - * Constructs a new syslog object. - * - * @param string $name The syslog facility. - * @param string $ident The identity string. - * @param array $conf The configuration array. - * @param int $maxLevel Maximum level at which to log. - * @access public - */ - function Log_daemon($name, $ident = '', $conf = array(), - $level = PEAR_LOG_DEBUG) - { - /* Ensure we have a valid integer value for $name. */ - if (empty($name) || !is_int($name)) { - $name = LOG_SYSLOG; - } - - $this->_id = md5(microtime()); - $this->_name = $name; - $this->_ident = $ident; - $this->_mask = Log::UPTO($level); - - if (isset($conf['ip'])) { - $this->_ip = $conf['ip']; - } - if (isset($conf['proto'])) { - $this->_proto = $conf['proto']; - } - if (isset($conf['port'])) { - $this->_port = $conf['port']; - } - if (isset($conf['maxsize'])) { - $this->_maxsize = $conf['maxsize']; - } - if (isset($conf['timeout'])) { - $this->_timeout = $conf['timeout']; - } - $this->_proto = $this->_proto . '://'; - - register_shutdown_function(array(&$this, '_Log_daemon')); - } - - /** - * Destructor. - * - * @access private - */ - function _Log_daemon() - { - $this->close(); - } - - /** - * Opens a connection to the system logger, if it has not already - * been opened. This is implicitly called by log(), if necessary. - * @access public - */ - function open() - { - if (!$this->_opened) { - $this->_opened = (bool)($this->_socket = @fsockopen( - $this->_proto . $this->_ip, - $this->_port, - $errno, - $errstr, - $this->_timeout)); - } - return $this->_opened; - } - - /** - * Closes the connection to the system logger, if it is open. - * @access public - */ - function close() - { - if ($this->_opened) { - $this->_opened = false; - return fclose($this->_socket); - } - return true; - } - - /** - * Sends $message to the currently open syslog connection. Calls - * open() if necessary. Also passes the message along to any Log_observer - * instances that are observing this Log. - * - * @param string $message The textual message to be logged. - * @param int $priority (optional) The priority of the message. Valid - * values are: LOG_EMERG, LOG_ALERT, LOG_CRIT, - * LOG_ERR, LOG_WARNING, LOG_NOTICE, LOG_INFO, - * and LOG_DEBUG. The default is LOG_INFO. - * @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); - - /* Set the facility level. */ - $facility_level = intval($this->_name) + - intval($this->_toSyslog($priority)); - - /* Prepend ident info. */ - if (!empty($this->_ident)) { - $message = $this->_ident . ' ' . $message; - } - - /* Check for message length. */ - if (strlen($message) > $this->_maxsize) { - $message = substr($message, 0, ($this->_maxsize) - 10) . ' [...]'; - } - - /* Write to socket. */ - fwrite($this->_socket, '<' . $facility_level . '>' . $message . "\n"); - - $this->_announce(array('priority' => $priority, 'message' => $message)); - } - - /** - * Converts a PEAR_LOG_* constant into a syslog LOG_* constant. - * - * This function exists because, under Windows, not all of the LOG_* - * constants have unique values. Instead, the PEAR_LOG_* were introduced - * for global use, with the conversion to the LOG_* constants kept local to - * to the syslog driver. - * - * @param int $priority PEAR_LOG_* value to convert to LOG_* value. - * - * @return The LOG_* representation of $priority. - * - * @access private - */ - function _toSyslog($priority) - { - static $priorities = array( - PEAR_LOG_EMERG => LOG_EMERG, - PEAR_LOG_ALERT => LOG_ALERT, - PEAR_LOG_CRIT => LOG_CRIT, - PEAR_LOG_ERR => LOG_ERR, - PEAR_LOG_WARNING => LOG_WARNING, - PEAR_LOG_NOTICE => LOG_NOTICE, - PEAR_LOG_INFO => LOG_INFO, - PEAR_LOG_DEBUG => LOG_DEBUG - ); - - /* If we're passed an unknown priority, default to LOG_INFO. */ - if (!is_int($priority) || !in_array($priority, $priorities)) { - return LOG_INFO; - } - - return $priorities[$priority]; - } -} diff --git a/inc/Log/display.php b/inc/Log/display.php deleted file mode 100644 index 0d5a93d79da491d2197cfcd9edefad553b660208..0000000000000000000000000000000000000000 --- a/inc/Log/display.php +++ /dev/null @@ -1,108 +0,0 @@ -<?php -/** - * $Header: /repository/pear/Log/Log/display.php,v 1.6 2004/11/27 21:46:50 jon Exp $ - * - * @version $Revision: 1.6 $ - * @package Log - */ - -/** - * The Log_display class is a concrete implementation of the Log:: - * abstract class which writes message into browser in usual PHP maner. - * This may be useful because when you use PEAR::setErrorHandling in - * PEAR_ERROR_CALLBACK mode error messages are not displayed by - * PHP error handler. - * - * @author Paul Yanchenko <pusher@inaco.ru> - * @since Log 1.8.0 - * @package Log - * - * @example display.php Using the display handler. - */ -class Log_display extends Log -{ - /** - * String to output before an error message - * @var string - * @access private - */ - var $_error_prepend = ''; - - /** - * String to output after an error message - * @var string - * @access private - */ - var $_error_append = ''; - - - /** - * Constructs a new Log_display object. - * - * @param string $name Ignored. - * @param string $ident The identity string. - * @param array $conf The configuration array. - * @param int $level Log messages up to and including this level. - * @access public - */ - function Log_display($name = '', $ident = '', $conf = array(), - $level = PEAR_LOG_DEBUG) - { - $this->_id = md5(microtime()); - $this->_ident = $ident; - $this->_mask = Log::UPTO($level); - - if (!empty($conf['error_prepend'])) { - $this->_error_prepend = $conf['error_prepend']; - } else { - $this->_error_prepend = ini_get('error_prepend_string'); - } - - if (!empty($conf['error_append'])) { - $this->_error_append = $conf['error_append']; - } else { - $this->_error_append = ini_get('error_append_string'); - } - } - - /** - * Writes $message to the text browser. 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; - } - - /* Extract the string representation of the message. */ - $message = $this->_extractMessage($message); - - /* Build and output the complete log line. */ - echo $this->_error_prepend . - '<b>' . ucfirst($this->priorityToString($priority)) . '</b>: '. - nl2br(htmlspecialchars($message)) . - $this->_error_append . "<br />\n"; - - /* Notify observers about this log message. */ - $this->_announce(array('priority' => $priority, 'message' => $message)); - - return true; - } -} - -?> diff --git a/inc/Log/error_log.php b/inc/Log/error_log.php deleted file mode 100644 index 04c0952cd7a38446887a66ad82951ad22974f427..0000000000000000000000000000000000000000 --- a/inc/Log/error_log.php +++ /dev/null @@ -1,104 +0,0 @@ -<?php -/** - * $Header: /repository/pear/Log/Log/error_log.php,v 1.6 2004/01/19 08:02:40 jon Exp $ - * - * @version $Revision: 1.6 $ - * @package Log - */ - -/** - * The Log_error_log class is a concrete implementation of the Log abstract - * class that logs messages using PHP's error_log() function. - * - * @author Jon Parise <jon@php.net> - * @since Log 1.7.0 - * @package Log - * - * @example error_log.php Using the error_log handler. - */ -class Log_error_log extends Log -{ - /** - * The error_log() log type. - * @var integer - * @access private - */ - var $_type = PEAR_LOG_TYPE_SYSTEM; - - /** - * The type-specific destination value. - * @var string - * @access private - */ - var $_destination = ''; - - /** - * Additional headers to pass to the mail() function when the - * PEAR_LOG_TYPE_MAIL type is used. - * @var string - * @access private - */ - var $_extra_headers = ''; - - /** - * Constructs a new Log_error_log object. - * - * @param string $name Ignored. - * @param string $ident The identity string. - * @param array $conf The configuration array. - * @param int $level Log messages up to and including this level. - * @access public - */ - function Log_error_log($name, $ident = '', $conf = array(), - $level = PEAR_LOG_DEBUG) - { - $this->_id = md5(microtime()); - $this->_type = $name; - $this->_ident = $ident; - $this->_mask = Log::UPTO($level); - - if (!empty($conf['destination'])) { - $this->_destination = $conf['destination']; - } - if (!empty($conf['extra_headers'])) { - $this->_extra_headers = $conf['extra_headers']; - } - } - - /** - * Logs $message using PHP's error_log() function. The message is also - * passed 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; - } - - /* Extract the string representation of the message. */ - $message = $this->_extractMessage($message); - - $success = error_log($this->_ident . ': ' . $message, $this->_type, - $this->_destination, $this->_extra_headers); - - $this->_announce(array('priority' => $priority, 'message' => $message)); - - return $success; - } -} - -?> diff --git a/inc/Log/file.php b/inc/Log/file.php deleted file mode 100644 index 36f30b429784704911f61fd723b52eac14e56938..0000000000000000000000000000000000000000 --- a/inc/Log/file.php +++ /dev/null @@ -1,286 +0,0 @@ -<?php -/** - * $Header: /repository/pear/Log/Log/file.php,v 1.37 2004/01/19 08:02:40 jon Exp $ - * - * @version $Revision: 1.37 $ - * @package Log - */ - -/** - * The Log_file class is a concrete implementation of the Log abstract - * class that logs messages to a text file. - * - * @author Jon Parise <jon@php.net> - * @author Roman Neuhauser <neuhauser@bellavista.cz> - * @since Log 1.0 - * @package Log - * - * @example file.php Using the file handler. - */ -class Log_file extends Log -{ - /** - * String containing the name of the log file. - * @var string - * @access private - */ - var $_filename = 'php.log'; - - /** - * Handle to the log file. - * @var resource - * @access private - */ - var $_fp = false; - - /** - * Should new log entries be append to an existing log file, or should the - * a new log file overwrite an existing one? - * @var boolean - * @access private - */ - var $_append = true; - - /** - * Integer (in octal) containing the log file's permissions mode. - * @var integer - * @access private - */ - var $_mode = 0644; - - /** - * String containing the format of a log line. - * @var string - * @access private - */ - var $_lineFormat = '%1$s %2$s [%3$s] %4$s'; - - /** - * String containing the timestamp format. It will be passed directly to - * strftime(). Note that the timestamp string will generated using the - * current locale. - * @var string - * @access private - */ - var $_timeFormat = '%b %d %H:%M:%S'; - - /** - * Hash that maps canonical format keys to position arguments for the - * "line format" string. - * @var array - * @access private - */ - var $_formatMap = array('%{timestamp}' => '%1$s', - '%{ident}' => '%2$s', - '%{priority}' => '%3$s', - '%{message}' => '%4$s', - '%\{' => '%%{'); - - /** - * String containing the end-on-line character sequence. - * @var string - * @access private - */ - var $_eol = "\n"; - - /** - * Constructs a new Log_file object. - * - * @param string $name Ignored. - * @param string $ident The identity string. - * @param array $conf The configuration array. - * @param int $level Log messages up to and including this level. - * @access public - */ - function Log_file($name, $ident = '', $conf = array(), - $level = PEAR_LOG_DEBUG) - { - $this->_id = md5(microtime()); - $this->_filename = $name; - $this->_ident = $ident; - $this->_mask = Log::UPTO($level); - - if (isset($conf['append'])) { - $this->_append = $conf['append']; - } - - if (!empty($conf['mode'])) { - $this->_mode = $conf['mode']; - } - - if (!empty($conf['lineFormat'])) { - $this->_lineFormat = str_replace(array_keys($this->_formatMap), - array_values($this->_formatMap), - $conf['lineFormat']); - } - - if (!empty($conf['timeFormat'])) { - $this->_timeFormat = $conf['timeFormat']; - } - - if (!empty($conf['eol'])) { - $this->_eol = $conf['eol']; - } else { - $this->_eol = (strstr(PHP_OS, 'WIN')) ? "\r\n" : "\n"; - } - - register_shutdown_function(array(&$this, '_Log_file')); - } - - /** - * Destructor - */ - function _Log_file() - { - if ($this->_opened) { - $this->close(); - } - } - - /** - * Creates the given directory path. If the parent directories don't - * already exist, they will be created, too. - * - * @param string $path The full directory path to create. - * @param integer $mode The permissions mode with which the - * directories will be created. - * - * @return True if the full path is successfully created or already - * exists. - * - * @access private - */ - function _mkpath($path, $mode = 0700) - { - static $depth = 0; - - /* Guard against potentially infinite recursion. */ - if ($depth++ > 25) { - trigger_error("_mkpath(): Maximum recursion depth (25) exceeded", - E_USER_WARNING); - return false; - } - - /* We're only interested in the directory component of the path. */ - $path = dirname($path); - - /* If the directory already exists, return success immediately. */ - if (is_dir($path)) { - $depth = 0; - return true; - } - - /* - * In order to understand recursion, you must first understand - * recursion ... - */ - if ($this->_mkpath($path, $mode) === false) { - return false; - } - - return @mkdir($path, $mode); - } - - /** - * Opens the log file for output. If the specified log file does not - * already exist, it will be created. By default, new log entries are - * appended to the end of the log file. - * - * This is implicitly called by log(), if necessary. - * - * @access public - */ - function open() - { - if (!$this->_opened) { - /* If the log file's directory doesn't exist, create it. */ - if (!is_dir(dirname($this->_filename))) { - $this->_mkpath($this->_filename); - } - - /* Obtain a handle to the log file. */ - $this->_fp = fopen($this->_filename, ($this->_append) ? 'a' : 'w'); - - $this->_opened = ($this->_fp !== false); - - /* Attempt to set the log file's mode. */ - @chmod($this->_filename, $this->_mode); - } - - return $this->_opened; - } - - /** - * Closes the log file if it is open. - * - * @access public - */ - function close() - { - /* If the log file is open, close it. */ - if ($this->_opened && fclose($this->_fp)) { - $this->_opened = false; - } - - return ($this->_opened === false); - } - - /** - * Flushes all pending data to the file handle. - * - * @access public - * @since Log 1.8.2 - */ - function flush() - { - return fflush($this->_fp); - } - - /** - * Logs $message to the output window. The message is also passed 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 log file isn't already open, open it now. */ - if (!$this->_opened && !$this->open()) { - return false; - } - - /* Extract the string representation of the message. */ - $message = $this->_extractMessage($message); - - /* Build the string containing the complete log line. */ - $line = sprintf($this->_lineFormat, strftime($this->_timeFormat), - $this->_ident, $this->priorityToString($priority), - $message) . $this->_eol; - - /* Write the log line to the log file. */ - $success = (fwrite($this->_fp, $line) !== false); - - /* Notify observers about this log message. */ - $this->_announce(array('priority' => $priority, 'message' => $message)); - - return $success; - } -} - -?> diff --git a/inc/Log/mail.php b/inc/Log/mail.php deleted file mode 100644 index 064f13c0ed5a4356451bc6f7a7097e998996a6a9..0000000000000000000000000000000000000000 --- a/inc/Log/mail.php +++ /dev/null @@ -1,222 +0,0 @@ -<?php -/** - * $Header: /repository/pear/Log/Log/mail.php,v 1.21 2004/01/19 08:02:40 jon Exp $ - * - * @version $Revision: 1.21 $ - * @package Log - */ - -/** - * The Log_mail class is a concrete implementation of the Log:: abstract class - * which sends log messages to a mailbox. - * The mail is actually sent when you close() the logger, or when the destructor - * is called (when the script is terminated). - * - * PLEASE NOTE that you must create a Log_mail object using =&, like this : - * $logger =& Log::factory("mail", "recipient@example.com", ...) - * - * This is a PEAR requirement for destructors to work properly. - * See http://pear.php.net/manual/en/class.pear.php - * - * @author Ronnie Garcia <ronnie@mk2.net> - * @author Jon Parise <jon@php.net> - * @since Log 1.3 - * @package Log - * - * @example mail.php Using the mail handler. - */ -class Log_mail extends Log -{ - /** - * String holding the recipient's email address. - * @var string - * @access private - */ - var $_recipient = ''; - - /** - * String holding the sender's email address. - * @var string - * @access private - */ - var $_from = ''; - - /** - * String holding the email's subject. - * @var string - * @access private - */ - var $_subject = '[Log_mail] Log message'; - - /** - * String holding an optional preamble for the log messages. - * @var string - * @access private - */ - var $_preamble = ''; - - /** - * String holding the mail message body. - * @var string - * @access private - */ - var $_message = ''; - - - /** - * Constructs a new Log_mail object. - * - * Here is how you can customize the mail driver with the conf[] hash : - * $conf['from'] : the mail's "From" header line, - * $conf['subject'] : the mail's "Subject" line. - * - * @param string $name The filename of the logfile. - * @param string $ident The identity string. - * @param array $conf The configuration array. - * @param int $level Log messages up to and including this level. - * @access public - */ - function Log_mail($name, $ident = '', $conf = array(), - $level = PEAR_LOG_DEBUG) - { - $this->_id = md5(microtime()); - $this->_recipient = $name; - $this->_ident = $ident; - $this->_mask = Log::UPTO($level); - - if (!empty($conf['from'])) { - $this->_from = $conf['from']; - } else { - $this->_from = ini_get('sendmail_from'); - } - - if (!empty($conf['subject'])) { - $this->_subject = $conf['subject']; - } - - if (!empty($conf['preamble'])) { - $this->_preamble = $conf['preamble']; - } - - /* register the destructor */ - register_shutdown_function(array(&$this, '_Log_mail')); - } - - /** - * Destructor. Calls close(). - * - * @access private - */ - function _Log_mail() - { - $this->close(); - } - - /** - * Starts a new mail message. - * This is implicitly called by log(), if necessary. - * - * @access public - */ - function open() - { - if (!$this->_opened) { - if (!empty($this->_preamble)) { - $this->_message = $this->_preamble . "\n\n"; - } - $this->_opened = true; - } - - return $this->_opened; - } - - /** - * Closes the message, if it is open, and sends the mail. - * This is implicitly called by the destructor, if necessary. - * - * @access public - */ - function close() - { - if ($this->_opened) { - if (!empty($this->_message)) { - $headers = "From: $this->_from\n"; - $headers .= "User-Agent: Log_mail"; - - if (mail($this->_recipient, $this->_subject, $this->_message, - $headers) == false) { - error_log("Log_mail: Failure executing mail()", 0); - return false; - } - - /* Clear the message string now that the email has been sent. */ - $this->_message = ''; - } - $this->_opened = false; - } - - return ($this->_opened === false); - } - - /** - * Flushes the log output by forcing the email message to be sent now. - * Events that are logged after flush() is called will be appended to a - * new email message. - * - * @access public - * @since Log 1.8.2 - */ - function flush() - { - /* - * It's sufficient to simply call close() to flush the output. - * The next call to log() will cause the handler to be reopened. - */ - return $this->close(); - } - - /** - * Writes $message to the currently open mail message. - * Calls open(), if necessary. - * - * @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 message 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); - - $entry = sprintf("%s %s [%s] %s\n", strftime('%b %d %H:%M:%S'), - $this->_ident, Log::priorityToString($priority), - $message); - - $this->_message .= $entry; - - $this->_announce(array('priority' => $priority, 'message' => $message)); - - return true; - } -} - -?> diff --git a/inc/Log/mcal.php b/inc/Log/mcal.php deleted file mode 100644 index a5c46f3dfc6789177d45e55abb9378b856a922d9..0000000000000000000000000000000000000000 --- a/inc/Log/mcal.php +++ /dev/null @@ -1,171 +0,0 @@ -<?php -/** - * $Header: /repository/pear/Log/Log/mcal.php,v 1.17 2004/01/19 08:02:40 jon Exp $ - * $Horde: horde/lib/Log/mcal.php,v 1.2 2000/06/28 21:36:13 jon Exp $ - * - * @version $Revision: 1.17 $ - * @package Log - */ - -/** - * The Log_mcal class is a concrete implementation of the Log:: - * abstract class which sends messages to a local or remote calendar - * store accessed through MCAL. - * - * @author Chuck Hagenbuch <chuck@horde.org> - * @since Horde 1.3 - * @since Log 1.0 - * @package Log - */ -class Log_mcal extends Log { - - /** - * holding the calendar specification to connect to. - * @var string - * @access private - */ - var $_calendar = '{localhost/mstore}'; - - /** - * holding the username to use. - * @var string - * @access private - */ - var $_username = ''; - - /** - * holding the password to use. - * @var string - * @access private - */ - var $_password = ''; - - /** - * holding the options to pass to the calendar stream. - * @var integer - * @access private - */ - var $_options = 0; - - /** - * ResourceID of the MCAL stream. - * @var string - * @access private - */ - var $_stream = ''; - - /** - * Integer holding the log facility to use. - * @var string - * @access private - */ - var $_name = LOG_SYSLOG; - - - /** - * Constructs a new Log_mcal object. - * - * @param string $name The category to use for our events. - * @param string $ident The identity string. - * @param array $conf The configuration array. - * @param int $level Log messages up to and including this level. - * @access public - */ - function Log_mcal($name, $ident = '', $conf = array(), - $level = PEAR_LOG_DEBUG) - { - $this->_id = md5(microtime()); - $this->_name = $name; - $this->_ident = $ident; - $this->_mask = Log::UPTO($level); - $this->_calendar = $conf['calendar']; - $this->_username = $conf['username']; - $this->_password = $conf['password']; - $this->_options = $conf['options']; - } - - /** - * Opens a calendar stream, if it has not already been - * opened. This is implicitly called by log(), if necessary. - * @access public - */ - function open() - { - if (!$this->_opened) { - $this->_stream = mcal_open($this->_calendar, $this->_username, - $this->_password, $this->_options); - $this->_opened = true; - } - - return $this->_opened; - } - - /** - * Closes the calendar stream, if it is open. - * @access public - */ - function close() - { - if ($this->_opened) { - mcal_close($this->_stream); - $this->_opened = false; - } - - return ($this->_opened === false); - } - - /** - * Logs $message and associated information to the currently open - * calendar stream. 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); - - $date_str = date('Y:n:j:G:i:s'); - $dates = explode(':', $date_str); - - mcal_event_init($this->_stream); - mcal_event_set_title($this->_stream, $this->_ident); - mcal_event_set_category($this->_stream, $this->_name); - mcal_event_set_description($this->_stream, $message); - mcal_event_add_attribute($this->_stream, 'priority', $priority); - mcal_event_set_start($this->_stream, $dates[0], $dates[1], $dates[2], - $dates[3], $dates[4], $dates[5]); - mcal_event_set_end($this->_stream, $dates[0], $dates[1], $dates[2], - $dates[3], $dates[4], $dates[5]); - mcal_append_event($this->_stream); - - $this->_announce(array('priority' => $priority, 'message' => $message)); - - return true; - } -} - -?> diff --git a/inc/Log/null.php b/inc/Log/null.php deleted file mode 100644 index 23de3f1a9e5b13c41a40128a5b51075cc19a3366..0000000000000000000000000000000000000000 --- a/inc/Log/null.php +++ /dev/null @@ -1,68 +0,0 @@ -<?php -/** - * $Header: /repository/pear/Log/Log/null.php,v 1.3 2004/01/19 08:02:40 jon Exp $ - * - * @version $Revision: 1.3 $ - * @package Log - */ - -/** - * The Log_null class is a concrete implementation of the Log:: abstract - * class. It simply consumes log events. - * - * @author Jon Parise <jon@php.net> - * @since Log 1.8.2 - * @package Log - * - * @example null.php Using the null handler. - */ -class Log_null extends Log -{ - /** - * Constructs a new Log_null object. - * - * @param string $name Ignored. - * @param string $ident The identity string. - * @param array $conf The configuration array. - * @param int $level Log messages up to and including this level. - * @access public - */ - function Log_null($name, $ident = '', $conf = array(), - $level = PEAR_LOG_DEBUG) - { - $this->_id = md5(microtime()); - $this->_ident = $ident; - $this->_mask = Log::UPTO($level); - } - - /** - * Simply consumes the log event. The message will still be passed - * 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; - } - - $this->_announce(array('priority' => $priority, 'message' => $message)); - - return true; - } -} - -?> diff --git a/inc/Log/observer.php b/inc/Log/observer.php deleted file mode 100644 index 187d5070f7425cbf727b205b1cfe1dd8657648a1..0000000000000000000000000000000000000000 --- a/inc/Log/observer.php +++ /dev/null @@ -1,126 +0,0 @@ -<?php -/** - * $Header: /repository/pear/Log/Log/observer.php,v 1.12 2004/01/11 20:49:49 jon Exp $ - * $Horde: horde/lib/Log/observer.php,v 1.5 2000/06/28 21:36:13 jon Exp $ - * - * @version $Revision: 1.12 $ - * @package Log - */ - -/** - * The Log_observer:: class implements the Observer end of a Subject-Observer - * pattern for watching log activity and taking actions on exceptional events. - * - * @author Chuck Hagenbuch <chuck@horde.org> - * @since Horde 1.3 - * @since Log 1.0 - * @package Log - * - * @example observer_mail.php An example Log_observer implementation. - */ -class Log_observer -{ - /** - * Instance-specific unique identification number. - * - * @var integer - * @access private - */ - var $_id = 0; - - /** - * The minimum priority level of message that we want to hear about. - * PEAR_LOG_EMERG is the highest priority, so we will only hear messages - * with an integer priority value less than or equal to ours. It defaults - * to PEAR_LOG_INFO, which listens to everything except PEAR_LOG_DEBUG. - * - * @var string - * @access private - */ - var $_priority = PEAR_LOG_INFO; - - /** - * Creates a new basic Log_observer instance. - * - * @param integer $priority The highest priority at which to receive - * log event notifications. - * - * @access public - */ - function Log_observer($priority = PEAR_LOG_INFO) - { - $this->_id = md5(microtime()); - $this->_priority = $priority; - } - - /** - * Attempts to return a new concrete Log_observer instance of the requested - * type. - * - * @param string $type The type of concreate Log_observer subclass - * to return. - * @param integer $priority The highest priority at which to receive - * log event notifications. - * @param array $conf Optional associative array of additional - * configuration values. - * - * @return object The newly created concrete Log_observer - * instance, or an false on an error. - */ - function &factory($type, $priority = PEAR_LOG_INFO, $conf = array()) - { - $type = strtolower($type); - $class = 'Log_observer_' . $type; - - /* Support both the new-style and old-style file naming conventions. */ - if (file_exists(dirname(__FILE__) . '/observer_' . $type . '.php')) { - $classfile = 'Log/observer_' . $type . '.php'; - $newstyle = true; - } else { - $classfile = 'Log/' . $type . '.php'; - $newstyle = false; - } - - /* Issue a warning if the old-style conventions are being used. */ - if (!$newstyle) - { - trigger_error('Using old-style Log_observer conventions', - E_USER_WARNING); - } - - /* - * Attempt to include our version of the named class, but don't treat - * a failure as fatal. The caller may have already included their own - * version of the named class. - */ - @include_once $classfile; - - /* If the class exists, return a new instance of it. */ - if (class_exists($class)) { - /* Support both new-style and old-style construction. */ - if ($newstyle) { - return new $class($priority, $conf); - } else { - return new $class($priority); - } - } - - return false; - } - - /** - * This is a stub method to make sure that Log_Observer classes do - * something when they are notified of a message. The default behavior - * is to just print the message, which is obviously not desireable in - * practically any situation - which is why you need to override this - * method. :) - * - * @param array $event A hash describing the log event. - */ - function notify($event) - { - print_r($event); - } -} - -?> diff --git a/inc/Log/sql.php b/inc/Log/sql.php deleted file mode 100644 index 3a20a0e2fafbdedb43ff0ca4ba002f18e7e83d89..0000000000000000000000000000000000000000 --- a/inc/Log/sql.php +++ /dev/null @@ -1,225 +0,0 @@ -<?php -/** - * $Header: /repository/pear/Log/Log/sql.php,v 1.34 2004/08/19 06:35:57 jon Exp $ - * $Horde: horde/lib/Log/sql.php,v 1.12 2000/08/16 20:27:34 chuck Exp $ - * - * @version $Revision: 1.34 $ - * @package Log - */ - -/** PEAR's DB package */ -require_once 'DB.php'; - -/** - * The Log_sql class is a concrete implementation of the Log:: - * abstract class which sends messages to an SQL server. Each entry - * occupies a separate row in the database. - * - * This implementation uses PHP's PEAR database abstraction layer. - * - * CREATE TABLE log_table ( - * id INT NOT NULL, - * logtime TIMESTAMP NOT NULL, - * ident CHAR(16) NOT NULL, - * priority INT NOT NULL, - * message VARCHAR(200), - * PRIMARY KEY (id) - * ); - * - * @author Jon Parise <jon@php.net> - * @since Horde 1.3 - * @since Log 1.0 - * @package Log - * - * @example sql.php Using the SQL handler. - */ -class Log_sql extends Log { - - /** - * Array containing the dsn information. - * @var string - * @access private - */ - var $_dsn = ''; - - /** - * 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'; - - /** - * String holding the name of the ID sequence. - * @var string - * @access private - */ - var $_sequence = 'log_id'; - - /** - * Maximum length of the $ident string. This corresponds to the size of - * the 'ident' column in the SQL table. - * @var integer - * @access private - */ - var $_identLimit = 16; - - - /** - * Constructs a new sql logging object. - * - * @param string $name The target SQL table. - * @param string $ident The identification field. - * @param array $conf The connection configuration array. - * @param int $level Log messages up to and including this level. - * @access public - */ - function Log_sql($name, $ident = '', $conf = array(), - $level = PEAR_LOG_DEBUG) - { - $this->_id = md5(microtime()); - $this->_table = $name; - $this->_mask = Log::UPTO($level); - - /* If a specific sequence name was provided, use it. */ - if (!empty($conf['sequence'])) { - $this->_sequence = $conf['sequence']; - } - - /* If a specific sequence name was provided, use it. */ - if (isset($conf['identLimit'])) { - $this->_identLimit = $conf['identLimit']; - } - - /* Now that the ident limit is confirmed, set the ident string. */ - $this->setIdent($ident); - - /* If an existing database connection was provided, use it. */ - if (isset($conf['db'])) { - $this->_db = &$conf['db']; - $this->_existingConnection = true; - $this->_opened = true; - } else { - $this->_dsn = $conf['dsn']; - } - } - - /** - * 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 (!$this->_opened) { - $this->_db = &DB::connect($this->_dsn, true); - if (DB::isError($this->_db)) { - return false; - } - $this->_opened = true; - } - - 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() - { - if ($this->_opened && !$this->_existingConnection) { - $this->_opened = false; - return $this->_db->disconnect(); - } - - return ($this->_opened === false); - } - - /** - * Sets this Log instance's identification string. Note that this - * SQL-specific implementation will limit the length of the $ident string - * to sixteen (16) characters. - * - * @param string $ident The new identification string. - * - * @access public - * @since Log 1.8.5 - */ - function setIdent($ident) - { - $this->_ident = substr($ident, 0, $this->_identLimit); - } - - /** - * 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. */ - $id = $this->_db->nextId($this->_sequence); - $q = sprintf('insert into %s (id, logtime, ident, priority, message)' . - 'values(%d, CURRENT_TIMESTAMP, %s, %d, %s)', - $this->_table, $id, $this->_db->quote($this->_ident), - $priority, $this->_db->quote($message)); - - $result = $this->_db->query($q); - if (DB::isError($result)) { - return false; - } - - $this->_announce(array('priority' => $priority, 'message' => $message)); - - return true; - } -} - -?> diff --git a/inc/Log/sqlite.php b/inc/Log/sqlite.php deleted file mode 100644 index 83b908a93962fff30ce95f663fbee9ee17cd15b2..0000000000000000000000000000000000000000 --- a/inc/Log/sqlite.php +++ /dev/null @@ -1,238 +0,0 @@ -<?php -/* vim: set expandtab tabstop=4 shiftwidth=4: */ -// +----------------------------------------------------------------------+ -// | PHP version 4.0 | -// +----------------------------------------------------------------------+ -// | Copyright (c) 1997-2004 The PHP Group | -// +----------------------------------------------------------------------+ -// | This source file is subject to version 2.0 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: Bertrand Mansion <bmansion@mamasam.com> | -// +----------------------------------------------------------------------+ -// -// $Id: sqlite.php,v 1.3 2004/01/19 08:02:40 jon Exp $ - -/** - * 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 = md5(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; - } -} - -?> diff --git a/inc/Log/syslog.php b/inc/Log/syslog.php deleted file mode 100644 index 4bafbaa2d9a2a30c4198d0135081622dec8e1283..0000000000000000000000000000000000000000 --- a/inc/Log/syslog.php +++ /dev/null @@ -1,160 +0,0 @@ -<?php -/** - * $Header: /repository/pear/Log/Log/syslog.php,v 1.22 2004/01/19 08:02:40 jon Exp $ - * $Horde: horde/lib/Log/syslog.php,v 1.6 2000/06/28 21:36:13 jon Exp $ - * - * @version $Revision: 1.22 $ - * @package Log - */ - -/** - * The Log_syslog class is a concrete implementation of the Log:: - * abstract class which sends messages to syslog on UNIX-like machines - * (PHP emulates this with the Event Log on Windows machines). - * - * @author Chuck Hagenbuch <chuck@horde.org> - * @since Horde 1.3 - * @since Log 1.0 - * @package Log - * - * @example syslog.php Using the syslog handler. - */ -class Log_syslog extends Log -{ - /** - * Integer holding the log facility to use. - * @var string - * @access private - */ - var $_name = LOG_SYSLOG; - - /** - * Constructs a new syslog object. - * - * @param string $name The syslog facility. - * @param string $ident The identity string. - * @param array $conf The configuration array. - * @param int $level Log messages up to and including this level. - * @access public - */ - function Log_syslog($name, $ident = '', $conf = array(), - $level = PEAR_LOG_DEBUG) - { - /* Ensure we have a valid integer value for $name. */ - if (empty($name) || !is_int($name)) { - $name = LOG_SYSLOG; - } - - $this->_id = md5(microtime()); - $this->_name = $name; - $this->_ident = $ident; - $this->_mask = Log::UPTO($level); - } - - /** - * Opens a connection to the system logger, if it has not already - * been opened. This is implicitly called by log(), if necessary. - * @access public - */ - function open() - { - if (!$this->_opened) { - openlog($this->_ident, LOG_PID, $this->_name); - $this->_opened = true; - } - - return $this->_opened; - } - - /** - * Closes the connection to the system logger, if it is open. - * @access public - */ - function close() - { - if ($this->_opened) { - closelog(); - $this->_opened = false; - } - - return ($this->_opened === false); - } - - /** - * Sends $message to the currently open syslog connection. 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 int $priority (optional) 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); - - if (!syslog($this->_toSyslog($priority), $message)) { - return false; - } - - $this->_announce(array('priority' => $priority, 'message' => $message)); - - return true; - } - - /** - * Converts a PEAR_LOG_* constant into a syslog LOG_* constant. - * - * This function exists because, under Windows, not all of the LOG_* - * constants have unique values. Instead, the PEAR_LOG_* were introduced - * for global use, with the conversion to the LOG_* constants kept local to - * to the syslog driver. - * - * @param int $priority PEAR_LOG_* value to convert to LOG_* value. - * - * @return The LOG_* representation of $priority. - * - * @access private - */ - function _toSyslog($priority) - { - static $priorities = array( - PEAR_LOG_EMERG => LOG_EMERG, - PEAR_LOG_ALERT => LOG_ALERT, - PEAR_LOG_CRIT => LOG_CRIT, - PEAR_LOG_ERR => LOG_ERR, - PEAR_LOG_WARNING => LOG_WARNING, - PEAR_LOG_NOTICE => LOG_NOTICE, - PEAR_LOG_INFO => LOG_INFO, - PEAR_LOG_DEBUG => LOG_DEBUG - ); - - /* If we're passed an unknown priority, default to LOG_INFO. */ - if (!is_int($priority) || !in_array($priority, $priorities)) { - return LOG_INFO; - } - - return $priorities[$priority]; - } -} -?> diff --git a/inc/Log/win.php b/inc/Log/win.php deleted file mode 100644 index e8a09d16e81802975491025257f8a3d63fc7d470..0000000000000000000000000000000000000000 --- a/inc/Log/win.php +++ /dev/null @@ -1,256 +0,0 @@ -<?php -/** - * $Header: /repository/pear/Log/Log/win.php,v 1.16 2004/09/08 23:35:53 jon Exp $ - * - * @version $Revision: 1.16 $ - * @package Log - */ - -/** - * The Log_win class is a concrete implementation of the Log abstract - * class that logs messages to a separate browser window. - * - * The concept for this log handler is based on part by Craig Davis' article - * entitled "JavaScript Power PHP Debugging: - * - * http://www.zend.com/zend/tut/tutorial-DebugLib.php - * - * @author Jon Parise <jon@php.net> - * @since Log 1.7.0 - * @package Log - * - * @example win.php Using the window handler. - */ -class Log_win extends Log -{ - /** - * The name of the output window. - * @var string - * @access private - */ - var $_name = 'LogWindow'; - - /** - * The title of the output window. - * @var string - * @access private - */ - var $_title = 'Log Output Window'; - - /** - * Mapping of log priorities to colors. - * @var array - * @access private - */ - var $_colors = array( - PEAR_LOG_EMERG => 'red', - PEAR_LOG_ALERT => 'orange', - PEAR_LOG_CRIT => 'yellow', - PEAR_LOG_ERR => 'green', - PEAR_LOG_WARNING => 'blue', - PEAR_LOG_NOTICE => 'indigo', - PEAR_LOG_INFO => 'violet', - PEAR_LOG_DEBUG => 'black' - ); - - /** - * String buffer that holds line that are pending output. - * @var array - * @access private - */ - var $_buffer = array(); - - /** - * Constructs a new Log_win object. - * - * @param string $name Ignored. - * @param string $ident The identity string. - * @param array $conf The configuration array. - * @param int $level Log messages up to and including this level. - * @access public - */ - function Log_win($name, $ident = '', $conf = array(), - $level = PEAR_LOG_DEBUG) - { - $this->_id = md5(microtime()); - $this->_name = $name; - $this->_ident = $ident; - $this->_mask = Log::UPTO($level); - - if (isset($conf['title'])) { - $this->_title = $conf['title']; - } - if (isset($conf['colors']) && is_array($conf['colors'])) { - $this->_colors = $conf['colors']; - } - - register_shutdown_function(array(&$this, '_Log_win')); - } - - /** - * Destructor - */ - function _Log_win() - { - if ($this->_opened || (count($this->_buffer) > 0)) { - $this->close(); - } - } - - /** - * The first time open() is called, it will open a new browser window and - * prepare it for output. - * - * This is implicitly called by log(), if necessary. - * - * @access public - */ - function open() - { - if (!$this->_opened) { - $win = $this->_name; - - if (!empty($this->_ident)) { - $identHeader = "$win.document.writeln('<th>Ident</th>')"; - } else { - $identHeader = ''; - } - - echo <<< END_OF_SCRIPT -<script language="JavaScript"> -$win = window.open('', '{$this->_name}', 'toolbar=no,scrollbars,width=600,height=400'); -$win.document.writeln('<html>'); -$win.document.writeln('<head>'); -$win.document.writeln('<title>{$this->_title}</title>'); -$win.document.writeln('<style type="text/css">'); -$win.document.writeln('body { font-family: monospace; font-size: 8pt; }'); -$win.document.writeln('td,th { font-size: 8pt; }'); -$win.document.writeln('td,th { border-bottom: #999999 solid 1px; }'); -$win.document.writeln('td,th { border-right: #999999 solid 1px; }'); -$win.document.writeln('</style>'); -$win.document.writeln('</head>'); -$win.document.writeln('<body>'); -$win.document.writeln('<table border="0" cellpadding="2" cellspacing="0">'); -$win.document.writeln('<tr><th>Time</th>'); -$identHeader -$win.document.writeln('<th>Priority</th><th width="100%">Message</th></tr>'); -</script> -END_OF_SCRIPT; - $this->_opened = true; - } - - return $this->_opened; - } - - /** - * Closes the output stream if it is open. If there are still pending - * lines in the output buffer, the output window will be opened so that - * the buffer can be drained. - * - * @access public - */ - function close() - { - /* - * If there are still lines waiting to be written, open the output - * window so that we can drain the buffer. - */ - if (!$this->_opened && (count($this->_buffer) > 0)) { - $this->open(); - } - - if ($this->_opened) { - $this->_writeln('</table>'); - $this->_writeln('</body></html>'); - $this->_opened = false; - } - - return ($this->_opened === false); - } - - /** - * Writes a single line of text to the output window. - * - * @param string $line The line of text to write. - * - * @access private - */ - function _writeln($line) - { - /* Add this line to our output buffer. */ - $this->_buffer[] = $line; - - /* Buffer the output until this page's headers have been sent. */ - if (!headers_sent()) { - return; - } - - /* If we haven't already opened the output window, do so now. */ - if (!$this->_opened && !$this->open()) { - return false; - } - - /* Drain the buffer to the output window. */ - $win = $this->_name; - foreach ($this->_buffer as $line) { - echo "<script language='JavaScript'>\n"; - echo "$win.document.writeln('" . addslashes($line) . "');\n"; - echo "self.focus();\n"; - echo "</script>\n"; - } - - /* Now that the buffer has been drained, clear it. */ - $this->_buffer = array(); - } - - /** - * Logs $message to the output window. The message is also passed 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; - } - - /* Extract the string representation of the message. */ - $message = $this->_extractMessage($message); - - list($usec, $sec) = explode(' ', microtime()); - - /* Build the output line that contains the log entry row. */ - $line = '<tr align="left" valign="top">'; - $line .= sprintf('<td>%s.%s</td>', - strftime('%T', $sec), substr($usec, 2, 2)); - if (!empty($this->_ident)) { - $line .= '<td>' . $this->_ident . '</td>'; - } - $line .= '<td>' . ucfirst($this->priorityToString($priority)) . '</td>'; - $line .= sprintf('<td style="color: %s">%s</td>', - $this->_colors[$priority], - preg_replace('/\r\n|\n|\r/', '<br />', $message)); - $line .= '</tr>'; - - $this->_writeln($line); - - $this->_announce(array('priority' => $priority, 'message' => $message)); - - return true; - } -} - -?> diff --git a/inc/Mail.php b/inc/Mail.php deleted file mode 100644 index c9f480fd488ee810486bb6582ed0568c65c78a3e..0000000000000000000000000000000000000000 --- a/inc/Mail.php +++ /dev/null @@ -1,212 +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: Chuck Hagenbuch <chuck@horde.org> | -// +----------------------------------------------------------------------+ -// -// $Id: Mail.php,v 1.11 2005/06/26 23:37:18 jon Exp $ - -require_once 'PEAR.php'; - -/** - * PEAR's Mail:: interface. Defines the interface for implementing - * mailers under the PEAR hierarchy, and provides supporting functions - * useful in multiple mailer backends. - * - * @access public - * @version $Revision: 1.11 $ - * @package Mail - */ -class Mail -{ - /** - * Line terminator used for separating header lines. - * @var string - */ - var $sep = "\r\n"; - - /** - * Provides an interface for generating Mail:: objects of various - * types - * - * @param string $driver The kind of Mail:: object to instantiate. - * @param array $params The parameters to pass to the Mail:: object. - * @return object Mail a instance of the driver class or if fails a PEAR Error - * @access public - */ - function &factory($driver, $params = array()) - { - $driver = strtolower($driver); - @include_once 'Mail/' . $driver . '.php'; - $class = 'Mail_' . $driver; - if (class_exists($class)) { - $mailer = &new $class($params); - } else { - $mailer = PEAR::raiseError('Unable to find class for driver ' . $driver); - } - - return $mailer; - } - - /** - * Implements Mail::send() function using php's built-in mail() - * command. - * - * @param mixed $recipients Either a comma-seperated list of recipients - * (RFC822 compliant), or an array of recipients, - * each RFC822 valid. This may contain recipients not - * specified in the headers, for Bcc:, resending - * messages, etc. - * - * @param array $headers The array of headers to send with the mail, in an - * associative array, where the array key is the - * header name (ie, 'Subject'), and the array value - * is the header value (ie, 'test'). The header - * produced from those values would be 'Subject: - * test'. - * - * @param string $body The full text of the message body, including any - * Mime parts, etc. - * - * @return mixed Returns true on success, or a PEAR_Error - * containing a descriptive error message on - * failure. - * @access public - * @deprecated use Mail_mail::send instead - */ - function send($recipients, $headers, $body) - { - // if we're passed an array of recipients, implode it. - if (is_array($recipients)) { - $recipients = implode(', ', $recipients); - } - - // get the Subject out of the headers array so that we can - // pass it as a seperate argument to mail(). - $subject = ''; - if (isset($headers['Subject'])) { - $subject = $headers['Subject']; - unset($headers['Subject']); - } - - // flatten the headers out. - list(,$text_headers) = Mail::prepareHeaders($headers); - - return mail($recipients, $subject, $body, $text_headers); - - } - - /** - * Take an array of mail headers and return a string containing - * text usable in sending a message. - * - * @param array $headers The array of headers to prepare, in an associative - * array, where the array key is the header name (ie, - * 'Subject'), and the array value is the header - * value (ie, 'test'). The header produced from those - * values would be 'Subject: test'. - * - * @return mixed Returns false if it encounters a bad address, - * otherwise returns an array containing two - * elements: Any From: address found in the headers, - * and the plain text version of the headers. - * @access private - */ - function prepareHeaders($headers) - { - $lines = array(); - $from = null; - - foreach ($headers as $key => $value) { - if (strcasecmp($key, 'From') === 0) { - include_once 'Mail/RFC822.php'; - $parser = &new Mail_RFC822(); - $addresses = $parser->parseAddressList($value, 'localhost', false); - if (PEAR::isError($addresses)) { - return $addresses; - } - - $from = $addresses[0]->mailbox . '@' . $addresses[0]->host; - - // Reject envelope From: addresses with spaces. - if (strstr($from, ' ')) { - return false; - } - - $lines[] = $key . ': ' . $value; - } elseif (strcasecmp($key, 'Received') === 0) { - $received = array(); - if (is_array($value)) { - foreach ($value as $line) { - $received[] = $key . ': ' . $line; - } - } - else { - $received[] = $key . ': ' . $value; - } - // Put Received: headers at the top. Spam detectors often - // flag messages with Received: headers after the Subject: - // as spam. - $lines = array_merge($received, $lines); - } else { - // If $value is an array (i.e., a list of addresses), convert - // it to a comma-delimited string of its elements (addresses). - if (is_array($value)) { - $value = implode(', ', $value); - } - $lines[] = $key . ': ' . $value; - } - } - - return array($from, join($this->sep, $lines) . $this->sep); - } - - /** - * Take a set of recipients and parse them, returning an array of - * bare addresses (forward paths) that can be passed to sendmail - * or an smtp server with the rcpt to: command. - * - * @param mixed Either a comma-seperated list of recipients - * (RFC822 compliant), or an array of recipients, - * each RFC822 valid. - * - * @return array An array of forward paths (bare addresses). - * @access private - */ - function parseRecipients($recipients) - { - include_once 'Mail/RFC822.php'; - - // if we're passed an array, assume addresses are valid and - // implode them before parsing. - if (is_array($recipients)) { - $recipients = implode(', ', $recipients); - } - - // Parse recipients, leaving out all personal info. This is - // for smtp recipients, etc. All relevant personal information - // should already be in the headers. - $addresses = Mail_RFC822::parseAddressList($recipients, 'localhost', false); - $recipients = array(); - if (is_array($addresses)) { - foreach ($addresses as $ob) { - $recipients[] = $ob->mailbox . '@' . $ob->host; - } - } - - return $recipients; - } - -} diff --git a/inc/Mail/RFC822.php b/inc/Mail/RFC822.php deleted file mode 100644 index 47e84f83b26d9ddb43478619371c1c182c24cf15..0000000000000000000000000000000000000000 --- a/inc/Mail/RFC822.php +++ /dev/null @@ -1,923 +0,0 @@ -<?php -// +-----------------------------------------------------------------------+ -// | Copyright (c) 2001-2002, Richard Heyes | -// | All rights reserved. | -// | | -// | Redistribution and use in source and binary forms, with or without | -// | modification, are permitted provided that the following conditions | -// | are met: | -// | | -// | o Redistributions of source code must retain the above copyright | -// | notice, this list of conditions and the following disclaimer. | -// | o Redistributions in binary form must reproduce the above copyright | -// | notice, this list of conditions and the following disclaimer in the | -// | documentation and/or other materials provided with the distribution.| -// | o The names of the authors may not be used to endorse or promote | -// | products derived from this software without specific prior written | -// | permission. | -// | | -// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | -// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | -// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | -// | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | -// | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | -// | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | -// | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | -// | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | -// | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | -// | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | -// | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | -// | | -// +-----------------------------------------------------------------------+ -// | Authors: Richard Heyes <richard@phpguru.org> | -// | Chuck Hagenbuch <chuck@horde.org> | -// +-----------------------------------------------------------------------+ - -/** - * RFC 822 Email address list validation Utility - * - * What is it? - * - * This class will take an address string, and parse it into it's consituent - * parts, be that either addresses, groups, or combinations. Nested groups - * are not supported. The structure it returns is pretty straight forward, - * and is similar to that provided by the imap_rfc822_parse_adrlist(). Use - * print_r() to view the structure. - * - * How do I use it? - * - * $address_string = 'My Group: "Richard" <richard@localhost> (A comment), ted@example.com (Ted Bloggs), Barney;'; - * $structure = Mail_RFC822::parseAddressList($address_string, 'example.com', true) - * print_r($structure); - * - * @author Richard Heyes <richard@phpguru.org> - * @author Chuck Hagenbuch <chuck@horde.org> - * @version $Revision: 1.21 $ - * @license BSD - * @package Mail - */ -class Mail_RFC822 { - - /** - * The address being parsed by the RFC822 object. - * @var string $address - */ - var $address = ''; - - /** - * The default domain to use for unqualified addresses. - * @var string $default_domain - */ - var $default_domain = 'localhost'; - - /** - * Should we return a nested array showing groups, or flatten everything? - * @var boolean $nestGroups - */ - var $nestGroups = true; - - /** - * Whether or not to validate atoms for non-ascii characters. - * @var boolean $validate - */ - var $validate = true; - - /** - * The array of raw addresses built up as we parse. - * @var array $addresses - */ - var $addresses = array(); - - /** - * The final array of parsed address information that we build up. - * @var array $structure - */ - var $structure = array(); - - /** - * The current error message, if any. - * @var string $error - */ - var $error = null; - - /** - * An internal counter/pointer. - * @var integer $index - */ - var $index = null; - - /** - * The number of groups that have been found in the address list. - * @var integer $num_groups - * @access public - */ - var $num_groups = 0; - - /** - * A variable so that we can tell whether or not we're inside a - * Mail_RFC822 object. - * @var boolean $mailRFC822 - */ - var $mailRFC822 = true; - - /** - * A limit after which processing stops - * @var int $limit - */ - var $limit = null; - - /** - * Sets up the object. The address must either be set here or when - * calling parseAddressList(). One or the other. - * - * @access public - * @param string $address The address(es) to validate. - * @param string $default_domain Default domain/host etc. If not supplied, will be set to localhost. - * @param boolean $nest_groups Whether to return the structure with groups nested for easier viewing. - * @param boolean $validate Whether to validate atoms. Turn this off if you need to run addresses through before encoding the personal names, for instance. - * - * @return object Mail_RFC822 A new Mail_RFC822 object. - */ - function Mail_RFC822($address = null, $default_domain = null, $nest_groups = null, $validate = null, $limit = null) - { - if (isset($address)) $this->address = $address; - if (isset($default_domain)) $this->default_domain = $default_domain; - if (isset($nest_groups)) $this->nestGroups = $nest_groups; - if (isset($validate)) $this->validate = $validate; - if (isset($limit)) $this->limit = $limit; - } - - /** - * Starts the whole process. The address must either be set here - * or when creating the object. One or the other. - * - * @access public - * @param string $address The address(es) to validate. - * @param string $default_domain Default domain/host etc. - * @param boolean $nest_groups Whether to return the structure with groups nested for easier viewing. - * @param boolean $validate Whether to validate atoms. Turn this off if you need to run addresses through before encoding the personal names, for instance. - * - * @return array A structured array of addresses. - */ - function parseAddressList($address = null, $default_domain = null, $nest_groups = null, $validate = null, $limit = null) - { - if (!isset($this) || !isset($this->mailRFC822)) { - $obj = new Mail_RFC822($address, $default_domain, $nest_groups, $validate, $limit); - return $obj->parseAddressList(); - } - - if (isset($address)) $this->address = $address; - if (isset($default_domain)) $this->default_domain = $default_domain; - if (isset($nest_groups)) $this->nestGroups = $nest_groups; - if (isset($validate)) $this->validate = $validate; - if (isset($limit)) $this->limit = $limit; - - $this->structure = array(); - $this->addresses = array(); - $this->error = null; - $this->index = null; - - // Unfold any long lines in $this->address. - $this->address = preg_replace('/\r?\n/', "\r\n", $this->address); - $this->address = preg_replace('/\r\n(\t| )+/', ' ', $this->address); - - while ($this->address = $this->_splitAddresses($this->address)); - - if ($this->address === false || isset($this->error)) { - require_once 'PEAR.php'; - return PEAR::raiseError($this->error); - } - - // Validate each address individually. If we encounter an invalid - // address, stop iterating and return an error immediately. - foreach ($this->addresses as $address) { - $valid = $this->_validateAddress($address); - - if ($valid === false || isset($this->error)) { - require_once 'PEAR.php'; - return PEAR::raiseError($this->error); - } - - if (!$this->nestGroups) { - $this->structure = array_merge($this->structure, $valid); - } else { - $this->structure[] = $valid; - } - } - - return $this->structure; - } - - /** - * Splits an address into separate addresses. - * - * @access private - * @param string $address The addresses to split. - * @return boolean Success or failure. - */ - function _splitAddresses($address) - { - if (!empty($this->limit) && count($this->addresses) == $this->limit) { - return ''; - } - - if ($this->_isGroup($address) && !isset($this->error)) { - $split_char = ';'; - $is_group = true; - } elseif (!isset($this->error)) { - $split_char = ','; - $is_group = false; - } elseif (isset($this->error)) { - return false; - } - - // Split the string based on the above ten or so lines. - $parts = explode($split_char, $address); - $string = $this->_splitCheck($parts, $split_char); - - // If a group... - if ($is_group) { - // If $string does not contain a colon outside of - // brackets/quotes etc then something's fubar. - - // First check there's a colon at all: - if (strpos($string, ':') === false) { - $this->error = 'Invalid address: ' . $string; - return false; - } - - // Now check it's outside of brackets/quotes: - if (!$this->_splitCheck(explode(':', $string), ':')) { - return false; - } - - // We must have a group at this point, so increase the counter: - $this->num_groups++; - } - - // $string now contains the first full address/group. - // Add to the addresses array. - $this->addresses[] = array( - 'address' => trim($string), - 'group' => $is_group - ); - - // Remove the now stored address from the initial line, the +1 - // is to account for the explode character. - $address = trim(substr($address, strlen($string) + 1)); - - // If the next char is a comma and this was a group, then - // there are more addresses, otherwise, if there are any more - // chars, then there is another address. - if ($is_group && substr($address, 0, 1) == ','){ - $address = trim(substr($address, 1)); - return $address; - - } elseif (strlen($address) > 0) { - return $address; - - } else { - return ''; - } - - // If you got here then something's off - return false; - } - - /** - * Checks for a group at the start of the string. - * - * @access private - * @param string $address The address to check. - * @return boolean Whether or not there is a group at the start of the string. - */ - function _isGroup($address) - { - // First comma not in quotes, angles or escaped: - $parts = explode(',', $address); - $string = $this->_splitCheck($parts, ','); - - // Now we have the first address, we can reliably check for a - // group by searching for a colon that's not escaped or in - // quotes or angle brackets. - if (count($parts = explode(':', $string)) > 1) { - $string2 = $this->_splitCheck($parts, ':'); - return ($string2 !== $string); - } else { - return false; - } - } - - /** - * A common function that will check an exploded string. - * - * @access private - * @param array $parts The exloded string. - * @param string $char The char that was exploded on. - * @return mixed False if the string contains unclosed quotes/brackets, or the string on success. - */ - function _splitCheck($parts, $char) - { - $string = $parts[0]; - - for ($i = 0; $i < count($parts); $i++) { - if ($this->_hasUnclosedQuotes($string) - || $this->_hasUnclosedBrackets($string, '<>') - || $this->_hasUnclosedBrackets($string, '[]') - || $this->_hasUnclosedBrackets($string, '()') - || substr($string, -1) == '\\') { - if (isset($parts[$i + 1])) { - $string = $string . $char . $parts[$i + 1]; - } else { - $this->error = 'Invalid address spec. Unclosed bracket or quotes'; - return false; - } - } else { - $this->index = $i; - break; - } - } - - return $string; - } - - /** - * Checks if a string has an unclosed quotes or not. - * - * @access private - * @param string $string The string to check. - * @return boolean True if there are unclosed quotes inside the string, false otherwise. - */ - function _hasUnclosedQuotes($string) - { - $string = explode('"', $string); - $string_cnt = count($string); - - for ($i = 0; $i < (count($string) - 1); $i++) - if (substr($string[$i], -1) == '\\') - $string_cnt--; - - return ($string_cnt % 2 === 0); - } - - /** - * Checks if a string has an unclosed brackets or not. IMPORTANT: - * This function handles both angle brackets and square brackets; - * - * @access private - * @param string $string The string to check. - * @param string $chars The characters to check for. - * @return boolean True if there are unclosed brackets inside the string, false otherwise. - */ - function _hasUnclosedBrackets($string, $chars) - { - $num_angle_start = substr_count($string, $chars[0]); - $num_angle_end = substr_count($string, $chars[1]); - - $this->_hasUnclosedBracketsSub($string, $num_angle_start, $chars[0]); - $this->_hasUnclosedBracketsSub($string, $num_angle_end, $chars[1]); - - if ($num_angle_start < $num_angle_end) { - $this->error = 'Invalid address spec. Unmatched quote or bracket (' . $chars . ')'; - return false; - } else { - return ($num_angle_start > $num_angle_end); - } - } - - /** - * Sub function that is used only by hasUnclosedBrackets(). - * - * @access private - * @param string $string The string to check. - * @param integer &$num The number of occurences. - * @param string $char The character to count. - * @return integer The number of occurences of $char in $string, adjusted for backslashes. - */ - function _hasUnclosedBracketsSub($string, &$num, $char) - { - $parts = explode($char, $string); - for ($i = 0; $i < count($parts); $i++){ - if (substr($parts[$i], -1) == '\\' || $this->_hasUnclosedQuotes($parts[$i])) - $num--; - if (isset($parts[$i + 1])) - $parts[$i + 1] = $parts[$i] . $char . $parts[$i + 1]; - } - - return $num; - } - - /** - * Function to begin checking the address. - * - * @access private - * @param string $address The address to validate. - * @return mixed False on failure, or a structured array of address information on success. - */ - function _validateAddress($address) - { - $is_group = false; - $addresses = array(); - - if ($address['group']) { - $is_group = true; - - // Get the group part of the name - $parts = explode(':', $address['address']); - $groupname = $this->_splitCheck($parts, ':'); - $structure = array(); - - // And validate the group part of the name. - if (!$this->_validatePhrase($groupname)){ - $this->error = 'Group name did not validate.'; - return false; - } else { - // Don't include groups if we are not nesting - // them. This avoids returning invalid addresses. - if ($this->nestGroups) { - $structure = new stdClass; - $structure->groupname = $groupname; - } - } - - $address['address'] = ltrim(substr($address['address'], strlen($groupname . ':'))); - } - - // If a group then split on comma and put into an array. - // Otherwise, Just put the whole address in an array. - if ($is_group) { - while (strlen($address['address']) > 0) { - $parts = explode(',', $address['address']); - $addresses[] = $this->_splitCheck($parts, ','); - $address['address'] = trim(substr($address['address'], strlen(end($addresses) . ','))); - } - } else { - $addresses[] = $address['address']; - } - - // Check that $addresses is set, if address like this: - // Groupname:; - // Then errors were appearing. - if (!count($addresses)){ - $this->error = 'Empty group.'; - return false; - } - - // Trim the whitespace from all of the address strings. - array_map('trim', $addresses); - - // Validate each mailbox. - // Format could be one of: name <geezer@domain.com> - // geezer@domain.com - // geezer - // ... or any other format valid by RFC 822. - for ($i = 0; $i < count($addresses); $i++) { - if (!$this->validateMailbox($addresses[$i])) { - if (empty($this->error)) { - $this->error = 'Validation failed for: ' . $addresses[$i]; - } - return false; - } - } - - // Nested format - if ($this->nestGroups) { - if ($is_group) { - $structure->addresses = $addresses; - } else { - $structure = $addresses[0]; - } - - // Flat format - } else { - if ($is_group) { - $structure = array_merge($structure, $addresses); - } else { - $structure = $addresses; - } - } - - return $structure; - } - - /** - * Function to validate a phrase. - * - * @access private - * @param string $phrase The phrase to check. - * @return boolean Success or failure. - */ - function _validatePhrase($phrase) - { - // Splits on one or more Tab or space. - $parts = preg_split('/[ \\x09]+/', $phrase, -1, PREG_SPLIT_NO_EMPTY); - - $phrase_parts = array(); - while (count($parts) > 0){ - $phrase_parts[] = $this->_splitCheck($parts, ' '); - for ($i = 0; $i < $this->index + 1; $i++) - array_shift($parts); - } - - foreach ($phrase_parts as $part) { - // If quoted string: - if (substr($part, 0, 1) == '"') { - if (!$this->_validateQuotedString($part)) { - return false; - } - continue; - } - - // Otherwise it's an atom: - if (!$this->_validateAtom($part)) return false; - } - - return true; - } - - /** - * Function to validate an atom which from rfc822 is: - * atom = 1*<any CHAR except specials, SPACE and CTLs> - * - * If validation ($this->validate) has been turned off, then - * validateAtom() doesn't actually check anything. This is so that you - * can split a list of addresses up before encoding personal names - * (umlauts, etc.), for example. - * - * @access private - * @param string $atom The string to check. - * @return boolean Success or failure. - */ - function _validateAtom($atom) - { - if (!$this->validate) { - // Validation has been turned off; assume the atom is okay. - return true; - } - - // Check for any char from ASCII 0 - ASCII 127 - if (!preg_match('/^[\\x00-\\x7E]+$/i', $atom, $matches)) { - return false; - } - - // Check for specials: - if (preg_match('/[][()<>@,;\\:". ]/', $atom)) { - return false; - } - - // Check for control characters (ASCII 0-31): - if (preg_match('/[\\x00-\\x1F]+/', $atom)) { - return false; - } - - return true; - } - - /** - * Function to validate quoted string, which is: - * quoted-string = <"> *(qtext/quoted-pair) <"> - * - * @access private - * @param string $qstring The string to check - * @return boolean Success or failure. - */ - function _validateQuotedString($qstring) - { - // Leading and trailing " - $qstring = substr($qstring, 1, -1); - - // Perform check, removing quoted characters first. - return !preg_match('/[\x0D\\\\"]/', preg_replace('/\\\\./', '', $qstring)); - } - - /** - * Function to validate a mailbox, which is: - * mailbox = addr-spec ; simple address - * / phrase route-addr ; name and route-addr - * - * @access public - * @param string &$mailbox The string to check. - * @return boolean Success or failure. - */ - function validateMailbox(&$mailbox) - { - // A couple of defaults. - $phrase = ''; - $comment = ''; - $comments = array(); - - // Catch any RFC822 comments and store them separately. - $_mailbox = $mailbox; - while (strlen(trim($_mailbox)) > 0) { - $parts = explode('(', $_mailbox); - $before_comment = $this->_splitCheck($parts, '('); - if ($before_comment != $_mailbox) { - // First char should be a (. - $comment = substr(str_replace($before_comment, '', $_mailbox), 1); - $parts = explode(')', $comment); - $comment = $this->_splitCheck($parts, ')'); - $comments[] = $comment; - - // +1 is for the trailing ) - $_mailbox = substr($_mailbox, strpos($_mailbox, $comment)+strlen($comment)+1); - } else { - break; - } - } - - foreach ($comments as $comment) { - $mailbox = str_replace("($comment)", '', $mailbox); - } - - $mailbox = trim($mailbox); - - // Check for name + route-addr - if (substr($mailbox, -1) == '>' && substr($mailbox, 0, 1) != '<') { - $parts = explode('<', $mailbox); - $name = $this->_splitCheck($parts, '<'); - - $phrase = trim($name); - $route_addr = trim(substr($mailbox, strlen($name.'<'), -1)); - - if ($this->_validatePhrase($phrase) === false || ($route_addr = $this->_validateRouteAddr($route_addr)) === false) { - return false; - } - - // Only got addr-spec - } else { - // First snip angle brackets if present. - if (substr($mailbox, 0, 1) == '<' && substr($mailbox, -1) == '>') { - $addr_spec = substr($mailbox, 1, -1); - } else { - $addr_spec = $mailbox; - } - - if (($addr_spec = $this->_validateAddrSpec($addr_spec)) === false) { - return false; - } - } - - // Construct the object that will be returned. - $mbox = new stdClass(); - - // Add the phrase (even if empty) and comments - $mbox->personal = $phrase; - $mbox->comment = isset($comments) ? $comments : array(); - - if (isset($route_addr)) { - $mbox->mailbox = $route_addr['local_part']; - $mbox->host = $route_addr['domain']; - $route_addr['adl'] !== '' ? $mbox->adl = $route_addr['adl'] : ''; - } else { - $mbox->mailbox = $addr_spec['local_part']; - $mbox->host = $addr_spec['domain']; - } - - $mailbox = $mbox; - return true; - } - - /** - * This function validates a route-addr which is: - * route-addr = "<" [route] addr-spec ">" - * - * Angle brackets have already been removed at the point of - * getting to this function. - * - * @access private - * @param string $route_addr The string to check. - * @return mixed False on failure, or an array containing validated address/route information on success. - */ - function _validateRouteAddr($route_addr) - { - // Check for colon. - if (strpos($route_addr, ':') !== false) { - $parts = explode(':', $route_addr); - $route = $this->_splitCheck($parts, ':'); - } else { - $route = $route_addr; - } - - // If $route is same as $route_addr then the colon was in - // quotes or brackets or, of course, non existent. - if ($route === $route_addr){ - unset($route); - $addr_spec = $route_addr; - if (($addr_spec = $this->_validateAddrSpec($addr_spec)) === false) { - return false; - } - } else { - // Validate route part. - if (($route = $this->_validateRoute($route)) === false) { - return false; - } - - $addr_spec = substr($route_addr, strlen($route . ':')); - - // Validate addr-spec part. - if (($addr_spec = $this->_validateAddrSpec($addr_spec)) === false) { - return false; - } - } - - if (isset($route)) { - $return['adl'] = $route; - } else { - $return['adl'] = ''; - } - - $return = array_merge($return, $addr_spec); - return $return; - } - - /** - * Function to validate a route, which is: - * route = 1#("@" domain) ":" - * - * @access private - * @param string $route The string to check. - * @return mixed False on failure, or the validated $route on success. - */ - function _validateRoute($route) - { - // Split on comma. - $domains = explode(',', trim($route)); - - foreach ($domains as $domain) { - $domain = str_replace('@', '', trim($domain)); - if (!$this->_validateDomain($domain)) return false; - } - - return $route; - } - - /** - * Function to validate a domain, though this is not quite what - * you expect of a strict internet domain. - * - * domain = sub-domain *("." sub-domain) - * - * @access private - * @param string $domain The string to check. - * @return mixed False on failure, or the validated domain on success. - */ - function _validateDomain($domain) - { - // Note the different use of $subdomains and $sub_domains - $subdomains = explode('.', $domain); - - while (count($subdomains) > 0) { - $sub_domains[] = $this->_splitCheck($subdomains, '.'); - for ($i = 0; $i < $this->index + 1; $i++) - array_shift($subdomains); - } - - foreach ($sub_domains as $sub_domain) { - if (!$this->_validateSubdomain(trim($sub_domain))) - return false; - } - - // Managed to get here, so return input. - return $domain; - } - - /** - * Function to validate a subdomain: - * subdomain = domain-ref / domain-literal - * - * @access private - * @param string $subdomain The string to check. - * @return boolean Success or failure. - */ - function _validateSubdomain($subdomain) - { - if (preg_match('|^\[(.*)]$|', $subdomain, $arr)){ - if (!$this->_validateDliteral($arr[1])) return false; - } else { - if (!$this->_validateAtom($subdomain)) return false; - } - - // Got here, so return successful. - return true; - } - - /** - * Function to validate a domain literal: - * domain-literal = "[" *(dtext / quoted-pair) "]" - * - * @access private - * @param string $dliteral The string to check. - * @return boolean Success or failure. - */ - function _validateDliteral($dliteral) - { - return !preg_match('/(.)[][\x0D\\\\]/', $dliteral, $matches) && $matches[1] != '\\'; - } - - /** - * Function to validate an addr-spec. - * - * addr-spec = local-part "@" domain - * - * @access private - * @param string $addr_spec The string to check. - * @return mixed False on failure, or the validated addr-spec on success. - */ - function _validateAddrSpec($addr_spec) - { - $addr_spec = trim($addr_spec); - - // Split on @ sign if there is one. - if (strpos($addr_spec, '@') !== false) { - $parts = explode('@', $addr_spec); - $local_part = $this->_splitCheck($parts, '@'); - $domain = substr($addr_spec, strlen($local_part . '@')); - - // No @ sign so assume the default domain. - } else { - $local_part = $addr_spec; - $domain = $this->default_domain; - } - - if (($local_part = $this->_validateLocalPart($local_part)) === false) return false; - if (($domain = $this->_validateDomain($domain)) === false) return false; - - // Got here so return successful. - return array('local_part' => $local_part, 'domain' => $domain); - } - - /** - * Function to validate the local part of an address: - * local-part = word *("." word) - * - * @access private - * @param string $local_part - * @return mixed False on failure, or the validated local part on success. - */ - function _validateLocalPart($local_part) - { - $parts = explode('.', $local_part); - $words = array(); - - // Split the local_part into words. - while (count($parts) > 0){ - $words[] = $this->_splitCheck($parts, '.'); - for ($i = 0; $i < $this->index + 1; $i++) { - array_shift($parts); - } - } - - // Validate each word. - foreach ($words as $word) { - // If this word contains an unquoted space, it is invalid. (6.2.4) - if (strpos($word, ' ') && $word[0] !== '"') - { - return false; - } - - if ($this->_validatePhrase(trim($word)) === false) return false; - } - - // Managed to get here, so return the input. - return $local_part; - } - - /** - * Returns an approximate count of how many addresses are in the - * given string. This is APPROXIMATE as it only splits based on a - * comma which has no preceding backslash. Could be useful as - * large amounts of addresses will end up producing *large* - * structures when used with parseAddressList(). - * - * @param string $data Addresses to count - * @return int Approximate count - */ - function approximateCount($data) - { - return count(preg_split('/(?<!\\\\),/', $data)); - } - - /** - * This is a email validating function separate to the rest of the - * class. It simply validates whether an email is of the common - * internet form: <user>@<domain>. This can be sufficient for most - * people. Optional stricter mode can be utilised which restricts - * mailbox characters allowed to alphanumeric, full stop, hyphen - * and underscore. - * - * @param string $data Address to check - * @param boolean $strict Optional stricter mode - * @return mixed False if it fails, an indexed array - * username/domain if it matches - */ - function isValidInetAddress($data, $strict = false) - { - $regex = $strict ? '/^([.0-9a-z_-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,4})$/i' : '/^([*+!.&#$|\'\\%\/0-9a-z^_`{}=?~:-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,4})$/i'; - if (preg_match($regex, trim($data), $matches)) { - return array($matches[1], $matches[2]); - } else { - return false; - } - } - -} diff --git a/inc/Mail/mail.php b/inc/Mail/mail.php deleted file mode 100644 index 9135fa2363b37be22e929eef49fb496c21f2bd46..0000000000000000000000000000000000000000 --- a/inc/Mail/mail.php +++ /dev/null @@ -1,130 +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: Chuck Hagenbuch <chuck@horde.org> | -// +----------------------------------------------------------------------+ -// -// $Id: mail.php,v 1.13 2004/09/09 02:08:55 jon Exp $ - -/** - * internal PHP-mail() implementation of the PEAR Mail:: interface. - * @package Mail - * @version $Revision: 1.13 $ - */ -class Mail_mail extends Mail { - - /** - * Any arguments to pass to the mail() function. - * @var string - */ - var $_params = ''; - - /** - * Constructor. - * - * Instantiates a new Mail_mail:: object based on the parameters - * passed in. - * - * @param array $params Extra arguments for the mail() function. - */ - function Mail_mail($params = null) - { - /* The other mail implementations accept parameters as arrays. - * In the interest of being consistent, explode an array into - * a string of parameter arguments. */ - if (is_array($params)) { - $this->_params = join(' ', $params); - } else { - $this->_params = $params; - } - - /* Because the mail() function may pass headers as command - * line arguments, we can't guarantee the use of the standard - * "\r\n" separator. Instead, we use the system's native line - * separator. */ - $this->sep = (strstr(PHP_OS, 'WIN')) ? "\r\n" : "\n"; - } - - /** - * Implements Mail_mail::send() function using php's built-in mail() - * command. - * - * @param mixed $recipients Either a comma-seperated list of recipients - * (RFC822 compliant), or an array of recipients, - * each RFC822 valid. This may contain recipients not - * specified in the headers, for Bcc:, resending - * messages, etc. - * - * @param array $headers The array of headers to send with the mail, in an - * associative array, where the array key is the - * header name (ie, 'Subject'), and the array value - * is the header value (ie, 'test'). The header - * produced from those values would be 'Subject: - * test'. - * - * @param string $body The full text of the message body, including any - * Mime parts, etc. - * - * @return mixed Returns true on success, or a PEAR_Error - * containing a descriptive error message on - * failure. - * - * @access public - */ - function send($recipients, $headers, $body) - { - // If we're passed an array of recipients, implode it. - if (is_array($recipients)) { - $recipients = implode(', ', $recipients); - } - - // Get the Subject out of the headers array so that we can - // pass it as a seperate argument to mail(). - $subject = ''; - if (isset($headers['Subject'])) { - $subject = $headers['Subject']; - unset($headers['Subject']); - } - - // Flatten the headers out. - $headerElements = $this->prepareHeaders($headers); - if (PEAR::isError($headerElements)) { - return $headerElements; - } - list(, $text_headers) = $headerElements; - - /* - * We only use mail()'s optional fifth parameter if the additional - * parameters have been provided and we're not running in safe mode. - */ - if (empty($this->_params) || ini_get('safe_mode')) { - $result = mail($recipients, $subject, $body, $text_headers); - } else { - $result = mail($recipients, $subject, $body, $text_headers, - $this->_params); - } - - /* - * If the mail() function returned failure, we need to create a - * PEAR_Error object and return it instead of the boolean result. - */ - if ($result === false) { - $result = PEAR::raiseError('mail() returned failure'); - } - - return $result; - } - -} diff --git a/inc/Mail/mime.php b/inc/Mail/mime.php deleted file mode 100644 index 302a2120d78c0caa3fc13ee6748a02abc538cded..0000000000000000000000000000000000000000 --- a/inc/Mail/mime.php +++ /dev/null @@ -1,713 +0,0 @@ -<?php -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ -// +-----------------------------------------------------------------------+ -// | Copyright (c) 2002-2003 Richard Heyes | -// | Copyright (c) 2003-2005 The PHP Group | -// | All rights reserved. | -// | | -// | Redistribution and use in source and binary forms, with or without | -// | modification, are permitted provided that the following conditions | -// | are met: | -// | | -// | o Redistributions of source code must retain the above copyright | -// | notice, this list of conditions and the following disclaimer. | -// | o Redistributions in binary form must reproduce the above copyright | -// | notice, this list of conditions and the following disclaimer in the | -// | documentation and/or other materials provided with the distribution.| -// | o The names of the authors may not be used to endorse or promote | -// | products derived from this software without specific prior written | -// | permission. | -// | | -// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | -// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | -// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | -// | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | -// | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | -// | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | -// | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | -// | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | -// | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | -// | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | -// | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | -// | | -// +-----------------------------------------------------------------------+ -// | Author: Richard Heyes <richard@phpguru.org> | -// | Tomas V.V.Cox <cox@idecnet.com> (port to PEAR) | -// +-----------------------------------------------------------------------+ -// -// $Id: mime.php,v 1.39 2005/06/13 21:24:16 cipri Exp $ - -require_once('PEAR.php'); -require_once('Mail/mimePart.php'); - -/** - * Mime mail composer class. Can handle: text and html bodies, embedded html - * images and attachments. - * Documentation and examples of this class are avaible here: - * http://pear.php.net/manual/ - * - * @notes This class is based on HTML Mime Mail class from - * Richard Heyes <richard@phpguru.org> which was based also - * in the mime_mail.class by Tobias Ratschiller <tobias@dnet.it> and - * Sascha Schumann <sascha@schumann.cx> - * - * @author Richard Heyes <richard.heyes@heyes-computing.net> - * @author Tomas V.V.Cox <cox@idecnet.com> - * @package Mail - * @access public - */ -class Mail_mime -{ - /** - * Contains the plain text part of the email - * @var string - */ - var $_txtbody; - /** - * Contains the html part of the email - * @var string - */ - var $_htmlbody; - /** - * contains the mime encoded text - * @var string - */ - var $_mime; - /** - * contains the multipart content - * @var string - */ - var $_multipart; - /** - * list of the attached images - * @var array - */ - var $_html_images = array(); - /** - * list of the attachements - * @var array - */ - var $_parts = array(); - /** - * Build parameters - * @var array - */ - var $_build_params = array(); - /** - * Headers for the mail - * @var array - */ - var $_headers = array(); - /** - * End Of Line sequence (for serialize) - * @var string - */ - var $_eol; - - - /** - * Constructor function - * - * @access public - */ - function Mail_mime($crlf = "\r\n") - { - $this->_setEOL($crlf); - $this->_build_params = array( - 'text_encoding' => '7bit', - 'html_encoding' => 'quoted-printable', - '7bit_wrap' => 998, - 'html_charset' => 'ISO-8859-1', - 'text_charset' => 'ISO-8859-1', - 'head_charset' => 'ISO-8859-1' - ); - } - - /** - * Wakeup (unserialize) - re-sets EOL constant - * - * @access private - */ - function __wakeup() - { - $this->_setEOL($this->_eol); - } - - /** - * Accessor function to set the body text. Body text is used if - * it's not an html mail being sent or else is used to fill the - * text/plain part that emails clients who don't support - * html should show. - * - * @param string $data Either a string or - * the file name with the contents - * @param bool $isfile If true the first param should be treated - * as a file name, else as a string (default) - * @param bool $append If true the text or file is appended to - * the existing body, else the old body is - * overwritten - * @return mixed true on success or PEAR_Error object - * @access public - */ - function setTXTBody($data, $isfile = false, $append = false) - { - if (!$isfile) { - if (!$append) { - $this->_txtbody = $data; - } else { - $this->_txtbody .= $data; - } - } else { - $cont = $this->_file2str($data); - if (PEAR::isError($cont)) { - return $cont; - } - if (!$append) { - $this->_txtbody = $cont; - } else { - $this->_txtbody .= $cont; - } - } - return true; - } - - /** - * Adds a html part to the mail - * - * @param string $data Either a string or the file name with the - * contents - * @param bool $isfile If true the first param should be treated - * as a file name, else as a string (default) - * @return mixed true on success or PEAR_Error object - * @access public - */ - function setHTMLBody($data, $isfile = false) - { - if (!$isfile) { - $this->_htmlbody = $data; - } else { - $cont = $this->_file2str($data); - if (PEAR::isError($cont)) { - return $cont; - } - $this->_htmlbody = $cont; - } - - return true; - } - - /** - * Adds an image to the list of embedded images. - * - * @param string $file The image file name OR image data itself - * @param string $c_type The content type - * @param string $name The filename of the image. - * Only use if $file is the image data - * @param bool $isfilename Whether $file is a filename or not - * Defaults to true - * @return mixed true on success or PEAR_Error object - * @access public - */ - function addHTMLImage($file, $c_type='application/octet-stream', - $name = '', $isfilename = true) - { - $filedata = ($isfilename === true) ? $this->_file2str($file) - : $file; - if ($isfilename === true) { - $filename = ($name == '' ? basename($file) : basename($name)); - } else { - $filename = basename($name); - } - if (PEAR::isError($filedata)) { - return $filedata; - } - $this->_html_images[] = array( - 'body' => $filedata, - 'name' => $filename, - 'c_type' => $c_type, - 'cid' => md5(uniqid(time())) - ); - return true; - } - - /** - * Adds a file to the list of attachments. - * - * @param string $file The file name of the file to attach - * OR the file data itself - * @param string $c_type The content type - * @param string $name The filename of the attachment - * Only use if $file is the file data - * @param bool $isFilename Whether $file is a filename or not - * Defaults to true - * @return mixed true on success or PEAR_Error object - * @access public - */ - function addAttachment($file, $c_type = 'application/octet-stream', - $name = '', $isfilename = true, - $encoding = 'base64') - { - $filedata = ($isfilename === true) ? $this->_file2str($file) - : $file; - if ($isfilename === true) { - // Force the name the user supplied, otherwise use $file - $filename = (!empty($name)) ? $name : $file; - } else { - $filename = $name; - } - if (empty($filename)) { - return PEAR::raiseError( - 'The supplied filename for the attachment can\'t be empty' - ); - } - $filename = basename($filename); - if (PEAR::isError($filedata)) { - return $filedata; - } - - $this->_parts[] = array( - 'body' => $filedata, - 'name' => $filename, - 'c_type' => $c_type, - 'encoding' => $encoding - ); - return true; - } - - /** - * Get the contents of the given file name as string - * - * @param string $file_name path of file to process - * @return string contents of $file_name - * @access private - */ - function &_file2str($file_name) - { - if (!is_readable($file_name)) { - return PEAR::raiseError('File is not readable ' . $file_name); - } - if (!$fd = fopen($file_name, 'rb')) { - return PEAR::raiseError('Could not open ' . $file_name); - } - $filesize = filesize($file_name); - if ($filesize == 0){ - $cont = ""; - }else{ - $cont = fread($fd, $filesize); - } - fclose($fd); - return $cont; - } - - /** - * Adds a text subpart to the mimePart object and - * returns it during the build process. - * - * @param mixed The object to add the part to, or - * null if a new object is to be created. - * @param string The text to add. - * @return object The text mimePart object - * @access private - */ - function &_addTextPart(&$obj, $text) - { - $params['content_type'] = 'text/plain'; - $params['encoding'] = $this->_build_params['text_encoding']; - $params['charset'] = $this->_build_params['text_charset']; - if (is_object($obj)) { - return $obj->addSubpart($text, $params); - } else { - return new Mail_mimePart($text, $params); - } - } - - /** - * Adds a html subpart to the mimePart object and - * returns it during the build process. - * - * @param mixed The object to add the part to, or - * null if a new object is to be created. - * @return object The html mimePart object - * @access private - */ - function &_addHtmlPart(&$obj) - { - $params['content_type'] = 'text/html'; - $params['encoding'] = $this->_build_params['html_encoding']; - $params['charset'] = $this->_build_params['html_charset']; - if (is_object($obj)) { - return $obj->addSubpart($this->_htmlbody, $params); - } else { - return new Mail_mimePart($this->_htmlbody, $params); - } - } - - /** - * Creates a new mimePart object, using multipart/mixed as - * the initial content-type and returns it during the - * build process. - * - * @return object The multipart/mixed mimePart object - * @access private - */ - function &_addMixedPart() - { - $params['content_type'] = 'multipart/mixed'; - return new Mail_mimePart('', $params); - } - - /** - * Adds a multipart/alternative part to a mimePart - * object (or creates one), and returns it during - * the build process. - * - * @param mixed The object to add the part to, or - * null if a new object is to be created. - * @return object The multipart/mixed mimePart object - * @access private - */ - function &_addAlternativePart(&$obj) - { - $params['content_type'] = 'multipart/alternative'; - if (is_object($obj)) { - return $obj->addSubpart('', $params); - } else { - return new Mail_mimePart('', $params); - } - } - - /** - * Adds a multipart/related part to a mimePart - * object (or creates one), and returns it during - * the build process. - * - * @param mixed The object to add the part to, or - * null if a new object is to be created - * @return object The multipart/mixed mimePart object - * @access private - */ - function &_addRelatedPart(&$obj) - { - $params['content_type'] = 'multipart/related'; - if (is_object($obj)) { - return $obj->addSubpart('', $params); - } else { - return new Mail_mimePart('', $params); - } - } - - /** - * Adds an html image subpart to a mimePart object - * and returns it during the build process. - * - * @param object The mimePart to add the image to - * @param array The image information - * @return object The image mimePart object - * @access private - */ - function &_addHtmlImagePart(&$obj, $value) - { - $params['content_type'] = $value['c_type']; - $params['encoding'] = 'base64'; - $params['disposition'] = 'inline'; - $params['dfilename'] = $value['name']; - $params['cid'] = $value['cid']; - $obj->addSubpart($value['body'], $params); - } - - /** - * Adds an attachment subpart to a mimePart object - * and returns it during the build process. - * - * @param object The mimePart to add the image to - * @param array The attachment information - * @return object The image mimePart object - * @access private - */ - function &_addAttachmentPart(&$obj, $value) - { - $params['content_type'] = $value['c_type']; - $params['encoding'] = $value['encoding']; - $params['disposition'] = 'attachment'; - $params['dfilename'] = $value['name']; - $obj->addSubpart($value['body'], $params); - } - - /** - * Builds the multipart message from the list ($this->_parts) and - * returns the mime content. - * - * @param array Build parameters that change the way the email - * is built. Should be associative. Can contain: - * text_encoding - What encoding to use for plain text - * Default is 7bit - * html_encoding - What encoding to use for html - * Default is quoted-printable - * 7bit_wrap - Number of characters before text is - * wrapped in 7bit encoding - * Default is 998 - * html_charset - The character set to use for html. - * Default is iso-8859-1 - * text_charset - The character set to use for text. - * Default is iso-8859-1 - * head_charset - The character set to use for headers. - * Default is iso-8859-1 - * @return string The mime content - * @access public - */ - function &get($build_params = null) - { - if (isset($build_params)) { - while (list($key, $value) = each($build_params)) { - $this->_build_params[$key] = $value; - } - } - - if (!empty($this->_html_images) AND isset($this->_htmlbody)) { - foreach ($this->_html_images as $value) { - $regex = '#(\s)((?i)src|background|href(?-i))\s*=\s*(["\']?)' . preg_quote($value['name'], '#') . - '\3#'; - $rep = '\1\2=\3cid:' . $value['cid'] .'\3'; - $this->_htmlbody = preg_replace($regex, $rep, - $this->_htmlbody - ); - } - } - - $null = null; - $attachments = !empty($this->_parts) ? true : false; - $html_images = !empty($this->_html_images) ? true : false; - $html = !empty($this->_htmlbody) ? true : false; - $text = (!$html AND !empty($this->_txtbody)) ? true : false; - - switch (true) { - case $text AND !$attachments: - $message =& $this->_addTextPart($null, $this->_txtbody); - break; - - case !$text AND !$html AND $attachments: - $message =& $this->_addMixedPart(); - for ($i = 0; $i < count($this->_parts); $i++) { - $this->_addAttachmentPart($message, $this->_parts[$i]); - } - break; - - case $text AND $attachments: - $message =& $this->_addMixedPart(); - $this->_addTextPart($message, $this->_txtbody); - for ($i = 0; $i < count($this->_parts); $i++) { - $this->_addAttachmentPart($message, $this->_parts[$i]); - } - break; - - case $html AND !$attachments AND !$html_images: - if (isset($this->_txtbody)) { - $message =& $this->_addAlternativePart($null); - $this->_addTextPart($message, $this->_txtbody); - $this->_addHtmlPart($message); - } else { - $message =& $this->_addHtmlPart($null); - } - break; - - case $html AND !$attachments AND $html_images: - if (isset($this->_txtbody)) { - $message =& $this->_addAlternativePart($null); - $this->_addTextPart($message, $this->_txtbody); - $related =& $this->_addRelatedPart($message); - } else { - $message =& $this->_addRelatedPart($null); - $related =& $message; - } - $this->_addHtmlPart($related); - for ($i = 0; $i < count($this->_html_images); $i++) { - $this->_addHtmlImagePart($related, $this->_html_images[$i]); - } - break; - - case $html AND $attachments AND !$html_images: - $message =& $this->_addMixedPart(); - if (isset($this->_txtbody)) { - $alt =& $this->_addAlternativePart($message); - $this->_addTextPart($alt, $this->_txtbody); - $this->_addHtmlPart($alt); - } else { - $this->_addHtmlPart($message); - } - for ($i = 0; $i < count($this->_parts); $i++) { - $this->_addAttachmentPart($message, $this->_parts[$i]); - } - break; - - case $html AND $attachments AND $html_images: - $message =& $this->_addMixedPart(); - if (isset($this->_txtbody)) { - $alt =& $this->_addAlternativePart($message); - $this->_addTextPart($alt, $this->_txtbody); - $rel =& $this->_addRelatedPart($alt); - } else { - $rel =& $this->_addRelatedPart($message); - } - $this->_addHtmlPart($rel); - for ($i = 0; $i < count($this->_html_images); $i++) { - $this->_addHtmlImagePart($rel, $this->_html_images[$i]); - } - for ($i = 0; $i < count($this->_parts); $i++) { - $this->_addAttachmentPart($message, $this->_parts[$i]); - } - break; - - } - - if (isset($message)) { - $output = $message->encode(); - $this->_headers = array_merge($this->_headers, - $output['headers']); - return $output['body']; - - } else { - return false; - } - } - - /** - * Returns an array with the headers needed to prepend to the email - * (MIME-Version and Content-Type). Format of argument is: - * $array['header-name'] = 'header-value'; - * - * @param array $xtra_headers Assoc array with any extra headers. - * Optional. - * @return array Assoc array with the mime headers - * @access public - */ - function &headers($xtra_headers = null) - { - // Content-Type header should already be present, - // So just add mime version header - $headers['MIME-Version'] = '1.0'; - if (isset($xtra_headers)) { - $headers = array_merge($headers, $xtra_headers); - } - $this->_headers = array_merge($headers, $this->_headers); - - return $this->_encodeHeaders($this->_headers); - } - - /** - * Get the text version of the headers - * (usefull if you want to use the PHP mail() function) - * - * @param array $xtra_headers Assoc array with any extra headers. - * Optional. - * @return string Plain text headers - * @access public - */ - function txtHeaders($xtra_headers = null) - { - $headers = $this->headers($xtra_headers); - $ret = ''; - foreach ($headers as $key => $val) { - $ret .= "$key: $val" . MAIL_MIME_CRLF; - } - return $ret; - } - - /** - * Sets the Subject header - * - * @param string $subject String to set the subject to - * access public - */ - function setSubject($subject) - { - $this->_headers['Subject'] = $subject; - } - - /** - * Set an email to the From (the sender) header - * - * @param string $email The email direction to add - * @access public - */ - function setFrom($email) - { - $this->_headers['From'] = $email; - } - - /** - * Add an email to the Cc (carbon copy) header - * (multiple calls to this method are allowed) - * - * @param string $email The email direction to add - * @access public - */ - function addCc($email) - { - if (isset($this->_headers['Cc'])) { - $this->_headers['Cc'] .= ", $email"; - } else { - $this->_headers['Cc'] = $email; - } - } - - /** - * Add an email to the Bcc (blank carbon copy) header - * (multiple calls to this method are allowed) - * - * @param string $email The email direction to add - * @access public - */ - function addBcc($email) - { - if (isset($this->_headers['Bcc'])) { - $this->_headers['Bcc'] .= ", $email"; - } else { - $this->_headers['Bcc'] = $email; - } - } - - /** - * Encodes a header as per RFC2047 - * - * @param string $input The header data to encode - * @return string Encoded data - * @access private - */ - function _encodeHeaders($input) - { - foreach ($input as $hdr_name => $hdr_value) { - preg_match_all('/(\w*[\x80-\xFF]+\w*)/', $hdr_value, $matches); - foreach ($matches[1] as $value) { - $replacement = preg_replace('/([\x80-\xFF])/e', - '"=" . - strtoupper(dechex(ord("\1")))', - $value); - $hdr_value = str_replace($value, '=?' . - $this->_build_params['head_charset'] . - '?Q?' . $replacement . '?=', - $hdr_value); - } - $input[$hdr_name] = $hdr_value; - } - - return $input; - } - - /** - * Set the object's end-of-line and define the constant if applicable - * - * @param string $eol End Of Line sequence - * @access private - */ - function _setEOL($eol) - { - $this->_eol = $eol; - if (!defined('MAIL_MIME_CRLF')) { - define('MAIL_MIME_CRLF', $this->_eol, true); - } - } - - - -} // End of class -?> diff --git a/inc/Mail/mimeDecode.php b/inc/Mail/mimeDecode.php deleted file mode 100644 index d5187d9b7aa39b1b93bfaf0b73b3c7f29297e2b3..0000000000000000000000000000000000000000 --- a/inc/Mail/mimeDecode.php +++ /dev/null @@ -1,837 +0,0 @@ -<?php -/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ -// +-----------------------------------------------------------------------+ -// | Copyright (c) 2002-2003 Richard Heyes | -// | Copyright (c) 2003-2005 The PHP Group | -// | All rights reserved. | -// | | -// | Redistribution and use in source and binary forms, with or without | -// | modification, are permitted provided that the following conditions | -// | are met: | -// | | -// | o Redistributions of source code must retain the above copyright | -// | notice, this list of conditions and the following disclaimer. | -// | o Redistributions in binary form must reproduce the above copyright | -// | notice, this list of conditions and the following disclaimer in the | -// | documentation and/or other materials provided with the distribution.| -// | o The names of the authors may not be used to endorse or promote | -// | products derived from this software without specific prior written | -// | permission. | -// | | -// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | -// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | -// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | -// | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | -// | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | -// | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | -// | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | -// | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | -// | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | -// | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | -// | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | -// | | -// +-----------------------------------------------------------------------+ -// | Author: Richard Heyes <richard@phpguru.org> | -// +-----------------------------------------------------------------------+ - -require_once 'PEAR.php'; - -/** -* +----------------------------- IMPORTANT ------------------------------+ -* | Usage of this class compared to native php extensions such as | -* | mailparse or imap, is slow and may be feature deficient. If available| -* | you are STRONGLY recommended to use the php extensions. | -* +----------------------------------------------------------------------+ -* -* Mime Decoding class -* -* This class will parse a raw mime email and return -* the structure. Returned structure is similar to -* that returned by imap_fetchstructure(). -* -* USAGE: (assume $input is your raw email) -* -* $decode = new Mail_mimeDecode($input, "\r\n"); -* $structure = $decode->decode(); -* print_r($structure); -* -* Or statically: -* -* $params['input'] = $input; -* $structure = Mail_mimeDecode::decode($params); -* print_r($structure); -* -* TODO: -* o Implement multipart/appledouble -* o UTF8: ??? - - > 4. We have also found a solution for decoding the UTF-8 - > headers. Therefore I made the following function: - > - > function decode_utf8($txt) { - > $trans=array("Å‘"=>"õ","ű"=>"û","Å"=>"Õ","Å°" - =>"Û"); - > $txt=strtr($txt,$trans); - > return(utf8_decode($txt)); - > } - > - > And I have inserted the following line to the class: - > - > if (strtolower($charset)=="utf-8") $text=decode_utf8($text); - > - > ... before the following one in the "_decodeHeader" function: - > - > $input = str_replace($encoded, $text, $input); - > - > This way from now on it can easily decode the UTF-8 headers too. - -* -* @author Richard Heyes <richard@phpguru.org> -* @version $Revision: 1.46 $ -* @package Mail -*/ -class Mail_mimeDecode extends PEAR -{ - /** - * The raw email to decode - * @var string - */ - var $_input; - - /** - * The header part of the input - * @var string - */ - var $_header; - - /** - * The body part of the input - * @var string - */ - var $_body; - - /** - * If an error occurs, this is used to store the message - * @var string - */ - var $_error; - - /** - * Flag to determine whether to include bodies in the - * returned object. - * @var boolean - */ - var $_include_bodies; - - /** - * Flag to determine whether to decode bodies - * @var boolean - */ - var $_decode_bodies; - - /** - * Flag to determine whether to decode headers - * @var boolean - */ - var $_decode_headers; - - /** - * Constructor. - * - * Sets up the object, initialise the variables, and splits and - * stores the header and body of the input. - * - * @param string The input to decode - * @access public - */ - function Mail_mimeDecode($input) - { - list($header, $body) = $this->_splitBodyHeader($input); - - $this->_input = $input; - $this->_header = $header; - $this->_body = $body; - $this->_decode_bodies = false; - $this->_include_bodies = true; - } - - /** - * Begins the decoding process. If called statically - * it will create an object and call the decode() method - * of it. - * - * @param array An array of various parameters that determine - * various things: - * include_bodies - Whether to include the body in the returned - * object. - * decode_bodies - Whether to decode the bodies - * of the parts. (Transfer encoding) - * decode_headers - Whether to decode headers - * input - If called statically, this will be treated - * as the input - * @return object Decoded results - * @access public - */ - function decode($params = null) - { - // determine if this method has been called statically - $isStatic = !(isset($this) && get_class($this) == __CLASS__); - - // Have we been called statically? - // If so, create an object and pass details to that. - if ($isStatic AND isset($params['input'])) { - - $obj = new Mail_mimeDecode($params['input']); - $structure = $obj->decode($params); - - // Called statically but no input - } elseif ($isStatic) { - return PEAR::raiseError('Called statically and no input given'); - - // Called via an object - } else { - $this->_include_bodies = isset($params['include_bodies']) ? - $params['include_bodies'] : false; - $this->_decode_bodies = isset($params['decode_bodies']) ? - $params['decode_bodies'] : false; - $this->_decode_headers = isset($params['decode_headers']) ? - $params['decode_headers'] : false; - - $structure = $this->_decode($this->_header, $this->_body); - if ($structure === false) { - $structure = $this->raiseError($this->_error); - } - } - - return $structure; - } - - /** - * Performs the decoding. Decodes the body string passed to it - * If it finds certain content-types it will call itself in a - * recursive fashion - * - * @param string Header section - * @param string Body section - * @return object Results of decoding process - * @access private - */ - function _decode($headers, $body, $default_ctype = 'text/plain') - { - $return = new stdClass; - $return->headers = array(); - $headers = $this->_parseHeaders($headers); - - foreach ($headers as $value) { - if (isset($return->headers[strtolower($value['name'])]) AND !is_array($return->headers[strtolower($value['name'])])) { - $return->headers[strtolower($value['name'])] = array($return->headers[strtolower($value['name'])]); - $return->headers[strtolower($value['name'])][] = $value['value']; - - } elseif (isset($return->headers[strtolower($value['name'])])) { - $return->headers[strtolower($value['name'])][] = $value['value']; - - } else { - $return->headers[strtolower($value['name'])] = $value['value']; - } - } - - reset($headers); - while (list($key, $value) = each($headers)) { - $headers[$key]['name'] = strtolower($headers[$key]['name']); - switch ($headers[$key]['name']) { - - case 'content-type': - $content_type = $this->_parseHeaderValue($headers[$key]['value']); - - if (preg_match('/([0-9a-z+.-]+)\/([0-9a-z+.-]+)/i', $content_type['value'], $regs)) { - $return->ctype_primary = $regs[1]; - $return->ctype_secondary = $regs[2]; - } - - if (isset($content_type['other'])) { - while (list($p_name, $p_value) = each($content_type['other'])) { - $return->ctype_parameters[$p_name] = $p_value; - } - } - break; - - case 'content-disposition': - $content_disposition = $this->_parseHeaderValue($headers[$key]['value']); - $return->disposition = $content_disposition['value']; - if (isset($content_disposition['other'])) { - while (list($p_name, $p_value) = each($content_disposition['other'])) { - $return->d_parameters[$p_name] = $p_value; - } - } - break; - - case 'content-transfer-encoding': - $content_transfer_encoding = $this->_parseHeaderValue($headers[$key]['value']); - break; - } - } - - if (isset($content_type)) { - switch (strtolower($content_type['value'])) { - case 'text/plain': - $encoding = isset($content_transfer_encoding) ? $content_transfer_encoding['value'] : '7bit'; - $this->_include_bodies ? $return->body = ($this->_decode_bodies ? $this->_decodeBody($body, $encoding) : $body) : null; - break; - - case 'text/html': - $encoding = isset($content_transfer_encoding) ? $content_transfer_encoding['value'] : '7bit'; - $this->_include_bodies ? $return->body = ($this->_decode_bodies ? $this->_decodeBody($body, $encoding) : $body) : null; - break; - - case 'multipart/parallel': - case 'multipart/report': // RFC1892 - case 'multipart/signed': // PGP - case 'multipart/digest': - case 'multipart/alternative': - case 'multipart/related': - case 'multipart/mixed': - if(!isset($content_type['other']['boundary'])){ - $this->_error = 'No boundary found for ' . $content_type['value'] . ' part'; - return false; - } - - $default_ctype = (strtolower($content_type['value']) === 'multipart/digest') ? 'message/rfc822' : 'text/plain'; - - $parts = $this->_boundarySplit($body, $content_type['other']['boundary']); - for ($i = 0; $i < count($parts); $i++) { - list($part_header, $part_body) = $this->_splitBodyHeader($parts[$i]); - $part = $this->_decode($part_header, $part_body, $default_ctype); - if($part === false) - $part = $this->raiseError($this->_error); - $return->parts[] = $part; - } - break; - - case 'message/rfc822': - $obj = &new Mail_mimeDecode($body); - $return->parts[] = $obj->decode(array('include_bodies' => $this->_include_bodies, - 'decode_bodies' => $this->_decode_bodies, - 'decode_headers' => $this->_decode_headers)); - unset($obj); - break; - - default: - if(!isset($content_transfer_encoding['value'])) - $content_transfer_encoding['value'] = '7bit'; - $this->_include_bodies ? $return->body = ($this->_decode_bodies ? $this->_decodeBody($body, $content_transfer_encoding['value']) : $body) : null; - break; - } - - } else { - $ctype = explode('/', $default_ctype); - $return->ctype_primary = $ctype[0]; - $return->ctype_secondary = $ctype[1]; - $this->_include_bodies ? $return->body = ($this->_decode_bodies ? $this->_decodeBody($body) : $body) : null; - } - - return $return; - } - - /** - * Given the output of the above function, this will return an - * array of references to the parts, indexed by mime number. - * - * @param object $structure The structure to go through - * @param string $mime_number Internal use only. - * @return array Mime numbers - */ - function &getMimeNumbers(&$structure, $no_refs = false, $mime_number = '', $prepend = '') - { - $return = array(); - if (!empty($structure->parts)) { - if ($mime_number != '') { - $structure->mime_id = $prepend . $mime_number; - $return[$prepend . $mime_number] = &$structure; - } - for ($i = 0; $i < count($structure->parts); $i++) { - - - if (!empty($structure->headers['content-type']) AND substr(strtolower($structure->headers['content-type']), 0, 8) == 'message/') { - $prepend = $prepend . $mime_number . '.'; - $_mime_number = ''; - } else { - $_mime_number = ($mime_number == '' ? $i + 1 : sprintf('%s.%s', $mime_number, $i + 1)); - } - - $arr = &Mail_mimeDecode::getMimeNumbers($structure->parts[$i], $no_refs, $_mime_number, $prepend); - foreach ($arr as $key => $val) { - $no_refs ? $return[$key] = '' : $return[$key] = &$arr[$key]; - } - } - } else { - if ($mime_number == '') { - $mime_number = '1'; - } - $structure->mime_id = $prepend . $mime_number; - $no_refs ? $return[$prepend . $mime_number] = '' : $return[$prepend . $mime_number] = &$structure; - } - - return $return; - } - - /** - * Given a string containing a header and body - * section, this function will split them (at the first - * blank line) and return them. - * - * @param string Input to split apart - * @return array Contains header and body section - * @access private - */ - function _splitBodyHeader($input) - { - if (preg_match("/^(.*?)\r?\n\r?\n(.*)/s", $input, $match)) { - return array($match[1], $match[2]); - } - $this->_error = 'Could not split header and body'; - return false; - } - - /** - * Parse headers given in $input and return - * as assoc array. - * - * @param string Headers to parse - * @return array Contains parsed headers - * @access private - */ - function _parseHeaders($input) - { - - if ($input !== '') { - // Unfold the input - $input = preg_replace("/\r?\n/", "\r\n", $input); - $input = preg_replace("/\r\n(\t| )+/", ' ', $input); - $headers = explode("\r\n", trim($input)); - - foreach ($headers as $value) { - $hdr_name = substr($value, 0, $pos = strpos($value, ':')); - $hdr_value = substr($value, $pos+1); - if($hdr_value[0] == ' ') - $hdr_value = substr($hdr_value, 1); - - $return[] = array( - 'name' => $hdr_name, - 'value' => $this->_decode_headers ? $this->_decodeHeader($hdr_value) : $hdr_value - ); - } - } else { - $return = array(); - } - - return $return; - } - - /** - * Function to parse a header value, - * extract first part, and any secondary - * parts (after ;) This function is not as - * robust as it could be. Eg. header comments - * in the wrong place will probably break it. - * - * @param string Header value to parse - * @return array Contains parsed result - * @access private - */ - function _parseHeaderValue($input) - { - - if (($pos = strpos($input, ';')) !== false) { - - $return['value'] = trim(substr($input, 0, $pos)); - $input = trim(substr($input, $pos+1)); - - if (strlen($input) > 0) { - - // This splits on a semi-colon, if there's no preceeding backslash - // Now works with quoted values; had to glue the \; breaks in PHP - // the regex is already bordering on incomprehensible - $splitRegex = '/([^;\'"]*[\'"]([^\'"]*([^\'"]*)*)[\'"][^;\'"]*|([^;]+))(;|$)/'; - preg_match_all($splitRegex, $input, $matches); - $parameters = array(); - for ($i=0; $i<count($matches[0]); $i++) { - $param = $matches[0][$i]; - while (substr($param, -2) == '\;') { - $param .= $matches[0][++$i]; - } - $parameters[] = $param; - } - - for ($i = 0; $i < count($parameters); $i++) { - $param_name = trim(substr($parameters[$i], 0, $pos = strpos($parameters[$i], '=')), "'\";\t\\ "); - $param_value = trim(str_replace('\;', ';', substr($parameters[$i], $pos + 1)), "'\";\t\\ "); - if ($param_value[0] == '"') { - $param_value = substr($param_value, 1, -1); - } - $return['other'][$param_name] = $param_value; - $return['other'][strtolower($param_name)] = $param_value; - } - } - } else { - $return['value'] = trim($input); - } - - return $return; - } - - /** - * This function splits the input based - * on the given boundary - * - * @param string Input to parse - * @return array Contains array of resulting mime parts - * @access private - */ - function _boundarySplit($input, $boundary) - { - $parts = array(); - - $bs_possible = substr($boundary, 2, -2); - $bs_check = '\"' . $bs_possible . '\"'; - - if ($boundary == $bs_check) { - $boundary = $bs_possible; - } - - $tmp = explode('--' . $boundary, $input); - - for ($i = 1; $i < count($tmp) - 1; $i++) { - $parts[] = $tmp[$i]; - } - - return $parts; - } - - /** - * Given a header, this function will decode it - * according to RFC2047. Probably not *exactly* - * conformant, but it does pass all the given - * examples (in RFC2047). - * - * @param string Input header value to decode - * @return string Decoded header value - * @access private - */ - function _decodeHeader($input) - { - // Remove white space between encoded-words - $input = preg_replace('/(=\?[^?]+\?(q|b)\?[^?]*\?=)(\s)+=\?/i', '\1=?', $input); - - // For each encoded-word... - while (preg_match('/(=\?([^?]+)\?(q|b)\?([^?]*)\?=)/i', $input, $matches)) { - - $encoded = $matches[1]; - $charset = $matches[2]; - $encoding = $matches[3]; - $text = $matches[4]; - - switch (strtolower($encoding)) { - case 'b': - $text = base64_decode($text); - break; - - case 'q': - $text = str_replace('_', ' ', $text); - preg_match_all('/=([a-f0-9]{2})/i', $text, $matches); - foreach($matches[1] as $value) - $text = str_replace('='.$value, chr(hexdec($value)), $text); - break; - } - - $input = str_replace($encoded, $text, $input); - } - - return $input; - } - - /** - * Given a body string and an encoding type, - * this function will decode and return it. - * - * @param string Input body to decode - * @param string Encoding type to use. - * @return string Decoded body - * @access private - */ - function _decodeBody($input, $encoding = '7bit') - { - switch (strtolower($encoding)) { - case '7bit': - return $input; - break; - - case 'quoted-printable': - return $this->_quotedPrintableDecode($input); - break; - - case 'base64': - return base64_decode($input); - break; - - default: - return $input; - } - } - - /** - * Given a quoted-printable string, this - * function will decode and return it. - * - * @param string Input body to decode - * @return string Decoded body - * @access private - */ - function _quotedPrintableDecode($input) - { - // Remove soft line breaks - $input = preg_replace("/=\r?\n/", '', $input); - - // Replace encoded characters - $input = preg_replace('/=([a-f0-9]{2})/ie', "chr(hexdec('\\1'))", $input); - - return $input; - } - - /** - * Checks the input for uuencoded files and returns - * an array of them. Can be called statically, eg: - * - * $files =& Mail_mimeDecode::uudecode($some_text); - * - * It will check for the begin 666 ... end syntax - * however and won't just blindly decode whatever you - * pass it. - * - * @param string Input body to look for attahcments in - * @return array Decoded bodies, filenames and permissions - * @access public - * @author Unknown - */ - function &uudecode($input) - { - // Find all uuencoded sections - preg_match_all("/begin ([0-7]{3}) (.+)\r?\n(.+)\r?\nend/Us", $input, $matches); - - for ($j = 0; $j < count($matches[3]); $j++) { - - $str = $matches[3][$j]; - $filename = $matches[2][$j]; - $fileperm = $matches[1][$j]; - - $file = ''; - $str = preg_split("/\r?\n/", trim($str)); - $strlen = count($str); - - for ($i = 0; $i < $strlen; $i++) { - $pos = 1; - $d = 0; - $len=(int)(((ord(substr($str[$i],0,1)) -32) - ' ') & 077); - - while (($d + 3 <= $len) AND ($pos + 4 <= strlen($str[$i]))) { - $c0 = (ord(substr($str[$i],$pos,1)) ^ 0x20); - $c1 = (ord(substr($str[$i],$pos+1,1)) ^ 0x20); - $c2 = (ord(substr($str[$i],$pos+2,1)) ^ 0x20); - $c3 = (ord(substr($str[$i],$pos+3,1)) ^ 0x20); - $file .= chr(((($c0 - ' ') & 077) << 2) | ((($c1 - ' ') & 077) >> 4)); - - $file .= chr(((($c1 - ' ') & 077) << 4) | ((($c2 - ' ') & 077) >> 2)); - - $file .= chr(((($c2 - ' ') & 077) << 6) | (($c3 - ' ') & 077)); - - $pos += 4; - $d += 3; - } - - if (($d + 2 <= $len) && ($pos + 3 <= strlen($str[$i]))) { - $c0 = (ord(substr($str[$i],$pos,1)) ^ 0x20); - $c1 = (ord(substr($str[$i],$pos+1,1)) ^ 0x20); - $c2 = (ord(substr($str[$i],$pos+2,1)) ^ 0x20); - $file .= chr(((($c0 - ' ') & 077) << 2) | ((($c1 - ' ') & 077) >> 4)); - - $file .= chr(((($c1 - ' ') & 077) << 4) | ((($c2 - ' ') & 077) >> 2)); - - $pos += 3; - $d += 2; - } - - if (($d + 1 <= $len) && ($pos + 2 <= strlen($str[$i]))) { - $c0 = (ord(substr($str[$i],$pos,1)) ^ 0x20); - $c1 = (ord(substr($str[$i],$pos+1,1)) ^ 0x20); - $file .= chr(((($c0 - ' ') & 077) << 2) | ((($c1 - ' ') & 077) >> 4)); - - } - } - $files[] = array('filename' => $filename, 'fileperm' => $fileperm, 'filedata' => $file); - } - - return $files; - } - - /** - * getSendArray() returns the arguments required for Mail::send() - * used to build the arguments for a mail::send() call - * - * Usage: - * $mailtext = Full email (for example generated by a template) - * $decoder = new Mail_mimeDecode($mailtext); - * $parts = $decoder->getSendArray(); - * if (!PEAR::isError($parts) { - * list($recipents,$headers,$body) = $parts; - * $mail = Mail::factory('smtp'); - * $mail->send($recipents,$headers,$body); - * } else { - * echo $parts->message; - * } - * @return mixed array of recipeint, headers,body or Pear_Error - * @access public - * @author Alan Knowles <alan@akbkhome.com> - */ - function getSendArray() - { - // prevent warning if this is not set - $this->_decode_headers = FALSE; - $headerlist =$this->_parseHeaders($this->_header); - $to = ""; - if (!$headerlist) { - return $this->raiseError("Message did not contain headers"); - } - foreach($headerlist as $item) { - $header[$item['name']] = $item['value']; - switch (strtolower($item['name'])) { - case "to": - case "cc": - case "bcc": - $to = ",".$item['value']; - default: - break; - } - } - if ($to == "") { - return $this->raiseError("Message did not contain any recipents"); - } - $to = substr($to,1); - return array($to,$header,$this->_body); - } - - /** - * Returns a xml copy of the output of - * Mail_mimeDecode::decode. Pass the output in as the - * argument. This function can be called statically. Eg: - * - * $output = $obj->decode(); - * $xml = Mail_mimeDecode::getXML($output); - * - * The DTD used for this should have been in the package. Or - * alternatively you can get it from cvs, or here: - * http://www.phpguru.org/xmail/xmail.dtd. - * - * @param object Input to convert to xml. This should be the - * output of the Mail_mimeDecode::decode function - * @return string XML version of input - * @access public - */ - function getXML($input) - { - $crlf = "\r\n"; - $output = '<?xml version=\'1.0\'?>' . $crlf . - '<!DOCTYPE email SYSTEM "http://www.phpguru.org/xmail/xmail.dtd">' . $crlf . - '<email>' . $crlf . - Mail_mimeDecode::_getXML($input) . - '</email>'; - - return $output; - } - - /** - * Function that does the actual conversion to xml. Does a single - * mimepart at a time. - * - * @param object Input to convert to xml. This is a mimepart object. - * It may or may not contain subparts. - * @param integer Number of tabs to indent - * @return string XML version of input - * @access private - */ - function _getXML($input, $indent = 1) - { - $htab = "\t"; - $crlf = "\r\n"; - $output = ''; - $headers = @(array)$input->headers; - - foreach ($headers as $hdr_name => $hdr_value) { - - // Multiple headers with this name - if (is_array($headers[$hdr_name])) { - for ($i = 0; $i < count($hdr_value); $i++) { - $output .= Mail_mimeDecode::_getXML_helper($hdr_name, $hdr_value[$i], $indent); - } - - // Only one header of this sort - } else { - $output .= Mail_mimeDecode::_getXML_helper($hdr_name, $hdr_value, $indent); - } - } - - if (!empty($input->parts)) { - for ($i = 0; $i < count($input->parts); $i++) { - $output .= $crlf . str_repeat($htab, $indent) . '<mimepart>' . $crlf . - Mail_mimeDecode::_getXML($input->parts[$i], $indent+1) . - str_repeat($htab, $indent) . '</mimepart>' . $crlf; - } - } elseif (isset($input->body)) { - $output .= $crlf . str_repeat($htab, $indent) . '<body><![CDATA[' . - $input->body . ']]></body>' . $crlf; - } - - return $output; - } - - /** - * Helper function to _getXML(). Returns xml of a header. - * - * @param string Name of header - * @param string Value of header - * @param integer Number of tabs to indent - * @return string XML version of input - * @access private - */ - function _getXML_helper($hdr_name, $hdr_value, $indent) - { - $htab = "\t"; - $crlf = "\r\n"; - $return = ''; - - $new_hdr_value = ($hdr_name != 'received') ? Mail_mimeDecode::_parseHeaderValue($hdr_value) : array('value' => $hdr_value); - $new_hdr_name = str_replace(' ', '-', ucwords(str_replace('-', ' ', $hdr_name))); - - // Sort out any parameters - if (!empty($new_hdr_value['other'])) { - foreach ($new_hdr_value['other'] as $paramname => $paramvalue) { - $params[] = str_repeat($htab, $indent) . $htab . '<parameter>' . $crlf . - str_repeat($htab, $indent) . $htab . $htab . '<paramname>' . htmlspecialchars($paramname) . '</paramname>' . $crlf . - str_repeat($htab, $indent) . $htab . $htab . '<paramvalue>' . htmlspecialchars($paramvalue) . '</paramvalue>' . $crlf . - str_repeat($htab, $indent) . $htab . '</parameter>' . $crlf; - } - - $params = implode('', $params); - } else { - $params = ''; - } - - $return = str_repeat($htab, $indent) . '<header>' . $crlf . - str_repeat($htab, $indent) . $htab . '<headername>' . htmlspecialchars($new_hdr_name) . '</headername>' . $crlf . - str_repeat($htab, $indent) . $htab . '<headervalue>' . htmlspecialchars($new_hdr_value['value']) . '</headervalue>' . $crlf . - $params . - str_repeat($htab, $indent) . '</header>' . $crlf; - - return $return; - } - -} // End of class -?> diff --git a/inc/Mail/mimePart.php b/inc/Mail/mimePart.php deleted file mode 100644 index c0050d411275ea9a6b2f174861d91b2dc994bc8d..0000000000000000000000000000000000000000 --- a/inc/Mail/mimePart.php +++ /dev/null @@ -1,351 +0,0 @@ -<?php -// +-----------------------------------------------------------------------+ -// | Copyright (c) 2002-2003 Richard Heyes | -// | All rights reserved. | -// | | -// | Redistribution and use in source and binary forms, with or without | -// | modification, are permitted provided that the following conditions | -// | are met: | -// | | -// | o Redistributions of source code must retain the above copyright | -// | notice, this list of conditions and the following disclaimer. | -// | o Redistributions in binary form must reproduce the above copyright | -// | notice, this list of conditions and the following disclaimer in the | -// | documentation and/or other materials provided with the distribution.| -// | o The names of the authors may not be used to endorse or promote | -// | products derived from this software without specific prior written | -// | permission. | -// | | -// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | -// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | -// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | -// | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | -// | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | -// | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | -// | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | -// | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | -// | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | -// | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | -// | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | -// | | -// +-----------------------------------------------------------------------+ -// | Author: Richard Heyes <richard@phpguru.org> | -// +-----------------------------------------------------------------------+ - -/** -* -* Raw mime encoding class -* -* What is it? -* This class enables you to manipulate and build -* a mime email from the ground up. -* -* Why use this instead of mime.php? -* mime.php is a userfriendly api to this class for -* people who aren't interested in the internals of -* mime mail. This class however allows full control -* over the email. -* -* Eg. -* -* // Since multipart/mixed has no real body, (the body is -* // the subpart), we set the body argument to blank. -* -* $params['content_type'] = 'multipart/mixed'; -* $email = new Mail_mimePart('', $params); -* -* // Here we add a text part to the multipart we have -* // already. Assume $body contains plain text. -* -* $params['content_type'] = 'text/plain'; -* $params['encoding'] = '7bit'; -* $text = $email->addSubPart($body, $params); -* -* // Now add an attachment. Assume $attach is -* the contents of the attachment -* -* $params['content_type'] = 'application/zip'; -* $params['encoding'] = 'base64'; -* $params['disposition'] = 'attachment'; -* $params['dfilename'] = 'example.zip'; -* $attach =& $email->addSubPart($body, $params); -* -* // Now build the email. Note that the encode -* // function returns an associative array containing two -* // elements, body and headers. You will need to add extra -* // headers, (eg. Mime-Version) before sending. -* -* $email = $message->encode(); -* $email['headers'][] = 'Mime-Version: 1.0'; -* -* -* Further examples are available at http://www.phpguru.org -* -* TODO: -* - Set encode() to return the $obj->encoded if encode() -* has already been run. Unless a flag is passed to specifically -* re-build the message. -* -* @author Richard Heyes <richard@phpguru.org> -* @version $Revision: 1.13 $ -* @package Mail -*/ - -class Mail_mimePart { - - /** - * The encoding type of this part - * @var string - */ - var $_encoding; - - /** - * An array of subparts - * @var array - */ - var $_subparts; - - /** - * The output of this part after being built - * @var string - */ - var $_encoded; - - /** - * Headers for this part - * @var array - */ - var $_headers; - - /** - * The body of this part (not encoded) - * @var string - */ - var $_body; - - /** - * Constructor. - * - * Sets up the object. - * - * @param $body - The body of the mime part if any. - * @param $params - An associative array of parameters: - * content_type - The content type for this part eg multipart/mixed - * encoding - The encoding to use, 7bit, 8bit, base64, or quoted-printable - * cid - Content ID to apply - * disposition - Content disposition, inline or attachment - * dfilename - Optional filename parameter for content disposition - * description - Content description - * charset - Character set to use - * @access public - */ - function Mail_mimePart($body = '', $params = array()) - { - if (!defined('MAIL_MIMEPART_CRLF')) { - define('MAIL_MIMEPART_CRLF', defined('MAIL_MIME_CRLF') ? MAIL_MIME_CRLF : "\r\n", TRUE); - } - - foreach ($params as $key => $value) { - switch ($key) { - case 'content_type': - $headers['Content-Type'] = $value . (isset($charset) ? '; charset="' . $charset . '"' : ''); - break; - - case 'encoding': - $this->_encoding = $value; - $headers['Content-Transfer-Encoding'] = $value; - break; - - case 'cid': - $headers['Content-ID'] = '<' . $value . '>'; - break; - - case 'disposition': - $headers['Content-Disposition'] = $value . (isset($dfilename) ? '; filename="' . $dfilename . '"' : ''); - break; - - case 'dfilename': - if (isset($headers['Content-Disposition'])) { - $headers['Content-Disposition'] .= '; filename="' . $value . '"'; - } else { - $dfilename = $value; - } - break; - - case 'description': - $headers['Content-Description'] = $value; - break; - - case 'charset': - if (isset($headers['Content-Type'])) { - $headers['Content-Type'] .= '; charset="' . $value . '"'; - } else { - $charset = $value; - } - break; - } - } - - // Default content-type - if (!isset($headers['Content-Type'])) { - $headers['Content-Type'] = 'text/plain'; - } - - //Default encoding - if (!isset($this->_encoding)) { - $this->_encoding = '7bit'; - } - - // Assign stuff to member variables - $this->_encoded = array(); - $this->_headers = $headers; - $this->_body = $body; - } - - /** - * encode() - * - * Encodes and returns the email. Also stores - * it in the encoded member variable - * - * @return An associative array containing two elements, - * body and headers. The headers element is itself - * an indexed array. - * @access public - */ - function encode() - { - $encoded =& $this->_encoded; - - if (!empty($this->_subparts)) { - srand((double)microtime()*1000000); - $boundary = '=_' . md5(rand() . microtime()); - $this->_headers['Content-Type'] .= ';' . MAIL_MIMEPART_CRLF . "\t" . 'boundary="' . $boundary . '"'; - - // Add body parts to $subparts - for ($i = 0; $i < count($this->_subparts); $i++) { - $headers = array(); - $tmp = $this->_subparts[$i]->encode(); - foreach ($tmp['headers'] as $key => $value) { - $headers[] = $key . ': ' . $value; - } - $subparts[] = implode(MAIL_MIMEPART_CRLF, $headers) . MAIL_MIMEPART_CRLF . MAIL_MIMEPART_CRLF . $tmp['body']; - } - - $encoded['body'] = '--' . $boundary . MAIL_MIMEPART_CRLF . - implode('--' . $boundary . MAIL_MIMEPART_CRLF, $subparts) . - '--' . $boundary.'--' . MAIL_MIMEPART_CRLF; - - } else { - $encoded['body'] = $this->_getEncodedData($this->_body, $this->_encoding) . MAIL_MIMEPART_CRLF; - } - - // Add headers to $encoded - $encoded['headers'] =& $this->_headers; - - return $encoded; - } - - /** - * &addSubPart() - * - * Adds a subpart to current mime part and returns - * a reference to it - * - * @param $body The body of the subpart, if any. - * @param $params The parameters for the subpart, same - * as the $params argument for constructor. - * @return A reference to the part you just added. It is - * crucial if using multipart/* in your subparts that - * you use =& in your script when calling this function, - * otherwise you will not be able to add further subparts. - * @access public - */ - function &addSubPart($body, $params) - { - $this->_subparts[] = new Mail_mimePart($body, $params); - return $this->_subparts[count($this->_subparts) - 1]; - } - - /** - * _getEncodedData() - * - * Returns encoded data based upon encoding passed to it - * - * @param $data The data to encode. - * @param $encoding The encoding type to use, 7bit, base64, - * or quoted-printable. - * @access private - */ - function _getEncodedData($data, $encoding) - { - switch ($encoding) { - case '8bit': - case '7bit': - return $data; - break; - - case 'quoted-printable': - return $this->_quotedPrintableEncode($data); - break; - - case 'base64': - return rtrim(chunk_split(base64_encode($data), 76, MAIL_MIMEPART_CRLF)); - break; - - default: - return $data; - } - } - - /** - * quoteadPrintableEncode() - * - * Encodes data to quoted-printable standard. - * - * @param $input The data to encode - * @param $line_max Optional max line length. Should - * not be more than 76 chars - * - * @access private - */ - function _quotedPrintableEncode($input , $line_max = 76) - { - $lines = preg_split("/\r?\n/", $input); - $eol = MAIL_MIMEPART_CRLF; - $escape = '='; - $output = ''; - - while(list(, $line) = each($lines)){ - - $linlen = strlen($line); - $newline = ''; - - for ($i = 0; $i < $linlen; $i++) { - $char = substr($line, $i, 1); - $dec = ord($char); - - if (($dec == 32) AND ($i == ($linlen - 1))){ // convert space at eol only - $char = '=20'; - - } elseif(($dec == 9) AND ($i == ($linlen - 1))) { // convert tab at eol only - $char = '=09'; - } elseif($dec == 9) { - ; // Do nothing if a tab. - } elseif(($dec == 61) OR ($dec < 32 ) OR ($dec > 126)) { - $char = $escape . strtoupper(sprintf('%02s', dechex($dec))); - } - - if ((strlen($newline) + strlen($char)) >= $line_max) { // MAIL_MIMEPART_CRLF is not counted - $output .= $newline . $escape . $eol; // soft line break; " =\r\n" is okay - $newline = ''; - } - $newline .= $char; - } // end of for - $output .= $newline . $eol; - } - $output = substr($output, 0, -1 * strlen($eol)); // Don't want last crlf - return $output; - } -} // End of class -?> diff --git a/inc/Mail/null.php b/inc/Mail/null.php deleted file mode 100644 index 982bfa45b6d652132a5219fb273d4327e505e856..0000000000000000000000000000000000000000 --- a/inc/Mail/null.php +++ /dev/null @@ -1,60 +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: Phil Kernick <philk@rotfl.com.au> | -// +----------------------------------------------------------------------+ -// -// $Id: null.php,v 1.2 2004/04/06 05:19:03 jon Exp $ -// - -/** - * Null implementation of the PEAR Mail:: interface. - * @access public - * @package Mail - * @version $Revision: 1.2 $ - */ -class Mail_null extends Mail { - - /** - * Implements Mail_null::send() function. Silently discards all - * mail. - * - * @param mixed $recipients Either a comma-seperated list of recipients - * (RFC822 compliant), or an array of recipients, - * each RFC822 valid. This may contain recipients not - * specified in the headers, for Bcc:, resending - * messages, etc. - * - * @param array $headers The array of headers to send with the mail, in an - * associative array, where the array key is the - * header name (ie, 'Subject'), and the array value - * is the header value (ie, 'test'). The header - * produced from those values would be 'Subject: - * test'. - * - * @param string $body The full text of the message body, including any - * Mime parts, etc. - * - * @return mixed Returns true on success, or a PEAR_Error - * containing a descriptive error message on - * failure. - * @access public - */ - function send($recipients, $headers, $body) - { - return true; - } - -} diff --git a/inc/Mail/sendmail.php b/inc/Mail/sendmail.php deleted file mode 100644 index 39a43c25062ab3577cc17116f5679603c0bc79a9..0000000000000000000000000000000000000000 --- a/inc/Mail/sendmail.php +++ /dev/null @@ -1,145 +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: Chuck Hagenbuch <chuck@horde.org> | -// +----------------------------------------------------------------------+ - -/** - * Sendmail implementation of the PEAR Mail:: interface. - * @access public - * @package Mail - * @version $Revision: 1.10 $ - */ -class Mail_sendmail extends Mail { - - /** - * The location of the sendmail or sendmail wrapper binary on the - * filesystem. - * @var string - */ - var $sendmail_path = '/usr/sbin/sendmail'; - - /** - * Any extra command-line parameters to pass to the sendmail or - * sendmail wrapper binary. - * @var string - */ - var $sendmail_args = ''; - - /** - * Constructor. - * - * Instantiates a new Mail_sendmail:: object based on the parameters - * passed in. It looks for the following parameters: - * sendmail_path The location of the sendmail binary on the - * filesystem. Defaults to '/usr/sbin/sendmail'. - * - * sendmail_args Any extra parameters to pass to the sendmail - * or sendmail wrapper binary. - * - * If a parameter is present in the $params array, it replaces the - * default. - * - * @param array $params Hash containing any parameters different from the - * defaults. - * @access public - */ - function Mail_sendmail($params) - { - if (isset($params['sendmail_path'])) $this->sendmail_path = $params['sendmail_path']; - if (isset($params['sendmail_args'])) $this->sendmail_args = $params['sendmail_args']; - - /* - * Because we need to pass message headers to the sendmail program on - * the commandline, we can't guarantee the use of the standard "\r\n" - * separator. Instead, we use the system's native line separator. - */ - $this->sep = (strstr(PHP_OS, 'WIN')) ? "\r\n" : "\n"; - } - - /** - * Implements Mail::send() function using the sendmail - * command-line binary. - * - * @param mixed $recipients Either a comma-seperated list of recipients - * (RFC822 compliant), or an array of recipients, - * each RFC822 valid. This may contain recipients not - * specified in the headers, for Bcc:, resending - * messages, etc. - * - * @param array $headers The array of headers to send with the mail, in an - * associative array, where the array key is the - * header name (ie, 'Subject'), and the array value - * is the header value (ie, 'test'). The header - * produced from those values would be 'Subject: - * test'. - * - * @param string $body The full text of the message body, including any - * Mime parts, etc. - * - * @return mixed Returns true on success, or a PEAR_Error - * containing a descriptive error message on - * failure. - * @access public - */ - function send($recipients, $headers, $body) - { - $recipients = $this->parseRecipients($recipients); - if (PEAR::isError($recipients)) { - return $recipients; - } - $recipients = escapeShellCmd(implode(' ', $recipients)); - - $headerElements = $this->prepareHeaders($headers); - if (PEAR::isError($headerElements)) { - return $headerElements; - } - list($from, $text_headers) = $headerElements; - - if (!isset($from)) { - return PEAR::raiseError('No from address given.'); - } elseif (strstr($from, ' ') || - strstr($from, ';') || - strstr($from, '&') || - strstr($from, '`')) { - return PEAR::raiseError('From address specified with dangerous characters.'); - } - - $result = 0; - if (@is_file($this->sendmail_path)) { - $from = escapeShellCmd($from); - $mail = popen($this->sendmail_path . (!empty($this->sendmail_args) ? ' ' . $this->sendmail_args : '') . " -f$from -- $recipients", 'w'); - fputs($mail, $text_headers); - fputs($mail, $this->sep); // newline to end the headers section - fputs($mail, $body); - $result = pclose($mail); - if (version_compare(phpversion(), '4.2.3') == -1) { - // With older php versions, we need to shift the - // pclose result to get the exit code. - $result = $result >> 8 & 0xFF; - } - } else { - return PEAR::raiseError('sendmail [' . $this->sendmail_path . '] is not a valid file'); - } - - if ($result != 0) { - return PEAR::raiseError('sendmail returned error code ' . $result, - $result); - } - - return true; - } - -} diff --git a/inc/Mail/smtp.php b/inc/Mail/smtp.php deleted file mode 100644 index 40686a6168904831fe74bd94c1e8a5ee30d15c52..0000000000000000000000000000000000000000 --- a/inc/Mail/smtp.php +++ /dev/null @@ -1,223 +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: Chuck Hagenbuch <chuck@horde.org> | -// | Jon Parise <jon@php.net> | -// +----------------------------------------------------------------------+ - -/** - * SMTP implementation of the PEAR Mail:: interface. Requires the PEAR - * Net_SMTP:: class. - * @access public - * @package Mail - * @version $Revision: 1.20 $ - */ -class Mail_smtp extends Mail { - - /** - * The SMTP host to connect to. - * @var string - */ - var $host = 'localhost'; - - /** - * The port the SMTP server is on. - * @var integer - */ - var $port = 25; - - /** - * Should SMTP authentication be used? - * - * This value may be set to true, false or the name of a specific - * authentication method. - * - * If the value is set to true, the Net_SMTP package will attempt to use - * the best authentication method advertised by the remote SMTP server. - * - * @var mixed - */ - var $auth = false; - - /** - * The username to use if the SMTP server requires authentication. - * @var string - */ - var $username = ''; - - /** - * The password to use if the SMTP server requires authentication. - * @var string - */ - var $password = ''; - - /** - * Hostname or domain that will be sent to the remote SMTP server in the - * HELO / EHLO message. - * - * @var string - */ - var $localhost = 'localhost'; - - /** - * SMTP connection timeout value. NULL indicates no timeout. - * - * @var integer - */ - var $timeout = null; - - /** - * Whether to use VERP or not. If not a boolean, the string value - * will be used as the VERP separators. - * - * @var mixed boolean or string - */ - var $verp = false; - - /** - * Turn on Net_SMTP debugging? - * - * @var boolean $debug - */ - var $debug = false; - - /** - * Constructor. - * - * Instantiates a new Mail_smtp:: object based on the parameters - * passed in. It looks for the following parameters: - * host The server to connect to. Defaults to localhost. - * port The port to connect to. Defaults to 25. - * auth SMTP authentication. Defaults to none. - * username The username to use for SMTP auth. No default. - * password The password to use for SMTP auth. No default. - * localhost The local hostname / domain. Defaults to localhost. - * timeout The SMTP connection timeout. Defaults to none. - * verp Whether to use VERP or not. Defaults to false. - * debug Activate SMTP debug mode? Defaults to false. - * - * If a parameter is present in the $params array, it replaces the - * default. - * - * @param array Hash containing any parameters different from the - * defaults. - * @access public - */ - function Mail_smtp($params) - { - if (isset($params['host'])) $this->host = $params['host']; - if (isset($params['port'])) $this->port = $params['port']; - if (isset($params['auth'])) $this->auth = $params['auth']; - if (isset($params['username'])) $this->username = $params['username']; - if (isset($params['password'])) $this->password = $params['password']; - if (isset($params['localhost'])) $this->localhost = $params['localhost']; - if (isset($params['timeout'])) $this->timeout = $params['timeout']; - if (isset($params['verp'])) $this->verp = $params['verp']; - if (isset($params['debug'])) $this->debug = (boolean)$params['debug']; - } - - /** - * Implements Mail::send() function using SMTP. - * - * @param mixed $recipients Either a comma-seperated list of recipients - * (RFC822 compliant), or an array of recipients, - * each RFC822 valid. This may contain recipients not - * specified in the headers, for Bcc:, resending - * messages, etc. - * - * @param array $headers The array of headers to send with the mail, in an - * associative array, where the array key is the - * header name (e.g., 'Subject'), and the array value - * is the header value (e.g., 'test'). The header - * produced from those values would be 'Subject: - * test'. - * - * @param string $body The full text of the message body, including any - * Mime parts, etc. - * - * @return mixed Returns true on success, or a PEAR_Error - * containing a descriptive error message on - * failure. - * @access public - */ - function send($recipients, $headers, $body) - { - include_once 'Net/SMTP.php'; - - if (!($smtp = &new Net_SMTP($this->host, $this->port, $this->localhost))) { - return PEAR::raiseError('unable to instantiate Net_SMTP object'); - } - - if ($this->debug) { - $smtp->setDebug(true); - } - - if (PEAR::isError($smtp->connect($this->timeout))) { - return PEAR::raiseError('unable to connect to smtp server ' . - $this->host . ':' . $this->port); - } - - if ($this->auth) { - $method = is_string($this->auth) ? $this->auth : ''; - - if (PEAR::isError($smtp->auth($this->username, $this->password, - $method))) { - return PEAR::raiseError('unable to authenticate to smtp server'); - } - } - - $headerElements = $this->prepareHeaders($headers); - if (PEAR::isError($headerElements)) { - return $headerElements; - } - list($from, $text_headers) = $headerElements; - - /* Since few MTAs are going to allow this header to be forged - * unless it's in the MAIL FROM: exchange, we'll use - * Return-Path instead of From: if it's set. */ - if (!empty($headers['Return-Path'])) { - $from = $headers['Return-Path']; - } - - if (!isset($from)) { - return PEAR::raiseError('No from address given'); - } - - $args['verp'] = $this->verp; - if (PEAR::isError($smtp->mailFrom($from, $args))) { - return PEAR::raiseError('unable to set sender to [' . $from . ']'); - } - - $recipients = $this->parseRecipients($recipients); - if (PEAR::isError($recipients)) { - return $recipients; - } - - foreach ($recipients as $recipient) { - if (PEAR::isError($res = $smtp->rcptTo($recipient))) { - return PEAR::raiseError('unable to add recipient [' . - $recipient . ']: ' . $res->getMessage()); - } - } - - if (PEAR::isError($smtp->data($text_headers . "\r\n" . $body))) { - return PEAR::raiseError('unable to send data'); - } - - $smtp->disconnect(); - return true; - } - -} diff --git a/inc/Mail/xmail.dtd b/inc/Mail/xmail.dtd deleted file mode 100644 index 9f42ca8b3312fb8a7a55d7a244ddd2f4ddd43932..0000000000000000000000000000000000000000 --- a/inc/Mail/xmail.dtd +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> - -<!ENTITY lt "&#60;"> -<!ENTITY gt ">"> -<!ENTITY amp "&#38;"> -<!ENTITY apos "'"> -<!ENTITY quot """> -<!ENTITY crlf " "> - -<!ELEMENT email (header+, (body | mimepart+))> -<!ELEMENT mimepart (header+, (body | mimepart+))> -<!ELEMENT body (#PCDATA)> -<!ELEMENT header ((headername|headervalue|parameter)*)> -<!ELEMENT headername (#PCDATA)> -<!ELEMENT headervalue (#PCDATA)> -<!ELEMENT parameter ((paramname|paramvalue)+)> -<!ELEMENT paramvalue (#PCDATA)> -<!ELEMENT paramname (#PCDATA)> - diff --git a/inc/Mail/xmail.xsl b/inc/Mail/xmail.xsl deleted file mode 100644 index 0b948913f84d47ea816a8ad42b59bd692efb73b3..0000000000000000000000000000000000000000 --- a/inc/Mail/xmail.xsl +++ /dev/null @@ -1,70 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"> -<xsl:output method="text" omit-xml-declaration="yes" indent="no"/> -<xsl:preserve-space elements="headervalue paramvalue body"/> - - <xsl:template name="mimepart"> - - <xsl:variable name="boundary"> - <xsl:for-each select="./header"> - <xsl:if test="string(./headername) = 'Content-Type'"> - <xsl:for-each select="./parameter"> - <xsl:if test="string(./paramname) = 'boundary'"> - <xsl:value-of select="paramvalue"/> - </xsl:if> - </xsl:for-each> - </xsl:if> - </xsl:for-each> - </xsl:variable> - - <xsl:for-each select="header"> - - <xsl:value-of select="headername"/> - <xsl:text>: </xsl:text> - <xsl:value-of select="headervalue"/> - - <xsl:if test="count(./parameter) = 0"> - <xsl:text> </xsl:text> - </xsl:if> - - <xsl:for-each select="parameter"> - <xsl:text>; 	</xsl:text> - <xsl:value-of select="paramname"/> - <xsl:text>="</xsl:text> - <xsl:value-of select="paramvalue"/> - <xsl:text>"</xsl:text> - </xsl:for-each> - - <xsl:if test="count(./parameter) > 0"> - <xsl:text> </xsl:text> - </xsl:if> - - </xsl:for-each> - - <xsl:text> </xsl:text> - - <!-- Which to do, print a body or process subparts? --> - <xsl:choose> - <xsl:when test="count(./mimepart) = 0"> - <xsl:value-of select="body"/> - <xsl:text> </xsl:text> - </xsl:when> - - <xsl:otherwise> - <xsl:for-each select="mimepart"> - <xsl:text>--</xsl:text><xsl:value-of select="$boundary"/><xsl:text> </xsl:text> - <xsl:call-template name="mimepart"/> - </xsl:for-each> - - <xsl:text>--</xsl:text><xsl:value-of select="$boundary"/><xsl:text>-- </xsl:text> - - </xsl:otherwise> - </xsl:choose> - </xsl:template> - -<!-- This is where the stylesheet really starts, matching the top level email element --> - <xsl:template match="email"> - <xsl:call-template name="mimepart"/> - </xsl:template> - -</xsl:stylesheet> \ No newline at end of file diff --git a/inc/Net/SMTP.php b/inc/Net/SMTP.php deleted file mode 100644 index 71dcb5e9bef3fd0d8df2aa2a56f486138dcb9a65..0000000000000000000000000000000000000000 --- a/inc/Net/SMTP.php +++ /dev/null @@ -1,970 +0,0 @@ -<?php -/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */ -// +----------------------------------------------------------------------+ -// | 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: Chuck Hagenbuch <chuck@horde.org> | -// | Jon Parise <jon@php.net> | -// | Damian Alejandro Fernandez Sosa <damlists@cnba.uba.ar> | -// +----------------------------------------------------------------------+ - -require_once 'PEAR.php'; -require_once 'Net/Socket.php'; - -/** - * Provides an implementation of the SMTP protocol using PEAR's - * Net_Socket:: class. - * - * @package Net_SMTP - * @author Chuck Hagenbuch <chuck@horde.org> - * @author Jon Parise <jon@php.net> - * @author Damian Alejandro Fernandez Sosa <damlists@cnba.uba.ar> - * - * @example basic.php A basic implementation of the Net_SMTP package. - */ -class Net_SMTP -{ - /** - * The server to connect to. - * @var string - * @access public - */ - var $host = 'localhost'; - - /** - * The port to connect to. - * @var int - * @access public - */ - var $port = 25; - - /** - * The value to give when sending EHLO or HELO. - * @var string - * @access public - */ - var $localhost = 'localhost'; - - /** - * List of supported authentication methods, in preferential order. - * @var array - * @access public - */ - var $auth_methods = array('DIGEST-MD5', 'CRAM-MD5', 'LOGIN', 'PLAIN'); - - /** - * Should debugging output be enabled? - * @var boolean - * @access private - */ - var $_debug = false; - - /** - * The socket resource being used to connect to the SMTP server. - * @var resource - * @access private - */ - var $_socket = null; - - /** - * The most recent server response code. - * @var int - * @access private - */ - var $_code = -1; - - /** - * The most recent server response arguments. - * @var array - * @access private - */ - var $_arguments = array(); - - /** - * Stores detected features of the SMTP server. - * @var array - * @access private - */ - var $_esmtp = array(); - - /** - * Instantiates a new Net_SMTP object, overriding any defaults - * with parameters that are passed in. - * - * @param string The server to connect to. - * @param int The port to connect to. - * @param string The value to give when sending EHLO or HELO. - * - * @access public - * @since 1.0 - */ - function Net_SMTP($host = null, $port = null, $localhost = null) - { - if (isset($host)) $this->host = $host; - if (isset($port)) $this->port = $port; - if (isset($localhost)) $this->localhost = $localhost; - - $this->_socket = new Net_Socket(); - - /* - * Include the Auth_SASL package. If the package is not available, - * we disable the authentication methods that depend upon it. - */ - if ((@include_once 'Auth/SASL.php') === false) { - $pos = array_search('DIGEST-MD5', $this->auth_methods); - unset($this->auth_methods[$pos]); - $pos = array_search('CRAM-MD5', $this->auth_methods); - unset($this->auth_methods[$pos]); - } - } - - /** - * Set the value of the debugging flag. - * - * @param boolean $debug New value for the debugging flag. - * - * @access public - * @since 1.1.0 - */ - function setDebug($debug) - { - $this->_debug = $debug; - } - - /** - * Send the given string of data to the server. - * - * @param string $data The string of data to send. - * - * @return mixed True on success or a PEAR_Error object on failure. - * - * @access private - * @since 1.1.0 - */ - function _send($data) - { - if ($this->_debug) { - echo "DEBUG: Send: $data\n"; - } - - if (PEAR::isError($error = $this->_socket->write($data))) { - return new PEAR_Error('Failed to write to socket: ' . - $error->getMessage()); - } - - return true; - } - - /** - * Send a command to the server with an optional string of arguments. - * A carriage return / linefeed (CRLF) sequence will be appended to each - * command string before it is sent to the SMTP server. - * - * @param string $command The SMTP command to send to the server. - * @param string $args A string of optional arguments to append - * to the command. - * - * @return mixed The result of the _send() call. - * - * @access private - * @since 1.1.0 - */ - function _put($command, $args = '') - { - if (!empty($args)) { - return $this->_send($command . ' ' . $args . "\r\n"); - } - - return $this->_send($command . "\r\n"); - } - - /** - * Read a reply from the SMTP server. The reply consists of a response - * code and a response message. - * - * @param mixed $valid The set of valid response codes. These - * may be specified as an array of integer - * values or as a single integer value. - * - * @return mixed True if the server returned a valid response code or - * a PEAR_Error object is an error condition is reached. - * - * @access private - * @since 1.1.0 - * - * @see getResponse - */ - function _parseResponse($valid) - { - $this->_code = -1; - $this->_arguments = array(); - - while ($line = $this->_socket->readLine()) { - if ($this->_debug) { - echo "DEBUG: Recv: $line\n"; - } - - /* If we receive an empty line, the connection has been closed. */ - if (empty($line)) { - $this->disconnect(); - return new PEAR_Error("Connection was unexpectedly closed"); - } - - /* Read the code and store the rest in the arguments array. */ - $code = substr($line, 0, 3); - $this->_arguments[] = trim(substr($line, 4)); - - /* Check the syntax of the response code. */ - if (is_numeric($code)) { - $this->_code = (int)$code; - } else { - $this->_code = -1; - break; - } - - /* If this is not a multiline response, we're done. */ - if (substr($line, 3, 1) != '-') { - break; - } - } - - /* Compare the server's response code with the valid code. */ - if (is_int($valid) && ($this->_code === $valid)) { - return true; - } - - /* If we were given an array of valid response codes, check each one. */ - if (is_array($valid)) { - foreach ($valid as $valid_code) { - if ($this->_code === $valid_code) { - return true; - } - } - } - - return new PEAR_Error("Invalid response code received from server"); - } - - /** - * Return a 2-tuple containing the last response from the SMTP server. - * - * @return array A two-element array: the first element contains the - * response code as an integer and the second element - * contains the response's arguments as a string. - * - * @access public - * @since 1.1.0 - */ - function getResponse() - { - return array($this->_code, join("\n", $this->_arguments)); - } - - /** - * Attempt to connect to the SMTP server. - * - * @param int $timeout The timeout value (in seconds) for the - * socket connection. - * @param bool $persistent Should a persistent socket connection - * be used? - * - * @return mixed Returns a PEAR_Error with an error message on any - * kind of failure, or true on success. - * @access public - * @since 1.0 - */ - function connect($timeout = null, $persistent = false) - { - $result = $this->_socket->connect($this->host, $this->port, - $persistent, $timeout); - if (PEAR::isError($result)) { - return new PEAR_Error('Failed to connect socket: ' . - $result->getMessage()); - } - - if (PEAR::isError($error = $this->_parseResponse(220))) { - return $error; - } - if (PEAR::isError($error = $this->_negotiate())) { - return $error; - } - - return true; - } - - /** - * Attempt to disconnect from the SMTP server. - * - * @return mixed Returns a PEAR_Error with an error message on any - * kind of failure, or true on success. - * @access public - * @since 1.0 - */ - function disconnect() - { - if (PEAR::isError($error = $this->_put('QUIT'))) { - return $error; - } - if (PEAR::isError($error = $this->_parseResponse(221))) { - return $error; - } - if (PEAR::isError($error = $this->_socket->disconnect())) { - return new PEAR_Error('Failed to disconnect socket: ' . - $error->getMessage()); - } - - return true; - } - - /** - * Attempt to send the EHLO command and obtain a list of ESMTP - * extensions available, and failing that just send HELO. - * - * @return mixed Returns a PEAR_Error with an error message on any - * kind of failure, or true on success. - * - * @access private - * @since 1.1.0 - */ - function _negotiate() - { - if (PEAR::isError($error = $this->_put('EHLO', $this->localhost))) { - return $error; - } - - if (PEAR::isError($this->_parseResponse(250))) { - /* If we receive a 503 response, we're already authenticated. */ - if ($this->_code === 503) { - return true; - } - - /* If the EHLO failed, try the simpler HELO command. */ - if (PEAR::isError($error = $this->_put('HELO', $this->localhost))) { - return $error; - } - if (PEAR::isError($this->_parseResponse(250))) { - return new PEAR_Error('HELO was not accepted: ', $this->_code); - } - - return true; - } - - foreach ($this->_arguments as $argument) { - $verb = strtok($argument, ' '); - $arguments = substr($argument, strlen($verb) + 1, - strlen($argument) - strlen($verb) - 1); - $this->_esmtp[$verb] = $arguments; - } - - return true; - } - - /** - * Returns the name of the best authentication method that the server - * has advertised. - * - * @return mixed Returns a string containing the name of the best - * supported authentication method or a PEAR_Error object - * if a failure condition is encountered. - * @access private - * @since 1.1.0 - */ - function _getBestAuthMethod() - { - $available_methods = explode(' ', $this->_esmtp['AUTH']); - - foreach ($this->auth_methods as $method) { - if (in_array($method, $available_methods)) { - return $method; - } - } - - return new PEAR_Error('No supported authentication methods'); - } - - /** - * Attempt to do SMTP authentication. - * - * @param string The userid to authenticate as. - * @param string The password to authenticate with. - * @param string The requested authentication method. If none is - * specified, the best supported method will be used. - * - * @return mixed Returns a PEAR_Error with an error message on any - * kind of failure, or true on success. - * @access public - * @since 1.0 - */ - function auth($uid, $pwd , $method = '') - { - if (empty($this->_esmtp['AUTH'])) { - return new PEAR_Error('SMTP server does no support authentication'); - } - - /* - * If no method has been specified, get the name of the best supported - * method advertised by the SMTP server. - */ - if (empty($method)) { - if (PEAR::isError($method = $this->_getBestAuthMethod())) { - /* Return the PEAR_Error object from _getBestAuthMethod(). */ - return $method; - } - } else { - $method = strtoupper($method); - if (!in_array($method, $this->auth_methods)) { - return new PEAR_Error("$method is not a supported authentication method"); - } - } - - switch ($method) { - case 'DIGEST-MD5': - $result = $this->_authDigest_MD5($uid, $pwd); - break; - case 'CRAM-MD5': - $result = $this->_authCRAM_MD5($uid, $pwd); - break; - case 'LOGIN': - $result = $this->_authLogin($uid, $pwd); - break; - case 'PLAIN': - $result = $this->_authPlain($uid, $pwd); - break; - default: - $result = new PEAR_Error("$method is not a supported authentication method"); - break; - } - - /* If an error was encountered, return the PEAR_Error object. */ - if (PEAR::isError($result)) { - return $result; - } - - /* RFC-2554 requires us to re-negotiate ESMTP after an AUTH. */ - if (PEAR::isError($error = $this->_negotiate())) { - return $error; - } - - return true; - } - - /** - * Authenticates the user using the DIGEST-MD5 method. - * - * @param string The userid to authenticate as. - * @param string The password to authenticate with. - * - * @return mixed Returns a PEAR_Error with an error message on any - * kind of failure, or true on success. - * @access private - * @since 1.1.0 - */ - function _authDigest_MD5($uid, $pwd) - { - if (PEAR::isError($error = $this->_put('AUTH', 'DIGEST-MD5'))) { - return $error; - } - /* 334: Continue authentication request */ - if (PEAR::isError($error = $this->_parseResponse(334))) { - /* 503: Error: already authenticated */ - if ($this->_code === 503) { - return true; - } - return $error; - } - - $challenge = base64_decode($this->_arguments[0]); - $digest = &Auth_SASL::factory('digestmd5'); - $auth_str = base64_encode($digest->getResponse($uid, $pwd, $challenge, - $this->host, "smtp")); - - if (PEAR::isError($error = $this->_put($auth_str))) { - return $error; - } - /* 334: Continue authentication request */ - if (PEAR::isError($error = $this->_parseResponse(334))) { - return $error; - } - - /* - * We don't use the protocol's third step because SMTP doesn't allow - * subsequent authentication, so we just silently ignore it. - */ - if (PEAR::isError($error = $this->_put(' '))) { - return $error; - } - /* 235: Authentication successful */ - if (PEAR::isError($error = $this->_parseResponse(235))) { - return $error; - } - } - - /** - * Authenticates the user using the CRAM-MD5 method. - * - * @param string The userid to authenticate as. - * @param string The password to authenticate with. - * - * @return mixed Returns a PEAR_Error with an error message on any - * kind of failure, or true on success. - * @access private - * @since 1.1.0 - */ - function _authCRAM_MD5($uid, $pwd) - { - if (PEAR::isError($error = $this->_put('AUTH', 'CRAM-MD5'))) { - return $error; - } - /* 334: Continue authentication request */ - if (PEAR::isError($error = $this->_parseResponse(334))) { - /* 503: Error: already authenticated */ - if ($this->_code === 503) { - return true; - } - return $error; - } - - $challenge = base64_decode($this->_arguments[0]); - $cram = &Auth_SASL::factory('crammd5'); - $auth_str = base64_encode($cram->getResponse($uid, $pwd, $challenge)); - - if (PEAR::isError($error = $this->_put($auth_str))) { - return $error; - } - - /* 235: Authentication successful */ - if (PEAR::isError($error = $this->_parseResponse(235))) { - return $error; - } - } - - /** - * Authenticates the user using the LOGIN method. - * - * @param string The userid to authenticate as. - * @param string The password to authenticate with. - * - * @return mixed Returns a PEAR_Error with an error message on any - * kind of failure, or true on success. - * @access private - * @since 1.1.0 - */ - function _authLogin($uid, $pwd) - { - if (PEAR::isError($error = $this->_put('AUTH', 'LOGIN'))) { - return $error; - } - /* 334: Continue authentication request */ - if (PEAR::isError($error = $this->_parseResponse(334))) { - /* 503: Error: already authenticated */ - if ($this->_code === 503) { - return true; - } - return $error; - } - - if (PEAR::isError($error = $this->_put(base64_encode($uid)))) { - return $error; - } - /* 334: Continue authentication request */ - if (PEAR::isError($error = $this->_parseResponse(334))) { - return $error; - } - - if (PEAR::isError($error = $this->_put(base64_encode($pwd)))) { - return $error; - } - - /* 235: Authentication successful */ - if (PEAR::isError($error = $this->_parseResponse(235))) { - return $error; - } - - return true; - } - - /** - * Authenticates the user using the PLAIN method. - * - * @param string The userid to authenticate as. - * @param string The password to authenticate with. - * - * @return mixed Returns a PEAR_Error with an error message on any - * kind of failure, or true on success. - * @access private - * @since 1.1.0 - */ - function _authPlain($uid, $pwd) - { - if (PEAR::isError($error = $this->_put('AUTH', 'PLAIN'))) { - return $error; - } - /* 334: Continue authentication request */ - if (PEAR::isError($error = $this->_parseResponse(334))) { - /* 503: Error: already authenticated */ - if ($this->_code === 503) { - return true; - } - return $error; - } - - $auth_str = base64_encode(chr(0) . $uid . chr(0) . $pwd); - - if (PEAR::isError($error = $this->_put($auth_str))) { - return $error; - } - - /* 235: Authentication successful */ - if (PEAR::isError($error = $this->_parseResponse(235))) { - return $error; - } - - return true; - } - - /** - * Send the HELO command. - * - * @param string The domain name to say we are. - * - * @return mixed Returns a PEAR_Error with an error message on any - * kind of failure, or true on success. - * @access public - * @since 1.0 - */ - function helo($domain) - { - if (PEAR::isError($error = $this->_put('HELO', $domain))) { - return $error; - } - if (PEAR::isError($error = $this->_parseResponse(250))) { - return $error; - } - - return true; - } - - /** - * Send the MAIL FROM: command. - * - * @param string The sender (reverse path) to set. - * - * @return mixed Returns a PEAR_Error with an error message on any - * kind of failure, or true on success. - * @access public - * @since 1.0 - */ - function mailFrom($sender) - { - if (PEAR::isError($error = $this->_put('MAIL', "FROM:<$sender>"))) { - return $error; - } - if (PEAR::isError($error = $this->_parseResponse(250))) { - return $error; - } - - return true; - } - - /** - * Send the RCPT TO: command. - * - * @param string The recipient (forward path) to add. - * - * @return mixed Returns a PEAR_Error with an error message on any - * kind of failure, or true on success. - * @access public - * @since 1.0 - */ - function rcptTo($recipient) - { - if (PEAR::isError($error = $this->_put('RCPT', "TO:<$recipient>"))) { - return $error; - } - if (PEAR::isError($error = $this->_parseResponse(array(250, 251)))) { - return $error; - } - - return true; - } - - /** - * Quote the data so that it meets SMTP standards. - * - * This is provided as a separate public function to facilitate easier - * overloading for the cases where it is desirable to customize the - * quoting behavior. - * - * @param string The message text to quote. The string must be passed - * by reference, and the text will be modified in place. - * - * @access public - * @since 1.2 - */ - function quotedata(&$data) - { - /* - * Change Unix (\n) and Mac (\r) linefeeds into Internet-standard CRLF - * (\r\n) linefeeds. - */ - $data = preg_replace("/([^\r]{1})\n/", "\\1\r\n", $data); - $data = preg_replace("/\n\n/", "\n\r\n", $data); - - /* - * Because a single leading period (.) signifies an end to the data, - * legitimate leading periods need to be "doubled" (e.g. '..'). - */ - $data = preg_replace("/\n\./", "\n..", $data); - } - - /** - * Send the DATA command. - * - * @param string The message body to send. - * - * @return mixed Returns a PEAR_Error with an error message on any - * kind of failure, or true on success. - * @access public - * @since 1.0 - */ - function data($data) - { - /* - * RFC 1870, section 3, subsection 3 states "a value of zero indicates - * that no fixed maximum message size is in force". Furthermore, it - * says that if "the parameter is omitted no information is conveyed - * about the server's fixed maximum message size". - */ - if (isset($this->_esmtp['SIZE']) && ($this->_esmtp['SIZE'] > 0)) { - if (strlen($data) >= $this->_esmtp['SIZE']) { - $this->disconnect(); - return new PEAR_Error('Message size excedes the server limit'); - } - } - - /* Quote the data based on the SMTP standards. */ - $this->quotedata($data); - - if (PEAR::isError($error = $this->_put('DATA'))) { - return $error; - } - if (PEAR::isError($error = $this->_parseResponse(354))) { - return $error; - } - - if (PEAR::isError($this->_send($data . "\r\n.\r\n"))) { - return new PEAR_Error('write to socket failed'); - } - if (PEAR::isError($error = $this->_parseResponse(250))) { - return $error; - } - - return true; - } - - /** - * Send the SEND FROM: command. - * - * @param string The reverse path to send. - * - * @return mixed Returns a PEAR_Error with an error message on any - * kind of failure, or true on success. - * @access public - * @since 1.2.6 - */ - function sendFrom($path) - { - if (PEAR::isError($error = $this->_put('SEND', "FROM:<$path>"))) { - return $error; - } - if (PEAR::isError($error = $this->_parseResponse(250))) { - return $error; - } - - return true; - } - - /** - * Backwards-compatibility wrapper for sendFrom(). - * - * @param string The reverse path to send. - * - * @return mixed Returns a PEAR_Error with an error message on any - * kind of failure, or true on success. - * - * @access public - * @since 1.0 - * @deprecated 1.2.6 - */ - function send_from($path) - { - return sendFrom($path); - } - - /** - * Send the SOML FROM: command. - * - * @param string The reverse path to send. - * - * @return mixed Returns a PEAR_Error with an error message on any - * kind of failure, or true on success. - * @access public - * @since 1.2.6 - */ - function somlFrom($path) - { - if (PEAR::isError($error = $this->_put('SOML', "FROM:<$path>"))) { - return $error; - } - if (PEAR::isError($error = $this->_parseResponse(250))) { - return $error; - } - - return true; - } - - /** - * Backwards-compatibility wrapper for somlFrom(). - * - * @param string The reverse path to send. - * - * @return mixed Returns a PEAR_Error with an error message on any - * kind of failure, or true on success. - * - * @access public - * @since 1.0 - * @deprecated 1.2.6 - */ - function soml_from($path) - { - return somlFrom($path); - } - - /** - * Send the SAML FROM: command. - * - * @param string The reverse path to send. - * - * @return mixed Returns a PEAR_Error with an error message on any - * kind of failure, or true on success. - * @access public - * @since 1.2.6 - */ - function samlFrom($path) - { - if (PEAR::isError($error = $this->_put('SAML', "FROM:<$path>"))) { - return $error; - } - if (PEAR::isError($error = $this->_parseResponse(250))) { - return $error; - } - - return true; - } - - /** - * Backwards-compatibility wrapper for samlFrom(). - * - * @param string The reverse path to send. - * - * @return mixed Returns a PEAR_Error with an error message on any - * kind of failure, or true on success. - * - * @access public - * @since 1.0 - * @deprecated 1.2.6 - */ - function saml_from($path) - { - return samlFrom($path); - } - - /** - * Send the RSET command. - * - * @return mixed Returns a PEAR_Error with an error message on any - * kind of failure, or true on success. - * @access public - * @since 1.0 - */ - function rset() - { - if (PEAR::isError($error = $this->_put('RSET'))) { - return $error; - } - if (PEAR::isError($error = $this->_parseResponse(250))) { - return $error; - } - - return true; - } - - /** - * Send the VRFY command. - * - * @param string The string to verify - * - * @return mixed Returns a PEAR_Error with an error message on any - * kind of failure, or true on success. - * @access public - * @since 1.0 - */ - function vrfy($string) - { - /* Note: 251 is also a valid response code */ - if (PEAR::isError($error = $this->_put('VRFY', $string))) { - return $error; - } - if (PEAR::isError($error = $this->_parseResponse(250))) { - return $error; - } - - return true; - } - - /** - * Send the NOOP command. - * - * @return mixed Returns a PEAR_Error with an error message on any - * kind of failure, or true on success. - * @access public - * @since 1.0 - */ - function noop() - { - if (PEAR::isError($error = $this->_put('NOOP'))) { - return $error; - } - if (PEAR::isError($error = $this->_parseResponse(250))) { - return $error; - } - - return true; - } - - /** - * Backwards-compatibility method. identifySender()'s functionality is - * now handled internally. - * - * @return boolean This method always return true. - * - * @access public - * @since 1.0 - */ - function identifySender() - { - return true; - } -} - -?> diff --git a/inc/Net/Socket.php b/inc/Net/Socket.php deleted file mode 100644 index 7c4ff1d4e21646ce33507dce2ad2a78e5c13831b..0000000000000000000000000000000000000000 --- a/inc/Net/Socket.php +++ /dev/null @@ -1,528 +0,0 @@ -<?php -// -// +----------------------------------------------------------------------+ -// | PHP Version 4 | -// +----------------------------------------------------------------------+ -// | Copyright (c) 1997-2003 The PHP Group | -// +----------------------------------------------------------------------+ -// | This source file is subject to version 2.0 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: Stig Bakken <ssb@php.net> | -// | Chuck Hagenbuch <chuck@horde.org> | -// +----------------------------------------------------------------------+ -// -// $Id: Socket.php,v 1.24 2005/02/03 20:40:16 chagenbu Exp $ - -require_once 'PEAR.php'; - -define('NET_SOCKET_READ', 1); -define('NET_SOCKET_WRITE', 2); -define('NET_SOCKET_ERROR', 3); - -/** - * Generalized Socket class. - * - * @version 1.1 - * @author Stig Bakken <ssb@php.net> - * @author Chuck Hagenbuch <chuck@horde.org> - */ -class Net_Socket extends PEAR { - - /** - * Socket file pointer. - * @var resource $fp - */ - var $fp = null; - - /** - * Whether the socket is blocking. Defaults to true. - * @var boolean $blocking - */ - var $blocking = true; - - /** - * Whether the socket is persistent. Defaults to false. - * @var boolean $persistent - */ - var $persistent = false; - - /** - * The IP address to connect to. - * @var string $addr - */ - var $addr = ''; - - /** - * The port number to connect to. - * @var integer $port - */ - var $port = 0; - - /** - * Number of seconds to wait on socket connections before assuming - * there's no more data. Defaults to no timeout. - * @var integer $timeout - */ - var $timeout = false; - - /** - * Number of bytes to read at a time in readLine() and - * readAll(). Defaults to 2048. - * @var integer $lineLength - */ - var $lineLength = 2048; - - /** - * Connect to the specified port. If called when the socket is - * already connected, it disconnects and connects again. - * - * @param string $addr IP address or host name. - * @param integer $port TCP port number. - * @param boolean $persistent (optional) Whether the connection is - * persistent (kept open between requests - * by the web server). - * @param integer $timeout (optional) How long to wait for data. - * @param array $options See options for stream_context_create. - * - * @access public - * - * @return boolean | PEAR_Error True on success or a PEAR_Error on failure. - */ - function connect($addr, $port = 0, $persistent = null, $timeout = null, $options = null) - { - if (is_resource($this->fp)) { - @fclose($this->fp); - $this->fp = null; - } - - if (!$addr) { - return $this->raiseError('$addr cannot be empty'); - } elseif (strspn($addr, '.0123456789') == strlen($addr) || - strstr($addr, '/') !== false) { - $this->addr = $addr; - } else { - $this->addr = @gethostbyname($addr); - } - - $this->port = $port % 65536; - - if ($persistent !== null) { - $this->persistent = $persistent; - } - - if ($timeout !== null) { - $this->timeout = $timeout; - } - - $openfunc = $this->persistent ? 'pfsockopen' : 'fsockopen'; - $errno = 0; - $errstr = ''; - if ($options && function_exists('stream_context_create')) { - if ($this->timeout) { - $timeout = $this->timeout; - } else { - $timeout = 0; - } - $context = stream_context_create($options); - $fp = @$openfunc($this->addr, $this->port, $errno, $errstr, $timeout, $context); - } else { - if ($this->timeout) { - $fp = @$openfunc($this->addr, $this->port, $errno, $errstr, $this->timeout); - } else { - $fp = @$openfunc($this->addr, $this->port, $errno, $errstr); - } - } - - if (!$fp) { - return $this->raiseError($errstr, $errno); - } - - $this->fp = $fp; - - return $this->setBlocking($this->blocking); - } - - /** - * Disconnects from the peer, closes the socket. - * - * @access public - * @return mixed true on success or an error object otherwise - */ - function disconnect() - { - if (!is_resource($this->fp)) { - return $this->raiseError('not connected'); - } - - @fclose($this->fp); - $this->fp = null; - return true; - } - - /** - * Find out if the socket is in blocking mode. - * - * @access public - * @return boolean The current blocking mode. - */ - function isBlocking() - { - return $this->blocking; - } - - /** - * Sets whether the socket connection should be blocking or - * not. A read call to a non-blocking socket will return immediately - * if there is no data available, whereas it will block until there - * is data for blocking sockets. - * - * @param boolean $mode True for blocking sockets, false for nonblocking. - * @access public - * @return mixed true on success or an error object otherwise - */ - function setBlocking($mode) - { - if (!is_resource($this->fp)) { - return $this->raiseError('not connected'); - } - - $this->blocking = $mode; - socket_set_blocking($this->fp, $this->blocking); - return true; - } - - /** - * Sets the timeout value on socket descriptor, - * expressed in the sum of seconds and microseconds - * - * @param integer $seconds Seconds. - * @param integer $microseconds Microseconds. - * @access public - * @return mixed true on success or an error object otherwise - */ - function setTimeout($seconds, $microseconds) - { - if (!is_resource($this->fp)) { - return $this->raiseError('not connected'); - } - - return socket_set_timeout($this->fp, $seconds, $microseconds); - } - - /** - * Returns information about an existing socket resource. - * Currently returns four entries in the result array: - * - * <p> - * timed_out (bool) - The socket timed out waiting for data<br> - * blocked (bool) - The socket was blocked<br> - * eof (bool) - Indicates EOF event<br> - * unread_bytes (int) - Number of bytes left in the socket buffer<br> - * </p> - * - * @access public - * @return mixed Array containing information about existing socket resource or an error object otherwise - */ - function getStatus() - { - if (!is_resource($this->fp)) { - return $this->raiseError('not connected'); - } - - return socket_get_status($this->fp); - } - - /** - * Get a specified line of data - * - * @access public - * @return $size bytes of data from the socket, or a PEAR_Error if - * not connected. - */ - function gets($size) - { - if (!is_resource($this->fp)) { - return $this->raiseError('not connected'); - } - - return @fgets($this->fp, $size); - } - - /** - * Read a specified amount of data. This is guaranteed to return, - * and has the added benefit of getting everything in one fread() - * chunk; if you know the size of the data you're getting - * beforehand, this is definitely the way to go. - * - * @param integer $size The number of bytes to read from the socket. - * @access public - * @return $size bytes of data from the socket, or a PEAR_Error if - * not connected. - */ - function read($size) - { - if (!is_resource($this->fp)) { - return $this->raiseError('not connected'); - } - - return @fread($this->fp, $size); - } - - /** - * Write a specified amount of data. - * - * @param string $data Data to write. - * @param integer $blocksize Amount of data to write at once. - * NULL means all at once. - * - * @access public - * @return mixed true on success or an error object otherwise - */ - function write($data, $blocksize = null) - { - if (!is_resource($this->fp)) { - return $this->raiseError('not connected'); - } - - if (is_null($blocksize) && !OS_WINDOWS) { - return fwrite($this->fp, $data); - } else { - if (is_null($blocksize)) { - $blocksize = 1024; - } - - $pos = 0; - $size = strlen($data); - while ($pos < $size) { - $written = @fwrite($this->fp, substr($data, $pos, $blocksize)); - if ($written === false) { - return false; - } - $pos += $written; - } - - return $pos; - } - } - - /** - * Write a line of data to the socket, followed by a trailing "\r\n". - * - * @access public - * @return mixed fputs result, or an error - */ - function writeLine($data) - { - if (!is_resource($this->fp)) { - return $this->raiseError('not connected'); - } - - return fwrite($this->fp, $data . "\r\n"); - } - - /** - * Tests for end-of-file on a socket descriptor. - * - * @access public - * @return bool - */ - function eof() - { - return (is_resource($this->fp) && feof($this->fp)); - } - - /** - * Reads a byte of data - * - * @access public - * @return 1 byte of data from the socket, or a PEAR_Error if - * not connected. - */ - function readByte() - { - if (!is_resource($this->fp)) { - return $this->raiseError('not connected'); - } - - return ord(@fread($this->fp, 1)); - } - - /** - * Reads a word of data - * - * @access public - * @return 1 word of data from the socket, or a PEAR_Error if - * not connected. - */ - function readWord() - { - if (!is_resource($this->fp)) { - return $this->raiseError('not connected'); - } - - $buf = @fread($this->fp, 2); - return (ord($buf[0]) + (ord($buf[1]) << 8)); - } - - /** - * Reads an int of data - * - * @access public - * @return integer 1 int of data from the socket, or a PEAR_Error if - * not connected. - */ - function readInt() - { - if (!is_resource($this->fp)) { - return $this->raiseError('not connected'); - } - - $buf = @fread($this->fp, 4); - return (ord($buf[0]) + (ord($buf[1]) << 8) + - (ord($buf[2]) << 16) + (ord($buf[3]) << 24)); - } - - /** - * Reads a zero-terminated string of data - * - * @access public - * @return string, or a PEAR_Error if - * not connected. - */ - function readString() - { - if (!is_resource($this->fp)) { - return $this->raiseError('not connected'); - } - - $string = ''; - while (($char = @fread($this->fp, 1)) != "\x00") { - $string .= $char; - } - return $string; - } - - /** - * Reads an IP Address and returns it in a dot formated string - * - * @access public - * @return Dot formated string, or a PEAR_Error if - * not connected. - */ - function readIPAddress() - { - if (!is_resource($this->fp)) { - return $this->raiseError('not connected'); - } - - $buf = @fread($this->fp, 4); - return sprintf("%s.%s.%s.%s", ord($buf[0]), ord($buf[1]), - ord($buf[2]), ord($buf[3])); - } - - /** - * Read until either the end of the socket or a newline, whichever - * comes first. Strips the trailing newline from the returned data. - * - * @access public - * @return All available data up to a newline, without that - * newline, or until the end of the socket, or a PEAR_Error if - * not connected. - */ - function readLine() - { - if (!is_resource($this->fp)) { - return $this->raiseError('not connected'); - } - - $line = ''; - $timeout = time() + $this->timeout; - while (!feof($this->fp) && (!$this->timeout || time() < $timeout)) { - $line .= @fgets($this->fp, $this->lineLength); - if (substr($line, -1) == "\n") { - return rtrim($line, "\r\n"); - } - } - return $line; - } - - /** - * Read until the socket closes, or until there is no more data in - * the inner PHP buffer. If the inner buffer is empty, in blocking - * mode we wait for at least 1 byte of data. Therefore, in - * blocking mode, if there is no data at all to be read, this - * function will never exit (unless the socket is closed on the - * remote end). - * - * @access public - * - * @return string All data until the socket closes, or a PEAR_Error if - * not connected. - */ - function readAll() - { - if (!is_resource($this->fp)) { - return $this->raiseError('not connected'); - } - - $data = ''; - while (!feof($this->fp)) { - $data .= @fread($this->fp, $this->lineLength); - } - return $data; - } - - /** - * Runs the equivalent of the select() system call on the socket - * with a timeout specified by tv_sec and tv_usec. - * - * @param integer $state Which of read/write/error to check for. - * @param integer $tv_sec Number of seconds for timeout. - * @param integer $tv_usec Number of microseconds for timeout. - * - * @access public - * @return False if select fails, integer describing which of read/write/error - * are ready, or PEAR_Error if not connected. - */ - function select($state, $tv_sec, $tv_usec = 0) - { - if (!is_resource($this->fp)) { - return $this->raiseError('not connected'); - } - - $read = null; - $write = null; - $except = null; - if ($state & NET_SOCKET_READ) { - $read[] = $this->fp; - } - if ($state & NET_SOCKET_WRITE) { - $write[] = $this->fp; - } - if ($state & NET_SOCKET_ERROR) { - $except[] = $this->fp; - } - if (false === ($sr = stream_select($read, $write, $except, $tv_sec, $tv_usec))) { - return false; - } - - $result = 0; - if (count($read)) { - $result |= NET_SOCKET_READ; - } - if (count($write)) { - $result |= NET_SOCKET_WRITE; - } - if (count($except)) { - $result |= NET_SOCKET_ERROR; - } - return $result; - } - -} diff --git a/inc/OS/Guess.php b/inc/OS/Guess.php deleted file mode 100644 index a85bf360ebc06fe884f8fec9ba0cc65d834ec83d..0000000000000000000000000000000000000000 --- a/inc/OS/Guess.php +++ /dev/null @@ -1,287 +0,0 @@ -<?php -// -// +----------------------------------------------------------------------+ -// | PHP Version 5 | -// +----------------------------------------------------------------------+ -// | Copyright (c) 1997-2004 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. | -// +----------------------------------------------------------------------+ -// | Authors: Stig Bakken <ssb@php.net> | -// | | -// +----------------------------------------------------------------------+ -// -// $Id: Guess.php,v 1.13.4.1 2004/10/19 04:15:56 cellog Exp $ - -// {{{ uname examples - -// php_uname() without args returns the same as 'uname -a', or a PHP-custom -// string for Windows. -// PHP versions prior to 4.3 return the uname of the host where PHP was built, -// as of 4.3 it returns the uname of the host running the PHP code. -// -// PC RedHat Linux 7.1: -// Linux host.example.com 2.4.2-2 #1 Sun Apr 8 20:41:30 EDT 2001 i686 unknown -// -// PC Debian Potato: -// Linux host 2.4.17 #2 SMP Tue Feb 12 15:10:04 CET 2002 i686 unknown -// -// PC FreeBSD 3.3: -// FreeBSD host.example.com 3.3-STABLE FreeBSD 3.3-STABLE #0: Mon Feb 21 00:42:31 CET 2000 root@example.com:/usr/src/sys/compile/CONFIG i386 -// -// PC FreeBSD 4.3: -// FreeBSD host.example.com 4.3-RELEASE FreeBSD 4.3-RELEASE #1: Mon Jun 25 11:19:43 EDT 2001 root@example.com:/usr/src/sys/compile/CONFIG i386 -// -// PC FreeBSD 4.5: -// FreeBSD host.example.com 4.5-STABLE FreeBSD 4.5-STABLE #0: Wed Feb 6 23:59:23 CET 2002 root@example.com:/usr/src/sys/compile/CONFIG i386 -// -// PC FreeBSD 4.5 w/uname from GNU shellutils: -// FreeBSD host.example.com 4.5-STABLE FreeBSD 4.5-STABLE #0: Wed Feb i386 unknown -// -// HP 9000/712 HP-UX 10: -// HP-UX iq B.10.10 A 9000/712 2008429113 two-user license -// -// HP 9000/712 HP-UX 10 w/uname from GNU shellutils: -// HP-UX host B.10.10 A 9000/712 unknown -// -// IBM RS6000/550 AIX 4.3: -// AIX host 3 4 000003531C00 -// -// AIX 4.3 w/uname from GNU shellutils: -// AIX host 3 4 000003531C00 unknown -// -// SGI Onyx IRIX 6.5 w/uname from GNU shellutils: -// IRIX64 host 6.5 01091820 IP19 mips -// -// SGI Onyx IRIX 6.5: -// IRIX64 host 6.5 01091820 IP19 -// -// SparcStation 20 Solaris 8 w/uname from GNU shellutils: -// SunOS host.example.com 5.8 Generic_108528-12 sun4m sparc -// -// SparcStation 20 Solaris 8: -// SunOS host.example.com 5.8 Generic_108528-12 sun4m sparc SUNW,SPARCstation-20 -// -// Mac OS X (Darwin) -// Darwin home-eden.local 7.5.0 Darwin Kernel Version 7.5.0: Thu Aug 5 19:26:16 PDT 2004; root:xnu/xnu-517.7.21.obj~3/RELEASE_PPC Power Macintosh -// -// Mac OS X early versions -// - -// }}} - -/* TODO: - * - define endianness, to allow matchSignature("bigend") etc. - */ - -class OS_Guess -{ - var $sysname; - var $nodename; - var $cpu; - var $release; - var $extra; - - function OS_Guess($uname = null) - { - list($this->sysname, - $this->release, - $this->cpu, - $this->extra, - $this->nodename) = $this->parseSignature($uname); - } - - function parseSignature($uname = null) - { - static $sysmap = array( - 'HP-UX' => 'hpux', - 'IRIX64' => 'irix', - ); - static $cpumap = array( - 'i586' => 'i386', - 'i686' => 'i386', - 'ppc' => 'powerpc', - ); - if ($uname === null) { - $uname = php_uname(); - } - $parts = split('[[:space:]]+', trim($uname)); - $n = count($parts); - - $release = $machine = $cpu = ''; - $sysname = $parts[0]; - $nodename = $parts[1]; - $cpu = $parts[$n-1]; - $extra = ''; - if ($cpu == 'unknown') { - $cpu = $parts[$n-2]; - } - - switch ($sysname) { - case 'AIX': - $release = "$parts[3].$parts[2]"; - break; - case 'Windows': - switch ($parts[1]) { - case '95/98': - $release = '9x'; - break; - default: - $release = $parts[1]; - break; - } - $cpu = 'i386'; - break; - case 'Linux': - $extra = $this->_detectGlibcVersion(); - // use only the first two digits from the kernel version - $release = ereg_replace('^([[:digit:]]+\.[[:digit:]]+).*', '\1', $parts[2]); - break; - case 'Mac' : - $sysname = 'darwin'; - $nodename = $parts[2]; - $release = $parts[3]; - if ($cpu == 'Macintosh') { - if ($parts[$n - 2] == 'Power') { - $cpu = 'powerpc'; - } - } - break; - case 'Darwin' : - if ($cpu == 'Macintosh') { - if ($parts[$n - 2] == 'Power') { - $cpu = 'powerpc'; - } - } - $release = ereg_replace('^([[:digit:]]+\.[[:digit:]]+).*', '\1', $parts[2]); - break; - default: - $release = ereg_replace('-.*', '', $parts[2]); - break; - } - - - if (isset($sysmap[$sysname])) { - $sysname = $sysmap[$sysname]; - } else { - $sysname = strtolower($sysname); - } - if (isset($cpumap[$cpu])) { - $cpu = $cpumap[$cpu]; - } - return array($sysname, $release, $cpu, $extra, $nodename); - } - - function _detectGlibcVersion() - { - // Use glibc's <features.h> header file to - // get major and minor version number: - include_once "System.php"; - $tmpfile = System::mktemp("glibctest"); - $fp = fopen($tmpfile, "w"); - fwrite($fp, "#include <features.h>\n__GLIBC__ __GLIBC_MINOR__\n"); - fclose($fp); - $cpp = popen("/usr/bin/cpp $tmpfile", "r"); - $major = $minor = 0; - while ($line = fgets($cpp, 1024)) { - if ($line{0} == '#' || trim($line) == '') { - continue; - } - if (list($major, $minor) = explode(' ', trim($line))) { - break; - } - } - pclose($cpp); - unlink($tmpfile); - if (!($major && $minor) && is_link('/lib/libc.so.6')) { - // Let's try reading the libc.so.6 symlink - if (ereg('^libc-([.*])\.so$', basename(readlink('/lib/libc.so.6')), $matches)) { - list($major, $minor) = explode('.', $matches); - } - } - if (!($major && $minor)) { - return ''; - } - return "glibc{$major}.{$minor}"; - } - - function getSignature() - { - if (empty($this->extra)) { - return "{$this->sysname}-{$this->release}-{$this->cpu}"; - } - return "{$this->sysname}-{$this->release}-{$this->cpu}-{$this->extra}"; - } - - function getSysname() - { - return $this->sysname; - } - - function getNodename() - { - return $this->nodename; - } - - function getCpu() - { - return $this->cpu; - } - - function getRelease() - { - return $this->release; - } - - function getExtra() - { - return $this->extra; - } - - function matchSignature($match) - { - if (is_array($match)) { - $fragments = $match; - } else { - $fragments = explode('-', $match); - } - $n = count($fragments); - $matches = 0; - if ($n > 0) { - $matches += $this->_matchFragment($fragments[0], $this->sysname); - } - if ($n > 1) { - $matches += $this->_matchFragment($fragments[1], $this->release); - } - if ($n > 2) { - $matches += $this->_matchFragment($fragments[2], $this->cpu); - } - if ($n > 3) { - $matches += $this->_matchFragment($fragments[3], $this->extra); - } - return ($matches == $n); - } - - function _matchFragment($fragment, $value) - { - if (strcspn($fragment, '*?') < strlen($fragment)) { - $reg = '^' . str_replace(array('*', '?', '/'), array('.*', '.', '\\/'), $fragment) . '$'; - return eregi($reg, $value); - } - return ($fragment == '*' || !strcasecmp($fragment, $value)); - } - -} -/* - * Local Variables: - * indent-tabs-mode: nil - * c-basic-offset: 4 - * End: - */ -?> diff --git a/inc/PHPUnit.php b/inc/PHPUnit.php deleted file mode 100644 index de4da858eb984689b589e76be699bb2d80e2fa87..0000000000000000000000000000000000000000 --- a/inc/PHPUnit.php +++ /dev/null @@ -1,83 +0,0 @@ -<?php -// -// +------------------------------------------------------------------------+ -// | PEAR :: PHPUnit | -// +------------------------------------------------------------------------+ -// | Copyright (c) 2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>. | -// +------------------------------------------------------------------------+ -// | This source file is subject to version 3.00 of the PHP License, | -// | that is available at 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. | -// +------------------------------------------------------------------------+ -// -// $Id: PHPUnit.php,v 1.14 2004/12/22 08:06:11 sebastian Exp $ -// - -require_once 'PHPUnit/TestCase.php'; -require_once 'PHPUnit/TestResult.php'; -require_once 'PHPUnit/TestSuite.php'; - -/** - * PHPUnit runs a TestSuite and returns a TestResult object. - * - * Here is an example: - * - * <code> - * <?php - * require_once 'PHPUnit.php'; - * - * class MathTest extends PHPUnit_TestCase { - * var $fValue1; - * var $fValue2; - * - * function MathTest($name) { - * $this->PHPUnit_TestCase($name); - * } - * - * function setUp() { - * $this->fValue1 = 2; - * $this->fValue2 = 3; - * } - * - * function testAdd() { - * $this->assertTrue($this->fValue1 + $this->fValue2 == 5); - * } - * } - * - * $suite = new PHPUnit_TestSuite(); - * $suite->addTest(new MathTest('testAdd')); - * - * $result = PHPUnit::run($suite); - * print $result->toHTML(); - * ?> - * </code> - * - * Alternatively, you can pass a class name to the PHPUnit_TestSuite() - * constructor and let it automatically add all methods of that class - * that start with 'test' to the suite: - * - * <code> - * <?php - * $suite = new PHPUnit_TestSuite('MathTest'); - * $result = PHPUnit::run($suite); - * print $result->toHTML(); - * ?> - * </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 Testing - * @package PHPUnit - */ -class PHPUnit { - function &run(&$suite) { - $result = new PHPUnit_TestResult(); - $suite->run($result); - - return $result; - } -} -?> diff --git a/inc/PHPUnit/Assert.php b/inc/PHPUnit/Assert.php deleted file mode 100644 index 74806458bd326373ce917559ab07d51c964de35c..0000000000000000000000000000000000000000 --- a/inc/PHPUnit/Assert.php +++ /dev/null @@ -1,384 +0,0 @@ -<?php -// -// +------------------------------------------------------------------------+ -// | PEAR :: PHPUnit | -// +------------------------------------------------------------------------+ -// | Copyright (c) 2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>. | -// +------------------------------------------------------------------------+ -// | This source file is subject to version 3.00 of the PHP License, | -// | that is available at 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. | -// +------------------------------------------------------------------------+ -// -// $Id: Assert.php,v 1.25 2005/01/31 04:57:16 sebastian Exp $ -// - -/** - * A set of assert methods. - * - * @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 Testing - * @package PHPUnit - */ -class PHPUnit_Assert { - /** - * @var boolean - * @access private - */ - var $_looselyTyped = FALSE; - - /** - * Asserts that a haystack contains a needle. - * - * @param mixed - * @param mixed - * @param string - * @access public - * @since 1.1.0 - */ - function assertContains($needle, $haystack, $message = '') { - if (is_string($needle) && is_string($haystack)) { - $this->assertTrue(strpos($haystack, $needle) !== FALSE ? TRUE : FALSE); - } - - else if (is_array($haystack) && !is_object($needle)) { - $this->assertTrue(in_array($needle, $haystack), $message); - } - - else { - $this->fail('Unsupported parameter passed to assertContains().'); - } - } - - /** - * Asserts that a haystack does not contain a needle. - * - * @param mixed - * @param mixed - * @param string - * @access public - * @since 1.1.0 - */ - function assertNotContains($needle, $haystack, $message = '') { - if (is_string($needle) && is_string($haystack)) { - $this->assertFalse(strpos($haystack, $needle) !== FALSE ? TRUE : FALSE); - } - - else if (is_array($haystack) && !is_object($needle)) { - $this->assertFalse(in_array($needle, $haystack), $message); - } - - else { - $this->fail('Unsupported parameter passed to assertNotContains().'); - } - } - - /** - * Asserts that two variables are equal. - * - * @param mixed - * @param mixed - * @param string - * @param mixed - * @access public - */ - function assertEquals($expected, $actual, $message = '', $delta = 0) { - if ((is_array($actual) && is_array($expected)) || - (is_object($actual) && is_object($expected))) { - if (is_array($actual) && is_array($expected)) { - ksort($actual); - ksort($expected); - } - - if ($this->_looselyTyped) { - $actual = $this->_convertToString($actual); - $expected = $this->_convertToString($expected); - } - - $actual = serialize($actual); - $expected = serialize($expected); - - $message = sprintf( - '%sexpected %s, actual %s', - - !empty($message) ? $message . ' ' : '', - $expected, - $actual - ); - - if ($actual !== $expected) { - return $this->fail($message); - } - } - - elseif (is_numeric($actual) && is_numeric($expected)) { - $message = sprintf( - '%sexpected %s%s, actual %s', - - !empty($message) ? $message . ' ' : '', - $expected, - ($delta != 0) ? ('+/- ' . $delta) : '', - $actual - ); - - if (!($actual >= ($expected - $delta) && $actual <= ($expected + $delta))) { - return $this->fail($message); - } - } - - else { - $message = sprintf( - '%sexpected %s, actual %s', - - !empty($message) ? $message . ' ' : '', - $expected, - $actual - ); - - if ($actual !== $expected) { - return $this->fail($message); - } - } - } - - /** - * Asserts that two variables reference the same object. - * This requires the Zend Engine 2 to work. - * - * @param object - * @param object - * @param string - * @access public - * @deprecated - */ - function assertSame($expected, $actual, $message = '') { - if (!version_compare(phpversion(), '5.0.0', '>=')) { - $this->fail('assertSame() only works with PHP >= 5.0.0.'); - } - - if ((is_object($expected) || is_null($expected)) && - (is_object($actual) || is_null($actual))) { - $message = sprintf( - '%sexpected two variables to reference the same object', - - !empty($message) ? $message . ' ' : '' - ); - - if ($expected !== $actual) { - return $this->fail($message); - } - } else { - $this->fail('Unsupported parameter passed to assertSame().'); - } - } - - /** - * Asserts that two variables do not reference the same object. - * This requires the Zend Engine 2 to work. - * - * @param object - * @param object - * @param string - * @access public - * @deprecated - */ - function assertNotSame($expected, $actual, $message = '') { - if (!version_compare(phpversion(), '5.0.0', '>=')) { - $this->fail('assertNotSame() only works with PHP >= 5.0.0.'); - } - - if ((is_object($expected) || is_null($expected)) && - (is_object($actual) || is_null($actual))) { - $message = sprintf( - '%sexpected two variables to reference different objects', - - !empty($message) ? $message . ' ' : '' - ); - - if ($expected === $actual) { - return $this->fail($message); - } - } else { - $this->fail('Unsupported parameter passed to assertNotSame().'); - } - } - - /** - * Asserts that a variable is not NULL. - * - * @param mixed - * @param string - * @access public - */ - function assertNotNull($actual, $message = '') { - $message = sprintf( - '%sexpected NOT NULL, actual NULL', - - !empty($message) ? $message . ' ' : '' - ); - - if (is_null($actual)) { - return $this->fail($message); - } - } - - /** - * Asserts that a variable is NULL. - * - * @param mixed - * @param string - * @access public - */ - function assertNull($actual, $message = '') { - $message = sprintf( - '%sexpected NULL, actual NOT NULL', - - !empty($message) ? $message . ' ' : '' - ); - - if (!is_null($actual)) { - return $this->fail($message); - } - } - - /** - * Asserts that a condition is true. - * - * @param boolean - * @param string - * @access public - */ - function assertTrue($condition, $message = '') { - $message = sprintf( - '%sexpected TRUE, actual FALSE', - - !empty($message) ? $message . ' ' : '' - ); - - if (!$condition) { - return $this->fail($message); - } - } - - /** - * Asserts that a condition is false. - * - * @param boolean - * @param string - * @access public - */ - function assertFalse($condition, $message = '') { - $message = sprintf( - '%sexpected FALSE, actual TRUE', - - !empty($message) ? $message . ' ' : '' - ); - - if ($condition) { - return $this->fail($message); - } - } - - /** - * Asserts that a string matches a given regular expression. - * - * @param string - * @param string - * @param string - * @access public - */ - function assertRegExp($pattern, $string, $message = '') { - $message = sprintf( - '%s"%s" does not match pattern "%s"', - - !empty($message) ? $message . ' ' : '', - $string, - $pattern - ); - - if (!preg_match($pattern, $string)) { - return $this->fail($message); - } - } - - /** - * Asserts that a string does not match a given regular expression. - * - * @param string - * @param string - * @param string - * @access public - * @since 1.1.0 - */ - function assertNotRegExp($pattern, $string, $message = '') { - $message = sprintf( - '%s"%s" matches pattern "%s"', - - !empty($message) ? $message . ' ' : '', - $string, - $pattern - ); - - if (preg_match($pattern, $string)) { - return $this->fail($message); - } - } - - /** - * Asserts that a variable is of a given type. - * - * @param string $expected - * @param mixed $actual - * @param optional string $message - * @access public - */ - function assertType($expected, $actual, $message = '') { - return $this->assertEquals( - $expected, - gettype($actual), - $message - ); - } - - /** - * Converts a value to a string. - * - * @param mixed $value - * @access private - */ - function _convertToString($value) { - foreach ($value as $k => $v) { - if (is_array($v)) { - $value[$k] = $this->_convertToString($value[$k]); - } else { - settype($value[$k], 'string'); - } - } - - return $value; - } - - /** - * @param boolean $looselyTyped - * @access public - */ - function setLooselyTyped($looselyTyped) { - if (is_bool($looselyTyped)) { - $this->_looselyTyped = $looselyTyped; - } - } - - /** - * Fails a test with the given message. - * - * @param string - * @access protected - * @abstract - */ - function fail($message = '') { /* abstract */ } -} -?> diff --git a/inc/PHPUnit/GUI/Gtk.php b/inc/PHPUnit/GUI/Gtk.php deleted file mode 100644 index fdd3a9931e5732d36717ec8a1d18d5f867c2b327..0000000000000000000000000000000000000000 --- a/inc/PHPUnit/GUI/Gtk.php +++ /dev/null @@ -1,698 +0,0 @@ -<?php -/* vim: set expandtab tabstop=4 shiftwidth=4: */ -// +----------------------------------------------------------------------+ -// | PHP Version 4 | -// +----------------------------------------------------------------------+ -// | Copyright (c) 2004 Scott Mattocks | -// +----------------------------------------------------------------------+ -// | 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: Scott Mattocks <scottmattocks@php.net> | -// +----------------------------------------------------------------------+ -// -// $Id: Gtk.php,v 1.2 2004/11/25 09:06:55 sebastian Exp $ -/** - * GTK GUI interface for PHPUnit. - * - * This class is a PHP port of junit.awtui.testrunner. Documentation - * for junit.awtui.testrunner can be found at - * http://junit.sourceforge.net - * - * Due to the limitations of PHP4 and PHP-Gtk, this class can not - * duplicate all of the functionality of the JUnit GUI. Some of the - * things this class cannot do include: - * - Reloading the class for each run - * - Stopping the test in progress - * - * To use simply intantiate the class and call main() - * $gtk =& new PHPUnit_GUI_Gtk; - * $gtk->main(); - * - * Once the window has finished loading, you can enter the name of - * a class that has been loaded (include/require some where in your - * code, or you can pass the name of the file containing the class. - * - * You can also load classes using the SetupDecorator class. - * require_once 'PHPUnit/GUI/SetupDecorator.php'; - * require_once 'PHPUnit/GUI/Gtk.php'; - * $gui = new PHPUnit_GUI_SetupDecorator(new PHPUnit_GUI_Gtk()); - * $gui->getSuitesFromDir('/path/to/test','.*\.php$',array('index.php','sql.php')); - * $gui->show(); - * - * @todo Allow file drop. (Gtk_FileDrop) - * - * @author Scott Mattocks - * @copyright Copyright © 2004 Scott Mattocks - * @license PHP 3.0 - * @version @VER@ - * @category PHP - * @package PHPUnit - * @subpackage GUI - */ -class PHPUnit_GUI_Gtk { - - /** - * The main gtk window - * @var object - */ - var $gui; - /** - * The text entry that contains the name of the - * file that holds the test(s)/suite(s). - * @var object - */ - var $suiteField; - /** - * The label that shows the number of tests that - * were run. - * @var object - */ - var $numberOfRuns; - /** - * The label that shows the number of errors that - * were encountered. - * @var object - */ - var $numberOfErrors; - /** - * The label that shows the number of failures - * that were encountered. - * @var object - */ - var $numberOfFailures; - /** - * The label for reporting user messages. - * @var object - */ - var $statusLine; - /** - * The text area for reporting messages from successful - * test runs. (not necessarily successful tests) - * @var object - */ - var $reportArea; - /** - * The text area for reporting errors encountered when - * running tests. - * @var object - */ - var $dumpArea; - /** - * The progress bar indicator. Shows the percentage of - * passed tests. - * @var object - */ - var $progress; - /** - * A checkbox for the user to indicate whether or not they - * would like to see results from all tests or just failures. - * @object - */ - var $showPassed; - - /** - * Constructor. - * - * The constructor checks for the gtk extension and loads it - * if needed. Then it creates the GUI. The GUI is not shown - * nor is the main gtk loop started until main() is called. - * - * @access public - * @param none - * @return void - */ - function PHPUnit_GUI_Gtk() - { - // Check for php-gtk extension. - if (!extension_loaded('gtk')) { - dl( 'php_gtk.' . PHP_SHLIB_SUFFIX); - } - - // Create the interface but don't start the loop - $this->_createUI(); - } - /** - * Start the main gtk loop. - * - * main() first sets the default state of the showPassed - * check box. Next all widgets that are part of the GUI - * are shown. Finally the main gtk loop is started. - * - * @access public - * @param boolean $showPassed - * @return void - */ - function main($showPassed = true) - { - $this->showPassed->set_active($showPassed); - $this->gui->show_all(); - - gtk::main(); - } - /** - * Create the user interface. - * - * The user interface is pretty simple. It consists of a - * menu, text entry, run button, some labels, a progress - * indicator, and a couple of areas for notification of - * any messages. - * - * @access private - * @param none - * @return void - */ - function _createUI() - { - // Create a window. - $window =& new GtkWindow; - $window->set_title('PHPUnit Gtk'); - $window->set_usize(400, -1); - - // Create the main box. - $mainBox =& new GtkVBox; - $window->add($mainBox); - - // Start with the menu. - $mainBox->pack_start($this->_createMenu()); - - // Then add the suite field entry. - $mainBox->pack_start($this->_createSuiteEntry()); - - // Then add the report labels. - $mainBox->pack_start($this->_createReportLabels()); - - // Next add the progress bar. - $mainBox->pack_start($this->_createProgressBar()); - - // Then add the report area and the dump area. - $mainBox->pack_start($this->_createReportAreas()); - - // Finish off with the status line. - $mainBox->pack_start($this->_createStatusLine()); - - // Connect the destroy signal. - $window->connect_object('destroy', array('gtk', 'main_quit')); - - // Assign the member. - $this->gui =& $window; - } - /** - * Create the menu. - * - * The menu is very simple. It an exit menu item, which exits - * the application, and an about menu item, which shows some - * basic information about the application itself. - * - * @access private - * @param none - * @return &object The GtkMenuBar - */ - function &_createMenu() - { - // Create the menu bar. - $menuBar =& new GtkMenuBar; - - // Create the main (only) menu item. - $phpHeader =& new GtkMenuItem('PHPUnit'); - - // Add the menu item to the menu bar. - $menuBar->append($phpHeader); - - // Create the PHPUnit menu. - $phpMenu =& new GtkMenu; - - // Add the menu items - $about =& new GtkMenuItem('About...'); - $about->connect('activate', array(&$this, 'about')); - $phpMenu->append($about); - - $exit =& new GtkMenuItem('Exit'); - $exit->connect_object('activate', array('gtk', 'main_quit')); - $phpMenu->append($exit); - - // Complete the menu. - $phpHeader->set_submenu($phpMenu); - - return $menuBar; - } - /** - * Create the suite entry and related widgets. - * - * The suite entry has some supporting components such as a - * label, the show passed check box and the run button. All - * of these items are packed into two nested boxes. - * - * @access private - * @param none - * @return &object A box that contains all of the suite entry pieces. - */ - function &_createSuiteEntry() - { - // Create the outermost box. - $outerBox =& new GtkVBox; - - // Create the suite label, box, and field. - $suiteLabel =& new GtkLabel('Test class name:'); - $suiteBox =& new GtkHBox; - $this->suiteField =& new GtkEntry; - $this->suiteField->set_text($suiteName != NULL ? $suiteName : ''); - - // Create the button the user will use to start the test. - $runButton =& new GtkButton('Run'); - $runButton->connect_object('clicked', array(&$this, 'run')); - - // Create the check box that lets the user show only failures. - $this->showPassed =& new GtkCheckButton('Show passed tests'); - - // Add the components to their respective boxes. - $suiteLabel->set_alignment(0, 0); - $outerBox->pack_start($suiteLabel); - $outerBox->pack_start($suiteBox); - $outerBox->pack_start($this->showPassed); - - $suiteBox->pack_start($this->suiteField); - $suiteBox->pack_start($runButton); - - return $outerBox; - } - - /** - * Create the labels that tell the user what has happened. - * - * There are three labels, one each for total runs, errors and - * failures. There is also one label for each of these that - * describes what the label is. It could be done with one label - * instead of two but that would make updates much harder. - * - * @access private - * @param none - * @return &object A box containing the labels. - */ - function &_createReportLabels() - { - // Create a box to hold everything. - $labelBox =& new GtkHBox; - - // Create the non-updated labels. - $numberOfRuns =& new GtkLabel('Runs:'); - $numberOfErrors =& new GtkLabel('Errors:'); - $numberOfFailures =& new GtkLabel('Failures:'); - - // Create the labels that will be updated. - // These are asssigned to members to make it easier to - // set their values later. - $this->numberOfRuns =& new GtkLabel(0); - $this->numberOfErrors =& new GtkLabel(0); - $this->numberOfFailures =& new GtkLabel(0); - - // Pack everything in. - $labelBox->pack_start($numberOfRuns); - $labelBox->pack_start($this->numberOfRuns); - $labelBox->pack_start($numberOfErrors); - $labelBox->pack_start($this->numberOfErrors); - $labelBox->pack_start($numberOfFailures); - $labelBox->pack_start($this->numberOfFailures); - - return $labelBox; - } - - /** - * Create the success/failure indicator. - * - * A GtkProgressBar is used to visually indicate how many - * tests were successful compared to how many were not. The - * progress bar shows the percentage of success and will - * change from green to red if there are any failures. - * - * @access private - * @param none - * @return &object The progress bar - */ - function &_createProgressBar() - { - // Create the progress bar. - $this->progress =& new GtkProgressBar(new GtkAdjustment(0, 0, 1, .1, 1, 0)); - - // Set the progress bar to print the percentage. - $this->progress->set_show_text(true); - - return $this->progress; - } - - /** - * Create the report text areas. - * - * The report area consists of one text area for failures, one - * text area for errors and one label for identification purposes. - * All three widgets are packed into a box. - * - * @access private - * @param none - * @return &object The box containing the report areas. - */ - function &_createReportAreas() - { - // Create the containing box. - $reportBox =& new GtkVBox; - - // Create the identification label - $reportLabel =& new GtkLabel('Errors and Failures:'); - $reportLabel->set_alignment(0, 0); - - // Create the scrolled windows for the text areas. - $reportScroll =& new GtkScrolledWindow; - $dumpScroll =& new GtkScrolledWindow; - - // Make the scroll areas big enough. - $reportScroll->set_usize(-1, 150); - $dumpScroll->set_usize(-1, 150); - - // Only show the vertical scroll bar when needed. - // Never show the horizontal scroll bar. - $reportScroll->set_policy(GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); - $dumpScroll->set_policy(GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); - - // Create the text areas. - $this->reportArea =& new GtkText; - $this->dumpArea =& new GtkText; - - // Don't let words get broken. - $this->reportArea->set_word_wrap(true); - $this->dumpArea->set_word_wrap(true); - - // Pack everything in. - $reportBox->pack_start($reportLabel); - $reportScroll->add($this->reportArea); - $reportBox->pack_start($reportScroll); - $dumpScroll->add($this->dumpArea); - $reportBox->pack_start($dumpScroll); - - return $reportBox; - } - - /** - * Create a status label. - * - * A status line at the bottom of the application is used - * to notify the user of non-test related messages such as - * failures loading a test suite. - * - * @access private - * @param none - * @return &object The status label. - */ - function &_createStatusLine() - { - // Create the status label. - $this->statusLine =& new GtkLabel(''); - $this->statusLine->set_alignment(0, 0); - - return $this->statusLine; - } - - /** - * Show a popup with information about the application. - * - * The popup should show information about the version, - * the author, the license, where to get the latest - * version and a short description. - * - * @access public - * @param none - * @return void - */ - function about() - { - // Create the new window. - $about =& new GtkWindow; - $about->set_title('About PHPUnit GUI Gtk'); - $about->set_usize(250, -1); - - // Put two vboxes in the hbox. - $vBox =& new GtkVBox; - $about->add($vBox); - - // Create the labels. - $version =& new GtkLabel(" Version: 1.0"); - $license =& new GtkLabel(" License: PHP License v3.0"); - $where =& new GtkLabel(" Download from: http://pear.php.net/PHPUnit/"); - $unitAuth =& new GtkLabel(" PHPUnit Author: Sebastian Bergman"); - $gtkAuth =& new GtkLabel(" Gtk GUI Author: Scott Mattocks"); - - // Align everything to the left - $where->set_alignment(0, .5); - $version->set_alignment(0, .5); - $license->set_alignment(0, .5); - $gtkAuth->set_alignment(0, .5); - $unitAuth->set_alignment(0, .5); - - // Pack everything into the vBox; - $vBox->pack_start($version); - $vBox->pack_start($license); - $vBox->pack_start($where); - $vBox->pack_start($unitAuth); - $vBox->pack_start($gtkAuth); - - // Connect the destroy signal. - $about->connect('destroy', array('gtk', 'true')); - - // Show the goods. - $about->show_all(); - } - - /** - * Load the test suite. - * - * This method tries to load test suite based on the user - * info. If the user passes the name of a tests suite, it - * is instantiated and a new object is returned. If the - * user passes a file that contains a test suite, the class - * is instantiated and a new object is returned. If the user - * passes a file that contains a test case, the test case is - * passed to a new test suite and the new suite object is - * returned. - * - * @access public - * @param string The file that contains a test case/suite or the classname. - * @return &object The new test suite. - */ - function &loadTest(&$file) - { - // Check to see if a class name was given. - if (is_a($file, 'PHPUnit_TestSuite')) { - return $file; - } elseif (class_exists($file)) { - require_once 'PHPUnit/TestSuite.php'; - return new PHPUnit_TestSuite($file); - } - - // Check that the file exists. - if (!@is_readable($file)) { - $this->_showStatus('Cannot find file: ' . $file); - return false; - } - - $this->_showStatus('Loading test suite...'); - - // Instantiate the class. - // If the path is /path/to/test/TestClass.php - // the class name should be test_TestClass - require_once $file; - $className = str_replace(DIRECTORY_SEPARATOR, '_', $file); - $className = substr($className, 0, strpos($className, '.')); - - require_once 'PHPUnit/TestSuite.php'; - return new PHPUnit_TestSuite($className); - } - - /** - * Run the test suite. - * - * This method runs the test suite and updates the messages - * for the user. When finished it changes the status line - * to 'Test Complete' - * - * @access public - * @param none - * @return void - */ - function runTest() - { - // Notify the user that the test is running. - $this->_showStatus('Running Test...'); - - // Run the test. - $result = PHPUnit::run($this->suite); - - // Update the labels. - $this->_setLabelValue($this->numberOfRuns, $result->runCount()); - $this->_setLabelValue($this->numberOfErrors, $result->errorCount()); - $this->_setLabelValue($this->numberOfFailures, $result->failureCount()); - - // Update the progress bar. - $this->_updateProgress($result->runCount(), - $result->errorCount(), - $result->failureCount() - ); - - // Show the errors. - $this->_showFailures($result->errors(), $this->dumpArea); - - // Show the messages from the tests. - if ($this->showPassed->get_active()) { - // Show failures and success. - $this->_showAll($result, $this->reportArea); - } else { - // Show only failures. - $this->_showFailures($result->failures(), $this->reportArea); - } - - // Update the status message. - $this->_showStatus('Test complete'); - } - - /** - * Set the text of a label. - * - * Change the text of a given label. - * - * @access private - * @param widget &$label The label whose value is to be changed. - * @param string $value The new text of the label. - * @return void - */ - function _setLabelValue(&$label, $value) - { - $label->set_text($value); - } - - /** - * The main work of the application. - * - * Load the test suite and then execute the tests. - * - * @access public - * @param none - * @return void - */ - function run() - { - // Load the test suite. - $this->suite =& $this->loadTest($this->suiteField->get_text()); - - // Check to make sure the suite was loaded properly. - if (!is_object($this->suite)) { - // Raise an error. - $this->_showStatus('Could not load test suite.'); - return false; - } - - // Run the tests. - $this->runTest(); - } - - /** - * Update the status message. - * - * @access private - * @param string $status The new message. - * @return void - */ - function _showStatus($status) - { - $this->statusLine->set_text($status); - } - - /** - * Alias for main() - * - * @see main - */ - function show($showPassed = true) - { - $this->main($showPassed); - } - - /** - * Add a suite to the tests. - * - * This method is require by SetupDecorator. It adds a - * suite to the the current set of suites. - * - * @access public - * @param object $testSuite The suite to add. - * @return void - */ - function addSuites($testSuite) - { - if (!is_array($testSuite)) { - settype($testSuite, 'array'); - } - - foreach ($testSuite as $suite) { - - if (is_a($this->suite, 'PHPUnit_TestSuite')) { - $this->suite->addTestSuite($suite->getName()); - } else { - $this->suite =& $this->loadTest($suite); - } - - // Set the suite field. - $text = $this->suiteField->get_text(); - if (empty($text)) { - $this->suiteField->set_text($this->suite->getName()); - } - } - } - - /** - * Show all test messages. - * - * @access private - * @param object The TestResult from the test suite. - * @return void - */ - function _showAll(&$result) - { - // Clear the area first. - $this->reportArea->delete_text(0, -1); - $this->reportArea->insert_text($result->toString(), 0); - } - - /** - * Show failure/error messages in the given text area. - * - * @access private - * @param object &$results The results of the test. - * @param widget &$area The area to show the results in. - */ - function _showFailures(&$results, &$area) - { - $area->delete_text(0, -1); - foreach (array_reverse($results, true) as $result) { - $area->insert_text($result->toString(), 0); - } - } - - /** - * Update the progress indicator. - * - * @access private - * @param integer $runs - * @param integer $errors - * @param integer $failures - * @return void - */ - function _updateProgress($runs, $errors, $failures) - { - $percentage = 1 - (($errors + $failures) / $runs); - $this->progress->set_percentage($percentage); - } -} -?> \ No newline at end of file diff --git a/inc/PHPUnit/GUI/HTML.php b/inc/PHPUnit/GUI/HTML.php deleted file mode 100644 index 773ab9af9f36850a191baca78a87fc4beba85292..0000000000000000000000000000000000000000 --- a/inc/PHPUnit/GUI/HTML.php +++ /dev/null @@ -1,210 +0,0 @@ -<?php -// -// +------------------------------------------------------------------------+ -// | PEAR :: PHPUnit | -// +------------------------------------------------------------------------+ -// | Copyright (c) 2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>. | -// +------------------------------------------------------------------------+ -// | This source file is subject to version 3.00 of the PHP License, | -// | that is available at 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. | -// +------------------------------------------------------------------------+ -// -// $Id: HTML.php,v 1.17 2005/01/07 07:34:05 sebastian Exp $ -// - -/** - * This class provides a HTML GUI. - * - * @author Wolfram Kriesing <wolfram@kriesing.de> - * @license http://www.php.net/license/3_0.txt The PHP License, Version 3.0 - * @category Testing - * @package PHPUnit - * @subpackage GUI - */ -class PHPUnit_GUI_HTML -{ - var $_suites = array(); - - /** - * the current implementation of PHPUnit is designed - * this way that adding a suite to another suite only - * grabs all the tests and adds them to the suite, so you - * have no chance to find out which test goes with which suite - * therefore you can simply pass an array of suites to this constructor here - * - * @param array The suites to be tested. If not given, then you might - * be using the SetupDecorator, which detects them automatically - * when calling getSuitesFromDir() - */ - function PHPUnit_GUI_HTML($suites = array()) - { - if (!is_array($suites)) { - $this->_suites = array($suites); - } else { - $this->_suites = $suites; - } - } - - /** - * Add suites to the GUI - * - * @param object this should be an instance of PHPUnit_TestSuite - */ - function addSuites($suites) - { - $this->_suites = array_merge($this->_suites,$suites); - } - - /** - * this prints the HTML code straight out - * - */ - function show() - { - $request = $_REQUEST; - $showPassed = FALSE; - $submitted = @$request['submitted']; - - if ($submitted) { - $showPassed = @$request['showOK'] ? TRUE : FALSE; - } - - $suiteResults = array(); - - foreach ($this->_suites as $aSuite) { - $aSuiteResult = array(); - - // remove the first directory's name from the test-suite name, since it - // mostly is something like 'tests' or alike - $removablePrefix = explode('_',$aSuite->getName()); - $aSuiteResult['name'] = str_replace($removablePrefix[0].'_', '', $aSuite->getName()); - - if ($submitted && isset($request[$aSuiteResult['name']])) { - $result = PHPUnit::run($aSuite); - - $aSuiteResult['counts']['run'] = $result->runCount(); - $aSuiteResult['counts']['error'] = $result->errorCount(); - $aSuiteResult['counts']['failure'] = $result->failureCount(); - - $aSuiteResult['results'] = $this->_prepareResult($result,$showPassed); - - $per = 100/$result->runCount(); - $failed = ($per*$result->errorCount())+($per*$result->failureCount()); - $aSuiteResult['percent'] = round(100-$failed,2); - } else { - $aSuiteResult['addInfo'] = 'NOT EXECUTED'; - } - - $suiteResults[] = $aSuiteResult; - } - - $final['name'] = 'OVERALL RESULT'; - $final['counts'] = array(); - $final['percent'] = 0; - $numExecutedTests = 0; - - foreach ($suiteResults as $aSuiteResult) { - if (sizeof(@$aSuiteResult['counts'])) { - foreach ($aSuiteResult['counts'] as $key=>$aCount) { - if (!isset($final['counts'][$key])) { - $final['counts'][$key] = 0; - } - - $final['counts'][$key] += $aCount; - } - } - } - - if (isset($final['counts']['run'])) { - $per = 100/$final['counts']['run']; - $failed = ($per*$final['counts']['error'])+($per*$final['counts']['failure']); - $final['percent'] = round(100-$failed,2); - } else { - $final['percent'] = 0; - } - - array_unshift($suiteResults,$final); - - include 'PHPUnit/GUI/HTML.tpl'; - } - - function _prepareResult($result,$showPassed) - { - $ret = array(); - $failures = $result->failures(); - - foreach($failures as $aFailure) { - $ret['failures'][] = $this->_prepareFailure($aFailure); - } - - $errors = $result->errors(); - - foreach($errors as $aError) { - $ret['errors'][] = $this->_prepareErrors($aError); - } - - if ($showPassed) { - $passed = $result->passedTests(); - - foreach($passed as $aPassed) { - $ret['passed'][] = $this->_preparePassedTests($aPassed); - } - } - - return $ret; - } - - function _prepareFailure($failure) - { - $test = $failure->failedTest(); - $ret['testName'] = $test->getName(); - $exception = $failure->thrownException(); - - // a serialized string starts with a 'character:decimal:{' - // if so we try to unserialize it - // this piece of the regular expression is for detecting a serialized - // type like 'a:3:' for an array with three element or an object i.e. 'O:12:"class":3' - $serialized = '(\w:\d+:(?:"[^"]+":\d+:)?\{.*\})'; - - // Spaces might make a diff, so we shall show them properly (since a - // user agent ignores them). - if (preg_match('/^(.*)expected ' . $serialized . ', actual ' . $serialized . '$/sU', $exception, $matches)) { - ob_start(); - print_r(unserialize($matches[2])); - $ret['expected'] = htmlspecialchars($matches[1]) . "<pre>" . htmlspecialchars(rtrim(ob_get_contents())) . "</pre>"; - // Improved compatibility, ob_clean() would be PHP >= 4.2.0 only. - ob_end_clean(); - - ob_start(); - print_r(unserialize($matches[3])); - $ret['actual'] = htmlspecialchars($matches[1]) . "<pre>" . htmlspecialchars(rtrim(ob_get_contents())) . "</pre>"; - ob_end_clean(); - } - - else if (preg_match('/^(.*)expected (.*), actual (.*)$/sU', $exception, $matches)) { - $ret['expected'] = nl2br(str_replace(" ", " ", htmlspecialchars($matches[1] . $matches[2]))); - $ret['actual'] = nl2br(str_replace(" ", " ", htmlspecialchars($matches[1] . $matches[3]))); - } else { - $ret['message'] = nl2br(str_replace(" ", " ", htmlspecialchars($exception))); - } - - return $ret; - } - - function _preparePassedTests($passed) - { - $ret['testName'] = $passed->getName(); - return $ret; - } - - function _prepareError($error) - { - $ret['testName'] = $error->getName(); - $ret['message'] = $error->toString(); - return $ret; - } -} -?> diff --git a/inc/PHPUnit/GUI/SetupDecorator.php b/inc/PHPUnit/GUI/SetupDecorator.php deleted file mode 100644 index 73c3d8298e2f80ce08aaebef7f71e935169e50f5..0000000000000000000000000000000000000000 --- a/inc/PHPUnit/GUI/SetupDecorator.php +++ /dev/null @@ -1,167 +0,0 @@ -<?php -// -// +------------------------------------------------------------------------+ -// | PEAR :: PHPUnit | -// +------------------------------------------------------------------------+ -// | Copyright (c) 2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>. | -// +------------------------------------------------------------------------+ -// | This source file is subject to version 3.00 of the PHP License, | -// | that is available at 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. | -// +------------------------------------------------------------------------+ -// -// $Id: SetupDecorator.php,v 1.12 2005/05/14 05:58:38 sebastian Exp $ -// - -/** - * This decorator actually just adds the functionality to read the - * test-suite classes from a given directory and instanciate them - * automatically, use it as given in the example below. - * - * <code> - * <?php - * $gui = new PHPUnit_GUI_SetupDecorator(new PHPUnit_GUI_HTML()); - * $gui->getSuitesFromDir('/path/to/dir/tests','.*\.php$',array('index.php','sql.php')); - * $gui->show(); - * ?> - * </code> - * - * The example calls this class and tells it to: - * - * - find all file under the directory /path/to/dir/tests - * - for files, which end with '.php' (this is a piece of a regexp, that's why the . is escaped) - * - and to exclude the files 'index.php' and 'sql.php' - * - and include all the files that are left in the tests. - * - * Given that the path (the first parameter) ends with 'tests' it will be assumed - * that the classes are named tests_* where * is the directory plus the filename, - * according to PEAR standards. - * - * So that: - * - * - 'testMe.php' in the dir 'tests' bill be assumed to contain a class tests_testMe - * - '/moretests/aTest.php' should contain a class 'tests_moretests_aTest' - * - * @author Wolfram Kriesing <wolfram@kriesing.de> - * @license http://www.php.net/license/3_0.txt The PHP License, Version 3.0 - * @category Testing - * @package PHPUnit - * @subpackage GUI - */ -class PHPUnit_GUI_SetupDecorator -{ - /** - * - * - */ - function PHPUnit_GUI_SetupDecorator(&$gui) - { - $this->_gui = &$gui; - } - - /** - * just forwarding the action to the decorated class. - * - */ - function show($showPassed=TRUE) - { - $this->_gui->show($showPassed); - } - - /** - * Setup test suites that can be found in the given directory - * Using the second parameter you can also choose a subsets of the files found - * in the given directory. I.e. only all the files that contain '_UnitTest_', - * in order to do this simply call it like this: - * <code>getSuitesFromDir($dir,'.*_UnitTest_.*')</code>. - * There you can already see that the pattern is built for the use within a regular expression. - * - * @param string the directory where to search for test-suite files - * @param string the pattern (a regexp) by which to find the files - * @param array an array of file names that shall be excluded - */ - function getSuitesFromDir($dir, $filenamePattern = '', $exclude = array()) - { - if ($dir{strlen($dir)-1} == DIRECTORY_SEPARATOR) { - $dir = substr($dir, 0, -1); - } - - $files = $this->_getFiles($dir, $filenamePattern, $exclude, realpath($dir . '/..')); - asort($files); - - foreach ($files as $className => $aFile) { - include_once($aFile); - - if (class_exists($className)) { - $suites[] =& new PHPUnit_TestSuite($className); - } else { - trigger_error("$className could not be found in $dir$aFile!"); - } - } - - $this->_gui->addSuites($suites); - } - - /** - * This method searches recursively through the directories - * to find all the files that shall be added to the be visible. - * - * @param string the path where find the files - * @param srting the string pattern by which to find the files - * @param string the file names to be excluded - * @param string the root directory, which serves as the prefix to the fully qualified filename - * @access private - */ - function _getFiles($dir, $filenamePattern, $exclude, $rootDir) - { - $files = array(); - - if ($dp = opendir($dir)) { - while (FALSE !== ($file = readdir($dp))) { - $filename = $dir . DIRECTORY_SEPARATOR . $file; - $match = TRUE; - - if ($filenamePattern && !preg_match("~$filenamePattern~", $file)) { - $match = FALSE; - } - - if (sizeof($exclude)) { - foreach ($exclude as $aExclude) { - if (strpos($file, $aExclude) !== FALSE) { - $match = FALSE; - break; - } - } - } - - if (is_file($filename) && $match) { - $tmp = str_replace($rootDir, '', $filename); - - if (strpos($tmp, DIRECTORY_SEPARATOR) === 0) { - $tmp = substr($tmp, 1); - } - - if (strpos($tmp, '/') === 0) { - $tmp = substr($tmp, 1); - } - - $className = str_replace(DIRECTORY_SEPARATOR, '_', $tmp); - $className = basename($className, '.php'); - - $files[$className] = $filename; - } - - if ($file != '.' && $file != '..' && is_dir($filename)) { - $files = array_merge($files, $this->_getFiles($filename, $filenamePattern, $exclude, $rootDir)); - } - } - - closedir($dp); - } - - return $files; - } -} -?> diff --git a/inc/PHPUnit/RepeatedTest.php b/inc/PHPUnit/RepeatedTest.php deleted file mode 100644 index f8cbbc640f6101992ffdd9fe4cbe815cff280866..0000000000000000000000000000000000000000 --- a/inc/PHPUnit/RepeatedTest.php +++ /dev/null @@ -1,112 +0,0 @@ -<?php -// -// +------------------------------------------------------------------------+ -// | PEAR :: PHPUnit | -// +------------------------------------------------------------------------+ -// | Copyright (c) 2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>. | -// +------------------------------------------------------------------------+ -// | This source file is subject to version 3.00 of the PHP License, | -// | that is available at 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. | -// +------------------------------------------------------------------------+ -// -// $Id: RepeatedTest.php,v 1.10 2004/12/22 08:06:11 sebastian Exp $ -// - -require_once 'PHPUnit/TestDecorator.php'; - -/** - * A Decorator that runs a test repeatedly. - * - * Here is an example: - * - * <code> - * <?php - * require_once 'PHPUnit.php'; - * require_once 'PHPUnit/RepeatedTest.php'; - * - * class MathTest extends PHPUnit_TestCase { - * var $fValue1; - * var $fValue2; - * - * function MathTest($name) { - * $this->PHPUnit_TestCase($name); - * } - * - * function setUp() { - * $this->fValue1 = 2; - * $this->fValue2 = 3; - * } - * - * function testAdd() { - * $this->assertTrue($this->fValue1 + $this->fValue2 == 5); - * } - * } - * - * $suite = new PHPUnit_TestSuite; - * - * $suite->addTest( - * new PHPUnit_RepeatedTest( - * new MathTest('testAdd'), - * 10 - * ) - * ); - * - * $result = PHPUnit::run($suite); - * print $result->toString(); - * ?> - * </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 Testing - * @package PHPUnit - */ -class PHPUnit_RepeatedTest extends PHPUnit_TestDecorator { - /** - * @var integer - * @access private - */ - var $_timesRepeat = 1; - - /** - * Constructor. - * - * @param object - * @param integer - * @access public - */ - function PHPUnit_RepeatedTest(&$test, $timesRepeat = 1) { - $this->PHPUnit_TestDecorator($test); - $this->_timesRepeat = $timesRepeat; - } - - /** - * Counts the number of test cases that - * will be run by this test. - * - * @return integer - * @access public - */ - function countTestCases() { - return $this->_timesRepeat * $this->_test->countTestCases(); - } - - /** - * Runs the decorated test and collects the - * result in a TestResult. - * - * @param object - * @access public - * @abstract - */ - function run(&$result) { - for ($i = 0; $i < $this->_timesRepeat; $i++) { - $this->_test->run($result); - } - } -} -?> diff --git a/inc/PHPUnit/Skeleton.php b/inc/PHPUnit/Skeleton.php deleted file mode 100644 index 81fe3149066b62c7218eb8b8a90475ecda743a68..0000000000000000000000000000000000000000 --- a/inc/PHPUnit/Skeleton.php +++ /dev/null @@ -1,406 +0,0 @@ -<?php -// -// +------------------------------------------------------------------------+ -// | PEAR :: PHPUnit | -// +------------------------------------------------------------------------+ -// | Copyright (c) 2002-2004 Sebastian Bergmann <sb@sebastian-bergmann.de>. | -// +------------------------------------------------------------------------+ -// | This source file is subject to version 3.00 of the PHP License, | -// | that is available at 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. | -// +------------------------------------------------------------------------+ -// -// $Id: Skeleton.php,v 1.6 2004/12/22 08:06:11 sebastian Exp $ -// - -/** - * Class for creating a PHPUnit_TestCase skeleton file. - * - * This class will take a classname as a parameter on construction and will - * create a PHP file that contains the skeleton of a PHPUnit_TestCase - * subclass. The test case will contain a test foreach method of the class. - * Methods of the parent class will, by default, be excluded from the test - * class. Passing and optional construction parameter will include them. - * - * Example - * - * <?php - * require_once 'PHPUnit/Skeleton.php'; - * $ps = new PHPUnit_Skeleton('PHPUnit_Skeleton', 'PHPUnit/Skeleton.php'); - * - * // Generate the test class. - * // Default settings will not include any parent class methods, but - * // will include private methods. - * $ps->createTestClass(); - * - * // Write the new test class to file. - * // By default, code to run the test will be included. - * $ps->writeTestClass(); - * ?> - * - * Now open the skeleton class and fill in the details. - * If you run the test as is, all tests will fail and - * you will see plenty of undefined constant errors. - * - * @author Scott Mattocks <scott@crisscott.com> - * @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 Testing - * @package PHPUnit - */ -class PHPUnit_Skeleton { - /** - * Path to the class file to create a skeleton for. - * @var string - */ - var $classPath; - - /** - * The name of the class - * @var string - */ - var $className; - - /** - * Path to the configuration file needed by class to test. - * @var string - */ - var $configFile; - - /** - * Whether or not to include the methods of the parent class when testing. - * @var boolean - */ - var $includeParents; - - /** - * Whether or not to test private methods. - * @var boolean - */ - var $includePrivate; - - /** - * The test class that will be created. - * @var string - */ - var $testClass; - - /** - * Constructor. Sets the class members and check that the class - * to test is accessible. - * - * @access public - * @param string $className - * @param string $classPath - * @param boolean $includeParents Wheter to include the parent's methods in the test. - * @return void - */ - function PHPUnit_Skeleton($className, $classPath, $includeParents = FALSE, $includePrivate = TRUE) { - // Set up the members. - if (@is_readable($classPath)) { - $this->className = $className; - $this->classPath = $classPath; - } else { - $this->_handleErrors($classPath . ' is not readable. Cannot create test class.'); - } - - // Do we want to include parent methods? - $this->includeParents = $includeParents; - - // Do we want to allow private methods? - $this->includePrivate = $includePrivate; - } - - /** - * The class to test may require a special config file before it can be - * instantiated. This method lets you set that file. - * - * @access public - * @param string $configPath - * @return void - */ - function setConfigFile($configFile) { - // Check that the file is readable - if (@is_readable($configFile)) { - $this->configFile = $configFile; - } else { - $this->_handleErrors($configFile . ' is not readable. Cannot create test class.'); - } - } - - /** - * Create the code that will be the skeleton of the test case. - * - * The test case must have a clss definition, one var, a constructor - * setUp, tearDown, and methods. Optionally and by default the code - * to run the test is added when the class is written to file. - * - * @access public - * @param none - * @return void - */ - function createTestClass() { - // Instantiate the object. - if (isset($this->configFile)) { - require_once $this->configFile; - } - - require_once $this->classPath; - - // Get the methods. - $classMethods = get_class_methods($this->className); - - // Remove the parent methods if needed. - if (!$this->includeParents) { - $parentMethods = get_class_methods(get_parent_class($this->className)); - - if (count($parentMethods)) { - $classMethods = array_diff($classMethods, $parentMethods); - } - } - - // Create the class definition, constructor, setUp and tearDown. - $this->_createDefinition(); - $this->_createConstructor(); - $this->_createSetUpTearDown(); - - if (count($classMethods)) { - // Foreach method create a test case. - foreach ($classMethods as $method) { - // Unless it is the constructor. - if (strcasecmp($this->className, $method) !== 0) { - // Check for private methods. - if (!$this->includePrivate && strpos($method, '_') === 0) { - continue; - } else { - $this->_createMethod($method); - } - } - } - } - - // Finis off the class. - $this->_finishClass(); - } - - /** - * Create the class definition. - * - * The definition consist of a header comment, require statment - * for getting the PHPUnit file, the actual class definition, - * and the definition of the class member variable. - * - * All of the code needed for the new class is stored in the - * testClass member. - * - * @access private - * @param none - * @return void - */ - function _createDefinition() { - // Create header comment. - $this->testClass = - "/**\n" . - " * PHPUnit test case for " . $this->className . "\n" . - " * \n" . - " * The method skeletons below need to be filled in with \n" . - " * real data so that the tests will run correctly. Replace \n" . - " * all EXPECTED_VAL and PARAM strings with real data. \n" . - " * \n" . - " * Created with PHPUnit_Skeleton on " . date('Y-m-d') . "\n" . - " */\n"; - - // Add the require statements. - $this->testClass .= "require_once 'PHPUnit.php';\n"; - - // Add the class definition and variable definition. - $this->testClass .= - "class " . $this->className . "Test extends PHPUnit_TestCase {\n\n" . - " var \$" . $this->className . ";\n\n"; - } - - /** - * Create the class constructor. (PHP4 style) - * - * The constructor simply calls the PHPUnit_TestCase method. - * This code is taken from the PHPUnit documentation. - * - * All of the code needed for the new class is stored in the - * testClass member. - * - * @access private - * @param none - * @return void - */ - function _createConstructor() { - // Create the test class constructor. - $this->testClass.= - " function " . $this->className . "Test(\$name)\n" . - " {\n" . - " \$this->PHPUnit_TestCase(\$name);\n" . - " }\n\n"; - } - - /** - * Create setUp and tearDown methods. - * - * The setUp method creates the instance of the object to test. - * The tearDown method releases the instance. - * This code is taken from the PHPUnit documentation. - * - * All of the code needed for the new class is stored in the - * testClass member. - * - * @access private - * @param none - * @return void - */ - function _createSetUpTearDown() { - // Create the setUp method. - $this->testClass .= - " function setUp()\n" . - " {\n"; - - if (isset($this->configFile)) { - $this->testClass .= - " require_once '" . $this->configFile . "';\n"; - } - - $this->testClass .= - " require_once '" . $this->classPath . "';\n" . - " \$this->" . $this->className . " =& new " . $this->className . "(PARAM);\n" . - " }\n\n"; - - // Create the tearDown method. - $this->testClass .= - " function tearDown()\n" . - " {\n" . - " unset(\$this->" . $this->className . ");\n" . - " }\n\n"; - } - - /** - * Create a basic skeleton for test methods. - * - * This code is taken from the PHPUnit documentation. - * - * All of the code needed for the new class is stored in the - * testClass member. - * - * @access private - * @param none - * @return void - */ - function _createMethod($methodName) { - // Create a test method. - $this->testClass .= - " function test" . $methodName . "()\n" . - " {\n" . - " \$result = \$this->" . $this->className . "->" . $methodName . "(PARAM);\n" . - " \$expected = EXPECTED_VAL;\n" . - " \$this->assertEquals(\$expected, \$result);\n" . - " }\n\n"; - } - - /** - * Add the closing brace needed for a proper class definition. - * - * All of the code needed for the new class is stored in the - * testClass member. - * - * @access private - * @param none - * @return void - */ - function _finishClass() { - // Close off the class. - $this->testClass.= "}\n"; - } - - /** - * Create the code that will actually run the test. - * - * This code is added by default so that the test can be run - * just by running the file. To have it not added pass false - * as the second parameter to the writeTestClass method. - * This code is taken from the PHPUnit documentation. - * - * All of the code needed for the new class is stored in the - * testClass member. - * - * @access private - * @param none - * @return void - */ - function _createTest() { - // Create a call to the test. - $test = - "// Running the test.\n" . - "\$suite = new PHPUnit_TestSuite('" . $this->className . "Test');\n" . - "\$result = PHPUnit::run(\$suite);\n" . - "echo \$result->toString();\n"; - - return $test; - } - - /** - * Write the test class to file. - * - * This will write the test class created using the createTestClass - * method to a file called <className>Test.php. By default the file - * is written to the current directory and will have code to run - * the test appended to the bottom of the file. - * - * @access public - * @param string $destination The directory to write the file to. - * @param boolean $addTest Wheter to add the test running code. - * @return void - */ - function writeTestClass($destination = './', $addTest = TRUE) { - // Check for something to write to file. - if (!isset($this->testClass)) { - $this->_handleErrors('Noting to write.', PHPUS_WARNING); - return; - } - - // Open the destination file. - $fp = fopen($destination . $this->className . 'Test.php', 'w'); - fwrite($fp, "<?php\n"); - - // Write the test class. - fwrite($fp, $this->testClass); - - // Add the call to test the class in the file if we were asked to. - if ($addTest) { - fwrite($fp, $this->_createTest()); - } - - // Close the file. - fwrite($fp, "?>\n"); - fclose($fp); - } - - /** - * Error handler. - * - * This method should be rewritten to use the prefered error - * handling method. (PEAR_ErrorStack) - * - * @access private - * @param string $message The error message. - * @param integer $type An indication of the severity of the error. - * @return void Code may cause PHP to exit. - */ - function _handleErrors($message, $type = E_USER_ERROR) { - // For now just echo the message. - echo $message; - - // Check to see if we should quit. - if ($type == E_USER_ERROR) { - exit; - } - } -} -?> diff --git a/inc/PHPUnit/TestCase.php b/inc/PHPUnit/TestCase.php deleted file mode 100644 index 69594ed2f8ee39f79ef5ffd095752b0e8f42f66a..0000000000000000000000000000000000000000 --- a/inc/PHPUnit/TestCase.php +++ /dev/null @@ -1,237 +0,0 @@ -<?php -// -// +------------------------------------------------------------------------+ -// | PEAR :: PHPUnit | -// +------------------------------------------------------------------------+ -// | Copyright (c) 2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>. | -// +------------------------------------------------------------------------+ -// | This source file is subject to version 3.00 of the PHP License, | -// | that is available at 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. | -// +------------------------------------------------------------------------+ -// -// $Id: TestCase.php,v 1.16 2004/12/22 08:06:11 sebastian Exp $ -// - -require_once 'PHPUnit/Assert.php'; -require_once 'PHPUnit/TestResult.php'; - -/** - * A TestCase defines the fixture to run multiple tests. - * - * To define a TestCase - * - * 1) Implement a subclass of PHPUnit_TestCase. - * 2) Define instance variables that store the state of the fixture. - * 3) Initialize the fixture state by overriding setUp(). - * 4) Clean-up after a test by overriding tearDown(). - * - * Each test runs in its own fixture so there can be no side effects - * among test runs. - * - * Here is an example: - * - * <code> - * <?php - * class MathTest extends PHPUnit_TestCase { - * var $fValue1; - * var $fValue2; - * - * function MathTest($name) { - * $this->PHPUnit_TestCase($name); - * } - * - * function setUp() { - * $this->fValue1 = 2; - * $this->fValue2 = 3; - * } - * } - * ?> - * </code> - * - * For each test implement a method which interacts with the fixture. - * Verify the expected results with assertions specified by calling - * assert with a boolean. - * - * <code> - * <?php - * function testPass() { - * $this->assertTrue($this->fValue1 + $this->fValue2 == 5); - * } - * ?> - * </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 Testing - * @package PHPUnit - */ -class PHPUnit_TestCase extends PHPUnit_Assert { - /** - * @var boolean - * @access private - */ - var $_failed = FALSE; - - /** - * The name of the test case. - * - * @var string - * @access private - */ - var $_name = ''; - - /** - * PHPUnit_TestResult object - * - * @var object - * @access private - */ - var $_result; - - /** - * Constructs a test case with the given name. - * - * @param string - * @access public - */ - function PHPUnit_TestCase($name = FALSE) { - if ($name !== FALSE) { - $this->setName($name); - } - } - - /** - * Counts the number of test cases executed by run(TestResult result). - * - * @return integer - * @access public - */ - function countTestCases() { - return 1; - } - - /** - * Gets the name of a TestCase. - * - * @return string - * @access public - */ - function getName() { - return $this->_name; - } - - /** - * Runs the test case and collects the results in a given TestResult object. - * - * @param object - * @return object - * @access public - */ - function run(&$result) { - $this->_result = &$result; - $this->_result->run($this); - - return $this->_result; - } - - /** - * Runs the bare test sequence. - * - * @access public - */ - function runBare() { - $this->setUp(); - $this->runTest(); - $this->tearDown(); - $this->pass(); - } - - /** - * Override to run the test and assert its state. - * - * @access protected - */ - function runTest() { - call_user_func( - array( - &$this, - $this->_name - ) - ); - } - - /** - * Sets the name of a TestCase. - * - * @param string - * @access public - */ - function setName($name) { - $this->_name = $name; - } - - /** - * Returns a string representation of the test case. - * - * @return string - * @access public - */ - function toString() { - return ''; - } - - /** - * Creates a default TestResult object. - * - * @return object - * @access protected - */ - function &createResult() { - return new PHPUnit_TestResult; - } - - /** - * Fails a test with the given message. - * - * @param string - * @access protected - */ - function fail($message = '') { - $this->_result->addFailure($this, $message); - $this->_failed = TRUE; - } - - /** - * Passes a test. - * - * @access protected - */ - function pass() { - if (!$this->_failed) { - $this->_result->addPassedTest($this); - } - } - - /** - * Sets up the fixture, for example, open a network connection. - * This method is called before a test is executed. - * - * @access protected - * @abstract - */ - function setUp() { /* abstract */ } - - /** - * Tears down the fixture, for example, close a network connection. - * This method is called after a test is executed. - * - * @access protected - * @abstract - */ - function tearDown() { /* abstract */ } -} -?> diff --git a/inc/PHPUnit/TestDecorator.php b/inc/PHPUnit/TestDecorator.php deleted file mode 100644 index 6486309a70b8ce401bdad22cd438f3a567be8951..0000000000000000000000000000000000000000 --- a/inc/PHPUnit/TestDecorator.php +++ /dev/null @@ -1,110 +0,0 @@ -<?php -// -// +------------------------------------------------------------------------+ -// | PEAR :: PHPUnit | -// +------------------------------------------------------------------------+ -// | Copyright (c) 2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>. | -// +------------------------------------------------------------------------+ -// | This source file is subject to version 3.00 of the PHP License, | -// | that is available at 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. | -// +------------------------------------------------------------------------+ -// -// $Id: TestDecorator.php,v 1.12 2005/05/14 05:58:38 sebastian Exp $ -// - -require_once 'PHPUnit/TestCase.php'; -require_once 'PHPUnit/TestSuite.php'; - -/** - * A Decorator for Tests. - * - * Use TestDecorator as the base class for defining new - * test decorators. Test decorator subclasses can be introduced - * to add behaviour before or after a test is run. - * - * @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 Testing - * @package PHPUnit - */ -class PHPUnit_TestDecorator { - /** - * The Test to be decorated. - * - * @var object - * @access protected - */ - var $_test = NULL; - - /** - * Constructor. - * - * @param object - * @access public - */ - function PHPUnit_TestDecorator(&$test) { - if (is_object($test) && - (is_a($test, 'PHPUnit_TestCase') || - is_a($test, 'PHPUnit_TestSuite'))) { - - $this->_test = &$test; - } - } - - /** - * Runs the test and collects the - * result in a TestResult. - * - * @param object - * @access public - */ - function basicRun(&$result) { - $this->_test->run($result); - } - - /** - * Counts the number of test cases that - * will be run by this test. - * - * @return integer - * @access public - */ - function countTestCases() { - return $this->_test->countTestCases(); - } - - /** - * Returns the test to be run. - * - * @return object - * @access public - */ - function &getTest() { - return $this->_test; - } - - /** - * Runs the decorated test and collects the - * result in a TestResult. - * - * @param object - * @access public - * @abstract - */ - function run(&$result) { /* abstract */ } - - /** - * Returns a string representation of the test. - * - * @return string - * @access public - */ - function toString() { - return $this->_test->toString(); - } -} -?> diff --git a/inc/PHPUnit/TestFailure.php b/inc/PHPUnit/TestFailure.php deleted file mode 100644 index 69c8b80bcbb6eedd70fd24aa7b24cf6ddc8f20f3..0000000000000000000000000000000000000000 --- a/inc/PHPUnit/TestFailure.php +++ /dev/null @@ -1,88 +0,0 @@ -<?php -// -// +------------------------------------------------------------------------+ -// | PEAR :: PHPUnit | -// +------------------------------------------------------------------------+ -// | Copyright (c) 2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>. | -// +------------------------------------------------------------------------+ -// | This source file is subject to version 3.00 of the PHP License, | -// | that is available at 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. | -// +------------------------------------------------------------------------+ -// -// $Id: TestFailure.php,v 1.10 2005/05/14 05:58:38 sebastian Exp $ -// - -/** - * A TestFailure collects a failed test together with the caught exception. - * - * @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 Testing - * @package PHPUnit - */ -class PHPUnit_TestFailure { - /** - * @var object - * @access private - */ - var $_failedTest; - - /** - * @var string - * @access private - */ - var $_thrownException; - - /** - * Constructs a TestFailure with the given test and exception. - * - * @param object - * @param string - * @access public - */ - function PHPUnit_TestFailure(&$failedTest, &$thrownException) { - $this->_failedTest = &$failedTest; - $this->_thrownException = &$thrownException; - } - - /** - * Gets the failed test. - * - * @return object - * @access public - */ - function &failedTest() { - return $this->_failedTest; - } - - /** - * Gets the thrown exception. - * - * @return object - * @access public - */ - function &thrownException() { - return $this->_thrownException; - } - - /** - * Returns a short description of the failure. - * - * @return string - * @access public - */ - function toString() { - return sprintf( - "TestCase %s->%s() failed: %s\n", - - get_class($this->_failedTest), - $this->_failedTest->getName(), - $this->_thrownException - ); - } -} -?> diff --git a/inc/PHPUnit/TestListener.php b/inc/PHPUnit/TestListener.php deleted file mode 100644 index 7685df46792abf58159c8a6f198653cf385922df..0000000000000000000000000000000000000000 --- a/inc/PHPUnit/TestListener.php +++ /dev/null @@ -1,120 +0,0 @@ -<?php -// -// +------------------------------------------------------------------------+ -// | PEAR :: PHPUnit | -// +------------------------------------------------------------------------+ -// | Copyright (c) 2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>. | -// +------------------------------------------------------------------------+ -// | This source file is subject to version 3.00 of the PHP License, | -// | that is available at 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. | -// +------------------------------------------------------------------------+ -// -// $Id: TestListener.php,v 1.9 2004/12/22 08:06:11 sebastian Exp $ -// - -/** - * A Listener for test progress. - * - * Here is an example: - * - * <code> - * <?php - * require_once 'PHPUnit.php'; - * require_once 'PHPUnit/TestListener.php'; - * - * class MathTest extends PHPUnit_TestCase { - * var $fValue1; - * var $fValue2; - * - * function MathTest($name) { - * $this->PHPUnit_TestCase($name); - * } - * - * function setUp() { - * $this->fValue1 = 2; - * $this->fValue2 = 3; - * } - * - * function testAdd() { - * $this->assertTrue($this->fValue1 + $this->fValue2 == 4); - * } - * } - * - * class MyListener extends PHPUnit_TestListener { - * function addError(&$test, &$t) { - * print "MyListener::addError() called.\n"; - * } - * - * function addFailure(&$test, &$t) { - * print "MyListener::addFailure() called.\n"; - * } - * - * function endTest(&$test) { - * print "MyListener::endTest() called.\n"; - * } - * - * function startTest(&$test) { - * print "MyListener::startTest() called.\n"; - * } - * } - * - * $suite = new PHPUnit_TestSuite; - * $suite->addTest(new MathTest('testAdd')); - * - * $result = new PHPUnit_TestResult; - * $result->addListener(new MyListener); - * - * $suite->run($result); - * print $result->toString(); - * ?> - * </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 Testing - * @package PHPUnit - */ -class PHPUnit_TestListener { - /** - * An error occurred. - * - * @param object - * @param object - * @access public - * @abstract - */ - function addError(&$test, &$t) { /*abstract */ } - - /** - * A failure occurred. - * - * @param object - * @param object - * @access public - * @abstract - */ - function addFailure(&$test, &$t) { /*abstract */ } - - /** - * A test ended. - * - * @param object - * @access public - * @abstract - */ - function endTest(&$test) { /*abstract */ } - - /** - * A test started. - * - * @param object - * @access public - * @abstract - */ - function startTest(&$test) { /*abstract */ } -} -?> diff --git a/inc/PHPUnit/TestResult.php b/inc/PHPUnit/TestResult.php deleted file mode 100644 index ee60b2c5b50f8b2c3cb67d5cb91e8e3a032982ab..0000000000000000000000000000000000000000 --- a/inc/PHPUnit/TestResult.php +++ /dev/null @@ -1,300 +0,0 @@ -<?php -// -// +------------------------------------------------------------------------+ -// | PEAR :: PHPUnit | -// +------------------------------------------------------------------------+ -// | Copyright (c) 2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>. | -// +------------------------------------------------------------------------+ -// | This source file is subject to version 3.00 of the PHP License, | -// | that is available at 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. | -// +------------------------------------------------------------------------+ -// -// $Id: TestResult.php,v 1.13 2005/05/14 05:58:38 sebastian Exp $ -// - -require_once 'PHPUnit/TestFailure.php'; -require_once 'PHPUnit/TestListener.php'; - -/** - * A TestResult collects the results of executing a test case. - * - * @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 Testing - * @package PHPUnit - */ -class PHPUnit_TestResult { - /** - * @var array - * @access protected - */ - var $_errors = array(); - - /** - * @var array - * @access protected - */ - var $_failures = array(); - - /** - * @var array - * @access protected - */ - var $_listeners = array(); - - /** - * @var array - * @access protected - */ - var $_passedTests = array(); - - /** - * @var integer - * @access protected - */ - var $_runTests = 0; - - /** - * @var boolean - * @access private - */ - var $_stop = FALSE; - - /** - * Adds an error to the list of errors. - * The passed in exception caused the error. - * - * @param object - * @param object - * @access public - */ - function addError(&$test, &$t) { - $this->_errors[] = new PHPUnit_TestFailure($test, $t); - - for ($i = 0; $i < sizeof($this->_listeners); $i++) { - $this->_listeners[$i]->addError($test, $t); - } - } - - /** - * Adds a failure to the list of failures. - * The passed in exception caused the failure. - * - * @param object - * @param object - * @access public - */ - function addFailure(&$test, &$t) { - $this->_failures[] = new PHPUnit_TestFailure($test, $t); - - for ($i = 0; $i < sizeof($this->_listeners); $i++) { - $this->_listeners[$i]->addFailure($test, $t); - } - } - - /** - * Registers a TestListener. - * - * @param object - * @access public - */ - function addListener(&$listener) { - if (is_object($listener) && - is_a($listener, 'PHPUnit_TestListener')) { - $this->_listeners[] = &$listener; - } - } - - /** - * Adds a passed test to the list of passed tests. - * - * @param object - * @access public - */ - function addPassedTest(&$test) { - $this->_passedTests[] = &$test; - } - - /** - * Informs the result that a test was completed. - * - * @param object - * @access public - */ - function endTest(&$test) { - for ($i = 0; $i < sizeof($this->_listeners); $i++) { - $this->_listeners[$i]->endTest($test); - } - } - - /** - * Gets the number of detected errors. - * - * @return integer - * @access public - */ - function errorCount() { - return sizeof($this->_errors); - } - - /** - * Returns an Enumeration for the errors. - * - * @return array - * @access public - */ - function &errors() { - return $this->_errors; - } - - /** - * Gets the number of detected failures. - * - * @return integer - * @access public - */ - function failureCount() { - return sizeof($this->_failures); - } - - /** - * Returns an Enumeration for the failures. - * - * @return array - * @access public - */ - function &failures() { - return $this->_failures; - } - - /** - * Returns an Enumeration for the passed tests. - * - * @return array - * @access public - */ - function &passedTests() { - return $this->_passedTests; - } - - /** - * Unregisters a TestListener. - * This requires the Zend Engine 2 (to work properly). - * - * @param object - * @access public - */ - function removeListener(&$listener) { - for ($i = 0; $i < sizeof($this->_listeners); $i++) { - if ($this->_listeners[$i] === $listener) { - unset($this->_listeners[$i]); - } - } - } - - /** - * Runs a TestCase. - * - * @param object - * @access public - */ - function run(&$test) { - $this->startTest($test); - $this->_runTests++; - $test->runBare(); - $this->endTest($test); - } - - /** - * Gets the number of run tests. - * - * @return integer - * @access public - */ - function runCount() { - return $this->_runTests; - } - - /** - * Checks whether the test run should stop. - * - * @access public - */ - function shouldStop() { - return $this->_stop; - } - - /** - * Informs the result that a test will be started. - * - * @param object - * @access public - */ - function startTest(&$test) { - for ($i = 0; $i < sizeof($this->_listeners); $i++) { - $this->_listeners[$i]->startTest($test); - } - } - - /** - * Marks that the test run should stop. - * - * @access public - */ - function stop() { - $this->_stop = TRUE; - } - - /** - * Returns a HTML representation of the test result. - * - * @return string - * @access public - */ - function toHTML() { - return '<pre>' . htmlspecialchars($this->toString()) . '</pre>'; - } - - /** - * Returns a text representation of the test result. - * - * @return string - * @access public - */ - function toString() { - $result = ''; - - foreach ($this->_passedTests as $passedTest) { - $result .= sprintf( - "TestCase %s->%s() passed\n", - - get_class($passedTest), - $passedTest->getName() - ); - } - - foreach ($this->_failures as $failedTest) { - $result .= $failedTest->toString(); - } - - return $result; - } - /** - * Returns whether the entire test was successful or not. - * - * @return boolean - * @access public - */ - function wasSuccessful() { - if (empty($this->_errors) && empty($this->_failures)) { - return TRUE; - } else { - return FALSE; - } - } -} -?> diff --git a/inc/PHPUnit/TestSuite.php b/inc/PHPUnit/TestSuite.php deleted file mode 100644 index f2396748ba35391dd6b3f48363c318cc0cc62aac..0000000000000000000000000000000000000000 --- a/inc/PHPUnit/TestSuite.php +++ /dev/null @@ -1,220 +0,0 @@ -<?php -// -// +------------------------------------------------------------------------+ -// | PEAR :: PHPUnit | -// +------------------------------------------------------------------------+ -// | Copyright (c) 2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>. | -// +------------------------------------------------------------------------+ -// | This source file is subject to version 3.00 of the PHP License, | -// | that is available at 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. | -// +------------------------------------------------------------------------+ -// -// $Id: TestSuite.php,v 1.14 2005/05/14 05:58:38 sebastian Exp $ -// - -require_once 'PHPUnit/TestCase.php'; - -/** - * A TestSuite is a Composite of Tests. It runs a collection of test cases. - * - * Here is an example using the dynamic test definition. - * - * <code> - * <?php - * $suite = new PHPUnit_TestSuite(); - * $suite->addTest(new MathTest('testPass')); - * ?> - * </code> - * - * Alternatively, a TestSuite can extract the tests to be run automatically. - * To do so you pass the classname of your TestCase class to the TestSuite - * constructor. - * - * <code> - * <?php - * $suite = new TestSuite('classname'); - * ?> - * </code> - * - * This constructor creates a suite with all the methods starting with - * "test" that take no arguments. - * - * @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 Testing - * @package PHPUnit - */ -class PHPUnit_TestSuite { - /** - * The name of the test suite. - * - * @var string - * @access private - */ - var $_name = ''; - - /** - * The tests in the test suite. - * - * @var array - * @access private - */ - var $_tests = array(); - - /** - * Constructs a TestSuite. - * - * @param mixed - * @access public - */ - function PHPUnit_TestSuite($test = FALSE) { - if ($test !== FALSE) { - $this->setName($test); - $this->addTestSuite($test); - } - } - - /** - * Adds a test to the suite. - * - * @param object - * @access public - */ - function addTest(&$test) { - $this->_tests[] = &$test; - } - - /** - * Adds the tests from the given class to the suite. - * - * @param string - * @access public - */ - function addTestSuite($testClass) { - if (class_exists($testClass)) { - $methods = get_class_methods($testClass); - $parentClasses = array(strtolower($testClass)); - $parentClass = $testClass; - - while(is_string($parentClass = get_parent_class($parentClass))) { - $parentClasses[] = $parentClass; - } - - foreach ($methods as $method) { - if (substr($method, 0, 4) == 'test' && - !in_array($method, $parentClasses)) { - $this->addTest(new $testClass($method)); - } - } - } - } - - /** - * Counts the number of test cases that will be run by this test. - * - * @return integer - * @access public - */ - function countTestCases() { - $count = 0; - - foreach ($this->_tests as $test) { - $count += $test->countTestCases(); - } - - return $count; - } - - /** - * Returns the name of the suite. - * - * @return string - * @access public - */ - function getName() { - return $this->_name; - } - - /** - * Runs the tests and collects their result in a TestResult. - * - * @param object - * @access public - */ - function run(&$result) { - for ($i = 0; $i < sizeof($this->_tests) && !$result->shouldStop(); $i++) { - $this->_tests[$i]->run($result); - } - } - - /** - * Runs a test. - * - * @param object - * @param object - * @access public - */ - function runTest(&$test, &$result) { - $test->run($result); - } - - /** - * Sets the name of the suite. - * - * @param string - * @access public - */ - function setName($name) { - $this->_name = $name; - } - - /** - * Returns the test at the given index. - * - * @param integer - * @return object - * @access public - */ - function &testAt($index) { - if (isset($this->_tests[$index])) { - return $this->_tests[$index]; - } else { - return FALSE; - } - } - - /** - * Returns the number of tests in this suite. - * - * @return integer - * @access public - */ - function testCount() { - return sizeof($this->_tests); - } - - /** - * Returns the tests as an enumeration. - * - * @return array - * @access public - */ - function &tests() { - return $this->_tests; - } - - /** - * Returns a string representation of the test suite. - * - * @return string - * @access public - */ - function toString() { - return ''; - } -} -?> diff --git a/inc/User/backend.php b/inc/User/backend.php deleted file mode 100644 index f4c12f6a88f39e71e1c21ec49ea66ce376d85bcc..0000000000000000000000000000000000000000 --- a/inc/User/backend.php +++ /dev/null @@ -1,161 +0,0 @@ -<?php - -/** -* ownCloud -* -* @author Frank Karlitschek -* @copyright 2010 Frank Karlitschek karlitschek@kde.org -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either -* version 3 of the License, or any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. -* -*/ - - - -/** - * Base class for user management - * - */ -abstract class OC_USER_BACKEND { - - /** - * Check if the login button is pressed and log the user in - * - */ - abstract public static function loginListener(); - - /** - * Try to create a new user - * - * @param string $username The username of the user to create - * @param string $password The password of the new user - */ - abstract public static function createUser($username, $password); - - /** - * Try to login a user - * - * @param string $username The username of the user to log in - * @param string $password The password of the user - */ - abstract public static function login($username, $password); - - /** - * Check if the logout button is pressed and logout the user - * - */ - abstract public static function logoutListener(); - - /** - * Check if some user is logged in - * - */ - abstract public static function isLoggedIn(); - - /** - * Try to create a new group - * - * @param string $groupName The name of the group to create - */ - abstract public static function createGroup($groupName); - - /** - * Get the ID of a user - * - * @param string $username Name of the user to find the ID - * @param boolean $noCache If false the cache is used to find the ID - */ - abstract public static function getUserId($username, $noCache=false); - - /** - * Get the ID of a group - * - * @param string $groupName Name of the group to find the ID - * @param boolean $noCache If false the cache is used to find the ID - */ - abstract public static function getGroupId($groupName, $noCache=false); - - /** - * Get the name of a group - * - * @param string $groupId ID of the group - * @param boolean $noCache If false the cache is used to find the name of the group - */ - abstract public static function getGroupName($groupId, $noCache=false); - - /** - * Check if a user belongs to a group - * - * @param string $username Name of the user to check - * @param string $groupName Name of the group - */ - abstract public static function inGroup($username, $groupName); - - /** - * Add a user to a group - * - * @param string $username Name of the user to add to group - * @param string $groupName Name of the group in which add the user - */ - abstract public static function addToGroup($username, $groupName); - - /** - * Remove a user from a group - * - * @param string $username Name of the user to remove from group - * @param string $groupName Name of the group from which remove the user - */ - abstract public static function removeFromGroup($username,$groupName); - - /** - * Generate a random password - */ - abstract public static function generatePassword(); - - /** - * Get all groups the user belongs to - * - * @param string $username Name of the user - */ - abstract public static function getUserGroups($username); - - /** - * Set the password of a user - * - * @param string $username User who password will be changed - * @param string $password The new password for the user - */ - abstract public static function setPassword($username, $password); - - /** - * Check if the password of the user is correct - * - * @param string $username Name of the user - * @param string $password Password of the user - */ - abstract public static function checkPassword($username, $password); - - - /** - * get a list of all users - * - */ - abstract public static function getUsers(); - - /** - * get a list of all groups - * - */ - abstract public static function getGroups(); -} diff --git a/inc/User/database.php b/inc/User/database.php deleted file mode 100644 index df49e8d364a28a589a526d084d79c6c6b0a9b949..0000000000000000000000000000000000000000 --- a/inc/User/database.php +++ /dev/null @@ -1,417 +0,0 @@ -<?php - -/** -* ownCloud -* -* @author Frank Karlitschek -* @copyright 2010 Frank Karlitschek karlitschek@kde.org -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either -* version 3 of the License, or any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. -* -*/ - -oc_require_once('inc/User/backend.php'); - - - -/** - * Class for user management in a SQL Database (e.g. MySQL, SQLite) - * - */ -class OC_USER_DATABASE extends OC_USER_BACKEND { - static private $userGroupCache=array(); - - /** - * Check if the login button is pressed and log the user in - * - */ - public static function loginListener(){ - if ( isset($_POST['loginbutton']) AND isset($_POST['password']) AND isset($_POST['login']) ) { - if ( OC_USER::login($_POST['login'], $_POST['password']) ) { - echo 1; - OC_LOG::event($_SESSION['username'], 1, ''); - echo 2; - if ( (isset($CONFIG_HTTPFORCESSL) AND $CONFIG_HTTPFORCESSL) - OR (isset($_SERVER['HTTPS']) AND ('on' == $_SERVER['HTTPS'])) ) { - $url = 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; - } else { - $url = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; - } - header("Location: $url"); - die(); - } else { - return('error'); - } - } - return(''); - } - - /** - * Try to create a new user - * - * @param string $username The username of the user to create - * @param string $password The password of the new user - */ - public static function createUser($username, $password) { - self::clearCache(); - global $CONFIG_DBTABLEPREFIX; - // Check if the user already exists - if ( 0 != OC_USER::getUserId($username, true) ) { - return false; - } else { - $usernameClean = strToLower($username); - $password = sha1($password); - $username = OC_DB::escape($username); - $usernameClean = OC_DB::escape($usernameClean); - $query = "INSERT INTO `{$CONFIG_DBTABLEPREFIX}users` (`user_name` ,`user_name_clean` ,`user_password`) " - . "VALUES ('$username', '$usernameClean', '$password')"; - $result = OC_DB::query($query); - return $result ? true : false; - } - } - - /** - * Try to login a user - * - * @param string $username The username of the user to log in - * @param string $password The password of the user - */ - public static function login($username,$password){ - global $CONFIG_DBTABLEPREFIX; - - $password = sha1($password); - $usernameClean = strtolower($username); - $username = OC_DB::escape($username); - $usernameClean = OC_DB::escape($usernameClean); - $query = "SELECT user_id FROM {$CONFIG_DBTABLEPREFIX}users " - . "WHERE user_name_clean = '$usernameClean' AND user_password = '$password' LIMIT 1"; - $result = OC_DB::select($query); - if ( isset($result[0]) AND isset($result[0]['user_id']) ) { - $_SESSION['user_id'] = $result[0]['user_id']; - $_SESSION['username'] = $username; - $_SESSION['username_clean'] = $usernameClean; - return true; - } else { - return false; - } - } - - /** - * Check if the logout button is pressed and logout the user - * - */ - public static function logoutListener() { - global $WEBROOT; - if ( isset($_GET['logoutbutton']) AND isset($_SESSION['username']) ) { - OC_LOG::event($_SESSION['username'], 2, ''); - $_SESSION['user_id'] = false; - $_SESSION['username'] = ''; - $_SESSION['username_clean'] = ''; - - header("location: $WEBROOT"); - } - } - - /** - * Check if the user is logged in - * - */ - public static function isLoggedIn() { - if ( isset($_SESSION['user_id']) AND $_SESSION['user_id'] ) { - return true; - } else { - return false; - } - } - - /** - * Try to create a new group - * - * @param string $groupName The name of the group to create - */ - public static function createGroup($groupName) { - self::clearCache(); - global $CONFIG_DBTABLEPREFIX; - if (0 == OC_USER::getGroupId($groupName) ) { - $groupName = OC_DB::escape($groupName); - $query = "INSERT INTO `{$CONFIG_DBTABLEPREFIX}groups` (`group_name`) VALUES ('$groupName')"; - $result = OC_DB::query($query); - return $result ? true : false; - } else { - return false; - } - } - - /** - * Get the ID of a user - * - * @param string $username Name of the user to find the ID - * @param boolean $noCache If false the cache is used to find the ID - */ - public static function getUserId($username, $noCache=false) { - global $CONFIG_DBTABLEPREFIX; - - $usernameClean = strToLower($username); - // Try to use cached value to avoid an SQL query - if ( !$noCache AND isset($_SESSION['user_id_cache'][$usernameClean]) ) { - return $_SESSION['user_id_cache'][$usernameClean]; - } - $usernameClean = OC_DB::escape($usernameClean); - $query = "SELECT user_id FROM {$CONFIG_DBTABLEPREFIX}users WHERE user_name_clean = '$usernameClean'"; - $result = OC_DB::select($query); - if ( !is_array($result) ) { - return 0; - } - if ( isset($result[0]) AND isset($result[0]['user_id']) ) { - $_SESSION['user_id_cache'][$usernameClean] = $result[0]['user_id']; - return $result[0]['user_id']; - } else { - return 0; - } - } - - /** - * Get the ID of a group - * - * @param string $groupName Name of the group to find the ID - * @param boolean $noCache If false the cache is used to find the ID - */ - public static function getGroupId($groupName, $noCache=false) { - global $CONFIG_DBTABLEPREFIX; - - // Try to use cached value to avoid an SQL query - if ( !$noCache AND isset($_SESSION['group_id_cache'][$groupName]) ) { - return $_SESSION['group_id_cache'][$groupName]; - } - $groupName = OC_DB::escape($groupName); - $query = "SELECT group_id FROM {$CONFIG_DBTABLEPREFIX}groups WHERE group_name = '$groupName'"; - $result = OC_DB::select($query); - if ( !is_array($result) ) { - return 0; - } - if ( isset($result[0]) AND isset($result[0]['group_id']) ){ - $_SESSION['group_id_cache'][$groupName] = $result[0]['group_id']; - return $result[0]['group_id']; - } else { - return 0; - } - } - - /** - * Get the name of a group - * - * @param string $groupId ID of the group - * @param boolean $noCache If false the cache is used to find the name of the group - */ - public static function getGroupName($groupId, $noCache=false) { - global $CONFIG_DBTABLEPREFIX; - - // Try to use cached value to avoid an sql query - if ( !$noCache AND ($name = array_search($groupId, $_SESSION['group_id_cache'])) ) { - return $name; - } - $groupId = (integer)$groupId; - $query = "SELECT group_name FROM {$CONFIG_DBTABLEPREFIX}groups WHERE group_id = '$groupId' LIMIT 1"; - $result = OC_DB::select($query); - if ( isset($result[0]) AND isset($result[0]['group_name']) ) { - return $result[0]['group_name']; - } else { - return 0; - } - } - - /** - * Check if a user belongs to a group - * - * @param string $username Name of the user to check - * @param string $groupName Name of the group - */ - public static function inGroup($username,$groupName) { - global $CONFIG_DBTABLEPREFIX; - $userId = OC_USER::getUserId($username); - $groupId = OC_USER::getGroupId($groupName); - self::getUserGroups($username); - $groups=self::$userGroupCache[$userId]; - return (array_search($groupId,$groups)!==false); - } - - /** - * Add a user to a group - * - * @param string $username Name of the user to add to group - * @param string $groupName Name of the group in which add the user - */ - public static function addToGroup($username, $groupName) { - global $CONFIG_DBTABLEPREFIX; - self::clearCache(); - if ( !OC_USER::inGroup($username, $groupName) ) { - $userId = OC_USER::getUserId($username,true); - $groupId = OC_USER::getGroupId($groupName,true); - if ( (0 != $groupId) AND (0 != $userId) ) { - $query = "INSERT INTO `{$CONFIG_DBTABLEPREFIX}user_group` (`user_id` ,`group_id`) VALUES ('$userId', '$groupId');"; - $result = OC_DB::query($query); - if ( $result ) { - self::clearCache(); - return true; - } else { - return false; - } - } else { - return false; - } - } else { - return true; - } - } - - /** - * Remove a user from a group - * - * @param string $username Name of the user to remove from group - * @param string $groupName Name of the group from which remove the user - */ - public static function removeFromGroup($username,$groupName){ - global $CONFIG_DBTABLEPREFIX; - self::clearCache(); - if (OC_USER::inGroup($username, $groupName) ) { - $userId = OC_USER::getUserId($username,true); - $groupId = OC_USER::getGroupId($groupName,true); - if ( (0 != $groupId) AND (0 != $userId) ) { - $query="DELETE FROM `{$CONFIG_DBTABLEPREFIX}user_group` WHERE `group_id` =$groupId AND `user_id`=$userId"; - $result = OC_DB::query($query); - if ( $result ) { - self::clearCache(); - return true; - } else { - return false; - } - } - } - return false; - } - - /** - * Generate a random password - */ - public static function generatePassword(){ - return uniqId(); - } - - /** - * Get all groups the user belongs to - * - * @param string $username Name of the user - */ - public static function getUserGroups($username) { - global $CONFIG_DBTABLEPREFIX; - - $userId = OC_USER::getUserId($username); - if(!isset(self::$userGroupCache[$userId])){ - $query = "SELECT group_id FROM {$CONFIG_DBTABLEPREFIX}user_group WHERE user_id = '$userId'"; - $result = OC_DB::select($query); - $groupsId = array(); - if ( is_array($result) ) { - foreach ( $result as $group ) { - $groupId = $group['group_id']; - $groupsId[]=$groupId; - } - } - self::$userGroupCache[$userId]=$groupsId; - return $groupsId; - }else{ - return self::$userGroupCache[$userId]; - } - } - - /** - * Set the password of a user - * - * @param string $username User who password will be changed - * @param string $password The new password for the user - */ - public static function setPassword($username, $password) { - global $CONFIG_DBTABLEPREFIX; - - $password = sha1($password); - $userId = OC_USER::getUserId($username); - $query = "UPDATE {$CONFIG_DBTABLEPREFIX}users SET user_password = '$password' WHERE user_id ='$userId'"; - $result = OC_DB::query($query); - if ( $result ) { - return true; - } else { - return false; - } - } - - /** - * Check if the password of the user is correct - * - * @param string $username Name of the user - * @param string $password Password of the user - */ - public static function checkPassword($username, $password) { - global $CONFIG_DBTABLEPREFIX; - - $password = sha1($password); - $usernameClean = strToLower($username); - $usernameClean = OC_DB::escape($usernameClean); - $username = OC_DB::escape($username); - $query = "SELECT user_id FROM `{$CONFIG_DBTABLEPREFIX}users` " - . "WHERE user_name_clean = '$usernameClean' AND user_password = '$password' LIMIT 1"; - $result = OC_DB::select($query); - if ( isset($result[0]) AND isset($result[0]['user_id']) AND ($result[0]['user_id'] > 0) ) { - return true; - } else { - return false; - } - } - - /** - * get a list of all users - * - */ - public static function getUsers() { - global $CONFIG_DBTABLEPREFIX; - - $query = "SELECT user_name FROM `{$CONFIG_DBTABLEPREFIX}users`"; - $result = OC_DB::select($query); - $users=array(); - foreach($result as $user){ - $users[]=$user['user_name']; - } - return $users; - } - - /** - * get a list of all groups - * - */ - public static function getGroups() { - global $CONFIG_DBTABLEPREFIX; - - $query = "SELECT group_name FROM `{$CONFIG_DBTABLEPREFIX}groups`"; - $result = OC_DB::select($query); - $groups=array(); - foreach($result as $group){ - $groups[]=$group['group_name']; - } - return $groups; - } - - private static function clearCache(){ - self::$userGroupCache=array(); - $_SESSION['user_id_cache']=array(); - $_SESSION['group_id_cache']=array(); - } -} diff --git a/inc/docs/HTTP_WebDAV_Server/README b/inc/docs/HTTP_WebDAV_Server/README deleted file mode 100644 index 9847b2616847c4d4de28df0b2b58ddb7aa5962f2..0000000000000000000000000000000000000000 --- a/inc/docs/HTTP_WebDAV_Server/README +++ /dev/null @@ -1,10 +0,0 @@ -This code depends on code introduced into the developement branch for -PHP 4.3, so it will not run with PHP releases before 4.3.0 - -preliminary documentation is available in the dav.txt file, -although it is currently a little outdated ... - -Server/Filesystem.php contains a sample implementation for a simple -file server (including property and lock info storage in a mySQL -database, see db/Fileserver.sql). This sample should give you a good -clue about how to use this class for your own purpose. diff --git a/inc/docs/HTTP_WebDAV_Server/dav.txt b/inc/docs/HTTP_WebDAV_Server/dav.txt deleted file mode 100644 index 9e0b82992293185bc58e72aa7fd8d91fb4543b18..0000000000000000000000000000000000000000 --- a/inc/docs/HTTP_WebDAV_Server/dav.txt +++ /dev/null @@ -1,229 +0,0 @@ -The HTTP_WebDAV_Server class provides a framwork for the -implementation of customized WebDAV servers that can provide -filesystem like access to almost any kind of hierachically stored -data. - -The (abstract) server base class tries to encapsulate as much of -the protocol details as possible. It takes care of the needed WebDAV -header and XML payload parsing and generation (and knows about some -of the problems with common clients and tries hard to work around -them). - -WebDAV itself is an extension to the HTTP protocol. The HTTP -specific parts of it are already taken care of by the web server. Any -data needed by the server class is provided by the PHP SAPI interface -of the server used. - -To create a working server from the base class you have to extend and -add methods for the actual access, modification and access control of -your own data. - -You may use the included HTTP_WebDAV_Server_Filesystem class as an -example of how to create a working server. This sample implementation -is used for testing the implementation of this package against the -litmus WebDAV compliance test suite. -(litmus is available on http://www.webdav.org/neon/litmus) - -The methods you can add in your extended class are mostly named after -the WebDAV specific request methods (using upper case names). Methods -you may implement are: - -* GET() get a resource from the server -* HEAD() get resource headers only from the server -* PUT() create or modify a resource on the server -* COPY() copy a resource on the server -* MOVE() move a resource on the server -* DELETE() delete a resource on the server -* MKCOL() create a new collection -* PROPFIND() get property data for a resource -* PROPPATCH() modify property data for a resource -* LOCK() lock a resource -* UNLOCK() unlock a locked resource -* checklock() check whether a resource is locked -* check_auth() check authentication - -You can think of WebDAV resources as files, collections as directories -and properties as filesystem meta data (like size, creation date, ...). - -The base class is able identify which of the methods you have -implemented and will create appropriate answers to OPTIONS requests -that ask for the WebDAV standards compliance level and the allowed -HTTP methods for you. - -For a minimal working test server you need to implement GET(), PUT() -and PROPFIND() only. - -For a minimal (level 1) standards compliant server you also need to -implement MKCOL(), DELETE(), and PROPPATCH(). The COPY(), MOVE() and -HEAD() methods are emulated using GET(), PUT() and DELETE() if not -implemented, but for performance reasons you should better implement -them yourself. - -For a complete (level 2) RFC2518 compliand server you also have to -provide locking support by implementing LOCK(), UNLOCK() and -checklock(). - -Authentication is not really part of the WebDAV specification and -should be handled on the HTTP level. You can do so by means of, for -example, .htaccess files or similar services provided by your web -server. But you can also make use of the authentication features -offered by PHP by implementing the check_auth() method. -Using the check_auth() method you can create a dynamic interface -to any authentication system protecting the data you want to serve. - - -<WARNING> - the following reference information may be outdated and/or - incomplete ... -</WARNING> - -bool PROPINFO($options, &$files) - - options[path] - Resource-Path - options[depth] - Depth of search requested: "0", "1", or "infinity" - options[props] - "all", "names", or an arry of requested properties - each property array element is either a string - (which implies the default "DAV:" namespace) or - an array with the two elements "name" and "xmlns" - for the properties name and XML namespace - - &$files - storage array for property results with the following elements: - - "files" -> array of found properties forresources. elements are: - - "path" -> path of the resource - "props" -> properties array - each property array element is either a string - (which implies the default "DAV:" namespace) or - an array with the two elements "name" and "xmlns" - for the properties name and XML namespace - - you should at least support the following - list of properties from the "DAV:" namespave: - - - resourcetype: "collection" oder "" - - creationdate: unix-timestamp - - getcontentlength: integer - - getlastmodified: unix-timestamp - - You may want to add support for these "DAV:" - properties, too: - - - getcontenttype: mime-type - - displayname: string - - for a compliant server you also have to be - able to return any property from other - namespaces that has been stored using - PROPPATCH - - - return-value: true / false - - - - -string MKCOL($option) - - options[path] - path of the new collection to be created - - return-value: string - HTTP status and status message, possible values are - * 201 Success - * 403 Forbidden - * 405 Method not allowed - * 409 Conflict - * 415 Unsupported media type - * 507 Insufficient Storage - (see also RFC2518 8.3.2) - - - - -string GET(&$options) - - $options['path'] - path to the requested resource - $options['ranges'] - optional array of range specifications for - partial access. range specs are arrays that - consist of either a 'start' and 'end' element - (where 'end' can be empty to indicate a request - up to the actual end of the resource) or a - 'last' element to access the last n bytes of - a resource without knowing its actual size in - advance - - Return-value: true bei Erfolg, false wenn not found - - (TODO: andere stati berücksichtigen) - - Content-Type, Content-Length header müssen von der Methode selbst - erzeugt werden (TODO: outdated) - - - - -string PUT($options) - - options[path] - path to the requested resource - options[content_length] - size of request data in bytes - options[stream] - a PHP stream providing the input data - - return-value: string - HTTP status, possible values are: - * 201 Created -> the resource did not exist before - and has been successfully created - * 204 No Content -> a previously existing resource has - successfully been modified - * 409 Conflict - ... - - - - -string COPY($options) - - options[path] - path to the resource to be copied - options[depth] - "0" or "infinity" (applies only to directories) - options[overwrite] - true / false - options[dest] - path to the destination resource if local - options[dest_url] - non-local destination path - - return-value: string - HTTP status, see RFC2518 8.8.5 - - - - - -string MOVE($options) - - options[path] - path to the resource to be moved - options[overwrite] - true / false - options[dest] - path to the destination resource if local - options[dest_url] - non-local destination path - - return-value: string - HTTP status, see RFC2518 8.9.4 - - - - -string DELETE($options) - - options[path] - path to the resource to be removed - - return-value: string - HTTP status, see RFC2518 8.6.2 - - - - - -bool check_auth($type, $user, $passwd) - - $type: HTTP-Auth type, i.A. "Basic" - $user: HTTP Username - $passwd: HTTP Passwort - - return-value: true bei success, sonst false - (ToDo: array mit Auth-Type und Realm String zulassen bei fehler) \ No newline at end of file diff --git a/inc/docs/HTTP_WebDAV_Server/db/Fileserver.sql b/inc/docs/HTTP_WebDAV_Server/db/Fileserver.sql deleted file mode 100644 index 8047d12f5e447e9448719254f9a15891c4444fc4..0000000000000000000000000000000000000000 --- a/inc/docs/HTTP_WebDAV_Server/db/Fileserver.sql +++ /dev/null @@ -1,49 +0,0 @@ --- MySQL dump 9.06 --- --- Host: localhost Database: webdav ---------------------------------------------------------- --- Server version 4.0.3-beta - --- --- Table structure for table 'locks' --- - -CREATE TABLE locks ( - token varchar(255) NOT NULL default '', - path varchar(200) NOT NULL default '', - expires int(11) NOT NULL default '0', - owner varchar(200) default NULL, - recursive int(11) default '0', - writelock int(11) default '0', - exclusivelock int(11) NOT NULL default 0, - PRIMARY KEY (token), - UNIQUE KEY token (token), - KEY path (path), - KEY path_2 (path), - KEY path_3 (path,token), - KEY expires (expires) -) TYPE=MyISAM; - --- --- Dumping data for table 'locks' --- - - --- --- Table structure for table 'properties' --- - -CREATE TABLE properties ( - path varchar(255) NOT NULL default '', - name varchar(120) NOT NULL default '', - ns varchar(120) NOT NULL default 'DAV:', - value text, - PRIMARY KEY (path,name,ns), - KEY path (path) -) TYPE=MyISAM; - --- --- Dumping data for table 'properties' --- - - diff --git a/inc/lib_base.php b/inc/lib_base.php deleted file mode 100644 index f51feb3e147cf81731ecb10c88ef6521f2e5bb6c..0000000000000000000000000000000000000000 --- a/inc/lib_base.php +++ /dev/null @@ -1,744 +0,0 @@ -<?php -/** -* ownCloud -* -* @author Frank Karlitschek -* @copyright 2010 Frank Karlitschek karlitschek@kde.org -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either -* version 3 of the License, or any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. -* -*/ - - -// set some stuff -ob_start(); -// error_reporting(E_ALL | E_STRICT); -error_reporting(E_ALL); // MDB2 gives loads of strict error, disabling for now - -date_default_timezone_set('Europe/Berlin'); -ini_set('arg_separator.output','&'); -ini_set('session.cookie_httponly','1;'); -session_start(); -// calculate the documentroot -$SERVERROOT=substr(__FILE__,0,-17); -$DOCUMENTROOT=realpath($_SERVER['DOCUMENT_ROOT']); -$SERVERROOT=str_replace("\\",'/',$SERVERROOT); -$SUBURI=substr(realpath($_SERVER["SCRIPT_FILENAME"]),strlen($SERVERROOT)); -$WEBROOT=substr($_SERVER["SCRIPT_NAME"],0,strlen($_SERVER["SCRIPT_NAME"])-strlen($SUBURI)); - - - -if($WEBROOT!='' and $WEBROOT[0]!=='/'){ - $WEBROOT='/'.$WEBROOT; -} - -// set the right include path -// set_include_path(get_include_path().PATH_SEPARATOR.$SERVERROOT.PATH_SEPARATOR.$SERVERROOT.'/inc'.PATH_SEPARATOR.$SERVERROOT.'/config'); - -// define default config values -$CONFIG_INSTALLED=false; -$CONFIG_DATADIRECTORY=$SERVERROOT.'/data'; -$CONFIG_BACKUPDIRECTORY=$SERVERROOT.'/backup'; -$CONFIG_HTTPFORCESSL=false; -$CONFIG_ENABLEBACKUP=false; -$CONFIG_DATEFORMAT='j M Y G:i'; -$CONFIG_DBNAME='owncloud'; -$CONFIG_DBTYPE='sqlite'; -$CONFIG_FILESYSTEM=array(); - -// include the generated configfile -@include_once($SERVERROOT.'/config/config.php'); - - -$CONFIG_DATADIRECTORY_ROOT=$CONFIG_DATADIRECTORY;// store this in a seperate variable so we can change the data directory to jail users. -// redirect to https site if configured -if(isset($CONFIG_HTTPFORCESSL) and $CONFIG_HTTPFORCESSL){ - if(!isset($_SERVER['HTTPS']) or $_SERVER['HTTPS'] != 'on') { - $url = "https://". $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; - header("Location: $url"); - exit; - } -} - -// load core libs -oc_require_once('lib_files.php'); -oc_require_once('lib_filesystem.php'); -oc_require_once('lib_filestorage.php'); -oc_require_once('lib_fileobserver.php'); -oc_require_once('lib_log.php'); -oc_require_once('lib_config.php'); -oc_require_once('lib_user.php'); -oc_require_once('lib_ocs.php'); -oc_require_once('lib_connect.php'); -oc_require_once('lib_remotestorage.php'); -oc_require_once('lib_plugin.php'); - -OC_PLUGIN::loadPlugins(); - -if(!isset($CONFIG_BACKEND)){ - $CONFIG_BACKEND='database'; -} -OC_USER::setBackend($CONFIG_BACKEND); - -OC_UTIL::setupFS(); - - - -// check if the server is correctly configured for ownCloud -OC_UTIL::checkserver(); - -// listen for login or logout actions -OC_USER::logoutlistener(); -$loginresult=OC_USER::loginlistener(); - -/** - * Class for utility functions - * - */ -class OC_UTIL { - public static $scripts=array(); - public static $styles=array(); - private static $fsSetup=false; - - public static function setupFS(){// configure the initial filesystem based on the configuration - if(self::$fsSetup){//setting up the filesystem twice can only lead to trouble - return false; - } - global $SERVERROOT; - global $CONFIG_DATADIRECTORY_ROOT; - global $CONFIG_DATADIRECTORY; - global $CONFIG_BACKUPDIRECTORY; - global $CONFIG_ENABLEBACKUP; - global $CONFIG_FILESYSTEM; - if(!is_dir($CONFIG_DATADIRECTORY_ROOT)){ - @mkdir($CONFIG_DATADIRECTORY_ROOT) or die("Can't create data directory ($CONFIG_DATADIRECTORY_ROOT), you can usually fix this by setting the owner of '$SERVERROOT' to the user that the web server uses (www-data for debian/ubuntu)"); - } - if(OC_USER::isLoggedIn()){ //if we aren't logged in, there is no use to set up the filesystem - $rootStorage=null; - - //set up storages according to the system settings - foreach($CONFIG_FILESYSTEM as $storageConfig){ - if(OC_FILESYSTEM::hasStorageType($storageConfig['type'])){ - $arguments=$storageConfig; - unset($arguments['type']); - unset($arguments['mountpoint']); - $storage=OC_FILESYSTEM::createStorage($storageConfig['type'],$arguments); - if($storage){ - OC_FILESYSTEM::mount($storage,$storageConfig['mountpoint']); - if($storageConfig['mountpoint']=='/'){ - $rootStorage=$storage; - } - } - } - } - - //create root filestorage if not specified in system settings - if(!$rootStorage){ - $rootStorage=OC_FILESYSTEM::createStorage('local',array('datadir'=>$CONFIG_DATADIRECTORY)); - OC_FILESYSTEM::mount($rootStorage,'/'); - $CONFIG_DATADIRECTORY=$CONFIG_DATADIRECTORY_ROOT.'/'.$_SESSION['username_clean']; - if(!is_dir($CONFIG_DATADIRECTORY)){ - mkdir($CONFIG_DATADIRECTORY); - } - } - - if($CONFIG_ENABLEBACKUP){ - if(!is_dir($CONFIG_BACKUPDIRECTORY)){ - mkdir($CONFIG_BACKUPDIRECTORY); - } - if(!is_dir($CONFIG_BACKUPDIRECTORY.'/'.$_SESSION['username_clean'])){ - mkdir($CONFIG_BACKUPDIRECTORY.'/'.$_SESSION['username_clean']); - } - $backupStorage=OC_FILESYSTEM::createStorage('local',array('datadir'=>$CONFIG_BACKUPDIRECTORY)); - $backup=new OC_FILEOBSERVER_BACKUP(array('storage'=>$backupStorage)); - $rootStorage->addObserver($backup); - } - - //jail the user into his "home" directory - OC_FILESYSTEM::chroot('/'.$_SESSION['username_clean']); - self::$fsSetup=true; - } - } - - /** - * get the current installed version of ownCloud - * @return array - */ - public static function getVersion(){ - return array(1,1,0); - } - - /** - * add a javascript file - * - * @param url $url - */ - public static function addScript($url){ - self::$scripts[]=$url; - } - /** - * add a css file - * - * @param url $url - */ - public static function addStyle($url){ - self::$styles[]=$url; - } - - /** - * array to store all the optional navigation buttons of the plugins - * - */ - static private $NAVIGATION = array(); - - - /** - * check if the current server configuration is suitable for ownCloud - * - */ - public static function checkServer(){ - global $SERVERROOT; - global $CONFIG_DATADIRECTORY_ROOT; - global $CONFIG_BACKUPDIRECTORY; - global $CONFIG_ENABLEBACKUP; - global $CONFIG_INSTALLED; - $error=''; - if(!is_callable('sqlite_open') and !is_callable('mysql_connect')){ - $error.='No database drivers (sqlite or mysql) installed.<br/>'; - } - global $CONFIG_DBTYPE; - global $CONFIG_DBNAME; - if(!stristr(PHP_OS, 'WIN')){ - if($CONFIG_DBTYPE=='sqlite'){ - $file=$SERVERROOT.'/'.$CONFIG_DBNAME; - if(file_exists($file)){ - $prems=substr(decoct(fileperms($file)),-3); - if(substr($prems,2,1)!='0'){ - @chmod($file,0660); - clearstatcache(); - $prems=substr(decoct(fileperms($file)),-3); - if(substr($prems,2,1)!='0'){ - $error.='SQLite database file ('.$file.') is readable from the web<br/>'; - } - } - } - } - $prems=substr(decoct(fileperms($CONFIG_DATADIRECTORY_ROOT)),-3); - if(substr($prems,-1)!='0'){ - chmodr($CONFIG_DATADIRECTORY_ROOT,0770); - clearstatcache(); - $prems=substr(decoct(fileperms($CONFIG_DATADIRECTORY_ROOT)),-3); - if(substr($prems,2,1)!='0'){ - $error.='Data directory ('.$CONFIG_DATADIRECTORY_ROOT.') is readable from the web<br/>'; - } - } - if($CONFIG_ENABLEBACKUP){ - $prems=substr(decoct(fileperms($CONFIG_BACKUPDIRECTORY)),-3); - if(substr($prems,-1)!='0'){ - chmodr($CONFIG_BACKUPDIRECTORY,0770); - clearstatcache(); - $prems=substr(decoct(fileperms($CONFIG_BACKUPDIRECTORY)),-3); - if(substr($prems,2,1)!='0'){ - $error.='Data directory ('.$CONFIG_BACKUPDIRECTORY.') is readable from the web<br/>'; - } - } - } - }else{ - //TODO: premisions checks for windows hosts - } - if($error){ - die($error); - } -} - - /** - * show the header of the web GUI - * - */ - public static function showHeader(){ - global $CONFIG_ADMINLOGIN; - global $WEBROOT; - oc_require('templates/header.php');; - } - - /** - * check if we need to use the layout optimized for smaller screen, currently only checks for iPhone/Android - * @return bool - */ - public static function hasSmallScreen(){ - $userAgent=strtolower($_SERVER['HTTP_USER_AGENT']); - if(strpos($userAgent,'android') or strpos($userAgent,'iphone') or strpos($userAgent,'ipod')){//todo, add support for more devices - return true; - } - return false; - } - - /** - * show the footer of the web GUI - * - */ - public static function showFooter(){ - global $CONFIG_FOOTEROWNERNAME; - global $CONFIG_FOOTEROWNEREMAIL; - oc_require('templates/footer.php');; - } - - /** - * add an navigationentry to the main navigation - * - * @param name $name - * @param url $url - */ - public static function addNavigationEntry($name,$url) { - $entry=array(); - $entry['name']=$name; - $entry['url']=$url; - OC_UTIL::$NAVIGATION[]=$entry; - } - - /** - * show the main navigation - * - */ - public static function showNavigation(){ - global $WEBROOT; - global $SERVERROOT; - echo('<table class="center" cellpadding="5" cellspacing="0" border="0"><tr>'); - echo('<td class="navigationitem1"><a href="'.$WEBROOT.'/">'.$_SESSION['username'].'</a></td>'); - if($_SERVER['SCRIPT_NAME']==$WEBROOT.'/index.php') echo('<td class="navigationitemselected"><a href="'.$WEBROOT.'/">Files</a></td>'); else echo('<td class="navigationitem"><a href="'.$WEBROOT.'/">Files</a></td>'); - - foreach(OC_UTIL::$NAVIGATION as $NAVI) { - if(dirname($_SERVER['SCRIPT_NAME'])==$WEBROOT.$NAVI['url']) echo('<td class="navigationitemselected"><a href="'.$WEBROOT.$NAVI['url'].'">'.$NAVI['name'].'</a></td>'); else echo('<td class="navigationitem"><a href="'.$WEBROOT.$NAVI['url'].'">'.$NAVI['name'].'</a></td>'); - } - - if($_SERVER['SCRIPT_NAME']==$WEBROOT.'/log/index.php') echo('<td class="navigationitemselected"><a href="'.$WEBROOT.'/log">Log</a></td>'); else echo('<td class="navigationitem"><a href="'.$WEBROOT.'/log">Log</a></td>'); - if($_SERVER['SCRIPT_NAME']==$WEBROOT.'/settings/index.php') echo('<td class="navigationitemselected"><a href="'.$WEBROOT.'/settings">Settings</a></td>'); else echo('<td class="navigationitem"><a href="'.$WEBROOT.'/settings">Settings</a></td>'); - echo('<td class="navigationitem"><a href="?logoutbutton=1">Logout</a></td>'); - echo('</tr></table>'); - } - - - /** - * show the loginform - * - */ - public static function showLoginForm(){ - global $loginresult; - oc_require('templates/loginform.php'); - } - - - /** - * show an icon for a filetype - * - */ - public static function showIcon($filetype){ - global $WEBROOT; - if($filetype=='dir'){ echo('<td><img src="'.$WEBROOT.'/img/icons/folder.png" width="16" height="16"></td>'); - }elseif($filetype=='foo'){ echo('<td>foo</td>'); - }else{ echo('<td><img src="'.$WEBROOT.'/img/icons/other.png" width="16" height="16"></td>'); - } - } -} - - -/** - * Class for database access - * - */ -class OC_DB { - static private $DBConnection=false; - static private $schema=false; - static private $affected=0; - static private $result=false; - /** - * connect to the datbase if not already connected - */ - public static function connect(){ - global $CONFIG_DBNAME; - global $CONFIG_DBHOST; - global $CONFIG_DBUSER; - global $CONFIG_DBPASSWORD; - global $CONFIG_DBTYPE; - global $DOCUMENTROOT; - global $SERVERROOT; - if(!self::$DBConnection){ - @oc_require_once('MDB2.php'); - $options = array( - 'portability' => MDB2_PORTABILITY_ALL, - 'log_line_break' => '<br>', - 'idxname_format' => '%s', - 'debug' => true, - 'quote_identifier' => true, - ); - if($CONFIG_DBTYPE=='sqlite'){ - $dsn = array( - 'phptype' => 'sqlite', - 'database' => $SERVERROOT.'/'.$CONFIG_DBNAME, - 'mode' => '0644', - ); - }elseif($CONFIG_DBTYPE=='mysql'){ - $dsn = array( - 'phptype' => 'mysql', - 'username' => $CONFIG_DBUSER, - 'password' => $CONFIG_DBPASSWORD, - 'hostspec' => $CONFIG_DBHOST, - 'database' => $CONFIG_DBNAME, - ); - }elseif($CONFIG_DBTYPE=='pgsql'){ - $dsn = array( - 'phptype' => 'pgsql', - 'username' => $CONFIG_DBUSER, - 'password' => $CONFIG_DBPASSWORD, - 'hostspec' => $CONFIG_DBHOST, - 'database' => $CONFIG_DBNAME, - ); - } - self::$DBConnection=MDB2::factory($dsn,$options); - - if (PEAR::isError(self::$DBConnection)) { - echo('<b>can not connect to database, using '.$CONFIG_DBTYPE.'. ('.self::$DBConnection->getUserInfo().')</center>'); - $error=self::$DBConnection->getMessage(); - error_log("$error"); - error_log(self::$DBConnection->getUserInfo()); - die($error); - } - self::$DBConnection->setFetchMode(MDB2_FETCHMODE_ASSOC); - } - } - - public static function connectScheme(){ - self::connect(); - if(!self::$schema){ - @oc_require_once('MDB2/Schema.php'); - self::$schema=&MDB2_Schema::factory(self::$DBConnection); - } - } - - /** - * executes a query on the database - * - * @param string $cmd - * @return result-set - */ - static function query($cmd){ - global $CONFIG_DBTYPE; - if(!trim($cmd)){ - return false; - } - OC_DB::connect(); - //fix differences between sql versions - - //differences in escaping of table names (` for mysql) - if($CONFIG_DBTYPE=='sqlite'){ - $cmd=str_replace('`','\'',$cmd); - }elseif($CONFIG_DBTYPE=='pgsql'){ - $cmd=str_replace('`','"',$cmd); - } - $result=self::$DBConnection->exec($cmd); - if (PEAR::isError($result)) { - $entry='DB Error: "'.$result->getMessage().'"<br />'; - $entry.='Offending command was: '.$cmd.'<br />'; - error_log($entry); - die($entry); - }else{ - self::$affected=$result; - } - self::$result=$result; - return $result; - } - - /** - * executes a query on the database and returns the result in an array - * - * @param string $cmd - * @return result-set - */ - static function select($cmd){ - OC_DB::connect(); - global $CONFIG_DBTYPE; - //fix differences between sql versions - - //differences in escaping of table names (` for mysql) - if($CONFIG_DBTYPE=='sqlite'){ - $cmd=str_replace('`','\'',$cmd); - }elseif($CONFIG_DBTYPE=='pgsql'){ - $cmd=str_replace('`','"',$cmd); - } - $result=self::$DBConnection->queryAll($cmd); - if (PEAR::isError($result)){ - $entry='DB Error: "'.$result->getMessage().'"<br />'; - $entry.='Offending command was: '.$cmd.'<br />'; - die($entry); - } - return $result; - } - - /** - * executes multiply queries on the database - * - * @param string $cmd - * @return result-set - */ - static function multiquery($cmd) { - $queries=explode(';',$cmd); - foreach($queries as $query){ - OC_DB::query($query); - } - return true; - } - - - /** - * closing a db connection - * - * @return bool - */ - static function close() { - self::$DBConnection->disconnect(); - self::$DBConnection=false; - } - - - /** - * Returning primarykey if last statement was an insert. - * - * @return primarykey - */ - static function insertid() { - $id=self::$DBConnection->lastInsertID(); - return $id; - } - - /** - * Returning number of rows in a result - * - * @param resultset $result - * @return int - */ - static function numrows($result) { - $result->numRows(); - } - /** - * Returning number of affected rows - * - * @return int - */ - static function affected_rows() { - return self::$affected; - } - - /** - * get a field from the resultset - * - * @param resultset $result - * @param int $i - * @param int $field - * @return unknown - */ - static function result($result, $i, $field) { - $tmp=$result->fetchRow(MDB2_FETCHMODE_ASSOC,$i); - $tmp=$tmp[$field]; - return($tmp); - } - - /** - * get data-array from resultset - * - * @param resultset $result - * @return data - */ - static function fetch_assoc($result){ - return $result->fetchRow(MDB2_FETCHMODE_ASSOC); - } - - /** - * Freeing resultset (performance) - * - * @param unknown_type $result - * @return bool - */ - static function free_result() { - if(self::$result){ - self::$result->free(); - self::$result=false; - } - } - - static public function disconnect(){ - if(self::$DBConnection){ - self::$DBConnection->disconnect(); - self::$DBConnection=false; - } - } - - /** - * escape strings so they can be used in queries - * - * @param string string - * @return string - */ - static function escape($string){ - OC_DB::connect(); - return self::$DBConnection->escape($string); - } - - static function getDbStructure($file){ - OC_DB::connectScheme(); - $definition = self::$schema->getDefinitionFromDatabase(); - $dump_options = array( - 'output_mode' => 'file', - 'output' => $file, - 'end_of_line' => "\n" - ); - self::$schema->dumpDatabase($definition, $dump_options, MDB2_SCHEMA_DUMP_STRUCTURE); - } - - static function createDbFromStructure($file){ - OC_DB::connectScheme(); - global $CONFIG_DBNAME; - global $CONFIG_DBTABLEPREFIX; - $content=file_get_contents($file); - $file2=tempnam(sys_get_temp_dir(),'oc_db_scheme_'); - $content=str_replace('*dbname*',$CONFIG_DBNAME,$content); - $content=str_replace('*dbprefix*',$CONFIG_DBTABLEPREFIX,$content); - file_put_contents($file2,$content); - $definition=@self::$schema->parseDatabaseDefinitionFile($file2); - unlink($file2); - if($definition instanceof MDB2_Schema_Error){ - die($definition->getMessage() . ': ' . $definition->getUserInfo()); - } - $ret=@self::$schema->createDatabase($definition); - if($ret instanceof MDB2_Error) { - die ($ret->getMessage() . ': ' . $ret->getUserInfo()); - }else{ - return true; - } - } -} - - -//custom require/include functions because not all hosts allow us to set the include path -function oc_require($file){ - global $SERVERROOT; - global $DOCUMENTROOT; - global $WEBROOT; - global $CONFIG_DBNAME; - global $CONFIG_DBHOST; - global $CONFIG_DBUSER; - global $CONFIG_DBPASSWORD; - global $CONFIG_DBTYPE; - global $CONFIG_DATADIRECTORY; - global $CONFIG_HTTPFORCESSL; - global $CONFIG_DATEFORMAT; - global $CONFIG_INSTALLED; - if(is_file($file)){ - return require($file); - }elseif(is_file($SERVERROOT.'/'.$file)){ - return require($SERVERROOT.'/'.$file); - }elseif(is_file($SERVERROOT.'/inc/'.$file)){ - return require($SERVERROOT.'/inc/'.$file); - } -} - -function oc_require_once($file){ - global $SERVERROOT; - global $DOCUMENTROOT; - global $WEBROOT; - global $CONFIG_DBNAME; - global $CONFIG_DBHOST; - global $CONFIG_DBUSER; - global $CONFIG_DBPASSWORD; - global $CONFIG_DBTYPE; - global $CONFIG_DATADIRECTORY; - global $CONFIG_HTTPFORCESSL; - global $CONFIG_DATEFORMAT; - global $CONFIG_INSTALLED; - if(is_file($file)){ - return require_once($file); - }elseif(is_file($SERVERROOT.'/'.$file)){ - return require_once($SERVERROOT.'/'.$file); - }elseif(is_file($SERVERROOT.'/inc/'.$file)){ - return require_once($SERVERROOT.'/inc/'.$file); - } -} - -function oc_include($file){ - global $SERVERROOT; - global $DOCUMENTROOT; - global $WEBROOT; - global $CONFIG_DBNAME; - global $CONFIG_DBHOST; - global $CONFIG_DBUSER; - global $CONFIG_DBPASSWORD; - global $CONFIG_DBTYPE; - global $CONFIG_DATADIRECTORY; - global $CONFIG_HTTPFORCESSL; - global $CONFIG_DATEFORMAT; - global $CONFIG_INSTALLED; - if(is_file($file)){ - return include($file); - }elseif(is_file($SERVERROOT.'/'.$file)){ - return include($SERVERROOT.'/'.$file); - }elseif(is_file($SERVERROOT.'/inc/'.$file)){ - return include($SERVERROOT.'/inc/'.$file); - } -} - -function oc_include_once($file){ - global $SERVERROOT; - global $DOCUMENTROOT; - global $WEBROOT; - global $CONFIG_DBNAME; - global $CONFIG_DBHOST; - global $CONFIG_DBUSER; - global $CONFIG_DBPASSWORD; - global $CONFIG_DBTYPE; - global $CONFIG_DATADIRECTORY; - global $CONFIG_HTTPFORCESSL; - global $CONFIG_DATEFORMAT; - global $CONFIG_INSTALLED; - if(is_file($SERVERROOT.'/'.$file)){ - return include_once($SERVERROOT.'/'.$file); - }elseif(is_file($SERVERROOT.'/inc/'.$file)){ - return include_once($SERVERROOT.'/inc/'.$file); - }elseif(is_file($file)){ - return include_once($file); - } -} - -function chmodr($path, $filemode) { -// echo "$path<br/>"; - if (!is_dir($path)) - return chmod($path, $filemode); - $dh = opendir($path); - while (($file = readdir($dh)) !== false) { - if($file != '.' && $file != '..') { - $fullpath = $path.'/'.$file; - if(is_link($fullpath)) - return FALSE; - elseif(!is_dir($fullpath) && !chmod($fullpath, $filemode)) - return FALSE; - elseif(!chmodr($fullpath, $filemode)) - return FALSE; - } - } - closedir($dh); - if(chmod($path, $filemode)) - return TRUE; - else - return FALSE; -} - -?> diff --git a/inc/lib_config.php b/inc/lib_config.php deleted file mode 100644 index 75ddaafc31692c335747be728b3a2fb414c24d42..0000000000000000000000000000000000000000 --- a/inc/lib_config.php +++ /dev/null @@ -1,392 +0,0 @@ -<?php -class OC_CONFIG{ - static public $forms=array(); - - /** - * add a form to the settings page - * @param string name - * @param string url - */ - public static function addForm($name,$url){ - self::$forms[$name]=$url; - } - - /** - * settings page - * - */ - public static function showSettings(){ - oc_require('templates/settings.php'); - } - - /** - * show the configform - * - */ - public static function showAdminForm(){ - global $CONFIG_ADMINLOGIN; - global $CONFIG_ADMINPASSWORD; - global $CONFIG_DATADIRECTORY; - global $CONFIG_HTTPFORCESSL; - global $CONFIG_DATEFORMAT; - global $CONFIG_DBNAME; - global $CONFIG_DBTABLEPREFIX; - global $CONFIG_INSTALLED; - $allow=false; - if(!$CONFIG_INSTALLED){ - $allow=true; - }elseif(OC_USER::isLoggedIn()){ - if(OC_USER::ingroup($_SESSION['username'],'admin')){ - $allow=true; - } - } - if($allow){ - oc_require('templates/adminform.php'); - } - } - - public static function createUserListener(){ - if(OC_USER::isLoggedIn()){ - if(OC_USER::ingroup($_SESSION['username'],'admin')){ - if(isset($_POST['new_username']) and isset($_POST['new_password'])){ - if(OC_USER::createuser($_POST['new_username'],$_POST['new_password'])){ - return 'user successfully created'; - }else{ - return 'error while trying to create user'; - } - }else{ - return false; - } - }else{ - return false; - } - } - } - - public static function createGroupListener(){ - if(OC_USER::isLoggedIn()){ - if(isset($_POST['creategroup']) and $_POST['creategroup']==1){ - if(OC_USER::creategroup($_POST['groupname'])){ - return 'group successfully created'; - }else{ - return 'error while trying to create group'; - } - }else{ - return false; - } - }else{ - return false; - } - } - - - /** - * listen for configuration changes - * - */ - public static function configListener(){ - if(OC_USER::isLoggedIn()){ - if(isset($_POST['config']) and $_POST['config']==1){ - $error=''; - if(!OC_USER::checkpassword($_SESSION['username'],$_POST['currentpassword'])){ - $error.='wrong password<br />'; - }else{ - if(isset($_POST['changepass']) and $_POST['changepass']==1){ - if(!isset($_POST['password']) or empty($_POST['password'])) $error.='password not set<br />'; - if(!isset($_POST['password2']) or empty($_POST['password2'])) $error.='retype password not set<br />'; - if($_POST['password']<>$_POST['password2'] ) $error.='passwords are not the same<br />'; - if(empty($error)){ - if(!OC_USER::setpassword($_SESSION['username'],$_POST['password'])){ - $error.='error while trying to set password<br />'; - } - } - } - } - return $error; - }else{ - return false; - } - }else{ - return false; - } - } - - /** - * Write the configuration to the `config.php` file - * - * $configuration contains key/value pairs - * - the key is the option name without the 'CONFIG_' prefix - * - the value is a string, a boolean or a number - * - * @param array $configuration is an associative array - */ - protected static function saveConfiguration($configuration) { - global $SERVERROOT; - - $configContent = '<?php'; - foreach ( $configuration as $key => $value ) { - if ( is_string($value) ) { - $configContent .= "\n\$CONFIG_$key = '$value';"; // e.g. $CONFIG_DBTYPE = 'mysql'; - } else if ( is_bool($value) ) { - $value = $value ? 'true' : 'false'; - $configContent .= "\n\$CONFIG_$key = $value;"; // e.g. $CONFIG_INSTALLED = true; - } else if ( is_numeric($value) ) { - $configContent .= "\n\$CONFIG_$key = $value;"; // e.g. $CONFIG_PI = 3.14; - } - } - $configContent .= "\n?>"; - $filename = "$SERVERROOT/config/config.php"; - file_put_contents($filename, $configContent); - } - - /** - * listen for admin configuration changes and write it to the file - *4bd0be1185e76 - */ - public static function writeAdminListener(){ - global $CONFIG_INSTALLED; - $allow=false; - if(!$CONFIG_INSTALLED){ - $allow=true; - }elseif(OC_USER::isLoggedIn()){ - if(OC_USER::ingroup($_SESSION['username'],'admin')){ - $allow=true; - } - } - if($allow){ - global $DOCUMENTROOT; - global $SERVERROOT; - global $WEBROOT; - global $CONFIG_DBHOST; - global $CONFIG_DBNAME; - global $CONFIG_DBTABLEPREFIX; - global $CONFIG_INSTALLED; - global $CONFIG_DBUSER; - global $CONFIG_DBPASSWORD; - global $CONFIG_DBTYPE; - global $CONFIG_ADMINLOGIN; - global $CONFIG_ADMINPASSWORD; - if(isset($_POST['set_config'])){ - //checkdata - $error=''; - $FIRSTRUN=!$CONFIG_INSTALLED; - if(!$FIRSTRUN){ - if(!OC_USER::login($_SESSION['username'],$_POST['currentpassword'])){ - $error.='wrong password<br />'; - } - } - - if((!isset($_POST['adminlogin']) or empty($_POST['adminlogin'])) and $FIRSTRUN) $error.='admin login not set<br />'; - if((!isset($_POST['adminpassword']) or empty($_POST['adminpassword'])) and $FIRSTRUN) $error.='admin password not set<br />'; - if((!isset($_POST['adminpassword2']) or empty($_POST['adminpassword2'])) and $FIRSTRUN) $error.='retype admin password not set<br />'; - if((!isset($_POST['datadirectory']) or empty($_POST['datadirectory'])) and $FIRSTRUN) $error.='data directory not set<br />'; - if(!isset($_POST['dateformat']) or empty($_POST['dateformat'])) $error.='dateformat not set<br />'; - if((!isset($_POST['dbname']) or empty($_POST['dbname'])) and $FIRSTRUN) $error.='databasename not set<br />'; - if($FIRSTRUN and $_POST['adminpassword']<>$_POST['adminpassword2'] ) $error.='admin passwords are not the same<br />'; - $dbtype=(isset($_POST['dbtype']))?$_POST['dbtype']:$CONFIG_DBTYPE; - if($dbtype=='mysql'){ - if(!isset($_POST['dbhost']) or empty($_POST['dbhost'])) $error.='database host not set<br />'; - if(!isset($_POST['dbuser']) or empty($_POST['dbuser'])) $error.='database user not set<br />'; - if($_POST['dbpassword']<>$_POST['dbpassword2'] ) $error.='database passwords are not the same<br />'; - - } - if(isset($_POST['enablebackup']) and $_POST['enablebackup']==1){ - if(!isset($_POST['backupdirectory']) or empty($_POST['backupdirectory'])) $error.='backup directory not set<br />'; - } - if(!$FIRSTRUN){ - if(!isset($_POST['adminpassword']) or empty($_POST['adminpassword'])){ - $_POST['adminpassword']=$CONFIG_ADMINPASSWORD; - } - if(!isset($_POST['dbpassword']) or empty($_POST['dbpassword'])){ - $_POST['dbpassword']=$CONFIG_DBPASSWORD; - } - }else{ - if(!is_dir($_POST['datadirectory'])){ - try{ - mkdir($_POST['datadirectory']); - }catch(Exception $e){ - $error.='error while trying to create data directory<br/>'; - } - } - } - if(empty($error)) { - if($CONFIG_DBTYPE!=$dbtype or $FIRSTRUN){ - //create/fill database - $CONFIG_DBTYPE=$dbtype; - $CONFIG_DBNAME=$_POST['dbname']; - if($dbtype!='sqlite'){ - $CONFIG_DBTABLEPREFIX=$_POST['dbtableprefix']; - $CONFIG_DBHOST=$_POST['dbhost']; - $CONFIG_DBUSER=$_POST['dbuser']; - $CONFIG_DBPASSWORD=$_POST['dbpassword']; - }else{ - $_POST['dbtableprefix']=''; - $CONFIG_DBTABLEPREFIX=''; - } - try{ - if(isset($_POST['createdatabase']) and $CONFIG_DBTYPE!='sqlite'){ - self::createdatabase($_POST['dbadminuser'],$_POST['dbadminpwd']); - } - }catch(Exception $e){ - $error.='error while trying to create the database<br/>'; - } - if($CONFIG_DBTYPE=='sqlite'){ - $f=@fopen($SERVERROOT.'/'.$CONFIG_DBNAME,'a+'); - if(!$f){ - $error.='path of sqlite database not writable by server<br/>'; - } - OC_DB::disconnect(); - unlink($SERVERROOT.'/'.$CONFIG_DBNAME); - } - try{ - if(isset($_POST['filldb'])){ - self::filldatabase(); - } - }catch(Exception $e){ - $error.='error while trying to fill the database<br/>'; - } - if($CONFIG_DBTYPE=='sqlite'){ - OC_DB::disconnect(); - } - } - if($FIRSTRUN){ - if(!OC_USER::createuser($_POST['adminlogin'],$_POST['adminpassword']) && !OC_USER::login($_POST['adminlogin'],$_POST['adminpassword'])){ - $error.='error while trying to create the admin user<br/>'; - } - if(OC_USER::getgroupid('admin',true)==0){ - if(!OC_USER::creategroup('admin')){ - $error.='error while trying to create the admin group<br/>'; - } - } - if(!OC_USER::addtogroup($_POST['adminlogin'],'admin')){ - $error.='error while trying to add the admin user to the admin group<br/>'; - } - } - // Build the configuration array - $config = array(); - $config['INSTALLED'] = true; - $config['DATADIRECTORY'] = $_POST['datadirectory']; - $config['HTTPFORCESSL'] = isset($_POST['forcessl']); - // Backup configuration - $config['ENABLEBACKUP'] = isset($_POST['enablebackup']); - if ( $config['ENABLEBACKUP'] AND (1 == $_POST['enablebackup']) ) - $config['BACKUPDIRECTORY'] = $_POST['backupdirectory']; - $config['DATEFORMAT'] = $_POST['dateformat']; - // DB Configuration - $config['DBTYPE'] = $dbtype; - $config['DBNAME'] = $_POST['dbname']; - $config['DBTABLEPREFIX'] = $_POST['dbtableprefix']; - if ( 'sqlite' != $dbtype ) { - $config['DBHOST'] = $_POST['dbhost']; - $config['DBUSER'] = $_POST['dbuser']; - $config['DBPASSWORD'] = $_POST['dbpassword']; - } - - if( empty($error) ) { - header("Location: $WEBROOT/"); - try { - // Write the configuration array to `/config/config.php` - self::saveConfiguration($config); - } catch ( Exception $e ) { - $error.='error while trying to save the configuration file<br/>'; - return $error; - } - } else { - return $error; - } - } - return($error); - } - } - } - - /** - * Fills the database with the initial tables - * Note: while the AUTO_INCREMENT function is not supported by SQLite - * the same effect can be achieved by accessing the SQLite pseudo-column - * "rowid" - */ - private static function fillDatabase(){ - global $SERVERROOT; - OC_DB::createDBFromStructure($SERVERROOT.'/db_structure.xml'); - } - - /** - * Create the database and user - * @param string adminUser - * @param string adminPwd - * - */ - private static function createDatabase($adminUser,$adminPwd){ - global $CONFIG_DBHOST; - global $CONFIG_DBNAME; - global $CONFIG_DBUSER; - global $CONFIG_DBPWD; - global $CONFIG_DBTYPE; - //we cant user OC_BD functions here because we need to connect as the administrative user. - if($CONFIG_DBTYPE=='mysql'){ - $connection=mysql_connect($CONFIG_DBHOST, $adminUser, $adminPwd); - if(!$connection) { - @ob_end_clean(); - echo('<html><head></head><body bgcolor="#F0F0F0"><br /><br /><center><b>can not connect to database as administrative user.</center></body></html>'); - exit(); - } - $query="SELECT user FROM mysql.user WHERE user='{$_POST['dbuser']}'"; - $result = mysql_query($query,$connection); - if (!$result) { - $entry='DB Error: "'.mysql_error($connection).'"<br />'; - $entry.='Offending command was: '.$query.'<br />'; - echo($entry); - } - if(mysql_num_rows($result)==0){ - $pwd=$_POST['dbpassword']; - //we need to create 2 accounts, one for global use and one for local user. if we don't speccify the local one, - // the anonymous user would take precedence when there is one. - $query="CREATE USER '{$_POST['dbuser']}'@'localhost' IDENTIFIED BY '$pwd'"; - $result = mysql_query($query,$connection); - if (!$result) { - $entry='DB Error: "'.mysql_error($connection).'"<br />'; - $entry.='Offending command was: '.$query.'<br />'; - echo($entry); - } - $query="CREATE USER '{$_POST['dbuser']}'@'%' IDENTIFIED BY '$pwd'"; - $result = mysql_query($query,$connection); - if (!$result) { - $entry='DB Error: "'.mysql_error($connection).'"<br />'; - $entry.='Offending command was: '.$query.'<br />'; - echo($entry); - } - } - $query="CREATE DATABASE IF NOT EXISTS `{$_POST['dbname']}`"; - $result = mysql_query($query,$connection); - if (!$result) { - $entry='DB Error: "'.mysql_error($connection).'"<br />'; - $entry.='Offending command was: '.$query.'<br />'; - echo($entry); - } - $query="GRANT ALL PRIVILEGES ON `{$_POST['dbname']}` . * TO '{$_POST['dbuser']}'"; - $result = mysql_query($query,$connection); - if (!$result) { - $entry='DB Error: "'.mysql_error($connection).'"<br />'; - $entry.='Offending command was: '.$query.'<br />'; - echo($entry); - } - mysql_close($connection); - }elseif($CONFIG_DBTYPE=='pgsql'){ - $connection = pg_connect("user='$adminUser' host='$CONFIG_DBHOST' password='$adminPwd'"); - $query="CREATE USER {$_POST['dbuser']} WITH PASSWORD '{$_POST['dbpassword']}' CREATEDB;"; - $result = pg_exec($connection, $query); - $query="select count(*) from pg_catalog.pg_database where datname = '{$_POST['dbname']}';"; - $result = pg_exec($connection, $query); - if(pg_result($result,0,0)==0){ - $query="CREATE DATABASE {$_POST['dbname']};"; - $result = pg_exec($connection, $query); - $query="ALTER DATABASE {$_POST['dbname']} OWNER TO {$_POST['dbuser']};"; - $result = pg_exec($connection, $query); - } - } - } -} -?> - - diff --git a/inc/lib_fileobserver.php b/inc/lib_fileobserver.php deleted file mode 100644 index 08a67521f037bdcd957ba9c1178f760337b88ee5..0000000000000000000000000000000000000000 --- a/inc/lib_fileobserver.php +++ /dev/null @@ -1,82 +0,0 @@ -<?php - -/** -* ownCloud -* -* @author Frank Karlitschek -* @copyright 2010 Frank Karlitschek karlitschek@kde.org -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either -* version 3 of the License, or any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. -*/ - -define('OC_FILEACTION_WRITE',2); -define('OC_FILEACTION_READ',4); -define('OC_FILEACTION_DELETE',8); -define('OC_FILEACTION_CREATE',16); -define('OC_FILEACTION_RENAME',32); - -/** - * base class for file observers - */ -class OC_FILEOBSERVER{ - private $mask; - - public function __construct($arguments){} - - public function __get($name){ - switch($name){ - case 'mask': - return $this->mask; - } - } - - public function notify($path,$action){} -} - -/** - * observer that makes automatic backups - */ -class OC_FILEOBSERVER_BACKUP extends OC_FILEOBSERVER{ - private $storage; - - public function __construct($arguments){ - $this->mask=OC_FILEACTION_WRITE+OC_FILEACTION_DELETE+OC_FILEACTION_CREATE+OC_FILEACTION_RENAME; - $this->storage=$arguments['storage']; - } - - public function notify($path,$action,$storage){ - switch($action){ - case OC_FILEACTION_DELETE: - if($storage->is_dir($path)){ - $this->storage->delTree($path); - }else{ - $this->storage->unlink($path); - } - break; - case OC_FILEACTION_CREATE: - if($storage->is_dir($path)){ - $this->storage->mkdir($path); - break; - } - case OC_FILEACTION_WRITE: - $tmpFile=$storage->toTmpFile($path); - $this->storage->fromTmpFile($tmpFile,$path); - break; - case OC_FILEACTION_RENAME: - list($source,$target)=explode('->',$path); - $this->storage->rename($source,$target); - } - } -} -?> \ No newline at end of file diff --git a/inc/lib_log.php b/inc/lib_log.php deleted file mode 100644 index 9b6736d25a1b5c495cca4c07e91c121d4813841e..0000000000000000000000000000000000000000 --- a/inc/lib_log.php +++ /dev/null @@ -1,86 +0,0 @@ -<?php - -/** -* ownCloud -* -* @author Frank Karlitschek -* @copyright 2010 Frank Karlitschek karlitschek@kde.org -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either -* version 3 of the License, or any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. -* -*/ - - -/** - * Class for logging features - * - */ -class OC_LOG { - - /** - * array to define different log types - * - */ - public static $TYPE = array ( - 1=>'login', - 2=>'logout', - 3=>'read', - 4=>'write', - ); - - - /** - * log an event - * - * @param username $user - * @param type $type - * @param message $message - */ - public static function event($user,$type,$message){ - global $CONFIG_DBTABLEPREFIX; - $result = OC_DB::query('INSERT INTO `' . $CONFIG_DBTABLEPREFIX . 'log` (`timestamp`,`user`,`type`,`message`) VALUES ('.time().',\''.addslashes($user).'\','.addslashes($type).',\''.addslashes($message).'\');'); - } - - - /** - * show the log entries in a web GUI - * - */ - public static function show(){ - global $CONFIG_DATEFORMAT; - global $CONFIG_DBTABLEPREFIX; - echo('<div class="center"><table cellpadding="6" cellspacing="0" border="0" class="log">'); - - if(OC_USER::ingroup($_SESSION['username_clean'],'admin')){ - $result = OC_DB::select('select `timestamp`,`user`,`type`,`message` from '.$CONFIG_DBTABLEPREFIX.'log order by timestamp desc limit 20'); - }else{ - $user=$_SESSION['username_clean']; - $result = OC_DB::select('select `timestamp`,`user`,`type`,`message` from '.$CONFIG_DBTABLEPREFIX.'log where user=\''.$user.'\' order by timestamp desc limit 20'); - } - foreach($result as $entry){ - echo('<tr class="browserline">'); - echo('<td class="sizetext">'.date($CONFIG_DATEFORMAT,$entry['timestamp']).'</td>'); - echo('<td class="highlighttext">'.OC_LOG::$TYPE[$entry['type']].'</td>'); - echo('<td class="nametext">'.$entry['user'].'</td>'); - echo('<td class="nametext">'.$entry['message'].'</td>'); - echo('</tr>'); - } - echo('</table></div>'); - } - -} - - - -?> diff --git a/inc/lib_plugin.php b/inc/lib_plugin.php deleted file mode 100644 index 04c213077265501ae72f2af65de4ccfd8da8ca99..0000000000000000000000000000000000000000 --- a/inc/lib_plugin.php +++ /dev/null @@ -1,381 +0,0 @@ -<?php - -/** -* ownCloud -* -* @author Frank Karlitschek -* @copyright 2010 Frank Karlitschek karlitschek@kde.org -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either -* version 3 of the License, or any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. -* -*/ - -class OC_PLUGIN{ - static private $blacklist=array(); - - /** - * load the plugin with the given id - * @param string id - * @return bool - */ - static public function load($id){ - global $SERVERROOT; - $data=self::getPluginData($id); - if($data){ - if(isset($data['info']['require'])){ - $minVersion=explode('.',$data['info']['require']); - $version=OC_UTIL::getVersion(); - $roundTo=count($minVersion); - while(count($version)>$roundTo){ - if($version[count($version)-1]>=50){ - $version[count($version)-2]++; - } - unset($version[count($version)-1]); - } - for($i=0;$i<count($minVersion);$i++){ - if($version[$i]<$minVersion[$i]){ - return false; - } - } - } - //check for uninstalled db's - if(isset($data['install']) and isset($data['install']['database'])){ - foreach($data['install']['database'] as $db){ - if(!$data['install']['database_installed'][$db]){ - self::installDB($id); - break; - } - } - } - - if(isset($data['runtime'])){ - foreach($data['runtime'] as $include){ - include($SERVERROOT.'/plugins/'.$id.'/'.$include); - } - } - } - return false; - } - - /** - * Get a list of all installed plugins - */ - public static function listPlugins() { - global $SERVERROOT; - $plugins = array(); - $fd = opendir($SERVERROOT . '/plugins'); - while ( false !== ($filename = readdir($fd)) ) { - if ( $filename<>'.' AND $filename<>'..' AND ('.' != substr($filename, 0, 1))) { - if(file_exists($SERVERROOT . '/plugins/'.$filename.'/plugin.xml')){ - $plugins[]=$filename; - } - } - } - closedir($fd); - return $plugins; - } - - /** - * Load all plugins that aren't blacklisted - */ - public static function loadPlugins() { - global $CONFIG_INSTALLED; - if($CONFIG_INSTALLED){ - global $SERVERROOT; - $plugins = self::listPlugins(); - $blacklist=self::loadBlacklist(); - foreach($plugins as $plugin){ - if (array_search($plugin,$blacklist)===false) { - self::load($plugin); - } - } - } - } - - /** - * load the blacklist from blacklist.txt - * @return array - */ - public static function loadBlacklist(){ - global $SERVERROOT; - if(count(self::$blacklist)>0){ - return self::$blacklist; - } - $blacklist=array(); - if(is_file($SERVERROOT.'/plugins/blacklist.txt')){ - $file=file_get_contents($SERVERROOT.'/plugins/blacklist.txt'); - $lines=explode("\n",$file); - foreach($lines as $line){ - $id=trim($line); - if($id!='' and is_dir($SERVERROOT.'/plugins/'.$id)){ - $blacklist[]=$id; - } - } - } - self::$blacklist=$blacklist; - return $blacklist; - } - - /** - * save a blacklist to blacklist.txt - * @param array blacklist - */ - private static function saveBlacklist($blacklist){ - global $SERVERROOT; - $file=''; - foreach($blacklist as $item){ - $file.="$item\n"; - } - self::$blacklist=$blacklist; - file_put_contents($SERVERROOT.'/plugins/blacklist.txt',$file); - } - - /** - * add a plugin to the blacklist - * @param string id - */ - public static function addToBlacklist($id){ - $blacklist=self::loadBlacklist(); - if(array_search($id,$blacklist)===false){ - $blacklist[]=$id; - self::$blacklist=$blacklist; - self::saveBlacklist($blacklist); - } - } - - /** - * remove a plugin to the blacklist - * @param string id - */ - public static function removeFromBlacklist($id){ - $blacklist=self::loadBlacklist(); - $index=array_search($id,$blacklist); - if($index!==false){ - unset($blacklist[$index]); - self::$blacklist=$blacklist; - self::saveBlacklist($blacklist); - } - } - - /** - * Load data from the plugin.xml of a plugin, either identified by the plugin or the path of the plugin.xml file - * @param string id - * @return array - */ - public static function getPluginData($id){ - global $SERVERROOT; - if(is_file($id)){ - $file=$id; - }else{ - if(!is_dir($SERVERROOT.'/plugins/'.$id) or !is_file($SERVERROOT.'/plugins/'.$id.'/plugin.xml')){ - return false; - }else{ - $file=$SERVERROOT.'/plugins/'.$id.'/plugin.xml'; - } - } - $data=array(); - $plugin=new DOMDocument(); - $plugin->load($file); - $data['version']=$plugin->documentElement->getAttribute('version'); - $info=$plugin->getElementsByTagName('info'); - if($info->length>0){ - $info=$info->item(0); - $data['info']=array(); - foreach($info->childNodes as $child){ - if($child->nodeType==XML_ELEMENT_NODE){ - $data['info'][$child->tagName]=$child->textContent; - } - } - } - $runtime=$plugin->getElementsByTagName('runtime'); - if($runtime->length>0){ - $runtime=$runtime->item(0); - $data['runtime']=array(); - foreach($runtime->childNodes as $child){ - if($child->nodeType==XML_ELEMENT_NODE and $child->tagName=='include'){ - $data['runtime'][]=$child->textContent; - } - } - } - $install=$plugin->getElementsByTagName('install'); - if($install->length>0){ - $install=$install->item(0); - $data['install']=array(); - foreach($install->childNodes as $child){ - if($child->nodeType==XML_ELEMENT_NODE){ - $data['install']['include']=array(); - $data['install']['dialog']=array(); - $data['install']['database']=array(); - switch($child->tagName){ - case 'include': - $data['install']['include'][]=$child->textContent; - break; - case 'dialog': - $data['install']['dialog'][]=$child->textContent; - break; - case 'database': - $data['install']['database'][]=$child->textContent; - $data['install']['database_installed'][$child->textContent]=($child->hasAttribute('installed') and $child->getAttribute('installed')=='true')?true:false; - break; - } - } - } - } - $uninstall=$plugin->getElementsByTagName('uninstall'); - if($uninstall->length>0){ - $uninstall=$uninstall->item(0); - $data['uninstall']=array(); - foreach($uninstall->childNodes as $child){ - if($child->nodeType==XML_ELEMENT_NODE){ - $data['uninstall']['include']=array(); - $data['uninstall']['dialog']=array(); - switch($child->tagName){ - case 'include': - $data['uninstall']['include'][]=$child->textContent; - break; - case 'dialog': - $data['uninstall']['dialog'][]=$child->textContent; - break; - } - } - } - } - return $data; - } - - - /** - * Save data to the plugin.xml of a plugin, either identified by the plugin or the path of the plugin.xml file - * @param string id - * @param array data the plugin data in the same structure as returned by getPluginData - * @return bool - */ - public static function savePluginData($id,$data){ - global $SERVERROOT; - if(is_file($id)){ - $file=$id; - } - if(!is_dir($SERVERROOT.'/plugins/'.$id) or !is_file($SERVERROOT.'/plugins/'.$id.'/plugin.xml')){ - return false; - }else{ - $file=$SERVERROOT.'/plugins/'.$id.'/plugin.xml'; - } - $plugin=new DOMDocument(); - $pluginNode=$plugin->createElement('plugin'); - $pluginNode->setAttribute('version',$data['version']); - $plugin->appendChild($pluginNode); - $info=$plugin->createElement('info'); - foreach($data['info'] as $name=>$value){ - $node=$plugin->createElement($name); - $node->appendChild($plugin->createTextNode($value)); - $info->appendChild($node); - } - $pluginNode->appendChild($info); - if(isset($data['runtime'])){ - $runtime=$plugin->createElement('runtime'); - foreach($data['runtime'] as $include){ - $node=$plugin->createElement('include'); - $node->appendChild($plugin->createTextNode($include)); - $runtime->appendChild($node); - } - $pluginNode->appendChild($runtime); - } - if(isset($data['install'])){ - $install=$plugin->createElement('install'); - foreach($data['install']['include'] as $include){ - $node=$plugin->createElement('include'); - $node->appendChild($plugin->createTextNode($include)); - $install->appendChild($node); - } - foreach($data['install']['dialog'] as $dialog){ - $node=$plugin->createElement('dialog'); - $node->appendChild($plugin->createTextNode($dialog)); - $install->appendChild($node); - } - foreach($data['install']['database'] as $database){ - $node=$plugin->createElement('database'); - $node->appendChild($plugin->createTextNode($database)); - if($data['install']['database_installed'][$database]){ - $node->setAttribute('installed','true'); - } - $install->appendChild($node); - } - $pluginNode->appendChild($install); - } - if(isset($data['uninstall'])){ - $uninstall=$plugin->createElement('uninstall'); - foreach($data['uninstall']['include'] as $include){ - $node=$plugin->createElement('include'); - $node->appendChild($plugin->createTextNode($include)); - $uninstall->appendChild($node); - } - foreach($data['uninstall']['dialog'] as $dialog){ - $node=$plugin->createElement('dialog'); - $node->appendChild($plugin->createTextNode($dialog)); - $uninstall->appendChild($node); - } - $pluginNode->appendChild($uninstall); - } - $plugin->save($file); - } - - /** - * install the databases of a plugin - * @param string id - * @return bool - */ - public static function installDB($id){ - global $SERVERROOT; - $data=OC_PLUGIN::getPluginData($id); - foreach($data['install']['database'] as $db){ - if (!$data['install']['database_installed'][$db]){ - $file=$SERVERROOT.'/plugins/'.$id.'/'.$db; - OC_DB::createDbFromStructure($file); - $data['install']['database_installed'][$db]=true; - } - } - self::savePluginData($id,$data); - return true; - } - - public static function installPlugin($path){ - global $SERVERROOT; - if(is_file($path)){ - $zip = new ZipArchive; - if($zip->open($path)===TRUE){ - $folder=sys_get_temp_dir().'/OC_PLUGIN_INSTALL/'; - mkdir($folder); - $zip->extractTo($folder); - if(is_file($folder.'/plugin.xml')){ - $pluginData=self::getPluginData($folder.'/plugin.xml'); - if(array_search($pluginData['info']['id'],self::listPlugins())===false){ - if(isset($pluginData['install'])){ - foreach($pluginData['install']['database'] as $db){ - OC_DB::createDbFromStructure($folder.'/'.$db); - $pluginData['install']['database_installed'][$db]=true; - } - foreach($pluginData['install']['include'] as $include){ - include($folder.'/'.$include); - } - } - recursive_copy($folder,$SERVERROOT.'/plugins/'.$pluginData['info']['id']); - self::savePluginData($SERVERROOT.'/plugins/'.$pluginData['info']['id'].'/plugin.xml',$pluginData); - } - } - delTree($folder); - } - } - } -} -?> diff --git a/inc/lib_user.php b/inc/lib_user.php deleted file mode 100644 index f4bc913d46a642ea076a2f65c025e09574af97e3..0000000000000000000000000000000000000000 --- a/inc/lib_user.php +++ /dev/null @@ -1,241 +0,0 @@ -<?php - -/** -* ownCloud -* -* @author Frank Karlitschek -* @copyright 2010 Frank Karlitschek karlitschek@kde.org -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either -* version 3 of the License, or any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. -* -*/ - - - - -if ( !$CONFIG_INSTALLED ) { - $_SESSION['user_id'] = false; - $_SESSION['username'] = ''; - $_SESSION['username_clean'] = ''; -} - -//cache the userid's an groupid's -if ( !isset($_SESSION['user_id_cache']) ) { - $_SESSION['user_id_cache'] = array(); -} -if ( !isset($_SESSION['group_id_cache']) ) { - $_SESSION['group_id_cache'] = array(); -} - - - - -/** - * Class for User Management - * - */ -class OC_USER { - - // The backend used for user management - private static $_backend; - - /** - * Set the User Authentication Module - * - * @param string $backend The backend to use for user managment - */ - public static function setBackend($backend='database') { - if ( (null === $backend) OR (!is_string($backend)) ) { - $backend = 'database'; - } - - switch ( $backend ) { - case 'database': - case 'mysql': - case 'sqlite': - oc_require_once('inc/User/database.php'); - self::$_backend = new OC_USER_DATABASE(); - break; - default: - $className = 'OC_USER_' . strToUpper($backend); - self::$_backend = new $className(); - break; - } - } - - /** - * Check if the login button is pressed and log the user in - * - */ - public static function loginListener() { - return self::$_backend->loginListener(); - } - - /** - * Try to create a new user - * - * @param string $username The username of the user to create - * @param string $password The password of the new user - */ - public static function createUser($username, $password) { - return self::$_backend->createUser($username, $password); - } - - /** - * Try to login a user - * - * @param string $username The username of the user to log in - * @param string $password The password of the user - */ - public static function login($username, $password) { - return self::$_backend->login($username, $password); - } - - /** - * Check if the logout button is pressed and logout the user - * - */ - public static function logoutListener() { - return self::$_backend->logoutListener(); - } - - /** - * Check if the user is logged in - * - */ - public static function isLoggedIn() { - return self::$_backend->isLoggedIn(); - } - - /** - * Try to create a new group - * - * @param string $groupName The name of the group to create - */ - public static function createGroup($groupName) { - return self::$_backend->createGroup($groupName); - } - - /** - * Get the ID of a user - * - * @param string $username Name of the user to find the ID - * @param boolean $noCache If false the cache is used to find the ID - */ - public static function getUserId($username, $noCache=false) { - return self::$_backend->getUserId($username, $noCache); - } - - /** - * Get the ID of a group - * - * @param string $groupName Name of the group to find the ID - * @param boolean $noCache If false the cache is used to find the ID - */ - public static function getGroupId($groupName, $noCache=false) { - return self::$_backend->getGroupId($groupName, $noCache); - } - - /** - * Get the name of a group - * - * @param string $groupId ID of the group - * @param boolean $noCache If false the cache is used to find the name of the group - */ - public static function getGroupName($groupId, $noCache=false) { - return self::$_backend->getGroupName($groupId, $noCache); - } - - /** - * Check if a user belongs to a group - * - * @param string $username Name of the user to check - * @param string $groupName Name of the group - */ - public static function inGroup($username, $groupName) { - return self::$_backend->inGroup($username, $groupName); - } - - /** - * Add a user to a group - * - * @param string $username Name of the user to add to group - * @param string $groupName Name of the group in which add the user - */ - public static function addToGroup($username, $groupName) { - return self::$_backend->addToGroup($username, $groupName); - } - - /** - * Remove a user from a group - * - * @param string $username Name of the user to remove from group - * @param string $groupName Name of the group from which remove the user - */ - public static function removeFromGroup($username,$groupName){ - return self::$_backend->removeFromGroup($username, $groupName); - } - - /** - * Generate a random password - */ - public static function generatePassword() { - return substr(md5(uniqId().time()),0,10); - } - - /** - * Get all groups the user belongs to - * - * @param string $username Name of the user - */ - public static function getUserGroups($username) { - return self::$_backend->getUserGroups($username); - } - - /** - * Set the password of a user - * - * @param string $username User who password will be changed - * @param string $password The new password for the user - */ - public static function setPassword($username, $password) { - return self::$_backend->setPassword($username, $password); - } - - /** - * Check if the password of the user is correct - * - * @param string $username Name of the user - * @param string $password Password of the user - */ - public static function checkPassword($username, $password) { - return self::$_backend->checkPassword($username, $password); - } - - /** - * get a list of all users - * - */ - public static function getUsers() { - return self::$_backend->getUsers(); - } - - /** - * get a list of all groups - * - */ - public static function getGroups() { - return self::$_backend->getGroups(); - } -} diff --git a/inc/package.dtd b/inc/package.dtd deleted file mode 100644 index 6092e8f4ce3a4121cb116b21a60a4dc1125786bf..0000000000000000000000000000000000000000 --- a/inc/package.dtd +++ /dev/null @@ -1,110 +0,0 @@ -<!-- - $Id: package.dtd,v 1.35.4.1 2004/12/31 18:43:21 cellog Exp $ - - This is the PEAR package description, version 1.0. - It should be used with the informal public identifier: - - "-//PHP Group//DTD PEAR Package 1.0//EN//XML" - - Copyright (c) 1997-2004 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 at through the world-wide-web at - 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. - - Authors: - Stig S. Bakken <ssb@php.net> - - --> -<!ENTITY % NUMBER "CDATA"> -<!ELEMENT package (name|summary|description|license|maintainers|release|changelog)+> -<!ATTLIST package type (source|binary|empty) "empty" - version CDATA #REQUIRED> - -<!ELEMENT name (#PCDATA)> - -<!ELEMENT summary (#PCDATA)> - -<!ELEMENT description (#PCDATA)> - -<!ELEMENT license (#PCDATA)> - -<!ELEMENT maintainers (maintainer)+> - -<!ELEMENT maintainer (user|role|name|email)+> - -<!ELEMENT user (#PCDATA)> - -<!ELEMENT role (#PCDATA)> - -<!ELEMENT email (#PCDATA)> - -<!ELEMENT changelog (release)+> - -<!ELEMENT release (version|license|state|date|notes|filelist|deps|provides|script|configureoptions)+> - -<!ELEMENT version (#PCDATA)> - -<!ELEMENT state (#PCDATA)> - -<!ELEMENT date (#PCDATA)> - -<!ELEMENT notes (#PCDATA)> - -<!ELEMENT filelist (dir|file)+> - -<!ELEMENT dir (dir|file)+> -<!ATTLIST dir name CDATA #REQUIRED - baseinstalldir CDATA #IMPLIED> - -<!ELEMENT file (replace*)> -<!ATTLIST file role (php|ext|src|test|doc|data|script) 'php' - debug (na|on|off) 'na' - zts (na|on|off) 'na' - phpapi %NUMBER; #IMPLIED - zendapi %NUMBER; #IMPLIED - format CDATA #IMPLIED - baseinstalldir CDATA #IMPLIED - platform CDATA #IMPLIED - md5sum CDATA #IMPLIED - name CDATA #REQUIRED - install-as CDATA #IMPLIED> - -<!ELEMENT replace EMPTY> -<!ATTLIST replace from CDATA #REQUIRED - to CDATA #REQUIRED - type CDATA #REQUIRED> - -<!ELEMENT deps (dep)+> - -<!ELEMENT dep (#PCDATA)> -<!ATTLIST dep - optional (yes|no) 'no' - type (pkg|ext|php|prog|ldlib|rtlib|os|websrv|sapi|zend) #REQUIRED - rel (has|eq|lt|le|gt|ge) 'has' - version CDATA #IMPLIED> - -<!ELEMENT provides (#PCDATA)> -<!ATTLIST provides - type (ext|prog|class|function|feature|api) #REQUIRED - name CDATA #REQUIRED - extends CDATA #IMPLIED> - -<!ELEMENT script (#PCDATA)> -<!ATTLIST script - phase (pre-install |post-install | - pre-uninstall|post-uninstall| - pre-build |post-build | - pre-setup |post-setup ) #REQUIRED> - -<!ELEMENT configureoptions (configureoption*)> - -<!ELEMENT configureoption EMPTY> -<!ATTLIST configureoption - name CDATA #REQUIRED - default CDATA #IMPLIED - prompt CDATA #REQUIRED> diff --git a/inc/packages/Archive_Tar.xml b/inc/packages/Archive_Tar.xml deleted file mode 100644 index ba748a18afd331ef56a7b85b1e613dddc070cd12..0000000000000000000000000000000000000000 --- a/inc/packages/Archive_Tar.xml +++ /dev/null @@ -1,122 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0"> -<package version="1.0"> - <name>Archive_Tar</name> - <summary>Tar file management class</summary> - <description>This class provides handling of tar files in PHP. -It supports creating, listing, extracting and adding to tar files. -Gzip support is available if PHP has the zlib extension built-in or -loaded. Bz2 compression is also supported with the bz2 extension loaded.</description> - <maintainers> - <maintainer> - <user>vblavet</user> - <name>Vincent Blavet</name> - <email>vincent@phpconcept.net</email> - <role>lead</role> - </maintainer> - <maintainer> - <user>ssb</user> - <name>Stig Bakken</name> - <email>stig@php.net</email> - <role>helper</role> - </maintainer> - </maintainers> - <release> - <version>1.3.1</version> - <date>2005-03-17</date> - <license>PHP License</license> - <state>stable</state> - <notes>Correct Bug #3855</notes> - <provides type="class" name="Archive_Tar" /> - <provides type="function" name="Archive_Tar::create" /> - <provides type="function" name="Archive_Tar::add" /> - <provides type="function" name="Archive_Tar::extract" /> - <provides type="function" name="Archive_Tar::listContent" /> - <provides type="function" name="Archive_Tar::createModify" /> - <provides type="function" name="Archive_Tar::addModify" /> - <provides type="function" name="Archive_Tar::addString" /> - <provides type="function" name="Archive_Tar::extractModify" /> - <provides type="function" name="Archive_Tar::extractInString" /> - <provides type="function" name="Archive_Tar::extractList" /> - <provides type="function" name="Archive_Tar::setAttribute" /> - <filelist> - <file role="php" baseinstalldir="/" md5sum="5a9ef212cbfc1789c875870b3a4db6e5" name="Archive/Tar.php"/> - <file role="doc" baseinstalldir="/" md5sum="ae640b797078a6542ea0d236f28efffb" name="docs/Archive_Tar.txt"/> - </filelist> - </release> - <changelog> - <release> - <version>1.3.0</version> - <date>2005-03-06</date> - <state>stable</state> - <notes>Bugs correction (2475, 2488, 2135, 2176) - -</notes> - </release> - <release> - <version>1.2</version> - <date>2004-05-08</date> - <state>stable</state> - <notes>Add support for other separator than the space char and bug - correction - -</notes> - </release> - <release> - <version>1.1</version> - <date>2003-05-28</date> - <state>stable</state> - <notes>* Add support for BZ2 compression -* Add support for add and extract without using temporary files : methods addString() and extractInString() -</notes> - </release> - <release> - <version>1.0</version> - <date>2003-01-24</date> - <state>stable</state> - <notes>Change status to stable - -</notes> - </release> - <release> - <version>0.10-b1</version> - <date>2003-01-08</date> - <state>beta</state> - <notes>Add support for long filenames (greater than 99 characters) - -</notes> - </release> - <release> - <version>0.9</version> - <date>2002-05-27</date> - <state>stable</state> - <notes>Auto-detect gzip'ed files - -</notes> - </release> - <release> - <version>0.4</version> - <date>2002-05-20</date> - <state>stable</state> - <notes>Windows bugfix: use forward slashes inside archives - -</notes> - </release> - <release> - <version>0.2</version> - <date>2002-02-18</date> - <state>stable</state> - <notes>From initial commit to stable - -</notes> - </release> - <release> - <version>0.3</version> - <date>2002-04-13</date> - <state>stable</state> - <notes>Windows bugfix: used wrong directory separators - -</notes> - </release> - </changelog> -</package> diff --git a/inc/packages/Console_Getopt.xml b/inc/packages/Console_Getopt.xml deleted file mode 100644 index 221919d9767b8f940d8e4048876818ca3b567ac2..0000000000000000000000000000000000000000 --- a/inc/packages/Console_Getopt.xml +++ /dev/null @@ -1,69 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0"> -<package version="1.0"> - <name>Console_Getopt</name> - <summary>Command-line option parser</summary> - <description>This is a PHP implementation of "getopt" supporting both -short and long options.</description> - <maintainers> - <maintainer> - <user>andrei</user> - <name>Andrei Zmievski</name> - <email>andrei@php.net</email> - <role>lead</role> - </maintainer> - <maintainer> - <user>ssb</user> - <name>Stig Bakken</name> - <email>stig@php.net</email> - <role>developer</role> - </maintainer> - </maintainers> - <release> - <version>1.2</version> - <date>2003-12-11</date> - <license>PHP License</license> - <state>stable</state> - <notes>Fix to preserve BC with 1.0 and allow correct behaviour for new users</notes> - <provides type="class" name="Console_Getopt" /> - <provides type="function" name="Console_Getopt::getopt2" /> - <provides type="function" name="Console_Getopt::getopt" /> - <provides type="function" name="Console_Getopt::doGetopt" /> - <provides type="function" name="Console_Getopt::readPHPArgv" /> - <filelist> - <file role="php" md5sum="add0781a1cae0b3daf5e8521b8a954cc" name="Console/Getopt.php"/> - </filelist> - </release> - <changelog> - <release> - <version>1.0</version> - <date>2002-09-13</date> - <state>stable</state> - <notes>Stable release -</notes> - </release> - <release> - <version>0.11</version> - <date>2002-05-26</date> - <state>beta</state> - <notes>POSIX getopt compatibility fix: treat first element of args - array as command name - -</notes> - </release> - <release> - <version>0.10</version> - <date>2002-05-12</date> - <state>beta</state> - <notes>Packaging fix -</notes> - </release> - <release> - <version>0.9</version> - <date>2002-05-12</date> - <state>beta</state> - <notes>Initial release -</notes> - </release> - </changelog> -</package> diff --git a/inc/packages/DB.xml b/inc/packages/DB.xml deleted file mode 100644 index d8aaec82c27abcdc153f5abf1177c171e16ea6d2..0000000000000000000000000000000000000000 --- a/inc/packages/DB.xml +++ /dev/null @@ -1,348 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0"> -<package version="1.0" packagerversion="1.4.0a10"> - <name>DB</name> - <summary>Database Abstraction Layer</summary> - <description>DB is a database abstraction layer providing: -* an OO-style query API -* portability features that make programs written for one DBMS work with other DBMS's -* a DSN (data source name) format for specifying database servers -* prepare/execute (bind) emulation for databases that don't support it natively -* a result object for each query response -* portable error codes -* sequence emulation -* sequential and non-sequential row fetching as well as bulk fetching -* formats fetched rows as associative arrays, ordered arrays or objects -* row limit support -* transactions support -* table information interface -* DocBook and phpDocumentor API documentation - -DB layers itself on top of PHP's existing -database extensions. - -Drivers for the following extensions pass -the complete test suite and provide -interchangeability when all of DB's -portability options are enabled: - - fbsql, ibase, informix, msql, mssql, - mysql, mysqli, oci8, odbc, pgsql, - sqlite and sybase. - -There is also a driver for the dbase -extension, but it can't be used -interchangeably because dbase doesn't -support many standard DBMS features. - -DB is compatible with both PHP 4 and PHP 5. - </description> - <maintainers> - <maintainer> - <user>ssb</user> - <name>Stig Bakken</name> - <email>stig@php.net</email> - <role>developer</role> - </maintainer> - <maintainer> - <user>cox</user> - <name>Tomas V.V.Cox</name> - <email>cox@idecnet.com</email> - <role>developer</role> - </maintainer> - <maintainer> - <user>danielc</user> - <name>Daniel Convissor</name> - <email>danielc@php.net</email> - <role>lead</role> - </maintainer> - <maintainer> - <user>lsmith</user> - <name>Lukas Kahwe Smith</name> - <email>smith@backendmedia.com</email> - <role>helper</role> - </maintainer> - </maintainers> - <release> - <version>1.7.6</version> - <date>2005-04-11</date> - <license>PHP License</license> - <state>stable</state> - <notes>common: -* Fix the docblocks regarding DB_FETCHMODE_FLIPPED. Bug 4027. - -oic8: -* Provide BC hack for those connecting to oci8 using 'hostspec' instead of 'database'. Bug 4104. - </notes> - <deps> - <dep type="php" rel="ge" version="4.2.0"/> - <dep type="pkg" rel="ge" version="1.0b1">PEAR</dep> - </deps> - <provides type="class" name="DB" /> - <provides type="function" name="DB::factory" /> - <provides type="class" name="DB_common" extends="PEAR" /> - <provides type="function" name="DB_common::toString" /> - <provides type="function" name="DB_common::quoteString" /> - <provides type="function" name="DB_common::quote" /> - <provides type="function" name="DB_common::quoteIdentifier" /> - <provides type="function" name="DB_common::quoteSmart" /> - <provides type="function" name="DB_common::escapeSimple" /> - <provides type="function" name="DB_common::provides" /> - <provides type="function" name="DB_common::setFetchMode" /> - <provides type="function" name="DB_common::setOption" /> - <provides type="class" name="DB_dbase" extends="DB_common" /> - <provides type="function" name="DB_dbase::connect" /> - <provides type="function" name="DB_dbase::disconnect" /> - <provides type="function" name="DB_dbase::query" /> - <provides type="function" name="DB_dbase::fetchInto" /> - <provides type="function" name="DB_dbase::numCols" /> - <provides type="function" name="DB_dbase::numRows" /> - <provides type="function" name="DB_dbase::quoteSmart" /> - <provides type="function" name="DB_dbase::tableInfo" /> - <provides type="class" name="DB_fbsql" extends="DB_common" /> - <provides type="function" name="DB_fbsql::connect" /> - <provides type="function" name="DB_fbsql::disconnect" /> - <provides type="function" name="DB_fbsql::simpleQuery" /> - <provides type="class" name="DB_ibase" extends="DB_common" /> - <provides type="function" name="DB_ibase::connect" /> - <provides type="function" name="DB_ibase::disconnect" /> - <provides type="function" name="DB_ibase::simpleQuery" /> - <provides type="function" name="DB_ibase::modifyLimitQuery" /> - <provides type="class" name="DB_ifx" extends="DB_common" /> - <provides type="function" name="DB_ifx::connect" /> - <provides type="function" name="DB_ifx::disconnect" /> - <provides type="function" name="DB_ifx::simpleQuery" /> - <provides type="function" name="DB_ifx::nextResult" /> - <provides type="function" name="DB_ifx::affectedRows" /> - <provides type="function" name="DB_ifx::fetchInto" /> - <provides type="function" name="DB_ifx::numCols" /> - <provides type="function" name="DB_ifx::freeResult" /> - <provides type="function" name="DB_ifx::autoCommit" /> - <provides type="function" name="DB_ifx::commit" /> - <provides type="function" name="DB_ifx::rollback" /> - <provides type="function" name="DB_ifx::ifxRaiseError" /> - <provides type="function" name="DB_ifx::errorNative" /> - <provides type="function" name="DB_ifx::errorCode" /> - <provides type="function" name="DB_ifx::tableInfo" /> - <provides type="class" name="DB_msql" extends="DB_common" /> - <provides type="function" name="DB_msql::connect" /> - <provides type="function" name="DB_msql::disconnect" /> - <provides type="function" name="DB_msql::simpleQuery" /> - <provides type="function" name="DB_msql::nextResult" /> - <provides type="function" name="DB_msql::fetchInto" /> - <provides type="function" name="DB_msql::freeResult" /> - <provides type="function" name="DB_msql::numCols" /> - <provides type="function" name="DB_msql::numRows" /> - <provides type="function" name="DB_msql::affectedRows" /> - <provides type="function" name="DB_msql::nextId" /> - <provides type="class" name="DB_mssql" extends="DB_common" /> - <provides type="function" name="DB_mssql::connect" /> - <provides type="function" name="DB_mssql::disconnect" /> - <provides type="function" name="DB_mssql::simpleQuery" /> - <provides type="function" name="DB_mssql::nextResult" /> - <provides type="function" name="DB_mssql::fetchInto" /> - <provides type="function" name="DB_mssql::freeResult" /> - <provides type="function" name="DB_mssql::numCols" /> - <provides type="function" name="DB_mssql::numRows" /> - <provides type="function" name="DB_mssql::autoCommit" /> - <provides type="function" name="DB_mssql::commit" /> - <provides type="function" name="DB_mssql::rollback" /> - <provides type="function" name="DB_mssql::affectedRows" /> - <provides type="function" name="DB_mssql::nextId" /> - <provides type="class" name="DB_mysql" extends="DB_common" /> - <provides type="function" name="DB_mysql::connect" /> - <provides type="function" name="DB_mysql::disconnect" /> - <provides type="function" name="DB_mysql::simpleQuery" /> - <provides type="function" name="DB_mysql::nextResult" /> - <provides type="function" name="DB_mysql::fetchInto" /> - <provides type="function" name="DB_mysql::freeResult" /> - <provides type="function" name="DB_mysql::numCols" /> - <provides type="function" name="DB_mysql::numRows" /> - <provides type="function" name="DB_mysql::autoCommit" /> - <provides type="function" name="DB_mysql::commit" /> - <provides type="function" name="DB_mysql::rollback" /> - <provides type="function" name="DB_mysql::affectedRows" /> - <provides type="function" name="DB_mysql::nextId" /> - <provides type="class" name="DB_mysqli" extends="DB_common" /> - <provides type="function" name="DB_mysqli::connect" /> - <provides type="function" name="DB_mysqli::disconnect" /> - <provides type="function" name="DB_mysqli::simpleQuery" /> - <provides type="function" name="DB_mysqli::nextResult" /> - <provides type="function" name="DB_mysqli::fetchInto" /> - <provides type="function" name="DB_mysqli::freeResult" /> - <provides type="function" name="DB_mysqli::numCols" /> - <provides type="function" name="DB_mysqli::numRows" /> - <provides type="function" name="DB_mysqli::autoCommit" /> - <provides type="function" name="DB_mysqli::commit" /> - <provides type="function" name="DB_mysqli::rollback" /> - <provides type="function" name="DB_mysqli::affectedRows" /> - <provides type="function" name="DB_mysqli::nextId" /> - <provides type="class" name="DB_oci8" extends="DB_common" /> - <provides type="function" name="DB_oci8::connect" /> - <provides type="function" name="DB_oci8::disconnect" /> - <provides type="function" name="DB_oci8::simpleQuery" /> - <provides type="function" name="DB_oci8::nextResult" /> - <provides type="function" name="DB_oci8::fetchInto" /> - <provides type="function" name="DB_oci8::freeResult" /> - <provides type="function" name="DB_oci8::freePrepared" /> - <provides type="function" name="DB_oci8::numRows" /> - <provides type="function" name="DB_oci8::numCols" /> - <provides type="function" name="DB_oci8::prepare" /> - <provides type="function" name="DB_oci8::execute" /> - <provides type="class" name="DB_odbc" extends="DB_common" /> - <provides type="function" name="DB_odbc::connect" /> - <provides type="function" name="DB_odbc::disconnect" /> - <provides type="function" name="DB_odbc::simpleQuery" /> - <provides type="function" name="DB_odbc::nextResult" /> - <provides type="function" name="DB_odbc::fetchInto" /> - <provides type="function" name="DB_odbc::freeResult" /> - <provides type="function" name="DB_odbc::numCols" /> - <provides type="function" name="DB_odbc::affectedRows" /> - <provides type="function" name="DB_odbc::numRows" /> - <provides type="function" name="DB_odbc::quoteIdentifier" /> - <provides type="function" name="DB_odbc::quote" /> - <provides type="function" name="DB_odbc::nextId" /> - <provides type="class" name="DB_pgsql" extends="DB_common" /> - <provides type="function" name="DB_pgsql::connect" /> - <provides type="function" name="DB_pgsql::disconnect" /> - <provides type="function" name="DB_pgsql::simpleQuery" /> - <provides type="function" name="DB_pgsql::nextResult" /> - <provides type="function" name="DB_pgsql::fetchInto" /> - <provides type="function" name="DB_pgsql::freeResult" /> - <provides type="function" name="DB_pgsql::quote" /> - <provides type="function" name="DB_pgsql::quoteSmart" /> - <provides type="function" name="DB_pgsql::escapeSimple" /> - <provides type="function" name="DB_pgsql::numCols" /> - <provides type="function" name="DB_pgsql::numRows" /> - <provides type="function" name="DB_pgsql::autoCommit" /> - <provides type="function" name="DB_pgsql::commit" /> - <provides type="function" name="DB_pgsql::rollback" /> - <provides type="function" name="DB_pgsql::affectedRows" /> - <provides type="function" name="DB_pgsql::nextId" /> - <provides type="class" name="DB_sybase" extends="DB_common" /> - <provides type="function" name="DB_sybase::connect" /> - <provides type="function" name="DB_sybase::disconnect" /> - <provides type="function" name="DB_sybase::simpleQuery" /> - <provides type="function" name="DB_sybase::nextResult" /> - <provides type="function" name="DB_sybase::fetchInto" /> - <provides type="function" name="DB_sybase::freeResult" /> - <provides type="function" name="DB_sybase::numCols" /> - <provides type="function" name="DB_sybase::numRows" /> - <provides type="function" name="DB_sybase::affectedRows" /> - <provides type="function" name="DB_sybase::nextId" /> - <provides type="class" name="DB_storage" extends="PEAR" /> - <provides type="function" name="DB_storage::setup" /> - <provides type="function" name="DB_storage::insert" /> - <provides type="class" name="DB_sqlite" extends="DB_common" /> - <provides type="function" name="DB_sqlite::connect" /> - <provides type="function" name="DB_sqlite::disconnect" /> - <provides type="function" name="DB_sqlite::simpleQuery" /> - <provides type="function" name="DB_sqlite::nextResult" /> - <provides type="function" name="DB_sqlite::fetchInto" /> - <provides type="function" name="DB_sqlite::freeResult" /> - <provides type="function" name="DB_sqlite::numCols" /> - <provides type="function" name="DB_sqlite::numRows" /> - <provides type="function" name="DB_sqlite::affectedRows" /> - <provides type="function" name="DB_sqlite::dropSequence" /> - <provides type="function" name="DB_sqlite::createSequence" /> - <filelist> - <file role="php" baseinstalldir="/" md5sum="ea7037643a27c7d1eb0f818efcbf35ee" name="DB.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" md5sum="05dadd359cf7682e73fe7bc41cc4742c" name="DB/common.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" md5sum="921d3cde2d8295ca978caae22ab48761" name="DB/dbase.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" md5sum="830899b5b2ee3dbc93a0ccaab184c153" name="DB/fbsql.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" md5sum="64376b17c209ebc78745e7a532ccdd86" name="DB/ibase.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" md5sum="a27b90a13bfc9580d3954ca420d87c01" name="DB/ifx.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" md5sum="0fc78181842e1b47893a0be27f680bd9" name="DB/msql.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" md5sum="c7f21c8c526d7cf698095d594acc0c7c" name="DB/mssql.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" md5sum="3838d8d75ce62c730814bdb87799e79c" name="DB/mysql.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" md5sum="908762bfcf17b2195a61ec9219cbf10e" name="DB/mysqli.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" md5sum="dc42cd00866890e91f9235938a9acf87" name="DB/oci8.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" md5sum="8d6d0c54cfcec2cf46eace182886d8aa" name="DB/odbc.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" md5sum="7018bbfb1cd7f5e283688747d83fe18b" name="DB/pgsql.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" md5sum="fdc093d71420407c0034206c4068d332" name="DB/sybase.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" md5sum="0a920908d899cf8ce620449207de5e89" name="DB/storage.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" md5sum="7726118beb7c038e531783542b816a33" name="DB/sqlite.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="doc" md5sum="651a644b6f3495fc39279d75b8099372" name="doc/IDEAS"/> - <file role="doc" md5sum="8c5779871e07720a032615177403b691" name="doc/MAINTAINERS"/> - <file role="doc" md5sum="30bc4ceeccd51413ab81fa98c1fb9aa8" name="doc/STATUS"/> - <file role="doc" md5sum="31f276d6ff710a1f048c50cd533ffe5c" name="doc/TESTERS"/> - <file role="test" md5sum="2e7f987503b8b5e2a7fc4c3c30e79c13" name="tests/db_error.phpt"/> - <file role="test" md5sum="ca733f1d806681c6522ab993c999b12f" name="tests/db_parsedsn.phpt"/> - <file role="test" md5sum="79e88e6db0c25ca1ee5e2aac35a24d6c" name="tests/db_factory.phpt"/> - <file role="test" md5sum="859cffe6ae0f54122485879805629261" name="tests/db_ismanip.phpt"/> - <file role="test" md5sum="5f5068a8a1a3742ff0810be61b57288d" name="tests/db_error2.phpt"/> - <file role="test" md5sum="0ebba9b5012622df59dc2066e884cce1" name="tests/errors.inc"/> - <file role="test" md5sum="3732edbe1c159b16d82c0cefb23fb283" name="tests/fetchmode_object.inc"/> - <file role="test" md5sum="2cdad3e62c059414ddab8a410781458c" name="tests/fetchmodes.inc"/> - <file role="test" md5sum="f3d663fdf145e5bb3797c96b3d0dcf47" name="tests/include.inc"> - <replace from="@include_path@" to="php_dir" type="pear-config"/> - </file> - <file role="test" md5sum="600316395dc9ebe05f8249b4252088e6" name="tests/limit.inc"/> - <file role="test" md5sum="3abeeb0a61cdd7f4108a647cccb55810" name="tests/numcols.inc"/> - <file role="test" md5sum="26fb3581b281991838b2dfacf4e86f5d" name="tests/numrows.inc"/> - <file role="test" md5sum="06f6cd517eb324113c8cedf1c64a1e3e" name="tests/prepexe.inc"/> - <file role="test" md5sum="aac444f47ed3ad1642013539d99f5757" name="tests/run.cvs"/> - <file role="test" md5sum="0a3b6c14fb3a8cb6e3cd8ece9736e9eb" name="tests/sequences.inc"/> - <file role="test" md5sum="8f773eb10ee19145937296dca60d296e" name="tests/simplequery.inc"/> - <file role="test" md5sum="8b42ffcce8bbe68507f0ed21dab3200c" name="tests/transactions.inc"/> - <file role="test" md5sum="5f6f6b62f9779b97adf57bdbbcffe450" name="tests/skipif.inc"/> - <file role="test" md5sum="2cbff4d99f59d9ad71adf0833794f9e5" name="tests/driver/01connect.phpt"/> - <file role="test" md5sum="0261a7e827ff9581e4aca6dd6b13642e" name="tests/driver/02fetch.phpt"/> - <file role="test" md5sum="b671efeac9fd34b83309de8413531317" name="tests/driver/03simplequery.phpt"/> - <file role="test" md5sum="a5ecf473f648022af5dc9fbb2f33e371" name="tests/driver/04numcols.phpt"/> - <file role="test" md5sum="1ab9a3b8a98c691a222a510eb8134355" name="tests/driver/05sequences.phpt"/> - <file role="test" md5sum="8d651d2da580619ed5abeaaa9e1f71ad" name="tests/driver/06prepexec.phpt"/> - <file role="test" md5sum="b2e5ebe28916e63d8502845d58f74d49" name="tests/driver/08affectedrows.phpt"/> - <file role="test" md5sum="7efee695096e0cf6e243e5590915b6fc" name="tests/driver/09numrows.phpt"/> - <file role="test" md5sum="b2e481fc6f310db41e249a1e53f353c2" name="tests/driver/10errormap.phpt"/> - <file role="test" md5sum="f53ca06e8370629e5ab6717bf7bbe2a7" name="tests/driver/11transactions.phpt"/> - <file role="test" md5sum="7f2d525fc8d2038157a736b64b774811" name="tests/driver/13limit.phpt"/> - <file role="test" md5sum="13870a67a986287a1dd7b8616538cb90" name="tests/driver/14fetchmode_object.phpt"/> - <file role="test" md5sum="2cf853766a1c1dc21f0b38988cd5a406" name="tests/driver/15quote.phpt"/> - <file role="test" md5sum="a7db7211ac1faebce9248ffba535472e" name="tests/driver/16tableinfo.phpt"/> - <file role="test" md5sum="f796eae81fce16bc2a03cbea5af80b49" name="tests/driver/17query.phpt"/> - <file role="test" md5sum="8363274c9471e5b8038856ec4b111bea" name="tests/driver/18get.phpt"/> - <file role="test" md5sum="871bdd4a90291602c206042742922a71" name="tests/driver/19getlistof.phpt"/> - <file role="test" md5sum="4180a5d038d41a1262d1cc41951f0f3d" name="tests/driver/connect.inc"/> - <file role="test" md5sum="6f4a4b1e45c94733717a21ef26f388ba" name="tests/driver/mktable.inc"/> - <file role="test" md5sum="4af9cff841e14f1c94e358346747e7b6" name="tests/driver/multiconnect.php"/> - <file role="test" md5sum="7023d979e8bcb94a93d48597d864feb3" name="tests/driver/run.cvs"/> - <file role="test" md5sum="a7ee27ff0a2aacf0ef906eea8569718f" name="tests/driver/setup.inc.cvs"> - <replace from="@include_path@" to="php_dir" type="pear-config"/> - </file> - <file role="test" md5sum="5e3ad6fb4ab28735d788396ab80a63b5" name="tests/driver/skipif.inc"/> - </filelist> - </release> -</package> diff --git a/inc/packages/Log.xml b/inc/packages/Log.xml deleted file mode 100644 index de16370c8bfb70bd9e0bee8b599ee36b0d33d757..0000000000000000000000000000000000000000 --- a/inc/packages/Log.xml +++ /dev/null @@ -1,315 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0"> -<package version="1.0"> - <name>Log</name> - <summary>Logging utilities</summary> - <description>The Log framework provides an abstracted logging system. It supports logging to console, file, syslog, SQL, Sqlite, mail and mcal targets. It also provides a subject - observer mechanism.</description> - <maintainers> - <maintainer> - <user>jon</user> - <name>Jon Parise</name> - <email>jon@php.net</email> - <role>lead</role> - </maintainer> - </maintainers> - <release> - <version>1.8.7</version> - <date>2004-12-20</date> - <license>PHP License</license> - <state>stable</state> - <notes>The Log package now supports logging arrays with a 'message' key. -The 'display' handler now preserves line breaks in its output. -An experimental new handler ('daemon') has been added.</notes> - <deps> - <dep type="pkg" rel="has" optional="yes">DB</dep> - <dep type="ext" rel="has" optional="yes">sqlite</dep> - <dep type="php" rel="ge" version="4.3.0" optional="no"/> - </deps> - <filelist> - <file role="doc" baseinstalldir="/" name="docs/guide.txt"/> - <file role="doc" baseinstalldir="/" name="docs/examples/composite.php"/> - <file role="doc" baseinstalldir="/" name="docs/examples/console.php"/> - <file role="doc" baseinstalldir="/" name="docs/examples/display.php"/> - <file role="doc" baseinstalldir="/" name="docs/examples/error_log.php"/> - <file role="doc" baseinstalldir="/" name="docs/examples/file.php"/> - <file role="doc" baseinstalldir="/" name="docs/examples/mail.php"/> - <file role="doc" baseinstalldir="/" name="docs/examples/null.php"/> - <file role="doc" baseinstalldir="/" name="docs/examples/observer_mail.php"/> - <file role="doc" baseinstalldir="/" name="docs/examples/pear_error_handler.php"/> - <file role="doc" baseinstalldir="/" name="docs/examples/php_error_handler.php"/> - <file role="doc" baseinstalldir="/" name="docs/examples/sql.php"/> - <file role="doc" baseinstalldir="/" name="docs/examples/sqlite.php"/> - <file role="doc" baseinstalldir="/" name="docs/examples/syslog.php"/> - <file role="doc" baseinstalldir="/" name="docs/examples/win.php"/> - <file role="php" baseinstalldir="/" name="Log/composite.php"/> - <file role="php" baseinstalldir="/" name="Log/console.php"/> - <file role="php" baseinstalldir="/" name="Log/daemon.php"/> - <file role="php" baseinstalldir="/" name="Log/display.php"/> - <file role="php" baseinstalldir="/" name="Log/error_log.php"/> - <file role="php" baseinstalldir="/" name="Log/file.php"/> - <file role="php" baseinstalldir="/" name="Log/mail.php"/> - <file role="php" baseinstalldir="/" name="Log/mcal.php"/> - <file role="php" baseinstalldir="/" name="Log/null.php"/> - <file role="php" baseinstalldir="/" name="Log/observer.php"/> - <file role="php" baseinstalldir="/" name="Log/sql.php"/> - <file role="php" baseinstalldir="/" name="Log/sqlite.php"/> - <file role="php" baseinstalldir="/" name="Log/syslog.php"/> - <file role="php" baseinstalldir="/" name="Log/win.php"/> - <file role="data" baseinstalldir="/" name="misc/log.sql"/> - <file role="test" baseinstalldir="/" name="tests/composite.phpt"/> - <file role="test" baseinstalldir="/" name="tests/console.phpt"/> - <file role="test" baseinstalldir="/" name="tests/display.phpt"/> - <file role="test" baseinstalldir="/" name="tests/error_log.phpt"/> - <file role="test" baseinstalldir="/" name="tests/extract.phpt"/> - <file role="test" baseinstalldir="/" name="tests/extract2.phpt"/> - <file role="test" baseinstalldir="/" name="tests/factory.phpt"/> - <file role="test" baseinstalldir="/" name="tests/null.phpt"/> - <file role="test" baseinstalldir="/" name="tests/priority.phpt"/> - <file role="test" baseinstalldir="/" name="tests/singleton.phpt"/> - <file role="test" baseinstalldir="/" name="tests/sqlite.phpt"/> - <file role="test" baseinstalldir="/" name="tests/sql_ident.phpt"/> - <file role="php" baseinstalldir="/" name="Log.php"/> - </filelist> - </release> - <changelog> - <release> - <version>1.8.7</version> - <date>2004-12-20</date> - <license>PHP License</license> - <state>stable</state> - <notes>The Log::_extractMessage() routine will now extract and use the value of an array's 'message' key if it exists. (Laurent Laville) -The 'display' handler now preserves line breaks in its output. (Bug 2606) -An experimental new syslog daemon log handler ('daemon') has been added to the Log distribution. (Bart van der Schans) -</notes> - </release> - <release> - <version>1.8.6</version> - <date>2004-09-08</date> - <license>PHP License</license> - <state>stable</state> - <notes>The maximum length of the 'sql' handler's 'ident' string is now configurable via the 'identLimit' configuration parameter. (Bug 2137) - -Different instances of the 'win' handler can now address their own output windows. (Bug 2212) -</notes> - </release> - <release> - <version>1.8.5</version> - <date>2004-08-09</date> - <license>PHP License</license> - <state>stable</state> - <notes>The 'sql' handler now enforces a maximum 'ident' length of 16 characters. - -The 'sql' handler can now use a user-defined sequence (via the 'sequence' configuration parameter). This allows each log table to use its own sequence. You will need to take appropriate steps to preserve your sequence numbering if that is important to your site; the ID sequence will be reinitialized to 0 the first time this updated handler is used. You may also need to explicitly drop the 'log_id_seq' sequence before using this new code. - -The 'composite' handler now properly closes all of its children when its close() method is called. It also guards against multiple calls to open(). (Bug 1947) -</notes> - </release> - <release> - <version>1.8.4</version> - <date>2004-02-16</date> - <license>PHP License</license> - <state>stable</state> - <notes>The Log package now requires PHP 4.3.0 or later. - -The _extractMessage() method no longer uses the serialize()'ed version of an event object if no string conversion method is available. Instead, the human-readable (via print_r()) representation of the object will be used. - -_extractMessage() can now handle arrays. Their human-readable representation will be used. - -Each Log instance now has a default priority level. This priority will be used by the log() method when no specific priority parameter is provided. It can be accessed using the new getPriority() and setPriority() methods. -</notes> - </release> - <release> - <version>1.8.3</version> - <date>2004-01-11</date> - <license>PHP License</license> - <state>stable</state> - <notes>The open() and close() methods now consistently return success or failure. Previously, some handlers' open() and close() methods did not return any result. Also, the log() methods will return failure when the handler cannot be opened. - -Bertrand Mansion contributed a new handler that logs using the Sqlite extension. -</notes> - </release> - <release> - <version>1.8.2</version> - <date>2004-01-01</date> - <license>PHP License</license> - <state>stable</state> - <notes>A new 'null' log handler that simply consumes log events has been added. The 'null' handler will still respect log masks and attached observers. - -The public Log API has grown a flush() method. This allows buffered log output to be explicitly flushed. At this time, the flush() method is only implemented by the console, file and mail handlers. - -New unit tests for the Factory and Singleton construction methods have been added. -</notes> - </release> - <release> - <version>1.8.1</version> - <date>2003-12-14</date> - <license>PHP License</license> - <state>stable</state> - <notes>The 'win' handler now handles newline sequences correctly (Bug 282). - -The Log_observer::factory() method has been updated to accept an optional associative array of configuration values, return the newly-created object by reference, and look for files named 'Log/observer_.php'. Backwards compatibility for the old-style conventions has been preserved. -</notes> - </release> - <release> - <version>1.8.0</version> - <date>2003-11-18</date> - <license>PHP License</license> - <state>stable</state> - <notes>The Log package now includes a users guide, example scripts and unit tests. - -A number of small improvements have been made to the 'win' log handler (based on suggestions from Paul Yanchenko). - -A new 'display' log handler has been added to the distribution. Contributed by Paul Yanchenko, this handler simply prints the error message back to the browser. It respects the 'error_prepend_string' and 'error_append_string' PHP INI values and is useful when using PEAR::setErrorHandling()'s PEAR_ERROR_CALLBACK mechanism. -</notes> - </release> - <release> - <version>1.7.1</version> - <date>2003-09-21</date> - <state>stable</state> - <notes>The mail handler now uses "\n" to terminate lines instead of "\r\n". - -The file handler's path creation routines now guard against potentially infinite recursion. - -It is now possible to pass an object to the logging methods. If the object offers a PEAR_Error-style getMessage() or PHP5 exception-style toString() method, it will be used to extract the message text. -</notes> - </release> - <release> - <version>1.7.0</version> - <date>2003-08-02</date> - <state>stable</state> - <notes>It is now possible to specific a specific mask that dictates exactly which levels will be logged. - -A number of convenient "shortcut" functions have been added for logging messages at specific log messages. - -Two new log handers have been added: the 'error_log' handler wraps PHP's native error_log() function; and the 'win' handler outputs log messages to a separate browser window. - -The file log handler has been completely rewritten based on suggestions from Roman Neuhauser. It no longer buffers log output in memory before writing to the log file. - -Greg Beaver submitted a change that allows callers to provide their own Log classes (that existing outside of the PEAR file hierarchy) by including them before invoking a factory() method. -</notes> - </release> - <release> - <version>1.6.7</version> - <date>2003-06-16</date> - <state>stable</state> - <notes>It is now possible to set the identification string for all of a composite's child instances. - -The preamble of the mail handler's message is now configurable. -</notes> - </release> - <release> - <version>1.6.5</version> - <date>2003-04-26</date> - <state>stable</state> - <notes>The mail log handler needs to register its own destructer now that the Log class no longer inherits from the PEAR base class. -</notes> - </release> - <release> - <version>1.6.4</version> - <date>2003-04-08</date> - <state>stable</state> - <notes>The Log classes no longer inherits from the PEAR base class. Not including the PEAR base class gives us smaller, faster Log objects. - -The Log_file class now registers its own destructor to ensure that the logfile is correctly closed upon shutdown. - -A ZendEngine 1 incompatibility was introduced in the previous release. This has been corrrected. -</notes> - </release> - <release> - <version>1.6.3</version> - <date>2003-04-07</date> - <state>stable</state> - <notes>A unique identifier is now stored inside each Log instance. Both the composite and subject-observer mechanisms use this identifier to index their object lists. - -The internals of the Log_observer system have been rewritten for general cleanliness. The external interface remains unchanged. - -The Log class now offers public setIdent() and getIdent() members for setting and getting the Log instance's identification string during the object's lifetime. -</notes> - </release> - <release> - <version>1.6.2</version> - <date>2003-04-06</date> - <state>stable</state> - <notes>In the Log_observer class, operate directly on the reference to the Log instance (instead of on a copy of the object). -</notes> - </release> - <release> - <version>1.6.1</version> - <date>2003-04-02</date> - <state>stable</state> - <notes>- Fix a typo that broke the Log_Observer class. -</notes> - </release> - <release> - <version>1.6.0</version> - <date>2003-02-17</date> - <state>stable</state> - <notes>- The SQL handler now uses sequences instead of timestamps as unique identifiers. -- The time format used by the file handler is now configurable. -</notes> - </release> - <release> - <version>1.5.3</version> - <date>2003-01-01</date> - <state>stable</state> - <notes>- Improved singleton()'s signature generation. -- The SQL handler no longer closes existing database connections. -- The log() method now returns a boolean result indicating success or failure. -</notes> - </release> - <release> - <version>1.5.2</version> - <date>2002-11-28</date> - <state>stable</state> - <notes>- Altered the singleton's "signature" construction to be shorter and more array-friendly. -</notes> - </release> - <release> - <version>1.5.1</version> - <date>2002-11-17</date> - <state>stable</state> - <notes>- The mail handler now implements a destructor to ensure close() is called. -- The syslog handler now requires $name to be a valid syslog facility. -</notes> - </release> - <release> - <version>1.5</version> - <date>2002-10-24</date> - <state>stable</state> - <notes>- Adding the ability to set the mode of the logfile in the Log_file. -- mail() failures in Log_mail are logged via error_log(). -- Replaced all remaining LOG_* constants with the PEAR_LOG_* versions. -</notes> - </release> - <release> - <version>1.4</version> - <date>2002-09-28</date> - <state>stable</state> - <notes>- Altered the format of the SQL logging table to use a TIMESTAMP field. -- The Log class now extends the PEAR base class. -- New file logger that keeps the log file open for the life of the request. -</notes> - </release> - <release> - <version>1.3</version> - <date>2002-09-15</date> - <state>stable</state> - <notes>Adding a mail logging target. -</notes> - </release> - <release> - <version>1.2</version> - <date>2002-07-24</date> - <state>stable</state> - <notes>Introduce the PEAR_LOG_* constants. -</notes> - </release> - <release> - <version>1.1</version> - <date>2002-04-12</date> - <state>stable</state> - <notes>Adding a new console logging target. -</notes> - </release> - </changelog> -</package> diff --git a/inc/packages/Mail.xml b/inc/packages/Mail.xml deleted file mode 100644 index 0fbd10ac951cd89049a9867dc41a7ef44ab579ae..0000000000000000000000000000000000000000 --- a/inc/packages/Mail.xml +++ /dev/null @@ -1,122 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0"> -<package version="1.0"> - <name>Mail</name> - <summary>Class that provides multiple interfaces for sending emails</summary> - <description>PEAR's Mail:: package defines the interface for implementing mailers under the PEAR hierarchy, and provides supporting functions useful in multiple mailer backends. Currently supported are native PHP mail() function, sendmail and SMTP. This package also provides a RFC 822 Email address list validation utility class.</description> - <maintainers> - <maintainer> - <user>chagenbu</user> - <name>Chuck Hagenbuch</name> - <email>chuck@horde.org</email> - <role>lead</role> - </maintainer> - <maintainer> - <user>richard</user> - <name>Richard Heyes</name> - <email>richard@phpguru.org</email> - <role>developer</role> - </maintainer> - <maintainer> - <user>jon</user> - <name>Jon Parise</name> - <email>jon@php.net</email> - <role>lead</role> - </maintainer> - </maintainers> - <release> - <version>1.1.6</version> - <date>2005-07-12</date> - <license>PHP/BSD</license> - <state>stable</state> - <notes>- Don't emit warnings with PHP 4.4/5.1.</notes> - <deps> - <dep type="pkg" rel="ge" version="1.1.0" optional="yes">Net_SMTP</dep> - </deps> - <filelist> - <file role="php" md5sum="b0699c0f6b51275e74a2c97cb1de7980" name="Mail.php"/> - <file role="php" md5sum="ff2c701d512ef88a6c9c3dfe3f0e88e5" name="Mail/mail.php"/> - <file role="php" md5sum="4a1ed7ae8036862b24fa0ea84f8bbe0e" name="Mail/null.php"/> - <file role="php" md5sum="34ee064a62dae8fe5d9d3a17f3c27d39" name="Mail/sendmail.php"/> - <file role="php" md5sum="2afc664c71665f79c30814427bfe36ae" name="Mail/smtp.php"/> - <file role="php" md5sum="1dd4f8ccc2527904d07149d4d9855c41" name="Mail/RFC822.php"/> - <file role="test" md5sum="415a187e606d547c3e852ab83e2ab4e8" name="tests/rfc822.phpt"/> - </filelist> - </release> - <changelog> - <release> - <version>1.1.5</version> - <date>2005-06-26</date> - <state>stable</state> - <notes>- Unfold long lines before parsing addresses in Mail_RFC822. -- The SMTP driver now supports a 'timeout' value. (Request #3776) -- An array of Received: headers can now be provided. (Bug #4636) - -</notes> - </release> - <release> - <version>1.1.4</version> - <date>2004-09-08</date> - <state>stable</state> - <notes>- Header key comparisons are now case-insensitive. (Colin Viebrock) -- Header fields (e.g., 'Cc', 'Bcc') may now be specified as arrays of addresses. (Colin Viebrock) -- PHP5 compatibility fix (Bug #1563). -- PHP4 / Win32 compatibility fix for the 'sendmail' driver (Bug 1881). -- Stricter "local part" parsing for Mail_RFC822 (in accordance with Section 6.2.4 of RFC 822) (Bug 1869). -- The various send() implementations now properly escalate the PEAR_Error object returned by Mail::prepareHeaders() in the event of an invalid header. - -</notes> - </release> - <release> - <version>1.1.3</version> - <date>2004-04-08</date> - <state>stable</state> - <notes>- The 'mail' driver now returns a PEAR_Error object on failure. -- The individual drivers no longer include the 'Mail.php' file. If you want to instantiate a driver directly, you'll need to explicitly include the 'Mail.php' file yourself. - -</notes> - </release> - <release> - <version>1.1.2</version> - <date>2003-09-04</date> - <state>stable</state> - <notes>The 'localhost' value can now be set in the SMTP driver. -</notes> - </release> - <release> - <version>1.1.1</version> - <date>2003-06-26</date> - <state>stable</state> - <notes>Minor fixes with newlines in headers. -</notes> - </release> - <release> - <version>1.1.0</version> - <date>2003-06-21</date> - <state>stable</state> - <notes>The Mail package now depends on Net_SMTP 1.1.0 or greater for its SMTP authentication capabilities. -</notes> - </release> - <release> - <version>1.0.2</version> - <date>2002-07-27</date> - <state>stable</state> - <notes>Minor additions and changes to RFC822.php. Fixed line terminator issue for smtp.php and set smtp.php to use Return-Path header in place of From header for MAIL FROM: (if supplied) -</notes> - </release> - <release> - <version>1.0.1</version> - <date>2002-07-27</date> - <state>stable</state> - <notes>License change for RFC822.php -</notes> - </release> - <release> - <version>1.0</version> - <date>2002-06-06</date> - <state>stable</state> - <notes>Initial release as PEAR package -</notes> - </release> - </changelog> -</package> diff --git a/inc/packages/Mail_Mime.xml b/inc/packages/Mail_Mime.xml deleted file mode 100644 index ddf734f0c28cfb048f0647f8e08f379592971371..0000000000000000000000000000000000000000 --- a/inc/packages/Mail_Mime.xml +++ /dev/null @@ -1,113 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0"> -<package version="1.0"> - <name>Mail_Mime</name> - <summary>Provides classes to create and decode mime messages.</summary> - <description>Provides classes to deal with creation and manipulation of mime messages.</description> - <maintainers> - <maintainer> - <user>cipri</user> - <name>Cipriano Groenendal</name> - <email>cipri@php.net</email> - <role>lead</role> - </maintainer> - <maintainer> - <user>gschlossnagle</user> - <name>George Schlossnagle</name> - <email>gschlossnagle@php.net</email> - <role>lead</role> - </maintainer> - <maintainer> - <user>sean</user> - <name>Sean Coates</name> - <email>sean@php.net</email> - <role>lead</role> - </maintainer> - <maintainer> - <user>richard</user> - <name>Richard Heyes</name> - <email>richard@php.net</email> - <role>contributor</role> - </maintainer> - <maintainer> - <user>cox</user> - <name>Tomas V.V.Cox</name> - <email>cox@idecnet.com</email> - <role>contributor</role> - </maintainer> - </maintainers> - <release> - <version>1.3.1</version> - <date>2005-07-13</date> - <license>PHP</license> - <state>stable</state> - <notes>A bugfix release:</notes> - <filelist> - <file role="php" baseinstalldir="Mail" md5sum="8c87c7120ef61cd7c927f022fb270d2d" name="mime.php"/> - <file role="php" baseinstalldir="Mail" md5sum="e266dce6abce7f0e0e2e8972a8fe2275" name="mimeDecode.php"/> - <file role="php" baseinstalldir="Mail" md5sum="3663406015b4ae1cc9df19f68247a784" name="mimePart.php"/> - <file role="data" baseinstalldir="Mail" md5sum="194810c478066eaeb28f51116b88e25a" name="xmail.dtd"/> - <file role="data" baseinstalldir="Mail" md5sum="61cea06fb6b4bd3a4b5e2d37384e14a9" name="xmail.xsl"/> - </filelist> - </release> - <changelog> - <release> - <version>1.3.0</version> - <date>2005-04-01</date> - <license>PHP</license> - <state>stable</state> - <notes>o First (stable) release in over 2.5 years (!) -o MANY bugfixes (see the bugtracker) -o added a few tests -o one small fix after RC1 (bug #3940) - -</notes> - </release> - <release> - <version>1.3.0RC1</version> - <date>2005-03-20</date> - <state>beta</state> - <notes>o First release in over 2.5 years (!) -o MANY bugfixes (see the bugtracker) -o added a few tests - -</notes> - </release> - <release> - <version>1.2.1</version> - <date>2002-07-27</date> - <license>PHP</license> - <state>stable</state> - <notes>o License change -o Applied a few changes From Ilia Alshanetsky - -</notes> - </release> - <release> - <version>1.2</version> - <date>2002-07-14</date> - <state>stable</state> - <notes>o Added header encoding -o Altered mimePart to put boundary parameter on newline -o Changed addFrom() to setFrom() -o Added setSubject() -o Made mimePart inherit crlf setting from mime - -</notes> - </release> - <release> - <version>1.1</version> - <date>2002-04-03</date> - <state>stable</state> - <notes>This is a maintenance release with various bugfixes and minor enhancements. -</notes> - </release> - <release> - <version>1.0</version> - <date>2001-12-28</date> - <state>stable</state> - <notes>This is the initial release of the Mime_Mail package. -</notes> - </release> - </changelog> -</package> diff --git a/inc/packages/Net_SMTP.xml b/inc/packages/Net_SMTP.xml deleted file mode 100644 index d1e8c56332e172a412517b3d32499d64761e5841..0000000000000000000000000000000000000000 --- a/inc/packages/Net_SMTP.xml +++ /dev/null @@ -1,137 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0"> -<package version="1.0"> - <name>Net_SMTP</name> - <summary>Provides an implementation of the SMTP protocol</summary> - <description>Provides an implementation of the SMTP protocol using PEAR's Net_Socket class.</description> - <maintainers> - <maintainer> - <user>chagenbu</user> - <name>Chuck Hagenbuch</name> - <email>chuck@horde.org</email> - <role>lead</role> - </maintainer> - <maintainer> - <user>jon</user> - <name>Jon Parise</name> - <email>jon@php.net</email> - <role>lead</role> - </maintainer> - </maintainers> - <release> - <version>1.2.6</version> - <date>2004-04-12</date> - <license>PHP License</license> - <state>stable</state> - <notes>Renaming some methods to be compatible with the PEAR coding standards. Backwards-compatible wrappers have been provided.</notes> - <deps> - <dep type="pkg" rel="has" optional="no">Net_Socket</dep> - <dep type="pkg" rel="has" optional="yes">Auth_SASL</dep> - </deps> - <filelist> - <file role="doc" baseinstalldir="Net" name="docs/guide.txt"/> - <file role="doc" baseinstalldir="Net" name="docs/examples/basic.php"/> - <file role="test" baseinstalldir="Net" name="tests/auth.phpt"/> - <file role="test" baseinstalldir="Net" name="tests/basic.phpt"/> - <file role="test" baseinstalldir="Net" name="tests/config.php.dist"/> - <file role="php" baseinstalldir="Net" name="SMTP.php"/> - </filelist> - </release> - <changelog> - <release> - <version>1.2.6</version> - <date>2004-04-12</date> - <license>PHP License</license> - <state>stable</state> - <notes>The following methods have been renamed for compliance with the PEAR coding standards: send_from() -> sendFrom(), soml_from() -> somlFrom(), saml_from() -> samlFrom(). Backwards-compatible wrappers have been provided. -</notes> - </release> - <release> - <version>1.2.5</version> - <date>2004-03-11</date> - <license>PHP License</license> - <state>stable</state> - <notes>The connect() method has grown an optional 'persistent' parameter that will be passed to the Net_Socket::connect() method. Previously, persistent connections will always disabled. 'persistent' defaults to false. - -Release 1.2.4 was incorrectly packaged. Release 1.2.5 corrects that error. The code itself remains the same. -</notes> - </release> - <release> - <version>1.2.4</version> - <date>2004-03-11</date> - <license>PHP License</license> - <state>stable</state> - <notes>The connect() method has grown an optional 'persistent' parameter that will be passed to the Net_Socket::connect() method. Previously, persistent connections will always disabled. 'persistent' defaults to false. -</notes> - </release> - <release> - <version>1.2.3</version> - <date>2003-05-11</date> - <state>stable</state> - <notes>Both 235 (Authentication successful) and 503 (Error: already authenticated) are now accepted as valid AUTH responses. - -503 (Error: already authenticated) is now considered a valid EHLO response. -</notes> - </release> - <release> - <version>1.2.2</version> - <date>2003-05-02</date> - <state>stable</state> - <notes>Fix a call-time pass-by-reference problem that was raising a warning if call-time pass-by-reference was disabled. -</notes> - </release> - <release> - <version>1.2.1</version> - <date>2003-04-26</date> - <state>stable</state> - <notes>The Auth_SASL package is no longer absolutely required, but it will be used if it is available. Otherwise, the authentication methods that depend upon it will be disabled. -</notes> - </release> - <release> - <version>1.2.0</version> - <date>2003-04-06</date> - <state>stable</state> - <notes>- Perform data quoting in its own routine: quotedata() -</notes> - </release> - <release> - <version>1.1.2</version> - <date>2003-02-17</date> - <state>stable</state> - <notes>- Correctly handle the case where the server's ESMTP response includes a SIZE keyword with no specific value. -</notes> - </release> - <release> - <version>1.1.1</version> - <date>2003-01-30</date> - <state>stable</state> - <notes>- Don't enforce a maximum message size if the SIZE parameter is zero. -</notes> - </release> - <release> - <version>1.1.0</version> - <date>2003-01-18</date> - <state>stable</state> - <notes>- The SMTP server's SIZE capability is now honored. -- Improved support for SMTP authentication (LOGIN, PLAIN, CRAM-MD5, DIGEST-MD5). -- Overhauled the server response parsing system. -- Added optional debugging output (enabled via setDebug()). -- A timeout value can now be specified for the socket connection. -</notes> - </release> - <release> - <version>1.0.1</version> - <date>2003-01-02</date> - <state>stable</state> - <notes>Corrected an off-by-one bug that corrupted the list of ESMTP capabilities. -</notes> - </release> - <release> - <version>1.0</version> - <date>2002-06-11</date> - <state>stable</state> - <notes>Initial release as PEAR package -</notes> - </release> - </changelog> -</package> diff --git a/inc/packages/Net_Socket.xml b/inc/packages/Net_Socket.xml deleted file mode 100644 index 9c7eae0094081f091275755cf6b4b55f93ec47e6..0000000000000000000000000000000000000000 --- a/inc/packages/Net_Socket.xml +++ /dev/null @@ -1,84 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0"> -<package version="1.0"> - <name>Net_Socket</name> - <summary>Network Socket Interface</summary> - <description>Net_Socket is a class interface to TCP sockets. It provides blocking -and non-blocking operation, with different reading and writing modes -(byte-wise, block-wise, line-wise and special formats like network -byte-order ip addresses).</description> - <maintainers> - <maintainer> - <user>ssb</user> - <name>Stig Bakken</name> - <email>stig@php.net</email> - <role>lead</role> - </maintainer> - <maintainer> - <user>chagenbu</user> - <name>Chuck Hagenbuch</name> - <email>chuck@horde.org</email> - <role>lead</role> - </maintainer> - </maintainers> - <release> - <version>1.0.6</version> - <date>2005-02-26</date> - <license>PHP License</license> - <state>stable</state> - <notes>- Make package.xml safe for PEAR 1.4.0. -- Chunk socket writes on Windows by default, or if explicitly specified (Bug #980) -- Don't run any $addr with a '/' in it through gethostbyname() (Bug #3372)</notes> - <filelist> - <file role="php" baseinstalldir="Net" md5sum="1c7a9a28fc3fa78e682200d7540b66d5" name="Socket.php"/> - </filelist> - </release> - <changelog> - <release> - <version>1.0.0</version> - <date>2002-04-01</date> - <state>stable</state> - <notes>First independent release of Net_Socket. -</notes> - </release> - <release> - <version>1.0.1</version> - <date>2002-04-04</date> - <state>stable</state> - <notes>Touch up error handling. -</notes> - </release> - <release> - <version>1.0.2</version> - <date>2004-04-26</date> - <state>stable</state> - <notes>Fixes for several longstanding bugs. Allow setting of stream -context. Correctly read lines that only end in \n. Suppress -PHP warnings. -</notes> - </release> - <release> - <version>1.0.3</version> - <date>2004-12-08</date> - <state>stable</state> - <notes>Optimize away some duplicate is_resource() calls. -Better solution for eof() on blocking sockets [#1427]. -Add select() implementation [#1428]. -</notes> - </release> - <release> - <version>1.0.4</version> - <date>2004-12-13</date> - <state>stable</state> - <notes>Restore support for unix sockets (Bug #2961). -</notes> - </release> - <release> - <version>1.0.5</version> - <date>2005-01-11</date> - <state>stable</state> - <notes>Don't rely on gethostbyname() for error checking (Bug #3100). -</notes> - </release> - </changelog> -</package> diff --git a/inc/packages/PEAR.xml b/inc/packages/PEAR.xml deleted file mode 100644 index 83800a16a0d94d43607a82a8d7d9c8261a52d1b8..0000000000000000000000000000000000000000 --- a/inc/packages/PEAR.xml +++ /dev/null @@ -1,282 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0"> -<package version="1.0" packagerversion="1.4.0a1"> - <name>PEAR</name> - <summary>PEAR Base System</summary> - <description>The PEAR package contains: - * the PEAR installer, for creating, distributing - and installing packages - * the alpha-quality PEAR_Exception php5-only exception class - * the beta-quality PEAR_ErrorStack advanced error handling mechanism - * the PEAR_Error error handling mechanism - * the OS_Guess class for retrieving info about the OS - where PHP is running on - * the System class for quick handling common operations - with files and directories - * the PEAR base class - </description> - <maintainers> - <maintainer> - <user>ssb</user> - <name>Stig Bakken</name> - <email>stig@php.net</email> - <role>lead</role> - </maintainer> - <maintainer> - <user>cox</user> - <name>Tomas V.V.Cox</name> - <email>cox@idecnet.com</email> - <role>lead</role> - </maintainer> - <maintainer> - <user>cellog</user> - <name>Greg Beaver</name> - <email>cellog@php.net</email> - <role>lead</role> - </maintainer> - <maintainer> - <user>pajoye</user> - <name>Pierre-Alain Joye</name> - <email>pajoye@pearfr.org</email> - <role>lead</role> - </maintainer> - <maintainer> - <user>mj</user> - <name>Martin Jansen</name> - <email>mj@php.net</email> - <role>developer</role> - </maintainer> - </maintainers> - <release> - <version>1.3.5</version> - <date>2005-02-18</date> - <license>PHP License</license> - <state>stable</state> - <notes>* fix Bug #3505: pecl can't install PDO -* enhance pear run-tests dramatically -* fix Bug #3506: pear install should export the pear version into the environment - </notes> - <deps> - <dep type="php" rel="ge" version="4.2"/> - <dep type="pkg" rel="ge" version="1.1">Archive_Tar</dep> - <dep type="pkg" rel="ge" version="1.2">Console_Getopt</dep> - <dep type="pkg" rel="ge" version="1.0.4">XML_RPC</dep> - <dep type="ext" rel="has">xml</dep> - <dep type="ext" rel="has">pcre</dep> - </deps> - <provides type="class" name="OS_Guess" /> - <provides type="class" name="System" /> - <provides type="function" name="md5_file" /> - <provides type="function" name="OS_Guess::parseSignature" /> - <provides type="class" name="PEAR_Command_Auth" extends="PEAR_Command_Common" /> - <provides type="function" name="PEAR_Command_Auth::doLogin" /> - <provides type="class" name="PEAR_Command_Build" extends="PEAR_Command_Common" /> - <provides type="function" name="PEAR_Command_Build::doBuild" /> - <provides type="function" name="PEAR_Command_Build::buildCallback" /> - <provides type="class" name="PEAR_Command_Common" extends="PEAR" /> - <provides type="function" name="PEAR_Command_Common::getCommands" /> - <provides type="function" name="PEAR_Command_Common::getShortcuts" /> - <provides type="function" name="PEAR_Command_Common::getOptions" /> - <provides type="function" name="PEAR_Command_Common::getGetoptArgs" /> - <provides type="function" name="PEAR_Command_Common::getHelp" /> - <provides type="class" name="PEAR_Command_Config" extends="PEAR_Command_Common" /> - <provides type="function" name="PEAR_Command_Config::doConfigShow" /> - <provides type="function" name="PEAR_Command_Config::doConfigGet" /> - <provides type="function" name="PEAR_Command_Config::doConfigSet" /> - <provides type="function" name="PEAR_Command_Config::doConfigHelp" /> - <provides type="class" name="PEAR_Command_Install" extends="PEAR_Command_Common" /> - <provides type="function" name="PEAR_Command_Install::doInstall" /> - <provides type="class" name="PEAR_Command_Package" extends="PEAR_Command_Common" /> - <provides type="class" name="PEAR_Command_Registry" extends="PEAR_Command_Common" /> - <provides type="function" name="PEAR_Command_Registry::doList" /> - <provides type="class" name="PEAR_Command_Remote" extends="PEAR_Command_Common" /> - <provides type="function" name="PEAR_Command_Remote::doRemoteInfo" /> - <provides type="class" name="PEAR_Command_Mirror" extends="PEAR_Command_Common" /> - <provides type="function" name="PEAR_Command_Mirror::doDownloadAll" /> - <provides type="class" name="PEAR_Frontend_CLI" extends="PEAR" /> - <provides type="function" name="PEAR_Frontend_CLI::displayLine" /> - <provides type="class" name="PEAR_Autoloader" extends="PEAR" /> - <provides type="function" name="PEAR_Autoloader::addAutoload" /> - <provides type="function" name="PEAR_Autoloader::removeAutoload" /> - <provides type="function" name="PEAR_Autoloader::addAggregateObject" /> - <provides type="function" name="PEAR_Autoloader::removeAggregateObject" /> - <provides type="class" name="PEAR_Command" /> - <provides type="function" name="PEAR_Command::factory" /> - <provides type="class" name="PEAR_Common" extends="PEAR" /> - <provides type="function" name="PEAR_Common::addTempFile" /> - <provides type="function" name="PEAR_Common::mkDirHier" /> - <provides type="class" name="PEAR_Config" extends="PEAR" /> - <provides type="function" name="PEAR_Config::singleton" /> - <provides type="function" name="PEAR_Config::readConfigFile" /> - <provides type="class" name="PEAR_Dependency" /> - <provides type="function" name="PEAR_Dependency::callCheckMethod" /> - <provides type="class" name="PEAR_Downloader" extends="PEAR_Common" /> - <provides type="function" name="PEAR_Downloader::configSet" /> - <provides type="function" name="PEAR_Downloader::setOptions" /> - <provides type="class" name="PEAR_Exception" extends="Exception" /> - <provides type="function" name="PEAR_Exception::addObserver" /> - <provides type="function" name="PEAR_Exception::removeObserver" /> - <provides type="function" name="PEAR_Exception::getUniqueId" /> - <provides type="function" name="PEAR_Exception::signal" /> - <provides type="function" name="PEAR_Exception::getErrorData" /> - <provides type="function" name="PEAR_Exception::getCause" /> - <provides type="function" name="PEAR_Exception::getCauseMessage" /> - <provides type="function" name="PEAR_Exception::getTraceSafe" /> - <provides type="function" name="PEAR_Exception::getErrorClass" /> - <provides type="function" name="PEAR_Exception::getErrorMethod" /> - <provides type="function" name="PEAR_Exception::toHtml" /> - <provides type="function" name="PEAR_Exception::toText" /> - <provides type="class" name="PEAR_ErrorStack" /> - <provides type="function" name="PEAR_ErrorStack::singleton" /> - <provides type="function" name="PEAR_ErrorStack::setDefaultLogger" /> - <provides type="function" name="PEAR_ErrorStack::setLogger" /> - <provides type="function" name="PEAR_ErrorStack::setMessageCallback" /> - <provides type="function" name="PEAR_ErrorStack::getMessageCallback" /> - <provides type="function" name="PEAR_ErrorStack::setDefaultCallback" /> - <provides type="function" name="PEAR_ErrorStack::setContextCallback" /> - <provides type="function" name="PEAR_ErrorStack::pushCallback" /> - <provides type="function" name="PEAR_ErrorStack::popCallback" /> - <provides type="function" name="PEAR_ErrorStack::staticPushCallback" /> - <provides type="function" name="PEAR_ErrorStack::staticPopCallback" /> - <provides type="function" name="PEAR_ErrorStack::push" /> - <provides type="function" name="PEAR_ErrorStack::staticPush" /> - <provides type="function" name="PEAR_ErrorStack::pop" /> - <provides type="function" name="PEAR_ErrorStack::hasErrors" /> - <provides type="function" name="PEAR_ErrorStack::getErrors" /> - <provides type="function" name="PEAR_ErrorStack::staticHasErrors" /> - <provides type="function" name="PEAR_ErrorStack::staticGetErrors" /> - <provides type="function" name="PEAR_ErrorStack::getFileLine" /> - <provides type="function" name="PEAR_ErrorStack::getErrorMessage" /> - <provides type="function" name="PEAR_ErrorStack::getErrorMessageTemplate" /> - <provides type="function" name="PEAR_ErrorStack::setErrorMessageTemplate" /> - <provides type="function" name="PEAR_ErrorStack::raiseError" /> - <provides type="class" name="PEAR_Builder" extends="PEAR_Common" /> - <provides type="class" name="PEAR_Installer" extends="PEAR_Downloader" /> - <provides type="class" name="PEAR_Packager" extends="PEAR_Common" /> - <provides type="function" name="PEAR_Packager::package" /> - <provides type="class" name="PEAR_Registry" extends="PEAR" /> - <provides type="class" name="PEAR_Remote" extends="PEAR" /> - <provides type="function" name="PEAR_Remote::getCache" /> - <provides type="function" name="PEAR_Remote::saveCache" /> - <provides type="function" name="PEAR_Remote::call" /> - <provides type="function" name="PEAR_Remote::call_epi" /> - <provides type="class" name="PEAR_RunTest" /> - <provides type="function" name="PEAR_RunTest::run" /> - <provides type="class" name="PEAR" /> - <provides type="function" name="System::raiseError" /> - <filelist> - <file role="php" md5sum="7f552f5a5476a5ef8d180290d7d2a90f" name="OS/Guess.php"/> - <file role="php" md5sum="f257b9252172a6e174b36499296bb972" name="PEAR/Command/Auth.php"/> - <file role="php" md5sum="b0c210a914fb6c25507bfb948ff71bac" name="PEAR/Command/Build.php"/> - <file role="php" md5sum="d90bfb54cf2505747999d8ad1f6c470f" name="PEAR/Command/Common.php"/> - <file role="php" md5sum="303bbf44d112d510dd3a87ea7e55becf" name="PEAR/Command/Config.php"/> - <file role="php" md5sum="6fee5ff129e8846d32e54dd5952c214d" name="PEAR/Command/Install.php"/> - <file role="php" md5sum="3f428a3b9f09eb6f2e5e36dcf8983d1e" name="PEAR/Command/Package.php"/> - <file role="php" md5sum="87a9582c0ba5ec6c9fbaba2d518e33dd" name="PEAR/Command/Registry.php"/> - <file role="php" md5sum="db11793e282f070ad9dcadf2a644aeec" name="PEAR/Command/Remote.php"/> - <file role="php" md5sum="a0f44e37e237f81404c6f73819a58206" name="PEAR/Command/Mirror.php"/> - <file role="php" md5sum="8e310f4f947bf7079778ef0a71fcc5b3" name="PEAR/Frontend/CLI.php"/> - <file role="php" md5sum="3940b7d27d339d72f019b8ab7e8e81b0" name="PEAR/Autoloader.php"/> - <file role="php" md5sum="7fe4074ba2914cea3d17913b96c0088c" name="PEAR/Command.php"/> - <file role="php" md5sum="435431d9bec9802f440845fce49f7b4b" name="PEAR/Common.php"/> - <file role="php" md5sum="cea7df54a1491f7acf6d5290d68cd4ae" name="PEAR/Config.php"/> - <file role="php" md5sum="e807f3abd241e82703725709c6a405c5" name="PEAR/Dependency.php"/> - <file role="php" md5sum="bd1e073d4d42516164fe9da30bad9e75" name="PEAR/Downloader.php"/> - <file role="php" md5sum="3b598325201802e8bb6498ec8c72128e" name="PEAR/Exception.php"/> - <file role="php" md5sum="119d0fc70323e7a01bbc45a74c7840e4" name="PEAR/ErrorStack.php"/> - <file role="php" md5sum="e2588d6c525aa58c0e063678a463138e" name="PEAR/Builder.php"> - <replace from="@PEAR-VER@" to="version" type="package-info"/> - </file> - <file role="php" md5sum="f6e026da8c0c36db331bd4e07f52608f" name="PEAR/Installer.php"/> - <file role="php" md5sum="cf9a5b9cbd6cf1d43bbb6151c77a5b4c" name="PEAR/Packager.php"/> - <file role="php" md5sum="6840ca9ca43e611da23aee935657a67d" name="PEAR/Registry.php"/> - <file role="php" md5sum="a2a46e11af74a5b73cd1095f54ad5e51" name="PEAR/Remote.php"/> - <file role="php" md5sum="342353331db1aff0c29818ff1b51e91c" name="PEAR/RunTest.php"/> - <file role="script" baseinstalldir="/" md5sum="a3bc543b3f7174ab74108449496cad8b" install-as="pear" name="scripts/pear.sh"> - <replace from="/usr/bin/php" to="php_bin" type="pear-config"/> - <replace from="/usr/share/pear" to="php_dir" type="pear-config"/> - <replace from="5.0.4" to="version" type="package-info"/> - <replace from="@include_path@" to="php_dir" type="pear-config"/> - </file> - <file role="script" baseinstalldir="/" md5sum="9ba3c9c4bd09c5dbd18af6dab0dab7b4" platform="windows" install-as="pear.bat" name="scripts/pear.bat"> - <replace from="@bin_dir@" to="bin_dir" type="pear-config"/> - <replace from="/usr/bin/php" to="php_bin" type="pear-config"/> - <replace from="@include_path@" to="php_dir" type="pear-config"/> - </file> - <file role="php" baseinstalldir="/" md5sum="ea4d7860cf26ab30a3f9426f8a7df8c1" install-as="pearcmd.php" name="scripts/pearcmd.php"> - <replace from="/usr/bin/php" to="php_bin" type="pear-config"/> - <replace from="/usr/share/pear" to="php_dir" type="pear-config"/> - <replace from="5.0.4" to="version" type="package-info"/> - <replace from="@include_path@" to="php_dir" type="pear-config"/> - </file> - <file role="data" baseinstalldir="/" md5sum="72ce49e8fe0ec14277d29e15d0f6166f" name="package.dtd"/> - <file role="data" baseinstalldir="/" md5sum="f2abf8db08a36295645d19b51e319a32" name="template.spec"/> - <file role="php" baseinstalldir="/" md5sum="58a98a6d63e1089d7e389bc0249eac36" name="PEAR.php"/> - <file role="php" baseinstalldir="/" md5sum="57012786babadc058fab98c6e6468689" name="System.php"/> - </filelist> - </release> - <changelog> - <release> - <version>1.3.1</version> - <date>2004-04-06</date> - <state>stable</state> - <notes>PEAR Installer: - - * Bug #534 pear search doesn't list unstable releases - * Bug #933 CMD Usability Patch - * Bug #937 throwError() treats every call as static - * Bug #964 PEAR_ERROR_EXCEPTION causes fatal error - * Bug #1008 safe mode raises warning - -PEAR_ErrorStack: - - * Added experimental error handling, designed to eventually replace - PEAR_Error. It should be considered experimental until explicitly marked - stable. require_once 'PEAR/ErrorStack.php' to use. - </notes> - </release> - <release> - <version>1.3.3</version> - <date>2004-10-28</date> - <state>stable</state> - <notes>Installer: - * fix Bug #1186 raise a notice error on PEAR::Common $_packageName - * fix Bug #1249 display the right state when using --force option - * fix Bug #2189 upgrade-all stops if dependancy fails - * fix Bug #1637 The use of interface causes warnings when packaging with PEAR - * fix Bug #1420 Parser bug for T_DOUBLE_COLON - * fix Request #2220 pear5 build fails on dual php4/php5 system - * fix Bug #1163 pear makerpm fails with packages that supply role="doc" - -Other: - * add PEAR_Exception class for PHP5 users - * fix critical problem in package.xml for linux in 1.3.2 - * fix staticPopCallback() in PEAR_ErrorStack - * fix warning in PEAR_Registry for windows 98 users - </notes> - </release> - <release> - <version>1.3.3.1</version> - <date>2004-11-08</date> - <state>stable</state> - <notes>add RunTest.php to package.xml, make run-tests display failed tests, and use ui - </notes> - </release> - <release> - <version>1.3.4</version> - <date>2005-01-01</date> - <state>stable</state> - <notes>* fix a serious problem caused by a bug in all versions of PHP that caused multiple registration - of the shutdown function of PEAR.php -* fix Bug #2861: package.dtd does not define NUMBER -* fix Bug #2946: ini_set warning errors -* fix Bug #3026: Dependency type "ne" is needed, "not" is not handled - properly -* fix Bug #3061: potential warnings in PEAR_Exception -* implement Request #2848: PEAR_ErrorStack logger extends, PEAR_ERRORSTACK_DIE -* implement Request #2914: Dynamic Include Path for run-tests command -* make pear help listing more useful (put how-to-use info at the bottom of the listing) - </notes> - </release> - </changelog> -</package> diff --git a/inc/packages/PHPUnit.xml b/inc/packages/PHPUnit.xml deleted file mode 100644 index 71e736764db310fedc29786e8c81dfac2a37ba50..0000000000000000000000000000000000000000 --- a/inc/packages/PHPUnit.xml +++ /dev/null @@ -1,224 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0"> -<package version="1.0"> - <name>PHPUnit</name> - <summary>Regression testing framework for unit tests.</summary> - <description>PHPUnit is a regression testing framework used by the developer who implements unit tests in PHP. This is the version to be used with PHP 4.</description> - <maintainers> - <maintainer> - <user>sebastian</user> - <name>Sebastian Bergmann</name> - <email>sb@sebastian-bergmann.de</email> - <role>lead</role> - </maintainer> - </maintainers> - <release> - <version>1.2.3</version> - <date>2005-05-14</date> - <license>PHP License</license> - <state>stable</state> - <notes>Fixed bug #4342.</notes> - <filelist> - <file role="php" baseinstalldir="/" md5sum="5488043b7a6387fddd81e17a21f830ef" name="PHPUnit.php"/> - <file role="php" md5sum="5851a03772edcb21eb6fe5b45190da20" name="PHPUnit/GUI/Gtk.php"/> - <file role="php" md5sum="fa838ef5db2b541c6491164c3ea47077" name="PHPUnit/GUI/HTML.php"/> - <file role="php" md5sum="222a8fef6537f8fb1653f68f1b1d6a28" name="PHPUnit/GUI/HTML.tpl"/> - <file role="php" md5sum="8f82a97cc65ff80dced33a75fca0bc3d" name="PHPUnit/GUI/SetupDecorator.php"/> - <file role="php" md5sum="23c0b3e2ecb4195e149c7a7b0e575cdf" name="PHPUnit/Assert.php"/> - <file role="php" md5sum="e21e528ba2fdbf0f1e8b04cd36c477f0" name="PHPUnit/RepeatedTest.php"/> - <file role="php" md5sum="2a425b3f6e42680e0926627d17413d59" name="PHPUnit/Skeleton.php"/> - <file role="php" md5sum="7cc66f04974a60461bfb1ef03b2d23c4" name="PHPUnit/TestCase.php"/> - <file role="php" md5sum="061dcb2cfc8ef9b17ac09032906e8beb" name="PHPUnit/TestDecorator.php"/> - <file role="php" md5sum="74e1f1d35ff640598182ff86bed75142" name="PHPUnit/TestFailure.php"/> - <file role="php" md5sum="e334f9dbad5478edb6da17714b9fa3ab" name="PHPUnit/TestListener.php"/> - <file role="php" md5sum="9ca95d9252f8395def72fc3a9c68e73e" name="PHPUnit/TestResult.php"/> - <file role="php" md5sum="20fccede54695a140ebad7f7289cb465" name="PHPUnit/TestSuite.php"/> - </filelist> - </release> - <changelog> - <release> - <version>1.2.2</version> - <date>2005-01-31</date> - <state>stable</state> - <notes>* Fixed bug #3332. - - -</notes> - </release> - <release> - <version>1.2.1</version> - <date>2005-01-28</date> - <state>stable</state> - <notes>* Relaxed PHPUnit_Assert::assertNotNull() and PHPUnit_Assert::assertNull() to work on non-objects. - -* Fixed an issue in PHPUnit_GUI_SetupDecorator related to Windows' directory separators. (Patch by Lorenzo Alberton <l.alberton@quipo.it>) - - -</notes> - </release> - <release> - <version>1.2.0</version> - <date>2005-01-19</date> - <state>stable</state> - <notes>+ Added Gtk-based frontend. (Patch by Scott Mattocks <scott@crisscott.com>) - -+ Re-Added PHPUnit_Assert::assertSame() and PHPUnit_Assert::assertNotSame() to make the PEAR QA team happy. These methods only work with PHP >= 5.0.0. - -* PHPUnit_Assert::assertSame(), PHPUnit_Assert::assertNotSame(), PHPUnit_Assert::assertNotNull(), and PHPUnit_Assert::assertNull() are now stricter than before and only work on objects. This was always the documented behaviour. - -* Fixed a bug in the PHPUnit_GUI_SetupDecorator::_getFiles() method. (Patch by Michael Schmidt <michael.schmidt@object-it.de>) - -* Fixed bug #3127: PHPUnit_GUI_HTML and $_REQUEST. (Patch by cricket@djcricket.com) - - -</notes> - </release> - <release> - <version>1.1.1</version> - <date>2004-11-05</date> - <state>stable</state> - <notes>* Fixed bug #2701. - - -</notes> - </release> - <release> - <version>1.1.0</version> - <date>2004-09-29</date> - <state>stable</state> - <notes>+ Added PHPUnit_Skeleton class for creating a PHPUnit_TestCase skeleton file. (Patch by Scott Mattocks <scott@crisscott.com>) - -+ Added PHPUnit_Assert::assertContains() and PHPUnit_Assert::assertNotContains() methods to assert that an array contains (or not contains) a given value or that a string contains (or not contains) a given substring. - -+ Added PHPUnit_Assert::assertNotRegexp() to assert that a string does not match a given regular expression. - -- Removed PHPUnit_Assert::assertSame() and PHPUnit_Assert::assertNotSame() since these assertion methods do not work with PHP 4. - - -</notes> - </release> - <release> - <version>1.0.2</version> - <date>2004-09-21</date> - <state>stable</state> - <notes>* Added/fixed phpDocumentor code documentation. - - -</notes> - </release> - <release> - <version>1.0.1</version> - <date>2004-04-17</date> - <state>stable</state> - <notes>* Fixed a bug that let the HTML GUI fail for expected and/or actual results with newline characters. (Patch by Thiemo Maettig <thiemo.maettig@gmx.de>) - -* Fixed bug #1169. - - -</notes> - </release> - <release> - <version>1.0.0</version> - <date>2004-03-15</date> - <state>stable</state> - <notes>* No functional changes since PHPUnit-0.6.2. - - -</notes> - </release> - <release> - <version>0.6.2</version> - <date>2003-06-21</date> - <notes>* Fixed PHPUnit_Assert::assertType(). - - -</notes> - </release> - <release> - <version>0.6.1</version> - <date>2003-05-15</date> - <notes>+ Added assertType() assertion method. - -* Fixed parse error in GUI/HTML.php that occured with PHP 5. - -* Fixed a layout issue in the HTML GUI. - - -</notes> - </release> - <release> - <version>0.6</version> - <date>2003-04-25</date> - <notes>* Fixed bug that caused the constructor detection in PHPUnit_TestSuite to fail with upper-case class names. - -* Fixed bug with multiple assertions per Test Case. - -* call_user_func() was called with a copy instead of a reference in PHPUnit_TestCase::runTest(). - -* Assertion methods append the generated actual/expected message to a user-defined message, rather than overwriting it. - -* Constructors are now excluded from automatic TestCase creation in TestSuite::addTestSuite(). (Patch by Wolfram Kriesing <wolfram@kriesing.de>.) - -* serialize() was called twice in PHPUnit_Assert::assertEquals(). - - -</notes> - </release> - <release> - <version>0.5</version> - <date>2003-03-26</date> - <notes>+ Added new HTML GUI. (Patch by Wolfram Kriesing <wolfram@kriesing.de>.) - -+ Added "loosely typed" mode to assertEquals() that can be turned on/off using setLooselyTyped(). When activated, array elements are cast to strings before comparison. - -* Allow multiple assertions per Test Case. - -* Use call_user_func() instead of $object->$method(). - - -</notes> - </release> - <release> - <version>0.4</version> - <date>2002-09-25</date> - <notes>+ Added PHPUnit_Assert::assertFalse() and PHPUnit_Assert::assertNotSame(). JUnit introduced those two convenience methods in the JUnit 3.8 release. - -* Fixed directory structure. - - -</notes> - </release> - <release> - <version>0.3</version> - <date>2002-07-12</date> - <notes>* Added PHPUnit_TestDecorator and PHPUnit_RepeatedTest. - -* Implemented PHPUnit_TestResult::addListener() and PHPUnit_TestResult::removeListener(). - -* Added object support to PHPUnit_Assert::assertEquals(). - -* Implemented PHPUnit_Assert::assertSame() using Zend Engine 2 object handles. - - -</notes> - </release> - <release> - <version>0.2</version> - <date>2002-07-11</date> - <notes>* Added Array support to PHPUnit_Assert::equals(). (Patch by Wolfram Kriesing <wolfram@kriesing.de>) - -* Added PHPUnit_Assert::assertRegExp(). (Patch by M@rms <marms@marms.com>) - - -</notes> - </release> - <release> - <version>0.1</version> - <date>2002-04-06</date> - <notes>First release. - - -</notes> - </release> - </changelog> -</package> diff --git a/inc/packages/XML_Parser.xml b/inc/packages/XML_Parser.xml deleted file mode 100644 index 9b4b0269faf8e11afa63cef7bee9e8d8aa4c6fce..0000000000000000000000000000000000000000 --- a/inc/packages/XML_Parser.xml +++ /dev/null @@ -1,254 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0"> -<package version="1.0" packagerversion="1.4.0a9"> - <name>XML_Parser</name> - <summary>XML parsing class based on PHP's bundled expat</summary> - <description>This is an XML parser based on PHPs built-in xml extension. -It supports two basic modes of operation: "func" and "event". In "func" mode, it will look for a function named after each element (xmltag_ELEMENT for start tags and xmltag_ELEMENT_ for end tags), and in "event" mode it uses a set of generic callbacks. - -Since version 1.2.0 there's a new XML_Parser_Simple class that makes parsing of most XML documents easier, by automatically providing a stack for the elements. -Furthermore its now possible to split the parser from the handler object, so you do not have to extend XML_Parser anymore in order to parse a document with it. - </description> - <maintainers> - <maintainer> - <user>schst</user> - <name>Stephan Schmidt</name> - <email>schst@php-tools.net</email> - <role>lead</role> - </maintainer> - <maintainer> - <user>ssb</user> - <name>Stig S&#230;ther Bakken</name> - <email>stig@php.net</email> - <role>developer</role> - </maintainer> - <maintainer> - <user>cox</user> - <name>Tomas V.V.Cox</name> - <email>cox@php.net</email> - <role>developer</role> - </maintainer> - </maintainers> - <release> - <version>1.2.6</version> - <date>2005-03-25</date> - <license>PHP License</license> - <state>stable</state> - <notes>- fixed Bug #3949: reset does not return true on success as the documentation states -- implement Request #3905: replace "." with "_" in tagnames when using func mode -- added package2.xml file for PEAR 1.4.0 - </notes> - <deps> - <dep type="php" rel="ge" version="4.2.0" optional="no"/> - <dep type="pkg" rel="has" optional="no">PEAR</dep> - </deps> - <filelist> - <file role="doc" baseinstalldir="XML" name="examples/xml_parser_file.php"/> - <file role="doc" baseinstalldir="XML" name="examples/xml_parser_file.xml"/> - <file role="doc" baseinstalldir="XML" name="examples/xml_parser_handler.php"/> - <file role="doc" baseinstalldir="XML" name="examples/xml_parser_simple1.php"/> - <file role="doc" baseinstalldir="XML" name="examples/xml_parser_simple1.xml"/> - <file role="doc" baseinstalldir="XML" name="examples/xml_parser_simple2.php"/> - <file role="doc" baseinstalldir="XML" name="examples/xml_parser_simple2.xml"/> - <file role="doc" baseinstalldir="XML" name="examples/xml_parser_simple_handler.php"/> - <file role="php" baseinstalldir="XML" name="Parser/Simple.php"/> - <file role="test" baseinstalldir="XML" name="tests/001.phpt"/> - <file role="test" baseinstalldir="XML" name="tests/002.phpt"/> - <file role="test" baseinstalldir="XML" name="tests/003.phpt"/> - <file role="test" baseinstalldir="XML" name="tests/004.phpt"/> - <file role="test" baseinstalldir="XML" name="tests/005.phpt"/> - <file role="test" baseinstalldir="XML" name="tests/test2.xml"/> - <file role="test" baseinstalldir="XML" name="tests/test3.xml"/> - <file role="php" baseinstalldir="XML" name="Parser.php"/> - </filelist> - </release> - <changelog> - <release> - <version>1.1.0beta1</version> - <date>2004-04-16</date> - <license>PHP License</license> - <state>beta</state> - <notes>- Fixed memory leaks parsing many documents or big files (mroch) -- Fixed setInput() url detection regex (mroch) -- Added setInputString() method, allowing strings to be passed as input (schst) -- Error handling rewritten (cox) -- Increased the overall parsing speed (cox) -- Added free() method (schst -- Added reset() method, that is called when parsing a document so it is possible to parse more than one document per instance (schst) -- Added error codes (schst) -- revamped documentation (cox, schst) -- Fixed bug #516 (url fopen and safe mode) (schst) -- Fixed bug #637 (dependency on PEAR) (schst) -- improved parse() and parseString() to be able to parse more than one document (schst) -- added PHP5 constructor (schst) -- moved xml_parser_create() to _create() for PHP5 compatibility (schst) -- added dependency on PHP 4.2 - -Thanks to Marshall Roch for commments and contributions and Tomas V.V. Cox -for applying a lot of fixes and improvements. - </notes> - </release> - <release> - <version>1.1.0beta2</version> - <date>2004-04-18</date> - <license>PHP License</license> - <state>beta</state> - <notes>beta2: -- Fixed calling of __construct - -beta1: -- Fixed memory leaks parsing many documents or big files (mroch) -- Fixed setInput() url detection regex (mroch) -- Added setInputString() method, allowing strings to be passed as input (schst) -- Error handling rewritten (cox) -- Increased the overall parsing speed (cox) -- Added free() method (schst -- Added reset() method, that is called when parsing a document so it is possible to parse more than one document per instance (schst) -- Added error codes (schst) -- revamped documentation (cox, schst) -- Fixed bug #516 (url fopen and safe mode) (schst) -- Fixed bug #637 (dependency on PEAR) (schst) -- improved parse() and parseString() to be able to parse more than one document (schst) -- added PHP5 constructor (schst) -- moved xml_parser_create() to _create() for PHP5 compatibility (schst) -- added dependency on PHP 4.2 - -Thanks to Marshall Roch for commments and contributions and Tomas V.V. Cox -for applying a lot of fixes and improvements. - </notes> - </release> - <release> - <version>1.1.0</version> - <date>2004-04-23</date> - <license>PHP License</license> - <state>stable</state> - <notes>- Fixed memory leaks parsing many documents or big files (mroch) -- Fixed setInput() url detection regex (mroch) -- Added setInputString() method, allowing strings to be passed as input (schst) -- Error handling rewritten (cox) -- Increased the overall parsing speed (cox) -- Added free() method (schst -- Added reset() method, that is called when parsing a document so it is possible to parse more than one document per instance (schst) -- Added error codes (schst) -- revamped documentation (cox, schst) -- Fixed bug #516 (url fopen and safe mode) (schst) -- Fixed bug #637 (dependency on PEAR) (schst) -- improved parse() and parseString() to be able to parse more than one document (schst) -- added PHP5 constructor (schst) -- moved xml_parser_create() to _create() for PHP5 compatibility (schst) -- added dependency on PHP 4.2 - -Thanks to Marshall Roch for commments and contributions and Tomas V.V. Cox -for applying a lot of fixes and improvements. - </notes> - </release> - <release> - <version>1.2.0beta1</version> - <date>2004-05-17</date> - <license>PHP License</license> - <state>beta</state> - <notes>added new class XML_Parser_Simple that provides a stack for the elements so the user only needs to implement one method to handle the tag and cdata. - </notes> - </release> - <release> - <version>1.2.0beta2</version> - <date>2004-05-24</date> - <license>PHP License</license> - <state>beta</state> - <notes>XML_Parser: -- fixed bug with setMode() -- moved the init routines for the handlers in _initHandlers() -XML_Parser_Simple: -- fixed bug with character data (did not get parsed) -- fixed bug with setMode() -- some refactoring -- added getCurrentDepth() to retrieve the tag depth -- added addToData() -- added new example - </notes> - </release> - <release> - <version>1.2.0beta3</version> - <date>2004-05-25</date> - <license>PHP License</license> - <state>beta</state> - <notes>- added setHandlerObj() which allows you to have the parser separate from the handler methods - </notes> - </release> - <release> - <version>1.2.0</version> - <date>2004-05-28</date> - <license>PHP License</license> - <state>stable</state> - <notes>- added setHandlerObj() which allows you to have the parser separate from the handler methods -- fixed bug with setMode() -- moved the init routines for the handlers in _initHandlers() -- added new examples -- fixed test files so they do not fail because of different resource ids -XML_Parser_Simple: -- added new class XML_Parser_Simple that provides a stack for the elements so the user only needs to implement one method to handle the tag and cdata. - </notes> - </release> - <release> - <version>1.2.1</version> - <date>2004-10-04</date> - <license>PHP License</license> - <state>stable</state> - <notes>fixed bug #2442: Call to "xmltag_ELEMENT_" not correctly managed in function funcEndHandler - </notes> - </release> - <release> - <version>1.2.2beta1</version> - <date>2004-12-22</date> - <license>PHP License</license> - <state>beta</state> - <notes>- fixed small notice in XML_Parser::free(), -- fixed Bug #2939: bug in error routine leads to segmentation fault (raiseError does not free the internal resources anymore) - </notes> - </release> - <release> - <version>1.2.2</version> - <date>2004-12-22</date> - <license>PHP License</license> - <state>stable</state> - <notes>- fixed small notice in XML_Parser::free(), -- fixed Bug #2939: bug in error routine leads to segmentation fault (raiseError does not free the internal resources anymore) - </notes> - </release> - <release> - <version>1.2.3</version> - <date>2005-01-17</date> - <license>PHP License</license> - <state>stable</state> - <notes>- fixed a bug that occured when using 'func' mode and setHandlerObj() (schst) -- added default handlers for 'func' mode (schst) - </notes> - </release> - <release> - <version>1.2.4</version> - <date>2005-01-18</date> - <license>PHP License</license> - <state>stable</state> - <notes>- fixed a bug in XML_Parser_Simple when trying to register more than the default handlers and a separate callback object (schst) - </notes> - </release> - <release> - <version>1.2.5</version> - <date>2005-02-26</date> - <license>PHP License</license> - <state>stable</state> - <notes>- fixed Bug #3557 (removed $attribs parameter, which caused a notice) -- fixed Bug #3277 (remove obsolete ini_set('allow_url_fopen')) - </notes> - </release> - <release> - <version>1.2.6</version> - <date>2005-03-25</date> - <license>PHP License</license> - <state>stable</state> - <notes>- fixed Bug #3949: reset does not return true on success as the documentation states -- implement Request #3905: replace "." with "_" in tagnames when using func mode - </notes> - </release> - </changelog> -</package> diff --git a/inc/packages/XML_RPC.xml b/inc/packages/XML_RPC.xml deleted file mode 100644 index 44e948826477ae4fb4d99a620239944512b08533..0000000000000000000000000000000000000000 --- a/inc/packages/XML_RPC.xml +++ /dev/null @@ -1,266 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0"> -<package version="1.0" packagerversion="1.4.0a12"> - <name>XML_RPC</name> - <summary>PHP implementation of the XML-RPC protocol</summary> - <description>A PEAR-ified version of Useful Inc's XML-RPC for PHP. - -It has support for HTTP/HTTPS transport, proxies and authentication. - </description> - <maintainers> - <maintainer> - <user>ssb</user> - <name>Stig Bakken</name> - <email>stig@php.net</email> - <role>lead</role> - </maintainer> - <maintainer> - <user>danielc</user> - <name>Daniel Convissor</name> - <email>danielc@php.net</email> - <role>lead</role> - </maintainer> - </maintainers> - <release> - <version>1.4.0</version> - <date>2005-08-14</date> - <license>PHP License</license> - <state>stable</state> - <notes>* MAJOR SECURITY FIX: eliminate use of eval(). -* Using socket_get_status() because stream_get_meta_data() was introduced in 4.3.0, but we need to support 4.2.0. Bug 4805. - </notes> - <filelist> - <file role="php" baseinstalldir="XML" name="RPC.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" baseinstalldir="XML/RPC" name="Server.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="php" baseinstalldir="XML/RPC" name="Dump.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="test" name="tests/protoport.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - <file role="test" name="tests/test_Dump.php"> - <replace from="@package_version@" to="version" type="package-info"/> - </file> - </filelist> - </release> - <changelog> - <release> - <version>1.3.3</version> - <date>2005-07-15</date> - <state>stable</state> - <notes>* Eliminate memory leak by resetting $XML_RPC_xh each time parseResponse() is called. Bug 4780. -* Using socket_set_timeout() because stream_set_timeout() was introduced in 4.3.0, but we need to support 4.2.0. Bug 4805. - </notes> - </release> - <release> - <version>1.3.2</version> - <date>2005-07-07</date> - <state>stable</state> - <notes>* Eliminate path disclosure vulnerabilities by suppressing error messages when eval()'ing. -* Eliminate path disclosure vulnerability by catching bogus parameters submitted to XML_RPC_Value::serializeval(). -* In XML_RPC_Server::service(), only call createServerPayload() and createServerHeaders() if necessary. Fixes compatibility issue introduced in Release 1.3.0RC1 for users who set the $serviceNow parameter of XML_RPC_Server() to 0. Bug 4757. -* Change "var $errstring" to "var $errstr". Bug 4582. Was put into CVS version 1.75 of RPC.php but didn't make it into RELEASE_1_3_1. - </notes> - </release> - <release> - <version>1.3.1</version> - <date>2005-06-29</date> - <state>stable</state> - <notes>* Security fix. Update highly recommended! - </notes> - </release> - <release> - <version>1.3.0</version> - <date>2005-06-13</date> - <state>stable</state> - <notes>* Stable release. See earlier releases for changes since 1.2.2. - </notes> - </release> - <release> - <version>1.3.0RC3</version> - <date>2005-05-10</date> - <state>beta</state> - <notes>* When verifying requests against function signatures, if the number of parameters don't match, provide an appropriate message. NOTE: this resolves a path disclosure vulnerability. (Refines the changes made in the last commit.) Bug 4231. -* XML_RPC_Message::getParam() now returns an XML_RPC_Response object upon error. Changed from Release 1.3.0RC2. -* Add the XML_RPC_Value::isValue() method. For testing if an item is an XML_RPC_Value object. -* If XML_RPC_Client::send() is given an incorrect $msg parameter, raise an error with the new XML_RPC_ERROR_PROGRAMMING code and return 0. -* Improve cross-platform operation by using PEAR::loadExtension() instead of dl(). -* Use <br /> instead of <br> in XML_RPC_Value::dump(). - </notes> - </release> - <release> - <version>1.3.0RC2</version> - <date>2005-05-05</date> - <state>beta</state> - <notes>* If XML_RPC_Message::getParam() is given an incorrect parameter, raise an error with the new XML_RPC_ERROR_INCORRECT_PARAMS code and return FALSE. -* Handle improper requests to XML_RPC_Server::verifySignature(). Bug 4231. -* Try to allow HTTP 100 responses if followed by a 200 response. Bug 4116. -* Help Delphi users by making RPCMETHODNAME an alias for METHODNAME. Request 4205. - </notes> - </release> - <release> - <version>1.3.0RC1</version> - <date>2005-04-07</date> - <state>beta</state> - <notes>* Improve timeout handling for situations where connection to server is made but no response is not received in time. Accomplished via stream_set_timeout(). Request 3963. -* Add Fault Code 6: "The requested method didn't return an XML_RPC_Response object." Request 4032. -* Add the createServerPayload() and createServerHeaders() methods and the $server_payload and $server_headers properties. Request 3121. -* As in earlier versions, if the $serviceNow parameter to XML_RPC_Server() is 0, no data will be returned, but now the new $server_payload and $server_headers properties will be set. -* Convert the parser handle to an integer before using it as an index for $XML_RPC_xh[$parser]. Reduces E_STRICT notices. Bug 3782. -* Add createHeaders() method and $headers property to XML_RPC_Client to make testing easier. - </notes> - </release> - <release> - <version>1.2.2</version> - <date>2005-03-07</date> - <state>stable</state> - <notes>* When using a proxy, add the protocol to the Request-URI, making it an "absoluteURI" as per the HTTP 1.0 spec. Bug 3679. - </notes> - </release> - <release> - <version>1.2.1</version> - <date>2005-03-01</date> - <state>stable</state> - <notes>* Add isset() check before examining the dispatch map. Bug 3658. - </notes> - </release> - <release> - <version>1.2.0</version> - <date>2005-02-27</date> - <state>stable</state> - <notes>* Provide the "stable" release. -* Add package2.xml for compatibility with PEAR 1.4.0. -* For changes since 1.1.0, see the changelogs for the various RC releases. - </notes> - </release> - <release> - <version>1.2.0RC7</version> - <date>2005-02-22</date> - <state>beta</state> - <notes>* Add the setSendEncoding() method and $send_encoding - property to XML_RPC_Message. Request 3537. -* Allow class methods to be mapped using either syntax: - 'function' => 'hello::sayHello', - or - 'function' => array('hello', 'sayhello'), - Bug 3363. -* Use 8192 instead of 32768 for bytes in fread() - in parseResponseFile(). Bug 3340. - </notes> - </release> - <release> - <version>1.2.0RC6</version> - <date>2005-01-25</date> - <state>beta</state> - <notes>* Don't put the protocol in the Host field of the POST data. (danielc) - </notes> - </release> - <release> - <version>1.2.0RC5</version> - <date>2005-01-24</date> - <state>beta</state> - <notes>* If $port is 443 but a protocol isn't specified in $server, assume ssl:// is the protocol. - </notes> - </release> - <release> - <version>1.2.0RC4</version> - <date>2005-01-24</date> - <state>beta</state> - <notes>* When a connection attempt fails, have the method return 0. (danielc) -* Move the protocol/port checking/switching and the property settings from sendPayloadHTTP10() to the XML_RPC_Client constructor. (danielc) -* Add tests for setting the client properties. (danielc) -* Remove $GLOBALS['XML_RPC_twoslash'] since it's not used. (danielc) -* Bundle the tests with the package. (danielc) - </notes> - </release> - <release> - <version>1.2.0RC3</version> - <date>2005-01-19</date> - <state>beta</state> - <notes>* ssl uses port 443, not 445. - </notes> - </release> - <release> - <version>1.2.0RC2</version> - <date>2005-01-11</date> - <state>beta</state> - <notes>* Handle ssl:// in the $server string. (danielc) -* Also default to port 445 for ssl:// requests as well. (danielc) -* Enhance debugging in the server. (danielc) - </notes> - </release> - <release> - <version>1.2.0RC1</version> - <date>2004-12-30</date> - <state>beta</state> - <notes>* Make things work with SSL. Bug 2489. (nkukard lbsd net) -* Allow array function callbacks (Matt Kane) -* Some minor speed-ups (Matt Kane) -* Add Dump.php to the package (Christian Weiske) -* Replace all line endings with \r\n. Had only done replacements on \n. Bug 2521. (danielc) -* Silence fsockopen() errors. Bug 1714. (danielc) -* Encode empty arrays as an array. Bug 1493. (danielc) -* Eliminate undefined index notice when submitting empty arrays to XML_RPC_Encode(). Bug 1819. (danielc) -* Speed up check for enumerated arrays in XML_RPC_Encode(). (danielc) -* Prepend "XML_RPC_" to ERROR_NON_NUMERIC_FOUND, eliminating problem when eval()'ing error messages. (danielc) -* Use XML_RPC_Base::raiseError() instead of PEAR::raiseError() in XML_RPC_ee() because PEAR.php is lazy loaded. (danielc) -* Allow raiseError() to be called statically. (danielc) -* Stop double escaping of character entities. Bug 987. (danielc) - NOTICE: the following have been removed: - * XML_RPC_dh() - * $GLOBALS['XML_RPC_entities'] - * XML_RPC_entity_decode() - * XML_RPC_lookup_entity() -* Determine the XML's encoding via the encoding attribute in the XML declaration. Bug 52. (danielc) - </notes> - </release> - <release> - <version>1.1.0</version> - <date>2004-03-15</date> - <state>stable</state> - <notes>* Added support for sequential arrays to XML_RPC_encode() (mroch) -* Cleaned up new XML_RPC_encode() changes a bit (mroch, pierre) -* Remove "require_once 'PEAR.php'", include only when needed to raise an error -* Replace echo and error_log() with raiseError() (mroch) -* Make all classes extend XML_RPC_Base, which will handle common functions (mroch) -* be tolerant of junk after methodResponse (Luca Mariano, mroch) -* Silent notice even in the error log (pierre) -* fix include of shared xml extension on win32 (pierre) - </notes> - </release> - <release> - <version>1.0.4</version> - <date>2002-10-02</date> - <state>stable</state> - <notes>* added HTTP proxy authorization support (thanks to Arnaud Limbourg) - </notes> - </release> - <release> - <version>1.0.3</version> - <date>2002-05-19</date> - <state>stable</state> - <notes>* fix bug when parsing responses with boolean types - </notes> - </release> - <release> - <version>1.0.2</version> - <date>2002-04-16</date> - <state>stable</state> - <notes>* E_ALL fixes -* fix HTTP response header parsing - </notes> - </release> - <release> - <version>1.0.1</version> - <date>2001-09-25</date> - <state>stable</state> - <notes>This is a PEAR-ified version of Useful Inc's 1.0.1 release. -Includes an urgent security fix identified by Dan Libby <dan@libby.com>. - </notes> - </release> - </changelog> -</package> diff --git a/inc/pearcmd.php b/inc/pearcmd.php deleted file mode 100644 index 28a81dcf67f7ca46b3dc95c55289f62d8d104cb2..0000000000000000000000000000000000000000 --- a/inc/pearcmd.php +++ /dev/null @@ -1,318 +0,0 @@ -<?php -// -// +----------------------------------------------------------------------+ -// | PHP Version 5 | -// +----------------------------------------------------------------------+ -// | Copyright (c) 1997-2004 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. | -// +----------------------------------------------------------------------+ -// | Authors: Stig Bakken <ssb@php.net> | -// | Tomas V.V.Cox <cox@idecnet.com> | -// | | -// +----------------------------------------------------------------------+ -// -// $Id: pearcmd.php,v 1.13.2.2 2004/12/30 05:43:18 cellog Exp $ - -ob_end_clean(); -/** - * @nodep Gtk - */ -if ('@include_path@' != '@'.'include_path'.'@') { - ini_set('include_path', '@include_path@'); -} -ini_set('allow_url_fopen', true); -if (!ini_get('safe_mode')) { - @set_time_limit(0); -} -ob_implicit_flush(true); -ini_set('track_errors', true); -ini_set('html_errors', false); -ini_set('magic_quotes_runtime', false); -set_error_handler('error_handler'); - -$pear_package_version = "5.0.4"; - -require_once 'PEAR.php'; -require_once 'PEAR/Config.php'; -require_once 'PEAR/Command.php'; -require_once 'Console/Getopt.php'; - -PEAR_Command::setFrontendType('CLI'); -$all_commands = PEAR_Command::getCommands(); - -$argv = Console_Getopt::readPHPArgv(); -/* $progname = basename($argv[0]); */ -$progname = 'pear'; -if (in_array('getopt2', get_class_methods('Console_Getopt'))) { - array_shift($argv); - $options = Console_Getopt::getopt2($argv, "c:C:d:D:Gh?sSqu:vV"); -} else { - $options = Console_Getopt::getopt($argv, "c:C:d:D:Gh?sSqu:vV"); -} -if (PEAR::isError($options)) { - usage($options); -} - -$opts = $options[0]; - -$fetype = 'CLI'; -if ($progname == 'gpear' || $progname == 'pear-gtk') { - $fetype = 'Gtk'; -} else { - foreach ($opts as $opt) { - if ($opt[0] == 'G') { - $fetype = 'Gtk'; - } - } -} -PEAR_Command::setFrontendType($fetype); -$ui = &PEAR_Command::getFrontendObject(); -PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($ui, "displayFatalError")); -if (ini_get('safe_mode')) { - $ui->outputData('WARNING: running in safe mode requires that all files created ' . - 'be the same uid as the current script. PHP reports this script is uid: ' . - @getmyuid() . ', and current user is: ' . @get_current_user()); -} - -$pear_user_config = ''; -$pear_system_config = ''; -$store_user_config = false; -$store_system_config = false; -$verbose = 1; - -foreach ($opts as $opt) { - switch ($opt[0]) { - case 'c': - $pear_user_config = $opt[1]; - break; - case 'C': - $pear_system_config = $opt[1]; - break; - } -} - -$config = &PEAR_Config::singleton($pear_user_config, $pear_system_config); -$verbose = $config->get("verbose"); -$cmdopts = array(); - -foreach ($opts as $opt) { - $param = !empty($opt[1]) ? $opt[1] : true; - switch ($opt[0]) { - case 'd': - list($key, $value) = explode('=', $param); - $config->set($key, $value, 'user'); - break; - case 'D': - list($key, $value) = explode('=', $param); - $config->set($key, $value, 'system'); - break; - case 's': - $store_user_config = true; - break; - case 'S': - $store_system_config = true; - break; - case 'u': - $config->remove($param, 'user'); - break; - case 'v': - $config->set('verbose', $config->get('verbose') + 1); - break; - case 'q': - $config->set('verbose', $config->get('verbose') - 1); - break; - case 'V': - usage(null, 'version'); - default: - // all non pear params goes to the command - $cmdopts[$opt[0]] = $param; - break; - } -} - -if ($store_system_config) { - $config->store('system'); -} - -if ($store_user_config) { - $config->store('user'); -} - -$command = (isset($options[1][0])) ? $options[1][0] : null; - -if (empty($command) && ($store_user_config || $store_system_config)) { - exit; -} - -if ($fetype == 'Gtk') { - Gtk::main(); -} else do { - if ($command == 'help') { - usage(null, @$options[1][1]); - } - - PEAR::pushErrorHandling(PEAR_ERROR_RETURN); - $cmd = PEAR_Command::factory($command, $config); - PEAR::popErrorHandling(); - if (PEAR::isError($cmd)) { - usage(null, @$options[1][1]); - } - - $short_args = $long_args = null; - PEAR_Command::getGetoptArgs($command, $short_args, $long_args); - if (in_array('getopt2', get_class_methods('Console_Getopt'))) { - array_shift($options[1]); - $tmp = Console_Getopt::getopt2($options[1], $short_args, $long_args); - } else { - $tmp = Console_Getopt::getopt($options[1], $short_args, $long_args); - } - if (PEAR::isError($tmp)) { - break; - } - list($tmpopt, $params) = $tmp; - $opts = array(); - foreach ($tmpopt as $foo => $tmp2) { - list($opt, $value) = $tmp2; - if ($value === null) { - $value = true; // options without args - } - if (strlen($opt) == 1) { - $cmdoptions = $cmd->getOptions($command); - foreach ($cmdoptions as $o => $d) { - if (@$d['shortopt'] == $opt) { - $opts[$o] = $value; - } - } - } else { - if (substr($opt, 0, 2) == '--') { - $opts[substr($opt, 2)] = $value; - } - } - } - $ok = $cmd->run($command, $opts, $params); - if ($ok === false) { - PEAR::raiseError("unknown command `$command'"); - } -} while (false); - -// {{{ usage() - -function usage($error = null, $helpsubject = null) -{ - global $progname, $all_commands; - $stderr = fopen('php://stderr', 'w'); - if (PEAR::isError($error)) { - fputs($stderr, $error->getMessage() . "\n"); - } elseif ($error !== null) { - fputs($stderr, "$error\n"); - } - if ($helpsubject != null) { - $put = cmdHelp($helpsubject); - } else { - $put = - "Commands:\n"; - $maxlen = max(array_map("strlen", $all_commands)); - $formatstr = "%-{$maxlen}s %s\n"; - ksort($all_commands); - foreach ($all_commands as $cmd => $class) { - $put .= sprintf($formatstr, $cmd, PEAR_Command::getDescription($cmd)); - } - $put .= - "Usage: $progname [options] command [command-options] <parameters>\n". - "Type \"$progname help options\" to list all options.\n". - "Type \"$progname help shortcuts\" to list all command shortcuts.\n". - "Type \"$progname help <command>\" to get the help for the specified command."; - } - fputs($stderr, "$put\n"); - fclose($stderr); - exit; -} - -function cmdHelp($command) -{ - global $progname, $all_commands, $config; - if ($command == "options") { - return - "Options:\n". - " -v increase verbosity level (default 1)\n". - " -q be quiet, decrease verbosity level\n". - " -c file find user configuration in `file'\n". - " -C file find system configuration in `file'\n". - " -d foo=bar set user config variable `foo' to `bar'\n". - " -D foo=bar set system config variable `foo' to `bar'\n". - " -G start in graphical (Gtk) mode\n". - " -s store user configuration\n". - " -S store system configuration\n". - " -u foo unset `foo' in the user configuration\n". - " -h, -? display help/usage (this message)\n". - " -V version information\n"; - } elseif ($command == "shortcuts") { - $sc = PEAR_Command::getShortcuts(); - $ret = "Shortcuts:\n"; - foreach ($sc as $s => $c) { - $ret .= sprintf(" %-8s %s\n", $s, $c); - } - return $ret; - - } elseif ($command == "version") { - return "PEAR Version: ".$GLOBALS['pear_package_version']. - "\nPHP Version: ".phpversion(). - "\nZend Engine Version: ".zend_version(). - "\nRunning on: ".php_uname(); - - } elseif ($help = PEAR_Command::getHelp($command)) { - if (is_string($help)) { - return "$progname $command [options] $help\n"; - } - if ($help[1] === null) { - return "$progname $command $help[0]"; - } else { - return "$progname $command [options] $help[0]\n$help[1]"; - } - } - return "Command '$command' is not valid, try 'pear help'"; -} - -// }}} - -function error_handler($errno, $errmsg, $file, $line, $vars) { - if ((defined('E_STRICT') && $errno & E_STRICT) || !error_reporting()) { - return; // @silenced error - } - $errortype = array ( - E_ERROR => "Error", - E_WARNING => "Warning", - E_PARSE => "Parsing Error", - E_NOTICE => "Notice", - E_CORE_ERROR => "Core Error", - E_CORE_WARNING => "Core Warning", - E_COMPILE_ERROR => "Compile Error", - E_COMPILE_WARNING => "Compile Warning", - E_USER_ERROR => "User Error", - E_USER_WARNING => "User Warning", - E_USER_NOTICE => "User Notice" - ); - $prefix = $errortype[$errno]; - $file = basename($file); - print "\n$prefix: $errmsg in $file on line $line\n"; -} - - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * indent-tabs-mode: nil - * mode: php - * End: - */ -// vim600:syn=php - -?> diff --git a/inc/templates/adminform.php b/inc/templates/adminform.php deleted file mode 100644 index 5a04c4902ac8c411bc12ed199079cdfbfaad2958..0000000000000000000000000000000000000000 --- a/inc/templates/adminform.php +++ /dev/null @@ -1,193 +0,0 @@ -<?php -global $WEBROOT; -global $FIRSTRUN; -global $CONFIG_ENABLEBACKUP; -global $CONFIG_DATADIRECTORY_ROOT; -global $CONFIG_BACKUPDIRECTORY; -global $CONFIG_ERROR; -$f=@fopen($SERVERROOT.'/config/config.php','a+'); -if(!$f) die('Error: Config file (config/config.php) is not writable for the webserver.<br/>'); -@fclose($f); -if(!isset($fillDB)) $fillDB=true; -if(!isset($CONFIG_DBHOST)) $CONFIG_DBHOST='localhost'; -if(!isset($CONFIG_DBUSER)) $CONFIG_DBUSER='owncloud'; -if(!isset($CONFIG_DBTABLEPREFIX)) $CONFIG_DBTABLEPREFIX='oc_'; -?> -<script type="text/javascript"> -function showDBAdmin(){ - var show=document.getElementById('dbcreate').checked; - document.getElementById('dbAdminUser').style.display=(show)?'table-row':'none'; - document.getElementById('dbAdminPwd').style.display=(show)?'table-row':'none'; -} - -function showBackupPath(){ - var show=document.getElementById('enablebackup').checked; - document.getElementById('backupdir').style.display=(show)?'table-row':'none'; -} - -function dbtypechange(){ - var dropdown=action=document.getElementById('dbtype'); - if (dropdown){ - var type=dropdown.options[dropdown.selectedIndex].value; - var inputs=Array('dbhost','dbuser','dbpass','dbpass_retype','dbcreaterow','dbAdminPwd','dbAdminUser','dbname','dbfill','dbtableprefix'); - var id,element; - if(type=='sqlite'){ - for(i in inputs){ - id=inputs[i]; - element=document.getElementById(id); - if(element){ - element.style.display='none'; - } - } - }else if(type=='mysql' || type=='pgsql'){ - for(i in inputs){ - id=inputs[i]; - element=document.getElementById(id); - if(element){ - element.style.display='table-row'; - } - } - showDBAdmin(); - } - } -} - -function datetypechange(){ - var dropdown=action=document.getElementById('datetype'); - var type=dropdown.options[dropdown.selectedIndex].value; - - var id,element; - if(type=='custom'){ - element=document.getElementById('trdateformat'); - if(element){ - element.style.display='table-row'; - } - }else{ - element=document.getElementById('trdateformat'); - if(element){ - element.style.display='none'; - } - element=document.getElementById('inputdateformat'); - if(element){ - element.value = type; - } - } -} -</script> -<?php -if(!$FIRSTRUN){ - $action=$WEBROOT.'/settings/#system_settings'; -}else{ - $action='#'; -} -echo('<form method="post" action="'.$action.'">') -?> -<table cellpadding="5" cellspacing="5" border="0" class="loginform"> -<?php - if(!empty($CONFIG_ERROR) and !$FIRSTRUN){ - echo "<tr><td colspan='3' class='error'>$CONFIG_ERROR</td></tr>"; - } -if($FIRSTRUN){?> -<tr><th colspan="2">Administrator User</th></tr> -<tr title="Name used to log in."><td>user name:</td><td><input type="text" name="adminlogin" size="30" class="formstyle" value=""></input></td></tr> -<tr title="Make a secure password, use at least 9 characters. Use letters and numbers."><td>password:</td><td><input type="password" name="adminpassword" size="30" class="formstyle"></input></td></tr> -<tr title="Retype password to avoid typing errors."><td>retype password:</td><td><input type="password" name="adminpassword2" size="30" class="formstyle"></input></td></tr> -<?php -} -?> -<tr><th colspan="2">Advanced Configuration</th></tr> -<?php if($FIRSTRUN){?> -<tr title="This directory is used to store files."><td>data directory:</td><td><input type="text" name="datadirectory" size="30" class="formstyle" value="<?php echo($CONFIG_DATADIRECTORY_ROOT);?>"></input></td></tr> -<?php } ?> -<tr title="Using SSL is more secure but requires specific configurations. Click the link to test SSL on your server."><td>force ssl: (<a href="https://<?php echo($_SERVER["HTTP_HOST"].$WEBROOT);?>" target="_blank">test SLL</a>)</td><td><input type="checkbox" name="forcessl" size="30" class="formstyle" value='1' <?php if($CONFIG_HTTPFORCESSL) echo 'checked="checked"'?>></input></td></tr> -<tr title="If something goes wrong, it is often possible to protect your data using a back-up."><td>automatic backup:</td><td><input type="checkbox" name="enablebackup" id="enablebackup" onchange='showBackupPath()' size="30" class="formstyle" value='1' <?php if($CONFIG_ENABLEBACKUP) echo 'checked'?>></input></td></tr> -<tr title="This directory is used to store backups." id='backupdir'><td> - backup directory:</td><td><input type="text" name="backupdirectory" size="30" class="formstyle" value="<?php echo($CONFIG_BACKUPDIRECTORY);?>"></input></td></tr> -<tr><td>date format:</td><td><select id='datetype' name="datetype" onchange='datetypechange()'> - <option value='<?php echo($CONFIG_DATEFORMAT);?>'><?php echo(date($CONFIG_DATEFORMAT));?></option> - <!-- dd-mm-yyyy yyyy-mm-dd mm-dd-yyyy --> - <optgroup label="DD-MM-YYYY"> - <option value='j M Y G:i'><?php echo(date('j M Y G:i'));?></option> - <option value='j M Y'><?php echo(date('j M Y'));?></option> - <option value='D j M Y G:i:s'><?php echo(date('D j M Y G:i:s'));?></option> - <option value='l j F'><?php echo(date('l j F'));?></option> - <option value='d-m-Y G:i'><?php echo(date('d-m-Y H:i'));?></option> - </optgroup> - <optgroup label="MM-DD-YYYY"> - <option value='M j Y G:i'><?php echo(date('M j Y G:i'));?></option> - <option value='M j Y'><?php echo(date('M j Y'));?></option> - </optgroup> - <optgroup label="YYYY-MM-DD"> - <option value='Y M j G:i'><?php echo(date('Y M j G:i'));?></option> - <option value='Y M j'><?php echo(date('Y M j'));?></option> - </optgroup> - <option value='custom'>Custom Date</option> -</select></td></tr> -<tr id='trdateformat'><td> - custom date:</td><td><input type="text" id="inputdateformat" name="dateformat" size="30" class="formstyle" value='<?php echo($CONFIG_DATEFORMAT);?>'></input></td></tr> -<?php if($FIRSTRUN){ - if(!is_callable('sqlite_open')){ - echo '<tr><td colspan="2">No SQLite support detected, make sure you have both sqlite and the sqlite php module installed (sqlite and php5-sqlite for Debian/Ubuntu)</td></tr>'; - } -?> -<tr title="SQLite is usually the easiest database to work with."><td>database type:</td><td> -<select id='dbtype' name="dbtype" onchange='dbtypechange()'> -<?php -global $CONFIG_DBTYPE; -if($CONFIG_DBTYPE=='sqlite'){ - if(is_callable('sqlite_open')){ - echo "<option value='sqlite'>SQLite</option>"; - } - if(is_callable('mysql_connect')){ - echo "<option value='mysql'>MySQL</option>"; - } - if(is_callable('pg_connect')){ - echo "<option value='pgsql'>PostgreSQL</option>"; - } -}elseif($CONFIG_DBTYPE=='mysql'){ - if(is_callable('mysql_connect')){ - echo "<option value='mysql'>MySQL</option>"; - } - if(is_callable('sqlite_open')){ - echo "<option value='sqlite'>SQLite</option>"; - } - if(is_callable('pg_connect')){ - echo "<option value='pgsql'>PostgreSQL</option>"; - } -}elseif($CONFIG_DBTYPE=='pgsql'){ - if(is_callable('pg_connect')){ - echo "<option value='pgsql'>PostgreSQL</option>"; - } - if(is_callable('mysql_connect')){ - echo "<option value='mysql'>MySQL</option>"; - } - if(is_callable('sqlite_open')){ - echo "<option value='sqlite'>SQLite</option>"; - } -} -?> -</select> -</td></tr> -<tr title="The database server. In most cases, localhost works fine." id='dbhost'><td> - database host:</td><td><input type="text" name="dbhost" size="30" class="formstyle" value='<?php echo($CONFIG_DBHOST);?>'></input></td></tr> -<tr title="The name of the database." id='dbname'><td> - database name:</td><td><input type="text" name="dbname" size="30" class="formstyle" value='<?php echo($CONFIG_DBNAME);?>'></input></td></tr> -<tr title="Used to avoid conflict between web-applications. Don't use the same prefix for two web-applications." id='dbtableprefix'><td> - table prefix:</td><td><input type="text" name="dbtableprefix" size="30" class="formstyle" value='<?php echo($CONFIG_DBTABLEPREFIX);?>'></input></td></tr> -<tr title="The user of the database. If possible avoid the root user." id='dbuser'><td> - database user:</td><td><input type="text" name="dbuser" size="30" class="formstyle" value='<?php echo($CONFIG_DBUSER);?>'></input></td></tr> -<tr title="The password of the database." id='dbpass'><td> - password:</td><td><input type="password" name="dbpassword" size="30" class="formstyle" value=''></input></td></tr> -<tr title="Retype password to avoid typing errors." id='dbpass_retype'><td> - retype password:</td><td><input type="password" name="dbpassword2" size="30" class="formstyle" value=''></input></td></tr> -<tr title="Automatically create a database and user for ownCloud." id='dbcreaterow'><td> - create database and user:</td><td><input id='dbcreate' type="checkbox" name="createdatabase" size="30" class="formstyle" value='1' checked="checked" onchange='showDBAdmin()'></input></td></tr> -<tr title="The administrative database user. This is often 'root'. If in doubt, contact your web-host" id='dbAdminUser'><td> - administrative user:</td><td><input type="text" name="dbadminuser" size="30" class="formstyle" value='root'></input></td></tr> -<tr title="The password of the administrative database user. If in doubt, contact your web-host." id='dbAdminPwd'><td> - administrative password:</td><td><input type="password" name="dbadminpwd" size="30" class="formstyle" value=''></input></td></tr> -<tr title="Fill database with default data so you can start right away." id='dbfill'><td> - fill initial database:</td><td><input type="checkbox" name="filldb" size="30" class="formstyle" value='1' checked="checked"></input></td></tr> -<?php }?> -<tr><th colspan="2">Confirmation</th></tr> -<?php - if(!$FIRSTRUN){?> - <tr title="This is to avoid abuse while you are away and have not logged out decently."><td>your password:</td><td><input type="password" name="currentpassword" size="30" class="formstyle"></input></td></tr> - <?php - } -?> -<tr><td></td><td><input type="submit" name="set_config" alt="save" value="save" class="formstyle" /></td></tr> -</table></form><br/> -<script type="text/javascript"> - dbtypechange(); - datetypechange(); - showBackupPath(); -</script> diff --git a/inc/templates/configform.php b/inc/templates/configform.php deleted file mode 100644 index 76c73cb8887aedee0a86ef5ecc4fc75c757fbf0f..0000000000000000000000000000000000000000 --- a/inc/templates/configform.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php -global $FIRSTRUN; -global $WEBROOT; -global $CONFIG_ERROR; -if(!isset($fillDB)) $fillDB=true; -if(!isset($CONFIG_DBHOST)) $CONFIG_DBHOST='localhost'; -if(!isset($CONFIG_DBUSER)) $CONFIG_DBUSER='owncloud'; -$newuserpassword=OC_USER::generatepassword(); -?> -<script type="text/javascript"> -changepassset=function(){ - var change=document.getElementById('changepass').checked; - if(!change){ - document.getElementById('new_password').style.display='none'; - document.getElementById('new_password_retype').style.display='none'; - }else{ - document.getElementById('new_password').style.display='table-row'; - document.getElementById('new_password_retype').style.display='table-row'; - } -} -</script> -<form method="post" enctype="multipart/form-data" action="<?php echo($WEBROOT);?>/settings/#"> -<div><input type='hidden' name='config' value='1' /></div> -<table cellpadding="5" cellspacing="5" border="0" class="loginform"> -<?php - if(!empty($CONFIG_ERROR) and !$FIRSTRUN){ - echo "<tr><td colspan='3' class='error'>$CONFIG_ERROR</td></tr>"; - } -?> -<tr><td>enter password</td><td><input type="password" name="currentpassword" size="30" class="formstyle"></input></td></tr> -<tr><td>change password:</td><td><input onchange='changepassset()' id='changepass' type="checkbox" name="changepass" size="30" class="formstyle" value='1'></input></td></tr> -<tr style='display:none' id='new_password'><td>new password:</td><td><input type="password" name="password" size="30" class="formstyle"></input></td></tr> -<tr style='display:none' id='new_password_retype'><td>retype admin password:</td><td><input type="password" name="password2" size="30" class="formstyle"></input></td></tr> -<tr><td></td><td><input type='submit' value='save' class='formstyle'/></td></tr> -</table> -</form> diff --git a/inc/templates/footer.php b/inc/templates/footer.php deleted file mode 100644 index 56f4fce195294f2943ed3763fbb1512f9cb0d62d..0000000000000000000000000000000000000000 --- a/inc/templates/footer.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php -global $WEBROOT; -?> -</div> -<div class='foot'> -<?php -if(!OC_UTIL::hasSmallScreen()){ - if (isset($_SERVER['HTTPS'])) { - $PROTO="webdavs://"; - } else { - $PROTO="webdav://"; - } -?> -<div class='bar'><p class="hint"> -Hint: Mount it via webdav like this: <a href="<?php echo($PROTO.$_SERVER["HTTP_HOST"].$WEBROOT.'/webdav/owncloud.php');?>"><?php echo($PROTO.$_SERVER["HTTP_HOST"].$WEBROOT);?>/webdav/owncloud.php</a> -</p></div> -<?php }?> -<p class="footer"> -<?php - $version=implode('.',OC_UTIL::getVersion()); - echo('<a href="http://ownCloud.org">ownCloud</a> - '.$version); -?> -</p> -</div> -</div> -</body></html> diff --git a/inc/templates/header.php b/inc/templates/header.php deleted file mode 100644 index 4593af59518c220d8d0f4eb2efc4ef24ce539d89..0000000000000000000000000000000000000000 --- a/inc/templates/header.php +++ /dev/null @@ -1,90 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> - <title>ownCloud</title> - <base href="<?php echo($WEBROOT); ?>/"/> - <link rel="stylesheet" type="text/css" href="<?php - if(!OC_UTIL::hasSmallScreen()){ - echo($WEBROOT.'/css/default.php'); - }else{ - echo($WEBROOT.'/css/small.php'); - } - ?>"/> - <script type='text/ecmascript' src='<?php echo($WEBROOT)?>/js/lib_ajax.js'></script> - <?php - global $CONFIG_INSTALLED; - if($CONFIG_INSTALLED){//the javascripts somehow breaks the first run wizzard in konqueror?> - <script type='text/ecmascript' src='<?php echo($WEBROOT)?>/js/lib_timer.js'></script> - <script type='text/ecmascript' src='<?php echo($WEBROOT)?>/js/lib_notification.js'></script> - <script type='text/ecmascript' src='<?php echo($WEBROOT)?>/js/lib_xmlloader.js'></script> - <script type='text/ecmascript' src='<?php echo($WEBROOT)?>/js/lib_files.js'></script> - <script type='text/ecmascript' src='<?php echo($WEBROOT)?>/js/lib_event.js'></script> - <script type='text/ecmascript' src='<?php echo($WEBROOT)?>/js/lib_drag.js'></script> - <script type='text/ecmascript' src='<?php echo($WEBROOT)?>/js/lib_api.js'></script> - <script type='text/ecmascript' src='<?php echo($WEBROOT)?>/js/filebrowser.js'></script> - <?php - } - ?> -<?php -foreach(OC_UTIL::$scripts as $script){ - echo("<script type='text/ecmascript' src='$WEBROOT/$script'></script>\n"); -} -foreach(OC_UTIL::$styles as $style){ - echo("<link rel='stylesheet' type='text/css' href='$WEBROOT/$style'/>\n"); -} -?> - <script type='text/ecmascript'> - var WEBROOT='<?php echo($WEBROOT)?>'; - var SMALLSCREEN='<?php echo((OC_UTIL::hasSmallScreen())?'true':'false')?>'; - </script> - </head> - <body onload='OC_onload.run()'> -<div id='mainlayout'> -<div class='head'> -<?php -global $CONFIG_ERROR; -if(!OC_UTIL::hasSmallScreen()){ - echo('<h1><a id="owncloud-logo" href="'.$WEBROOT.'"><span>ownCloud</span></a></h1>'); -} - - - // check if already configured. otherwise start configuration wizard - $error=OC_CONFIG::writeadminlistener(); - if($e=OC_CONFIG::configlistener()){ - $error.=$e; - } - if($e=OC_CONFIG::createuserlistener()){ - $error.=$e; - } - if($e=OC_CONFIG::creategrouplistener()){ - $error.=$e; - } - $CONFIG_ERROR=$error; - global $CONFIG_INSTALLED; - if(!$CONFIG_INSTALLED) { - global $FIRSTRUN; - $FIRSTRUN=true; - echo('</div><div class="body">'); - echo('<div class="center">'); - echo('<p class="errortext">'.$error.'</p>'); - echo('<p class="highlighttext">First Run Wizard</p>'); - OC_CONFIG::showadminform(); - echo('</div>'); - OC_UTIL::showfooter(); - exit(); - }elseif(!isset($_SESSION['username']) or $_SESSION['username']=='') { // show the loginform if not loggedin - echo('<div class="center">'); - OC_UTIL::showloginform(); - echo('</div>'); - OC_UTIL::showfooter(); - exit(); - }else{ - echo('<div id="nav" class="center">'); - OC_UTIL::shownavigation(); - echo('</div>'); - echo('</div><div class="body">'); - } - -?> diff --git a/inc/templates/loginform.php b/inc/templates/loginform.php deleted file mode 100644 index 41c86eef0130ae442649c2091fcde55d4b17a4c3..0000000000000000000000000000000000000000 --- a/inc/templates/loginform.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php -if(isset($loginresult) and $loginresult=='error') echo('<p class="errortext">login failed</p>'); -?> -<form method="post" enctype="multipart/form-data" action="<?php echo $_SERVER['REQUEST_URI']; ?>"> -<table cellpadding="5" cellspacing="5" border="0" class="loginform"> -<tr><td>login:</td><td><input type="text" name="login" size="30" class="formstyle"></input></td></tr> -<tr><td>password:</td><td><input type="password" name="password" size="30" class="formstyle"></input></td></tr> -<tr><td></td><td><input type="submit" name="loginbutton" alt="login" value="login" class="formstyle" /></td></tr> -</table></form> diff --git a/inc/templates/pluginform.php b/inc/templates/pluginform.php deleted file mode 100644 index 01410f9c82918afe2ee844e2e231f46e9c2f3332..0000000000000000000000000000000000000000 --- a/inc/templates/pluginform.php +++ /dev/null @@ -1,77 +0,0 @@ -<?php -$action=$WEBROOT.'/settings/#plugin_management'; -if(isset($_POST['plugin_disable_id'])){ - $id=$_POST['plugin_disable_id']; - $disable=$_POST['plugin_disable']; - if($disable=='true'){ - OC_PLUGIN::addToBlacklist($id); - }else{ - OC_PLUGIN::removeFromBlacklist($id); - } - header('location: '.$action); - die(); -} - -if(isset($_POST['install_plugin']) and $_POST['install_plugin']=='true'){ - $file=$_FILES['plugin_file']['tmp_name']; - OC_PLUGIN::installPlugin($file); - header('location: '.$action); - die(); -} -$plugins=OC_PLUGIN::listPlugins(); -$blacklist=OC_PLUGIN::loadBlackList(); -?> -<script type="text/javascript"> -<?php - echo('var plugins='.json_encode($plugins).";\n"); - echo('var blacklist='.json_encode($blacklist).";\n"); -?> - -disablePlugin=function(id,disable){ - var form=document.getElementById('disableForm'); - var input=document.getElementById('plugin_disable_name'); - input.value=id; - var input=document.getElementById('plugin_disable'); - input.value=disable; - form.submit(); -} -</script> -<p class='description'>Plugin List</p> -<form id='disableForm' action='<?php echo($action);?>' method="post" enctype="multipart/form-data"> -<input id='plugin_disable_name' type='hidden' name='plugin_disable_id' value=''/> -<input id='plugin_disable' type='hidden' name='plugin_disable' value=''/> -</form> -<table class='pluginlist'> - <thead> - <tr> - <td colspan='2'>Id</td> - <td>Version</td> - <td>Description</td> - <td>Author</td> - </tr> - </thead> - <tbody> - <?php - foreach($plugins as $plugin){ - $pluginData=OC_PLUGIN::getPluginData($plugin); - $enabled=(array_search($plugin,$blacklist)===false); - $enabledString=($enabled)?'enabled':'disabled'; - $enabledStringOther=(!$enabled)?'enable':'disable'; - $enabled=($enabled)?'true':'false'; - echo("<tr class='$enabledString'>\n"); - echo("<td class='name'>$plugin</td>"); - echo("<td class='disable'>(<a href='$action' onclick='disablePlugin(\"$plugin\",$enabled)'>$enabledStringOther</a>)</td>"); - echo("<td class='version'>{$pluginData['info']['version']}</td>"); - echo("<td>{$pluginData['info']['name']}</td>"); - echo("<td>{$pluginData['info']['author']}</td>"); - echo("</tr>\n"); - } - ?> - </tbody> -</table> -<p class='description'>Install Plugin</p> -<form action='<?php echo($action);?>' method="post" enctype="multipart/form-data"> - <input class='formstyle' type='file' name='plugin_file'/> - <input type='hidden' name='install_plugin' value='true'/> - <input class='formstyle' type='submit'/> -</form> \ No newline at end of file diff --git a/inc/templates/settings.php b/inc/templates/settings.php deleted file mode 100644 index 5df6b70f5af80ce5b1dc94477e22e9702bdf1373..0000000000000000000000000000000000000000 --- a/inc/templates/settings.php +++ /dev/null @@ -1,50 +0,0 @@ -<script type="text/javascript"> -function showForm(id){ - hideAllForms(); - form=document.getElementById('settingsContent_'+id); - form.setAttribute('class','settingsContent'); -} - -function showFormInit(){ - var loc=document.location.toString(); - if(loc.indexOf('#')!=-1){ - var id=loc.substring(loc.indexOf('#')+1); - showForm(id); - } -} - -function hideAllForms(){ - forms=document.getElementById('settingsHolder').childNodes; - for(var i=0;i<forms.length;i++){ - form=forms.item(i); - if(form.nodeType==1 && (form.tagName=='div' || form.tagName=='DIV')){ - form.setAttribute('class','settingsContent hidden'); - } - } -} -</script> -<div id='settingsNav'> -<ul> -<?php -global $WEBROOT; -foreach(OC_CONFIG::$forms as $name=>$url){ - $clean=strtolower(str_replace(' ','_',$name)); - echo("<li><a onclick='showForm(\"$clean\")' href='{$WEBROOT}/settings/#$clean'>$name</a></li>\n"); -} -?> -</ul> -</div> -<div id='settingsHolder'> -<div class='settingsContent'>Settings</div> -<?php -foreach(OC_CONFIG::$forms as $name=>$url){ - $clean=strtolower(str_replace(' ','_',$name)); - echo("<div id='settingsContent_$clean' class='settingsContent hidden'>\n"); - oc_include($url); - echo("</div>\n"); -} -?> -</div> -<script type="text/javascript"> -OC_onload.add(showFormInit()); -</script> \ No newline at end of file diff --git a/inc/templates/userform.php b/inc/templates/userform.php deleted file mode 100644 index dea419159e3b25c574eb6d22989c970607f58865..0000000000000000000000000000000000000000 --- a/inc/templates/userform.php +++ /dev/null @@ -1,126 +0,0 @@ -<?php -//handle addTo and removeFrom group -if(isset($_POST['groupAddRemove'])){ - $groupName=$_POST['groupname']; - $users=explode(';',$_POST['users']); - if($_POST['groupAddRemove']=='add'){ - foreach($users as $user){ - OC_USER::addToGroup($user,$groupName); - } - }elseif($_POST['groupAddRemove']=='remove'){ - foreach($users as $user){ - OC_USER::removeFromGroup($user,$groupName); - } - } -} -$action=$WEBROOT.'/settings/#user_management'; -if(!empty($CONFIG_ERROR)){ - echo "<p class='error'>$CONFIG_ERROR</p>"; -} -?> -<script type="text/javascript"> -<?php - $users=OC_USER::getUsers(); - $groups=OC_USER::getGroups(); - echo('var users='.json_encode($users).";\n"); - echo('var groups='.json_encode($groups).";\n"); -?> -sellectAllUsers=function(){ - var check=document.getElementById('user_selectall'); - for(i in users){ - if(users[i]){ - document.getElementById('user_select_'+users[i]).checked=check.checked; - } - } - getSellectedUsers(); -} - -getSellectedUsers=function(){ - sellectedUsers=new Array(); - for(i in users){ - if(users[i]){ - if(document.getElementById('user_select_'+users[i]).checked){ - sellectedUsers.push(users[i]); - } - } - } - document.getElementById('removeFromGroupUsers').value=sellectedUsers.join(';'); - document.getElementById('addToGroupUsers').value=sellectedUsers.join(';'); -} - -var sellectedUsers=new Array(); - -setGroup=function(){ - var select=document.getElementById('groupselect'); - var group=select.options[select.selectedIndex].value; - document.getElementById('addToGroupName').value=group; - document.getElementById('removeFromGroupName').value=group; -} - -</script> -<p class='description'>All Users</p> -<table class='userlist'> - <thead> - <tr> - <td class='sellect'><input type='checkbox' id='user_selectall' onchange='sellectAllUsers()' class='formstyle'/></td> - <td class='name'>Name</td> - <td class='groups'>Groups</td> - </tr> - </thead> - <tbody> - <?php - foreach($users as $user){ - if($user){ - echo("<tr>\n"); - echo("<td class='sellect'><input type='checkbox' onchange='getSellectedUsers()' id='user_select_$user' class='formstyle'/></td>\n"); - echo("<td class='name'>$user</td>\n"); - $userGroups=OC_USER::getUserGroups($user); - foreach($userGroups as &$userGroup){ - $userGroup=OC_USER::getGroupName($userGroup); - } - $userGroups=join(', ',$userGroups); - echo("<td class='groups'>$userGroups</td>\n"); - echo("</tr>\n"); - } - } - ?> - </tbody> -</table> -<div id='sellectedUsersActions'> -Groups <select id='groupselect' onchange='setGroup()'> -<?php -foreach($groups as $group){ - echo("<option value='$group'>$group</option>"); -} -?> -</select> -<form id='addToGroupForm' method="post" enctype="multipart/form-data" action="<?php echo($action);?>"> -<input type='hidden' name='groupAddRemove' value='add'></input> -<input id='addToGroupName' type='hidden' name='groupname' value='<?php echo($groups[0]);?>'></input> -<input id='addToGroupUsers' type='hidden' name='users' value=''></input> -<input type='submit' value='Add'></input> -</form> -<form id='removeFromGroupForm' method="post" enctype="multipart/form-data" action="<?php echo($action);?>"> -<input type='hidden' name='groupAddRemove' value='remove'></input> -<input id='removeFromGroupName' type='hidden' name='groupname' value='<?php echo($groups[0]);?>'></input> -<input id='removeFromGroupUsers' type='hidden' name='users' value=''></input> -<input type='submit' value='Remove'></input> -</form> -</div> -<p class='description'>Add User</p> -<?php -$newuserpassword=OC_USER::generatepassword(); -?> -<form id='newUserForm' method="post" enctype="multipart/form-data" action="<?php echo($action);?>"> -user name: <input type='text' name='new_username' class="formstyle"></input> -password <input type='text' name='new_password' class="formstyle" autocomplete="off" value='<?php echo($newuserpassword);?>'></input> - <input type='submit' value='create' class="formstyle"></input> -</form> -<p class='description'>Add Group</p> -<form id='newGroupForm' method="post" enctype="multipart/form-data" action="<?php echo($action);?>"> -<input type='hidden' name='creategroup' value='1' /> -<input type='text' name='groupname' class="formstyle"></input> -<input type='submit' value='create' class="formstyle"></input> -</form> - - diff --git a/index.php b/index.php index 67e0b5493027fa503bbf9466a07487066bf8fd20..f4d6f27a3c4743a967466c3322695f386027f30b 100644 --- a/index.php +++ b/index.php @@ -3,40 +3,73 @@ /** * ownCloud * -* @author Frank Karlitschek -* @copyright 2010 Frank Karlitschek karlitschek@kde.org -* +* @author Frank Karlitschek +* @copyright 2010 Frank Karlitschek karlitschek@kde.org +* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either +* License as published by the Free Software Foundation; either * version 3 of the License, or any later version. -* +* * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public +* +* You should have received a copy of the GNU Affero General Public * License along with this library. If not, see <http://www.gnu.org/licenses/>. -* +* */ -require_once('inc/lib_base.php'); +$RUNTIME_NOAPPS = TRUE; //no apps, yet -if(isset($_GET['dir'])) $dir=$_GET['dir']; else $dir=''; +require_once(dirname(__FILE__).'/lib/base.php'); +require_once('appconfig.php'); +require_once('template.php'); -if(isset($_GET['file'])) { +$not_installed = !OC_CONFIG::getValue('installed', false); +$install_called = (isset($_POST['install']) AND $_POST['install']=='true'); - OC_FILES::get($dir,$_GET['file']); -}else{ +// First step : check if the server is correctly configured for ownCloud : +$errors = OC_UTIL::checkServer(); +if(count($errors) > 0) { + OC_TEMPLATE::printGuestPage("", "error", array("errors" => $errors)); +} - OC_UTIL::addscript('js/ajax.js'); - OC_UTIL::showheader(); +// Setup required : +elseif($not_installed OR $install_called) { + require_once('setup.php'); +} - OC_FILES::showbrowser($CONFIG_DATADIRECTORY,$dir); +// Someone is logged in : +elseif(OC_USER::isLoggedIn()) { + if(isset($_GET["logout"]) and ($_GET["logout"])) { + OC_USER::logout(); + header("Location: $WEBROOT"); + exit(); + } + else { + header("Location: ".$WEBROOT.'/'.OC_APPCONFIG::getValue("core", "defaultpage", "files/index.php")); + exit(); + } +} - OC_UTIL::showfooter(); +// Someone wants to log in : +elseif(isset($_POST["user"])) { + OC_APP::loadApps(); + if(OC_USER::login($_POST["user"], $_POST["password"])) { + header("Location: ".$WEBROOT.'/'.OC_APPCONFIG::getValue("core", "defaultpage", "files/index.php")); + exit(); + } + else { + OC_TEMPLATE::printGuestPage("", "login", array("error" => true)); + } +} +// For all others cases, we display the guest page : +else { + OC_APP::loadApps(); + OC_TEMPLATE::printGuestPage("", "login", array("error" => false)); } -?> +?> \ No newline at end of file diff --git a/js/filebrowser.js b/js/filebrowser.js deleted file mode 100644 index 1aa0e138970d940c389aadda62da7ad531907996..0000000000000000000000000000000000000000 --- a/js/filebrowser.js +++ /dev/null @@ -1,596 +0,0 @@ -/** -* ownCloud - ajax frontend -* -* @author Robin Appelman -* @copyright 2010 Robin Appelman icewind1991@gmail.com -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either -* version 3 of the License, or any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. -* -*/ - -OC_FILES.browser=new Object(); - -OC_FILES.browser.showInitial=function(){ - if(document.getElementById('content')){ - var dir='' - var loc=document.location.toString(); - if(loc.indexOf('#')!=-1){ - dir=loc.substring(loc.indexOf('#')+1); - } - OC_FILES.getdirectorycontent(dir,OC_FILES.browser.show_callback,true); - } -} - -OC_FILES.browser.show=function(dir,forceReload){ - if(!dir || !dir.split){ - dir=''; - } - OC_FILES.getdirectorycontent(dir,OC_FILES.browser.show_callback,forceReload); -} - -OC_FILES.browser.breadcrumb=new Object(); -OC_FILES.browser.breadcrumb.node=null; -OC_FILES.browser.breadcrumb.crumbs=Array(); -OC_FILES.browser.breadcrumb.show=function(parent,path){ - if((!OC_FILES.browser.breadcrumb.node==parent && parent) || OC_FILES.browser.breadcrumb.node==null){ - OC_FILES.browser.breadcrumb.clear(); - OC_FILES.browser.breadcrumb.node=parent; - OC_FILES.browser.breadcrumb.add('Home','/'); - } - var dirs=path.split('/'); - var currentPath='/'; - var paths=Array(); - var currentPath; - if(dirs.length>0){ - for(var i=0;i<dirs.length;i++){ - dir=dirs[i]; - if(dir){ - currentPath+=dir+'/'; - paths[currentPath]=true; - if(!OC_FILES.browser.breadcrumb.crumbs[currentPath]){ - OC_FILES.browser.breadcrumb.add(dir,currentPath); - } - } - } - } - //remove all crumbs that are not part of our current path - for(currentPath in OC_FILES.browser.breadcrumb.crumbs){ - if(!paths[currentPath] && currentPath!='/'){ - OC_FILES.browser.breadcrumb.remove(currentPath); - } - } - -} -OC_FILES.browser.breadcrumb.add=function(name,path){ - var a=document.createElement('a'); - var div=document.createElement('div'); - OC_FILES.browser.breadcrumb.crumbs[path]=div; - div.className='breadcrumb'; - a.setAttribute('href','#'+path); - a.addEvent('onclick',OC_FILES.browser.show,path); - img=document.createElement('img'); - img.src=WEBROOT+'/img/arrow.png'; - a.appendChild(document.createTextNode(' ' +name)); - a.appendChild(img); - OC_FILES.files[path]=new OC_FILES.file('',path,'dir'); - div.makeDropTarget(); - div.file=OC_FILES.files[path]; - div.addEvent('ondropon',OC_FILES.browser.handleDropOn); - div.appendChild(a); - - OC_FILES.browser.breadcrumb.node.appendChild(div); -} -OC_FILES.browser.breadcrumb.remove=function(path){ - if(OC_FILES.browser.breadcrumb.crumbs[path]){ - var div=OC_FILES.browser.breadcrumb.crumbs[path]; - if(div.parentNode){ - div.parentNode.removeChild(div); - } - delete OC_FILES.browser.breadcrumb.crumbs[path]; - } -} -OC_FILES.browser.breadcrumb.clear=function(){ - for(path in OC_FILES.browser.breadcrumb.crumbs){ - OC_FILES.browser.breadcrumb.remove(path); - } -} - -OC_FILES.browser.files=new Object(); -OC_FILES.browser.files.fileNodes=Array(); -OC_FILES.browser.files.node=null; -OC_FILES.browser.files.tbody=null; -OC_FILES.browser.files.show=function(parent,fileList){ - if(parent){ - OC_FILES.browser.files.node=parent; - } - var table=document.createElement('table'); - OC_FILES.browser.files.node.appendChild(table); - var tbody=document.createElement('tbody'); - OC_FILES.browser.files.tbody=tbody; - table.appendChild(tbody); - table.setAttribute('cellpadding',6); - table.setAttribute('cellspacing',0); - if(fileList){ - var name; - //remove files that no longer are in the folder - for(name in OC_FILES.browser.files.fileNodes){ - if(!fileList[name]){ - OC_FILES.browser.files.remove(name); - } - } - //add the files that arent in the list yet - var unreadableFiles=[]; - for(name in fileList){ - file=fileList[name]; - if(file.readable){ - if(!OC_FILES.browser.files.fileNodes[file.name]){ - OC_FILES.browser.files.add(file.name,file.type,file.size,file.date,file.mime); - } - }else if(file.name){ - unreadableFiles.push(file); - } - } - if(unreadableFiles.length>0){ - var message=unreadableFiles.length+" unreadable files detected:\n"; - var first=true; - unreadableFiles.foreach(function(item){ - if(!first){ - message+=', '; - } - first=false; - message+=item.name; - }); - message+="\nPlease check the file premissions"; - alert(message); - } - } -} -OC_FILES.browser.files.add=function(name,type,size,date,mime){ - if(name){ - if(!size) size=0; - if(!date) date=getTimeString(); - OC_FILES.files[name]=new OC_FILES.file(OC_FILES.dir,name,type,mime); - tr=document.createElement('tr'); - OC_FILES.browser.files.fileNodes[name]=tr; - OC_FILES.browser.files.tbody.appendChild(tr); - tr.className='browserline'; - td=document.createElement('td'); - tr.appendChild(td); - td.className='fileSelector'; - input=document.createElement('input'); - input.setAttribute('type','checkbox'); - input.setAttribute('name','fileSelector'); - input.setAttribute('value',name); - td.appendChild(input); - tr.appendChild(OC_FILES.browser.showicon(type)); - td=document.createElement('td'); - tr.appendChild(td); - td.makeDropTarget(); - td.addEvent('ondropon',OC_FILES.browser.handleDropOn); - td.className='nametext'; - td.setAttribute('name',name); - td.setAttribute('id',name); - var fileObject=OC_FILES.files[name]; - td.file=fileObject; - a=document.createElement('a'); - td.appendChild(a); - a.appendChild(document.createTextNode(name)); - a.addEvent('onclick',fileObject.actions['default'].bindScope(fileObject)); - a.makeDraggable(); - a.addEvent('ondrop',OC_FILES.browser.handleDrop); - if(type=='dir'){ - td.setAttribute('colspan',2); - var dirname=name; - if(OC_FILES.dir[OC_FILES.dir.length-1]!='/'){ - dirname='/'+name; - } - a.setAttribute('href','#'+OC_FILES.dir+dirname); - }else{ - a.setAttribute('href','#'+OC_FILES.dir); - if(!SMALLSCREEN){ - sizeTd=document.createElement('td'); - tr.appendChild(sizeTd); - sizeTd.className='sizetext'; - sizeTd.appendChild(document.createTextNode(sizeFormat(size))); - }else{ - td.setAttribute('colspan',2); - } - } - a=document.createElement('a'); - var img=document.createElement('img'); - td.appendChild(img); - img.className='file_actions'; - img.alt='' - img.title='actions'; - img.src=WEBROOT+'/img/arrow_down.png'; - img.addEvent('onclick',OC_FILES.browser.showactions.bind(name)); - if(!SMALLSCREEN){ - td=document.createElement('td'); - tr.appendChild(td); - td.className='sizetext'; - td.appendChild(document.createTextNode(date)); - } - } -} - -OC_FILES.browser.files.remove=function(name){ - if(OC_FILES.browser.files.fileNodes[name]){ - tr=OC_FILES.browser.files.fileNodes[name]; - tr.parentNode.removeChild(tr); - delete OC_FILES.browser.files.fileNodes[name]; - } - -} -OC_FILES.browser.files.clear=function(){ - for(name in OC_FILES.browser.files.fileNodes){ - OC_FILES.browser.files.remove(name); - } -} - -OC_FILES.browser.table=null; -OC_FILES.browser.show_callback=function(content){ - var dir=OC_FILES.dir - var tr=null; - var td=null; - var img=null; - if(!OC_FILES.browser.table){ - body=document.getElementsByTagName('body').item(0); - body.addEvent('onclick',OC_FILES.browser.hideallactions); - - //remove current content; - var contentNode=document.getElementById('content'); - contentNode.className='center'; - if(contentNode.hasChildNodes()){ - while(contentNode.childNodes.length >=1){ - contentNode.removeChild(contentNode.firstChild); - } - } - var table=document.createElement('table'); - OC_FILES.browser.table=table; - table.className='browser'; - var tbody=document.createElement('tbody'); - var thead=document.createElement('thead'); - var tfoot=document.createElement('tfoot'); - table.appendChild(thead); - table.appendChild(tbody); - table.appendChild(tfoot); - OC_FILES.files=Array(); - table.setAttribute('cellpadding',6); - - tr=document.createElement('tr'); - thead.appendChild(tr); - tr.className='breadcrumb'; - td=document.createElement('td'); - tr.appendChild(td); - input=document.createElement('input'); - input.className='fileSelector' - input.setAttribute('type','checkbox'); - input.setAttribute('name','fileSelector'); - input.setAttribute('value','select_all'); - input.setAttribute('id','select_all'); - input.addEvent('onclick',OC_FILES.selectAll); - td.appendChild(input); - td.className='breadcrumb'; - OC_FILES.browser.breadcrumb.show(td,dir); - // files and directories - tr=document.createElement('tr'); - tbody.appendChild(tr); - td=document.createElement('td'); - tr.appendChild(td); - div=document.createElement('div'); - div.className='fileList'; - td.appendChild(div); - OC_FILES.browser.files.show(div,content); - tr=document.createElement('tr'); - tfoot.appendChild(tr); - tr.className='utilityline'; - td=document.createElement('td'); - tr.appendChild(td); - td.className='actionsSelected'; - dropdown=document.createElement('select'); - td.appendChild(dropdown); - dropdown.setAttribute('id','selected_action'); - for(index in OC_FILES.actions_selected){ - if(OC_FILES.actions_selected[index].call){ - option=document.createElement('option'); - dropdown.appendChild(option); - option.setAttribute('value',index); - option.appendChild(document.createTextNode(capitaliseFirstLetter(index))); - } - } - td.appendChild(document.createTextNode(' Selected ')); - button=document.createElement('button'); - td.appendChild(button); - button.appendChild(document.createTextNode('Go')); - button.addEvent('onclick',OC_FILES.action_selected); - div=document.createElement('div'); - td.appendChild(div); - div.className='moreActionsButton'; - OC_FILES.maxUpload=content['max_upload']; - var p=document.createElement('p'); - div.appendChild(p); - p.appendChild(document.createTextNode('More Actions')); - div.setAttribute('id','moreActionsButton'); - OC_FILES.browser.moreActionsShown=false; - p.addEvent('onclick',OC_FILES.browser.showMoreActions); - contentNode.appendChild(table); - }else{ - OC_FILES.browser.breadcrumb.show(null,dir); - OC_FILES.browser.files.show(null,content); - } - if(OC_FILES.uploadForm){ - OC_FILES.uploadForm.setAttribute('action','files/upload.php?dir='+encodeURIComponent(dir)); - } -} - -OC_FILES.browser.handleDropOn=function(event,node){ - var dropTargetFile=this.file; - var dropFile=node.parentNode.file; - if(dropTargetFile!=dropFile){ - if(dropTargetFile.actions.dropOn && dropTargetFile.actions.dropOn.call){ - dropTargetFile.actions.dropOn.call(dropTargetFile,dropFile); - } - return false; - } -} - -OC_FILES.browser.handleDrop=function(event,node){ - var dropTargetFile=node.file; - var dropFile=this.parentNode.file; - if(dropFile.actions.drop && dropFile.actions.drop.call){ - dropFile.actions.drop.call(dropFile,dropTargetFile); - } - return false; -} - -OC_FILES.browser.showMoreActions=function(){ - if(!OC_FILES.browser.moreActionsList){ - var div=document.createElement('div'); - div.className='moreActionsList'; - var table=document.createElement('table'); - div.appendChild(table); - var tbody=document.createElement('tbody'); - table.appendChild(tbody); - var tr=document.createElement('tr'); - tbody.appendChild(tr); - var td=document.createElement('td'); - tr.appendChild(td); - OC_FILES.browser.showuploader(OC_FILES.dir,td,OC_FILES.maxUpload); - tr=document.createElement('tr'); - tbody.appendChild(tr); - td=document.createElement('td'); - tr.appendChild(td); - var form=document.createElement('form'); - td.appendChild(form); - form.appendChild(document.createTextNode('New ')); - var dropdown=document.createElement('select'); - form.appendChild(dropdown); - dropdown.setAttribute('id','newFileType'); - var option=document.createElement('option'); - dropdown.appendChild(option); - option.setAttribute('value','dir'); - option.appendChild(document.createTextNode('Folder')); - option=document.createElement('option'); - dropdown.appendChild(option); - option.setAttribute('value','file'); - option.appendChild(document.createTextNode('File')); - form.appendChild(document.createTextNode(' ')); - var input=document.createElement('input'); - form.appendChild(input); - input.setAttribute('id','newFileName'); - form.addEvent('onsubmit',OC_FILES.browser.newFile); - var submit=document.createElement('input'); - submit.type='submit'; - form.appendChild(submit); - submit.value='Create'; - OC_FILES.browser.moreActionsList=div; - }else{ - var div=OC_FILES.browser.moreActionsList; - } - var button=document.getElementById('moreActionsButton'); - if(!OC_FILES.browser.moreActionsShown){ - button.appendChild(div); - OC_FILES.browser.moreActionsShown=true; - button.className='moreActionsButton moreActionsButtonClicked'; - }else{ - OC_FILES.browser.moreActionsShown=false; - button.removeChild(div); - button.className='moreActionsButton'; - } -} - -OC_FILES.browser.newFile=function(event){ - if(event.preventDefault){ - event.preventDefault(); - }; - var typeSelect=document.getElementById('newFileType'); - var type=typeSelect.options[typeSelect.selectedIndex].value; - var name=document.getElementById('newFileName').value; - OC_FILES.newFile(type,name,OC_FILES.dir); - return false; -} - -OC_FILES.browser.showicon=function(filetype){ - var td=document.createElement('td'); - td.className='fileicon'; - var img=document.createElement('img'); - td.appendChild(img); - img.setAttribute('width',16); - img.setAttribute('height',16); - if(filetype=='dir'){ - img.src=WEBROOT+'/img/icons/folder.png'; - }else if(filetype=='incomplete'){ - img.src=WEBROOT+'/img/icons/loading.gif'; - }else{ - img.src=WEBROOT+'/img/icons/other.png'; - } - return td; -} - -OC_FILES.uploadIFrames=Array(); -OC_FILES.browser.showuploader=function(dir,parent,max_upload){ - var iframeId=OC_FILES.uploadIFrames.length - OC_FILES.uploadForm=document.createElement('form'); - OC_FILES.uploadForm.setAttribute('target','uploadIFrame'+iframeId); - OC_FILES.uploadForm.setAttribute('action','files/upload.php?dir='+encodeURIComponent(dir)); - OC_FILES.uploadForm.method='post'; - OC_FILES.uploadForm.setAttribute('enctype','multipart/form-data'); - OC_FILES.uploadIFrames[iframeId]=document.createElement('iframe'); - OC_FILES.uploadIFrames[iframeId].uploadParent=parent; - OC_FILES.uploadIFrames[iframeId].className='hidden'; - OC_FILES.uploadIFrames[iframeId].name='uploadIFrame'+iframeId; - var input=document.createElement('input'); - input.setAttribute('type','hidden'); - input.setAttribute('name','MAX_FILE_SIZE'); - input.setAttribute('value',max_upload); - input.setAttribute('id','max_upload'); - OC_FILES.uploadForm.appendChild(input); - var file=document.createElement('input'); - file.name='file'; - file.setAttribute('id','fileSelector'); - file.setAttribute('type','file'); - file.addEvent('onchange',OC_FILES.upload.bind(iframeId)); - OC_FILES.uploadForm.appendChild(document.createTextNode('Upload file: ')); - OC_FILES.uploadForm.appendChild(file); - parent.appendChild(OC_FILES.uploadForm); - var body=document.getElementsByTagName('body').item(0); - body.appendChild(OC_FILES.uploadIFrames[iframeId]); -} - -OC_FILES.browser.show_rename=function(dir,file){ - var item=document.getElementById(file); - item.oldContent=Array(); - if(item.hasChildNodes()){ - while(item.childNodes.length >=1){ - item.oldContent[item.oldContent.length]=item.firstChild; - item.removeChild(item.firstChild); - } - } - var form=document.createElement('form'); - form.addEvent('onsubmit',OC_FILES.rename.bind(dir).bind(file)); - var input=document.createElement('input'); - input.setAttribute('type','text'); - input.setAttribute('name','newname'); - input.setAttribute('value',file); - input.setAttribute('id',file+'_newname') - input.addEvent('onblur',OC_FILES.browser.rename_cancel.bind(file)); - form.appendChild(input); - item.appendChild(form); - input.focus(); -} - -OC_FILES.browser.rename_cancel=function(file){ - var item=document.getElementsByName(file).item(0); - if(item.hasChildNodes()){ - while(item.childNodes.length >=1){ - item.removeChild(item.firstChild); - } - } - for(index in item.oldContent){ - if(item.oldContent[index].nodeType){ - item.appendChild(item.oldContent[index]); - } - } -} - -OC_FILES.browser.showactions=function(file,hide){ - var node=document.getElementById(file); - if(node &&(node.actionsshown || hide===true)){ - if(node.actionsshown){ - node.actionsdiv.parentNode.removeChild(node.actionsdiv); - } - node.actionsdiv=null; - node.actionsshown=false - }else if(node){ - node.actionsshown=true - div=document.createElement('div'); - node.actionsdiv=div; - div.className='fileactionlist'; - table=document.createElement('table'); - div.appendChild(table); - tbody=document.createElement('tbody'); - table.appendChild(tbody); - var file=OC_FILES.files[file] - var actions=file.actions; - var name; - for(name in actions){ - if(actions[name].call && name!='default' && name!='dropOn' && name!='drop'){ - tr=document.createElement('tr'); - tbody.appendChild(tr); - td=document.createElement('td'); - tr.appendChild(td); - a=document.createElement('a'); - td.appendChild(a); - a.appendChild(document.createTextNode(capitaliseFirstLetter(name))); - var action=actions[name]; - td.addEvent('onclick',action.bindScope(file)); - } - } - node.appendChild(div); - OC_FILES.hideallenabled=false; - setTimeout('OC_FILES.hideallenabled=true',50); - } -} - -OC_FILES.browser.hideallactions=function(){ - if(OC_FILES.hideallenabled){ - for(name in OC_FILES.files){ - if(OC_FILES.files[name]){ - if(OC_FILES.files[name].hideactions){ - OC_FILES.files[name].hideactions.call(OC_FILES.files[name]); - } - } - } - } -} - -OC_FILES.hideallenabled=true; //used to prevent browsers from hiding actionslists right after they are displayed; - -sizeFormat=function(size){ - if(isNaN(size)){ - return false; - } - var orig=size; - var steps=Array('B','KiB','MiB','GiB','TiB'); - var step=0; - while(size>(1024*2)){ - step++; - size=size/1024; - } - if(size.toFixed){ - size=size.toFixed(2); - } - return ''+size+' '+steps[step]; -} - -OC_FILES.browser.showImage=function(dir,file){ - var path=WEBROOT+'/files/open_file.php?dir='+encodeURIComponent(dir)+'&file='+encodeURIComponent(file); - var div=document.createElement('div'); - div.setAttribute('id','imageframe'); - div.addEvent('onclick',OC_FILES.browser.hideImage) - var img=document.createElement('img'); - img.setAttribute('src',path); - div.appendChild(img); - body=document.getElementsByTagName('body').item(0); - body.appendChild(div); -} - -OC_FILES.browser.hideImage=function(){ - var div=document.getElementById('imageframe'); - div.parentNode.removeChild(div); -} - -function capitaliseFirstLetter(string){ - return string.charAt(0).toUpperCase() + string.slice(1); -} \ No newline at end of file diff --git a/js/jquery-1.5.min.js b/js/jquery-1.5.min.js new file mode 100644 index 0000000000000000000000000000000000000000..9144b8ae98c7a899c40ddb0cd864ecac72475020 --- /dev/null +++ b/js/jquery-1.5.min.js @@ -0,0 +1,16 @@ +/*! + * jQuery JavaScript Library v1.5 + * http://jquery.com/ + * + * Copyright 2011, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2011, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Mon Jan 31 08:31:29 2011 -0500 + */ +(function(a,b){function b$(a){return d.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function bX(a){if(!bR[a]){var b=d("<"+a+">").appendTo("body"),c=b.css("display");b.remove();if(c==="none"||c==="")c="block";bR[a]=c}return bR[a]}function bW(a,b){var c={};d.each(bV.concat.apply([],bV.slice(0,b)),function(){c[this]=a});return c}function bJ(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var e=a.dataTypes,f=a.converters,g,h=e.length,i,j=e[0],k,l,m,n,o;for(g=1;g<h;g++){k=j,j=e[g];if(j==="*")j=k;else if(k!=="*"&&k!==j){l=k+" "+j,m=f[l]||f["* "+j];if(!m){o=b;for(n in f){i=n.split(" ");if(i[0]===k||i[0]==="*"){o=f[i[1]+" "+j];if(o){n=f[n],n===!0?m=o:o===!0&&(m=n);break}}}}!m&&!o&&d.error("No conversion from "+l.replace(" "," to ")),m!==!0&&(c=m?m(c):o(n(c)))}}return c}function bI(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function bH(a,b,c,e){d.isArray(b)&&b.length?d.each(b,function(b,f){c||bp.test(a)?e(a,f):bH(a+"["+(typeof f==="object"||d.isArray(f)?b:"")+"]",f,c,e)}):c||b==null||typeof b!=="object"?e(a,b):d.isArray(b)||d.isEmptyObject(b)?e(a,""):d.each(b,function(b,d){bH(a+"["+b+"]",d,c,e)})}function bG(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bD,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l==="string"&&(g[l]?l=b:(c.dataTypes.unshift(l),l=bG(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bG(a,c,d,e,"*",g));return l}function bF(a){return function(b,c){typeof b!=="string"&&(c=b,b="*");if(d.isFunction(c)){var e=b.toLowerCase().split(bz),f=0,g=e.length,h,i,j;for(;f<g;f++)h=e[f],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bn(a,b,c){var e=b==="width"?bh:bi,f=b==="width"?a.offsetWidth:a.offsetHeight;if(c==="border")return f;d.each(e,function(){c||(f-=parseFloat(d.css(a,"padding"+this))||0),c==="margin"?f+=parseFloat(d.css(a,"margin"+this))||0:f-=parseFloat(d.css(a,"border"+this+"Width"))||0});return f}function _(a,b){b.src?d.ajax({url:b.src,async:!1,dataType:"script"}):d.globalEval(b.text||b.textContent||b.innerHTML||""),b.parentNode&&b.parentNode.removeChild(b)}function $(a,b){if(b.nodeType===1){var c=b.nodeName.toLowerCase();b.clearAttributes(),b.mergeAttributes(a);if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(d.expando)}}function Z(a,b){if(b.nodeType===1&&d.hasData(a)){var c=d.expando,e=d.data(a),f=d.data(b,e);if(e=e[c]){var g=e.events;f=f[c]=d.extend({},e);if(g){delete f.handle,f.events={};for(var h in g)for(var i=0,j=g[h].length;i<j;i++)d.event.add(b,h,g[h][i],g[h][i].data)}}}}function Y(a,b){return d.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function O(a,b,c){if(d.isFunction(b))return d.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return d.grep(a,function(a,d){return a===b===c});if(typeof b==="string"){var e=d.grep(a,function(a){return a.nodeType===1});if(J.test(b))return d.filter(b,e,!c);b=d.filter(b,e)}return d.grep(a,function(a,e){return d.inArray(a,b)>=0===c})}function N(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function F(a,b){return(a&&a!=="*"?a+".":"")+b.replace(q,"`").replace(r,"&")}function E(a){var b,c,e,f,g,h,i,j,k,l,m,n,p,q=[],r=[],s=d._data(this,u);typeof s==="function"&&(s=s.events);if(a.liveFired!==this&&s&&s.live&&!a.target.disabled&&(!a.button||a.type!=="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var t=s.live.slice(0);for(i=0;i<t.length;i++)g=t[i],g.origType.replace(o,"")===a.type?r.push(g.selector):t.splice(i--,1);f=d(a.target).closest(r,a.currentTarget);for(j=0,k=f.length;j<k;j++){m=f[j];for(i=0;i<t.length;i++){g=t[i];if(m.selector===g.selector&&(!n||n.test(g.namespace))){h=m.elem,e=null;if(g.preType==="mouseenter"||g.preType==="mouseleave")a.type=g.preType,e=d(a.relatedTarget).closest(g.selector)[0];(!e||e!==h)&&q.push({elem:h,handleObj:g,level:m.level})}}}for(j=0,k=q.length;j<k;j++){f=q[j];if(c&&f.level>c)break;a.currentTarget=f.elem,a.data=f.handleObj.data,a.handleObj=f.handleObj,p=f.handleObj.origHandler.apply(f.elem,arguments);if(p===!1||a.isPropagationStopped()){c=f.level,p===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function C(a,b,c){c[0].type=a;return d.event.handle.apply(b,c)}function w(){return!0}function v(){return!1}function f(a,c,f){if(f===b&&a.nodeType===1){f=a.getAttribute("data-"+c);if(typeof f==="string"){try{f=f==="true"?!0:f==="false"?!1:f==="null"?null:d.isNaN(f)?e.test(f)?d.parseJSON(f):f:parseFloat(f)}catch(g){}d.data(a,c,f)}else f=b}return f}var c=a.document,d=function(){function I(){if(!d.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(I,1);return}d.ready()}}var d=function(a,b){return new d.fn.init(a,b,g)},e=a.jQuery,f=a.$,g,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,i=/\S/,j=/^\s+/,k=/\s+$/,l=/\d/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=navigator.userAgent,w,x=!1,y,z="then done fail isResolved isRejected promise".split(" "),A,B=Object.prototype.toString,C=Object.prototype.hasOwnProperty,D=Array.prototype.push,E=Array.prototype.slice,F=String.prototype.trim,G=Array.prototype.indexOf,H={};d.fn=d.prototype={constructor:d,init:function(a,e,f){var g,i,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!e&&c.body){this.context=c,this[0]=c.body,this.selector="body",this.length=1;return this}if(typeof a==="string"){g=h.exec(a);if(!g||!g[1]&&e)return!e||e.jquery?(e||f).find(a):this.constructor(e).find(a);if(g[1]){e=e instanceof d?e[0]:e,k=e?e.ownerDocument||e:c,j=m.exec(a),j?d.isPlainObject(e)?(a=[c.createElement(j[1])],d.fn.attr.call(a,e,!0)):a=[k.createElement(j[1])]:(j=d.buildFragment([g[1]],[k]),a=(j.cacheable?d.clone(j.fragment):j.fragment).childNodes);return d.merge(this,a)}i=c.getElementById(g[2]);if(i&&i.parentNode){if(i.id!==g[2])return f.find(a);this.length=1,this[0]=i}this.context=c,this.selector=a;return this}if(d.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return d.makeArray(a,this)},selector:"",jquery:"1.5",length:0,size:function(){return this.length},toArray:function(){return E.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var e=this.constructor();d.isArray(a)?D.apply(e,a):d.merge(e,a),e.prevObject=this,e.context=this.context,b==="find"?e.selector=this.selector+(this.selector?" ":"")+c:b&&(e.selector=this.selector+"."+b+"("+c+")");return e},each:function(a,b){return d.each(this,a,b)},ready:function(a){d.bindReady(),y.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(E.apply(this,arguments),"slice",E.call(arguments).join(","))},map:function(a){return this.pushStack(d.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:D,sort:[].sort,splice:[].splice},d.fn.init.prototype=d.fn,d.extend=d.fn.extend=function(){var a,c,e,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i==="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!=="object"&&!d.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){e=i[c],f=a[c];if(i===f)continue;l&&f&&(d.isPlainObject(f)||(g=d.isArray(f)))?(g?(g=!1,h=e&&d.isArray(e)?e:[]):h=e&&d.isPlainObject(e)?e:{},i[c]=d.extend(l,h,f)):f!==b&&(i[c]=f)}return i},d.extend({noConflict:function(b){a.$=f,b&&(a.jQuery=e);return d},isReady:!1,readyWait:1,ready:function(a){a===!0&&d.readyWait--;if(!d.readyWait||a!==!0&&!d.isReady){if(!c.body)return setTimeout(d.ready,1);d.isReady=!0;if(a!==!0&&--d.readyWait>0)return;y.resolveWith(c,[d]),d.fn.trigger&&d(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!x){x=!0;if(c.readyState==="complete")return setTimeout(d.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",A,!1),a.addEventListener("load",d.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",A),a.attachEvent("onload",d.ready);var b=!1;try{b=a.frameElement==null}catch(e){}c.documentElement.doScroll&&b&&I()}}},isFunction:function(a){return d.type(a)==="function"},isArray:Array.isArray||function(a){return d.type(a)==="array"},isWindow:function(a){return a&&typeof a==="object"&&"setInterval"in a},isNaN:function(a){return a==null||!l.test(a)||isNaN(a)},type:function(a){return a==null?String(a):H[B.call(a)]||"object"},isPlainObject:function(a){if(!a||d.type(a)!=="object"||a.nodeType||d.isWindow(a))return!1;if(a.constructor&&!C.call(a,"constructor")&&!C.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a){}return c===b||C.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!=="string"||!b)return null;b=d.trim(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return a.JSON&&a.JSON.parse?a.JSON.parse(b):(new Function("return "+b))();d.error("Invalid JSON: "+b)},parseXML:function(b,c,e){a.DOMParser?(e=new DOMParser,c=e.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),e=c.documentElement,(!e||!e.nodeName||e.nodeName==="parsererror")&&d.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(a){if(a&&i.test(a)){var b=c.getElementsByTagName("head")[0]||c.documentElement,e=c.createElement("script");e.type="text/javascript",d.support.scriptEval()?e.appendChild(c.createTextNode(a)):e.text=a,b.insertBefore(e,b.firstChild),b.removeChild(e)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,e){var f,g=0,h=a.length,i=h===b||d.isFunction(a);if(e){if(i){for(f in a)if(c.apply(a[f],e)===!1)break}else for(;g<h;)if(c.apply(a[g++],e)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(var j=a[0];g<h&&c.call(j,g,j)!==!1;j=a[++g]){}return a},trim:F?function(a){return a==null?"":F.call(a)}:function(a){return a==null?"":(a+"").replace(j,"").replace(k,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var e=d.type(a);a.length==null||e==="string"||e==="function"||e==="regexp"||d.isWindow(a)?D.call(c,a):d.merge(c,a)}return c},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var c=0,d=b.length;c<d;c++)if(b[c]===a)return c;return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length==="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,b,c){var d=[],e;for(var f=0,g=a.length;f<g;f++)e=b(a[f],f,c),e!=null&&(d[d.length]=e);return d.concat.apply([],d)},guid:1,proxy:function(a,c,e){arguments.length===2&&(typeof c==="string"?(e=a,a=e[c],c=b):c&&!d.isFunction(c)&&(e=c,c=b)),!c&&a&&(c=function(){return a.apply(e||this,arguments)}),a&&(c.guid=a.guid=a.guid||c.guid||d.guid++);return c},access:function(a,c,e,f,g,h){var i=a.length;if(typeof c==="object"){for(var j in c)d.access(a,j,c[j],f,g,e);return a}if(e!==b){f=!h&&f&&d.isFunction(e);for(var k=0;k<i;k++)g(a[k],c,f?e.call(a[k],k,g(a[k],c)):e,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},_Deferred:function(){var a=[],b,c,e,f={done:function(){if(!e){var c=arguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g<h;g++)i=c[g],j=d.type(i),j==="array"?f.done.apply(f,i):j==="function"&&a.push(i);k&&f.resolveWith(k[0],k[1])}return this},resolveWith:function(d,f){if(!e&&!b&&!c){c=1;try{while(a[0])a.shift().apply(d,f)}finally{b=[d,f],c=0}}return this},resolve:function(){f.resolveWith(d.isFunction(this.promise)?this.promise():this,arguments);return this},isResolved:function(){return c||b},cancel:function(){e=1,a=[];return this}};return f},Deferred:function(a){var b=d._Deferred(),c=d._Deferred(),e;d.extend(b,{then:function(a,c){b.done(a).fail(c);return this},fail:c.done,rejectWith:c.resolveWith,reject:c.resolve,isRejected:c.isResolved,promise:function(a,c){if(a==null){if(e)return e;e=a={}}c=z.length;while(c--)a[z[c]]=b[z[c]];return a}}),b.then(c.cancel,b.cancel),delete b.cancel,a&&a.call(b,b);return b},when:function(a){var b=arguments,c=b.length,e=c<=1&&a&&d.isFunction(a.promise)?a:d.Deferred(),f=e.promise(),g;c>1?(g=Array(c),d.each(b,function(a,b){d.when(b).then(function(b){g[a]=arguments.length>1?E.call(arguments,0):b,--c||e.resolveWith(f,g)},e.reject)})):e!==a&&e.resolve(a);return f},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}d.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.subclass=this.subclass,a.fn.init=function b(b,c){c&&c instanceof d&&!(c instanceof a)&&(c=a(c));return d.fn.init.call(this,b,c,e)},a.fn.init.prototype=a.fn;var e=a(c);return a},browser:{}}),y=d._Deferred(),d.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){H["[object "+b+"]"]=b.toLowerCase()}),w=d.uaMatch(v),w.browser&&(d.browser[w.browser]=!0,d.browser.version=w.version),d.browser.webkit&&(d.browser.safari=!0),G&&(d.inArray=function(a,b){return G.call(b,a)}),i.test(" ")&&(j=/^[\s\xA0]+/,k=/[\s\xA0]+$/),g=d(c),c.addEventListener?A=function(){c.removeEventListener("DOMContentLoaded",A,!1),d.ready()}:c.attachEvent&&(A=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",A),d.ready())});return a.jQuery=a.$=d}();(function(){d.support={};var b=c.createElement("div");b.style.display="none",b.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var e=b.getElementsByTagName("*"),f=b.getElementsByTagName("a")[0],g=c.createElement("select"),h=g.appendChild(c.createElement("option"));if(e&&e.length&&f){d.support={leadingWhitespace:b.firstChild.nodeType===3,tbody:!b.getElementsByTagName("tbody").length,htmlSerialize:!!b.getElementsByTagName("link").length,style:/red/.test(f.getAttribute("style")),hrefNormalized:f.getAttribute("href")==="/a",opacity:/^0.55$/.test(f.style.opacity),cssFloat:!!f.style.cssFloat,checkOn:b.getElementsByTagName("input")[0].value==="on",optSelected:h.selected,deleteExpando:!0,optDisabled:!1,checkClone:!1,_scriptEval:null,noCloneEvent:!0,boxModel:null,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableHiddenOffsets:!0},g.disabled=!0,d.support.optDisabled=!h.disabled,d.support.scriptEval=function(){if(d.support._scriptEval===null){var b=c.documentElement,e=c.createElement("script"),f="script"+d.now();e.type="text/javascript";try{e.appendChild(c.createTextNode("window."+f+"=1;"))}catch(g){}b.insertBefore(e,b.firstChild),a[f]?(d.support._scriptEval=!0,delete a[f]):d.support._scriptEval=!1,b.removeChild(e),b=e=f=null}return d.support._scriptEval};try{delete b.test}catch(i){d.support.deleteExpando=!1}b.attachEvent&&b.fireEvent&&(b.attachEvent("onclick",function j(){d.support.noCloneEvent=!1,b.detachEvent("onclick",j)}),b.cloneNode(!0).fireEvent("onclick")),b=c.createElement("div"),b.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";var k=c.createDocumentFragment();k.appendChild(b.firstChild),d.support.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,d(function(){var a=c.createElement("div"),b=c.getElementsByTagName("body")[0];if(b){a.style.width=a.style.paddingLeft="1px",b.appendChild(a),d.boxModel=d.support.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,d.support.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="<div style='width:4px;'></div>",d.support.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";var e=a.getElementsByTagName("td");d.support.reliableHiddenOffsets=e[0].offsetHeight===0,e[0].style.display="",e[1].style.display="none",d.support.reliableHiddenOffsets=d.support.reliableHiddenOffsets&&e[0].offsetHeight===0,a.innerHTML="",b.removeChild(a).style.display="none",a=e=null}});var l=function(a){var b=c.createElement("div");a="on"+a;if(!b.attachEvent)return!0;var d=a in b;d||(b.setAttribute(a,"return;"),d=typeof b[a]==="function"),b=null;return d};d.support.submitBubbles=l("submit"),d.support.changeBubbles=l("change"),b=e=f=null}})();var e=/^(?:\{.*\}|\[.*\])$/;d.extend({cache:{},uuid:0,expando:"jQuery"+(d.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?d.cache[a[d.expando]]:a[d.expando];return!!a&&!d.isEmptyObject(a)},data:function(a,c,e,f){if(d.acceptData(a)){var g=d.expando,h=typeof c==="string",i,j=a.nodeType,k=j?d.cache:a,l=j?a[d.expando]:a[d.expando]&&d.expando;if((!l||f&&l&&!k[l][g])&&h&&e===b)return;l||(j?a[d.expando]=l=++d.uuid:l=d.expando),k[l]||(k[l]={}),typeof c==="object"&&(f?k[l][g]=d.extend(k[l][g],c):k[l]=d.extend(k[l],c)),i=k[l],f&&(i[g]||(i[g]={}),i=i[g]),e!==b&&(i[c]=e);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[c]:i}},removeData:function(b,c,e){if(d.acceptData(b)){var f=d.expando,g=b.nodeType,h=g?d.cache:b,i=g?b[d.expando]:d.expando;if(!h[i])return;if(c){var j=e?h[i][f]:h[i];if(j){delete j[c];if(!d.isEmptyObject(j))return}}if(e){delete h[i][f];if(!d.isEmptyObject(h[i]))return}var k=h[i][f];d.support.deleteExpando||h!=a?delete h[i]:h[i]=null,k?(h[i]={},h[i][f]=k):g&&(d.support.deleteExpando?delete b[d.expando]:b.removeAttribute?b.removeAttribute(d.expando):b[d.expando]=null)}},_data:function(a,b,c){return d.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=d.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),d.fn.extend({data:function(a,c){var e=null;if(typeof a==="undefined"){if(this.length){e=d.data(this[0]);if(this[0].nodeType===1){var g=this[0].attributes,h;for(var i=0,j=g.length;i<j;i++)h=g[i].name,h.indexOf("data-")===0&&(h=h.substr(5),f(this[0],h,e[h]))}}return e}if(typeof a==="object")return this.each(function(){d.data(this,a)});var k=a.split(".");k[1]=k[1]?"."+k[1]:"";if(c===b){e=this.triggerHandler("getData"+k[1]+"!",[k[0]]),e===b&&this.length&&(e=d.data(this[0],a),e=f(this[0],a,e));return e===b&&k[1]?this.data(k[0]):e}return this.each(function(){var b=d(this),e=[k[0],c];b.triggerHandler("setData"+k[1]+"!",e),d.data(this,a,c),b.triggerHandler("changeData"+k[1]+"!",e)})},removeData:function(a){return this.each(function(){d.removeData(this,a)})}}),d.extend({queue:function(a,b,c){if(a){b=(b||"fx")+"queue";var e=d._data(a,b);if(!c)return e||[];!e||d.isArray(c)?e=d._data(a,b,d.makeArray(c)):e.push(c);return e}},dequeue:function(a,b){b=b||"fx";var c=d.queue(a,b),e=c.shift();e==="inprogress"&&(e=c.shift()),e&&(b==="fx"&&c.unshift("inprogress"),e.call(a,function(){d.dequeue(a,b)})),c.length||d.removeData(a,b+"queue",!0)}}),d.fn.extend({queue:function(a,c){typeof a!=="string"&&(c=a,a="fx");if(c===b)return d.queue(this[0],a);return this.each(function(b){var e=d.queue(this,a,c);a==="fx"&&e[0]!=="inprogress"&&d.dequeue(this,a)})},dequeue:function(a){return this.each(function(){d.dequeue(this,a)})},delay:function(a,b){a=d.fx?d.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(){var c=this;setTimeout(function(){d.dequeue(c,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var g=/[\n\t\r]/g,h=/\s+/,i=/\r/g,j=/^(?:href|src|style)$/,k=/^(?:button|input)$/i,l=/^(?:button|input|object|select|textarea)$/i,m=/^a(?:rea)?$/i,n=/^(?:radio|checkbox)$/i;d.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"},d.fn.extend({attr:function(a,b){return d.access(this,a,b,!0,d.attr)},removeAttr:function(a,b){return this.each(function(){d.attr(this,a,""),this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(d.isFunction(a))return this.each(function(b){var c=d(this);c.addClass(a.call(this,b,c.attr("class")))});if(a&&typeof a==="string"){var b=(a||"").split(h);for(var c=0,e=this.length;c<e;c++){var f=this[c];if(f.nodeType===1)if(f.className){var g=" "+f.className+" ",i=f.className;for(var j=0,k=b.length;j<k;j++)g.indexOf(" "+b[j]+" ")<0&&(i+=" "+b[j]);f.className=d.trim(i)}else f.className=a}}return this},removeClass:function(a){if(d.isFunction(a))return this.each(function(b){var c=d(this);c.removeClass(a.call(this,b,c.attr("class")))});if(a&&typeof a==="string"||a===b){var c=(a||"").split(h);for(var e=0,f=this.length;e<f;e++){var i=this[e];if(i.nodeType===1&&i.className)if(a){var j=(" "+i.className+" ").replace(g," ");for(var k=0,l=c.length;k<l;k++)j=j.replace(" "+c[k]+" "," ");i.className=d.trim(j)}else i.className=""}}return this},toggleClass:function(a,b){var c=typeof a,e=typeof b==="boolean";if(d.isFunction(a))return this.each(function(c){var e=d(this);e.toggleClass(a.call(this,c,e.attr("class"),b),b)});return this.each(function(){if(c==="string"){var f,g=0,i=d(this),j=b,k=a.split(h);while(f=k[g++])j=e?j:!i.hasClass(f),i[j?"addClass":"removeClass"](f)}else if(c==="undefined"||c==="boolean")this.className&&d._data(this,"__className__",this.className),this.className=this.className||a===!1?"":d._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ";for(var c=0,d=this.length;c<d;c++)if((" "+this[c].className+" ").replace(g," ").indexOf(b)>-1)return!0;return!1},val:function(a){if(!arguments.length){var c=this[0];if(c){if(d.nodeName(c,"option")){var e=c.attributes.value;return!e||e.specified?c.value:c.text}if(d.nodeName(c,"select")){var f=c.selectedIndex,g=[],h=c.options,j=c.type==="select-one";if(f<0)return null;for(var k=j?f:0,l=j?f+1:h.length;k<l;k++){var m=h[k];if(m.selected&&(d.support.optDisabled?!m.disabled:m.getAttribute("disabled")===null)&&(!m.parentNode.disabled||!d.nodeName(m.parentNode,"optgroup"))){a=d(m).val();if(j)return a;g.push(a)}}return g}if(n.test(c.type)&&!d.support.checkOn)return c.getAttribute("value")===null?"on":c.value;return(c.value||"").replace(i,"")}return b}var o=d.isFunction(a);return this.each(function(b){var c=d(this),e=a;if(this.nodeType===1){o&&(e=a.call(this,b,c.val())),e==null?e="":typeof e==="number"?e+="":d.isArray(e)&&(e=d.map(e,function(a){return a==null?"":a+""}));if(d.isArray(e)&&n.test(this.type))this.checked=d.inArray(c.val(),e)>=0;else if(d.nodeName(this,"select")){var f=d.makeArray(e);d("option",this).each(function(){this.selected=d.inArray(d(this).val(),f)>=0}),f.length||(this.selectedIndex=-1)}else this.value=e}})}}),d.extend({attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,e,f){if(!a||a.nodeType===3||a.nodeType===8||a.nodeType===2)return b;if(f&&c in d.attrFn)return d(a)[c](e);var g=a.nodeType!==1||!d.isXMLDoc(a),h=e!==b;c=g&&d.props[c]||c;if(a.nodeType===1){var i=j.test(c);if(c==="selected"&&!d.support.optSelected){var n=a.parentNode;n&&(n.selectedIndex,n.parentNode&&n.parentNode.selectedIndex)}if((c in a||a[c]!==b)&&g&&!i){h&&(c==="type"&&k.test(a.nodeName)&&a.parentNode&&d.error("type property can't be changed"),e===null?a.nodeType===1&&a.removeAttribute(c):a[c]=e);if(d.nodeName(a,"form")&&a.getAttributeNode(c))return a.getAttributeNode(c).nodeValue;if(c==="tabIndex"){var o=a.getAttributeNode("tabIndex");return o&&o.specified?o.value:l.test(a.nodeName)||m.test(a.nodeName)&&a.href?0:b}return a[c]}if(!d.support.style&&g&&c==="style"){h&&(a.style.cssText=""+e);return a.style.cssText}h&&a.setAttribute(c,""+e);if(!a.attributes[c]&&(a.hasAttribute&&!a.hasAttribute(c)))return b;var p=!d.support.hrefNormalized&&g&&i?a.getAttribute(c,2):a.getAttribute(c);return p===null?b:p}h&&(a[c]=e);return a[c]}});var o=/\.(.*)$/,p=/^(?:textarea|input|select)$/i,q=/\./g,r=/ /g,s=/[^\w\s.|`]/g,t=function(a){return a.replace(s,"\\$&")},u="events";d.event={add:function(c,e,f,g){if(c.nodeType!==3&&c.nodeType!==8){d.isWindow(c)&&(c!==a&&!c.frameElement)&&(c=a);if(f===!1)f=v;else if(!f)return;var h,i;f.handler&&(h=f,f=h.handler),f.guid||(f.guid=d.guid++);var j=d._data(c);if(!j)return;var k=j[u],l=j.handle;typeof k==="function"?(l=k.handle,k=k.events):k||(c.nodeType||(j[u]=j=function(){}),j.events=k={}),l||(j.handle=l=function(){return typeof d!=="undefined"&&!d.event.triggered?d.event.handle.apply(l.elem,arguments):b}),l.elem=c,e=e.split(" ");var m,n=0,o;while(m=e[n++]){i=h?d.extend({},h):{handler:f,data:g},m.indexOf(".")>-1?(o=m.split("."),m=o.shift(),i.namespace=o.slice(0).sort().join(".")):(o=[],i.namespace=""),i.type=m,i.guid||(i.guid=f.guid);var p=k[m],q=d.event.special[m]||{};if(!p){p=k[m]=[];if(!q.setup||q.setup.call(c,g,o,l)===!1)c.addEventListener?c.addEventListener(m,l,!1):c.attachEvent&&c.attachEvent("on"+m,l)}q.add&&(q.add.call(c,i),i.handler.guid||(i.handler.guid=f.guid)),p.push(i),d.event.global[m]=!0}c=null}},global:{},remove:function(a,c,e,f){if(a.nodeType!==3&&a.nodeType!==8){e===!1&&(e=v);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=d.hasData(a)&&d._data(a),w=s&&s[u];if(!s||!w)return;typeof w==="function"&&(s=w,w=w.events),c&&c.type&&(e=c.handler,c=c.type);if(!c||typeof c==="string"&&c.charAt(0)==="."){c=c||"";for(h in w)d.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+d.map(m.slice(0).sort(),t).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=w[h];if(!p)continue;if(!e){for(j=0;j<p.length;j++){q=p[j];if(l||n.test(q.namespace))d.event.remove(a,r,q.handler,j),p.splice(j--,1)}continue}o=d.event.special[h]||{};for(j=f||0;j<p.length;j++){q=p[j];if(e.guid===q.guid){if(l||n.test(q.namespace))f==null&&p.splice(j--,1),o.remove&&o.remove.call(a,q);if(f!=null)break}}if(p.length===0||f!=null&&p.length===1)(!o.teardown||o.teardown.call(a,m)===!1)&&d.removeEvent(a,h,s.handle),g=null,delete w[h]}if(d.isEmptyObject(w)){var x=s.handle;x&&(x.elem=null),delete s.events,delete s.handle,typeof s==="function"?d.removeData(a,u,!0):d.isEmptyObject(s)&&d.removeData(a,b,!0)}}},trigger:function(a,c,e){var f=a.type||a,g=arguments[3];if(!g){a=typeof a==="object"?a[d.expando]?a:d.extend(d.Event(f),a):d.Event(f),f.indexOf("!")>=0&&(a.type=f=f.slice(0,-1),a.exclusive=!0),e||(a.stopPropagation(),d.event.global[f]&&d.each(d.cache,function(){var b=d.expando,e=this[b];e&&e.events&&e.events[f]&&d.event.trigger(a,c,e.handle.elem)}));if(!e||e.nodeType===3||e.nodeType===8)return b;a.result=b,a.target=e,c=d.makeArray(c),c.unshift(a)}a.currentTarget=e;var h=e.nodeType?d._data(e,"handle"):(d._data(e,u)||{}).handle;h&&h.apply(e,c);var i=e.parentNode||e.ownerDocument;try{e&&e.nodeName&&d.noData[e.nodeName.toLowerCase()]||e["on"+f]&&e["on"+f].apply(e,c)===!1&&(a.result=!1,a.preventDefault())}catch(j){}if(!a.isPropagationStopped()&&i)d.event.trigger(a,c,i,!0);else if(!a.isDefaultPrevented()){var k,l=a.target,m=f.replace(o,""),n=d.nodeName(l,"a")&&m==="click",p=d.event.special[m]||{};if((!p._default||p._default.call(e,a)===!1)&&!n&&!(l&&l.nodeName&&d.noData[l.nodeName.toLowerCase()])){try{l[m]&&(k=l["on"+m],k&&(l["on"+m]=null),d.event.triggered=!0,l[m]())}catch(q){}k&&(l["on"+m]=k),d.event.triggered=!1}}},handle:function(c){var e,f,g,h,i,j=[],k=d.makeArray(arguments);c=k[0]=d.event.fix(c||a.event),c.currentTarget=this,e=c.type.indexOf(".")<0&&!c.exclusive,e||(g=c.type.split("."),c.type=g.shift(),j=g.slice(0).sort(),h=new RegExp("(^|\\.)"+j.join("\\.(?:.*\\.)?")+"(\\.|$)")),c.namespace=c.namespace||j.join("."),i=d._data(this,u),typeof i==="function"&&(i=i.events),f=(i||{})[c.type];if(i&&f){f=f.slice(0);for(var l=0,m=f.length;l<m;l++){var n=f[l];if(e||h.test(n.namespace)){c.handler=n.handler,c.data=n.data,c.handleObj=n;var o=n.handler.apply(this,k);o!==b&&(c.result=o,o===!1&&(c.preventDefault(),c.stopPropagation()));if(c.isImmediatePropagationStopped())break}}}return c.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a){if(a[d.expando])return a;var e=a;a=d.Event(e);for(var f=this.props.length,g;f;)g=this.props[--f],a[g]=e[g];a.target||(a.target=a.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),!a.relatedTarget&&a.fromElement&&(a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement);if(a.pageX==null&&a.clientX!=null){var h=c.documentElement,i=c.body;a.pageX=a.clientX+(h&&h.scrollLeft||i&&i.scrollLeft||0)-(h&&h.clientLeft||i&&i.clientLeft||0),a.pageY=a.clientY+(h&&h.scrollTop||i&&i.scrollTop||0)-(h&&h.clientTop||i&&i.clientTop||0)}a.which==null&&(a.charCode!=null||a.keyCode!=null)&&(a.which=a.charCode!=null?a.charCode:a.keyCode),!a.metaKey&&a.ctrlKey&&(a.metaKey=a.ctrlKey),!a.which&&a.button!==b&&(a.which=a.button&1?1:a.button&2?3:a.button&4?2:0);return a},guid:1e8,proxy:d.proxy,special:{ready:{setup:d.bindReady,teardown:d.noop},live:{add:function(a){d.event.add(this,F(a.origType,a.selector),d.extend({},a,{handler:E,guid:a.handler.guid}))},remove:function(a){d.event.remove(this,F(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,c){d.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}}},d.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},d.Event=function(a){if(!this.preventDefault)return new d.Event(a);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?w:v):this.type=a,this.timeStamp=d.now(),this[d.expando]=!0},d.Event.prototype={preventDefault:function(){this.isDefaultPrevented=w;var a=this.originalEvent;a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=w;var a=this.originalEvent;a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=w,this.stopPropagation()},isDefaultPrevented:v,isPropagationStopped:v,isImmediatePropagationStopped:v};var x=function(a){var b=a.relatedTarget;try{while(b&&b!==this)b=b.parentNode;b!==this&&(a.type=a.data,d.event.handle.apply(this,arguments))}catch(c){}},y=function(a){a.type=a.data,d.event.handle.apply(this,arguments)};d.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){d.event.special[a]={setup:function(c){d.event.add(this,b,c&&c.selector?y:x,a)},teardown:function(a){d.event.remove(this,b,a&&a.selector?y:x)}}}),d.support.submitBubbles||(d.event.special.submit={setup:function(a,c){if(this.nodeName&&this.nodeName.toLowerCase()!=="form")d.event.add(this,"click.specialSubmit",function(a){var c=a.target,e=c.type;if((e==="submit"||e==="image")&&d(c).closest("form").length){a.liveFired=b;return C("submit",this,arguments)}}),d.event.add(this,"keypress.specialSubmit",function(a){var c=a.target,e=c.type;if((e==="text"||e==="password")&&d(c).closest("form").length&&a.keyCode===13){a.liveFired=b;return C("submit",this,arguments)}});else return!1},teardown:function(a){d.event.remove(this,".specialSubmit")}});if(!d.support.changeBubbles){var z,A=function(a){var b=a.type,c=a.value;b==="radio"||b==="checkbox"?c=a.checked:b==="select-multiple"?c=a.selectedIndex>-1?d.map(a.options,function(a){return a.selected}).join("-"):"":a.nodeName.toLowerCase()==="select"&&(c=a.selectedIndex);return c},B=function B(a){var c=a.target,e,f;if(p.test(c.nodeName)&&!c.readOnly){e=d._data(c,"_change_data"),f=A(c),(a.type!=="focusout"||c.type!=="radio")&&d._data(c,"_change_data",f);if(e===b||f===e)return;if(e!=null||f){a.type="change",a.liveFired=b;return d.event.trigger(a,arguments[1],c)}}};d.event.special.change={filters:{focusout:B,beforedeactivate:B,click:function(a){var b=a.target,c=b.type;if(c==="radio"||c==="checkbox"||b.nodeName.toLowerCase()==="select")return B.call(this,a)},keydown:function(a){var b=a.target,c=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")return B.call(this,a)},beforeactivate:function(a){var b=a.target;d._data(b,"_change_data",A(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in z)d.event.add(this,c+".specialChange",z[c]);return p.test(this.nodeName)},teardown:function(a){d.event.remove(this,".specialChange");return p.test(this.nodeName)}},z=d.event.special.change.filters,z.focus=z.beforeactivate}c.addEventListener&&d.each({focus:"focusin",blur:"focusout"},function(a,b){function c(a){a=d.event.fix(a),a.type=b;return d.event.handle.call(this,a)}d.event.special[b]={setup:function(){this.addEventListener(a,c,!0)},teardown:function(){this.removeEventListener(a,c,!0)}}}),d.each(["bind","one"],function(a,c){d.fn[c]=function(a,e,f){if(typeof a==="object"){for(var g in a)this[c](g,e,a[g],f);return this}if(d.isFunction(e)||e===!1)f=e,e=b;var h=c==="one"?d.proxy(f,function(a){d(this).unbind(a,h);return f.apply(this,arguments)}):f;if(a==="unload"&&c!=="one")this.one(a,e,f);else for(var i=0,j=this.length;i<j;i++)d.event.add(this[i],a,h,e);return this}}),d.fn.extend({unbind:function(a,b){if(typeof a!=="object"||a.preventDefault)for(var e=0,f=this.length;e<f;e++)d.event.remove(this[e],a,b);else for(var c in a)this.unbind(c,a[c]);return this},delegate:function(a,b,c,d){return this.live(b,c,d,a)},undelegate:function(a,b,c){return arguments.length===0?this.unbind("live"):this.die(b,null,c,a)},trigger:function(a,b){return this.each(function(){d.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){var c=d.Event(a);c.preventDefault(),c.stopPropagation(),d.event.trigger(c,b,this[0]);return c.result}},toggle:function(a){var b=arguments,c=1;while(c<b.length)d.proxy(a,b[c++]);return this.click(d.proxy(a,function(e){var f=(d._data(this,"lastToggle"+a.guid)||0)%c;d._data(this,"lastToggle"+a.guid,f+1),e.preventDefault();return b[f].apply(this,arguments)||!1}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var D={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};d.each(["live","die"],function(a,c){d.fn[c]=function(a,e,f,g){var h,i=0,j,k,l,m=g||this.selector,n=g?this:d(this.context);if(typeof a==="object"&&!a.preventDefault){for(var p in a)n[c](p,e,a[p],m);return this}d.isFunction(e)&&(f=e,e=b),a=(a||"").split(" ");while((h=a[i++])!=null){j=o.exec(h),k="",j&&(k=j[0],h=h.replace(o,""));if(h==="hover"){a.push("mouseenter"+k,"mouseleave"+k);continue}l=h,h==="focus"||h==="blur"?(a.push(D[h]+k),h=h+k):h=(D[h]||h)+k;if(c==="live")for(var q=0,r=n.length;q<r;q++)d.event.add(n[q],"live."+F(h,m),{data:e,selector:m,handler:f,origType:h,origHandler:f,preType:l});else n.unbind("live."+F(h,m),f)}return this}}),d.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){d.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.bind(b,a,c):this.trigger(b)},d.attrFn&&(d.attrFn[b]=!0)}),function(){function s(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var j=d[g];if(j){var k=!1;j=j[a];while(j){if(j.sizcache===c){k=d[j.sizset];break}if(j.nodeType===1){f||(j.sizcache=c,j.sizset=g);if(typeof b!=="string"){if(j===b){k=!0;break}}else if(i.filter(b,[j]).length>0){k=j;break}}j=j[a]}d[g]=k}}}function r(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}i.nodeType===1&&!f&&(i.sizcache=c,i.sizset=g);if(i.nodeName.toLowerCase()===b){j=i;break}i=i[a]}d[g]=j}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,g=!1,h=!0;[0,0].sort(function(){h=!1;return 0});var i=function(b,d,e,g){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!=="string")return e;var l,m,o,p,q,r,s,u,v=!0,w=i.isXML(d),x=[],y=b;do{a.exec(""),l=a.exec(y);if(l){y=l[3],x.push(l[1]);if(l[2]){p=l[3];break}}}while(l);if(x.length>1&&k.exec(b))if(x.length===2&&j.relative[x[0]])m=t(x[0]+x[1],d);else{m=j.relative[x[0]]?[d]:i(x.shift(),d);while(x.length)b=x.shift(),j.relative[b]&&(b+=x.shift()),m=t(b,m)}else{!g&&x.length>1&&d.nodeType===9&&!w&&j.match.ID.test(x[0])&&!j.match.ID.test(x[x.length-1])&&(q=i.find(x.shift(),d,w),d=q.expr?i.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:n(g)}:i.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),m=q.expr?i.filter(q.expr,q.set):q.set,x.length>0?o=n(m):v=!1;while(x.length)r=x.pop(),s=r,j.relative[r]?s=x.pop():r="",s==null&&(s=d),j.relative[r](o,s,w)}else o=x=[]}o||(o=m),o||i.error(r||b);if(f.call(o)==="[object Array]")if(v)if(d&&d.nodeType===1)for(u=0;o[u]!=null;u++)o[u]&&(o[u]===!0||o[u].nodeType===1&&i.contains(d,o[u]))&&e.push(m[u]);else for(u=0;o[u]!=null;u++)o[u]&&o[u].nodeType===1&&e.push(m[u]);else e.push.apply(e,o);else n(o,e);p&&(i(p,h,e,g),i.uniqueSort(e));return e};i.uniqueSort=function(a){if(p){g=h,a.sort(p);if(g)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},i.matches=function(a,b){return i(a,null,null,b)},i.matchesSelector=function(a,b){return i(b,null,null,[a]).length>0},i.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=j.order.length;e<f;e++){var g,h=j.order[e];if(g=j.leftMatch[h].exec(a)){var i=g[1];g.splice(1,1);if(i.substr(i.length-1)!=="\\"){g[1]=(g[1]||"").replace(/\\/g,""),d=j.find[h](g,b,c);if(d!=null){a=a.replace(j.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!=="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},i.filter=function(a,c,d,e){var f,g,h=a,k=[],l=c,m=c&&c[0]&&i.isXML(c[0]);while(a&&c.length){for(var n in j.filter)if((f=j.leftMatch[n].exec(a))!=null&&f[2]){var o,p,q=j.filter[n],r=f[1];g=!1,f.splice(1,1);if(r.substr(r.length-1)==="\\")continue;l===k&&(k=[]);if(j.preFilter[n]){f=j.preFilter[n](f,l,d,k,e,m);if(f){if(f===!0)continue}else g=o=!0}if(f)for(var s=0;(p=l[s])!=null;s++)if(p){o=q(p,f,s,l);var t=e^!!o;d&&o!=null?t?g=!0:l[s]=!1:t&&(k.push(p),g=!0)}if(o!==b){d||(l=k),a=a.replace(j.match[n],"");if(!g)return[];break}}if(a===h)if(g==null)i.error(a);else break;h=a}return l},i.error=function(a){throw"Syntax error, unrecognized expression: "+a};var j=i.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")}},relative:{"+":function(a,b){var c=typeof b==="string",d=c&&!/\W/.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1){}a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&i.filter(b,a,!0)},">":function(a,b){var c,d=typeof b==="string",e=0,f=a.length;if(d&&!/\W/.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&i.filter(b,a,!0)}},"":function(a,b,c){var d,f=e++,g=s;typeof b==="string"&&!/\W/.test(b)&&(b=b.toLowerCase(),d=b,g=r),g("parentNode",b,f,a,d,c)},"~":function(a,b,c){var d,f=e++,g=s;typeof b==="string"&&!/\W/.test(b)&&(b=b.toLowerCase(),d=b,g=r),g("previousSibling",b,f,a,d,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!=="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!=="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!=="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(/\\/g,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(/\\/g,"")},TAG:function(a,b){return a[1].toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||i.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&i.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(/\\/g,"");!f&&j.attrMap[g]&&(a[1]=j.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(/\\/g,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=i(b[3],null,null,c);else{var g=i.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(j.match.POS.test(b[0])||j.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!i(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){return"text"===a.type},radio:function(a){return"radio"===a.type},checkbox:function(a){return"checkbox"===a.type},file:function(a){return"file"===a.type},password:function(a){return"password"===a.type},submit:function(a){return"submit"===a.type},image:function(a){return"image"===a.type},reset:function(a){return"reset"===a.type},button:function(a){return"button"===a.type||a.nodeName.toLowerCase()==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=j.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||i.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,k=g.length;h<k;h++)if(g[h]===a)return!1;return!0}i.error(e)},CHILD:function(a,b){var c=b[1],d=a;switch(c){case"only":case"first":while(d=d.previousSibling)if(d.nodeType===1)return!1;if(c==="first")return!0;d=a;case"last":while(d=d.nextSibling)if(d.nodeType===1)return!1;return!0;case"nth":var e=b[2],f=b[3];if(e===1&&f===0)return!0;var g=b[0],h=a.parentNode;if(h&&(h.sizcache!==g||!a.nodeIndex)){var i=0;for(d=h.firstChild;d;d=d.nextSibling)d.nodeType===1&&(d.nodeIndex=++i);h.sizcache=g}var j=a.nodeIndex-f;return e===0?j===0:j%e===0&&j/e>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=j.attrHandle[c]?j.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=j.setFilters[e];if(f)return f(a,c,b,d)}}},k=j.match.POS,l=function(a,b){return"\\"+(b-0+1)};for(var m in j.match)j.match[m]=new RegExp(j.match[m].source+/(?![^\[]*\])(?![^\(]*\))/.source),j.leftMatch[m]=new RegExp(/(^(?:.|\r|\n)*?)/.source+j.match[m].source.replace(/\\(\d+)/g,l));var n=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(o){n=function(a,b){var c=0,d=b||[];if(f.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length==="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var p,q;c.documentElement.compareDocumentPosition?p=function(a,b){if(a===b){g=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(p=function(a,b){var c,d,e=[],f=[],h=a.parentNode,i=b.parentNode,j=h;if(a===b){g=!0;return 0}if(h===i)return q(a,b);if(!h)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return q(e[k],f[k]);return k===c?q(a,f[k],-1):q(e[k],b,1)},q=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),i.getText=function(a){var b="",c;for(var d=0;a[d];d++)c=a[d],c.nodeType===3||c.nodeType===4?b+=c.nodeValue:c.nodeType!==8&&(b+=i.getText(c.childNodes));return b},function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(j.find.ID=function(a,c,d){if(typeof c.getElementById!=="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!=="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},j.filter.ID=function(a,b){var c=typeof a.getAttributeNode!=="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(j.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!=="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(j.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=i,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){i=function(b,e,f,g){e=e||c;if(!g&&!i.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return n(e.getElementsByTagName(b),f);if(h[2]&&j.find.CLASS&&e.getElementsByClassName)return n(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return n([e.body],f);if(h&&h[3]){var k=e.getElementById(h[3]);if(!k||!k.parentNode)return n([],f);if(k.id===h[3])return n([k],f)}try{return n(e.querySelectorAll(b),f)}catch(l){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e.getAttribute("id"),o=m||d,p=e.parentNode,q=/^\s*[+~]/.test(b);m?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),q&&p&&(e=e.parentNode);try{if(!q||p)return n(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(r){}finally{m||e.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)i[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector,d=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(e){d=!0}b&&(i.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!i.isXML(a))try{if(d||!j.match.PSEUDO.test(c)&&!/!=/.test(c))return b.call(a,c)}catch(e){}return i(c,null,null,[a]).length>0})}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;j.order.splice(1,0,"CLASS"),j.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!=="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?i.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?i.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:i.contains=function(){return!1},i.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var t=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=j.match.PSEUDO.exec(a))e+=c[0],a=a.replace(j.match.PSEUDO,"");a=j.relative[a]?a+"*":a;for(var g=0,h=f.length;g<h;g++)i(a,f[g],d);return i.filter(e,d)};d.find=i,d.expr=i.selectors,d.expr[":"]=d.expr.filters,d.unique=i.uniqueSort,d.text=i.getText,d.isXMLDoc=i.isXML,d.contains=i.contains}();var G=/Until$/,H=/^(?:parents|prevUntil|prevAll)/,I=/,/,J=/^.[^:#\[\.,]*$/,K=Array.prototype.slice,L=d.expr.match.POS,M={children:!0,contents:!0,next:!0,prev:!0};d.fn.extend({find:function(a){var b=this.pushStack("","find",a),c=0;for(var e=0,f=this.length;e<f;e++){c=b.length,d.find(a,this[e],b);if(e>0)for(var g=c;g<b.length;g++)for(var h=0;h<c;h++)if(b[h]===b[g]){b.splice(g--,1);break}}return b},has:function(a){var b=d(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(d.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(O(this,a,!1),"not",a)},filter:function(a){return this.pushStack(O(this,a,!0),"filter",a)},is:function(a){return!!a&&d.filter(a,this).length>0},closest:function(a,b){var c=[],e,f,g=this[0];if(d.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(e=0,f=a.length;e<f;e++)i=a[e],j[i]||(j[i]=d.expr.match.POS.test(i)?d(i,b||this.context):i);while(g&&g.ownerDocument&&g!==b){for(i in j)h=j[i],(h.jquery?h.index(g)>-1:d(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=L.test(a)?d(a,b||this.context):null;for(e=0,f=this.length;e<f;e++){g=this[e];while(g){if(l?l.index(g)>-1:d.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b)break}}c=c.length>1?d.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a==="string")return d.inArray(this[0],a?d(a):this.parent().children());return d.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a==="string"?d(a,b):d.makeArray(a),e=d.merge(this.get(),c);return this.pushStack(N(c[0])||N(e[0])?e:d.unique(e))},andSelf:function(){return this.add(this.prevObject)}}),d.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return d.dir(a,"parentNode")},parentsUntil:function(a,b,c){return d.dir(a,"parentNode",c)},next:function(a){return d.nth(a,2,"nextSibling")},prev:function(a){return d.nth(a,2,"previousSibling")},nextAll:function(a){return d.dir(a,"nextSibling")},prevAll:function(a){return d.dir(a,"previousSibling")},nextUntil:function(a,b,c){return d.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return d.dir(a,"previousSibling",c)},siblings:function(a){return d.sibling(a.parentNode.firstChild,a)},children:function(a){return d.sibling(a.firstChild)},contents:function(a){return d.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:d.makeArray(a.childNodes)}},function(a,b){d.fn[a]=function(c,e){var f=d.map(this,b,c),g=K.call(arguments);G.test(a)||(e=c),e&&typeof e==="string"&&(f=d.filter(e,f)),f=this.length>1&&!M[a]?d.unique(f):f,(this.length>1||I.test(e))&&H.test(a)&&(f=f.reverse());return this.pushStack(f,a,g.join(","))}}),d.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?d.find.matchesSelector(b[0],a)?[b[0]]:[]:d.find.matches(a,b)},dir:function(a,c,e){var f=[],g=a[c];while(g&&g.nodeType!==9&&(e===b||g.nodeType!==1||!d(g).is(e)))g.nodeType===1&&f.push(g),g=g[c];return f},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var P=/ jQuery\d+="(?:\d+|null)"/g,Q=/^\s+/,R=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,S=/<([\w:]+)/,T=/<tbody/i,U=/<|&#?\w+;/,V=/<(?:script|object|embed|option|style)/i,W=/checked\s*(?:[^=]|=\s*.checked.)/i,X={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};X.optgroup=X.option,X.tbody=X.tfoot=X.colgroup=X.caption=X.thead,X.th=X.td,d.support.htmlSerialize||(X._default=[1,"div<div>","</div>"]),d.fn.extend({text:function(a){if(d.isFunction(a))return this.each(function(b){var c=d(this);c.text(a.call(this,b,c.text()))});if(typeof a!=="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return d.text(this)},wrapAll:function(a){if(d.isFunction(a))return this.each(function(b){d(this).wrapAll(a.call(this,b))});if(this[0]){var b=d(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(d.isFunction(a))return this.each(function(b){d(this).wrapInner(a.call(this,b))});return this.each(function(){var b=d(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){d(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){d.nodeName(this,"body")||d(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=d(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,d(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,e;(e=this[c])!=null;c++)if(!a||d.filter(a,[e]).length)!b&&e.nodeType===1&&(d.cleanData(e.getElementsByTagName("*")),d.cleanData([e])),e.parentNode&&e.parentNode.removeChild(e);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&d.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!0:a,b=b==null?a:b;return this.map(function(){return d.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(P,""):null;if(typeof a!=="string"||V.test(a)||!d.support.leadingWhitespace&&Q.test(a)||X[(S.exec(a)||["",""])[1].toLowerCase()])d.isFunction(a)?this.each(function(b){var c=d(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);else{a=a.replace(R,"<$1></$2>");try{for(var c=0,e=this.length;c<e;c++)this[c].nodeType===1&&(d.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(f){this.empty().append(a)}}return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(d.isFunction(a))return this.each(function(b){var c=d(this),e=c.html();c.replaceWith(a.call(this,b,e))});typeof a!=="string"&&(a=d(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;d(this).remove(),b?d(b).before(a):d(c).append(a)})}return this.pushStack(d(d.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,e){var f,g,h,i,j=a[0],k=[];if(!d.support.checkClone&&arguments.length===3&&typeof j==="string"&&W.test(j))return this.each(function(){d(this).domManip(a,c,e,!0)});if(d.isFunction(j))return this.each(function(f){var g=d(this);a[0]=j.call(this,f,c?g.html():b),g.domManip(a,c,e)});if(this[0]){i=j&&j.parentNode,d.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?f={fragment:i}:f=d.buildFragment(a,this,k),h=f.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&d.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)e.call(c?Y(this[l],g):this[l],f.cacheable||m>1&&l<n?d.clone(h,!0,!0):h)}k.length&&d.each(k,_)}return this}}),d.buildFragment=function(a,b,e){var f,g,h,i=b&&b[0]?b[0].ownerDocument||b[0]:c;a.length===1&&typeof a[0]==="string"&&a[0].length<512&&i===c&&a[0].charAt(0)==="<"&&!V.test(a[0])&&(d.support.checkClone||!W.test(a[0]))&&(g=!0,h=d.fragments[a[0]],h&&(h!==1&&(f=h))),f||(f=i.createDocumentFragment(),d.clean(a,i,f,e)),g&&(d.fragments[a[0]]=h?f:1);return{fragment:f,cacheable:g}},d.fragments={},d.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){d.fn[a]=function(c){var e=[],f=d(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&f.length===1){f[b](this[0]);return this}for(var h=0,i=f.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();d(f[h])[b](j),e=e.concat(j)}return this.pushStack(e,a,f.selector)}}),d.extend({clone:function(a,b,c){var e=a.cloneNode(!0),f,g,h;if(!d.support.noCloneEvent&&(a.nodeType===1||a.nodeType===11)&&!d.isXMLDoc(a)){f=a.getElementsByTagName("*"),g=e.getElementsByTagName("*");for(h=0;f[h];++h)$(f[h],g[h]);$(a,e)}if(b){Z(a,e);if(c&&"getElementsByTagName"in a){f=a.getElementsByTagName("*"),g=e.getElementsByTagName("*");if(f.length)for(h=0;f[h];++h)Z(f[h],g[h])}}return e},clean:function(a,b,e,f){b=b||c,typeof b.createElement==="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var g=[];for(var h=0,i;(i=a[h])!=null;h++){typeof i==="number"&&(i+="");if(!i)continue;if(typeof i!=="string"||U.test(i)){if(typeof i==="string"){i=i.replace(R,"<$1></$2>");var j=(S.exec(i)||["",""])[1].toLowerCase(),k=X[j]||X._default,l=k[0],m=b.createElement("div");m.innerHTML=k[1]+i+k[2];while(l--)m=m.lastChild;if(!d.support.tbody){var n=T.test(i),o=j==="table"&&!n?m.firstChild&&m.firstChild.childNodes:k[1]==="<table>"&&!n?m.childNodes:[];for(var p=o.length-1;p>=0;--p)d.nodeName(o[p],"tbody")&&!o[p].childNodes.length&&o[p].parentNode.removeChild(o[p])}!d.support.leadingWhitespace&&Q.test(i)&&m.insertBefore(b.createTextNode(Q.exec(i)[0]),m.firstChild),i=m.childNodes}}else i=b.createTextNode(i);i.nodeType?g.push(i):g=d.merge(g,i)}if(e)for(h=0;g[h];h++)!f||!d.nodeName(g[h],"script")||g[h].type&&g[h].type.toLowerCase()!=="text/javascript"?(g[h].nodeType===1&&g.splice.apply(g,[h+1,0].concat(d.makeArray(g[h].getElementsByTagName("script")))),e.appendChild(g[h])):f.push(g[h].parentNode?g[h].parentNode.removeChild(g[h]):g[h]);return g},cleanData:function(a){var b,c,e=d.cache,f=d.expando,g=d.event.special,h=d.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&d.noData[j.nodeName.toLowerCase()])continue;c=j[d.expando];if(c){b=e[c]&&e[c][f];if(b&&b.events){for(var k in b.events)g[k]?d.event.remove(j,k):d.removeEvent(j,k,b.handle);b.handle&&(b.handle.elem=null)}h?delete j[d.expando]:j.removeAttribute&&j.removeAttribute(d.expando),delete e[c]}}}});var ba=/alpha\([^)]*\)/i,bb=/opacity=([^)]*)/,bc=/-([a-z])/ig,bd=/([A-Z])/g,be=/^-?\d+(?:px)?$/i,bf=/^-?\d/,bg={position:"absolute",visibility:"hidden",display:"block"},bh=["Left","Right"],bi=["Top","Bottom"],bj,bk,bl,bm=function(a,b){return b.toUpperCase()};d.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return d.access(this,a,c,!0,function(a,c,e){return e!==b?d.style(a,c,e):d.css(a,c)})},d.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bj(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{zIndex:!0,fontWeight:!0,opacity:!0,zoom:!0,lineHeight:!0},cssProps:{"float":d.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,e,f){if(a&&a.nodeType!==3&&a.nodeType!==8&&a.style){var g,h=d.camelCase(c),i=a.style,j=d.cssHooks[h];c=d.cssProps[h]||h;if(e===b){if(j&&"get"in j&&(g=j.get(a,!1,f))!==b)return g;return i[c]}if(typeof e==="number"&&isNaN(e)||e==null)return;typeof e==="number"&&!d.cssNumber[h]&&(e+="px");if(!j||!("set"in j)||(e=j.set(a,e))!==b)try{i[c]=e}catch(k){}}},css:function(a,c,e){var f,g=d.camelCase(c),h=d.cssHooks[g];c=d.cssProps[g]||g;if(h&&"get"in h&&(f=h.get(a,!0,e))!==b)return f;if(bj)return bj(a,c,g)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]},camelCase:function(a){return a.replace(bc,bm)}}),d.curCSS=d.css,d.each(["height","width"],function(a,b){d.cssHooks[b]={get:function(a,c,e){var f;if(c){a.offsetWidth!==0?f=bn(a,b,e):d.swap(a,bg,function(){f=bn(a,b,e)});if(f<=0){f=bj(a,b,b),f==="0px"&&bl&&(f=bl(a,b,b));if(f!=null)return f===""||f==="auto"?"0px":f}if(f<0||f==null){f=a.style[b];return f===""||f==="auto"?"0px":f}return typeof f==="string"?f:f+"px"}},set:function(a,b){if(!be.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),d.support.opacity||(d.cssHooks.opacity={get:function(a,b){return bb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style;c.zoom=1;var e=d.isNaN(b)?"":"alpha(opacity="+b*100+")",f=c.filter||"";c.filter=ba.test(f)?f.replace(ba,e):c.filter+" "+e}}),c.defaultView&&c.defaultView.getComputedStyle&&(bk=function(a,c,e){var f,g,h;e=e.replace(bd,"-$1").toLowerCase();if(!(g=a.ownerDocument.defaultView))return b;if(h=g.getComputedStyle(a,null))f=h.getPropertyValue(e),f===""&&!d.contains(a.ownerDocument.documentElement,a)&&(f=d.style(a,e));return f}),c.documentElement.currentStyle&&(bl=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!be.test(d)&&bf.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bj=bk||bl,d.expr&&d.expr.filters&&(d.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!d.support.reliableHiddenOffsets&&(a.style.display||d.css(a,"display"))==="none"},d.expr.filters.visible=function(a){return!d.expr.filters.hidden(a)});var bo=/%20/g,bp=/\[\]$/,bq=/\r?\n/g,br=/#.*$/,bs=/^(.*?):\s*(.*?)\r?$/mg,bt=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bu=/^(?:GET|HEAD)$/,bv=/^\/\//,bw=/\?/,bx=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,by=/^(?:select|textarea)/i,bz=/\s+/,bA=/([?&])_=[^&]*/,bB=/^(\w+:)\/\/([^\/?#:]+)(?::(\d+))?/,bC=d.fn.load,bD={},bE={};d.fn.extend({load:function(a,b,c){if(typeof a!=="string"&&bC)return bC.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var f=a.slice(e,a.length);a=a.slice(0,e)}var g="GET";b&&(d.isFunction(b)?(c=b,b=null):typeof b==="object"&&(b=d.param(b,d.ajaxSettings.traditional),g="POST"));var h=this;d.ajax({url:a,type:g,dataType:"html",data:b,complete:function(a,b,e){e=a.responseText,a.isResolved()&&(a.done(function(a){e=a}),h.html(f?d("<div>").append(e.replace(bx,"")).find(f):e)),c&&h.each(c,[e,b,a])}});return this},serialize:function(){return d.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?d.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||by.test(this.nodeName)||bt.test(this.type))}).map(function(a,b){var c=d(this).val();return c==null?null:d.isArray(c)?d.map(c,function(a,c){return{name:b.name,value:a.replace(bq,"\r\n")}}):{name:b.name,value:c.replace(bq,"\r\n")}}).get()}}),d.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){d.fn[b]=function(a){return this.bind(b,a)}}),d.each(["get","post"],function(a,b){d[b]=function(a,c,e,f){d.isFunction(c)&&(f=f||e,e=c,c=null);return d.ajax({type:b,url:a,data:c,success:e,dataType:f})}}),d.extend({getScript:function(a,b){return d.get(a,null,b,"script")},getJSON:function(a,b,c){return d.get(a,b,c,"json")},ajaxSetup:function(a){d.extend(!0,d.ajaxSettings,a),a.context&&(d.ajaxSettings.context=a.context)},ajaxSettings:{url:location.href,global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":d.parseJSON,"text xml":d.parseXML}},ajaxPrefilter:bF(bD),ajaxTransport:bF(bE),ajax:function(a,e){function w(a,c,e,l){if(t!==2){t=2,p&&clearTimeout(p),o=b,m=l||"",v.readyState=a?4:0;var n,q,r,s=e?bI(f,v,e):b,u,w;if(a>=200&&a<300||a===304){if(f.ifModified){if(u=v.getResponseHeader("Last-Modified"))d.lastModified[f.url]=u;if(w=v.getResponseHeader("Etag"))d.etag[f.url]=w}if(a===304)c="notmodified",n=!0;else try{q=bJ(f,s),c="success",n=!0}catch(x){c="parsererror",r=x}}else r=c,a&&(c="error",a<0&&(a=0));v.status=a,v.statusText=c,n?i.resolveWith(g,[q,c,v]):i.rejectWith(g,[v,c,r]),v.statusCode(k),k=b,f.global&&h.trigger("ajax"+(n?"Success":"Error"),[v,f,n?q:r]),j.resolveWith(g,[v,c]),f.global&&(h.trigger("ajaxComplete",[v,f]),--d.active||d.event.trigger("ajaxStop"))}}typeof e!=="object"&&(e=a,a=b),e=e||{};var f=d.extend(!0,{},d.ajaxSettings,e),g=(f.context=("context"in e?e:d.ajaxSettings).context)||f,h=g===f?d.event:d(g),i=d.Deferred(),j=d._Deferred(),k=f.statusCode||{},l={},m,n,o,p,q=c.location,r=q.protocol||"http:",s,t=0,u,v={readyState:0,setRequestHeader:function(a,b){t===0&&(l[a.toLowerCase()]=b);return this},getAllResponseHeaders:function(){return t===2?m:null},getResponseHeader:function(a){var b;if(t===2){if(!n){n={};while(b=bs.exec(m))n[b[1].toLowerCase()]=b[2]}b=n[a.toLowerCase()]}return b||null},abort:function(a){a=a||"abort",o&&o.abort(a),w(0,a);return this}};i.promise(v),v.success=v.done,v.error=v.fail,v.complete=j.done,v.statusCode=function(a){if(a){var b;if(t<2)for(b in a)k[b]=[k[b],a[b]];else b=a[v.status],v.then(b,b)}return this},f.url=(""+(a||f.url)).replace(br,"").replace(bv,r+"//"),f.dataTypes=d.trim(f.dataType||"*").toLowerCase().split(bz),f.crossDomain||(s=bB.exec(f.url.toLowerCase()),f.crossDomain=s&&(s[1]!=r||s[2]!=q.hostname||(s[3]||(s[1]==="http:"?80:443))!=(q.port||(r==="http:"?80:443)))),f.data&&f.processData&&typeof f.data!=="string"&&(f.data=d.param(f.data,f.traditional)),bG(bD,f,e,v),f.type=f.type.toUpperCase(),f.hasContent=!bu.test(f.type),f.global&&d.active++===0&&d.event.trigger("ajaxStart");if(!f.hasContent){f.data&&(f.url+=(bw.test(f.url)?"&":"?")+f.data);if(f.cache===!1){var x=d.now(),y=f.url.replace(bA,"$1_="+x);f.url=y+(y===f.url?(bw.test(f.url)?"&":"?")+"_="+x:"")}}if(f.data&&f.hasContent&&f.contentType!==!1||e.contentType)l["content-type"]=f.contentType;f.ifModified&&(d.lastModified[f.url]&&(l["if-modified-since"]=d.lastModified[f.url]),d.etag[f.url]&&(l["if-none-match"]=d.etag[f.url])),l.accept=f.dataTypes[0]&&f.accepts[f.dataTypes[0]]?f.accepts[f.dataTypes[0]]+(f.dataTypes[0]!=="*"?", */*; q=0.01":""):f.accepts["*"];for(u in f.headers)l[u.toLowerCase()]=f.headers[u];if(!f.beforeSend||f.beforeSend.call(g,v,f)!==!1&&t!==2){for(u in {success:1,error:1,complete:1})v[u](f[u]);o=bG(bE,f,e,v);if(o){t=v.readyState=1,f.global&&h.trigger("ajaxSend",[v,f]),f.async&&f.timeout>0&&(p=setTimeout(function(){v.abort("timeout")},f.timeout));try{o.send(l,w)}catch(z){status<2?w(-1,z):d.error(z)}}else w(-1,"No Transport")}else w(0,"abort"),v=!1;return v},param:function(a,c){var e=[],f=function(a,b){b=d.isFunction(b)?b():b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=d.ajaxSettings.traditional);if(d.isArray(a)||a.jquery)d.each(a,function(){f(this.name,this.value)});else for(var g in a)bH(g,a[g],c,f);return e.join("&").replace(bo,"+")}}),d.extend({active:0,lastModified:{},etag:{}});var bK=d.now(),bL=/(\=)\?(&|$)|()\?\?()/i;d.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return d.expando+"_"+bK++}}),d.ajaxPrefilter("json jsonp",function(b,c,e){e=typeof b.data==="string";if(b.dataTypes[0]==="jsonp"||c.jsonpCallback||c.jsonp!=null||b.jsonp!==!1&&(bL.test(b.url)||e&&bL.test(b.data))){var f,g=b.jsonpCallback=d.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h=a[g],i=b.url,j=b.data,k="$1"+g+"$2";b.jsonp!==!1&&(i=i.replace(bL,k),b.url===i&&(e&&(j=j.replace(bL,k)),b.data===j&&(i+=(/\?/.test(i)?"&":"?")+b.jsonp+"="+g))),b.url=i,b.data=j,a[g]=function(a){f=[a]},b.complete=[function(){a[g]=h;if(h)f&&d.isFunction(h)&&a[g](f[0]);else try{delete a[g]}catch(b){}},b.complete],b.converters["script json"]=function(){f||d.error(g+" was not called");return f[0]},b.dataTypes[0]="json";return"script"}}),d.ajaxSetup({accepts:{script:"text/javascript, application/javascript"},contents:{script:/javascript/},converters:{"text script":function(a){d.globalEval(a);return a}}}),d.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),d.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var bM=d.now(),bN={},bO,bP;d.ajaxSettings.xhr=a.ActiveXObject?function(){if(a.location.protocol!=="file:")try{return new a.XMLHttpRequest}catch(b){}try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(c){}}:function(){return new a.XMLHttpRequest};try{bP=d.ajaxSettings.xhr()}catch(bQ){}d.support.ajax=!!bP,d.support.cors=bP&&"withCredentials"in bP,bP=b,d.support.ajax&&d.ajaxTransport(function(b){if(!b.crossDomain||d.support.cors){var c;return{send:function(e,f){bO||(bO=1,d(a).bind("unload",function(){d.each(bN,function(a,b){b.onreadystatechange&&b.onreadystatechange(1)})}));var g=b.xhr(),h;b.username?g.open(b.type,b.url,b.async,b.username,b.password):g.open(b.type,b.url,b.async),(!b.crossDomain||b.hasContent)&&!e["x-requested-with"]&&(e["x-requested-with"]="XMLHttpRequest");try{d.each(e,function(a,b){g.setRequestHeader(a,b)})}catch(i){}g.send(b.hasContent&&b.data||null),c=function(a,e){if(c&&(e||g.readyState===4)){c=0,h&&(g.onreadystatechange=d.noop,delete bN[h]);if(e)g.readyState!==4&&g.abort();else{var i=g.status,j,k=g.getAllResponseHeaders(),l={},m=g.responseXML;m&&m.documentElement&&(l.xml=m),l.text=g.responseText;try{j=g.statusText}catch(n){j=""}i=i===0?!b.crossDomain||j?k?304:0:302:i==1223?204:i,f(i,j,l,k)}}},b.async&&g.readyState!==4?(h=bM++,bN[h]=g,g.onreadystatechange=c):c()},abort:function(){c&&c(0,1)}}}});var bR={},bS=/^(?:toggle|show|hide)$/,bT=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,bU,bV=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];d.fn.extend({show:function(a,b,c){var e,f;if(a||a===0)return this.animate(bW("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)e=this[g],f=e.style.display,!d._data(e,"olddisplay")&&f==="none"&&(f=e.style.display=""),f===""&&d.css(e,"display")==="none"&&d._data(e,"olddisplay",bX(e.nodeName));for(g=0;g<h;g++){e=this[g],f=e.style.display;if(f===""||f==="none")e.style.display=d._data(e,"olddisplay")||""}return this},hide:function(a,b,c){if(a||a===0)return this.animate(bW("hide",3),a,b,c);for(var e=0,f=this.length;e<f;e++){var g=d.css(this[e],"display");g!=="none"&&!d._data(this[e],"olddisplay")&&d._data(this[e],"olddisplay",g)}for(e=0;e<f;e++)this[e].style.display="none";return this},_toggle:d.fn.toggle,toggle:function(a,b,c){var e=typeof a==="boolean";d.isFunction(a)&&d.isFunction(b)?this._toggle.apply(this,arguments):a==null||e?this.each(function(){var b=e?a:d(this).is(":hidden");d(this)[b?"show":"hide"]()}):this.animate(bW("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,e){var f=d.speed(b,c,e);if(d.isEmptyObject(a))return this.each(f.complete);return this[f.queue===!1?"each":"queue"](function(){var b=d.extend({},f),c,e=this.nodeType===1,g=e&&d(this).is(":hidden"),h=this;for(c in a){var i=d.camelCase(c);c!==i&&(a[i]=a[c],delete a[c],c=i);if(a[c]==="hide"&&g||a[c]==="show"&&!g)return b.complete.call(this);if(e&&(c==="height"||c==="width")){b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(d.css(this,"display")==="inline"&&d.css(this,"float")==="none")if(d.support.inlineBlockNeedsLayout){var j=bX(this.nodeName);j==="inline"?this.style.display="inline-block":(this.style.display="inline",this.style.zoom=1)}else this.style.display="inline-block"}d.isArray(a[c])&&((b.specialEasing=b.specialEasing||{})[c]=a[c][1],a[c]=a[c][0])}b.overflow!=null&&(this.style.overflow="hidden"),b.curAnim=d.extend({},a),d.each(a,function(c,e){var f=new d.fx(h,b,c);if(bS.test(e))f[e==="toggle"?g?"show":"hide":e](a);else{var i=bT.exec(e),j=f.cur()||0;if(i){var k=parseFloat(i[2]),l=i[3]||"px";l!=="px"&&(d.style(h,c,(k||1)+l),j=(k||1)/f.cur()*j,d.style(h,c,j+l)),i[1]&&(k=(i[1]==="-="?-1:1)*k+j),f.custom(j,k,l)}else f.custom(j,e,"")}});return!0})},stop:function(a,b){var c=d.timers;a&&this.queue([]),this.each(function(){for(var a=c.length-1;a>=0;a--)c[a].elem===this&&(b&&c[a](!0),c.splice(a,1))}),b||this.dequeue();return this}}),d.each({slideDown:bW("show",1),slideUp:bW("hide",1),slideToggle:bW("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){d.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),d.extend({speed:function(a,b,c){var e=a&&typeof a==="object"?d.extend({},a):{complete:c||!c&&b||d.isFunction(a)&&a,duration:a,easing:c&&b||b&&!d.isFunction(b)&&b};e.duration=d.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in d.fx.speeds?d.fx.speeds[e.duration]:d.fx.speeds._default,e.old=e.complete,e.complete=function(){e.queue!==!1&&d(this).dequeue(),d.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig||(b.orig={})}}),d.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(d.fx.step[this.prop]||d.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a=parseFloat(d.css(this.elem,this.prop));return a||0},custom:function(a,b,c){function g(a){return e.step(a)}var e=this,f=d.fx;this.startTime=d.now(),this.start=a,this.end=b,this.unit=c||this.unit||"px",this.now=this.start,this.pos=this.state=0,g.elem=this.elem,g()&&d.timers.push(g)&&!bU&&(bU=setInterval(f.tick,f.interval))},show:function(){this.options.orig[this.prop]=d.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),d(this.elem).show()},hide:function(){this.options.orig[this.prop]=d.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=d.now(),c=!0;if(a||b>=this.options.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),this.options.curAnim[this.prop]=!0;for(var e in this.options.curAnim)this.options.curAnim[e]!==!0&&(c=!1);if(c){if(this.options.overflow!=null&&!d.support.shrinkWrapBlocks){var f=this.elem,g=this.options;d.each(["","X","Y"],function(a,b){f.style["overflow"+b]=g.overflow[a]})}this.options.hide&&d(this.elem).hide();if(this.options.hide||this.options.show)for(var h in this.options.curAnim)d.style(this.elem,h,this.options.orig[h]);this.options.complete.call(this.elem)}return!1}var i=b-this.startTime;this.state=i/this.options.duration;var j=this.options.specialEasing&&this.options.specialEasing[this.prop],k=this.options.easing||(d.easing.swing?"swing":"linear");this.pos=d.easing[j||k](this.state,i,0,1,this.options.duration),this.now=this.start+(this.end-this.start)*this.pos,this.update();return!0}},d.extend(d.fx,{tick:function(){var a=d.timers;for(var b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||d.fx.stop()},interval:13,stop:function(){clearInterval(bU),bU=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){d.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit:a.elem[a.prop]=a.now}}}),d.expr&&d.expr.filters&&(d.expr.filters.animated=function(a){return d.grep(d.timers,function(b){return a===b.elem}).length});var bY=/^t(?:able|d|h)$/i,bZ=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?d.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){d.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return d.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(e){}var f=b.ownerDocument,g=f.documentElement;if(!c||!d.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=f.body,i=b$(f),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||d.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||d.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:d.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){d.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return d.offset.bodyOffset(b);d.offset.initialize();var c,e=b.offsetParent,f=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(d.offset.supportsFixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===e&&(l+=b.offsetTop,m+=b.offsetLeft,d.offset.doesNotAddBorder&&(!d.offset.doesAddBorderForTableAndCells||!bY.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),f=e,e=b.offsetParent),d.offset.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;d.offset.supportsFixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},d.offset={initialize:function(){var a=c.body,b=c.createElement("div"),e,f,g,h,i=parseFloat(d.css(a,"marginTop"))||0,j="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";d.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),e=b.firstChild,f=e.firstChild,h=e.nextSibling.firstChild.firstChild,this.doesNotAddBorder=f.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,f.style.position="fixed",f.style.top="20px",this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15,f.style.position=f.style.top="",e.style.overflow="hidden",e.style.position="relative",this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),a=b=e=f=g=h=null,d.offset.initialize=d.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;d.offset.initialize(),d.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(d.css(a,"marginTop"))||0,c+=parseFloat(d.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var e=d.css(a,"position");e==="static"&&(a.style.position="relative");var f=d(a),g=f.offset(),h=d.css(a,"top"),i=d.css(a,"left"),j=e==="absolute"&&d.inArray("auto",[h,i])>-1,k={},l={},m,n;j&&(l=f.position()),m=j?l.top:parseInt(h,10)||0,n=j?l.left:parseInt(i,10)||0,d.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):f.css(k)}},d.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),e=bZ.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(d.css(a,"marginTop"))||0,c.left-=parseFloat(d.css(a,"marginLeft"))||0,e.top+=parseFloat(d.css(b[0],"borderTopWidth"))||0,e.left+=parseFloat(d.css(b[0],"borderLeftWidth"))||0;return{top:c.top-e.top,left:c.left-e.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&(!bZ.test(a.nodeName)&&d.css(a,"position")==="static"))a=a.offsetParent;return a})}}),d.each(["Left","Top"],function(a,c){var e="scroll"+c;d.fn[e]=function(c){var f=this[0],g;if(!f)return null;if(c!==b)return this.each(function(){g=b$(this),g?g.scrollTo(a?d(g).scrollLeft():c,a?c:d(g).scrollTop()):this[e]=c});g=b$(f);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:d.support.boxModel&&g.document.documentElement[e]||g.document.body[e]:f[e]}}),d.each(["Height","Width"],function(a,c){var e=c.toLowerCase();d.fn["inner"+c]=function(){return this[0]?parseFloat(d.css(this[0],e,"padding")):null},d.fn["outer"+c]=function(a){return this[0]?parseFloat(d.css(this[0],e,a?"margin":"border")):null},d.fn[e]=function(a){var f=this[0];if(!f)return a==null?null:this;if(d.isFunction(a))return this.each(function(b){var c=d(this);c[e](a.call(this,b,c[e]()))});if(d.isWindow(f)){var g=f.document.documentElement["client"+c];return f.document.compatMode==="CSS1Compat"&&g||f.document.body["client"+c]||g}if(f.nodeType===9)return Math.max(f.documentElement["client"+c],f.body["scroll"+c],f.documentElement["scroll"+c],f.body["offset"+c],f.documentElement["offset"+c]);if(a===b){var h=d.css(f,e),i=parseFloat(h);return d.isNaN(i)?h:i}return this.css(e,typeof a==="string"?a:a+"px")}})})(window); diff --git a/js/jquery-ui-1.8.10.custom.min.js b/js/jquery-ui-1.8.10.custom.min.js new file mode 100644 index 0000000000000000000000000000000000000000..7d4ff1cec10c7258403b0777b27436db5a822ba0 --- /dev/null +++ b/js/jquery-ui-1.8.10.custom.min.js @@ -0,0 +1,782 @@ +/*! + * jQuery UI 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI + */ +(function(c,j){function k(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.10",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106, +NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this, +"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position"); +if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,l,m){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(l)g-=parseFloat(c.curCSS(f, +"border"+this+"Width",true))||0;if(m)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h, +d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){var b=a.nodeName.toLowerCase(),d=c.attr(a,"tabindex");if("area"===b){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&k(a)}return(/input|select|textarea|button|object/.test(b)?!a.disabled:"a"==b?a.href||!isNaN(d):!isNaN(d))&&k(a)},tabbable:function(a){var b=c.attr(a,"tabindex");return(isNaN(b)||b>=0)&&c(a).is(":focusable")}}); +c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode)for(var e=0;e<b.length;e++)a.options[b[e][0]]&& +b[e][1].apply(a.element,d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;b=b&&b==="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&c.ui.isOverAxis(b,e,i)}})}})(jQuery); +;/*! + * jQuery UI Widget 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Widget + */ +(function(b,j){if(b.cleanData){var k=b.cleanData;b.cleanData=function(a){for(var c=0,d;(d=a[c])!=null;c++)b(d).triggerHandler("remove");k(a)}}else{var l=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add([this]).each(function(){b(this).triggerHandler("remove")});return l.call(b(this),a,c)})}}b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=function(h){return!!b.data(h, +a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend(true,{},c.options);b[e][a].prototype=b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):d;if(e&&d.charAt(0)==="_")return h; +e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==j){h=i;return false}}):this.each(function(){var g=b.data(this,a);g?g.option(d||{})._init():b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=b.extend(true,{},this.options, +this._getCreateOptions(),a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")}, +widget:function(){return this.element},option:function(a,c){var d=a;if(arguments.length===0)return b.extend({},this.options);if(typeof a==="string"){if(c===j)return this.options[a];d={};d[a]=c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(d,e){c._setOption(d,e)});return this},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",c);return this}, +enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery); +;/*! + * jQuery UI Mouse 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Mouse + * + * Depends: + * jquery.ui.widget.js + */ +(function(c){c.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var a=this;this.element.bind("mousedown."+this.widgetName,function(b){return a._mouseDown(b)}).bind("click."+this.widgetName,function(b){if(true===c.data(b.target,a.widgetName+".preventClickEvent")){c.removeData(b.target,a.widgetName+".preventClickEvent");b.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName)},_mouseDown:function(a){a.originalEvent= +a.originalEvent||{};if(!a.originalEvent.mouseHandled){this._mouseStarted&&this._mouseUp(a);this._mouseDownEvent=a;var b=this,e=a.which==1,f=typeof this.options.cancel=="string"?c(a.target).parents().add(a.target).filter(this.options.cancel).length:false;if(!e||f||!this._mouseCapture(a))return true;this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet)this._mouseDelayTimer=setTimeout(function(){b.mouseDelayMet=true},this.options.delay);if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a)){this._mouseStarted= +this._mouseStart(a)!==false;if(!this._mouseStarted){a.preventDefault();return true}}this._mouseMoveDelegate=function(d){return b._mouseMove(d)};this._mouseUpDelegate=function(d){return b._mouseUp(d)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);a.preventDefault();return a.originalEvent.mouseHandled=true}},_mouseMove:function(a){if(c.browser.msie&&!(document.documentMode>=9)&&!a.button)return this._mouseUp(a);if(this._mouseStarted){this._mouseDrag(a); +return a.preventDefault()}if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==false)?this._mouseDrag(a):this._mouseUp(a);return!this._mouseStarted},_mouseUp:function(a){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;a.target==this._mouseDownEvent.target&&c.data(a.target,this.widgetName+".preventClickEvent", +true);this._mouseStop(a)}return false},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery); +;/* + * jQuery UI Position 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Position + */ +(function(c){c.ui=c.ui||{};var n=/left|center|right/,o=/top|center|bottom/,t=c.fn.position,u=c.fn.offset;c.fn.position=function(b){if(!b||!b.of)return t.apply(this,arguments);b=c.extend({},b);var a=c(b.of),d=a[0],g=(b.collision||"flip").split(" "),e=b.offset?b.offset.split(" "):[0,0],h,k,j;if(d.nodeType===9){h=a.width();k=a.height();j={top:0,left:0}}else if(d.setTimeout){h=a.width();k=a.height();j={top:a.scrollTop(),left:a.scrollLeft()}}else if(d.preventDefault){b.at="left top";h=k=0;j={top:b.of.pageY, +left:b.of.pageX}}else{h=a.outerWidth();k=a.outerHeight();j=a.offset()}c.each(["my","at"],function(){var f=(b[this]||"").split(" ");if(f.length===1)f=n.test(f[0])?f.concat(["center"]):o.test(f[0])?["center"].concat(f):["center","center"];f[0]=n.test(f[0])?f[0]:"center";f[1]=o.test(f[1])?f[1]:"center";b[this]=f});if(g.length===1)g[1]=g[0];e[0]=parseInt(e[0],10)||0;if(e.length===1)e[1]=e[0];e[1]=parseInt(e[1],10)||0;if(b.at[0]==="right")j.left+=h;else if(b.at[0]==="center")j.left+=h/2;if(b.at[1]==="bottom")j.top+= +k;else if(b.at[1]==="center")j.top+=k/2;j.left+=e[0];j.top+=e[1];return this.each(function(){var f=c(this),l=f.outerWidth(),m=f.outerHeight(),p=parseInt(c.curCSS(this,"marginLeft",true))||0,q=parseInt(c.curCSS(this,"marginTop",true))||0,v=l+p+(parseInt(c.curCSS(this,"marginRight",true))||0),w=m+q+(parseInt(c.curCSS(this,"marginBottom",true))||0),i=c.extend({},j),r;if(b.my[0]==="right")i.left-=l;else if(b.my[0]==="center")i.left-=l/2;if(b.my[1]==="bottom")i.top-=m;else if(b.my[1]==="center")i.top-= +m/2;i.left=Math.round(i.left);i.top=Math.round(i.top);r={left:i.left-p,top:i.top-q};c.each(["left","top"],function(s,x){c.ui.position[g[s]]&&c.ui.position[g[s]][x](i,{targetWidth:h,targetHeight:k,elemWidth:l,elemHeight:m,collisionPosition:r,collisionWidth:v,collisionHeight:w,offset:e,my:b.my,at:b.at})});c.fn.bgiframe&&f.bgiframe();f.offset(c.extend(i,{using:b.using}))})};c.ui.position={fit:{left:function(b,a){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();b.left= +d>0?b.left-d:Math.max(b.left-a.collisionPosition.left,b.left)},top:function(b,a){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();b.top=d>0?b.top-d:Math.max(b.top-a.collisionPosition.top,b.top)}},flip:{left:function(b,a){if(a.at[0]!=="center"){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();var g=a.my[0]==="left"?-a.elemWidth:a.my[0]==="right"?a.elemWidth:0,e=a.at[0]==="left"?a.targetWidth:-a.targetWidth,h=-2*a.offset[0];b.left+= +a.collisionPosition.left<0?g+e+h:d>0?g+e+h:0}},top:function(b,a){if(a.at[1]!=="center"){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();var g=a.my[1]==="top"?-a.elemHeight:a.my[1]==="bottom"?a.elemHeight:0,e=a.at[1]==="top"?a.targetHeight:-a.targetHeight,h=-2*a.offset[1];b.top+=a.collisionPosition.top<0?g+e+h:d>0?g+e+h:0}}}};if(!c.offset.setOffset){c.offset.setOffset=function(b,a){if(/static/.test(c.curCSS(b,"position")))b.style.position="relative";var d=c(b), +g=d.offset(),e=parseInt(c.curCSS(b,"top",true),10)||0,h=parseInt(c.curCSS(b,"left",true),10)||0;g={top:a.top-g.top+e,left:a.left-g.left+h};"using"in a?a.using.call(b,g):d.css(g)};c.fn.offset=function(b){var a=this[0];if(!a||!a.ownerDocument)return null;if(b)return this.each(function(){c.offset.setOffset(this,b)});return u.call(this)}}})(jQuery); +;/* + * jQuery UI Draggable 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Draggables + * + * Depends: + * jquery.ui.core.js + * jquery.ui.mouse.js + * jquery.ui.widget.js + */ +(function(d){d.widget("ui.draggable",d.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false},_create:function(){if(this.options.helper== +"original"&&!/^(?:r|a|f)/.test(this.element.css("position")))this.element[0].style.position="relative";this.options.addClasses&&this.element.addClass("ui-draggable");this.options.disabled&&this.element.addClass("ui-draggable-disabled");this._mouseInit()},destroy:function(){if(this.element.data("draggable")){this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy();return this}},_mouseCapture:function(a){var b= +this.options;if(this.helper||b.disabled||d(a.target).is(".ui-resizable-handle"))return false;this.handle=this._getHandle(a);if(!this.handle)return false;return true},_mouseStart:function(a){var b=this.options;this.helper=this._createHelper(a);this._cacheHelperProportions();if(d.ui.ddmanager)d.ui.ddmanager.current=this;this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.positionAbs=this.element.offset();this.offset={top:this.offset.top- +this.margins.top,left:this.offset.left-this.margins.left};d.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this.position=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);b.containment&&this._setContainment();if(this._trigger("start",a)===false){this._clear();return false}this._cacheHelperProportions(); +d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(a,true);return true},_mouseDrag:function(a,b){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");if(!b){b=this._uiHash();if(this._trigger("drag",a,b)===false){this._mouseUp({});return false}this.position=b.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis|| +this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);return false},_mouseStop:function(a){var b=false;if(d.ui.ddmanager&&!this.options.dropBehaviour)b=d.ui.ddmanager.drop(this,a);if(this.dropped){b=this.dropped;this.dropped=false}if((!this.element[0]||!this.element[0].parentNode)&&this.options.helper=="original")return false;if(this.options.revert=="invalid"&&!b||this.options.revert=="valid"&&b||this.options.revert===true||d.isFunction(this.options.revert)&& +this.options.revert.call(this.element,b)){var c=this;d(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){c._trigger("stop",a)!==false&&c._clear()})}else this._trigger("stop",a)!==false&&this._clear();return false},cancel:function(){this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear();return this},_getHandle:function(a){var b=!this.options.handle||!d(this.options.handle,this.element).length?true:false;d(this.options.handle,this.element).find("*").andSelf().each(function(){if(this== +a.target)b=true});return b},_createHelper:function(a){var b=this.options;a=d.isFunction(b.helper)?d(b.helper.apply(this.element[0],[a])):b.helper=="clone"?this.element.clone():this.element;a.parents("body").length||a.appendTo(b.appendTo=="parent"?this.element[0].parentNode:b.appendTo);a[0]!=this.element[0]&&!/(fixed|absolute)/.test(a.css("position"))&&a.css("position","absolute");return a},_adjustOffsetFromHelper:function(a){if(typeof a=="string")a=a.split(" ");if(d.isArray(a))a={left:+a[0],top:+a[1]|| +0};if("left"in a)this.offset.click.left=a.left+this.margins.left;if("right"in a)this.offset.click.left=this.helperProportions.width-a.right+this.margins.left;if("top"in a)this.offset.click.top=a.top+this.margins.top;if("bottom"in a)this.offset.click.top=this.helperProportions.height-a.bottom+this.margins.top},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var a=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0], +this.offsetParent[0])){a.left+=this.scrollParent.scrollLeft();a.top+=this.scrollParent.scrollTop()}if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&d.browser.msie)a={top:0,left:0};return{top:a.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:a.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.element.position();return{top:a.top- +(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var a=this.options;if(a.containment== +"parent")a.containment=this.helper[0].parentNode;if(a.containment=="document"||a.containment=="window")this.containment=[(a.containment=="document"?0:d(window).scrollLeft())-this.offset.relative.left-this.offset.parent.left,(a.containment=="document"?0:d(window).scrollTop())-this.offset.relative.top-this.offset.parent.top,(a.containment=="document"?0:d(window).scrollLeft())+d(a.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a.containment=="document"? +0:d(window).scrollTop())+(d(a.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(a.containment)&&a.containment.constructor!=Array){var b=d(a.containment)[0];if(b){a=d(a.containment).offset();var c=d(b).css("overflow")!="hidden";this.containment=[a.left+(parseInt(d(b).css("borderLeftWidth"),10)||0)+(parseInt(d(b).css("paddingLeft"),10)||0)-this.margins.left,a.top+(parseInt(d(b).css("borderTopWidth"), +10)||0)+(parseInt(d(b).css("paddingTop"),10)||0)-this.margins.top,a.left+(c?Math.max(b.scrollWidth,b.offsetWidth):b.offsetWidth)-(parseInt(d(b).css("borderLeftWidth"),10)||0)-(parseInt(d(b).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,a.top+(c?Math.max(b.scrollHeight,b.offsetHeight):b.offsetHeight)-(parseInt(d(b).css("borderTopWidth"),10)||0)-(parseInt(d(b).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}}else if(a.containment.constructor== +Array)this.containment=a.containment},_convertPositionTo:function(a,b){if(!b)b=this.position;a=a=="absolute"?1:-1;var c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName);return{top:b.top+this.offset.relative.top*a+this.offset.parent.top*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop(): +f?0:c.scrollTop())*a),left:b.left+this.offset.relative.left*a+this.offset.parent.left*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():f?0:c.scrollLeft())*a)}},_generatePosition:function(a){var b=this.options,c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName),e=a.pageX,g=a.pageY; +if(this.originalPosition){if(this.containment){if(a.pageX-this.offset.click.left<this.containment[0])e=this.containment[0]+this.offset.click.left;if(a.pageY-this.offset.click.top<this.containment[1])g=this.containment[1]+this.offset.click.top;if(a.pageX-this.offset.click.left>this.containment[2])e=this.containment[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>this.containment[3])g=this.containment[3]+this.offset.click.top}if(b.grid){g=this.originalPageY+Math.round((g-this.originalPageY)/ +b.grid[1])*b.grid[1];g=this.containment?!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:!(g-this.offset.click.top<this.containment[1])?g-b.grid[1]:g+b.grid[1]:g;e=this.originalPageX+Math.round((e-this.originalPageX)/b.grid[0])*b.grid[0];e=this.containment?!(e-this.offset.click.left<this.containment[0]||e-this.offset.click.left>this.containment[2])?e:!(e-this.offset.click.left<this.containment[0])?e-b.grid[0]:e+b.grid[0]:e}}return{top:g-this.offset.click.top- +this.offset.relative.top-this.offset.parent.top+(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:c.scrollTop()),left:e-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():f?0:c.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");this.helper[0]!= +this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove();this.helper=null;this.cancelHelperRemoval=false},_trigger:function(a,b,c){c=c||this._uiHash();d.ui.plugin.call(this,a,[b,c]);if(a=="drag")this.positionAbs=this._convertPositionTo("absolute");return d.Widget.prototype._trigger.call(this,a,b,c)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}});d.extend(d.ui.draggable,{version:"1.8.10"}); +d.ui.plugin.add("draggable","connectToSortable",{start:function(a,b){var c=d(this).data("draggable"),f=c.options,e=d.extend({},b,{item:c.element});c.sortables=[];d(f.connectToSortable).each(function(){var g=d.data(this,"sortable");if(g&&!g.options.disabled){c.sortables.push({instance:g,shouldRevert:g.options.revert});g._refreshItems();g._trigger("activate",a,e)}})},stop:function(a,b){var c=d(this).data("draggable"),f=d.extend({},b,{item:c.element});d.each(c.sortables,function(){if(this.instance.isOver){this.instance.isOver= +0;c.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert)this.instance.options.revert=true;this.instance._mouseStop(a);this.instance.options.helper=this.instance.options._helper;c.options.helper=="original"&&this.instance.currentItem.css({top:"auto",left:"auto"})}else{this.instance.cancelHelperRemoval=false;this.instance._trigger("deactivate",a,f)}})},drag:function(a,b){var c=d(this).data("draggable"),f=this;d.each(c.sortables,function(){this.instance.positionAbs= +c.positionAbs;this.instance.helperProportions=c.helperProportions;this.instance.offset.click=c.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=d(f).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return b.helper[0]};a.target=this.instance.currentItem[0];this.instance._mouseCapture(a, +true);this.instance._mouseStart(a,true,true);this.instance.offset.click.top=c.offset.click.top;this.instance.offset.click.left=c.offset.click.left;this.instance.offset.parent.left-=c.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=c.offset.parent.top-this.instance.offset.parent.top;c._trigger("toSortable",a);c.dropped=this.instance.element;c.currentItem=c.element;this.instance.fromOutside=c}this.instance.currentItem&&this.instance._mouseDrag(a)}else if(this.instance.isOver){this.instance.isOver= +0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._trigger("out",a,this.instance._uiHash(this.instance));this.instance._mouseStop(a,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();this.instance.placeholder&&this.instance.placeholder.remove();c._trigger("fromSortable",a);c.dropped=false}})}});d.ui.plugin.add("draggable","cursor",{start:function(){var a=d("body"),b=d(this).data("draggable").options;if(a.css("cursor"))b._cursor= +a.css("cursor");a.css("cursor",b.cursor)},stop:function(){var a=d(this).data("draggable").options;a._cursor&&d("body").css("cursor",a._cursor)}});d.ui.plugin.add("draggable","iframeFix",{start:function(){var a=d(this).data("draggable").options;d(a.iframeFix===true?"iframe":a.iframeFix).each(function(){d('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1E3}).css(d(this).offset()).appendTo("body")})}, +stop:function(){d("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});d.ui.plugin.add("draggable","opacity",{start:function(a,b){a=d(b.helper);b=d(this).data("draggable").options;if(a.css("opacity"))b._opacity=a.css("opacity");a.css("opacity",b.opacity)},stop:function(a,b){a=d(this).data("draggable").options;a._opacity&&d(b.helper).css("opacity",a._opacity)}});d.ui.plugin.add("draggable","scroll",{start:function(){var a=d(this).data("draggable");if(a.scrollParent[0]!= +document&&a.scrollParent[0].tagName!="HTML")a.overflowOffset=a.scrollParent.offset()},drag:function(a){var b=d(this).data("draggable"),c=b.options,f=false;if(b.scrollParent[0]!=document&&b.scrollParent[0].tagName!="HTML"){if(!c.axis||c.axis!="x")if(b.overflowOffset.top+b.scrollParent[0].offsetHeight-a.pageY<c.scrollSensitivity)b.scrollParent[0].scrollTop=f=b.scrollParent[0].scrollTop+c.scrollSpeed;else if(a.pageY-b.overflowOffset.top<c.scrollSensitivity)b.scrollParent[0].scrollTop=f=b.scrollParent[0].scrollTop- +c.scrollSpeed;if(!c.axis||c.axis!="y")if(b.overflowOffset.left+b.scrollParent[0].offsetWidth-a.pageX<c.scrollSensitivity)b.scrollParent[0].scrollLeft=f=b.scrollParent[0].scrollLeft+c.scrollSpeed;else if(a.pageX-b.overflowOffset.left<c.scrollSensitivity)b.scrollParent[0].scrollLeft=f=b.scrollParent[0].scrollLeft-c.scrollSpeed}else{if(!c.axis||c.axis!="x")if(a.pageY-d(document).scrollTop()<c.scrollSensitivity)f=d(document).scrollTop(d(document).scrollTop()-c.scrollSpeed);else if(d(window).height()- +(a.pageY-d(document).scrollTop())<c.scrollSensitivity)f=d(document).scrollTop(d(document).scrollTop()+c.scrollSpeed);if(!c.axis||c.axis!="y")if(a.pageX-d(document).scrollLeft()<c.scrollSensitivity)f=d(document).scrollLeft(d(document).scrollLeft()-c.scrollSpeed);else if(d(window).width()-(a.pageX-d(document).scrollLeft())<c.scrollSensitivity)f=d(document).scrollLeft(d(document).scrollLeft()+c.scrollSpeed)}f!==false&&d.ui.ddmanager&&!c.dropBehaviour&&d.ui.ddmanager.prepareOffsets(b,a)}});d.ui.plugin.add("draggable", +"snap",{start:function(){var a=d(this).data("draggable"),b=a.options;a.snapElements=[];d(b.snap.constructor!=String?b.snap.items||":data(draggable)":b.snap).each(function(){var c=d(this),f=c.offset();this!=a.element[0]&&a.snapElements.push({item:this,width:c.outerWidth(),height:c.outerHeight(),top:f.top,left:f.left})})},drag:function(a,b){for(var c=d(this).data("draggable"),f=c.options,e=f.snapTolerance,g=b.offset.left,n=g+c.helperProportions.width,m=b.offset.top,o=m+c.helperProportions.height,h= +c.snapElements.length-1;h>=0;h--){var i=c.snapElements[h].left,k=i+c.snapElements[h].width,j=c.snapElements[h].top,l=j+c.snapElements[h].height;if(i-e<g&&g<k+e&&j-e<m&&m<l+e||i-e<g&&g<k+e&&j-e<o&&o<l+e||i-e<n&&n<k+e&&j-e<m&&m<l+e||i-e<n&&n<k+e&&j-e<o&&o<l+e){if(f.snapMode!="inner"){var p=Math.abs(j-o)<=e,q=Math.abs(l-m)<=e,r=Math.abs(i-n)<=e,s=Math.abs(k-g)<=e;if(p)b.position.top=c._convertPositionTo("relative",{top:j-c.helperProportions.height,left:0}).top-c.margins.top;if(q)b.position.top=c._convertPositionTo("relative", +{top:l,left:0}).top-c.margins.top;if(r)b.position.left=c._convertPositionTo("relative",{top:0,left:i-c.helperProportions.width}).left-c.margins.left;if(s)b.position.left=c._convertPositionTo("relative",{top:0,left:k}).left-c.margins.left}var t=p||q||r||s;if(f.snapMode!="outer"){p=Math.abs(j-m)<=e;q=Math.abs(l-o)<=e;r=Math.abs(i-g)<=e;s=Math.abs(k-n)<=e;if(p)b.position.top=c._convertPositionTo("relative",{top:j,left:0}).top-c.margins.top;if(q)b.position.top=c._convertPositionTo("relative",{top:l-c.helperProportions.height, +left:0}).top-c.margins.top;if(r)b.position.left=c._convertPositionTo("relative",{top:0,left:i}).left-c.margins.left;if(s)b.position.left=c._convertPositionTo("relative",{top:0,left:k-c.helperProportions.width}).left-c.margins.left}if(!c.snapElements[h].snapping&&(p||q||r||s||t))c.options.snap.snap&&c.options.snap.snap.call(c.element,a,d.extend(c._uiHash(),{snapItem:c.snapElements[h].item}));c.snapElements[h].snapping=p||q||r||s||t}else{c.snapElements[h].snapping&&c.options.snap.release&&c.options.snap.release.call(c.element, +a,d.extend(c._uiHash(),{snapItem:c.snapElements[h].item}));c.snapElements[h].snapping=false}}}});d.ui.plugin.add("draggable","stack",{start:function(){var a=d(this).data("draggable").options;a=d.makeArray(d(a.stack)).sort(function(c,f){return(parseInt(d(c).css("zIndex"),10)||0)-(parseInt(d(f).css("zIndex"),10)||0)});if(a.length){var b=parseInt(a[0].style.zIndex)||0;d(a).each(function(c){this.style.zIndex=b+c});this[0].style.zIndex=b+a.length}}});d.ui.plugin.add("draggable","zIndex",{start:function(a, +b){a=d(b.helper);b=d(this).data("draggable").options;if(a.css("zIndex"))b._zIndex=a.css("zIndex");a.css("zIndex",b.zIndex)},stop:function(a,b){a=d(this).data("draggable").options;a._zIndex&&d(b.helper).css("zIndex",a._zIndex)}})})(jQuery); +;/* + * jQuery UI Droppable 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Droppables + * + * Depends: + * jquery.ui.core.js + * jquery.ui.widget.js + * jquery.ui.mouse.js + * jquery.ui.draggable.js + */ +(function(d){d.widget("ui.droppable",{widgetEventPrefix:"drop",options:{accept:"*",activeClass:false,addClasses:true,greedy:false,hoverClass:false,scope:"default",tolerance:"intersect"},_create:function(){var a=this.options,b=a.accept;this.isover=0;this.isout=1;this.accept=d.isFunction(b)?b:function(c){return c.is(b)};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};d.ui.ddmanager.droppables[a.scope]=d.ui.ddmanager.droppables[a.scope]||[];d.ui.ddmanager.droppables[a.scope].push(this); +a.addClasses&&this.element.addClass("ui-droppable")},destroy:function(){for(var a=d.ui.ddmanager.droppables[this.options.scope],b=0;b<a.length;b++)a[b]==this&&a.splice(b,1);this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable");return this},_setOption:function(a,b){if(a=="accept")this.accept=d.isFunction(b)?b:function(c){return c.is(b)};d.Widget.prototype._setOption.apply(this,arguments)},_activate:function(a){var b=d.ui.ddmanager.current;this.options.activeClass&& +this.element.addClass(this.options.activeClass);b&&this._trigger("activate",a,this.ui(b))},_deactivate:function(a){var b=d.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass);b&&this._trigger("deactivate",a,this.ui(b))},_over:function(a){var b=d.ui.ddmanager.current;if(!(!b||(b.currentItem||b.element)[0]==this.element[0]))if(this.accept.call(this.element[0],b.currentItem||b.element)){this.options.hoverClass&&this.element.addClass(this.options.hoverClass); +this._trigger("over",a,this.ui(b))}},_out:function(a){var b=d.ui.ddmanager.current;if(!(!b||(b.currentItem||b.element)[0]==this.element[0]))if(this.accept.call(this.element[0],b.currentItem||b.element)){this.options.hoverClass&&this.element.removeClass(this.options.hoverClass);this._trigger("out",a,this.ui(b))}},_drop:function(a,b){var c=b||d.ui.ddmanager.current;if(!c||(c.currentItem||c.element)[0]==this.element[0])return false;var e=false;this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var g= +d.data(this,"droppable");if(g.options.greedy&&!g.options.disabled&&g.options.scope==c.options.scope&&g.accept.call(g.element[0],c.currentItem||c.element)&&d.ui.intersect(c,d.extend(g,{offset:g.element.offset()}),g.options.tolerance)){e=true;return false}});if(e)return false;if(this.accept.call(this.element[0],c.currentItem||c.element)){this.options.activeClass&&this.element.removeClass(this.options.activeClass);this.options.hoverClass&&this.element.removeClass(this.options.hoverClass);this._trigger("drop", +a,this.ui(c));return this.element}return false},ui:function(a){return{draggable:a.currentItem||a.element,helper:a.helper,position:a.position,offset:a.positionAbs}}});d.extend(d.ui.droppable,{version:"1.8.10"});d.ui.intersect=function(a,b,c){if(!b.offset)return false;var e=(a.positionAbs||a.position.absolute).left,g=e+a.helperProportions.width,f=(a.positionAbs||a.position.absolute).top,h=f+a.helperProportions.height,i=b.offset.left,k=i+b.proportions.width,j=b.offset.top,l=j+b.proportions.height; +switch(c){case "fit":return i<=e&&g<=k&&j<=f&&h<=l;case "intersect":return i<e+a.helperProportions.width/2&&g-a.helperProportions.width/2<k&&j<f+a.helperProportions.height/2&&h-a.helperProportions.height/2<l;case "pointer":return d.ui.isOver((a.positionAbs||a.position.absolute).top+(a.clickOffset||a.offset.click).top,(a.positionAbs||a.position.absolute).left+(a.clickOffset||a.offset.click).left,j,i,b.proportions.height,b.proportions.width);case "touch":return(f>=j&&f<=l||h>=j&&h<=l||f<j&&h>l)&&(e>= +i&&e<=k||g>=i&&g<=k||e<i&&g>k);default:return false}};d.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(a,b){var c=d.ui.ddmanager.droppables[a.options.scope]||[],e=b?b.type:null,g=(a.currentItem||a.element).find(":data(droppable)").andSelf(),f=0;a:for(;f<c.length;f++)if(!(c[f].options.disabled||a&&!c[f].accept.call(c[f].element[0],a.currentItem||a.element))){for(var h=0;h<g.length;h++)if(g[h]==c[f].element[0]){c[f].proportions.height=0;continue a}c[f].visible=c[f].element.css("display")!= +"none";if(c[f].visible){c[f].offset=c[f].element.offset();c[f].proportions={width:c[f].element[0].offsetWidth,height:c[f].element[0].offsetHeight};e=="mousedown"&&c[f]._activate.call(c[f],b)}}},drop:function(a,b){var c=false;d.each(d.ui.ddmanager.droppables[a.options.scope]||[],function(){if(this.options){if(!this.options.disabled&&this.visible&&d.ui.intersect(a,this,this.options.tolerance))c=c||this._drop.call(this,b);if(!this.options.disabled&&this.visible&&this.accept.call(this.element[0],a.currentItem|| +a.element)){this.isout=1;this.isover=0;this._deactivate.call(this,b)}}});return c},drag:function(a,b){a.options.refreshPositions&&d.ui.ddmanager.prepareOffsets(a,b);d.each(d.ui.ddmanager.droppables[a.options.scope]||[],function(){if(!(this.options.disabled||this.greedyChild||!this.visible)){var c=d.ui.intersect(a,this,this.options.tolerance);if(c=!c&&this.isover==1?"isout":c&&this.isover==0?"isover":null){var e;if(this.options.greedy){var g=this.element.parents(":data(droppable):eq(0)");if(g.length){e= +d.data(g[0],"droppable");e.greedyChild=c=="isover"?1:0}}if(e&&c=="isover"){e.isover=0;e.isout=1;e._out.call(e,b)}this[c]=1;this[c=="isout"?"isover":"isout"]=0;this[c=="isover"?"_over":"_out"].call(this,b);if(e&&c=="isout"){e.isout=0;e.isover=1;e._over.call(e,b)}}}})}}})(jQuery); +;/* + * jQuery UI Resizable 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Resizables + * + * Depends: + * jquery.ui.core.js + * jquery.ui.mouse.js + * jquery.ui.widget.js + */ +(function(e){e.widget("ui.resizable",e.ui.mouse,{widgetEventPrefix:"resize",options:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,containment:false,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1E3},_create:function(){var b=this,a=this.options;this.element.addClass("ui-resizable");e.extend(this,{_aspectRatio:!!a.aspectRatio,aspectRatio:a.aspectRatio,originalElement:this.element, +_proportionallyResizeElements:[],_helper:a.helper||a.ghost||a.animate?a.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){/relative/.test(this.element.css("position"))&&e.browser.opera&&this.element.css({position:"relative",top:"auto",left:"auto"});this.element.wrap(e('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(), +top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle= +this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=a.handles||(!e(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne", +nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all")this.handles="n,e,s,w,se,sw,ne,nw";var c=this.handles.split(",");this.handles={};for(var d=0;d<c.length;d++){var f=e.trim(c[d]),g=e('<div class="ui-resizable-handle '+("ui-resizable-"+f)+'"></div>');/sw|se|ne|nw/.test(f)&&g.css({zIndex:++a.zIndex});"se"==f&&g.addClass("ui-icon ui-icon-gripsmall-diagonal-se");this.handles[f]=".ui-resizable-"+f;this.element.append(g)}}this._renderAxis=function(h){h=h||this.element;for(var i in this.handles){if(this.handles[i].constructor== +String)this.handles[i]=e(this.handles[i],this.element).show();if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var j=e(this.handles[i],this.element),k=0;k=/sw|ne|nw|se|n|s/.test(i)?j.outerHeight():j.outerWidth();j=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join("");h.css(j,k);this._proportionallyResize()}e(this.handles[i])}};this._renderAxis(this.element);this._handles=e(".ui-resizable-handle",this.element).disableSelection(); +this._handles.mouseover(function(){if(!b.resizing){if(this.className)var h=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);b.axis=h&&h[1]?h[1]:"se"}});if(a.autoHide){this._handles.hide();e(this.element).addClass("ui-resizable-autohide").hover(function(){e(this).removeClass("ui-resizable-autohide");b._handles.show()},function(){if(!b.resizing){e(this).addClass("ui-resizable-autohide");b._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var b=function(c){e(c).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()}; +if(this.elementIsWrapper){b(this.element);var a=this.element;a.after(this.originalElement.css({position:a.css("position"),width:a.outerWidth(),height:a.outerHeight(),top:a.css("top"),left:a.css("left")})).remove()}this.originalElement.css("resize",this.originalResizeStyle);b(this.originalElement);return this},_mouseCapture:function(b){var a=false;for(var c in this.handles)if(e(this.handles[c])[0]==b.target)a=true;return!this.options.disabled&&a},_mouseStart:function(b){var a=this.options,c=this.element.position(), +d=this.element;this.resizing=true;this.documentScroll={top:e(document).scrollTop(),left:e(document).scrollLeft()};if(d.is(".ui-draggable")||/absolute/.test(d.css("position")))d.css({position:"absolute",top:c.top,left:c.left});e.browser.opera&&/relative/.test(d.css("position"))&&d.css({position:"relative",top:"auto",left:"auto"});this._renderProxy();c=m(this.helper.css("left"));var f=m(this.helper.css("top"));if(a.containment){c+=e(a.containment).scrollLeft()||0;f+=e(a.containment).scrollTop()||0}this.offset= +this.helper.offset();this.position={left:c,top:f};this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalPosition={left:c,top:f};this.sizeDiff={width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};this.originalMousePosition={left:b.pageX,top:b.pageY};this.aspectRatio=typeof a.aspectRatio=="number"?a.aspectRatio: +this.originalSize.width/this.originalSize.height||1;a=e(".ui-resizable-"+this.axis).css("cursor");e("body").css("cursor",a=="auto"?this.axis+"-resize":a);d.addClass("ui-resizable-resizing");this._propagate("start",b);return true},_mouseDrag:function(b){var a=this.helper,c=this.originalMousePosition,d=this._change[this.axis];if(!d)return false;c=d.apply(this,[b,b.pageX-c.left||0,b.pageY-c.top||0]);if(this._aspectRatio||b.shiftKey)c=this._updateRatio(c,b);c=this._respectSize(c,b);this._propagate("resize", +b);a.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize();this._updateCache(c);this._trigger("resize",b,this.ui());return false},_mouseStop:function(b){this.resizing=false;var a=this.options,c=this;if(this._helper){var d=this._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName);d=f&&e.ui.hasScroll(d[0],"left")?0:c.sizeDiff.height; +f=f?0:c.sizeDiff.width;f={width:c.helper.width()-f,height:c.helper.height()-d};d=parseInt(c.element.css("left"),10)+(c.position.left-c.originalPosition.left)||null;var g=parseInt(c.element.css("top"),10)+(c.position.top-c.originalPosition.top)||null;a.animate||this.element.css(e.extend(f,{top:g,left:d}));c.helper.height(c.size.height);c.helper.width(c.size.width);this._helper&&!a.animate&&this._proportionallyResize()}e("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing"); +this._propagate("stop",b);this._helper&&this.helper.remove();return false},_updateCache:function(b){this.offset=this.helper.offset();if(l(b.left))this.position.left=b.left;if(l(b.top))this.position.top=b.top;if(l(b.height))this.size.height=b.height;if(l(b.width))this.size.width=b.width},_updateRatio:function(b){var a=this.position,c=this.size,d=this.axis;if(b.height)b.width=c.height*this.aspectRatio;else if(b.width)b.height=c.width/this.aspectRatio;if(d=="sw"){b.left=a.left+(c.width-b.width);b.top= +null}if(d=="nw"){b.top=a.top+(c.height-b.height);b.left=a.left+(c.width-b.width)}return b},_respectSize:function(b){var a=this.options,c=this.axis,d=l(b.width)&&a.maxWidth&&a.maxWidth<b.width,f=l(b.height)&&a.maxHeight&&a.maxHeight<b.height,g=l(b.width)&&a.minWidth&&a.minWidth>b.width,h=l(b.height)&&a.minHeight&&a.minHeight>b.height;if(g)b.width=a.minWidth;if(h)b.height=a.minHeight;if(d)b.width=a.maxWidth;if(f)b.height=a.maxHeight;var i=this.originalPosition.left+this.originalSize.width,j=this.position.top+ +this.size.height,k=/sw|nw|w/.test(c);c=/nw|ne|n/.test(c);if(g&&k)b.left=i-a.minWidth;if(d&&k)b.left=i-a.maxWidth;if(h&&c)b.top=j-a.minHeight;if(f&&c)b.top=j-a.maxHeight;if((a=!b.width&&!b.height)&&!b.left&&b.top)b.top=null;else if(a&&!b.top&&b.left)b.left=null;return b},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var b=this.helper||this.element,a=0;a<this._proportionallyResizeElements.length;a++){var c=this._proportionallyResizeElements[a];if(!this.borderDif){var d= +[c.css("borderTopWidth"),c.css("borderRightWidth"),c.css("borderBottomWidth"),c.css("borderLeftWidth")],f=[c.css("paddingTop"),c.css("paddingRight"),c.css("paddingBottom"),c.css("paddingLeft")];this.borderDif=e.map(d,function(g,h){g=parseInt(g,10)||0;h=parseInt(f[h],10)||0;return g+h})}e.browser.msie&&(e(b).is(":hidden")||e(b).parents(":hidden").length)||c.css({height:b.height()-this.borderDif[0]-this.borderDif[2]||0,width:b.width()-this.borderDif[1]-this.borderDif[3]||0})}},_renderProxy:function(){var b= +this.options;this.elementOffset=this.element.offset();if(this._helper){this.helper=this.helper||e('<div style="overflow:hidden;"></div>');var a=e.browser.msie&&e.browser.version<7,c=a?1:0;a=a?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+a,height:this.element.outerHeight()+a,position:"absolute",left:this.elementOffset.left-c+"px",top:this.elementOffset.top-c+"px",zIndex:++b.zIndex});this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(b, +a){return{width:this.originalSize.width+a}},w:function(b,a){return{left:this.originalPosition.left+a,width:this.originalSize.width-a}},n:function(b,a,c){return{top:this.originalPosition.top+c,height:this.originalSize.height-c}},s:function(b,a,c){return{height:this.originalSize.height+c}},se:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},sw:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,a, +c]))},ne:function(b,a,c){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},nw:function(b,a,c){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,a,c]))}},_propagate:function(b,a){e.ui.plugin.call(this,b,[a,this.ui()]);b!="resize"&&this._trigger(b,a,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize, +originalPosition:this.originalPosition}}});e.extend(e.ui.resizable,{version:"1.8.10"});e.ui.plugin.add("resizable","alsoResize",{start:function(){var b=e(this).data("resizable").options,a=function(c){e(c).each(function(){var d=e(this);d.data("resizable-alsoresize",{width:parseInt(d.width(),10),height:parseInt(d.height(),10),left:parseInt(d.css("left"),10),top:parseInt(d.css("top"),10),position:d.css("position")})})};if(typeof b.alsoResize=="object"&&!b.alsoResize.parentNode)if(b.alsoResize.length){b.alsoResize= +b.alsoResize[0];a(b.alsoResize)}else e.each(b.alsoResize,function(c){a(c)});else a(b.alsoResize)},resize:function(b,a){var c=e(this).data("resizable");b=c.options;var d=c.originalSize,f=c.originalPosition,g={height:c.size.height-d.height||0,width:c.size.width-d.width||0,top:c.position.top-f.top||0,left:c.position.left-f.left||0},h=function(i,j){e(i).each(function(){var k=e(this),q=e(this).data("resizable-alsoresize"),p={},r=j&&j.length?j:k.parents(a.originalElement[0]).length?["width","height"]:["width", +"height","top","left"];e.each(r,function(n,o){if((n=(q[o]||0)+(g[o]||0))&&n>=0)p[o]=n||null});if(e.browser.opera&&/relative/.test(k.css("position"))){c._revertToRelativePosition=true;k.css({position:"absolute",top:"auto",left:"auto"})}k.css(p)})};typeof b.alsoResize=="object"&&!b.alsoResize.nodeType?e.each(b.alsoResize,function(i,j){h(i,j)}):h(b.alsoResize)},stop:function(){var b=e(this).data("resizable"),a=b.options,c=function(d){e(d).each(function(){var f=e(this);f.css({position:f.data("resizable-alsoresize").position})})}; +if(b._revertToRelativePosition){b._revertToRelativePosition=false;typeof a.alsoResize=="object"&&!a.alsoResize.nodeType?e.each(a.alsoResize,function(d){c(d)}):c(a.alsoResize)}e(this).removeData("resizable-alsoresize")}});e.ui.plugin.add("resizable","animate",{stop:function(b){var a=e(this).data("resizable"),c=a.options,d=a._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName),g=f&&e.ui.hasScroll(d[0],"left")?0:a.sizeDiff.height;f={width:a.size.width-(f?0:a.sizeDiff.width),height:a.size.height- +g};g=parseInt(a.element.css("left"),10)+(a.position.left-a.originalPosition.left)||null;var h=parseInt(a.element.css("top"),10)+(a.position.top-a.originalPosition.top)||null;a.element.animate(e.extend(f,h&&g?{top:h,left:g}:{}),{duration:c.animateDuration,easing:c.animateEasing,step:function(){var i={width:parseInt(a.element.css("width"),10),height:parseInt(a.element.css("height"),10),top:parseInt(a.element.css("top"),10),left:parseInt(a.element.css("left"),10)};d&&d.length&&e(d[0]).css({width:i.width, +height:i.height});a._updateCache(i);a._propagate("resize",b)}})}});e.ui.plugin.add("resizable","containment",{start:function(){var b=e(this).data("resizable"),a=b.element,c=b.options.containment;if(a=c instanceof e?c.get(0):/parent/.test(c)?a.parent().get(0):c){b.containerElement=e(a);if(/document/.test(c)||c==document){b.containerOffset={left:0,top:0};b.containerPosition={left:0,top:0};b.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}}else{var d= +e(a),f=[];e(["Top","Right","Left","Bottom"]).each(function(i,j){f[i]=m(d.css("padding"+j))});b.containerOffset=d.offset();b.containerPosition=d.position();b.containerSize={height:d.innerHeight()-f[3],width:d.innerWidth()-f[1]};c=b.containerOffset;var g=b.containerSize.height,h=b.containerSize.width;h=e.ui.hasScroll(a,"left")?a.scrollWidth:h;g=e.ui.hasScroll(a)?a.scrollHeight:g;b.parentData={element:a,left:c.left,top:c.top,width:h,height:g}}}},resize:function(b){var a=e(this).data("resizable"),c=a.options, +d=a.containerOffset,f=a.position;b=a._aspectRatio||b.shiftKey;var g={top:0,left:0},h=a.containerElement;if(h[0]!=document&&/static/.test(h.css("position")))g=d;if(f.left<(a._helper?d.left:0)){a.size.width+=a._helper?a.position.left-d.left:a.position.left-g.left;if(b)a.size.height=a.size.width/c.aspectRatio;a.position.left=c.helper?d.left:0}if(f.top<(a._helper?d.top:0)){a.size.height+=a._helper?a.position.top-d.top:a.position.top;if(b)a.size.width=a.size.height*c.aspectRatio;a.position.top=a._helper? +d.top:0}a.offset.left=a.parentData.left+a.position.left;a.offset.top=a.parentData.top+a.position.top;c=Math.abs((a._helper?a.offset.left-g.left:a.offset.left-g.left)+a.sizeDiff.width);d=Math.abs((a._helper?a.offset.top-g.top:a.offset.top-d.top)+a.sizeDiff.height);f=a.containerElement.get(0)==a.element.parent().get(0);g=/relative|absolute/.test(a.containerElement.css("position"));if(f&&g)c-=a.parentData.left;if(c+a.size.width>=a.parentData.width){a.size.width=a.parentData.width-c;if(b)a.size.height= +a.size.width/a.aspectRatio}if(d+a.size.height>=a.parentData.height){a.size.height=a.parentData.height-d;if(b)a.size.width=a.size.height*a.aspectRatio}},stop:function(){var b=e(this).data("resizable"),a=b.options,c=b.containerOffset,d=b.containerPosition,f=b.containerElement,g=e(b.helper),h=g.offset(),i=g.outerWidth()-b.sizeDiff.width;g=g.outerHeight()-b.sizeDiff.height;b._helper&&!a.animate&&/relative/.test(f.css("position"))&&e(this).css({left:h.left-d.left-c.left,width:i,height:g});b._helper&&!a.animate&& +/static/.test(f.css("position"))&&e(this).css({left:h.left-d.left-c.left,width:i,height:g})}});e.ui.plugin.add("resizable","ghost",{start:function(){var b=e(this).data("resizable"),a=b.options,c=b.size;b.ghost=b.originalElement.clone();b.ghost.css({opacity:0.25,display:"block",position:"relative",height:c.height,width:c.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof a.ghost=="string"?a.ghost:"");b.ghost.appendTo(b.helper)},resize:function(){var b=e(this).data("resizable"); +b.ghost&&b.ghost.css({position:"relative",height:b.size.height,width:b.size.width})},stop:function(){var b=e(this).data("resizable");b.ghost&&b.helper&&b.helper.get(0).removeChild(b.ghost.get(0))}});e.ui.plugin.add("resizable","grid",{resize:function(){var b=e(this).data("resizable"),a=b.options,c=b.size,d=b.originalSize,f=b.originalPosition,g=b.axis;a.grid=typeof a.grid=="number"?[a.grid,a.grid]:a.grid;var h=Math.round((c.width-d.width)/(a.grid[0]||1))*(a.grid[0]||1);a=Math.round((c.height-d.height)/ +(a.grid[1]||1))*(a.grid[1]||1);if(/^(se|s|e)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a}else if(/^(ne)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}else{if(/^(sw)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a}else{b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}b.position.left=f.left-h}}});var m=function(b){return parseInt(b,10)||0},l=function(b){return!isNaN(parseInt(b,10))}})(jQuery); +;/* + * jQuery UI Selectable 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Selectables + * + * Depends: + * jquery.ui.core.js + * jquery.ui.mouse.js + * jquery.ui.widget.js + */ +(function(e){e.widget("ui.selectable",e.ui.mouse,{options:{appendTo:"body",autoRefresh:true,distance:0,filter:"*",tolerance:"touch"},_create:function(){var c=this;this.element.addClass("ui-selectable");this.dragged=false;var f;this.refresh=function(){f=e(c.options.filter,c.element[0]);f.each(function(){var d=e(this),b=d.offset();e.data(this,"selectable-item",{element:this,$element:d,left:b.left,top:b.top,right:b.left+d.outerWidth(),bottom:b.top+d.outerHeight(),startselected:false,selected:d.hasClass("ui-selected"), +selecting:d.hasClass("ui-selecting"),unselecting:d.hasClass("ui-unselecting")})})};this.refresh();this.selectees=f.addClass("ui-selectee");this._mouseInit();this.helper=e("<div class='ui-selectable-helper'></div>")},destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item");this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy();return this},_mouseStart:function(c){var f=this;this.opos=[c.pageX, +c.pageY];if(!this.options.disabled){var d=this.options;this.selectees=e(d.filter,this.element[0]);this._trigger("start",c);e(d.appendTo).append(this.helper);this.helper.css({left:c.clientX,top:c.clientY,width:0,height:0});d.autoRefresh&&this.refresh();this.selectees.filter(".ui-selected").each(function(){var b=e.data(this,"selectable-item");b.startselected=true;if(!c.metaKey){b.$element.removeClass("ui-selected");b.selected=false;b.$element.addClass("ui-unselecting");b.unselecting=true;f._trigger("unselecting", +c,{unselecting:b.element})}});e(c.target).parents().andSelf().each(function(){var b=e.data(this,"selectable-item");if(b){var g=!c.metaKey||!b.$element.hasClass("ui-selected");b.$element.removeClass(g?"ui-unselecting":"ui-selected").addClass(g?"ui-selecting":"ui-unselecting");b.unselecting=!g;b.selecting=g;(b.selected=g)?f._trigger("selecting",c,{selecting:b.element}):f._trigger("unselecting",c,{unselecting:b.element});return false}})}},_mouseDrag:function(c){var f=this;this.dragged=true;if(!this.options.disabled){var d= +this.options,b=this.opos[0],g=this.opos[1],h=c.pageX,i=c.pageY;if(b>h){var j=h;h=b;b=j}if(g>i){j=i;i=g;g=j}this.helper.css({left:b,top:g,width:h-b,height:i-g});this.selectees.each(function(){var a=e.data(this,"selectable-item");if(!(!a||a.element==f.element[0])){var k=false;if(d.tolerance=="touch")k=!(a.left>h||a.right<b||a.top>i||a.bottom<g);else if(d.tolerance=="fit")k=a.left>b&&a.right<h&&a.top>g&&a.bottom<i;if(k){if(a.selected){a.$element.removeClass("ui-selected");a.selected=false}if(a.unselecting){a.$element.removeClass("ui-unselecting"); +a.unselecting=false}if(!a.selecting){a.$element.addClass("ui-selecting");a.selecting=true;f._trigger("selecting",c,{selecting:a.element})}}else{if(a.selecting)if(c.metaKey&&a.startselected){a.$element.removeClass("ui-selecting");a.selecting=false;a.$element.addClass("ui-selected");a.selected=true}else{a.$element.removeClass("ui-selecting");a.selecting=false;if(a.startselected){a.$element.addClass("ui-unselecting");a.unselecting=true}f._trigger("unselecting",c,{unselecting:a.element})}if(a.selected)if(!c.metaKey&& +!a.startselected){a.$element.removeClass("ui-selected");a.selected=false;a.$element.addClass("ui-unselecting");a.unselecting=true;f._trigger("unselecting",c,{unselecting:a.element})}}}});return false}},_mouseStop:function(c){var f=this;this.dragged=false;e(".ui-unselecting",this.element[0]).each(function(){var d=e.data(this,"selectable-item");d.$element.removeClass("ui-unselecting");d.unselecting=false;d.startselected=false;f._trigger("unselected",c,{unselected:d.element})});e(".ui-selecting",this.element[0]).each(function(){var d= +e.data(this,"selectable-item");d.$element.removeClass("ui-selecting").addClass("ui-selected");d.selecting=false;d.selected=true;d.startselected=true;f._trigger("selected",c,{selected:d.element})});this._trigger("stop",c);this.helper.remove();return false}});e.extend(e.ui.selectable,{version:"1.8.10"})})(jQuery); +;/* + * jQuery UI Sortable 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Sortables + * + * Depends: + * jquery.ui.core.js + * jquery.ui.mouse.js + * jquery.ui.widget.js + */ +(function(d){d.widget("ui.sortable",d.ui.mouse,{widgetEventPrefix:"sort",options:{appendTo:"parent",axis:false,connectWith:false,containment:false,cursor:"auto",cursorAt:false,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,grid:false,handle:false,helper:"original",items:"> *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1E3},_create:function(){this.containerCache={};this.element.addClass("ui-sortable"); +this.refresh();this.floating=this.items.length?/left|right/.test(this.items[0].item.css("float")):false;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var a=this.items.length-1;a>=0;a--)this.items[a].item.removeData("sortable-item");return this},_setOption:function(a,b){if(a==="disabled"){this.options[a]=b;this.widget()[b?"addClass":"removeClass"]("ui-sortable-disabled")}else d.Widget.prototype._setOption.apply(this, +arguments)},_mouseCapture:function(a,b){if(this.reverting)return false;if(this.options.disabled||this.options.type=="static")return false;this._refreshItems(a);var c=null,e=this;d(a.target).parents().each(function(){if(d.data(this,"sortable-item")==e){c=d(this);return false}});if(d.data(a.target,"sortable-item")==e)c=d(a.target);if(!c)return false;if(this.options.handle&&!b){var f=false;d(this.options.handle,c).find("*").andSelf().each(function(){if(this==a.target)f=true});if(!f)return false}this.currentItem= +c;this._removeCurrentsFromItems();return true},_mouseStart:function(a,b,c){b=this.options;var e=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(a);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");d.extend(this.offset, +{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};this.helper[0]!=this.currentItem[0]&&this.currentItem.hide();this._createPlaceholder();b.containment&&this._setContainment(); +if(b.cursor){if(d("body").css("cursor"))this._storedCursor=d("body").css("cursor");d("body").css("cursor",b.cursor)}if(b.opacity){if(this.helper.css("opacity"))this._storedOpacity=this.helper.css("opacity");this.helper.css("opacity",b.opacity)}if(b.zIndex){if(this.helper.css("zIndex"))this._storedZIndex=this.helper.css("zIndex");this.helper.css("zIndex",b.zIndex)}if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML")this.overflowOffset=this.scrollParent.offset();this._trigger("start", +a,this._uiHash());this._preserveHelperProportions||this._cacheHelperProportions();if(!c)for(c=this.containers.length-1;c>=0;c--)this.containers[c]._trigger("activate",a,e._uiHash(this));if(d.ui.ddmanager)d.ui.ddmanager.current=this;d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(a);return true},_mouseDrag:function(a){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute"); +if(!this.lastPositionAbs)this.lastPositionAbs=this.positionAbs;if(this.options.scroll){var b=this.options,c=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if(this.overflowOffset.top+this.scrollParent[0].offsetHeight-a.pageY<b.scrollSensitivity)this.scrollParent[0].scrollTop=c=this.scrollParent[0].scrollTop+b.scrollSpeed;else if(a.pageY-this.overflowOffset.top<b.scrollSensitivity)this.scrollParent[0].scrollTop=c=this.scrollParent[0].scrollTop-b.scrollSpeed;if(this.overflowOffset.left+ +this.scrollParent[0].offsetWidth-a.pageX<b.scrollSensitivity)this.scrollParent[0].scrollLeft=c=this.scrollParent[0].scrollLeft+b.scrollSpeed;else if(a.pageX-this.overflowOffset.left<b.scrollSensitivity)this.scrollParent[0].scrollLeft=c=this.scrollParent[0].scrollLeft-b.scrollSpeed}else{if(a.pageY-d(document).scrollTop()<b.scrollSensitivity)c=d(document).scrollTop(d(document).scrollTop()-b.scrollSpeed);else if(d(window).height()-(a.pageY-d(document).scrollTop())<b.scrollSensitivity)c=d(document).scrollTop(d(document).scrollTop()+ +b.scrollSpeed);if(a.pageX-d(document).scrollLeft()<b.scrollSensitivity)c=d(document).scrollLeft(d(document).scrollLeft()-b.scrollSpeed);else if(d(window).width()-(a.pageX-d(document).scrollLeft())<b.scrollSensitivity)c=d(document).scrollLeft(d(document).scrollLeft()+b.scrollSpeed)}c!==false&&d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a)}this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+ +"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";for(b=this.items.length-1;b>=0;b--){c=this.items[b];var e=c.item[0],f=this._intersectsWithPointer(c);if(f)if(e!=this.currentItem[0]&&this.placeholder[f==1?"next":"prev"]()[0]!=e&&!d.ui.contains(this.placeholder[0],e)&&(this.options.type=="semi-dynamic"?!d.ui.contains(this.element[0],e):true)){this.direction=f==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(c))this._rearrange(a, +c);else break;this._trigger("change",a,this._uiHash());break}}this._contactContainers(a);d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);this._trigger("sort",a,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(a,b){if(a){d.ui.ddmanager&&!this.options.dropBehaviour&&d.ui.ddmanager.drop(this,a);if(this.options.revert){var c=this;b=c.placeholder.offset();c.reverting=true;d(this.helper).animate({left:b.left-this.offset.parent.left-c.margins.left+(this.offsetParent[0]== +document.body?0:this.offsetParent[0].scrollLeft),top:b.top-this.offset.parent.top-c.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){c._clear(a)})}else this._clear(a,b);return false}},cancel:function(){var a=this;if(this.dragging){this._mouseUp({target:null});this.options.helper=="original"?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var b=this.containers.length- +1;b>=0;b--){this.containers[b]._trigger("deactivate",null,a._uiHash(this));if(this.containers[b].containerCache.over){this.containers[b]._trigger("out",null,a._uiHash(this));this.containers[b].containerCache.over=0}}}if(this.placeholder){this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]);this.options.helper!="original"&&this.helper&&this.helper[0].parentNode&&this.helper.remove();d.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null}); +this.domPosition.prev?d(this.domPosition.prev).after(this.currentItem):d(this.domPosition.parent).prepend(this.currentItem)}return this},serialize:function(a){var b=this._getItemsAsjQuery(a&&a.connected),c=[];a=a||{};d(b).each(function(){var e=(d(a.item||this).attr(a.attribute||"id")||"").match(a.expression||/(.+)[-=_](.+)/);if(e)c.push((a.key||e[1]+"[]")+"="+(a.key&&a.expression?e[1]:e[2]))});!c.length&&a.key&&c.push(a.key+"=");return c.join("&")},toArray:function(a){var b=this._getItemsAsjQuery(a&& +a.connected),c=[];a=a||{};b.each(function(){c.push(d(a.item||this).attr(a.attribute||"id")||"")});return c},_intersectsWith:function(a){var b=this.positionAbs.left,c=b+this.helperProportions.width,e=this.positionAbs.top,f=e+this.helperProportions.height,g=a.left,h=g+a.width,i=a.top,k=i+a.height,j=this.offset.click.top,l=this.offset.click.left;j=e+j>i&&e+j<k&&b+l>g&&b+l<h;return this.options.tolerance=="pointer"||this.options.forcePointerForContainers||this.options.tolerance!="pointer"&&this.helperProportions[this.floating? +"width":"height"]>a[this.floating?"width":"height"]?j:g<b+this.helperProportions.width/2&&c-this.helperProportions.width/2<h&&i<e+this.helperProportions.height/2&&f-this.helperProportions.height/2<k},_intersectsWithPointer:function(a){var b=d.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,a.top,a.height);a=d.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,a.left,a.width);b=b&&a;a=this._getDragVerticalDirection();var c=this._getDragHorizontalDirection();if(!b)return false;return this.floating? +c&&c=="right"||a=="down"?2:1:a&&(a=="down"?2:1)},_intersectsWithSides:function(a){var b=d.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,a.top+a.height/2,a.height);a=d.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,a.left+a.width/2,a.width);var c=this._getDragVerticalDirection(),e=this._getDragHorizontalDirection();return this.floating&&e?e=="right"&&a||e=="left"&&!a:c&&(c=="down"&&b||c=="up"&&!b)},_getDragVerticalDirection:function(){var a=this.positionAbs.top-this.lastPositionAbs.top; +return a!=0&&(a>0?"down":"up")},_getDragHorizontalDirection:function(){var a=this.positionAbs.left-this.lastPositionAbs.left;return a!=0&&(a>0?"right":"left")},refresh:function(a){this._refreshItems(a);this.refreshPositions();return this},_connectWith:function(){var a=this.options;return a.connectWith.constructor==String?[a.connectWith]:a.connectWith},_getItemsAsjQuery:function(a){var b=[],c=[],e=this._connectWith();if(e&&a)for(a=e.length-1;a>=0;a--)for(var f=d(e[a]),g=f.length-1;g>=0;g--){var h= +d.data(f[g],"sortable");if(h&&h!=this&&!h.options.disabled)c.push([d.isFunction(h.options.items)?h.options.items.call(h.element):d(h.options.items,h.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),h])}c.push([d.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):d(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);for(a=c.length-1;a>=0;a--)c[a][0].each(function(){b.push(this)}); +return d(b)},_removeCurrentsFromItems:function(){for(var a=this.currentItem.find(":data(sortable-item)"),b=0;b<this.items.length;b++)for(var c=0;c<a.length;c++)a[c]==this.items[b].item[0]&&this.items.splice(b,1)},_refreshItems:function(a){this.items=[];this.containers=[this];var b=this.items,c=[[d.isFunction(this.options.items)?this.options.items.call(this.element[0],a,{item:this.currentItem}):d(this.options.items,this.element),this]],e=this._connectWith();if(e)for(var f=e.length-1;f>=0;f--)for(var g= +d(e[f]),h=g.length-1;h>=0;h--){var i=d.data(g[h],"sortable");if(i&&i!=this&&!i.options.disabled){c.push([d.isFunction(i.options.items)?i.options.items.call(i.element[0],a,{item:this.currentItem}):d(i.options.items,i.element),i]);this.containers.push(i)}}for(f=c.length-1;f>=0;f--){a=c[f][1];e=c[f][0];h=0;for(g=e.length;h<g;h++){i=d(e[h]);i.data("sortable-item",a);b.push({item:i,instance:a,width:0,height:0,left:0,top:0})}}},refreshPositions:function(a){if(this.offsetParent&&this.helper)this.offset.parent= +this._getParentOffset();for(var b=this.items.length-1;b>=0;b--){var c=this.items[b],e=this.options.toleranceElement?d(this.options.toleranceElement,c.item):c.item;if(!a){c.width=e.outerWidth();c.height=e.outerHeight()}e=e.offset();c.left=e.left;c.top=e.top}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(b=this.containers.length-1;b>=0;b--){e=this.containers[b].element.offset();this.containers[b].containerCache.left=e.left;this.containers[b].containerCache.top= +e.top;this.containers[b].containerCache.width=this.containers[b].element.outerWidth();this.containers[b].containerCache.height=this.containers[b].element.outerHeight()}return this},_createPlaceholder:function(a){var b=a||this,c=b.options;if(!c.placeholder||c.placeholder.constructor==String){var e=c.placeholder;c.placeholder={element:function(){var f=d(document.createElement(b.currentItem[0].nodeName)).addClass(e||b.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0]; +if(!e)f.style.visibility="hidden";return f},update:function(f,g){if(!(e&&!c.forcePlaceholderSize)){g.height()||g.height(b.currentItem.innerHeight()-parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10));g.width()||g.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")||0,10))}}}}b.placeholder=d(c.placeholder.element.call(b.element,b.currentItem));b.currentItem.after(b.placeholder); +c.placeholder.update(b,b.placeholder)},_contactContainers:function(a){for(var b=null,c=null,e=this.containers.length-1;e>=0;e--)if(!d.ui.contains(this.currentItem[0],this.containers[e].element[0]))if(this._intersectsWith(this.containers[e].containerCache)){if(!(b&&d.ui.contains(this.containers[e].element[0],b.element[0]))){b=this.containers[e];c=e}}else if(this.containers[e].containerCache.over){this.containers[e]._trigger("out",a,this._uiHash(this));this.containers[e].containerCache.over=0}if(b)if(this.containers.length=== +1){this.containers[c]._trigger("over",a,this._uiHash(this));this.containers[c].containerCache.over=1}else if(this.currentContainer!=this.containers[c]){b=1E4;e=null;for(var f=this.positionAbs[this.containers[c].floating?"left":"top"],g=this.items.length-1;g>=0;g--)if(d.ui.contains(this.containers[c].element[0],this.items[g].item[0])){var h=this.items[g][this.containers[c].floating?"left":"top"];if(Math.abs(h-f)<b){b=Math.abs(h-f);e=this.items[g]}}if(e||this.options.dropOnEmpty){this.currentContainer= +this.containers[c];e?this._rearrange(a,e,null,true):this._rearrange(a,null,this.containers[c].element,true);this._trigger("change",a,this._uiHash());this.containers[c]._trigger("change",a,this._uiHash(this));this.options.placeholder.update(this.currentContainer,this.placeholder);this.containers[c]._trigger("over",a,this._uiHash(this));this.containers[c].containerCache.over=1}}},_createHelper:function(a){var b=this.options;a=d.isFunction(b.helper)?d(b.helper.apply(this.element[0],[a,this.currentItem])): +b.helper=="clone"?this.currentItem.clone():this.currentItem;a.parents("body").length||d(b.appendTo!="parent"?b.appendTo:this.currentItem[0].parentNode)[0].appendChild(a[0]);if(a[0]==this.currentItem[0])this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")};if(a[0].style.width==""||b.forceHelperSize)a.width(this.currentItem.width());if(a[0].style.height== +""||b.forceHelperSize)a.height(this.currentItem.height());return a},_adjustOffsetFromHelper:function(a){if(typeof a=="string")a=a.split(" ");if(d.isArray(a))a={left:+a[0],top:+a[1]||0};if("left"in a)this.offset.click.left=a.left+this.margins.left;if("right"in a)this.offset.click.left=this.helperProportions.width-a.right+this.margins.left;if("top"in a)this.offset.click.top=a.top+this.margins.top;if("bottom"in a)this.offset.click.top=this.helperProportions.height-a.bottom+this.margins.top},_getParentOffset:function(){this.offsetParent= +this.helper.offsetParent();var a=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0])){a.left+=this.scrollParent.scrollLeft();a.top+=this.scrollParent.scrollTop()}if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&d.browser.msie)a={top:0,left:0};return{top:a.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:a.left+(parseInt(this.offsetParent.css("borderLeftWidth"), +10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.currentItem.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions= +{width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var a=this.options;if(a.containment=="parent")a.containment=this.helper[0].parentNode;if(a.containment=="document"||a.containment=="window")this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,d(a.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(d(a.containment=="document"?document:window).height()|| +document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(a.containment)){var b=d(a.containment)[0];a=d(a.containment).offset();var c=d(b).css("overflow")!="hidden";this.containment=[a.left+(parseInt(d(b).css("borderLeftWidth"),10)||0)+(parseInt(d(b).css("paddingLeft"),10)||0)-this.margins.left,a.top+(parseInt(d(b).css("borderTopWidth"),10)||0)+(parseInt(d(b).css("paddingTop"),10)||0)-this.margins.top,a.left+(c?Math.max(b.scrollWidth, +b.offsetWidth):b.offsetWidth)-(parseInt(d(b).css("borderLeftWidth"),10)||0)-(parseInt(d(b).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,a.top+(c?Math.max(b.scrollHeight,b.offsetHeight):b.offsetHeight)-(parseInt(d(b).css("borderTopWidth"),10)||0)-(parseInt(d(b).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(a,b){if(!b)b=this.position;a=a=="absolute"?1:-1;var c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!= +document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,e=/(html|body)/i.test(c[0].tagName);return{top:b.top+this.offset.relative.top*a+this.offset.parent.top*a-(d.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():e?0:c.scrollTop())*a),left:b.left+this.offset.relative.left*a+this.offset.parent.left*a-(d.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft(): +e?0:c.scrollLeft())*a)}},_generatePosition:function(a){var b=this.options,c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,e=/(html|body)/i.test(c[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0]))this.offset.relative=this._getRelativeOffset();var f=a.pageX,g=a.pageY;if(this.originalPosition){if(this.containment){if(a.pageX- +this.offset.click.left<this.containment[0])f=this.containment[0]+this.offset.click.left;if(a.pageY-this.offset.click.top<this.containment[1])g=this.containment[1]+this.offset.click.top;if(a.pageX-this.offset.click.left>this.containment[2])f=this.containment[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>this.containment[3])g=this.containment[3]+this.offset.click.top}if(b.grid){g=this.originalPageY+Math.round((g-this.originalPageY)/b.grid[1])*b.grid[1];g=this.containment?!(g-this.offset.click.top< +this.containment[1]||g-this.offset.click.top>this.containment[3])?g:!(g-this.offset.click.top<this.containment[1])?g-b.grid[1]:g+b.grid[1]:g;f=this.originalPageX+Math.round((f-this.originalPageX)/b.grid[0])*b.grid[0];f=this.containment?!(f-this.offset.click.left<this.containment[0]||f-this.offset.click.left>this.containment[2])?f:!(f-this.offset.click.left<this.containment[0])?f-b.grid[0]:f+b.grid[0]:f}}return{top:g-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(d.browser.safari&& +this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():e?0:c.scrollTop()),left:f-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(d.browser.safari&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():e?0:c.scrollLeft())}},_rearrange:function(a,b,c,e){c?c[0].appendChild(this.placeholder[0]):b.item[0].parentNode.insertBefore(this.placeholder[0],this.direction=="down"?b.item[0]:b.item[0].nextSibling);this.counter= +this.counter?++this.counter:1;var f=this,g=this.counter;window.setTimeout(function(){g==f.counter&&f.refreshPositions(!e)},0)},_clear:function(a,b){this.reverting=false;var c=[];!this._noFinalSort&&this.currentItem[0].parentNode&&this.placeholder.before(this.currentItem);this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var e in this._storedCSS)if(this._storedCSS[e]=="auto"||this._storedCSS[e]=="static")this._storedCSS[e]="";this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show(); +this.fromOutside&&!b&&c.push(function(f){this._trigger("receive",f,this._uiHash(this.fromOutside))});if((this.fromOutside||this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0])&&!b)c.push(function(f){this._trigger("update",f,this._uiHash())});if(!d.ui.contains(this.element[0],this.currentItem[0])){b||c.push(function(f){this._trigger("remove",f,this._uiHash())});for(e=this.containers.length-1;e>=0;e--)if(d.ui.contains(this.containers[e].element[0], +this.currentItem[0])&&!b){c.push(function(f){return function(g){f._trigger("receive",g,this._uiHash(this))}}.call(this,this.containers[e]));c.push(function(f){return function(g){f._trigger("update",g,this._uiHash(this))}}.call(this,this.containers[e]))}}for(e=this.containers.length-1;e>=0;e--){b||c.push(function(f){return function(g){f._trigger("deactivate",g,this._uiHash(this))}}.call(this,this.containers[e]));if(this.containers[e].containerCache.over){c.push(function(f){return function(g){f._trigger("out", +g,this._uiHash(this))}}.call(this,this.containers[e]));this.containers[e].containerCache.over=0}}this._storedCursor&&d("body").css("cursor",this._storedCursor);this._storedOpacity&&this.helper.css("opacity",this._storedOpacity);if(this._storedZIndex)this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex);this.dragging=false;if(this.cancelHelperRemoval){if(!b){this._trigger("beforeStop",a,this._uiHash());for(e=0;e<c.length;e++)c[e].call(this,a);this._trigger("stop",a,this._uiHash())}return false}b|| +this._trigger("beforeStop",a,this._uiHash());this.placeholder[0].parentNode.removeChild(this.placeholder[0]);this.helper[0]!=this.currentItem[0]&&this.helper.remove();this.helper=null;if(!b){for(e=0;e<c.length;e++)c[e].call(this,a);this._trigger("stop",a,this._uiHash())}this.fromOutside=false;return true},_trigger:function(){d.Widget.prototype._trigger.apply(this,arguments)===false&&this.cancel()},_uiHash:function(a){var b=a||this;return{helper:b.helper,placeholder:b.placeholder||d([]),position:b.position, +originalPosition:b.originalPosition,offset:b.positionAbs,item:b.currentItem,sender:a?a.element:null}}});d.extend(d.ui.sortable,{version:"1.8.10"})})(jQuery); +;/* + * jQuery UI Accordion 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Accordion + * + * Depends: + * jquery.ui.core.js + * jquery.ui.widget.js + */ +(function(c){c.widget("ui.accordion",{options:{active:0,animated:"slide",autoHeight:true,clearStyle:false,collapsible:false,event:"click",fillSpace:false,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}},_create:function(){var a=this,b=a.options;a.running=0;a.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix"); +a.headers=a.element.find(b.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){b.disabled||c(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){b.disabled||c(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){b.disabled||c(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){b.disabled||c(this).removeClass("ui-state-focus")});a.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom"); +if(b.navigation){var d=a.element.find("a").filter(b.navigationFilter).eq(0);if(d.length){var h=d.closest(".ui-accordion-header");a.active=h.length?h:d.closest(".ui-accordion-content").prev()}}a.active=a._findActive(a.active||b.active).addClass("ui-state-default ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");a.active.next().addClass("ui-accordion-content-active");a._createIcons();a.resize();a.element.attr("role","tablist");a.headers.attr("role","tab").bind("keydown.accordion", +function(f){return a._keydown(f)}).next().attr("role","tabpanel");a.headers.not(a.active||"").attr({"aria-expanded":"false",tabIndex:-1}).next().hide();a.active.length?a.active.attr({"aria-expanded":"true",tabIndex:0}):a.headers.eq(0).attr("tabIndex",0);c.browser.safari||a.headers.find("a").attr("tabIndex",-1);b.event&&a.headers.bind(b.event.split(" ").join(".accordion ")+".accordion",function(f){a._clickHandler.call(a,f,this);f.preventDefault()})},_createIcons:function(){var a=this.options;if(a.icons){c("<span></span>").addClass("ui-icon "+ +a.icons.header).prependTo(this.headers);this.active.children(".ui-icon").toggleClass(a.icons.header).toggleClass(a.icons.headerSelected);this.element.addClass("ui-accordion-icons")}},_destroyIcons:function(){this.headers.children(".ui-icon").remove();this.element.removeClass("ui-accordion-icons")},destroy:function(){var a=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role");this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("tabIndex"); +this.headers.find("a").removeAttr("tabIndex");this._destroyIcons();var b=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled");if(a.autoHeight||a.fillHeight)b.css("height","");return c.Widget.prototype.destroy.call(this)},_setOption:function(a,b){c.Widget.prototype._setOption.apply(this,arguments);a=="active"&&this.activate(b);if(a=="icons"){this._destroyIcons(); +b&&this._createIcons()}if(a=="disabled")this.headers.add(this.headers.next())[b?"addClass":"removeClass"]("ui-accordion-disabled ui-state-disabled")},_keydown:function(a){if(!(this.options.disabled||a.altKey||a.ctrlKey)){var b=c.ui.keyCode,d=this.headers.length,h=this.headers.index(a.target),f=false;switch(a.keyCode){case b.RIGHT:case b.DOWN:f=this.headers[(h+1)%d];break;case b.LEFT:case b.UP:f=this.headers[(h-1+d)%d];break;case b.SPACE:case b.ENTER:this._clickHandler({target:a.target},a.target); +a.preventDefault()}if(f){c(a.target).attr("tabIndex",-1);c(f).attr("tabIndex",0);f.focus();return false}return true}},resize:function(){var a=this.options,b;if(a.fillSpace){if(c.browser.msie){var d=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}b=this.element.parent().height();c.browser.msie&&this.element.parent().css("overflow",d);this.headers.each(function(){b-=c(this).outerHeight(true)});this.headers.next().each(function(){c(this).height(Math.max(0,b-c(this).innerHeight()+ +c(this).height()))}).css("overflow","auto")}else if(a.autoHeight){b=0;this.headers.next().each(function(){b=Math.max(b,c(this).height("").height())}).height(b)}return this},activate:function(a){this.options.active=a;a=this._findActive(a)[0];this._clickHandler({target:a},a);return this},_findActive:function(a){return a?typeof a==="number"?this.headers.filter(":eq("+a+")"):this.headers.not(this.headers.not(a)):a===false?c([]):this.headers.filter(":eq(0)")},_clickHandler:function(a,b){var d=this.options; +if(!d.disabled)if(a.target){a=c(a.currentTarget||b);b=a[0]===this.active[0];d.active=d.collapsible&&b?false:this.headers.index(a);if(!(this.running||!d.collapsible&&b)){var h=this.active;j=a.next();g=this.active.next();e={options:d,newHeader:b&&d.collapsible?c([]):a,oldHeader:this.active,newContent:b&&d.collapsible?c([]):j,oldContent:g};var f=this.headers.index(this.active[0])>this.headers.index(a[0]);this.active=b?c([]):a;this._toggle(j,g,e,b,f);h.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header); +if(!b){a.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").children(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected);a.next().addClass("ui-accordion-content-active")}}}else if(d.collapsible){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);this.active.next().addClass("ui-accordion-content-active");var g=this.active.next(), +e={options:d,newHeader:c([]),oldHeader:d.active,newContent:c([]),oldContent:g},j=this.active=c([]);this._toggle(j,g,e)}},_toggle:function(a,b,d,h,f){var g=this,e=g.options;g.toShow=a;g.toHide=b;g.data=d;var j=function(){if(g)return g._completed.apply(g,arguments)};g._trigger("changestart",null,g.data);g.running=b.size()===0?a.size():b.size();if(e.animated){d={};d=e.collapsible&&h?{toShow:c([]),toHide:b,complete:j,down:f,autoHeight:e.autoHeight||e.fillSpace}:{toShow:a,toHide:b,complete:j,down:f,autoHeight:e.autoHeight|| +e.fillSpace};if(!e.proxied)e.proxied=e.animated;if(!e.proxiedDuration)e.proxiedDuration=e.duration;e.animated=c.isFunction(e.proxied)?e.proxied(d):e.proxied;e.duration=c.isFunction(e.proxiedDuration)?e.proxiedDuration(d):e.proxiedDuration;h=c.ui.accordion.animations;var i=e.duration,k=e.animated;if(k&&!h[k]&&!c.easing[k])k="slide";h[k]||(h[k]=function(l){this.slide(l,{easing:k,duration:i||700})});h[k](d)}else{if(e.collapsible&&h)a.toggle();else{b.hide();a.show()}j(true)}b.prev().attr({"aria-expanded":"false", +tabIndex:-1}).blur();a.prev().attr({"aria-expanded":"true",tabIndex:0}).focus()},_completed:function(a){this.running=a?0:--this.running;if(!this.running){this.options.clearStyle&&this.toShow.add(this.toHide).css({height:"",overflow:""});this.toHide.removeClass("ui-accordion-content-active");if(this.toHide.length)this.toHide.parent()[0].className=this.toHide.parent()[0].className;this._trigger("change",null,this.data)}}});c.extend(c.ui.accordion,{version:"1.8.10",animations:{slide:function(a,b){a= +c.extend({easing:"swing",duration:300},a,b);if(a.toHide.size())if(a.toShow.size()){var d=a.toShow.css("overflow"),h=0,f={},g={},e;b=a.toShow;e=b[0].style.width;b.width(parseInt(b.parent().width(),10)-parseInt(b.css("paddingLeft"),10)-parseInt(b.css("paddingRight"),10)-(parseInt(b.css("borderLeftWidth"),10)||0)-(parseInt(b.css("borderRightWidth"),10)||0));c.each(["height","paddingTop","paddingBottom"],function(j,i){g[i]="hide";j=(""+c.css(a.toShow[0],i)).match(/^([\d+-.]+)(.*)$/);f[i]={value:j[1], +unit:j[2]||"px"}});a.toShow.css({height:0,overflow:"hidden"}).show();a.toHide.filter(":hidden").each(a.complete).end().filter(":visible").animate(g,{step:function(j,i){if(i.prop=="height")h=i.end-i.start===0?0:(i.now-i.start)/(i.end-i.start);a.toShow[0].style[i.prop]=h*f[i.prop].value+f[i.prop].unit},duration:a.duration,easing:a.easing,complete:function(){a.autoHeight||a.toShow.css("height","");a.toShow.css({width:e,overflow:d});a.complete()}})}else a.toHide.animate({height:"hide",paddingTop:"hide", +paddingBottom:"hide"},a);else a.toShow.animate({height:"show",paddingTop:"show",paddingBottom:"show"},a)},bounceslide:function(a){this.slide(a,{easing:a.down?"easeOutBounce":"swing",duration:a.down?1E3:200})}}})})(jQuery); +;/* + * jQuery UI Autocomplete 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Autocomplete + * + * Depends: + * jquery.ui.core.js + * jquery.ui.widget.js + * jquery.ui.position.js + */ +(function(d){var e=0;d.widget("ui.autocomplete",{options:{appendTo:"body",delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var a=this,b=this.element[0].ownerDocument,g;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(!(a.options.disabled||a.element.attr("readonly"))){g=false;var f=d.ui.keyCode; +switch(c.keyCode){case f.PAGE_UP:a._move("previousPage",c);break;case f.PAGE_DOWN:a._move("nextPage",c);break;case f.UP:a._move("previous",c);c.preventDefault();break;case f.DOWN:a._move("next",c);c.preventDefault();break;case f.ENTER:case f.NUMPAD_ENTER:if(a.menu.active){g=true;c.preventDefault()}case f.TAB:if(!a.menu.active)return;a.menu.select(c);break;case f.ESCAPE:a.element.val(a.term);a.close(c);break;default:clearTimeout(a.searching);a.searching=setTimeout(function(){if(a.term!=a.element.val()){a.selectedItem= +null;a.search(null,c)}},a.options.delay);break}}}).bind("keypress.autocomplete",function(c){if(g){g=false;c.preventDefault()}}).bind("focus.autocomplete",function(){if(!a.options.disabled){a.selectedItem=null;a.previous=a.element.val()}}).bind("blur.autocomplete",function(c){if(!a.options.disabled){clearTimeout(a.searching);a.closing=setTimeout(function(){a.close(c);a._change(c)},150)}});this._initSource();this.response=function(){return a._response.apply(a,arguments)};this.menu=d("<ul></ul>").addClass("ui-autocomplete").appendTo(d(this.options.appendTo|| +"body",b)[0]).mousedown(function(c){var f=a.menu.element[0];d(c.target).closest(".ui-menu-item").length||setTimeout(function(){d(document).one("mousedown",function(h){h.target!==a.element[0]&&h.target!==f&&!d.ui.contains(f,h.target)&&a.close()})},1);setTimeout(function(){clearTimeout(a.closing)},13)}).menu({focus:function(c,f){f=f.item.data("item.autocomplete");false!==a._trigger("focus",c,{item:f})&&/^key/.test(c.originalEvent.type)&&a.element.val(f.value)},selected:function(c,f){var h=f.item.data("item.autocomplete"), +i=a.previous;if(a.element[0]!==b.activeElement){a.element.focus();a.previous=i;setTimeout(function(){a.previous=i;a.selectedItem=h},1)}false!==a._trigger("select",c,{item:h})&&a.element.val(h.value);a.term=a.element.val();a.close(c);a.selectedItem=h},blur:function(){a.menu.element.is(":visible")&&a.element.val()!==a.term&&a.element.val(a.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu");d.fn.bgiframe&&this.menu.element.bgiframe()},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup"); +this.menu.element.remove();d.Widget.prototype.destroy.call(this)},_setOption:function(a,b){d.Widget.prototype._setOption.apply(this,arguments);a==="source"&&this._initSource();if(a==="appendTo")this.menu.element.appendTo(d(b||"body",this.element[0].ownerDocument)[0]);a==="disabled"&&b&&this.xhr&&this.xhr.abort()},_initSource:function(){var a=this,b,g;if(d.isArray(this.options.source)){b=this.options.source;this.source=function(c,f){f(d.ui.autocomplete.filter(b,c.term))}}else if(typeof this.options.source=== +"string"){g=this.options.source;this.source=function(c,f){a.xhr&&a.xhr.abort();a.xhr=d.ajax({url:g,data:c,dataType:"json",autocompleteRequest:++e,success:function(h){this.autocompleteRequest===e&&f(h)},error:function(){this.autocompleteRequest===e&&f([])}})}}else this.source=this.options.source},search:function(a,b){a=a!=null?a:this.element.val();this.term=this.element.val();if(a.length<this.options.minLength)return this.close(b);clearTimeout(this.closing);if(this._trigger("search",b)!==false)return this._search(a)}, +_search:function(a){this.pending++;this.element.addClass("ui-autocomplete-loading");this.source({term:a},this.response)},_response:function(a){if(!this.options.disabled&&a&&a.length){a=this._normalize(a);this._suggest(a);this._trigger("open")}else this.close();this.pending--;this.pending||this.element.removeClass("ui-autocomplete-loading")},close:function(a){clearTimeout(this.closing);if(this.menu.element.is(":visible")){this.menu.element.hide();this.menu.deactivate();this._trigger("close",a)}},_change:function(a){this.previous!== +this.element.val()&&this._trigger("change",a,{item:this.selectedItem})},_normalize:function(a){if(a.length&&a[0].label&&a[0].value)return a;return d.map(a,function(b){if(typeof b==="string")return{label:b,value:b};return d.extend({label:b.label||b.value,value:b.value||b.label},b)})},_suggest:function(a){var b=this.menu.element.empty().zIndex(this.element.zIndex()+1);this._renderMenu(b,a);this.menu.deactivate();this.menu.refresh();b.show();this._resizeMenu();b.position(d.extend({of:this.element},this.options.position))}, +_resizeMenu:function(){var a=this.menu.element;a.outerWidth(Math.max(a.width("").outerWidth(),this.element.outerWidth()))},_renderMenu:function(a,b){var g=this;d.each(b,function(c,f){g._renderItem(a,f)})},_renderItem:function(a,b){return d("<li></li>").data("item.autocomplete",b).append(d("<a></a>").text(b.label)).appendTo(a)},_move:function(a,b){if(this.menu.element.is(":visible"))if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term);this.menu.deactivate()}else this.menu[a](b); +else this.search(null,b)},widget:function(){return this.menu.element}});d.extend(d.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},filter:function(a,b){var g=new RegExp(d.ui.autocomplete.escapeRegex(b),"i");return d.grep(a,function(c){return g.test(c.label||c.value||c)})}})})(jQuery); +(function(d){d.widget("ui.menu",{_create:function(){var e=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(a){if(d(a.target).closest(".ui-menu-item a").length){a.preventDefault();e.select(a)}});this.refresh()},refresh:function(){var e=this;this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem").children("a").addClass("ui-corner-all").attr("tabindex", +-1).mouseenter(function(a){e.activate(a,d(this).parent())}).mouseleave(function(){e.deactivate()})},activate:function(e,a){this.deactivate();if(this.hasScroll()){var b=a.offset().top-this.element.offset().top,g=this.element.attr("scrollTop"),c=this.element.height();if(b<0)this.element.attr("scrollTop",g+b);else b>=c&&this.element.attr("scrollTop",g+b-c+a.height())}this.active=a.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end();this._trigger("focus",e,{item:a})}, +deactivate:function(){if(this.active){this.active.children("a").removeClass("ui-state-hover").removeAttr("id");this._trigger("blur");this.active=null}},next:function(e){this.move("next",".ui-menu-item:first",e)},previous:function(e){this.move("prev",".ui-menu-item:last",e)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(e,a,b){if(this.active){e=this.active[e+"All"](".ui-menu-item").eq(0); +e.length?this.activate(b,e):this.activate(b,this.element.children(a))}else this.activate(b,this.element.children(a))},nextPage:function(e){if(this.hasScroll())if(!this.active||this.last())this.activate(e,this.element.children(".ui-menu-item:first"));else{var a=this.active.offset().top,b=this.element.height(),g=this.element.children(".ui-menu-item").filter(function(){var c=d(this).offset().top-a-b+d(this).height();return c<10&&c>-10});g.length||(g=this.element.children(".ui-menu-item:last"));this.activate(e, +g)}else this.activate(e,this.element.children(".ui-menu-item").filter(!this.active||this.last()?":first":":last"))},previousPage:function(e){if(this.hasScroll())if(!this.active||this.first())this.activate(e,this.element.children(".ui-menu-item:last"));else{var a=this.active.offset().top,b=this.element.height();result=this.element.children(".ui-menu-item").filter(function(){var g=d(this).offset().top-a+b-d(this).height();return g<10&&g>-10});result.length||(result=this.element.children(".ui-menu-item:first")); +this.activate(e,result)}else this.activate(e,this.element.children(".ui-menu-item").filter(!this.active||this.first()?":last":":first"))},hasScroll:function(){return this.element.height()<this.element.attr("scrollHeight")},select:function(e){this._trigger("selected",e,{item:this.active})}})})(jQuery); +;/* + * jQuery UI Button 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Button + * + * Depends: + * jquery.ui.core.js + * jquery.ui.widget.js + */ +(function(a){var g,i=function(b){a(":ui-button",b.target.form).each(function(){var c=a(this).data("button");setTimeout(function(){c.refresh()},1)})},h=function(b){var c=b.name,d=b.form,f=a([]);if(c)f=d?a(d).find("[name='"+c+"']"):a("[name='"+c+"']",b.ownerDocument).filter(function(){return!this.form});return f};a.widget("ui.button",{options:{disabled:null,text:true,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset.button").bind("reset.button", +i);if(typeof this.options.disabled!=="boolean")this.options.disabled=this.element.attr("disabled");this._determineButtonType();this.hasTitle=!!this.buttonElement.attr("title");var b=this,c=this.options,d=this.type==="checkbox"||this.type==="radio",f="ui-state-hover"+(!d?" ui-state-active":"");if(c.label===null)c.label=this.buttonElement.html();if(this.element.is(":disabled"))c.disabled=true;this.buttonElement.addClass("ui-button ui-widget ui-state-default ui-corner-all").attr("role","button").bind("mouseenter.button", +function(){if(!c.disabled){a(this).addClass("ui-state-hover");this===g&&a(this).addClass("ui-state-active")}}).bind("mouseleave.button",function(){c.disabled||a(this).removeClass(f)}).bind("focus.button",function(){a(this).addClass("ui-state-focus")}).bind("blur.button",function(){a(this).removeClass("ui-state-focus")});d&&this.element.bind("change.button",function(){b.refresh()});if(this.type==="checkbox")this.buttonElement.bind("click.button",function(){if(c.disabled)return false;a(this).toggleClass("ui-state-active"); +b.buttonElement.attr("aria-pressed",b.element[0].checked)});else if(this.type==="radio")this.buttonElement.bind("click.button",function(){if(c.disabled)return false;a(this).addClass("ui-state-active");b.buttonElement.attr("aria-pressed",true);var e=b.element[0];h(e).not(e).map(function(){return a(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed",false)});else{this.buttonElement.bind("mousedown.button",function(){if(c.disabled)return false;a(this).addClass("ui-state-active"); +g=this;a(document).one("mouseup",function(){g=null})}).bind("mouseup.button",function(){if(c.disabled)return false;a(this).removeClass("ui-state-active")}).bind("keydown.button",function(e){if(c.disabled)return false;if(e.keyCode==a.ui.keyCode.SPACE||e.keyCode==a.ui.keyCode.ENTER)a(this).addClass("ui-state-active")}).bind("keyup.button",function(){a(this).removeClass("ui-state-active")});this.buttonElement.is("a")&&this.buttonElement.keyup(function(e){e.keyCode===a.ui.keyCode.SPACE&&a(this).click()})}this._setOption("disabled", +c.disabled)},_determineButtonType:function(){this.type=this.element.is(":checkbox")?"checkbox":this.element.is(":radio")?"radio":this.element.is("input")?"input":"button";if(this.type==="checkbox"||this.type==="radio"){this.buttonElement=this.element.parents().last().find("label[for="+this.element.attr("id")+"]");this.element.addClass("ui-helper-hidden-accessible");var b=this.element.is(":checked");b&&this.buttonElement.addClass("ui-state-active");this.buttonElement.attr("aria-pressed",b)}else this.buttonElement= +this.element},widget:function(){return this.buttonElement},destroy:function(){this.element.removeClass("ui-helper-hidden-accessible");this.buttonElement.removeClass("ui-button ui-widget ui-state-default ui-corner-all ui-state-hover ui-state-active ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only").removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html());this.hasTitle|| +this.buttonElement.removeAttr("title");a.Widget.prototype.destroy.call(this)},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments);if(b==="disabled")c?this.element.attr("disabled",true):this.element.removeAttr("disabled");this._resetButton()},refresh:function(){var b=this.element.is(":disabled");b!==this.options.disabled&&this._setOption("disabled",b);if(this.type==="radio")h(this.element[0]).each(function(){a(this).is(":checked")?a(this).button("widget").addClass("ui-state-active").attr("aria-pressed", +true):a(this).button("widget").removeClass("ui-state-active").attr("aria-pressed",false)});else if(this.type==="checkbox")this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed",true):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed",false)},_resetButton:function(){if(this.type==="input")this.options.label&&this.element.val(this.options.label);else{var b=this.buttonElement.removeClass("ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only"), +c=a("<span></span>").addClass("ui-button-text").html(this.options.label).appendTo(b.empty()).text(),d=this.options.icons,f=d.primary&&d.secondary,e=[];if(d.primary||d.secondary){e.push("ui-button-text-icon"+(f?"s":d.primary?"-primary":"-secondary"));d.primary&&b.prepend("<span class='ui-button-icon-primary ui-icon "+d.primary+"'></span>");d.secondary&&b.append("<span class='ui-button-icon-secondary ui-icon "+d.secondary+"'></span>");if(!this.options.text){e.push(f?"ui-button-icons-only":"ui-button-icon-only"); +b.removeClass("ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary");this.hasTitle||b.attr("title",c)}}else e.push("ui-button-text-only");b.addClass(e.join(" "))}}});a.widget("ui.buttonset",{options:{items:":button, :submit, :reset, :checkbox, :radio, a, :data(button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(b,c){b==="disabled"&&this.buttons.button("option",b,c);a.Widget.prototype._setOption.apply(this, +arguments)},refresh:function(){this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass("ui-corner-left").end().filter(":last").addClass("ui-corner-right").end().end()},destroy:function(){this.element.removeClass("ui-buttonset");this.buttons.map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy"); +a.Widget.prototype.destroy.call(this)}})})(jQuery); +;/* + * jQuery UI Dialog 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Dialog + * + * Depends: + * jquery.ui.core.js + * jquery.ui.widget.js + * jquery.ui.button.js + * jquery.ui.draggable.js + * jquery.ui.mouse.js + * jquery.ui.position.js + * jquery.ui.resizable.js + */ +(function(c,j){var k={buttons:true,height:true,maxHeight:true,maxWidth:true,minHeight:true,minWidth:true,width:true},l={maxHeight:true,maxWidth:true,minHeight:true,minWidth:true};c.widget("ui.dialog",{options:{autoOpen:true,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false,position:{my:"center",at:"center",collision:"fit",using:function(a){var b=c(this).css(a).offset().top;b<0&& +c(this).css("top",a.top-b)}},resizable:true,show:null,stack:true,title:"",width:300,zIndex:1E3},_create:function(){this.originalTitle=this.element.attr("title");if(typeof this.originalTitle!=="string")this.originalTitle="";this.options.title=this.options.title||this.originalTitle;var a=this,b=a.options,d=b.title||" ",e=c.ui.dialog.getTitleId(a.element),g=(a.uiDialog=c("<div></div>")).appendTo(document.body).hide().addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+b.dialogClass).css({zIndex:b.zIndex}).attr("tabIndex", +-1).css("outline",0).keydown(function(i){if(b.closeOnEscape&&i.keyCode&&i.keyCode===c.ui.keyCode.ESCAPE){a.close(i);i.preventDefault()}}).attr({role:"dialog","aria-labelledby":e}).mousedown(function(i){a.moveToTop(false,i)});a.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(g);var f=(a.uiDialogTitlebar=c("<div></div>")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(g),h=c('<a href="#"></a>').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role", +"button").hover(function(){h.addClass("ui-state-hover")},function(){h.removeClass("ui-state-hover")}).focus(function(){h.addClass("ui-state-focus")}).blur(function(){h.removeClass("ui-state-focus")}).click(function(i){a.close(i);return false}).appendTo(f);(a.uiDialogTitlebarCloseText=c("<span></span>")).addClass("ui-icon ui-icon-closethick").text(b.closeText).appendTo(h);c("<span></span>").addClass("ui-dialog-title").attr("id",e).html(d).prependTo(f);if(c.isFunction(b.beforeclose)&&!c.isFunction(b.beforeClose))b.beforeClose= +b.beforeclose;f.find("*").add(f).disableSelection();b.draggable&&c.fn.draggable&&a._makeDraggable();b.resizable&&c.fn.resizable&&a._makeResizable();a._createButtons(b.buttons);a._isOpen=false;c.fn.bgiframe&&g.bgiframe()},_init:function(){this.options.autoOpen&&this.open()},destroy:function(){var a=this;a.overlay&&a.overlay.destroy();a.uiDialog.hide();a.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body");a.uiDialog.remove();a.originalTitle&& +a.element.attr("title",a.originalTitle);return a},widget:function(){return this.uiDialog},close:function(a){var b=this,d,e;if(false!==b._trigger("beforeClose",a)){b.overlay&&b.overlay.destroy();b.uiDialog.unbind("keypress.ui-dialog");b._isOpen=false;if(b.options.hide)b.uiDialog.hide(b.options.hide,function(){b._trigger("close",a)});else{b.uiDialog.hide();b._trigger("close",a)}c.ui.dialog.overlay.resize();if(b.options.modal){d=0;c(".ui-dialog").each(function(){if(this!==b.uiDialog[0]){e=c(this).css("z-index"); +isNaN(e)||(d=Math.max(d,e))}});c.ui.dialog.maxZ=d}return b}},isOpen:function(){return this._isOpen},moveToTop:function(a,b){var d=this,e=d.options;if(e.modal&&!a||!e.stack&&!e.modal)return d._trigger("focus",b);if(e.zIndex>c.ui.dialog.maxZ)c.ui.dialog.maxZ=e.zIndex;if(d.overlay){c.ui.dialog.maxZ+=1;d.overlay.$el.css("z-index",c.ui.dialog.overlay.maxZ=c.ui.dialog.maxZ)}a={scrollTop:d.element.attr("scrollTop"),scrollLeft:d.element.attr("scrollLeft")};c.ui.dialog.maxZ+=1;d.uiDialog.css("z-index",c.ui.dialog.maxZ); +d.element.attr(a);d._trigger("focus",b);return d},open:function(){if(!this._isOpen){var a=this,b=a.options,d=a.uiDialog;a.overlay=b.modal?new c.ui.dialog.overlay(a):null;a._size();a._position(b.position);d.show(b.show);a.moveToTop(true);b.modal&&d.bind("keypress.ui-dialog",function(e){if(e.keyCode===c.ui.keyCode.TAB){var g=c(":tabbable",this),f=g.filter(":first");g=g.filter(":last");if(e.target===g[0]&&!e.shiftKey){f.focus(1);return false}else if(e.target===f[0]&&e.shiftKey){g.focus(1);return false}}}); +c(a.element.find(":tabbable").get().concat(d.find(".ui-dialog-buttonpane :tabbable").get().concat(d.get()))).eq(0).focus();a._isOpen=true;a._trigger("open");return a}},_createButtons:function(a){var b=this,d=false,e=c("<div></div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),g=c("<div></div>").addClass("ui-dialog-buttonset").appendTo(e);b.uiDialog.find(".ui-dialog-buttonpane").remove();typeof a==="object"&&a!==null&&c.each(a,function(){return!(d=true)});if(d){c.each(a,function(f, +h){h=c.isFunction(h)?{click:h,text:f}:h;f=c('<button type="button"></button>').attr(h,true).unbind("click").click(function(){h.click.apply(b.element[0],arguments)}).appendTo(g);c.fn.button&&f.button()});e.appendTo(b.uiDialog)}},_makeDraggable:function(){function a(f){return{position:f.position,offset:f.offset}}var b=this,d=b.options,e=c(document),g;b.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(f,h){g= +d.height==="auto"?"auto":c(this).height();c(this).height(c(this).height()).addClass("ui-dialog-dragging");b._trigger("dragStart",f,a(h))},drag:function(f,h){b._trigger("drag",f,a(h))},stop:function(f,h){d.position=[h.position.left-e.scrollLeft(),h.position.top-e.scrollTop()];c(this).removeClass("ui-dialog-dragging").height(g);b._trigger("dragStop",f,a(h));c.ui.dialog.overlay.resize()}})},_makeResizable:function(a){function b(f){return{originalPosition:f.originalPosition,originalSize:f.originalSize, +position:f.position,size:f.size}}a=a===j?this.options.resizable:a;var d=this,e=d.options,g=d.uiDialog.css("position");a=typeof a==="string"?a:"n,e,s,w,se,sw,ne,nw";d.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:d.element,maxWidth:e.maxWidth,maxHeight:e.maxHeight,minWidth:e.minWidth,minHeight:d._minHeight(),handles:a,start:function(f,h){c(this).addClass("ui-dialog-resizing");d._trigger("resizeStart",f,b(h))},resize:function(f,h){d._trigger("resize",f,b(h))},stop:function(f, +h){c(this).removeClass("ui-dialog-resizing");e.height=c(this).height();e.width=c(this).width();d._trigger("resizeStop",f,b(h));c.ui.dialog.overlay.resize()}}).css("position",g).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var a=this.options;return a.height==="auto"?a.minHeight:Math.min(a.minHeight,a.height)},_position:function(a){var b=[],d=[0,0],e;if(a){if(typeof a==="string"||typeof a==="object"&&"0"in a){b=a.split?a.split(" "):[a[0],a[1]];if(b.length=== +1)b[1]=b[0];c.each(["left","top"],function(g,f){if(+b[g]===b[g]){d[g]=b[g];b[g]=f}});a={my:b.join(" "),at:b.join(" "),offset:d.join(" ")}}a=c.extend({},c.ui.dialog.prototype.options.position,a)}else a=c.ui.dialog.prototype.options.position;(e=this.uiDialog.is(":visible"))||this.uiDialog.show();this.uiDialog.css({top:0,left:0}).position(c.extend({of:window},a));e||this.uiDialog.hide()},_setOptions:function(a){var b=this,d={},e=false;c.each(a,function(g,f){b._setOption(g,f);if(g in k)e=true;if(g in +l)d[g]=f});e&&this._size();this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",d)},_setOption:function(a,b){var d=this,e=d.uiDialog;switch(a){case "beforeclose":a="beforeClose";break;case "buttons":d._createButtons(b);break;case "closeText":d.uiDialogTitlebarCloseText.text(""+b);break;case "dialogClass":e.removeClass(d.options.dialogClass).addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+b);break;case "disabled":b?e.addClass("ui-dialog-disabled"):e.removeClass("ui-dialog-disabled"); +break;case "draggable":var g=e.is(":data(draggable)");g&&!b&&e.draggable("destroy");!g&&b&&d._makeDraggable();break;case "position":d._position(b);break;case "resizable":(g=e.is(":data(resizable)"))&&!b&&e.resizable("destroy");g&&typeof b==="string"&&e.resizable("option","handles",b);!g&&b!==false&&d._makeResizable(b);break;case "title":c(".ui-dialog-title",d.uiDialogTitlebar).html(""+(b||" "));break}c.Widget.prototype._setOption.apply(d,arguments)},_size:function(){var a=this.options,b,d,e= +this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0});if(a.minWidth>a.width)a.width=a.minWidth;b=this.uiDialog.css({height:"auto",width:a.width}).height();d=Math.max(0,a.minHeight-b);if(a.height==="auto")if(c.support.minHeight)this.element.css({minHeight:d,height:"auto"});else{this.uiDialog.show();a=this.element.css("height","auto").height();e||this.uiDialog.hide();this.element.height(Math.max(a,d))}else this.element.height(Math.max(a.height-b,0));this.uiDialog.is(":data(resizable)")&& +this.uiDialog.resizable("option","minHeight",this._minHeight())}});c.extend(c.ui.dialog,{version:"1.8.10",uuid:0,maxZ:0,getTitleId:function(a){a=a.attr("id");if(!a){this.uuid+=1;a=this.uuid}return"ui-dialog-title-"+a},overlay:function(a){this.$el=c.ui.dialog.overlay.create(a)}});c.extend(c.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:c.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(a){return a+".dialog-overlay"}).join(" "),create:function(a){if(this.instances.length=== +0){setTimeout(function(){c.ui.dialog.overlay.instances.length&&c(document).bind(c.ui.dialog.overlay.events,function(d){if(c(d.target).zIndex()<c.ui.dialog.overlay.maxZ)return false})},1);c(document).bind("keydown.dialog-overlay",function(d){if(a.options.closeOnEscape&&d.keyCode&&d.keyCode===c.ui.keyCode.ESCAPE){a.close(d);d.preventDefault()}});c(window).bind("resize.dialog-overlay",c.ui.dialog.overlay.resize)}var b=(this.oldInstances.pop()||c("<div></div>").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(), +height:this.height()});c.fn.bgiframe&&b.bgiframe();this.instances.push(b);return b},destroy:function(a){var b=c.inArray(a,this.instances);b!=-1&&this.oldInstances.push(this.instances.splice(b,1)[0]);this.instances.length===0&&c([document,window]).unbind(".dialog-overlay");a.remove();var d=0;c.each(this.instances,function(){d=Math.max(d,this.css("z-index"))});this.maxZ=d},height:function(){var a,b;if(c.browser.msie&&c.browser.version<7){a=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight); +b=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);return a<b?c(window).height()+"px":a+"px"}else return c(document).height()+"px"},width:function(){var a,b;if(c.browser.msie&&c.browser.version<7){a=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth);b=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);return a<b?c(window).width()+"px":a+"px"}else return c(document).width()+"px"},resize:function(){var a=c([]);c.each(c.ui.dialog.overlay.instances, +function(){a=a.add(this)});a.css({width:0,height:0}).css({width:c.ui.dialog.overlay.width(),height:c.ui.dialog.overlay.height()})}});c.extend(c.ui.dialog.overlay.prototype,{destroy:function(){c.ui.dialog.overlay.destroy(this.$el)}})})(jQuery); +;/* + * jQuery UI Slider 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Slider + * + * Depends: + * jquery.ui.core.js + * jquery.ui.mouse.js + * jquery.ui.widget.js + */ +(function(d){d.widget("ui.slider",d.ui.mouse,{widgetEventPrefix:"slide",options:{animate:false,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null},_create:function(){var b=this,a=this.options;this._mouseSliding=this._keySliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget ui-widget-content ui-corner-all");a.disabled&&this.element.addClass("ui-slider-disabled ui-disabled"); +this.range=d([]);if(a.range){if(a.range===true){this.range=d("<div></div>");if(!a.values)a.values=[this._valueMin(),this._valueMin()];if(a.values.length&&a.values.length!==2)a.values=[a.values[0],a.values[0]]}else this.range=d("<div></div>");this.range.appendTo(this.element).addClass("ui-slider-range");if(a.range==="min"||a.range==="max")this.range.addClass("ui-slider-range-"+a.range);this.range.addClass("ui-widget-header")}d(".ui-slider-handle",this.element).length===0&&d("<a href='#'></a>").appendTo(this.element).addClass("ui-slider-handle"); +if(a.values&&a.values.length)for(;d(".ui-slider-handle",this.element).length<a.values.length;)d("<a href='#'></a>").appendTo(this.element).addClass("ui-slider-handle");this.handles=d(".ui-slider-handle",this.element).addClass("ui-state-default ui-corner-all");this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(c){c.preventDefault()}).hover(function(){a.disabled||d(this).addClass("ui-state-hover")},function(){d(this).removeClass("ui-state-hover")}).focus(function(){if(a.disabled)d(this).blur(); +else{d(".ui-slider .ui-state-focus").removeClass("ui-state-focus");d(this).addClass("ui-state-focus")}}).blur(function(){d(this).removeClass("ui-state-focus")});this.handles.each(function(c){d(this).data("index.ui-slider-handle",c)});this.handles.keydown(function(c){var e=true,f=d(this).data("index.ui-slider-handle"),h,g,i;if(!b.options.disabled){switch(c.keyCode){case d.ui.keyCode.HOME:case d.ui.keyCode.END:case d.ui.keyCode.PAGE_UP:case d.ui.keyCode.PAGE_DOWN:case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:e= +false;if(!b._keySliding){b._keySliding=true;d(this).addClass("ui-state-active");h=b._start(c,f);if(h===false)return}break}i=b.options.step;h=b.options.values&&b.options.values.length?(g=b.values(f)):(g=b.value());switch(c.keyCode){case d.ui.keyCode.HOME:g=b._valueMin();break;case d.ui.keyCode.END:g=b._valueMax();break;case d.ui.keyCode.PAGE_UP:g=b._trimAlignValue(h+(b._valueMax()-b._valueMin())/5);break;case d.ui.keyCode.PAGE_DOWN:g=b._trimAlignValue(h-(b._valueMax()-b._valueMin())/5);break;case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:if(h=== +b._valueMax())return;g=b._trimAlignValue(h+i);break;case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:if(h===b._valueMin())return;g=b._trimAlignValue(h-i);break}b._slide(c,f,g);return e}}).keyup(function(c){var e=d(this).data("index.ui-slider-handle");if(b._keySliding){b._keySliding=false;b._stop(c,e);b._change(c,e);d(this).removeClass("ui-state-active")}});this._refreshValue();this._animateOff=false},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider"); +this._mouseDestroy();return this},_mouseCapture:function(b){var a=this.options,c,e,f,h,g;if(a.disabled)return false;this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();c=this._normValueFromMouse({x:b.pageX,y:b.pageY});e=this._valueMax()-this._valueMin()+1;h=this;this.handles.each(function(i){var j=Math.abs(c-h.values(i));if(e>j){e=j;f=d(this);g=i}});if(a.range===true&&this.values(1)===a.min){g+=1;f=d(this.handles[g])}if(this._start(b, +g)===false)return false;this._mouseSliding=true;h._handleIndex=g;f.addClass("ui-state-active").focus();a=f.offset();this._clickOffset=!d(b.target).parents().andSelf().is(".ui-slider-handle")?{left:0,top:0}:{left:b.pageX-a.left-f.width()/2,top:b.pageY-a.top-f.height()/2-(parseInt(f.css("borderTopWidth"),10)||0)-(parseInt(f.css("borderBottomWidth"),10)||0)+(parseInt(f.css("marginTop"),10)||0)};this.handles.hasClass("ui-state-hover")||this._slide(b,g,c);return this._animateOff=true},_mouseStart:function(){return true}, +_mouseDrag:function(b){var a=this._normValueFromMouse({x:b.pageX,y:b.pageY});this._slide(b,this._handleIndex,a);return false},_mouseStop:function(b){this.handles.removeClass("ui-state-active");this._mouseSliding=false;this._stop(b,this._handleIndex);this._change(b,this._handleIndex);this._clickOffset=this._handleIndex=null;return this._animateOff=false},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(b){var a; +if(this.orientation==="horizontal"){a=this.elementSize.width;b=b.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{a=this.elementSize.height;b=b.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}a=b/a;if(a>1)a=1;if(a<0)a=0;if(this.orientation==="vertical")a=1-a;b=this._valueMax()-this._valueMin();return this._trimAlignValue(this._valueMin()+a*b)},_start:function(b,a){var c={handle:this.handles[a],value:this.value()};if(this.options.values&&this.options.values.length){c.value= +this.values(a);c.values=this.values()}return this._trigger("start",b,c)},_slide:function(b,a,c){var e;if(this.options.values&&this.options.values.length){e=this.values(a?0:1);if(this.options.values.length===2&&this.options.range===true&&(a===0&&c>e||a===1&&c<e))c=e;if(c!==this.values(a)){e=this.values();e[a]=c;b=this._trigger("slide",b,{handle:this.handles[a],value:c,values:e});this.values(a?0:1);b!==false&&this.values(a,c,true)}}else if(c!==this.value()){b=this._trigger("slide",b,{handle:this.handles[a], +value:c});b!==false&&this.value(c)}},_stop:function(b,a){var c={handle:this.handles[a],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(a);c.values=this.values()}this._trigger("stop",b,c)},_change:function(b,a){if(!this._keySliding&&!this._mouseSliding){var c={handle:this.handles[a],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(a);c.values=this.values()}this._trigger("change",b,c)}},value:function(b){if(arguments.length){this.options.value= +this._trimAlignValue(b);this._refreshValue();this._change(null,0)}return this._value()},values:function(b,a){var c,e,f;if(arguments.length>1){this.options.values[b]=this._trimAlignValue(a);this._refreshValue();this._change(null,b)}if(arguments.length)if(d.isArray(arguments[0])){c=this.options.values;e=arguments[0];for(f=0;f<c.length;f+=1){c[f]=this._trimAlignValue(e[f]);this._change(null,f)}this._refreshValue()}else return this.options.values&&this.options.values.length?this._values(b):this.value(); +else return this._values()},_setOption:function(b,a){var c,e=0;if(d.isArray(this.options.values))e=this.options.values.length;d.Widget.prototype._setOption.apply(this,arguments);switch(b){case "disabled":if(a){this.handles.filter(".ui-state-focus").blur();this.handles.removeClass("ui-state-hover");this.handles.attr("disabled","disabled");this.element.addClass("ui-disabled")}else{this.handles.removeAttr("disabled");this.element.removeClass("ui-disabled")}break;case "orientation":this._detectOrientation(); +this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);this._refreshValue();break;case "value":this._animateOff=true;this._refreshValue();this._change(null,0);this._animateOff=false;break;case "values":this._animateOff=true;this._refreshValue();for(c=0;c<e;c+=1)this._change(null,c);this._animateOff=false;break}},_value:function(){var b=this.options.value;return b=this._trimAlignValue(b)},_values:function(b){var a,c;if(arguments.length){a=this.options.values[b]; +return a=this._trimAlignValue(a)}else{a=this.options.values.slice();for(c=0;c<a.length;c+=1)a[c]=this._trimAlignValue(a[c]);return a}},_trimAlignValue:function(b){if(b<=this._valueMin())return this._valueMin();if(b>=this._valueMax())return this._valueMax();var a=this.options.step>0?this.options.step:1,c=(b-this._valueMin())%a;alignValue=b-c;if(Math.abs(c)*2>=a)alignValue+=c>0?a:-a;return parseFloat(alignValue.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max}, +_refreshValue:function(){var b=this.options.range,a=this.options,c=this,e=!this._animateOff?a.animate:false,f,h={},g,i,j,l;if(this.options.values&&this.options.values.length)this.handles.each(function(k){f=(c.values(k)-c._valueMin())/(c._valueMax()-c._valueMin())*100;h[c.orientation==="horizontal"?"left":"bottom"]=f+"%";d(this).stop(1,1)[e?"animate":"css"](h,a.animate);if(c.options.range===true)if(c.orientation==="horizontal"){if(k===0)c.range.stop(1,1)[e?"animate":"css"]({left:f+"%"},a.animate); +if(k===1)c.range[e?"animate":"css"]({width:f-g+"%"},{queue:false,duration:a.animate})}else{if(k===0)c.range.stop(1,1)[e?"animate":"css"]({bottom:f+"%"},a.animate);if(k===1)c.range[e?"animate":"css"]({height:f-g+"%"},{queue:false,duration:a.animate})}g=f});else{i=this.value();j=this._valueMin();l=this._valueMax();f=l!==j?(i-j)/(l-j)*100:0;h[c.orientation==="horizontal"?"left":"bottom"]=f+"%";this.handle.stop(1,1)[e?"animate":"css"](h,a.animate);if(b==="min"&&this.orientation==="horizontal")this.range.stop(1, +1)[e?"animate":"css"]({width:f+"%"},a.animate);if(b==="max"&&this.orientation==="horizontal")this.range[e?"animate":"css"]({width:100-f+"%"},{queue:false,duration:a.animate});if(b==="min"&&this.orientation==="vertical")this.range.stop(1,1)[e?"animate":"css"]({height:f+"%"},a.animate);if(b==="max"&&this.orientation==="vertical")this.range[e?"animate":"css"]({height:100-f+"%"},{queue:false,duration:a.animate})}}});d.extend(d.ui.slider,{version:"1.8.10"})})(jQuery); +;/* + * jQuery UI Tabs 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Tabs + * + * Depends: + * jquery.ui.core.js + * jquery.ui.widget.js + */ +(function(d,p){function u(){return++v}function w(){return++x}var v=0,x=0;d.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:false,cookie:null,collapsible:false,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"<div></div>",remove:null,select:null,show:null,spinner:"<em>Loading…</em>",tabTemplate:"<li><a href='#{href}'><span>#{label}</span></a></li>"},_create:function(){this._tabify(true)},_setOption:function(b,e){if(b=="selected")this.options.collapsible&& +e==this.options.selected||this.select(e);else{this.options[b]=e;this._tabify()}},_tabId:function(b){return b.title&&b.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+u()},_sanitizeSelector:function(b){return b.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+w());return d.cookie.apply(null,[b].concat(d.makeArray(arguments)))},_ui:function(b,e){return{tab:b,panel:e,index:this.anchors.index(b)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b= +d(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(b){function e(g,f){g.css("display","");!d.support.opacity&&f.opacity&&g[0].style.removeAttribute("filter")}var a=this,c=this.options,h=/^#.+/;this.list=this.element.find("ol,ul").eq(0);this.lis=d(" > li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return d("a",this)[0]});this.panels=d([]);this.anchors.each(function(g,f){var i=d(f).attr("href"),l=i.split("#")[0],q;if(l&&(l===location.toString().split("#")[0]|| +(q=d("base")[0])&&l===q.href)){i=f.hash;f.href=i}if(h.test(i))a.panels=a.panels.add(a.element.find(a._sanitizeSelector(i)));else if(i&&i!=="#"){d.data(f,"href.tabs",i);d.data(f,"load.tabs",i.replace(/#.*$/,""));i=a._tabId(f);f.href="#"+i;f=a.element.find("#"+i);if(!f.length){f=d(c.panelTemplate).attr("id",i).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(a.panels[g-1]||a.list);f.data("destroy.tabs",true)}a.panels=a.panels.add(f)}else c.disabled.push(g)});if(b){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all"); +this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(c.selected===p){location.hash&&this.anchors.each(function(g,f){if(f.hash==location.hash){c.selected=g;return false}});if(typeof c.selected!=="number"&&c.cookie)c.selected=parseInt(a._cookie(),10);if(typeof c.selected!=="number"&&this.lis.filter(".ui-tabs-selected").length)c.selected= +this.lis.index(this.lis.filter(".ui-tabs-selected"));c.selected=c.selected||(this.lis.length?0:-1)}else if(c.selected===null)c.selected=-1;c.selected=c.selected>=0&&this.anchors[c.selected]||c.selected<0?c.selected:0;c.disabled=d.unique(c.disabled.concat(d.map(this.lis.filter(".ui-state-disabled"),function(g){return a.lis.index(g)}))).sort();d.inArray(c.selected,c.disabled)!=-1&&c.disabled.splice(d.inArray(c.selected,c.disabled),1);this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active"); +if(c.selected>=0&&this.anchors.length){a.element.find(a._sanitizeSelector(a.anchors[c.selected].hash)).removeClass("ui-tabs-hide");this.lis.eq(c.selected).addClass("ui-tabs-selected ui-state-active");a.element.queue("tabs",function(){a._trigger("show",null,a._ui(a.anchors[c.selected],a.element.find(a._sanitizeSelector(a.anchors[c.selected].hash))[0]))});this.load(c.selected)}d(window).bind("unload",function(){a.lis.add(a.anchors).unbind(".tabs");a.lis=a.anchors=a.panels=null})}else c.selected=this.lis.index(this.lis.filter(".ui-tabs-selected")); +this.element[c.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");c.cookie&&this._cookie(c.selected,c.cookie);b=0;for(var j;j=this.lis[b];b++)d(j)[d.inArray(b,c.disabled)!=-1&&!d(j).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");c.cache===false&&this.anchors.removeData("cache.tabs");this.lis.add(this.anchors).unbind(".tabs");if(c.event!=="mouseover"){var k=function(g,f){f.is(":not(.ui-state-disabled)")&&f.addClass("ui-state-"+g)},n=function(g,f){f.removeClass("ui-state-"+ +g)};this.lis.bind("mouseover.tabs",function(){k("hover",d(this))});this.lis.bind("mouseout.tabs",function(){n("hover",d(this))});this.anchors.bind("focus.tabs",function(){k("focus",d(this).closest("li"))});this.anchors.bind("blur.tabs",function(){n("focus",d(this).closest("li"))})}var m,o;if(c.fx)if(d.isArray(c.fx)){m=c.fx[0];o=c.fx[1]}else m=o=c.fx;var r=o?function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.hide().removeClass("ui-tabs-hide").animate(o,o.duration||"normal", +function(){e(f,o);a._trigger("show",null,a._ui(g,f[0]))})}:function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.removeClass("ui-tabs-hide");a._trigger("show",null,a._ui(g,f[0]))},s=m?function(g,f){f.animate(m,m.duration||"normal",function(){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");e(f,m);a.element.dequeue("tabs")})}:function(g,f){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");a.element.dequeue("tabs")}; +this.anchors.bind(c.event+".tabs",function(){var g=this,f=d(g).closest("li"),i=a.panels.filter(":not(.ui-tabs-hide)"),l=a.element.find(a._sanitizeSelector(g.hash));if(f.hasClass("ui-tabs-selected")&&!c.collapsible||f.hasClass("ui-state-disabled")||f.hasClass("ui-state-processing")||a.panels.filter(":animated").length||a._trigger("select",null,a._ui(this,l[0]))===false){this.blur();return false}c.selected=a.anchors.index(this);a.abort();if(c.collapsible)if(f.hasClass("ui-tabs-selected")){c.selected= +-1;c.cookie&&a._cookie(c.selected,c.cookie);a.element.queue("tabs",function(){s(g,i)}).dequeue("tabs");this.blur();return false}else if(!i.length){c.cookie&&a._cookie(c.selected,c.cookie);a.element.queue("tabs",function(){r(g,l)});a.load(a.anchors.index(this));this.blur();return false}c.cookie&&a._cookie(c.selected,c.cookie);if(l.length){i.length&&a.element.queue("tabs",function(){s(g,i)});a.element.queue("tabs",function(){r(g,l)});a.load(a.anchors.index(this))}else throw"jQuery UI Tabs: Mismatching fragment identifier."; +d.browser.msie&&this.blur()});this.anchors.bind("click.tabs",function(){return false})},_getIndex:function(b){if(typeof b=="string")b=this.anchors.index(this.anchors.filter("[href$="+b+"]"));return b},destroy:function(){var b=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var e= +d.data(this,"href.tabs");if(e)this.href=e;var a=d(this).unbind(".tabs");d.each(["href","load","cache"],function(c,h){a.removeData(h+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){d.data(this,"destroy.tabs")?d(this).remove():d(this).removeClass("ui-state-default ui-corner-top ui-tabs-selected ui-state-active ui-state-hover ui-state-focus ui-state-disabled ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide")});b.cookie&&this._cookie(null,b.cookie);return this},add:function(b, +e,a){if(a===p)a=this.anchors.length;var c=this,h=this.options;e=d(h.tabTemplate.replace(/#\{href\}/g,b).replace(/#\{label\}/g,e));b=!b.indexOf("#")?b.replace("#",""):this._tabId(d("a",e)[0]);e.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var j=c.element.find("#"+b);j.length||(j=d(h.panelTemplate).attr("id",b).data("destroy.tabs",true));j.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(a>=this.lis.length){e.appendTo(this.list);j.appendTo(this.list[0].parentNode)}else{e.insertBefore(this.lis[a]); +j.insertBefore(this.panels[a])}h.disabled=d.map(h.disabled,function(k){return k>=a?++k:k});this._tabify();if(this.anchors.length==1){h.selected=0;e.addClass("ui-tabs-selected ui-state-active");j.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){c._trigger("show",null,c._ui(c.anchors[0],c.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[a],this.panels[a]));return this},remove:function(b){b=this._getIndex(b);var e=this.options,a=this.lis.eq(b).remove(),c=this.panels.eq(b).remove(); +if(a.hasClass("ui-tabs-selected")&&this.anchors.length>1)this.select(b+(b+1<this.anchors.length?1:-1));e.disabled=d.map(d.grep(e.disabled,function(h){return h!=b}),function(h){return h>=b?--h:h});this._tabify();this._trigger("remove",null,this._ui(a.find("a")[0],c[0]));return this},enable:function(b){b=this._getIndex(b);var e=this.options;if(d.inArray(b,e.disabled)!=-1){this.lis.eq(b).removeClass("ui-state-disabled");e.disabled=d.grep(e.disabled,function(a){return a!=b});this._trigger("enable",null, +this._ui(this.anchors[b],this.panels[b]));return this}},disable:function(b){b=this._getIndex(b);var e=this.options;if(b!=e.selected){this.lis.eq(b).addClass("ui-state-disabled");e.disabled.push(b);e.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[b],this.panels[b]))}return this},select:function(b){b=this._getIndex(b);if(b==-1)if(this.options.collapsible&&this.options.selected!=-1)b=this.options.selected;else return this;this.anchors.eq(b).trigger(this.options.event+".tabs");return this}, +load:function(b){b=this._getIndex(b);var e=this,a=this.options,c=this.anchors.eq(b)[0],h=d.data(c,"load.tabs");this.abort();if(!h||this.element.queue("tabs").length!==0&&d.data(c,"cache.tabs"))this.element.dequeue("tabs");else{this.lis.eq(b).addClass("ui-state-processing");if(a.spinner){var j=d("span",c);j.data("label.tabs",j.html()).html(a.spinner)}this.xhr=d.ajax(d.extend({},a.ajaxOptions,{url:h,success:function(k,n){e.element.find(e._sanitizeSelector(c.hash)).html(k);e._cleanup();a.cache&&d.data(c, +"cache.tabs",true);e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.success(k,n)}catch(m){}},error:function(k,n){e._cleanup();e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.error(k,n,b,c)}catch(m){}}}));e.element.dequeue("tabs");return this}},abort:function(){this.element.queue([]);this.panels.stop(false,true);this.element.queue("tabs",this.element.queue("tabs").splice(-2,2));if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup();return this}, +url:function(b,e){this.anchors.eq(b).removeData("cache.tabs").data("load.tabs",e);return this},length:function(){return this.anchors.length}});d.extend(d.ui.tabs,{version:"1.8.10"});d.extend(d.ui.tabs.prototype,{rotation:null,rotate:function(b,e){var a=this,c=this.options,h=a._rotate||(a._rotate=function(j){clearTimeout(a.rotation);a.rotation=setTimeout(function(){var k=c.selected;a.select(++k<a.anchors.length?k:0)},b);j&&j.stopPropagation()});e=a._unrotate||(a._unrotate=!e?function(j){j.clientX&& +a.rotate(null)}:function(){t=c.selected;h()});if(b){this.element.bind("tabsshow",h);this.anchors.bind(c.event+".tabs",e);h()}else{clearTimeout(a.rotation);this.element.unbind("tabsshow",h);this.anchors.unbind(c.event+".tabs",e);delete this._rotate;delete this._unrotate}return this}})})(jQuery); +;/* + * jQuery UI Datepicker 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Datepicker + * + * Depends: + * jquery.ui.core.js + */ +(function(d,G){function K(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._inDialog=this._datepickerShowing=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass= +"ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su", +"Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:false,showMonthAfterYear:false,yearSuffix:""};this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,yearRange:"c-10:c+10",showOtherMonths:false,selectOtherMonths:false,showWeek:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10", +minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:true,showButtonPanel:false,autoSize:false};d.extend(this._defaults,this.regional[""]);this.dpDiv=d('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')}function E(a,b){d.extend(a,b);for(var c in b)if(b[c]== +null||b[c]==G)a[c]=b[c];return a}d.extend(d.ui,{datepicker:{version:"1.8.10"}});var y=(new Date).getTime();d.extend(K.prototype,{markerClassName:"hasDatepicker",log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(a){E(this._defaults,a||{});return this},_attachDatepicker:function(a,b){var c=null;for(var e in this._defaults){var f=a.getAttribute("date:"+e);if(f){c=c||{};try{c[e]=eval(f)}catch(h){c[e]=f}}}e=a.nodeName.toLowerCase(); +f=e=="div"||e=="span";if(!a.id){this.uuid+=1;a.id="dp"+this.uuid}var i=this._newInst(d(a),f);i.settings=d.extend({},b||{},c||{});if(e=="input")this._connectDatepicker(a,i);else f&&this._inlineDatepicker(a,i)},_newInst:function(a,b){return{id:a[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1"),input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:!b?this.dpDiv:d('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')}}, +_connectDatepicker:function(a,b){var c=d(a);b.append=d([]);b.trigger=d([]);if(!c.hasClass(this.markerClassName)){this._attachments(c,b);c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});this._autoSize(b);d.data(a,"datepicker",b)}},_attachments:function(a,b){var c=this._get(b,"appendText"),e=this._get(b,"isRTL");b.append&& +b.append.remove();if(c){b.append=d('<span class="'+this._appendClass+'">'+c+"</span>");a[e?"before":"after"](b.append)}a.unbind("focus",this._showDatepicker);b.trigger&&b.trigger.remove();c=this._get(b,"showOn");if(c=="focus"||c=="both")a.focus(this._showDatepicker);if(c=="button"||c=="both"){c=this._get(b,"buttonText");var f=this._get(b,"buttonImage");b.trigger=d(this._get(b,"buttonImageOnly")?d("<img/>").addClass(this._triggerClass).attr({src:f,alt:c,title:c}):d('<button type="button"></button>').addClass(this._triggerClass).html(f== +""?c:d("<img/>").attr({src:f,alt:c,title:c})));a[e?"before":"after"](b.trigger);b.trigger.click(function(){d.datepicker._datepickerShowing&&d.datepicker._lastInput==a[0]?d.datepicker._hideDatepicker():d.datepicker._showDatepicker(a[0]);return false})}},_autoSize:function(a){if(this._get(a,"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var e=function(f){for(var h=0,i=0,g=0;g<f.length;g++)if(f[g].length>h){h=f[g].length;i=g}return i};b.setMonth(e(this._get(a, +c.match(/MM/)?"monthNames":"monthNamesShort")));b.setDate(e(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(a,b){var c=d(a);if(!c.hasClass(this.markerClassName)){c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker",function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});d.data(a,"datepicker",b);this._setDate(b,this._getDefaultDate(b), +true);this._updateDatepicker(b);this._updateAlternate(b);b.dpDiv.show()}},_dialogDatepicker:function(a,b,c,e,f){a=this._dialogInst;if(!a){this.uuid+=1;this._dialogInput=d('<input type="text" id="'+("dp"+this.uuid)+'" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>');this._dialogInput.keydown(this._doKeyDown);d("body").append(this._dialogInput);a=this._dialogInst=this._newInst(this._dialogInput,false);a.settings={};d.data(this._dialogInput[0],"datepicker",a)}E(a.settings,e||{}); +b=b&&b.constructor==Date?this._formatDate(a,b):b;this._dialogInput.val(b);this._pos=f?f.length?f:[f.pageX,f.pageY]:null;if(!this._pos)this._pos=[document.documentElement.clientWidth/2-100+(document.documentElement.scrollLeft||document.body.scrollLeft),document.documentElement.clientHeight/2-150+(document.documentElement.scrollTop||document.body.scrollTop)];this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px");a.settings.onSelect=c;this._inDialog=true;this.dpDiv.addClass(this._dialogClass); +this._showDatepicker(this._dialogInput[0]);d.blockUI&&d.blockUI(this.dpDiv);d.data(this._dialogInput[0],"datepicker",a);return this},_destroyDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();d.removeData(a,"datepicker");if(e=="input"){c.append.remove();c.trigger.remove();b.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup", +this._doKeyUp)}else if(e=="div"||e=="span")b.removeClass(this.markerClassName).empty()}},_enableDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=false;c.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else if(e=="div"||e=="span")b.children("."+this._inlineClass).children().removeClass("ui-state-disabled");this._disabledInputs=d.map(this._disabledInputs, +function(f){return f==a?null:f})}},_disableDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=true;c.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else if(e=="div"||e=="span")b.children("."+this._inlineClass).children().addClass("ui-state-disabled");this._disabledInputs=d.map(this._disabledInputs,function(f){return f==a?null: +f});this._disabledInputs[this._disabledInputs.length]=a}},_isDisabledDatepicker:function(a){if(!a)return false;for(var b=0;b<this._disabledInputs.length;b++)if(this._disabledInputs[b]==a)return true;return false},_getInst:function(a){try{return d.data(a,"datepicker")}catch(b){throw"Missing instance data for this datepicker";}},_optionDatepicker:function(a,b,c){var e=this._getInst(a);if(arguments.length==2&&typeof b=="string")return b=="defaults"?d.extend({},d.datepicker._defaults):e?b=="all"?d.extend({}, +e.settings):this._get(e,b):null;var f=b||{};if(typeof b=="string"){f={};f[b]=c}if(e){this._curInst==e&&this._hideDatepicker();var h=this._getDateDatepicker(a,true);E(e.settings,f);this._attachments(d(a),e);this._autoSize(e);this._setDateDatepicker(a,h);this._updateDatepicker(e)}},_changeDatepicker:function(a,b,c){this._optionDatepicker(a,b,c)},_refreshDatepicker:function(a){(a=this._getInst(a))&&this._updateDatepicker(a)},_setDateDatepicker:function(a,b){if(a=this._getInst(a)){this._setDate(a,b); +this._updateDatepicker(a);this._updateAlternate(a)}},_getDateDatepicker:function(a,b){(a=this._getInst(a))&&!a.inline&&this._setDateFromField(a,b);return a?this._getDate(a):null},_doKeyDown:function(a){var b=d.datepicker._getInst(a.target),c=true,e=b.dpDiv.is(".ui-datepicker-rtl");b._keyEvent=true;if(d.datepicker._datepickerShowing)switch(a.keyCode){case 9:d.datepicker._hideDatepicker();c=false;break;case 13:c=d("td."+d.datepicker._dayOverClass+":not(."+d.datepicker._currentClass+")",b.dpDiv);c[0]? +d.datepicker._selectDay(a.target,b.selectedMonth,b.selectedYear,c[0]):d.datepicker._hideDatepicker();return false;case 27:d.datepicker._hideDatepicker();break;case 33:d.datepicker._adjustDate(a.target,a.ctrlKey?-d.datepicker._get(b,"stepBigMonths"):-d.datepicker._get(b,"stepMonths"),"M");break;case 34:d.datepicker._adjustDate(a.target,a.ctrlKey?+d.datepicker._get(b,"stepBigMonths"):+d.datepicker._get(b,"stepMonths"),"M");break;case 35:if(a.ctrlKey||a.metaKey)d.datepicker._clearDate(a.target);c=a.ctrlKey|| +a.metaKey;break;case 36:if(a.ctrlKey||a.metaKey)d.datepicker._gotoToday(a.target);c=a.ctrlKey||a.metaKey;break;case 37:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,e?+1:-1,"D");c=a.ctrlKey||a.metaKey;if(a.originalEvent.altKey)d.datepicker._adjustDate(a.target,a.ctrlKey?-d.datepicker._get(b,"stepBigMonths"):-d.datepicker._get(b,"stepMonths"),"M");break;case 38:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,-7,"D");c=a.ctrlKey||a.metaKey;break;case 39:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target, +e?-1:+1,"D");c=a.ctrlKey||a.metaKey;if(a.originalEvent.altKey)d.datepicker._adjustDate(a.target,a.ctrlKey?+d.datepicker._get(b,"stepBigMonths"):+d.datepicker._get(b,"stepMonths"),"M");break;case 40:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,+7,"D");c=a.ctrlKey||a.metaKey;break;default:c=false}else if(a.keyCode==36&&a.ctrlKey)d.datepicker._showDatepicker(this);else c=false;if(c){a.preventDefault();a.stopPropagation()}},_doKeyPress:function(a){var b=d.datepicker._getInst(a.target);if(d.datepicker._get(b, +"constrainInput")){b=d.datepicker._possibleChars(d.datepicker._get(b,"dateFormat"));var c=String.fromCharCode(a.charCode==G?a.keyCode:a.charCode);return a.ctrlKey||a.metaKey||c<" "||!b||b.indexOf(c)>-1}},_doKeyUp:function(a){a=d.datepicker._getInst(a.target);if(a.input.val()!=a.lastVal)try{if(d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),a.input?a.input.val():null,d.datepicker._getFormatConfig(a))){d.datepicker._setDateFromField(a);d.datepicker._updateAlternate(a);d.datepicker._updateDatepicker(a)}}catch(b){d.datepicker.log(b)}return true}, +_showDatepicker:function(a){a=a.target||a;if(a.nodeName.toLowerCase()!="input")a=d("input",a.parentNode)[0];if(!(d.datepicker._isDisabledDatepicker(a)||d.datepicker._lastInput==a)){var b=d.datepicker._getInst(a);d.datepicker._curInst&&d.datepicker._curInst!=b&&d.datepicker._curInst.dpDiv.stop(true,true);var c=d.datepicker._get(b,"beforeShow");E(b.settings,c?c.apply(a,[a,b]):{});b.lastVal=null;d.datepicker._lastInput=a;d.datepicker._setDateFromField(b);if(d.datepicker._inDialog)a.value="";if(!d.datepicker._pos){d.datepicker._pos= +d.datepicker._findPos(a);d.datepicker._pos[1]+=a.offsetHeight}var e=false;d(a).parents().each(function(){e|=d(this).css("position")=="fixed";return!e});if(e&&d.browser.opera){d.datepicker._pos[0]-=document.documentElement.scrollLeft;d.datepicker._pos[1]-=document.documentElement.scrollTop}c={left:d.datepicker._pos[0],top:d.datepicker._pos[1]};d.datepicker._pos=null;b.dpDiv.empty();b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});d.datepicker._updateDatepicker(b);c=d.datepicker._checkOffset(b, +c,e);b.dpDiv.css({position:d.datepicker._inDialog&&d.blockUI?"static":e?"fixed":"absolute",display:"none",left:c.left+"px",top:c.top+"px"});if(!b.inline){c=d.datepicker._get(b,"showAnim");var f=d.datepicker._get(b,"duration"),h=function(){d.datepicker._datepickerShowing=true;var i=b.dpDiv.find("iframe.ui-datepicker-cover");if(i.length){var g=d.datepicker._getBorders(b.dpDiv);i.css({left:-g[0],top:-g[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()})}};b.dpDiv.zIndex(d(a).zIndex()+1);d.effects&& +d.effects[c]?b.dpDiv.show(c,d.datepicker._get(b,"showOptions"),f,h):b.dpDiv[c||"show"](c?f:null,h);if(!c||!f)h();b.input.is(":visible")&&!b.input.is(":disabled")&&b.input.focus();d.datepicker._curInst=b}}},_updateDatepicker:function(a){var b=this,c=d.datepicker._getBorders(a.dpDiv);a.dpDiv.empty().append(this._generateHTML(a));var e=a.dpDiv.find("iframe.ui-datepicker-cover");e.length&&e.css({left:-c[0],top:-c[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()});a.dpDiv.find("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a").bind("mouseout", +function(){d(this).removeClass("ui-state-hover");this.className.indexOf("ui-datepicker-prev")!=-1&&d(this).removeClass("ui-datepicker-prev-hover");this.className.indexOf("ui-datepicker-next")!=-1&&d(this).removeClass("ui-datepicker-next-hover")}).bind("mouseover",function(){if(!b._isDisabledDatepicker(a.inline?a.dpDiv.parent()[0]:a.input[0])){d(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");d(this).addClass("ui-state-hover");this.className.indexOf("ui-datepicker-prev")!= +-1&&d(this).addClass("ui-datepicker-prev-hover");this.className.indexOf("ui-datepicker-next")!=-1&&d(this).addClass("ui-datepicker-next-hover")}}).end().find("."+this._dayOverClass+" a").trigger("mouseover").end();c=this._getNumberOfMonths(a);e=c[1];e>1?a.dpDiv.addClass("ui-datepicker-multi-"+e).css("width",17*e+"em"):a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");a.dpDiv[(c[0]!=1||c[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");a.dpDiv[(this._get(a, +"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");a==d.datepicker._curInst&&d.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&&!a.input.is(":disabled")&&a.input[0]!=document.activeElement&&a.input.focus();if(a.yearshtml){var f=a.yearshtml;setTimeout(function(){f===a.yearshtml&&a.dpDiv.find("select.ui-datepicker-year:first").replaceWith(a.yearshtml);f=a.yearshtml=null},0)}},_getBorders:function(a){var b=function(c){return{thin:1,medium:2,thick:3}[c]||c};return[parseFloat(b(a.css("border-left-width"))), +parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(a,b,c){var e=a.dpDiv.outerWidth(),f=a.dpDiv.outerHeight(),h=a.input?a.input.outerWidth():0,i=a.input?a.input.outerHeight():0,g=document.documentElement.clientWidth+d(document).scrollLeft(),j=document.documentElement.clientHeight+d(document).scrollTop();b.left-=this._get(a,"isRTL")?e-h:0;b.left-=c&&b.left==a.input.offset().left?d(document).scrollLeft():0;b.top-=c&&b.top==a.input.offset().top+i?d(document).scrollTop():0;b.left-=Math.min(b.left, +b.left+e>g&&g>e?Math.abs(b.left+e-g):0);b.top-=Math.min(b.top,b.top+f>j&&j>f?Math.abs(f+i):0);return b},_findPos:function(a){for(var b=this._get(this._getInst(a),"isRTL");a&&(a.type=="hidden"||a.nodeType!=1||d.expr.filters.hidden(a));)a=a[b?"previousSibling":"nextSibling"];a=d(a).offset();return[a.left,a.top]},_hideDatepicker:function(a){var b=this._curInst;if(!(!b||a&&b!=d.data(a,"datepicker")))if(this._datepickerShowing){a=this._get(b,"showAnim");var c=this._get(b,"duration"),e=function(){d.datepicker._tidyDialog(b); +this._curInst=null};d.effects&&d.effects[a]?b.dpDiv.hide(a,d.datepicker._get(b,"showOptions"),c,e):b.dpDiv[a=="slideDown"?"slideUp":a=="fadeIn"?"fadeOut":"hide"](a?c:null,e);a||e();if(a=this._get(b,"onClose"))a.apply(b.input?b.input[0]:null,[b.input?b.input.val():"",b]);this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if(d.blockUI){d.unblockUI();d("body").append(this.dpDiv)}}this._inDialog=false}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")}, +_checkExternalClick:function(a){if(d.datepicker._curInst){a=d(a.target);a[0].id!=d.datepicker._mainDivId&&a.parents("#"+d.datepicker._mainDivId).length==0&&!a.hasClass(d.datepicker.markerClassName)&&!a.hasClass(d.datepicker._triggerClass)&&d.datepicker._datepickerShowing&&!(d.datepicker._inDialog&&d.blockUI)&&d.datepicker._hideDatepicker()}},_adjustDate:function(a,b,c){a=d(a);var e=this._getInst(a[0]);if(!this._isDisabledDatepicker(a[0])){this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"): +0),c);this._updateDatepicker(e)}},_gotoToday:function(a){a=d(a);var b=this._getInst(a[0]);if(this._get(b,"gotoCurrent")&&b.currentDay){b.selectedDay=b.currentDay;b.drawMonth=b.selectedMonth=b.currentMonth;b.drawYear=b.selectedYear=b.currentYear}else{var c=new Date;b.selectedDay=c.getDate();b.drawMonth=b.selectedMonth=c.getMonth();b.drawYear=b.selectedYear=c.getFullYear()}this._notifyChange(b);this._adjustDate(a)},_selectMonthYear:function(a,b,c){a=d(a);var e=this._getInst(a[0]);e._selectingMonthYear= +false;e["selected"+(c=="M"?"Month":"Year")]=e["draw"+(c=="M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10);this._notifyChange(e);this._adjustDate(a)},_clickMonthYear:function(a){var b=this._getInst(d(a)[0]);b.input&&b._selectingMonthYear&&setTimeout(function(){b.input.focus()},0);b._selectingMonthYear=!b._selectingMonthYear},_selectDay:function(a,b,c,e){var f=d(a);if(!(d(e).hasClass(this._unselectableClass)||this._isDisabledDatepicker(f[0]))){f=this._getInst(f[0]);f.selectedDay=f.currentDay= +d("a",e).html();f.selectedMonth=f.currentMonth=b;f.selectedYear=f.currentYear=c;this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear))}},_clearDate:function(a){a=d(a);this._getInst(a[0]);this._selectDate(a,"")},_selectDate:function(a,b){a=this._getInst(d(a)[0]);b=b!=null?b:this._formatDate(a);a.input&&a.input.val(b);this._updateAlternate(a);var c=this._get(a,"onSelect");if(c)c.apply(a.input?a.input[0]:null,[b,a]);else a.input&&a.input.trigger("change");if(a.inline)this._updateDatepicker(a); +else{this._hideDatepicker();this._lastInput=a.input[0];typeof a.input[0]!="object"&&a.input.focus();this._lastInput=null}},_updateAlternate:function(a){var b=this._get(a,"altField");if(b){var c=this._get(a,"altFormat")||this._get(a,"dateFormat"),e=this._getDate(a),f=this.formatDate(c,e,this._getFormatConfig(a));d(b).each(function(){d(this).val(f)})}},noWeekends:function(a){a=a.getDay();return[a>0&&a<6,""]},iso8601Week:function(a){a=new Date(a.getTime());a.setDate(a.getDate()+4-(a.getDay()||7));var b= +a.getTime();a.setMonth(0);a.setDate(1);return Math.floor(Math.round((b-a)/864E5)/7)+1},parseDate:function(a,b,c){if(a==null||b==null)throw"Invalid arguments";b=typeof b=="object"?b.toString():b+"";if(b=="")return null;var e=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff;e=typeof e!="string"?e:(new Date).getFullYear()%100+parseInt(e,10);for(var f=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,h=(c?c.dayNames:null)||this._defaults.dayNames,i=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort, +g=(c?c.monthNames:null)||this._defaults.monthNames,j=c=-1,l=-1,u=-1,k=false,o=function(p){(p=z+1<a.length&&a.charAt(z+1)==p)&&z++;return p},m=function(p){var v=o(p);p=new RegExp("^\\d{1,"+(p=="@"?14:p=="!"?20:p=="y"&&v?4:p=="o"?3:2)+"}");p=b.substring(s).match(p);if(!p)throw"Missing number at position "+s;s+=p[0].length;return parseInt(p[0],10)},n=function(p,v,H){p=o(p)?H:v;for(v=0;v<p.length;v++)if(b.substr(s,p[v].length).toLowerCase()==p[v].toLowerCase()){s+=p[v].length;return v+1}throw"Unknown name at position "+ +s;},r=function(){if(b.charAt(s)!=a.charAt(z))throw"Unexpected literal at position "+s;s++},s=0,z=0;z<a.length;z++)if(k)if(a.charAt(z)=="'"&&!o("'"))k=false;else r();else switch(a.charAt(z)){case "d":l=m("d");break;case "D":n("D",f,h);break;case "o":u=m("o");break;case "m":j=m("m");break;case "M":j=n("M",i,g);break;case "y":c=m("y");break;case "@":var w=new Date(m("@"));c=w.getFullYear();j=w.getMonth()+1;l=w.getDate();break;case "!":w=new Date((m("!")-this._ticksTo1970)/1E4);c=w.getFullYear();j=w.getMonth()+ +1;l=w.getDate();break;case "'":if(o("'"))r();else k=true;break;default:r()}if(c==-1)c=(new Date).getFullYear();else if(c<100)c+=(new Date).getFullYear()-(new Date).getFullYear()%100+(c<=e?0:-100);if(u>-1){j=1;l=u;do{e=this._getDaysInMonth(c,j-1);if(l<=e)break;j++;l-=e}while(1)}w=this._daylightSavingAdjust(new Date(c,j-1,l));if(w.getFullYear()!=c||w.getMonth()+1!=j||w.getDate()!=l)throw"Invalid date";return w},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y", +RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1E7,formatDate:function(a,b,c){if(!b)return"";var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?c.dayNames:null)||this._defaults.dayNames,h=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort;c=(c?c.monthNames:null)||this._defaults.monthNames;var i=function(o){(o=k+1<a.length&& +a.charAt(k+1)==o)&&k++;return o},g=function(o,m,n){m=""+m;if(i(o))for(;m.length<n;)m="0"+m;return m},j=function(o,m,n,r){return i(o)?r[m]:n[m]},l="",u=false;if(b)for(var k=0;k<a.length;k++)if(u)if(a.charAt(k)=="'"&&!i("'"))u=false;else l+=a.charAt(k);else switch(a.charAt(k)){case "d":l+=g("d",b.getDate(),2);break;case "D":l+=j("D",b.getDay(),e,f);break;case "o":l+=g("o",(b.getTime()-(new Date(b.getFullYear(),0,0)).getTime())/864E5,3);break;case "m":l+=g("m",b.getMonth()+1,2);break;case "M":l+=j("M", +b.getMonth(),h,c);break;case "y":l+=i("y")?b.getFullYear():(b.getYear()%100<10?"0":"")+b.getYear()%100;break;case "@":l+=b.getTime();break;case "!":l+=b.getTime()*1E4+this._ticksTo1970;break;case "'":if(i("'"))l+="'";else u=true;break;default:l+=a.charAt(k)}return l},_possibleChars:function(a){for(var b="",c=false,e=function(h){(h=f+1<a.length&&a.charAt(f+1)==h)&&f++;return h},f=0;f<a.length;f++)if(c)if(a.charAt(f)=="'"&&!e("'"))c=false;else b+=a.charAt(f);else switch(a.charAt(f)){case "d":case "m":case "y":case "@":b+= +"0123456789";break;case "D":case "M":return null;case "'":if(e("'"))b+="'";else c=true;break;default:b+=a.charAt(f)}return b},_get:function(a,b){return a.settings[b]!==G?a.settings[b]:this._defaults[b]},_setDateFromField:function(a,b){if(a.input.val()!=a.lastVal){var c=this._get(a,"dateFormat"),e=a.lastVal=a.input?a.input.val():null,f,h;f=h=this._getDefaultDate(a);var i=this._getFormatConfig(a);try{f=this.parseDate(c,e,i)||h}catch(g){this.log(g);e=b?"":e}a.selectedDay=f.getDate();a.drawMonth=a.selectedMonth= +f.getMonth();a.drawYear=a.selectedYear=f.getFullYear();a.currentDay=e?f.getDate():0;a.currentMonth=e?f.getMonth():0;a.currentYear=e?f.getFullYear():0;this._adjustInstDate(a)}},_getDefaultDate:function(a){return this._restrictMinMax(a,this._determineDate(a,this._get(a,"defaultDate"),new Date))},_determineDate:function(a,b,c){var e=function(h){var i=new Date;i.setDate(i.getDate()+h);return i},f=function(h){try{return d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),h,d.datepicker._getFormatConfig(a))}catch(i){}var g= +(h.toLowerCase().match(/^c/)?d.datepicker._getDate(a):null)||new Date,j=g.getFullYear(),l=g.getMonth();g=g.getDate();for(var u=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,k=u.exec(h);k;){switch(k[2]||"d"){case "d":case "D":g+=parseInt(k[1],10);break;case "w":case "W":g+=parseInt(k[1],10)*7;break;case "m":case "M":l+=parseInt(k[1],10);g=Math.min(g,d.datepicker._getDaysInMonth(j,l));break;case "y":case "Y":j+=parseInt(k[1],10);g=Math.min(g,d.datepicker._getDaysInMonth(j,l));break}k=u.exec(h)}return new Date(j, +l,g)};if(b=(b=b==null||b===""?c:typeof b=="string"?f(b):typeof b=="number"?isNaN(b)?c:e(b):new Date(b.getTime()))&&b.toString()=="Invalid Date"?c:b){b.setHours(0);b.setMinutes(0);b.setSeconds(0);b.setMilliseconds(0)}return this._daylightSavingAdjust(b)},_daylightSavingAdjust:function(a){if(!a)return null;a.setHours(a.getHours()>12?a.getHours()+2:0);return a},_setDate:function(a,b,c){var e=!b,f=a.selectedMonth,h=a.selectedYear;b=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay= +a.currentDay=b.getDate();a.drawMonth=a.selectedMonth=a.currentMonth=b.getMonth();a.drawYear=a.selectedYear=a.currentYear=b.getFullYear();if((f!=a.selectedMonth||h!=a.selectedYear)&&!c)this._notifyChange(a);this._adjustInstDate(a);if(a.input)a.input.val(e?"":this._formatDate(a))},_getDate:function(a){return!a.currentYear||a.input&&a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay))},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(), +b.getMonth(),b.getDate()));var c=this._get(a,"isRTL"),e=this._get(a,"showButtonPanel"),f=this._get(a,"hideIfNoPrevNext"),h=this._get(a,"navigationAsDateFormat"),i=this._getNumberOfMonths(a),g=this._get(a,"showCurrentAtPos"),j=this._get(a,"stepMonths"),l=i[0]!=1||i[1]!=1,u=this._daylightSavingAdjust(!a.currentDay?new Date(9999,9,9):new Date(a.currentYear,a.currentMonth,a.currentDay)),k=this._getMinMaxDate(a,"min"),o=this._getMinMaxDate(a,"max");g=a.drawMonth-g;var m=a.drawYear;if(g<0){g+=12;m--}if(o){var n= +this._daylightSavingAdjust(new Date(o.getFullYear(),o.getMonth()-i[0]*i[1]+1,o.getDate()));for(n=k&&n<k?k:n;this._daylightSavingAdjust(new Date(m,g,1))>n;){g--;if(g<0){g=11;m--}}}a.drawMonth=g;a.drawYear=m;n=this._get(a,"prevText");n=!h?n:this.formatDate(n,this._daylightSavingAdjust(new Date(m,g-j,1)),this._getFormatConfig(a));n=this._canAdjustMonth(a,-1,m,g)?'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_'+y+".datepicker._adjustDate('#"+a.id+"', -"+j+", 'M');\" title=\""+n+'"><span class="ui-icon ui-icon-circle-triangle-'+ +(c?"e":"w")+'">'+n+"</span></a>":f?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+n+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+n+"</span></a>";var r=this._get(a,"nextText");r=!h?r:this.formatDate(r,this._daylightSavingAdjust(new Date(m,g+j,1)),this._getFormatConfig(a));f=this._canAdjustMonth(a,+1,m,g)?'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_'+y+".datepicker._adjustDate('#"+a.id+"', +"+j+", 'M');\" title=\""+r+'"><span class="ui-icon ui-icon-circle-triangle-'+ +(c?"w":"e")+'">'+r+"</span></a>":f?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+r+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"w":"e")+'">'+r+"</span></a>";j=this._get(a,"currentText");r=this._get(a,"gotoCurrent")&&a.currentDay?u:b;j=!h?j:this.formatDate(j,r,this._getFormatConfig(a));h=!a.inline?'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_'+y+'.datepicker._hideDatepicker();">'+this._get(a, +"closeText")+"</button>":"";e=e?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(c?h:"")+(this._isInRange(a,r)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_'+y+".datepicker._gotoToday('#"+a.id+"');\">"+j+"</button>":"")+(c?"":h)+"</div>":"";h=parseInt(this._get(a,"firstDay"),10);h=isNaN(h)?0:h;j=this._get(a,"showWeek");r=this._get(a,"dayNames");this._get(a,"dayNamesShort");var s=this._get(a,"dayNamesMin"),z= +this._get(a,"monthNames"),w=this._get(a,"monthNamesShort"),p=this._get(a,"beforeShowDay"),v=this._get(a,"showOtherMonths"),H=this._get(a,"selectOtherMonths");this._get(a,"calculateWeek");for(var L=this._getDefaultDate(a),I="",C=0;C<i[0];C++){for(var M="",D=0;D<i[1];D++){var N=this._daylightSavingAdjust(new Date(m,g,a.selectedDay)),t=" ui-corner-all",x="";if(l){x+='<div class="ui-datepicker-group';if(i[1]>1)switch(D){case 0:x+=" ui-datepicker-group-first";t=" ui-corner-"+(c?"right":"left");break;case i[1]- +1:x+=" ui-datepicker-group-last";t=" ui-corner-"+(c?"left":"right");break;default:x+=" ui-datepicker-group-middle";t="";break}x+='">'}x+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+t+'">'+(/all|left/.test(t)&&C==0?c?f:n:"")+(/all|right/.test(t)&&C==0?c?n:f:"")+this._generateMonthYearHeader(a,g,m,k,o,C>0||D>0,z,w)+'</div><table class="ui-datepicker-calendar"><thead><tr>';var A=j?'<th class="ui-datepicker-week-col">'+this._get(a,"weekHeader")+"</th>":"";for(t=0;t<7;t++){var q= +(t+h)%7;A+="<th"+((t+h+6)%7>=5?' class="ui-datepicker-week-end"':"")+'><span title="'+r[q]+'">'+s[q]+"</span></th>"}x+=A+"</tr></thead><tbody>";A=this._getDaysInMonth(m,g);if(m==a.selectedYear&&g==a.selectedMonth)a.selectedDay=Math.min(a.selectedDay,A);t=(this._getFirstDayOfMonth(m,g)-h+7)%7;A=l?6:Math.ceil((t+A)/7);q=this._daylightSavingAdjust(new Date(m,g,1-t));for(var O=0;O<A;O++){x+="<tr>";var P=!j?"":'<td class="ui-datepicker-week-col">'+this._get(a,"calculateWeek")(q)+"</td>";for(t=0;t<7;t++){var F= +p?p.apply(a.input?a.input[0]:null,[q]):[true,""],B=q.getMonth()!=g,J=B&&!H||!F[0]||k&&q<k||o&&q>o;P+='<td class="'+((t+h+6)%7>=5?" ui-datepicker-week-end":"")+(B?" ui-datepicker-other-month":"")+(q.getTime()==N.getTime()&&g==a.selectedMonth&&a._keyEvent||L.getTime()==q.getTime()&&L.getTime()==N.getTime()?" "+this._dayOverClass:"")+(J?" "+this._unselectableClass+" ui-state-disabled":"")+(B&&!v?"":" "+F[1]+(q.getTime()==u.getTime()?" "+this._currentClass:"")+(q.getTime()==b.getTime()?" ui-datepicker-today": +""))+'"'+((!B||v)&&F[2]?' title="'+F[2]+'"':"")+(J?"":' onclick="DP_jQuery_'+y+".datepicker._selectDay('#"+a.id+"',"+q.getMonth()+","+q.getFullYear()+', this);return false;"')+">"+(B&&!v?" ":J?'<span class="ui-state-default">'+q.getDate()+"</span>":'<a class="ui-state-default'+(q.getTime()==b.getTime()?" ui-state-highlight":"")+(q.getTime()==u.getTime()?" ui-state-active":"")+(B?" ui-priority-secondary":"")+'" href="#">'+q.getDate()+"</a>")+"</td>";q.setDate(q.getDate()+1);q=this._daylightSavingAdjust(q)}x+= +P+"</tr>"}g++;if(g>11){g=0;m++}x+="</tbody></table>"+(l?"</div>"+(i[0]>0&&D==i[1]-1?'<div class="ui-datepicker-row-break"></div>':""):"");M+=x}I+=M}I+=e+(d.browser.msie&&parseInt(d.browser.version,10)<7&&!a.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':"");a._keyEvent=false;return I},_generateMonthYearHeader:function(a,b,c,e,f,h,i,g){var j=this._get(a,"changeMonth"),l=this._get(a,"changeYear"),u=this._get(a,"showMonthAfterYear"),k='<div class="ui-datepicker-title">', +o="";if(h||!j)o+='<span class="ui-datepicker-month">'+i[b]+"</span>";else{i=e&&e.getFullYear()==c;var m=f&&f.getFullYear()==c;o+='<select class="ui-datepicker-month" onchange="DP_jQuery_'+y+".datepicker._selectMonthYear('#"+a.id+"', this, 'M');\" onclick=\"DP_jQuery_"+y+".datepicker._clickMonthYear('#"+a.id+"');\">";for(var n=0;n<12;n++)if((!i||n>=e.getMonth())&&(!m||n<=f.getMonth()))o+='<option value="'+n+'"'+(n==b?' selected="selected"':"")+">"+g[n]+"</option>";o+="</select>"}u||(k+=o+(h||!(j&& +l)?" ":""));a.yearshtml="";if(h||!l)k+='<span class="ui-datepicker-year">'+c+"</span>";else{g=this._get(a,"yearRange").split(":");var r=(new Date).getFullYear();i=function(s){s=s.match(/c[+-].*/)?c+parseInt(s.substring(1),10):s.match(/[+-].*/)?r+parseInt(s,10):parseInt(s,10);return isNaN(s)?r:s};b=i(g[0]);g=Math.max(b,i(g[1]||""));b=e?Math.max(b,e.getFullYear()):b;g=f?Math.min(g,f.getFullYear()):g;for(a.yearshtml+='<select class="ui-datepicker-year" onchange="DP_jQuery_'+y+".datepicker._selectMonthYear('#"+ +a.id+"', this, 'Y');\" onclick=\"DP_jQuery_"+y+".datepicker._clickMonthYear('#"+a.id+"');\">";b<=g;b++)a.yearshtml+='<option value="'+b+'"'+(b==c?' selected="selected"':"")+">"+b+"</option>";a.yearshtml+="</select>";if(d.browser.mozilla)k+='<select class="ui-datepicker-year"><option value="'+c+'" selected="selected">'+c+"</option></select>";else{k+=a.yearshtml;a.yearshtml=null}}k+=this._get(a,"yearSuffix");if(u)k+=(h||!(j&&l)?" ":"")+o;k+="</div>";return k},_adjustInstDate:function(a,b,c){var e= +a.drawYear+(c=="Y"?b:0),f=a.drawMonth+(c=="M"?b:0);b=Math.min(a.selectedDay,this._getDaysInMonth(e,f))+(c=="D"?b:0);e=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(e,f,b)));a.selectedDay=e.getDate();a.drawMonth=a.selectedMonth=e.getMonth();a.drawYear=a.selectedYear=e.getFullYear();if(c=="M"||c=="Y")this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");b=c&&b<c?c:b;return b=a&&b>a?a:b},_notifyChange:function(a){var b=this._get(a, +"onChangeMonthYear");if(b)b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){a=this._get(a,"numberOfMonths");return a==null?[1,1]:typeof a=="number"?[1,a]:a},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,e){var f=this._getNumberOfMonths(a); +c=this._daylightSavingAdjust(new Date(c,e+(b<0?b:f[0]*f[1]),1));b<0&&c.setDate(this._getDaysInMonth(c.getFullYear(),c.getMonth()));return this._isInRange(a,c)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!a||b.getTime()<=a.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10);return{shortYearCutoff:b,dayNamesShort:this._get(a, +"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,e){if(!b){a.currentDay=a.selectedDay;a.currentMonth=a.selectedMonth;a.currentYear=a.selectedYear}b=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(e,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),b,this._getFormatConfig(a))}});d.fn.datepicker= +function(a){if(!this.length)return this;if(!d.datepicker.initialized){d(document).mousedown(d.datepicker._checkExternalClick).find("body").append(d.datepicker.dpDiv);d.datepicker.initialized=true}var b=Array.prototype.slice.call(arguments,1);if(typeof a=="string"&&(a=="isDisabled"||a=="getDate"||a=="widget"))return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));if(a=="option"&&arguments.length==2&&typeof arguments[1]=="string")return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker, +[this[0]].concat(b));return this.each(function(){typeof a=="string"?d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this].concat(b)):d.datepicker._attachDatepicker(this,a)})};d.datepicker=new K;d.datepicker.initialized=false;d.datepicker.uuid=(new Date).getTime();d.datepicker.version="1.8.10";window["DP_jQuery_"+y]=d})(jQuery); +;/* + * jQuery UI Progressbar 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Progressbar + * + * Depends: + * jquery.ui.core.js + * jquery.ui.widget.js + */ +(function(b,d){b.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()});this.valueDiv=b("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element);this.oldValue=this._value();this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"); +this.valueDiv.remove();b.Widget.prototype.destroy.apply(this,arguments)},value:function(a){if(a===d)return this._value();this._setOption("value",a);return this},_setOption:function(a,c){if(a==="value"){this.options.value=c;this._refreshValue();this._value()===this.options.max&&this._trigger("complete")}b.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var a=this.options.value;if(typeof a!=="number")a=0;return Math.min(this.options.max,Math.max(this.min,a))},_percentage:function(){return 100* +this._value()/this.options.max},_refreshValue:function(){var a=this.value(),c=this._percentage();if(this.oldValue!==a){this.oldValue=a;this._trigger("change")}this.valueDiv.toggleClass("ui-corner-right",a===this.options.max).width(c.toFixed(0)+"%");this.element.attr("aria-valuenow",a)}});b.extend(b.ui.progressbar,{version:"1.8.10"})})(jQuery); +;/* + * jQuery UI Effects 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/ + */ +jQuery.effects||function(f,j){function n(c){var a;if(c&&c.constructor==Array&&c.length==3)return c;if(a=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c))return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10)];if(a=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c))return[parseFloat(a[1])*2.55,parseFloat(a[2])*2.55,parseFloat(a[3])*2.55];if(a=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c))return[parseInt(a[1], +16),parseInt(a[2],16),parseInt(a[3],16)];if(a=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c))return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)];if(/rgba\(0, 0, 0, 0\)/.exec(c))return o.transparent;return o[f.trim(c).toLowerCase()]}function s(c,a){var b;do{b=f.curCSS(c,a);if(b!=""&&b!="transparent"||f.nodeName(c,"body"))break;a="backgroundColor"}while(c=c.parentNode);return n(b)}function p(){var c=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle, +a={},b,d;if(c&&c.length&&c[0]&&c[c[0]])for(var e=c.length;e--;){b=c[e];if(typeof c[b]=="string"){d=b.replace(/\-(\w)/g,function(g,h){return h.toUpperCase()});a[d]=c[b]}}else for(b in c)if(typeof c[b]==="string")a[b]=c[b];return a}function q(c){var a,b;for(a in c){b=c[a];if(b==null||f.isFunction(b)||a in t||/scrollbar/.test(a)||!/color/i.test(a)&&isNaN(parseFloat(b)))delete c[a]}return c}function u(c,a){var b={_:0},d;for(d in a)if(c[d]!=a[d])b[d]=a[d];return b}function k(c,a,b,d){if(typeof c=="object"){d= +a;b=null;a=c;c=a.effect}if(f.isFunction(a)){d=a;b=null;a={}}if(typeof a=="number"||f.fx.speeds[a]){d=b;b=a;a={}}if(f.isFunction(b)){d=b;b=null}a=a||{};b=b||a.duration;b=f.fx.off?0:typeof b=="number"?b:b in f.fx.speeds?f.fx.speeds[b]:f.fx.speeds._default;d=d||a.complete;return[c,a,b,d]}function m(c){if(!c||typeof c==="number"||f.fx.speeds[c])return true;if(typeof c==="string"&&!f.effects[c])return true;return false}f.effects={};f.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor", +"borderTopColor","borderColor","color","outlineColor"],function(c,a){f.fx.step[a]=function(b){if(!b.colorInit){b.start=s(b.elem,a);b.end=n(b.end);b.colorInit=true}b.elem.style[a]="rgb("+Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2],10),255),0)+")"}});var o={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0, +0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211, +211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},r=["add","remove","toggle"],t={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};f.effects.animateClass=function(c,a,b, +d){if(f.isFunction(b)){d=b;b=null}return this.queue("fx",function(){var e=f(this),g=e.attr("style")||" ",h=q(p.call(this)),l,v=e.attr("className");f.each(r,function(w,i){c[i]&&e[i+"Class"](c[i])});l=q(p.call(this));e.attr("className",v);e.animate(u(h,l),a,b,function(){f.each(r,function(w,i){c[i]&&e[i+"Class"](c[i])});if(typeof e.attr("style")=="object"){e.attr("style").cssText="";e.attr("style").cssText=g}else e.attr("style",g);d&&d.apply(this,arguments)});h=f.queue(this);l=h.splice(h.length-1,1)[0]; +h.splice(1,0,l);f.dequeue(this)})};f.fn.extend({_addClass:f.fn.addClass,addClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{add:c},a,b,d]):this._addClass(c)},_removeClass:f.fn.removeClass,removeClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{remove:c},a,b,d]):this._removeClass(c)},_toggleClass:f.fn.toggleClass,toggleClass:function(c,a,b,d,e){return typeof a=="boolean"||a===j?b?f.effects.animateClass.apply(this,[a?{add:c}:{remove:c},b,d,e]):this._toggleClass(c, +a):f.effects.animateClass.apply(this,[{toggle:c},a,b,d])},switchClass:function(c,a,b,d,e){return f.effects.animateClass.apply(this,[{add:a,remove:c},b,d,e])}});f.extend(f.effects,{version:"1.8.10",save:function(c,a){for(var b=0;b<a.length;b++)a[b]!==null&&c.data("ec.storage."+a[b],c[0].style[a[b]])},restore:function(c,a){for(var b=0;b<a.length;b++)a[b]!==null&&c.css(a[b],c.data("ec.storage."+a[b]))},setMode:function(c,a){if(a=="toggle")a=c.is(":hidden")?"show":"hide";return a},getBaseline:function(c, +a){var b;switch(c[0]){case "top":b=0;break;case "middle":b=0.5;break;case "bottom":b=1;break;default:b=c[0]/a.height}switch(c[1]){case "left":c=0;break;case "center":c=0.5;break;case "right":c=1;break;default:c=c[1]/a.width}return{x:c,y:b}},createWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent();var a={width:c.outerWidth(true),height:c.outerHeight(true),"float":c.css("float")},b=f("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent", +border:"none",margin:0,padding:0});c.wrap(b);b=c.parent();if(c.css("position")=="static"){b.css({position:"relative"});c.css({position:"relative"})}else{f.extend(a,{position:c.css("position"),zIndex:c.css("z-index")});f.each(["top","left","bottom","right"],function(d,e){a[e]=c.css(e);if(isNaN(parseInt(a[e],10)))a[e]="auto"});c.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})}return b.css(a).show()},removeWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent().replaceWith(c); +return c},setTransition:function(c,a,b,d){d=d||{};f.each(a,function(e,g){unit=c.cssUnit(g);if(unit[0]>0)d[g]=unit[0]*b+unit[1]});return d}});f.fn.extend({effect:function(c){var a=k.apply(this,arguments),b={options:a[1],duration:a[2],callback:a[3]};a=b.options.mode;var d=f.effects[c];if(f.fx.off||!d)return a?this[a](b.duration,b.callback):this.each(function(){b.callback&&b.callback.call(this)});return d.call(this,b)},_show:f.fn.show,show:function(c){if(m(c))return this._show.apply(this,arguments); +else{var a=k.apply(this,arguments);a[1].mode="show";return this.effect.apply(this,a)}},_hide:f.fn.hide,hide:function(c){if(m(c))return this._hide.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="hide";return this.effect.apply(this,a)}},__toggle:f.fn.toggle,toggle:function(c){if(m(c)||typeof c==="boolean"||f.isFunction(c))return this.__toggle.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="toggle";return this.effect.apply(this,a)}},cssUnit:function(c){var a=this.css(c), +b=[];f.each(["em","px","%","pt"],function(d,e){if(a.indexOf(e)>0)b=[parseFloat(a),e]});return b}});f.easing.jswing=f.easing.swing;f.extend(f.easing,{def:"easeOutQuad",swing:function(c,a,b,d,e){return f.easing[f.easing.def](c,a,b,d,e)},easeInQuad:function(c,a,b,d,e){return d*(a/=e)*a+b},easeOutQuad:function(c,a,b,d,e){return-d*(a/=e)*(a-2)+b},easeInOutQuad:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a+b;return-d/2*(--a*(a-2)-1)+b},easeInCubic:function(c,a,b,d,e){return d*(a/=e)*a*a+b},easeOutCubic:function(c, +a,b,d,e){return d*((a=a/e-1)*a*a+1)+b},easeInOutCubic:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a+b;return d/2*((a-=2)*a*a+2)+b},easeInQuart:function(c,a,b,d,e){return d*(a/=e)*a*a*a+b},easeOutQuart:function(c,a,b,d,e){return-d*((a=a/e-1)*a*a*a-1)+b},easeInOutQuart:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a+b;return-d/2*((a-=2)*a*a*a-2)+b},easeInQuint:function(c,a,b,d,e){return d*(a/=e)*a*a*a*a+b},easeOutQuint:function(c,a,b,d,e){return d*((a=a/e-1)*a*a*a*a+1)+b},easeInOutQuint:function(c, +a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a*a+b;return d/2*((a-=2)*a*a*a*a+2)+b},easeInSine:function(c,a,b,d,e){return-d*Math.cos(a/e*(Math.PI/2))+d+b},easeOutSine:function(c,a,b,d,e){return d*Math.sin(a/e*(Math.PI/2))+b},easeInOutSine:function(c,a,b,d,e){return-d/2*(Math.cos(Math.PI*a/e)-1)+b},easeInExpo:function(c,a,b,d,e){return a==0?b:d*Math.pow(2,10*(a/e-1))+b},easeOutExpo:function(c,a,b,d,e){return a==e?b+d:d*(-Math.pow(2,-10*a/e)+1)+b},easeInOutExpo:function(c,a,b,d,e){if(a==0)return b;if(a== +e)return b+d;if((a/=e/2)<1)return d/2*Math.pow(2,10*(a-1))+b;return d/2*(-Math.pow(2,-10*--a)+2)+b},easeInCirc:function(c,a,b,d,e){return-d*(Math.sqrt(1-(a/=e)*a)-1)+b},easeOutCirc:function(c,a,b,d,e){return d*Math.sqrt(1-(a=a/e-1)*a)+b},easeInOutCirc:function(c,a,b,d,e){if((a/=e/2)<1)return-d/2*(Math.sqrt(1-a*a)-1)+b;return d/2*(Math.sqrt(1-(a-=2)*a)+1)+b},easeInElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h<Math.abs(d)){h=d;c=g/4}else c= +g/(2*Math.PI)*Math.asin(d/h);return-(h*Math.pow(2,10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g))+b},easeOutElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/h);return h*Math.pow(2,-10*a)*Math.sin((a*e-c)*2*Math.PI/g)+d+b},easeInOutElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e/2)==2)return b+d;g||(g=e*0.3*1.5);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/ +h);if(a<1)return-0.5*h*Math.pow(2,10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g)+b;return h*Math.pow(2,-10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g)*0.5+d+b},easeInBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;return d*(a/=e)*a*((g+1)*a-g)+b},easeOutBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;return d*((a=a/e-1)*a*((g+1)*a+g)+1)+b},easeInOutBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;if((a/=e/2)<1)return d/2*a*a*(((g*=1.525)+1)*a-g)+b;return d/2*((a-=2)*a*(((g*=1.525)+1)*a+g)+2)+b},easeInBounce:function(c, +a,b,d,e){return d-f.easing.easeOutBounce(c,e-a,0,d,e)+b},easeOutBounce:function(c,a,b,d,e){return(a/=e)<1/2.75?d*7.5625*a*a+b:a<2/2.75?d*(7.5625*(a-=1.5/2.75)*a+0.75)+b:a<2.5/2.75?d*(7.5625*(a-=2.25/2.75)*a+0.9375)+b:d*(7.5625*(a-=2.625/2.75)*a+0.984375)+b},easeInOutBounce:function(c,a,b,d,e){if(a<e/2)return f.easing.easeInBounce(c,a*2,0,d,e)*0.5+b;return f.easing.easeOutBounce(c,a*2-e,0,d,e)*0.5+d*0.5+b}})}(jQuery); +;/* + * jQuery UI Effects Blind 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Blind + * + * Depends: + * jquery.effects.core.js + */ +(function(b){b.effects.blind=function(c){return this.queue(function(){var a=b(this),g=["position","top","bottom","left","right"],f=b.effects.setMode(a,c.options.mode||"hide"),d=c.options.direction||"vertical";b.effects.save(a,g);a.show();var e=b.effects.createWrapper(a).css({overflow:"hidden"}),h=d=="vertical"?"height":"width";d=d=="vertical"?e.height():e.width();f=="show"&&e.css(h,0);var i={};i[h]=f=="show"?d:0;e.animate(i,c.duration,c.options.easing,function(){f=="hide"&&a.hide();b.effects.restore(a, +g);b.effects.removeWrapper(a);c.callback&&c.callback.apply(a[0],arguments);a.dequeue()})})}})(jQuery); +;/* + * jQuery UI Effects Bounce 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Bounce + * + * Depends: + * jquery.effects.core.js + */ +(function(e){e.effects.bounce=function(b){return this.queue(function(){var a=e(this),l=["position","top","bottom","left","right"],h=e.effects.setMode(a,b.options.mode||"effect"),d=b.options.direction||"up",c=b.options.distance||20,m=b.options.times||5,i=b.duration||250;/show|hide/.test(h)&&l.push("opacity");e.effects.save(a,l);a.show();e.effects.createWrapper(a);var f=d=="up"||d=="down"?"top":"left";d=d=="up"||d=="left"?"pos":"neg";c=b.options.distance||(f=="top"?a.outerHeight({margin:true})/3:a.outerWidth({margin:true})/ +3);if(h=="show")a.css("opacity",0).css(f,d=="pos"?-c:c);if(h=="hide")c/=m*2;h!="hide"&&m--;if(h=="show"){var g={opacity:1};g[f]=(d=="pos"?"+=":"-=")+c;a.animate(g,i/2,b.options.easing);c/=2;m--}for(g=0;g<m;g++){var j={},k={};j[f]=(d=="pos"?"-=":"+=")+c;k[f]=(d=="pos"?"+=":"-=")+c;a.animate(j,i/2,b.options.easing).animate(k,i/2,b.options.easing);c=h=="hide"?c*2:c/2}if(h=="hide"){g={opacity:0};g[f]=(d=="pos"?"-=":"+=")+c;a.animate(g,i/2,b.options.easing,function(){a.hide();e.effects.restore(a,l);e.effects.removeWrapper(a); +b.callback&&b.callback.apply(this,arguments)})}else{j={};k={};j[f]=(d=="pos"?"-=":"+=")+c;k[f]=(d=="pos"?"+=":"-=")+c;a.animate(j,i/2,b.options.easing).animate(k,i/2,b.options.easing,function(){e.effects.restore(a,l);e.effects.removeWrapper(a);b.callback&&b.callback.apply(this,arguments)})}a.queue("fx",function(){a.dequeue()});a.dequeue()})}})(jQuery); +;/* + * jQuery UI Effects Clip 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Clip + * + * Depends: + * jquery.effects.core.js + */ +(function(b){b.effects.clip=function(e){return this.queue(function(){var a=b(this),i=["position","top","bottom","left","right","height","width"],f=b.effects.setMode(a,e.options.mode||"hide"),c=e.options.direction||"vertical";b.effects.save(a,i);a.show();var d=b.effects.createWrapper(a).css({overflow:"hidden"});d=a[0].tagName=="IMG"?d:a;var g={size:c=="vertical"?"height":"width",position:c=="vertical"?"top":"left"};c=c=="vertical"?d.height():d.width();if(f=="show"){d.css(g.size,0);d.css(g.position, +c/2)}var h={};h[g.size]=f=="show"?c:0;h[g.position]=f=="show"?0:c/2;d.animate(h,{queue:false,duration:e.duration,easing:e.options.easing,complete:function(){f=="hide"&&a.hide();b.effects.restore(a,i);b.effects.removeWrapper(a);e.callback&&e.callback.apply(a[0],arguments);a.dequeue()}})})}})(jQuery); +;/* + * jQuery UI Effects Drop 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Drop + * + * Depends: + * jquery.effects.core.js + */ +(function(c){c.effects.drop=function(d){return this.queue(function(){var a=c(this),h=["position","top","bottom","left","right","opacity"],e=c.effects.setMode(a,d.options.mode||"hide"),b=d.options.direction||"left";c.effects.save(a,h);a.show();c.effects.createWrapper(a);var f=b=="up"||b=="down"?"top":"left";b=b=="up"||b=="left"?"pos":"neg";var g=d.options.distance||(f=="top"?a.outerHeight({margin:true})/2:a.outerWidth({margin:true})/2);if(e=="show")a.css("opacity",0).css(f,b=="pos"?-g:g);var i={opacity:e== +"show"?1:0};i[f]=(e=="show"?b=="pos"?"+=":"-=":b=="pos"?"-=":"+=")+g;a.animate(i,{queue:false,duration:d.duration,easing:d.options.easing,complete:function(){e=="hide"&&a.hide();c.effects.restore(a,h);c.effects.removeWrapper(a);d.callback&&d.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery); +;/* + * jQuery UI Effects Explode 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Explode + * + * Depends: + * jquery.effects.core.js + */ +(function(j){j.effects.explode=function(a){return this.queue(function(){var c=a.options.pieces?Math.round(Math.sqrt(a.options.pieces)):3,d=a.options.pieces?Math.round(Math.sqrt(a.options.pieces)):3;a.options.mode=a.options.mode=="toggle"?j(this).is(":visible")?"hide":"show":a.options.mode;var b=j(this).show().css("visibility","hidden"),g=b.offset();g.top-=parseInt(b.css("marginTop"),10)||0;g.left-=parseInt(b.css("marginLeft"),10)||0;for(var h=b.outerWidth(true),i=b.outerHeight(true),e=0;e<c;e++)for(var f= +0;f<d;f++)b.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-f*(h/d),top:-e*(i/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:h/d,height:i/c,left:g.left+f*(h/d)+(a.options.mode=="show"?(f-Math.floor(d/2))*(h/d):0),top:g.top+e*(i/c)+(a.options.mode=="show"?(e-Math.floor(c/2))*(i/c):0),opacity:a.options.mode=="show"?0:1}).animate({left:g.left+f*(h/d)+(a.options.mode=="show"?0:(f-Math.floor(d/2))*(h/d)),top:g.top+ +e*(i/c)+(a.options.mode=="show"?0:(e-Math.floor(c/2))*(i/c)),opacity:a.options.mode=="show"?1:0},a.duration||500);setTimeout(function(){a.options.mode=="show"?b.css({visibility:"visible"}):b.css({visibility:"visible"}).hide();a.callback&&a.callback.apply(b[0]);b.dequeue();j("div.ui-effects-explode").remove()},a.duration||500)})}})(jQuery); +;/* + * jQuery UI Effects Fade 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Fade + * + * Depends: + * jquery.effects.core.js + */ +(function(b){b.effects.fade=function(a){return this.queue(function(){var c=b(this),d=b.effects.setMode(c,a.options.mode||"hide");c.animate({opacity:d},{queue:false,duration:a.duration,easing:a.options.easing,complete:function(){a.callback&&a.callback.apply(this,arguments);c.dequeue()}})})}})(jQuery); +;/* + * jQuery UI Effects Fold 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Fold + * + * Depends: + * jquery.effects.core.js + */ +(function(c){c.effects.fold=function(a){return this.queue(function(){var b=c(this),j=["position","top","bottom","left","right"],d=c.effects.setMode(b,a.options.mode||"hide"),g=a.options.size||15,h=!!a.options.horizFirst,k=a.duration?a.duration/2:c.fx.speeds._default/2;c.effects.save(b,j);b.show();var e=c.effects.createWrapper(b).css({overflow:"hidden"}),f=d=="show"!=h,l=f?["width","height"]:["height","width"];f=f?[e.width(),e.height()]:[e.height(),e.width()];var i=/([0-9]+)%/.exec(g);if(i)g=parseInt(i[1], +10)/100*f[d=="hide"?0:1];if(d=="show")e.css(h?{height:0,width:g}:{height:g,width:0});h={};i={};h[l[0]]=d=="show"?f[0]:g;i[l[1]]=d=="show"?f[1]:0;e.animate(h,k,a.options.easing).animate(i,k,a.options.easing,function(){d=="hide"&&b.hide();c.effects.restore(b,j);c.effects.removeWrapper(b);a.callback&&a.callback.apply(b[0],arguments);b.dequeue()})})}})(jQuery); +;/* + * jQuery UI Effects Highlight 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Highlight + * + * Depends: + * jquery.effects.core.js + */ +(function(b){b.effects.highlight=function(c){return this.queue(function(){var a=b(this),e=["backgroundImage","backgroundColor","opacity"],d=b.effects.setMode(a,c.options.mode||"show"),f={backgroundColor:a.css("backgroundColor")};if(d=="hide")f.opacity=0;b.effects.save(a,e);a.show().css({backgroundImage:"none",backgroundColor:c.options.color||"#ffff99"}).animate(f,{queue:false,duration:c.duration,easing:c.options.easing,complete:function(){d=="hide"&&a.hide();b.effects.restore(a,e);d=="show"&&!b.support.opacity&& +this.style.removeAttribute("filter");c.callback&&c.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery); +;/* + * jQuery UI Effects Pulsate 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Pulsate + * + * Depends: + * jquery.effects.core.js + */ +(function(d){d.effects.pulsate=function(a){return this.queue(function(){var b=d(this),c=d.effects.setMode(b,a.options.mode||"show");times=(a.options.times||5)*2-1;duration=a.duration?a.duration/2:d.fx.speeds._default/2;isVisible=b.is(":visible");animateTo=0;if(!isVisible){b.css("opacity",0).show();animateTo=1}if(c=="hide"&&isVisible||c=="show"&&!isVisible)times--;for(c=0;c<times;c++){b.animate({opacity:animateTo},duration,a.options.easing);animateTo=(animateTo+1)%2}b.animate({opacity:animateTo},duration, +a.options.easing,function(){animateTo==0&&b.hide();a.callback&&a.callback.apply(this,arguments)});b.queue("fx",function(){b.dequeue()}).dequeue()})}})(jQuery); +;/* + * jQuery UI Effects Scale 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Scale + * + * Depends: + * jquery.effects.core.js + */ +(function(c){c.effects.puff=function(b){return this.queue(function(){var a=c(this),e=c.effects.setMode(a,b.options.mode||"hide"),g=parseInt(b.options.percent,10)||150,h=g/100,i={height:a.height(),width:a.width()};c.extend(b.options,{fade:true,mode:e,percent:e=="hide"?g:100,from:e=="hide"?i:{height:i.height*h,width:i.width*h}});a.effect("scale",b.options,b.duration,b.callback);a.dequeue()})};c.effects.scale=function(b){return this.queue(function(){var a=c(this),e=c.extend(true,{},b.options),g=c.effects.setMode(a, +b.options.mode||"effect"),h=parseInt(b.options.percent,10)||(parseInt(b.options.percent,10)==0?0:g=="hide"?0:100),i=b.options.direction||"both",f=b.options.origin;if(g!="effect"){e.origin=f||["middle","center"];e.restore=true}f={height:a.height(),width:a.width()};a.from=b.options.from||(g=="show"?{height:0,width:0}:f);h={y:i!="horizontal"?h/100:1,x:i!="vertical"?h/100:1};a.to={height:f.height*h.y,width:f.width*h.x};if(b.options.fade){if(g=="show"){a.from.opacity=0;a.to.opacity=1}if(g=="hide"){a.from.opacity= +1;a.to.opacity=0}}e.from=a.from;e.to=a.to;e.mode=g;a.effect("size",e,b.duration,b.callback);a.dequeue()})};c.effects.size=function(b){return this.queue(function(){var a=c(this),e=["position","top","bottom","left","right","width","height","overflow","opacity"],g=["position","top","bottom","left","right","overflow","opacity"],h=["width","height","overflow"],i=["fontSize"],f=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],k=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"], +p=c.effects.setMode(a,b.options.mode||"effect"),n=b.options.restore||false,m=b.options.scale||"both",l=b.options.origin,j={height:a.height(),width:a.width()};a.from=b.options.from||j;a.to=b.options.to||j;if(l){l=c.effects.getBaseline(l,j);a.from.top=(j.height-a.from.height)*l.y;a.from.left=(j.width-a.from.width)*l.x;a.to.top=(j.height-a.to.height)*l.y;a.to.left=(j.width-a.to.width)*l.x}var d={from:{y:a.from.height/j.height,x:a.from.width/j.width},to:{y:a.to.height/j.height,x:a.to.width/j.width}}; +if(m=="box"||m=="both"){if(d.from.y!=d.to.y){e=e.concat(f);a.from=c.effects.setTransition(a,f,d.from.y,a.from);a.to=c.effects.setTransition(a,f,d.to.y,a.to)}if(d.from.x!=d.to.x){e=e.concat(k);a.from=c.effects.setTransition(a,k,d.from.x,a.from);a.to=c.effects.setTransition(a,k,d.to.x,a.to)}}if(m=="content"||m=="both")if(d.from.y!=d.to.y){e=e.concat(i);a.from=c.effects.setTransition(a,i,d.from.y,a.from);a.to=c.effects.setTransition(a,i,d.to.y,a.to)}c.effects.save(a,n?e:g);a.show();c.effects.createWrapper(a); +a.css("overflow","hidden").css(a.from);if(m=="content"||m=="both"){f=f.concat(["marginTop","marginBottom"]).concat(i);k=k.concat(["marginLeft","marginRight"]);h=e.concat(f).concat(k);a.find("*[width]").each(function(){child=c(this);n&&c.effects.save(child,h);var o={height:child.height(),width:child.width()};child.from={height:o.height*d.from.y,width:o.width*d.from.x};child.to={height:o.height*d.to.y,width:o.width*d.to.x};if(d.from.y!=d.to.y){child.from=c.effects.setTransition(child,f,d.from.y,child.from); +child.to=c.effects.setTransition(child,f,d.to.y,child.to)}if(d.from.x!=d.to.x){child.from=c.effects.setTransition(child,k,d.from.x,child.from);child.to=c.effects.setTransition(child,k,d.to.x,child.to)}child.css(child.from);child.animate(child.to,b.duration,b.options.easing,function(){n&&c.effects.restore(child,h)})})}a.animate(a.to,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){a.to.opacity===0&&a.css("opacity",a.from.opacity);p=="hide"&&a.hide();c.effects.restore(a, +n?e:g);c.effects.removeWrapper(a);b.callback&&b.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery); +;/* + * jQuery UI Effects Shake 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Shake + * + * Depends: + * jquery.effects.core.js + */ +(function(d){d.effects.shake=function(a){return this.queue(function(){var b=d(this),j=["position","top","bottom","left","right"];d.effects.setMode(b,a.options.mode||"effect");var c=a.options.direction||"left",e=a.options.distance||20,l=a.options.times||3,f=a.duration||a.options.duration||140;d.effects.save(b,j);b.show();d.effects.createWrapper(b);var g=c=="up"||c=="down"?"top":"left",h=c=="up"||c=="left"?"pos":"neg";c={};var i={},k={};c[g]=(h=="pos"?"-=":"+=")+e;i[g]=(h=="pos"?"+=":"-=")+e*2;k[g]= +(h=="pos"?"-=":"+=")+e*2;b.animate(c,f,a.options.easing);for(e=1;e<l;e++)b.animate(i,f,a.options.easing).animate(k,f,a.options.easing);b.animate(i,f,a.options.easing).animate(c,f/2,a.options.easing,function(){d.effects.restore(b,j);d.effects.removeWrapper(b);a.callback&&a.callback.apply(this,arguments)});b.queue("fx",function(){b.dequeue()});b.dequeue()})}})(jQuery); +;/* + * jQuery UI Effects Slide 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Slide + * + * Depends: + * jquery.effects.core.js + */ +(function(c){c.effects.slide=function(d){return this.queue(function(){var a=c(this),h=["position","top","bottom","left","right"],f=c.effects.setMode(a,d.options.mode||"show"),b=d.options.direction||"left";c.effects.save(a,h);a.show();c.effects.createWrapper(a).css({overflow:"hidden"});var g=b=="up"||b=="down"?"top":"left";b=b=="up"||b=="left"?"pos":"neg";var e=d.options.distance||(g=="top"?a.outerHeight({margin:true}):a.outerWidth({margin:true}));if(f=="show")a.css(g,b=="pos"?isNaN(e)?"-"+e:-e:e); +var i={};i[g]=(f=="show"?b=="pos"?"+=":"-=":b=="pos"?"-=":"+=")+e;a.animate(i,{queue:false,duration:d.duration,easing:d.options.easing,complete:function(){f=="hide"&&a.hide();c.effects.restore(a,h);c.effects.removeWrapper(a);d.callback&&d.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery); +;/* + * jQuery UI Effects Transfer 1.8.10 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Transfer + * + * Depends: + * jquery.effects.core.js + */ +(function(e){e.effects.transfer=function(a){return this.queue(function(){var b=e(this),c=e(a.options.to),d=c.offset();c={top:d.top,left:d.left,height:c.innerHeight(),width:c.innerWidth()};d=b.offset();var f=e('<div class="ui-effects-transfer"></div>').appendTo(document.body).addClass(a.options.className).css({top:d.top,left:d.left,height:b.innerHeight(),width:b.innerWidth(),position:"absolute"}).animate(c,a.duration,a.options.easing,function(){f.remove();a.callback&&a.callback.apply(b[0],arguments); +b.dequeue()})})}})(jQuery); +; \ No newline at end of file diff --git a/js/js.js b/js/js.js new file mode 100644 index 0000000000000000000000000000000000000000..a6765ec62db90609e2923e5db794d580992a76c5 --- /dev/null +++ b/js/js.js @@ -0,0 +1,26 @@ +$(document).ready(function() { + // Hide the MySQL config div if needed : + if(!$('#mysql').is(':checked') && $('#hasSQLite').val()=='true') { + $('#use_mysql').hide(); + } + + $('#datadirField').hide(250); + if($('#hasSQLite').val()=='true'){ + $('#databaseField').hide(250); + } + + $('#sqlite').click(function() { + $('#use_mysql').slideUp(250); + }); + + $('#mysql').click(function() { + $('#use_mysql').slideDown(250); + }); + + $('#showAdvanced').click(function() { + $('#datadirField').slideToggle(250); + if($('#hasSQLite').val()=='true'){ + $('#databaseField').slideToggle(250); + } + }); +}); diff --git a/js/lib_ajax.js b/js/lib_ajax.js deleted file mode 100644 index 9d282e741b2c59849c95d1d5412e3e72006590bd..0000000000000000000000000000000000000000 --- a/js/lib_ajax.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* ownCloud - ajax frontend -* -* @author Robin Appelman -* @copyright 2010 Robin Appelman icewind1991@gmail.com -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either -* version 3 of the License, or any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. -* -*/ - -//The callBack object provides an easy way to pass a member of an object as callback parameter and makes sure that the 'this' is always set correctly when called. -//bindScope provides a much cleaner sollution but we keep this one for compatibility and instead implement is with bindScope -callBack=function(func,obj){ - var newFunction=func.bindScope(obj); - callBack.callBacks[this.id]=newFunction; -} - -callBack.callBacks=Array(); - -callBack.call=function(id){ - callback=callBack.callBacks[id]; - var args=[]; - for (var m = 1; m < arguments.length; m++){ - args.push(arguments[m]); - } - if(callback){ - return callback.apply(null,args); - } -} - -//provide a simple way to add things to the onload -OC_onload=new Object(); - -OC_onload.items=new Array(); -OC_onload.itemsPriority=new Array(); -OC_onload.add=function(callback,priority){ - if(priority){ - OC_onload.itemsPriority[OC_onload.items.length]=callback; - }else{ - OC_onload.items[OC_onload.items.length]=callback; - } -} -OC_onload.run=function(){ - for(index in OC_onload.itemsPriority){ - if(OC_onload.itemsPriority[index].call){ - OC_onload.itemsPriority[index].call(); - } - } - for(index in OC_onload.items){ - if(OC_onload.items[index]&&OC_onload.items[index].call){ - OC_onload.items[index].call(); - } - } -} - -//implement Node.prototype under IE -if(typeof Node=='undefined'){ - Node=function(){}; - Node.prototype=new Object(); - - tmpObj=new Object(); - tmpObj.prototype=document.createElement; - document.createElementNative=document.createElement; - tmpObj=null; - - document.createElement=function(tagName){ -// alert(tagName); - node=document.createElementNative(tagName); - var proto=new Node() - var name; - for(name in proto){ - node[name]=proto[name]; - } - return node; - } - - addNodePrototype=function(node){ - if(!node){ - node=document.getElementsByTagName('body'); - node=node.item(0) - } - if(node.nodeType==1){ - var proto=new Node() - for(name in proto){ - node[name]=proto[name]; - } - if(node.hasChildNodes){ - var childs=node.childNodes; - for(var i=0;i<childs.length;i++){ - addNodePrototype(childs[i]); - } - } - } - } - OC_onload.add(new function(){addNodePrototype(document.documentElement);}); - OC_onload.add(addNodePrototype,true); -} - -function getStyle(x,styleProp) -{ - if (x.currentStyle){ - var y = x.currentStyle[styleProp]; - }else if (window.getComputedStyle){ - var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp); - } - return y; -} - -Node.prototype.getStyle=function(styleProp){ - return getStyle(this,styleProp) -} - -Node.prototype.clearNode=function(){ - if (this.hasChildNodes() ){ - while(this.childNodes.length>= 1){ - this.removeChild(this.firstChild); - } - } -} - -setDebug=function(text){ - node=document.getElementById('debug'); - if(node){ - node.clearNode(); - node.appendChild(document.createTextNode(text)); - } -} - -arrayMerge=function(array1,array2){ - var array=Array(); - for(i in array1){ - array[i]=array1[i]; - } - for(i in array2){ - array[i]=array2[i]; - } - return array; -} - -if(!Math.sign){ - Math.sign=function(x){ - return x/Math.abs(x); - } -} - -if(!Node.prototype.clearNode){ - Node.prototype.clearNode=function(){ - if(this.hasChildNodes()){ - while(this.childNodes.length >=1){ - this.removeChild(this.firstChild); - } - } - } -} - -getTimeString=function(){ - var date=new Date(); - var months=new Array(12); - months[0]="Jan"; - months[1]="Feb"; - months[2]="Mar"; - months[3]="Apr"; - months[4]="May"; - months[5]="Jun"; - months[6]="Jul"; - months[7]="Aug"; - months[8]="Sep"; - months[9]="Oct"; - months[10]="Nov"; - months[11]="Dec"; - return date.getDate()+' '+months[date.getMonth()]+' '+date.getFullYear()+' '+date.getHours()+':'+date.getMinutes(); -} - -loadScript=function(url){//dynamicly load javascript files - url=WEBROOT+'/'+url; - var script=document.createElement('script'); - script.setAttribute('type','text/javascript'); - script.setAttribute('src',url); - body=document.getElementsByTagName('body').item(0); - body.appendChild(script); -} - -Function.prototype.bindScope=function(obj){ - var o=obj; - var fn=this; - return function(){ - return fn.apply(o,arguments); - } -} - -Function.prototype.bind=function(){ - var args = []; - var fn=this; - for (var n = 0; n < arguments.length; n++){ - args.push(arguments[n]); - } - return function (){ - var myargs = []; - for (var m = 0; m < arguments.length; m++){ - myargs.push(arguments[m]); - } - return fn.apply(this, args.concat(myargs)); - }; -} - -Array.prototype.foreach=function(func,that){ - if (!func) return; - that=that||this; - var returns=[]; - for(var i=0;i<this.length;i++){ - returns.push(func.call(that,this[i])); - } - return returns; -} - -Array.prototype.where = function(func,that) { - var found = []; - that=that||this; - for(var i = 0, l = this.length; i < l; ++i) { - var item = this[i]; - if(func.call(that,item)){ - found.push(item); - } - } - return found; -}; \ No newline at end of file diff --git a/js/lib_api.js b/js/lib_api.js deleted file mode 100644 index d1779291cabbb1002c0e9f748ad912a51908553c..0000000000000000000000000000000000000000 --- a/js/lib_api.js +++ /dev/null @@ -1,34 +0,0 @@ -/** -* ownCloud - ajax frontend -* -* @author Robin Appelman -* @copyright 2010 Robin Appelman icewind1991@gmail.com -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either -* version 3 of the License, or any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. -* -*/ - -OC_API=new Object(); - -OC_API.run=function(action,params,callback,callbackparams){ - var xmlloader=new OCXMLLoader(); - xmlloader.setCallBack(callback); - xmlloader.method="POST"; - var paramString='action='+action; - for(name in params){ - paramString+='&'+name+'='+encodeURIComponent(params[name]); - } - xmlloader.arg=callbackparams; - xmlloader.load('files/api.php',paramString); -} \ No newline at end of file diff --git a/js/lib_drag.js b/js/lib_drag.js deleted file mode 100644 index 600b5b3882be5b761f765e42b7b85016aebad64c..0000000000000000000000000000000000000000 --- a/js/lib_drag.js +++ /dev/null @@ -1,348 +0,0 @@ -/** -* Javascript Drag&Drop - Modified for ownCloud -* -* @author Robin Appelman -* @copyright 2010 Robin Appelman icewind1991@gmail.com -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either -* version 3 of the License, or any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. -* -*/ - -position=function(x,y){ - if(x)this.x=x; - if(y)this.y=y; - return this; -} -position.prototype={ - x:0, - y:0, - add:function(pos2){ - return new position(this.x+pos2.x,this.y+pos2.y); - }, - substract:function(pos2){ - return new position(this.x-pos2.x,this.y-pos2.y); - },toString:function(){ - return 'x:'+this.x+',y:'+this.y; - },inside:function(pos2){ - return Math.abs(this.x)<Math.abs(pos2.x) && Math.abs(this.y)<Math.abs(pos2.y) && Math.sign(this.x)==Math.sign(pos2.x) && Math.sign(this.y)==Math.sign(pos2.y); - },outside:function(pos2){ - return !this.inside(pos2); - } -} - -Node.prototype.drag=new Object -/** - * is the node dragable - */ -Node.prototype.drag.dragable=false; -/** - * Are we currently dragging the node - */ -Node.prototype.drag.active=false; -/** - * Create a clone to drag around - */ -Node.prototype.drag.clone=true; -/** - * The node we (visually drag around) - */ -Node.prototype.drag.node=false; -/** - * can we drop nodes on this - */ -Node.prototype.drag.isDropTarget=false; -/** - * our current drop target - */ -Node.prototype.drag.dropTarget=null; -/** - * can we drop this node now - */ -Node.prototype.drag.dropable=false; -/** - * function called when we are being dropped on a node - * @return bool - */ -Node.prototype.drag.onDrop=function(node){}; -/** - * function called when an node is dropped on us - * @param Node node - * @return bool - */ -Node.prototype.drag.onDropOn=function(node){}; -/** - * where did we start the drag - */ -Node.prototype.drag.startPosition=new position(); -/** - * where are we now - */ -Node.prototype.drag.position=new position(); -/** - * how big are we - */ -Node.prototype.drag.size=new position(); -/** - * where is the mouse - */ -Node.prototype.drag.mousePosition=new position(); -/** - * where is the mouse relative to our node - */ -Node.prototype.drag.mouseOffset=new position(); - -document.drag=new Object(); -/** - * is there currently something dragged - */ -document.drag.active=false; -/** - * what is currently being dragged - */ -document.drag.node=null; -document.drag.dropTargets=Array(); -/** - * start the dragging. (onmousedown) - * @param Event event - */ -Node.prototype.drag.start=function(event){ - if(!event)var event=window.event; - if(!this.drag.active && this.drag.dragable){ - document.drag.active=true; - document.drag.node=this; - this.drag.active=true; - this.drag.position=this.getPosition(); - this.drag.startPosition=this.getPosition(); - this.drag.mousePosition=getMousePosition(event); - this.drag.mouseOffset=this.drag.mousePosition.substract(this.drag.position); - } -} - -/** - * update the dragging. (onmousemove) - * @param Event event - */ -Node.prototype.drag.update=function(event){ - if(!event)var event=window.event; - if(this.drag.active && this.drag.dragable){ - this.drag.mousePosition=getMousePosition(event); - this.drag.position=this.drag.mousePosition.substract(this.drag.mouseOffset); - if(this.drag.clone && !this.drag.node){ - this.drag.node=this.cloneNode(true); - this.drag.node.className='dragClone'; - if(this.drag.node.hasAttribute('id')){ - this.drag.node.setAttribute('id',this.drag.node.getAttribute('id')+'_dragClone'); - } - document.getElementsByTagName('body').item(0).appendChild(this.drag.node); - }else if(!this.drag.node){ - this.drag.node=this; - this.drag.node.style.position='absolute'; - } - this.drag.node.style.left=this.drag.position.x+'px'; - this.drag.node.style.top=this.drag.position.y+'px'; - } - return true; -} - -/** - * stop the dragging/drop. (onmouseup) - * @param Event event - * @return bool - */ -Node.prototype.drag.stop=function(event){ - if(!event)var event=window.event; - if(this.drag.active && this.drag.dragable){ - this.drag.active=false; - this.drag.mousePosition=getMousePosition(event); - this.drag.position=this.drag.mousePosition.substract(this.drag.mouseOffset); - if(this.drag.node){ - this.drag.node.style.left=this.drag.position.x; - this.drag.node.style.top=this.drag.position.y; - } - var target; - this.drag.dropTarget=null; - this.drag.dropable=false; - for(var i=0;i<document.drag.dropTargets.length;i++){ - target=document.drag.dropTargets[i]; - target.drag.checkDropTarget.call(target,event); - } - if(this.drag.dropable && this.drag.dropTarget){ - if(this.drag.onDrop){ - this.drag.onDrop.call(this,event,this.drag.dropTarget); - this.triggerEvent.call(this,'ondrop',event,this.drag.dropTarget); - } - if(this.drag.dropTarget.drag.onDropOn){ - this.drag.dropTarget.drag.onDropOn.call(this.drag.dropTarget,event,this); - this.drag.dropTarget.triggerEvent.call(this.drag.dropTarget,'ondropon',event,this); - } - } - if(this.drag.clone && this.drag.node){ - this.drag.node.parentNode.removeChild(this.drag.node); - this.drag.node=null; - } - document.drag.active=false; - document.drag.node=null; - } -} - -/** - * is there currently something being dragged over us - * @param Event event - */ -Node.prototype.drag.checkDropTarget=function(event){ - if(this.drag.isDropTarget & document.drag.active){ - mousePos=getMousePosition(event); - this.drag.position=this.getPosition(); - this.drag.size=this.getSize(true); - var offSet=mousePos.substract(this.drag.position); - if(offSet.inside(this.drag.size)){ - document.drag.node.drag.dropTarget=this; - document.drag.node.drag.dropable=true; - setDebug('ontarget'); - } - } -} - -/** - * called when the mouse is leaving a drop target - * @param Event event - */ -Node.prototype.drag.leaveDropTarget=function(event){ - if(this.drag.isDropTarget & document.drag.active){ - document.drag.node.drag.dropTarget=null; - document.drag.node.drag.dropable=false; - setDebug('offtarget'); - } -} -/** - * initiate the node as drop target - */ -Node.prototype.drag.initDropTarget=function(){ - this.drag.isDropTarget=true; - document.drag.dropTargets.push(this); -} -Node.prototype.makeDropTarget=function(){ - this.drag.initDropTarget.call(this); -} - -/** - * initiate the node as draggable - */ -Node.prototype.drag.init=function(){ - this.drag.dragable=true; - this.drag.size.x=this.getStyle('width'); - this.drag.size.y=this.getStyle('height'); - this.addEvent('onmousedown',new callBack(this.drag.start,this)); -} -Node.prototype.makeDraggable=function(){ - this.drag.init.call(this); -} - -/** - * update the dragging. (onmousemove) - * @param Event event - */ -document.drag.update=function(event){ - var target; - if(document.drag.active && document.drag.node){ - document.drag.node.drag.update.call(document.drag.node,event); - } -} - -/** - * update the dragging. (onmousemove) - * @param Event event - */ -document.drag.stop=function(event){ - if(document.drag.active && document.drag.node){ - document.drag.node.drag.stop.call(document.drag.node,event); - } -} -document.events.add(document,'onmousemove',document.drag.update); -document.events.add(document,'onmouseup',document.drag.stop); - -function getMousePosition(event){ - var pos=new position(); - if(!event)var event = window.event; - if(event.pageX||event.pageY){ - pos.x=event.pageX; - pos.y=event.pageY; - } - else if(event.clientX||event.clientY){ - pos.x=event.clientX+document.body.scrollLeft+document.documentElement.scrollLeft; - pos.y=event.clientY+document.body.scrollTop+document.documentElement.scrollTop; - } - return pos; -} - -/** - * get our position - **/ -Node.prototype.getPosition=function(){ - var pos=new position(); - element=this; - do{ - pos.y+=element.offsetTop; - pos.x+=element.offsetLeft; - }while(element=element.offsetParent); - return pos; -} - -/** - * get our size -* @param bool full (also include padding and border) - **/ -Node.prototype.getSize=function(full){ - var pos=new position(); - pos.y= parseInt(this.getStyle('height')); - pos.x= parseInt(this.getStyle('width')); - if(full){ - var extraY=['border-size','padding-top','padding-bottom','border-size']; - var extraX=['border-size','padding-left','padding-right','border-size']; - var tmp; - for(var i=0;i<extraY.length;i++){ - tmp=parseInt(this.getStyle(extraY[i])); - if(tmp){ - pos.y+=tmp; - } - } - for(var i=0;i<extraX.length;i++){ - tmp=parseInt(this.getStyle(extraX[i])); - if(tmp){ - pos.x+=tmp; - } - } - } - return pos; -} - -function mouseTest(event){ - var pos=getMousePosition(event); - setDebug(pos.toString()); -} - -function testDrag(){ - var node=document.getElementById('debug'); -// document.addEvent('onclick',getOffSet,[node]); - node.makeDropTarget(); -} - -function getOffSet(node,event){ - var nodePos=node.getPosition(); - var mousePos=getMousePosition(event); - return mousePos.substract(nodePos); -} - - -// OC_onload.add(testDrag); \ No newline at end of file diff --git a/js/lib_event.js b/js/lib_event.js deleted file mode 100644 index fe48f6dbc8b0c34735de90dfde436b4b28adf98c..0000000000000000000000000000000000000000 --- a/js/lib_event.js +++ /dev/null @@ -1,48 +0,0 @@ -/*event handling -usage: document.events.add(node,type,function,arguments); - or: node.addEvent(type,function,arguments); -*/ - -document.events=new Object; -document.events.functions=Array(); -document.events.args=Array(); - -document.events.add=function(element,type,func,args){ - if(args){ - if(!args.push){ - args=[args]; - } - } - args=args||[]; - if (type && element){ - args.foreach(function(argument){ - func.bind(argument); - }) - if(element.addEventListener){ - if(type.substr(0,2)=='on'){ - type=type.substr(2); - } - element.addEventListener(type,func,false); - }else if(element.attachEvent){ - element.attachEvent(type,func); - } - return func; - } -} -document.events.remove=function(element,type,func){ - if(element.removeEventListener){ - if(type.substr(0,2)=='on'){ - type=type.substr(2); - } - element.removeEventListener(type,func,false); - }else if(element.detachEvent){ - element.detachEvent(type,func) - } -} - -Node.prototype.addEvent=function(type,func,args){ - return document.events.add(this,type,func,args); -} -Node.prototype.removeEvent=function(type,func){ - document.events.remove(this,type,func); -} \ No newline at end of file diff --git a/js/lib_files.js b/js/lib_files.js deleted file mode 100644 index a1cf1b6c027265db4c5b4324471899316ae5c4d6..0000000000000000000000000000000000000000 --- a/js/lib_files.js +++ /dev/null @@ -1,414 +0,0 @@ -/** -* ownCloud - ajax frontend -* -* @author Robin Appelman -* @copyright 2010 Robin Appelman icewind1991@gmail.com -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either -* version 3 of the License, or any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. -* -*/ - -OC_FILES=new Object(); - -OC_FILES.cache=new Object(); - -OC_FILES.cache.files=Array(); -OC_FILES.cache.incomplete=Array(); -OC_FILES.cache.actions=new Object(); - -OC_FILES.cache.actions.move=Array(); -OC_FILES.cache.actions.rename=Array(); -OC_FILES.cache.actions['new']=Array(); -OC_FILES.cache.actions['delete']=Array(); -OC_FILES.cache.actions.upload=Array(); - -OC_FILES.cache.refresh=function(){ - OC_FILES.getdirectorycontent(OC_FILES.dir,false,true); -} - -OC_FILES.xmlloader=new OCXMLLoader(); - -OC_FILES.getdirectorycontent_parse=function(req){ - var files=new Array(); - var json=eval('('+req.responseText+')'); - OC_FILES.cache.files=Array(); - if(json){ - for(var name in json){ - if(name!='__max_upload'){ - var file=new Array(); - var attributes=Array('size','name','type','directory','date','mime','writable','readable'); - for(var i in attributes){ - var attributeName=attributes[i]; - file[attributeName]=json[name][attributeName]; - } - files[file.name]=file; - } - } - OC_FILES.cache.files=files; - if(OC_FILES.cache.incomplete[OC_FILES.dir]){ - files=arrayMerge(files,OC_FILES.cache.incomplete[OC_FILES.dir]); - } - files['max_upload']=json['__max_upload']; - if(OC_FILES.getdirectorycontent_callback){ - OC_FILES.getdirectorycontent_callback(files); - } - } -} - -OC_FILES.getdirectorycontent=function(dir,callback,refresh){ - if(refresh || OC_FILES.dir!=dir){ - OC_FILES.dir=dir; - if(callback){ - OC_FILES.getdirectorycontent_callback=callback; - } - OC_FILES.xmlloader.setCallBack(OC_FILES.getdirectorycontent_parse); -// OC_FILES.xmlloader.load('files/get_files.php?dir='+encodeURIComponent(dir)); - OC_FILES.xmlloader.load('files/api.php?action=getfiles&dir='+encodeURIComponent(dir)); - }else{ - var files=OC_FILES.cache.files - if(OC_FILES.cache.incomplete[OC_FILES.dir]){ - files=arrayMerge(files,OC_FILES.cache.incomplete[OC_FILES.dir]); - } - callback(files); - } -} - -OC_FILES.dir=''; - -OC_FILES.get=function(dir,file){ - window.location='files/api.php?action=get&dir='+encodeURIComponent(dir)+'&file='+encodeURIComponent(file); -} - -OC_FILES.upload=function(iframeId){ - var dir=OC_FILES.dir; - var file=new Object; - var fileSelector=document.getElementById('fileSelector'); - var max_upload=document.getElementById('max_upload').value; - var name=false; - if(fileSelector.files && fileSelector.files[0].fileName){ - name=fileSelector.files[0].fileName; - } - if(fileSelector.files && fileSelector.files[0].fileSize){ - var size=fileSelector.files[0].fileSize; - if(size>max_upload){ - new OCNotification('File too large',10000) - return false; - } - } - var mime=''; - if(fileSelector.files && fileSelector.files[0].type){ - var mime=fileSelector.files[0].type; - } - file.dir=OC_FILES.dir; - file.name=name; - file.type='file'; - file.size=size; - file.iframeId=iframeId; - if(!OC_FILES.cache.incomplete[dir]){ - OC_FILES.cache.incomplete[dir]=Array(); - } - OC_FILES.cache.incomplete[dir][name]=Array(); - OC_FILES.cache.incomplete[dir][name]['name']=name; - OC_FILES.cache.incomplete[dir][name]['type']='incomplete'; - OC_FILES.cache.incomplete[dir][name]['size']=size; - OC_FILES.cache.incomplete[dir][name]['mime']=mime; - OC_FILES.uploadIFrames[iframeId].file=file; - OC_FILES.uploadIFrames[iframeId].addEvent('onload',OC_FILES.upload_callback.bindScope(OC_FILES.uploadIFrames[iframeId])); - OC_FILES.browser.files.add(name,'incomplete',size,null,mime); - OC_FILES.uploadForm.submit(); - if(OC_FILES.uploadForm.parentElement){ - OC_FILES.uploadForm.className='hidden'; - OC_FILES.uploadForm.parentNode.removeChild(OC_FILES.uploadForm); - var body=document.getElementsByTagName('body').item(0); - body.appendChild(OC_FILES.uploadForm); - OC_FILES.uploadIFrames[iframeId].uploadForm=OC_FILES.uploadForm; - OC_FILES.browser.showuploader(OC_FILES.dir,OC_FILES.uploadIFrames[iframeId].uploadParent,OC_FILES.maxUpload) - } -} - -OC_FILES.upload_callback=function(iframeId){ - var file=this.file; - if(OC_FILES.cache.incomplete[file.dir][file.name]){ - OC_FILES.browser.files.remove(file.name); - OC_FILES.cache.files[file.name]=OC_FILES.cache.incomplete[file.dir][file.name] - delete OC_FILES.cache.incomplete[file.dir][file.name]; - OC_FILES.cache.files[file.name]['type']=file.type; - OC_FILES.cache.files[file.name]['writable']=true; - OC_FILES.cache.files[file.name]['readable']=true; - this.uploadForm.parentNode.removeChild(this.uploadForm); - this.parentNode.removeChild(this); - OC_FILES.uploadIFrames[file.iframeId]=null; - if(file.name){ - OC_FILES.browser.show(file.dir); - }else{ - OC_FILES.browser.show(file.dir,true);//if the data from the file isn't correct, force a reload of the cache - } - }else{ - OC_FILES.browser.show(OC_FILES.dir); - } -} - -OC_FILES.rename=function(dir,file,event){ - if(event && event.preventDefault){ - event.preventDefault(); - } - var item=document.getElementById(file+'_newname'); - var newname=item.value; - if(newname==''){ - return false; - }else if(file==newname){ - OC_FILES.browser.show(OC_FILES.dir); - return false; - } - arg=new Object; - arg.oldname=file; - arg.newname=newname; - arg.dir=dir; - arg.type=OC_FILES.cache.files[file]['type']; - OC_API.run('rename',{dir:dir,file:file,newname:newname},OC_FILES.rename_callback,arg) - if(!OC_FILES.cache.incomplete[dir]){ - OC_FILES.cache.incomplete[dir]=Array(); - } - OC_FILES.cache.files[file]['type']='incomplete'; - OC_FILES.cache.incomplete[dir][newname]=OC_FILES.cache.files[file]; - OC_FILES.cache.incomplete[dir][newname]['name']=newname; - OC_FILES.browser.files.remove(file); - OC_FILES.browser.files.add(newname,'incomplete'); - return false; -} - - -OC_FILES.rename_callback=function(req,file){ - delete OC_FILES.cache.files[file.oldname] - OC_FILES.cache.files[file.newname]=OC_FILES.cache.incomplete[file.dir][file.newname]; - delete OC_FILES.cache.incomplete[file.dir][file.newname]; - OC_FILES.browser.files.remove(file.newname); - OC_FILES.cache.files[file.newname]['type']=file.type; - OC_FILES.browser.show(OC_FILES.dir); -} - -OC_FILES.remove=function(dir,file,force){ - remove=force||confirm('Delete file \''+file+'\'?'); - if(remove){ - OC_API.run('delete',{dir:dir,file:file},OC_FILES.remove_callback,file) - OC_FILES.browser.files.remove(file); - delete OC_FILES.cache.files[file]; - } -} - -OC_FILES.remove_callback=function(req,name){ -// OC_FILES.browser.files.remove(name); -// OC_FILES.browser.show(OC_FILES.dir); -} - -OC_FILES.getSelected=function(){ - var nodes=document.getElementsByName('fileSelector'); - var files=Array(); - for(var index=0;index<nodes.length;index++){ - if(nodes[index].checked){ - files[files.length]=nodes[index].value; - } - } - return files; -} - -OC_FILES.newFile=function(type,name,dir){ - arg=new Object; - arg.name=name; - arg.dir=dir; - if(OC_FILES.cache.files[name]){//check if the file already exists - alert(((type=='dir')?'folder ':'file ')+name+' already exists.'); - return; - } - arg.type=type; - OC_API.run('new',{dir:dir,name:name,type:type},OC_FILES.new_callback,arg) - if(!OC_FILES.cache.incomplete[dir]){ - OC_FILES.cache.incomplete[dir]=Array(); - } - OC_FILES.cache.incomplete[dir][name]=Array(); - OC_FILES.cache.incomplete[dir][name]['name']=name; - OC_FILES.cache.incomplete[dir][name]['type']='incomplete'; - OC_FILES.cache.incomplete[dir][name]['size']=0; - OC_FILES.browser.files.add(name,'incomplete'); -} - -OC_FILES.new_callback=function(req,file){ - OC_FILES.cache.files[file.name]=OC_FILES.cache.incomplete[file.dir][file.name]; - delete OC_FILES.cache.incomplete[file.dir][file.name]; - OC_FILES.cache.files[file.name]['type']=file.type; - OC_FILES.browser.files.remove(file.name); -// OC_FILES.browser.files.add(name); - OC_FILES.browser.show(OC_FILES.dir,true); -} - -OC_FILES.move=function(source,target,sourceDir,targetDir){ - if(sourceDir!=targetDir || source!=target){ - if(!OC_FILES.cache.incomplete[sourceDir]){ - OC_FILES.cache.incomplete[sourceDir]=Array(); - } - if(!OC_FILES.cache.incomplete[targetDir]){ - OC_FILES.cache.incomplete[targetDir]=Array(); - } - if(!OC_FILES.cache.incomplete[targetDir+'/'+target]){ - OC_FILES.cache.incomplete[targetDir+'/'+target]=Array(); - } - arg=new Object; - arg.source=source; - arg.target=target; - arg.sourceDir=sourceDir; - arg.targetDir=targetDir; - arg.type=OC_FILES.cache.files[source]['type']; - OC_FILES.cache.files[source]['type']='incomplete'; - OC_FILES.cache.incomplete[targetDir+'/'+target][source]=OC_FILES.cache.files[source]; - OC_API.run('move',{sourcedir:sourceDir,source:source,targetdir:targetDir,target:target},OC_FILES.move_callback,arg); - } -} - -OC_FILES.move_callback=function(req,file){ - OC_FILES.cache.incomplete[file.targetDir+'/'+file.target][file.source]['type']=file.type; - delete OC_FILES.cache.files[file.source]; - OC_FILES.browser.show(OC_FILES.dir); -} - -OC_FILES.selectAll=function(){ - var value=document.getElementById('select_all').checked; - var nodes=document.getElementsByName('fileSelector'); - for(var index=0;index<nodes.length;index++){ - if(nodes[index].value){ - nodes[index].checked=value; - } - } -} - -OC_FILES.action_selected=function(){ - var dropdown=action=document.getElementById('selected_action'); - var action=dropdown.options[dropdown.selectedIndex].value; - if(OC_FILES.actions_selected[action] && OC_FILES.actions_selected[action].call){ - OC_FILES.actions_selected[action].call(OC_FILES); - } -} - -OC_FILES.actions_selected=new Object(); - -OC_FILES.actions_selected.download=function(){ - files=OC_FILES.getSelected(); - if(files.length==0){ - return false; - }else if(files.length>1){ - files=files.join(';'); - }else{ - files=files[0]; - } - OC_FILES.get(this.dir,files); -} - -OC_FILES.actions_selected['delete']=function(){ - files=OC_FILES.getSelected(); - remove=confirm('Delete files \''+files.join('\', \'')+'\'?'); - if(remove){ - for(index in files){ - OC_FILES.remove(OC_FILES.dir,files[index],true); - } - } -} - -OC_FILES.files=Array(); - -OC_FILES.file=function(dir,file,type,mime){ - if(file){ - this.type=type; - this.file=file; - this.dir=dir; - this.mime=mime; - if(mime){ - var mimeParts=mime.split('/'); - this.mime1=mimeParts[0]; - this.mime2=mimeParts[1]; - } - this.actions=new Object(); - if(file.lastIndexOf('.')){ - this.extention=file.substr(file.lastIndexOf('.')+1); - }else{ - this.extention; - } - for(index in OC_FILES.fileActions.all){ - if(OC_FILES.fileActions.all[index].call){ - this.actions[index]=OC_FILES.fileActions.all[index]; - } - } - if(OC_FILES.fileActions[this.type]){ - for(index in OC_FILES.fileActions[this.type]){ - if(OC_FILES.fileActions[this.type][index].call){ - this.actions[index]=OC_FILES.fileActions[this.type][index]; - } - } - } - if(OC_FILES.fileActions[this.mime1]){ - for(index in OC_FILES.fileActions[this.mime1]){ - if(OC_FILES.fileActions[this.mime1][index].call){ - this.actions[index]=OC_FILES.fileActions[this.mime1][index]; - } - } - } - if(OC_FILES.fileActions[this.mime]){ - for(index in OC_FILES.fileActions[this.mime]){ - if(OC_FILES.fileActions[this.mime][index].call){ - this.actions[index]=OC_FILES.fileActions[this.mime][index]; - } - } - } - } -} - -OC_FILES.file.prototype.showactions=function(){ - OC_FILES.browser.showactions(this.file); -} - -OC_FILES.file.prototype.hideactions=function(){ - OC_FILES.browser.showactions(this.file,true); -} - -OC_FILES.fileActions=new Object(); - -OC_FILES.fileActions.all=new Object(); - -OC_FILES.fileActions.all.remove=function(){ - OC_FILES.remove(this.dir,this.file); -} -OC_FILES.fileActions.all.rename=function(){ - OC_FILES.browser.show_rename(this.dir,this.file); -} -OC_FILES.fileActions.all.download=function(){ - OC_FILES.get(this.dir,this.file); -} -OC_FILES.fileActions.all['default']=OC_FILES.fileActions.all.download; - -OC_FILES.fileActions.dir=new Object() - -OC_FILES.fileActions.dir.open=function(){ - OC_FILES.browser.show(this.dir+'/'+this.file); -} -OC_FILES.fileActions.dir['default']=OC_FILES.fileActions.dir.open; - -OC_FILES.fileActions.dir.dropOn=function(file){ - OC_FILES.move(file.file,file.file,file.dir,this.dir+'/'+this.file); -} - -OC_FILES.fileActions.image=new Object() - -OC_FILES.fileActions.image.show=function(){ - OC_FILES.browser.showImage(this.dir,this.file); -} - -OC_FILES.fileActions.image['default']=OC_FILES.fileActions.image.show; diff --git a/js/lib_notification.js b/js/lib_notification.js deleted file mode 100644 index 7c19a04b58ecf487eee1dcf05d4815c9a0315f20..0000000000000000000000000000000000000000 --- a/js/lib_notification.js +++ /dev/null @@ -1,48 +0,0 @@ -/** - * StarLight - A client side webpage framework - * - * @package StarLight - * @author Icewind <icewind (at) derideal (dot) com> - * @copyright 2009 - * @license http://www.gnu.org/licenses/gpl.html GNU Public License - * @url http://blacklight.metalwarp.com/starlight - * @version 0.1 - */ - -OCNotification=function(text,time){ - this.text=text; - this.time=(time)?time:0; - this.notify(); -} - -OCNotification.prototype={ - notify:function(){ - this.holder=document.getElementById('OCNotificationHolder'); - if (!this.holder){ - this.holder=document.createElement('div'); - this.holder.className='OCNotificationHolder'; - this.holder.setAttribute('class','OCNotificationHolder'); - this.holder.setAttribute('id','OCNotificationHolder'); - document.getElementsByTagName('body').item(0).appendChild(this.holder); - } - this.notification=document.createElement('div'); - this.notification.className='OCNotification'; - this.notification.setAttribute('class','OCNotification'); - if (document.documentElement.innerHTML){ - this.notification.innerHTML=this.text; - }else{ - var text=document.createTextNode(this.text); - this.notification.appendChild(text); - } - this.holder.insertBefore(this.notification,this.holder.firstChild); - this.notification.addEvent('onclick',new callBack(this.removeNotification,this)); - if (this.time>0){ - this.timer = new OCTimer(this.removeNotification, this.time,false,this); - } - }, - removeNotification:function(){ - if(this.notification){ - this.holder.removeChild(this.notification); - } - } -} \ No newline at end of file diff --git a/js/lib_timer.js b/js/lib_timer.js deleted file mode 100644 index aadea90ba27ebb37ac1314968fa436032a1fcbb7..0000000000000000000000000000000000000000 --- a/js/lib_timer.js +++ /dev/null @@ -1,52 +0,0 @@ -/** - * StarLight - A client side webpage framework - * - * @package StarLight - * @author Icewind <icewind (at) derideal (dot) com> - * @copyright 2009 - * @license http://www.gnu.org/licenses/gpl.html GNU Public License - * @url http://blacklight.metalwarp.com/starlight - * @version 0.1 - */ -OCTimer=function(callback,time,repeat,object){ - this.object=(object)?object:false; - this.repeat=(!(repeat===undefined))?repeat:true; - this.callback=callback; - this.time=time; - this.timer=0; - this.number=OCTimer.count; - OCTimer.count++; - OCTimer.timers[this.number]=this; - if(this.time){ - this.start(); - } -} - -OCTimer.count=0; -OCTimer.timers=Array(); - -OCTimer.prototype={ - start:function(){ - this.running=true; - eval('var func=function(){OCTimer.timers['+this.number+'].run();};'); - if(this.repeat){ - this.timer = setInterval(func, this.time); - }else{ - this.timer = setTimeout(func, this.time); - } - }, - run:function(){ - if (!this.repeat){ - this.stop(); - } - if (this.object){ - this.callback.call(this.object); - }else{ - this.callback.call(); - } - }, - stop:function(){ - clearInterval(this.timer); - this.running=false; - } -} \ No newline at end of file diff --git a/js/lib_xmlloader.js b/js/lib_xmlloader.js deleted file mode 100644 index 819dfb6b0248db4c6961a499ead0645a553b8914..0000000000000000000000000000000000000000 --- a/js/lib_xmlloader.js +++ /dev/null @@ -1,154 +0,0 @@ -/** -* ownCloud - ajax frontend -* -* @author Robin Appelman -* @copyright 2010 Robin Appelman icewind1991@gmail.com -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either -* version 3 of the License, or any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. -* -*/ - -var READY_STATE_UNINITIALIZED=0; -var READY_STATE_LOADING=1; -var READY_STATE_LOADED=2; -var READY_STATE_INTERACTIVE=3; -var READY_STATE_COMPLETE=4; - -/** -* Class for loaded browser independant xml loading -*/ -OCXMLLoader=function(){ - this.errorCallBack=this.defaultError; -} - -OCXMLLoader.prototype={ - contentType:'', - method:'GET', - request:'', - callBack:null, - async:true, - arg:null, - - /** - * Loads an XML document - * @param string url - * @param string request - * @none - */ - load:function(url,request){ - request=(request)?request:""; - method=this.method; - contentType=(!this.contentType && method=="POST")?"application/x-www-form-urlencoded":this.contentType; - if(window.XMLHttpRequest){ - req=new XMLHttpRequest(); - }else if(window.XDomainRequest){ - req=new XDomainRequest(); - }else if(window.ActiveXObject){ - req=new ActiveXObject('Microsoft.XMLHTTP') - } - if (req){ - this.req=req; - try{ -// var loader=this; -// req.onreadystatechange=function(){ -// loader.onReadyState.call(loader,req) -// } - var callback=new callBack(this.onReadyState,this); - req.onreadystatechange=function(){eval('callBack.call('+callback.id+')');}; - req.open(method,url,this.async); - if (contentType){ - req.setRequestHeader("Content-Type",contentType); - } - if(method=="POST"){ - req.setRequestHeader("Content-length", request.length); - req.setRequestHeader("Connection", "close"); - } - req.send(request); - }catch (err){ - this.errorCallBack(req); - } - } - }, - onReadyState:function(){ - var ready=this.req.readyState; - if (ready==READY_STATE_COMPLETE){ - var HttpStatus=req.status; - if (HttpStatus==200 || HttpStatus==0){ - //alert("response: "+this.req.responseText); - this.callBack(this.req,this.arg); - }else{ - this.errorCallBack(this.req,this.arg); - } - } - }, - defaultError:function(req){ - alert("Error fetching data!" - +"\n\n<br/><br/>ReadyState: "+req.readyState - +"\n<br/>Status: "+req.status - +"\n<br/>Headers: "+req.getAllResponseHeaders() - +"\n<br/>File: "+req.url - +"\n<br/>Response: "+req.responseText); - }, - /** - * Sets the request method - * @param string method - * @none - */ - setMethod:function(method){ - this.method=method; - }, - /** - * Sets the content type - * @param string type - * @none - */ - setType:function(type){ - this.type=type; - }, - /** - * Sets the callback function - * @param function callBack - * @none - */ - setCallBack:function(callBack){ - this.callBack=callBack; - }, - /** - * Sets the error callback function - * @param function errorCallBack - * @none - */ - setErrorCallBack:function(errorCallBack){ - this.errorCallBack=errorCallBack; - } -} - -testClass=function(){ -} - -testClass.prototype={ - testFunc:function(){ - this.test="test"; - test=new OCXMLLoader(this); - test.setCallBack(this.callBack); - test.load(parseUri('%root%/data/sites/index.xml')); - }, - callBack:function(req){ - alert(this.test); - alert(req.responseText); - } -} -test=new testClass() -test.testFunc -// mainLoadStack.append(test.testFunc,test); diff --git a/lib/Group/backend.php b/lib/Group/backend.php new file mode 100644 index 0000000000000000000000000000000000000000..298cced7ff51a5ab148f3e4bac58839954456d71 --- /dev/null +++ b/lib/Group/backend.php @@ -0,0 +1,96 @@ +<?php + +/** +* ownCloud +* +* @author Frank Karlitschek +* @copyright 2010 Frank Karlitschek karlitschek@kde.org +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU AFFERO GENERAL PUBLIC LICENSE for more details. +* +* You should have received a copy of the GNU Affero General Public +* License along with this library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + + + +/** + * Abstract base class for user management + */ +abstract class OC_GROUP_BACKEND { + /** + * @brief Try to create a new group + * @param $gid The name of the group to create + * @returns true/false + * + * Trys to create a new group. If the group name already exists, false will + * be returned. + */ + public static function createGroup($gid){} + + /** + * @brief delete a group + * @param $gid gid of the group to delete + * @returns true/false + * + * Deletes a group and removes it from the group_user-table + */ + public static function removeGroup($gid){} + + /** + * @brief is user in group? + * @param $uid uid of the user + * @param $gid gid of the group + * @returns true/false + * + * Checks whether the user is member of a group or not. + */ + public static function inGroup($uid, $gid){} + + /** + * @brief Add a user to a group + * @param $uid Name of the user to add to group + * @param $gid Name of the group in which add the user + * @returns true/false + * + * Adds a user to a group. + */ + public static function addToGroup($uid, $gid){} + + /** + * @brief Removes a user from a group + * @param $uid Name of the user to remove from group + * @param $gid Name of the group from which remove the user + * @returns true/false + * + * removes the user from a group. + */ + public static function removeFromGroup($uid,$gid){} + + /** + * @brief Get all groups a user belongs to + * @param $uid Name of the user + * @returns array with group names + * + * This function fetches all groups a user belongs to. It does not check + * if the user exists at all. + */ + public static function getUserGroups($uid){} + + /** + * @brief get a list of all groups + * @returns array with group names + * + * Returns a list with all groups + */ + public static function getGroups(){} +} diff --git a/lib/Group/database.php b/lib/Group/database.php new file mode 100644 index 0000000000000000000000000000000000000000..6e508a4d47c2964370c3b1b3a3eb1a55e86fe3a7 --- /dev/null +++ b/lib/Group/database.php @@ -0,0 +1,179 @@ +<?php + +/** + * ownCloud + * + * @author Frank Karlitschek + * @copyright 2010 Frank Karlitschek karlitschek@kde.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ +/* + * + * The following SQL statement is just a help for developers and will not be + * executed! + * + * CREATE TABLE `groups` ( + * `gid` varchar(64) COLLATE utf8_unicode_ci NOT NULL, + * PRIMARY KEY (`gid`) + * ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + * + * CREATE TABLE `group_user` ( + * `gid` varchar(64) COLLATE utf8_unicode_ci NOT NULL, + * `uid` varchar(64) COLLATE utf8_unicode_ci NOT NULL + * ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + * + */ + +require_once( 'Group/backend.php' ); + +/** + * Class for group management in a SQL Database (e.g. MySQL, SQLite) + */ +class OC_GROUP_DATABASE extends OC_GROUP_BACKEND { + static private $userGroupCache=array(); + + /** + * @brief Try to create a new group + * @param $gid The name of the group to create + * @returns true/false + * + * Trys to create a new group. If the group name already exists, false will + * be returned. + */ + public static function createGroup( $gid ){ + // Check for existence + $query = OC_DB::prepare( "SELECT * FROM `*PREFIX*groups` WHERE gid = ?" ); + $result = $query->execute( array( $gid )); + + if( $result->numRows() > 0 ){ + // Can not add an existing group + return false; + } + else{ + // Add group and exit + $query = OC_DB::prepare( "INSERT INTO `*PREFIX*groups` ( `gid` ) VALUES( ? )" ); + $result = $query->execute( array( $gid )); + + return $result ? true : false; + } + } + + /** + * @brief delete a group + * @param $gid gid of the group to delete + * @returns true/false + * + * Deletes a group and removes it from the group_user-table + */ + public static function deleteGroup( $gid ){ + // Delete the group + $query = OC_DB::prepare( "DELETE FROM `*PREFIX*groups` WHERE gid = ?" ); + $result = $query->execute( array( $gid )); + + // Delete the group-user relation + $query = OC_DB::prepare( "DELETE FROM `*PREFIX*group_user` WHERE gid = ?" ); + $result = $query->execute( array( $gid )); + + return true; + } + + /** + * @brief is user in group? + * @param $uid uid of the user + * @param $gid gid of the group + * @returns true/false + * + * Checks whether the user is member of a group or not. + */ + public static function inGroup( $uid, $gid ){ + // check + $query = OC_DB::prepare( "SELECT * FROM `*PREFIX*group_user` WHERE gid = ? AND uid = ?" ); + $result = $query->execute( array( $gid, $uid )); + + return $result->numRows() > 0 ? true : false; + } + + /** + * @brief Add a user to a group + * @param $uid Name of the user to add to group + * @param $gid Name of the group in which add the user + * @returns true/false + * + * Adds a user to a group. + */ + public static function addToGroup( $uid, $gid ){ + // No duplicate entries! + if( !self::inGroup( $uid, $gid )){ + $query = OC_DB::prepare( "INSERT INTO `*PREFIX*group_user` ( `uid`, `gid` ) VALUES( ?, ? )" ); + $result = $query->execute( array( $uid, $gid )); + } + return true; + } + + /** + * @brief Removes a user from a group + * @param $uid Name of the user to remove from group + * @param $gid Name of the group from which remove the user + * @returns true/false + * + * removes the user from a group. + */ + public static function removeFromGroup( $uid, $gid ){ + $query = OC_DB::prepare( "DELETE FROM `*PREFIX*group_user` WHERE `uid` = ? AND `gid` = ?" ); + $result = $query->execute( array( $uid, $gid )); + + return true; + } + + /** + * @brief Get all groups a user belongs to + * @param $uid Name of the user + * @returns array with group names + * + * This function fetches all groups a user belongs to. It does not check + * if the user exists at all. + */ + public static function getUserGroups( $uid ){ + // No magic! + $query = OC_DB::prepare( "SELECT * FROM `*PREFIX*group_user` WHERE uid = ?" ); + $result = $query->execute( array( $uid )); + + $groups = array(); + while( $row = $result->fetchRow()){ + $groups[] = $row["gid"]; + } + + return $groups; + } + + /** + * @brief get a list of all groups + * @returns array with group names + * + * Returns a list with all groups + */ + public static function getGroups(){ + $query = OC_DB::prepare( "SELECT * FROM `*PREFIX*groups`" ); + $result = $query->execute(); + + $groups = array(); + while( $row = $result->fetchRow()){ + $groups[] = $row["gid"]; + } + + return $groups; + } +} diff --git a/inc/HTTP/WebDAV/Server/Filesystem.php b/lib/HTTP/WebDAV/Server/Filesystem.php similarity index 78% rename from inc/HTTP/WebDAV/Server/Filesystem.php rename to lib/HTTP/WebDAV/Server/Filesystem.php index 30c19fd29a641fdaa87082a81dbd4d130dab3d40..164892c9d862efb3ca4ba97e4a3323445e83734d 100644 --- a/inc/HTTP/WebDAV/Server/Filesystem.php +++ b/lib/HTTP/WebDAV/Server/Filesystem.php @@ -32,11 +32,11 @@ | POSSIBILITY OF SUCH DAMAGE. | +----------------------------------------------------------------------+ --- modified for ownCloud --- -*/ - require_once("../inc/lib_base.php"); - oc_require_once("HTTP/WebDAV/Server.php"); - oc_require_once("System.php"); - +*/ + require_once("lib/base.php"); + require_once("HTTP/WebDAV/Server.php"); + require_once("System.php"); + /** * Filesystem access using WebDAV * @@ -44,7 +44,7 @@ * @author Hartmut Holzgraefe <hartmut@php.net> * @version @package-version@ */ - class HTTP_WebDAV_Server_Filesystem extends HTTP_WebDAV_Server + class HTTP_WebDAV_Server_Filesystem extends HTTP_WebDAV_Server { /** * Root directory for WebDAV access @@ -60,9 +60,9 @@ * Serve a webdav request * * @access public - * @param string + * @param string */ - function ServeRequest($base = false) + function ServeRequest($base = false) { // special treatment for litmus compliance test // reply on its identifier header @@ -78,7 +78,7 @@ } else if (!$this->base) { $this->base = $this->_SERVER['DOCUMENT_ROOT']; } - + // let the base class do all the work parent::ServeRequest(); } @@ -92,7 +92,7 @@ * @param string Password * @return bool true on successful authentication */ - function check_auth($type, $user, $pass) + function check_auth($type, $user, $pass) { return true; } @@ -105,11 +105,11 @@ * @param array return array for file properties * @return bool true on success */ - function PROPFIND(&$options, &$files) + function PROPFIND(&$options, &$files) { // get absolute fs path to requested resource $fspath = $options["path"]; - + // sanity check if (!OC_FILESYSTEM::file_exists($fspath)) { return false; @@ -120,13 +120,13 @@ // store information for the requested path itself $files["files"][] = $this->fileinfo($options["path"]); // information for contained resources requested? - if (!empty($options["depth"]) && OC_FILESYSTEM::is_dir($fspath) && OC_FILESYSTEM::is_readable($fspath)) { + if (!empty($options["depth"]) && OC_FILESYSTEM::is_dir($fspath) && OC_FILESYSTEM::is_readable($fspath)) { // make sure path ends with '/' $options["path"] = $this->_slashify($options["path"]); // try to open directory $handle = @OC_FILESYSTEM::opendir($fspath); - + if ($handle) { // ok, now get all its contents while ($filename = readdir($handle)) { @@ -140,17 +140,16 @@ // ok, all done return true; - } - + } + /** * Get properties for a single file/resource * * @param string resource path * @return array resource properties */ - function fileinfo($path) + function fileinfo($path) { - global $CONFIG_DBTABLEPREFIX; // map URI path to filesystem path $fspath =$path; @@ -158,11 +157,11 @@ // create result array $info = array(); // TODO remove slash append code when base clase is able to do it itself - $info["path"] = OC_FILESYSTEM::is_dir($fspath) ? $this->_slashify($path) : $path; - $info["props"] = array(); + $info["path"] = OC_FILESYSTEM::is_dir($fspath) ? $this->_slashify($path) : $path; + $info["props"] = array(); // no special beautified displayname here ... $info["props"][] = $this->mkprop("displayname", strtoupper($path)); - + // creation and modification time $info["props"][] = $this->mkprop("creationdate", OC_FILESYSTEM::filectime($fspath)); $info["props"][] = $this->mkprop("getlastmodified", OC_FILESYSTEM::filemtime($fspath)); @@ -173,7 +172,7 @@ if ( OC_FILESYSTEM::is_dir($fspath)) { // directory (WebDAV collection) $info["props"][] = $this->mkprop("resourcetype", "collection"); - $info["props"][] = $this->mkprop("getcontenttype", "httpd/unix-directory"); + $info["props"][] = $this->mkprop("getcontenttype", "httpd/unix-directory"); } else { // plain file (WebDAV resource) $info["props"][] = $this->mkprop("resourcetype", ""); @@ -181,65 +180,65 @@ $info["props"][] = $this->mkprop("getcontenttype", $this->_mimetype($fspath)); } else { $info["props"][] = $this->mkprop("getcontenttype", "application/x-non-readable"); - } + } $info["props"][] = $this->mkprop("getcontentlength", OC_FILESYSTEM::filesize($fspath)); } // get additional properties from database - $query = "SELECT ns, name, value FROM {$CONFIG_DBTABLEPREFIX}properties WHERE path = '$path'"; - $res = OC_DB::select($query); + $query = OC_DB::prepare("SELECT ns, name, value FROM *PREFIX*properties WHERE path = ?"); + $res = $query->execute(array($path))->fetchAll(); foreach($res as $row){ $info["props"][] = $this->mkprop($row["ns"], $row["name"], $row["value"]); } return $info; } - + /** * try to detect the mime type of a file * * @param string file path * @return string guessed mime type */ - function _mimetype($fspath) + function _mimetype($fspath) { return OC_FILESYSTEM::getMimeType($fspath); } /** * HEAD method handler - * + * * @param array parameter passing array * @return bool true on success */ - function HEAD(&$options) + function HEAD(&$options) { // get absolute fs path to requested resource $fspath = $options["path"]; // sanity check if (! OC_FILESYSTEM::file_exists($fspath)) return false; - + // detect resource type - $options['mimetype'] = $this->_mimetype($fspath); - + $options['mimetype'] = $this->_mimetype($fspath); + // detect modification time // see rfc2518, section 13.7 // some clients seem to treat this as a reverse rule // requiering a Last-Modified header if the getlastmodified header was set $options['mtime'] = OC_FILESYSTEM::filemtime($fspath); - + // detect resource size $options['size'] = OC_FILESYSTEM::filesize($fspath); - + return true; } /** * GET method handler - * + * * @param array parameter passing array * @return bool true on success */ - function GET(&$options) + function GET(&$options) { // get absolute fs path to requested resource) $fspath = $options["path"]; @@ -255,7 +254,7 @@ // no need to check result here, it is handled by the base class $options['stream'] = OC_FILESYSTEM::fopen($fspath, "r"); - + return true; } @@ -268,7 +267,7 @@ * @param string directory path * @return void function has to handle HTTP response itself */ - function GetDir($fspath, &$options) + function GetDir($fspath, &$options) { $path = $this->_slashify($options["path"]); if ($path != $options["path"]) { @@ -289,21 +288,25 @@ } echo "<html><head><title>Index of ".htmlspecialchars($options['path'])."</title></head>\n"; - + echo "<h1>Index of ".htmlspecialchars($options['path'])."</h1>\n"; - + echo "<pre>"; printf($format, "Size", "Last modified", "Filename"); echo "<hr>"; while ($filename = readdir($handle)) { if ($filename != "." && $filename != "..") { - $fullpath = $fspath."/".$filename; + if( substr($fspath, -1) != '/' ){ + $fspath .= '/'; + } + $fullpath = $fspath.$filename; $name = htmlspecialchars($filename); - printf($format, - number_format(filesize($fullpath)), - strftime("%Y-%m-%d %H:%M:%S", filemtime($fullpath)), - "<a href='$name'>$name</a>"); + $uri = $_SERVER['SCRIPT_NAME'] . $fullpath; + printf($format, + number_format(OC_FILESYSTEM::filesize($fullpath)), + strftime("%Y-%m-%d %H:%M:%S", OC_FILESYSTEM::filemtime($fullpath)), + "<a href='$uri'>$name</a>"); } } @@ -318,11 +321,11 @@ /** * PUT method handler - * + * * @param array parameter passing array * @return bool true on success */ - function PUT(&$options) + function PUT(&$options) { $fspath = $options["path"]; $dir = dirname($fspath); @@ -353,8 +356,8 @@ * @param array general parameter passing array * @return bool true on success */ - function MKCOL($options) - { + function MKCOL($options) + { $path = $options["path"]; $parent = dirname($path); $name = basename($path); @@ -373,25 +376,24 @@ if (!empty($this->_SERVER["CONTENT_LENGTH"])) { // no body parsing yet return "415 Unsupported media type"; } - + $stat = OC_FILESYSTEM::mkdir($parent."/".$name, 0777); if (!$stat) { - return "403 Forbidden"; + return "403 Forbidden"; } return ("201 Created"); } - - + + /** * DELETE method handler * * @param array general parameter passing array * @return bool true on success */ - function DELETE($options) + function DELETE($options) { - global $CONFIG_DBTABLEPREFIX; $path =$options["path"]; if (!OC_FILESYSTEM::file_exists($path)) { return "404 Not found"; @@ -405,14 +407,14 @@ } } if (OC_FILESYSTEM::is_dir($path)) { - $query = "DELETE FROM {$CONFIG_DBTABLEPREFIX}properties WHERE path LIKE '".$this->_slashify($options["path"])."%'"; - OC_DB::query($query); + $query = OC_DB::prepare("DELETE FROM *PREFIX*properties WHERE path LIKE '?%'"); + $query->execute(array($this->_slashify($options["path"]))); OC_FILESYSTEM::delTree($path); } else { OC_FILESYSTEM::unlink($path); } - $query = "DELETE FROM {$CONFIG_DBTABLEPREFIX}properties WHERE path = '$options[path]'"; - OC_DB::query($query); + $query = OC_DB::prepare("DELETE FROM *PREFIX*properties WHERE path = ?"); + $query->execute(array($options['path'])); return "204 No Content"; } @@ -424,7 +426,7 @@ * @param array general parameter passing array * @return bool true on success */ - function MOVE($options) + function MOVE($options) { return $this->COPY($options, true); } @@ -435,10 +437,9 @@ * @param array general parameter passing array * @return bool true on success */ - function COPY($options, $del=false) + function COPY($options, $del=false) { // TODO Property updates still broken (Litmus should detect this?) - global $CONFIG_DBTABLEPREFIX; if (!empty($this->_SERVER["CONTENT_LENGTH"])) { // no body parsing yet return "415 Unsupported media type"; @@ -456,7 +457,7 @@ if (OC_FILESYSTEM::is_dir($source)) { // resource is a collection switch ($options["depth"]) { - case "infinity": // valid + case "infinity": // valid break; case "0": // valid for COPY only if ($del) { // MOVE? @@ -464,14 +465,14 @@ } break; case "1": // invalid for both COPY and MOVE - default: + default: return "400 Bad request"; } } $dest = $options["dest"]; $destdir = dirname($dest); - + if (!OC_FILESYSTEM::file_exists($destdir) || !OC_FILESYSTEM::is_dir($destdir)) { return "409 Conflict"; } @@ -499,7 +500,7 @@ if ($options["overwrite"]) { $stat = $this->DELETE(array("path" => $options["dest"])); if (($stat{0} != "2") && (substr($stat, 0, 3) != "404")) { - return $stat; + return $stat; } } else { return "412 precondition failed"; @@ -512,18 +513,18 @@ } $destpath = $this->_unslashify($options["dest"]); if (is_dir($source)) { - $dpath=OC_DB::escape($destpath); - $path=OC_DB::escape($options["path"]); - $query = "UPDATE {$CONFIG_DBTABLEPREFIX}properties - SET path = REPLACE(path, '$path', '$dpath') - WHERE path LIKE '$path%'"; - OC_DB::query($query); + $dpath=$destpath; + $path=$options["path"]; + $query = OC_DB::prepare("UPDATE *PREFIX*properties + SET path = REPLACE(path, ?, ?) + WHERE path LIKE '?%'"); + $query->execute(array($path,$dpath,$path)); } - $query = "UPDATE {$CONFIG_DBTABLEPREFIX}properties - SET path = '$dpath' - WHERE path = '$path'"; - OC_DB::query($query); + $query = OC_DB::prepare("UPDATE *PREFIX*properties + SET path = ? + WHERE path = ?"); + $query->execute(array($dpath,$path)); } else { if (OC_FILESYSTEM::is_dir($source)) { $files = OC_FILESYSTEM::getTree($source); @@ -534,14 +535,14 @@ if (!is_array($files) || empty($files)) { return "500 Internal server error"; } - - + + foreach ($files as $file) { if (OC_FILESYSTEM::is_dir($file)) { $file = $this->_slashify($file); } $destfile = str_replace($source, $dest, $file); - + if (OC_FILESYSTEM::is_dir($file)) { if (!OC_FILESYSTEM::file_exists($destfile)) { if (!OC_FILESYSTEM::is_writeable(dirname($destfile))) { @@ -560,7 +561,7 @@ } } } - return ($new && !$existing_col) ? "201 Created" : "204 No Content"; + return ($new && !$existing_col) ? "201 Created" : "204 No Content"; } /** @@ -569,33 +570,33 @@ * @param array general parameter passing array * @return bool true on success */ - function PROPPATCH(&$options) + function PROPPATCH(&$options) { global $prefs, $tab; - global $CONFIG_DBTABLEPREFIX; $msg = ""; $path = $options["path"]; $dir = dirname($path)."/"; $base = basename($path); - + foreach ($options["props"] as $key => $prop) { if ($prop["ns"] == "DAV:") { $options["props"][$key]['status'] = "403 Forbidden"; } else { - $path=OC_DB::escape($options['path']); - $name=OC_DB::escape($prop['name']); - $ns=OC_DB::escape($prop['ns']); - $val=OC_DB::escape($prop['val']); + $path=$options['path']; + $name=$prop['name']; + $ns=$prop['ns']; if (isset($prop["val"])) { - $query = "REPLACE INTO {$CONFIG_DBTABLEPREFIX}properties (path,name,ns,value) VALUES('$path','$name','$ns','$val')"; + $val=$prop['val']; + $query = OC_DB::prepare("REPLACE INTO *PREFIX*properties (path,name,ns,value) VALUES(?,?,?,?)"); + $query->execute(array($path,$name,$ns,$val)); } else { - $query = "DELETE FROM {$CONFIG_DBTABLEPREFIX}properties WHERE path = '$path' AND name = '$name' AND ns = '$ns'"; - } - OC_DB::query($query); + $query = $query = OC_DB::prepare("DELETE FROM *PREFIX*properties WHERE path = ? AND name = ? AND ns = ?"); + $query->execute(array($path,$name,$ns)); + } } } - + return ""; } @@ -606,9 +607,8 @@ * @param array general parameter passing array * @return bool true on success */ - function LOCK(&$options) + function LOCK(&$options) { - global $CONFIG_DBTABLEPREFIX; // get absolute fs path to requested resource $fspath = $options["path"]; @@ -630,56 +630,52 @@ $options["timeout"] = time()+300; // 5min. hardcoded if (isset($options["update"])) { // Lock Update - $where = "WHERE path = '$options[path]' AND token = '$options[update]'"; + $where = "WHERE path = ? AND token = ?"; - $query = "SELECT owner, exclusivelock FROM {$CONFIG_DBTABLEPREFIX}locks $where"; - $res = OC_DB::select($query); + $query = OC_DB::prepare("SELECT owner, exclusivelock FROM *PREFIX*locks $where"); + $res = $query->execute(array($options[path],$options[update]))->fetchAll(); if (is_array($res) and isset($res[0])) { $row=$res[0]; - $query = "UPDATE `{$CONFIG_DBTABLEPREFIX}locks` SET `expires` = '$options[timeout]', `modified` = ".time()." $where"; - OC_DB::query($query); - + $query = OC_DB::prepare("UPDATE `*PREFIX*locks` SET `expires` = , `modified` = $where"); + $query->execute(array($options[timeout],time(),$options[path],$options[update])); + $options['owner'] = $row['owner']; $options['scope'] = $row["exclusivelock"] ? "exclusive" : "shared"; $options['type'] = $row["exclusivelock"] ? "write" : "read"; return true; } else {//check for indirect refresh - $query = "SELECT * - FROM {$CONFIG_DBTABLEPREFIX}locks - WHERE recursive = 1 - "; - $res = OC_DB::select($query); + $query = OC_DB::prepare("SELECT * FROM *PREFIX*locks WHERE recursive = 1"); + $res = $query->execute(); foreach($res as $row){ if(strpos($options['path'],$row['path'])==0){//are we a child of a folder with an recursive lock - $where = "WHERE path = '$row[path]' AND token = '$options[update]'"; - $query = "UPDATE `{$CONFIG_DBTABLEPREFIX}locks` SET `expires` = '$options[timeout]', `modified` = ".time()." $where"; - OC_DB::query($query); - $options['owner'] = $row['owner']; - $options['scope'] = $row["exclusivelock"] ? "exclusive" : "shared"; - $options['type'] = $row["exclusivelock"] ? "write" : "read"; - return true; + $where = "WHERE path = ? AND token = ?"; + $query = OC_DB::prepare("UPDATE `*PREFIX*locks` SET `expires` = ?, `modified` = ? $where"); + $query->execute(array($options[timeout],time(),$row[path],$options[update])); + $options['owner'] = $row['owner']; + $options['scope'] = $row["exclusivelock"] ? "exclusive" : "shared"; + $options['type'] = $row["exclusivelock"] ? "write" : "read"; + return true; } } } } - - $locktoken=OC_DB::escape($options['locktoken']); - $path=OC_DB::escape($options['path']); + + $locktoken=$options['locktoken']; + $path=$options['path']; $time=time(); - $owner=OC_DB::escape($options['owner']); - $timeout=OC_DB::escape($options['timeout']); + $owner=$options['owner']; + $timeout=$options['timeout']; $exclusive=($options['scope'] === "exclusive" ? "1" : "0"); - $query = "INSERT INTO `{$CONFIG_DBTABLEPREFIX}locks` -(`token`,`path`,`created`,`modified`,`owner`,`expires`,`exclusivelock`,`recursive`) -VALUES ('$locktoken','$path',$time,$time,'$owner','timeout',$exclusive,$recursion)"; - OC_DB::query($query); - $rows=OC_DB::affected_rows(); + $query = OC_DB::prepare("INSERT INTO `*PREFIX*locks` +(`token`,`path`,`created`,`modified`,`owner`,`expires`,`exclusivelock`,`recursive`) +VALUES (?,?,?,?,?,'timeout',?,?)"); + $result=$query->execute(array($locktoken,$path,$time,$time,$owner,$exclusive,$recursion)); if(!OC_FILESYSTEM::file_exists($fspath) and $rows>0) { return "201 Created"; } - return OC_DB::affected_rows($rows) ? "200 OK" : "409 Conflict"; + return PEAR::isError($result) ? "409 Conflict" : "200 OK"; } /** @@ -688,15 +684,13 @@ VALUES ('$locktoken','$path',$time,$time,'$owner','timeout',$exclusive,$recursio * @param array general parameter passing array * @return bool true on success */ - function UNLOCK(&$options) + function UNLOCK(&$options) { - global $CONFIG_DBTABLEPREFIX; - $query = "DELETE FROM {$CONFIG_DBTABLEPREFIX}locks - WHERE path = '$options[path]' - AND token = '$options[token]'"; - OC_DB::query($query); - - return OC_DB::affected_rows() ? "204 No Content" : "409 Conflict"; + $query = OC_DB::prepare("DELETE FROM *PREFIX*locks + WHERE path = ? + AND token = ?"); + $query->execute(array($options[path]),$options[token]); + return PEAR::isError($result) ? "409 Conflict" : "204 No Content"; } /** @@ -705,16 +699,14 @@ VALUES ('$locktoken','$path',$time,$time,'$owner','timeout',$exclusive,$recursio * @param string resource path to check for locks * @return bool true on success */ - function checkLock($path) + function checkLock($path) { - global $CONFIG_DBTABLEPREFIX; - $result = false; - $query = "SELECT * - FROM {$CONFIG_DBTABLEPREFIX}locks - WHERE path = '$path' - "; - $res = OC_DB::select($query); + $query = OC_DB::prepare("SELECT * + FROM *PREFIX*locks + WHERE path = ? + "); + $res = $query->execute(array($path))->fetchAll(); if (is_array($res) and isset($res[0])) { $row=$res[0]; @@ -724,19 +716,19 @@ VALUES ('$locktoken','$path',$time,$time,'$owner','timeout',$exclusive,$recursio "depth" => 0, "owner" => $row['owner'], "token" => $row['token'], - "created" => $row['created'], - "modified" => $row['modified'], + "created" => $row['created'], + "modified" => $row['modified'], "expires" => $row['expires'], "recursive" => $row['recursive'] ); } }else{ //check for recursive locks; - $query = "SELECT * - FROM {$CONFIG_DBTABLEPREFIX}locks + $query = OC_DB::prepare("SELECT * + FROM *PREFIX*locks WHERE recursive = 1 - "; - $res = OC_DB::select($query); + "); + $res = $query->execute()->fetchAll(); foreach($res as $row){ if(strpos($path,$row['path'])==0){//are we a child of a folder with an recursive lock $result = array( "type" => "write", @@ -744,8 +736,8 @@ VALUES ('$locktoken','$path',$time,$time,'$owner','timeout',$exclusive,$recursio "depth" => 0, "owner" => $row['owner'], "token" => $row['token'], - "created" => $row['created'], - "modified" => $row['modified'], + "created" => $row['created'], + "modified" => $row['modified'], "expires" => $row['expires'], "recursive" => $row['recursive'] ); @@ -757,4 +749,4 @@ VALUES ('$locktoken','$path',$time,$time,'$owner','timeout',$exclusive,$recursio } } -?> \ No newline at end of file +?> diff --git a/lib/User/backend.php b/lib/User/backend.php new file mode 100644 index 0000000000000000000000000000000000000000..e99016a5214b5ddd1e48793d0b9e38a023358016 --- /dev/null +++ b/lib/User/backend.php @@ -0,0 +1,112 @@ +<?php + +/** + * ownCloud + * + * @author Frank Karlitschek + * @copyright 2010 Frank Karlitschek karlitschek@kde.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ + + + +/** + * abstract base class for user management + */ +abstract class OC_USER_BACKEND { + + /** + * @brief Create a new user + * @param $uid The username of the user to create + * @param $password The password of the new user + * @returns true/false + * + * Creates a new user. Basic checking of username is done in OC_USER + * itself, not in its subclasses. + */ + public static function createUser($uid, $password){} + + /** + * @brief delete a user + * @param $uid The username of the user to delete + * @returns true/false + * + * Deletes a user + */ + public static function deleteUser( $uid ){} + + /** + * @brief Try to login a user + * @param $uid The username of the user to log in + * @param $password The password of the user + * @returns true/false + * + * Log in a user - if the password is ok + */ + public static function login($uid, $password){} + + /** + * @brief Kick the user + * @returns true + * + * Logout, destroys session + */ + public static function logout(){} + + /** + * @brief Check if the user is logged in + * @returns true/false + * + * Checks if the user is logged in + */ + public static function isLoggedIn(){} + + /** + * @brief Autogenerate a password + * @returns string + * + * generates a password + */ + public static function generatePassword(){} + + /** + * @brief Set password + * @param $uid The username + * @param $password The new password + * @returns true/false + * + * Change the password of a user + */ + public static function setPassword($uid, $password){} + + /** + * @brief Check if the password is correct + * @param $uid The username + * @param $password The password + * @returns true/false + * + * Check if the password is correct without logging in the user + */ + public static function checkPassword($uid, $password){} + + /** + * @brief Get a list of all users + * @returns array with all uids + * + * Get a list of all users. + */ + public static function getUsers(){} +} diff --git a/lib/User/database.php b/lib/User/database.php new file mode 100644 index 0000000000000000000000000000000000000000..eeabb592c227814d01206309867402c96cc1a366 --- /dev/null +++ b/lib/User/database.php @@ -0,0 +1,206 @@ +<?php + +/** + * ownCloud + * + * @author Frank Karlitschek + * @copyright 2010 Frank Karlitschek karlitschek@kde.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ +/* + * + * The following SQL statement is just a help for developers and will not be + * executed! + * + * CREATE TABLE `users` ( + * `uid` varchar(64) COLLATE utf8_unicode_ci NOT NULL, + * `password` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + * PRIMARY KEY (`uid`) + * ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + * + */ + +require_once('User/backend.php'); + +/** + * Class for user management in a SQL Database (e.g. MySQL, SQLite) + */ +class OC_USER_DATABASE extends OC_USER_BACKEND { + static private $userGroupCache=array(); + + /** + * @brief Create a new user + * @param $uid The username of the user to create + * @param $password The password of the new user + * @returns true/false + * + * Creates a new user. Basic checking of username is done in OC_USER + * itself, not in its subclasses. + */ + public static function createUser( $uid, $password ){ + // Check if the user already exists + $query = OC_DB::prepare( "SELECT * FROM `*PREFIX*users` WHERE uid = ?" ); + $result = $query->execute( array( $uid )); + + if ( $result->numRows() > 0 ){ + return false; + } + else{ + $query = OC_DB::prepare( "INSERT INTO `*PREFIX*users` ( `uid`, `password` ) VALUES( ?, ? )" ); + $result = $query->execute( array( $uid, sha1( $password ))); + + return $result ? true : false; + } + } + + /** + * @brief delete a user + * @param $uid The username of the user to delete + * @returns true/false + * + * Deletes a user + */ + public static function deleteUser( $uid ){ + // Delete user-group-relation + $query = OC_DB::prepare( "DELETE FROM `*PREFIX*users` WHERE uid = ?" ); + $result = $query->execute( array( $uid )); + return true; + } + + /** + * @brief Try to login a user + * @param $uid The username of the user to log in + * @param $password The password of the user + * @returns true/false + * + * Log in a user - if the password is ok + */ + public static function login( $uid, $password ){ + // Query + $query = OC_DB::prepare( "SELECT uid FROM *PREFIX*users WHERE uid = ? AND password = ?" ); + $result = $query->execute( array( $uid, sha1( $password ))); + + if( $result->numRows() > 0 ){ + // Set username if name and password are known + $row = $result->fetchRow(); + $_SESSION['user_id'] = $row["uid"]; + OC_LOG::add( "core", $_SESSION['user_id'], "login" ); + return true; + } + else{ + return false; + } + } + + /** + * @brief Kick the user + * @returns true + * + * Logout, destroys session + */ + public static function logout(){ + OC_LOG::add( "core", $_SESSION['user_id'], "logout" ); + $_SESSION['user_id'] = false; + + return true; + } + + /** + * @brief Check if the user is logged in + * @returns true/false + * + * Checks if the user is logged in + */ + public static function isLoggedIn() { + if( isset($_SESSION['user_id']) AND $_SESSION['user_id'] ){ + return true; + } + else{ + return false; + } + } + + /** + * @brief Autogenerate a password + * @returns string + * + * generates a password + */ + public static function generatePassword(){ + return uniqId(); + } + + /** + * @brief Set password + * @param $uid The username + * @param $password The new password + * @returns true/false + * + * Change the password of a user + */ + public static function setPassword( $uid, $password ){ + // Check if the user already exists + $query = OC_DB::prepare( "SELECT * FROM `*PREFIX*users` WHERE uid = ?" ); + $result = $query->execute( array( $uid )); + + if( $result->numRows() > 0 ){ + $query = OC_DB::prepare( "UPDATE *PREFIX*users SET password = ? WHERE uid = ?" ); + $result = $query->execute( array( sha1( $password ), $uid )); + + return true; + } + else{ + return false; + } + } + + /** + * @brief Check if the password is correct + * @param $uid The username + * @param $password The password + * @returns true/false + * + * Check if the password is correct without logging in the user + */ + public static function checkPassword( $uid, $password ){ + $query = OC_DB::prepare( "SELECT uid FROM *PREFIX*users WHERE uid = ? AND password = ?" ); + $result = $query->execute( array( $uid, sha1( $password ))); + + if( $result->numRows() > 0 ){ + return true; + } + else{ + return false; + } + } + + /** + * @brief Get a list of all users + * @returns array with all uids + * + * Get a list of all users. + */ + public static function getUsers(){ + $query = OC_DB::prepare( "SELECT uid FROM *PREFIX*users" ); + $result = $query->execute(); + + $users=array(); + while( $row = $result->fetchRow()){ + $users[] = $row["uid"]; + } + return $users; + } +} diff --git a/lib/app.php b/lib/app.php new file mode 100644 index 0000000000000000000000000000000000000000..a56e0c2f9e66c8dde64282e87b66feea5b517e13 --- /dev/null +++ b/lib/app.php @@ -0,0 +1,355 @@ +<?php +/** + * ownCloud + * + * @author Frank Karlitschek + * @author Jakob Sack + * @copyright 2010 Frank Karlitschek karlitschek@kde.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ + +/** + * This class manages the apps. It allows them to register and integrate in the + * owncloud ecosystem. Furthermore, this class is responsible for installing, + * upgrading and removing apps. + */ +class OC_APP{ + static private $init = false; + static private $apps = array(); + static private $activeapp = ""; + static private $adminpages = array(); + static private $settingspages = array(); + static private $navigation = array(); + static private $subnavigation = array(); + + /** + * @brief loads all apps + * @returns true/false + * + * This function walks through the owncloud directory and loads all apps + * it can find. A directory contains an app if the file /appinfo/app.php + * exists. + */ + public static function loadApps(){ + global $SERVERROOT; + + // Did we allready load everything? + if( self::$init ){ + return true; + } + + // Our very own core apps are hardcoded + foreach( array( "admin", "files", "log", "help", "settings" ) as $app ){ + require( "$app/appinfo/app.php" ); + } + + // The rest comes here + $dir = opendir( "$SERVERROOT/apps" ); + while( false !== ( $filename = readdir( $dir ))){ + if( substr( $filename, 0, 1 ) != '.' ){ + if( file_exists( "$SERVERROOT/apps/$filename/appinfo/app.php" )){ + if(OC_APPCONFIG::getValue($filename,'installed_version',0)==0){ //check if the plugin is fully installed + //install the database + if(is_file("$SERVERROOT/apps/$filename/appinfo/database.xml")){ + OC_DB::createDbFromStructure("$SERVERROOT/apps/$filename/appinfo/database.xml"); + } + + //run appinfo/install.php + if(is_file("$SERVERROOT/apps/$filename/appinfo/install.php")){ + include("$SERVERROOT/apps/$filename/appinfo/install.php"); + } + $info=self::getAppInfo("$SERVERROOT/apps/$filename/appinfo/info.xml"); + OC_APPCONFIG::setValue($filename,'installed_version',$info['version']); + } + require( "apps/$filename/appinfo/app.php" ); + } + } + } + closedir( $dir ); + + self::$init = true; + + // return + return true; + } + + /** + * @brief makes owncloud aware of this app + * @param $data array with all information + * @returns true/false + * + * This function registers the application. $data is an associative array. + * The following keys are required: + * - id: id of the application, has to be unique ("addressbook") + * - name: Human readable name ("Addressbook") + * - version: array with Version (major, minor, bugfix) ( array(1, 0, 2)) + * + * The following keys are optional: + * - order: integer, that influences the position of your application in + * a list of applications. Lower values come first. + * + */ + public static function register( $data ){ + OC_APP::$apps[] = $data; + } + + /** + * @brief returns information of all apps + * @return array with all information + * + * This function returns all data it got via register(). + */ + public static function get(){ + // TODO: write function + return OC_APP::$apps; + } + + /** + * @brief adds an entry to the navigation + * @param $data array containing the data + * @returns true/false + * + * This function adds a new entry to the navigation visible to users. $data + * is an associative array. + * The following keys are required: + * - id: unique id for this entry ("addressbook_index") + * - href: link to the page + * - name: Human readable name ("Addressbook") + * + * The following keys are optional: + * - icon: path to the icon of the app + * - order: integer, that influences the position of your application in + * the navigation. Lower values come first. + */ + public static function addNavigationEntry( $data ){ + // TODO: write function + OC_APP::$navigation[] = $data; + return true; + } + + /** + * @brief adds a sub entry to the navigation + * @param $parent id of the parent + * @param $data array containing the data + * @returns true/false + * + * This function adds a new sub entry to the navigation visible to users. + * these entries are visible only if the parent navigation entry is marked + * as being active (see activateNavigationEntry()). $data is an associative + * array. + * The following keys are required: + * - id: unique id for this entry ("addressbook_index") + * - href: link to the page + * - name: Human readable name ("Addressbook") + * + * The following keys are optional: + * - icon: path to the icon of the app + * - order: integer, that influences the position of your application in + * the navigation. Lower values come first. + */ + public static function addNavigationSubEntry( $parent, $data ){ + if( !array_key_exists( $parent, self::$subnavigation )){ + self::$subnavigation[$parent] = array(); + } + self::$subnavigation[$parent][] = $data; + return true; + } + + /** + * @brief marks a navigation entry as active + * @param $id id of the entry + * @returns true/false + * + * This function sets a navigation entry as active and removes the "active" + * property from all other entries. The templates can use this for + * highlighting the current position of the user. + */ + public static function setActiveNavigationEntry( $id ){ + self::$activeapp = $id; + return true; + } + + /** + * @brief gets the active Menu entry + * @returns id or empty string + * + * This function returns the id of the active navigation entry (set by + * setActiveNavigationEntry + */ + public static function getActiveNavigationEntry(){ + return self::$activeapp; + } + + /** + * @brief registers an admin page + * @param $data array containing the data + * @returns true/false + * + * This function registers a admin page that will be shown in the admin + * menu. $data is an associative array. + * The following keys are required: + * - id: unique id for this entry ("files_admin") + * - href: link to the admin page + * - name: Human readable name ("Files Administration") + * + * The following keys are optional: + * - order: integer, that influences the position of your application in + * the list. Lower values come first. + */ + public static function addAdminPage( $data = array()){ + // TODO: write function + OC_APP::$adminpages[] = $data; + return true; + } + + /** + * @brief registers a settings page + * @param $data array containing the data + * @returns true/false + * + * This function registers a settings page. $data is an associative array. + * The following keys are required: + * - app: app the settings belong to ("files") + * - id: unique id for this entry ("files_public") + * - href: link to the admin page + * - name: Human readable name ("Public files") + * + * The following keys are optional: + * - order: integer, that influences the position of your application in + * the list. Lower values come first. + * + * For the main settings page of an app, the keys "app" and "id" have to be + * the same. + */ + public static function addSettingsPage( $data = array()){ + // TODO: write function + OC_APP::$settingspages[] = $data; + return true; + } + + /** + * @brief Returns the navigation + * @returns associative array + * + * This function returns an array containing all entries added. The + * entries are sorted by the key "order" ascending. Additional to the keys + * given for each app the following keys exist: + * - active: boolean, signals if the user is on this navigation entry + * - children: array that is empty if the key "active" is false or + * contains the subentries if the key "active" is true + */ + public static function getNavigation(){ + $navigation = self::proceedNavigation( self::$navigation ); + $navigation = self::addSubNavigation( $navigation ); + return $navigation; + } + + /** + * @brief Returns the Settings Navigation + * @returns associative array + * + * This function returns an array containing all settings pages added. The + * entries are sorted by the key "order" ascending. + */ + public static function getSettingsNavigation(){ + $navigation = self::proceedNavigation( self::$settingspages ); + $navigation = self::addSubNavigation( $navigation ); + + return $navigation; + } + + /** + * @brief Returns the admin navigation + * @returns associative array + * + * This function returns an array containing all admin pages added. The + * entries are sorted by the key "order" ascending. + */ + public static function getAdminNavigation(){ + $navigation = self::proceedNavigation( self::$adminpages ); + $navigation = self::addSubNavigation( $navigation ); + + return $navigation; + } + + /// Private foo + private static function addSubNavigation( $list ){ + $found = false; + foreach( self::$subnavigation as $parent => $selection ){ + foreach( $selection as $subentry ){ + if( $subentry["id"] == self::$activeapp ){ + foreach( $list as &$naventry ){ + if( $naventry["id"] == $parent ){ + $naventry["active"] = true; + $naventry["subnavigation"] = $selection; + } + else{ + $naventry["active"] = false; + } + } + $found = true; + } + } + } + + return $list; + } + + /// This is private as well. It simply works, so don't ask for more details + private static function proceedNavigation( $list ){ + foreach( $list as &$naventry ){ + $naventry["subnavigation"] = array(); + if( $naventry["id"] == self::$activeapp ){ + $naventry["active"] = true; + if( array_key_exists( $naventry["id"], self::$subnavigation )){ + $naventry["subnavigation"] = self::$subnavigation[$naventry["id"]]; + } + } + else{ + $naventry["active"] = false; + } + } + + usort( $list, create_function( '$a, $b', 'if( $a["order"] == $b["order"] ){return 0;}elseif( $a["order"] < $b["order"] ){return -1;}else{return 1;}' )); + + return $list; + } + + /** + * @brief Read app metadata from the info.xml file + * @param string $appid id of the app or the path of the info.xml file + * @returns array + */ + public static function getAppInfo($appid){ + if(is_file($appid)){ + $file=$appid; + }else{ + $file='apps/'.$appid.'/appinfo/info.xml'; + if(!is_file($file)){ + return array(); + } + } + $data=array(); + $content=file_get_contents($file); + $xml = new SimpleXMLElement($content); + $data['info']=array(); + foreach($xml->children() as $child){ + $data[$child->getName()]=(string)$child; + } + return $data; + } +} +?> \ No newline at end of file diff --git a/lib/appconfig.php b/lib/appconfig.php new file mode 100644 index 0000000000000000000000000000000000000000..4fef7542f405c2a94ade6375d290d8161d79cda5 --- /dev/null +++ b/lib/appconfig.php @@ -0,0 +1,161 @@ +<?php +/** + * ownCloud + * + * @author Frank Karlitschek + * @author Jakob Sack + * @copyright 2010 Frank Karlitschek karlitschek@kde.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ +/* + * + * The following SQL statement is just a help for developers and will not be + * executed! + * + * CREATE TABLE `appconfig` ( + * `appid` VARCHAR( 255 ) NOT NULL , + * `configkey` VARCHAR( 255 ) NOT NULL , + * `configvalue` VARCHAR( 255 ) NOT NULL + * ) + * + */ + +/** + * This class provides an easy way for apps to store config values in the + * database. + */ +class OC_APPCONFIG{ + /** + * @brief Get all apps using the config + * @returns array with app ids + * + * This function returns a list of all apps that have at least one + * entry in the appconfig table. + */ + public static function getApps(){ + // No magic in here! + $query = OC_DB::prepare( 'SELECT DISTINCT( appid ) FROM *PREFIX*appconfig' ); + $result = $query->execute(); + + $apps = array(); + while( $row = $result->fetchRow()){ + $apps[] = $row["appid"]; + } + + return $apps; + } + + /** + * @brief Get the available keys for an app + * @param $app the app we are looking for + * @returns array with key names + * + * This function gets all keys of an app. Please note that the values are + * not returned. + */ + public static function getKeys( $app ){ + // No magic in here as well + $query = OC_DB::prepare( 'SELECT configkey FROM *PREFIX*appconfig WHERE appid = ?' ); + $result = $query->execute( array( $app )); + + $keys = array(); + while( $row = $result->fetchRow()){ + $keys[] = $row["configkey"]; + } + + return $keys; + } + + /** + * @brief Gets the config value + * @param $app app + * @param $key key + * @param $default = null, default value if the key does not exist + * @returns the value or $default + * + * This function gets a value from the appconfig table. If the key does + * not exist the default value will be returnes + */ + public static function getValue( $app, $key, $default = null ){ + // At least some magic in here :-) + $query = OC_DB::prepare( 'SELECT configvalue FROM *PREFIX*appconfig WHERE appid = ? AND configkey = ?' ); + $result = $query->execute( array( $app, $key )); + + if( !$result->numRows()){ + return $default; + } + + $row = $result->fetchRow(); + + return $row["configvalue"]; + } + + /** + * @brief sets a value in the appconfig + * @param $app app + * @param $key key + * @param $value value + * @returns true/false + * + * Sets a value. If the key did not exist before it will be created. + */ + public static function setValue( $app, $key, $value ){ + // Does the key exist? yes: update. No: insert + $exists = self::getValue( $app, $key, null ); + + // null: does not exist + if( is_null( $exists )){ + $query = OC_DB::prepare( 'INSERT INTO *PREFIX*appconfig ( appid, configkey, configvalue ) VALUES( ?, ?, ? )' ); + $query->execute( array( $app, $key, $value )); + } + else{ + $query = OC_DB::prepare( 'UPDATE *PREFIX*appconfig SET configvalue = ? WHERE appid = ? AND configkey = ?' ); + $query->execute( array( $value, $app, $key )); + } + } + + /** + * @brief Deletes a key + * @param $app app + * @param $key key + * @returns true/false + * + * Deletes a key. + */ + public static function deleteKey( $app, $key ){ + // Boring! + $query = OC_DB::prepare( 'DELETE FROM *PREFIX*appconfig WHERE appid = ? AND configkey = ?' ); + $query->execute( array( $app, $key )); + + return true; + } + + /** + * @brief Remove app from appconfig + * @param $app app + * @returns true/false + * + * Removes all keys in appconfig belonging to the app. + */ + public static function deleteApp( $app ){ + // Nothing special + $query = OC_DB::prepare( 'DELETE FROM *PREFIX*appconfig WHERE appid = ?' ); + $query->execute( array( $app )); + + return true; + } +} +?> diff --git a/lib/base.php b/lib/base.php new file mode 100644 index 0000000000000000000000000000000000000000..c18ecd570db1bc4f7c0fac1d3606072a13a44c8b --- /dev/null +++ b/lib/base.php @@ -0,0 +1,400 @@ +<?php +/** + * ownCloud + * + * @author Frank Karlitschek + * @copyright 2010 Frank Karlitschek karlitschek@kde.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ + + +// set some stuff +//ob_start(); +error_reporting(E_ALL | E_STRICT); + +date_default_timezone_set('Europe/Berlin'); +ini_set('arg_separator.output','&'); +ini_set('session.cookie_httponly','1;'); +session_start(); + +// calculate the documentroot +$SERVERROOT=substr(__FILE__,0,-13); +$DOCUMENTROOT=realpath($_SERVER['DOCUMENT_ROOT']); +$SERVERROOT=str_replace("\\",'/',$SERVERROOT); +$SUBURI=substr(realpath($_SERVER["SCRIPT_FILENAME"]),strlen($SERVERROOT)); +$WEBROOT=substr($_SERVER["SCRIPT_NAME"],0,strlen($_SERVER["SCRIPT_NAME"])-strlen($SUBURI)); + + + +if($WEBROOT!='' and $WEBROOT[0]!=='/'){ + $WEBROOT='/'.$WEBROOT; +} + +// set the right include path +set_include_path($SERVERROOT.'/lib'.PATH_SEPARATOR.$SERVERROOT.'/config'.PATH_SEPARATOR.$SERVERROOT.'/3dparty'.PATH_SEPARATOR.get_include_path().PATH_SEPARATOR.$SERVERROOT); + +// define runtime variables - unless this already has been done +if( !isset( $RUNTIME_NOSETUPFS )){ + $RUNTIME_NOSETUPFS = false; +} +if( !isset( $RUNTIME_NOAPPS )){ + $RUNTIME_NOAPPS = false; +} + +// Doing the config stuff first +require_once('config.php'); + +// TODO: we should get rid of this one, too +// WARNING: to make everything even more confusing, DATADIRECTORY is a var that +// changes and DATATIRECTORY_ROOT stays the same, but is set by +// "datadirectory". Any questions? +$CONFIG_DATADIRECTORY = OC_CONFIG::getValue( "datadirectory", "$SERVERROOT/data" ); + +// redirect to https site if configured +if( OC_CONFIG::getValue( "forcessl", false )){ + if(!isset($_SERVER['HTTPS']) or $_SERVER['HTTPS'] != 'on') { + $url = "https://". $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; + header("Location: $url"); + exit(); + } +} + +// load core libs +require_once('helper.php'); +require_once('database.php'); +require_once('app.php'); +require_once('appconfig.php'); +require_once('files.php'); +require_once('filesystem.php'); +require_once('filestorage.php'); +require_once('log.php'); +require_once('user.php'); +require_once('group.php'); +require_once('ocs.php'); +require_once('ocsclient.php'); +require_once('connect.php'); +require_once('remotestorage.php'); +require_once('search.php'); + +$error=(count(OC_UTIL::checkServer())>0); + +OC_USER::setBackend( OC_CONFIG::getValue( "userbackend", "database" )); +OC_GROUP::setBackend( OC_CONFIG::getValue( "groupbackend", "database" )); + +// Set up file system unless forbidden +if(!$error and !$RUNTIME_NOSETUPFS ){ + OC_UTIL::setupFS(); +} + +// Add the stuff we need always +OC_UTIL::addScript( "jquery-1.5.min" ); +OC_UTIL::addScript( "jquery-ui-1.8.10.custom.min" ); +OC_UTIL::addScript( "js" ); +OC_UTIL::addStyle( "jquery-ui-1.8.10.custom" ); +OC_UTIL::addStyle( "styles" ); + +// Load Apps +if(!$error and !$RUNTIME_NOAPPS ){ + OC_APP::loadApps(); +} + +/** + * Class for utility functions + * + */ +class OC_UTIL { + public static $scripts=array(); + public static $styles=array(); + private static $fsSetup=false; + + // Can be set up + public static function setupFS( $user = "", $root = "files" ){// configure the initial filesystem based on the configuration + if(self::$fsSetup){//setting up the filesystem twice can only lead to trouble + return false; + } + + // Global Variables + global $SERVERROOT; + global $CONFIG_DATADIRECTORY; + + $CONFIG_DATADIRECTORY_ROOT = OC_CONFIG::getValue( "datadirectory", "$SERVERROOT/data" ); + $CONFIG_BACKUPDIRECTORY = OC_CONFIG::getValue( "backupdirectory", "$SERVERROOT/backup" ); + + // Create root dir + if(!is_dir($CONFIG_DATADIRECTORY_ROOT)){ + @mkdir($CONFIG_DATADIRECTORY_ROOT) or die("Can't create data directory ($CONFIG_DATADIRECTORY_ROOT), you can usually fix this by setting the owner of '$SERVERROOT' to the user that the web server uses (www-data for debian/ubuntu)"); + } + + // If we are not forced to load a specific user we load the one that is logged in + if( $user == "" && OC_USER::isLoggedIn()){ + $user = $_SESSION['user_id']; + } + + if( $user != "" ){ //if we aren't logged in, there is no use to set up the filesystem + //first set up the local "root" storage and the backupstorage if needed + $rootStorage=OC_FILESYSTEM::createStorage('local',array('datadir'=>$CONFIG_DATADIRECTORY)); +// if( OC_CONFIG::getValue( "enablebackup", false )){ +// // This creates the Directorys recursively +// if(!is_dir( "$CONFIG_BACKUPDIRECTORY/$user/$root" )){ +// mkdir( "$CONFIG_BACKUPDIRECTORY/$user/$root", 0755, true ); +// } +// $backupStorage=OC_FILESYSTEM::createStorage('local',array('datadir'=>$CONFIG_BACKUPDIRECTORY)); +// $backup=new OC_FILEOBSERVER_BACKUP(array('storage'=>$backupStorage)); +// $rootStorage->addObserver($backup); +// } + OC_FILESYSTEM::mount($rootStorage,'/'); + + $CONFIG_DATADIRECTORY = "$CONFIG_DATADIRECTORY_ROOT/$user/$root"; + if( !is_dir( $CONFIG_DATADIRECTORY )){ + mkdir( $CONFIG_DATADIRECTORY, 0755, true ); + } + +// TODO: find a cool way for doing this +// //set up the other storages according to the system settings +// foreach($CONFIG_FILESYSTEM as $storageConfig){ +// if(OC_FILESYSTEM::hasStorageType($storageConfig['type'])){ +// $arguments=$storageConfig; +// unset($arguments['type']); +// unset($arguments['mountpoint']); +// $storage=OC_FILESYSTEM::createStorage($storageConfig['type'],$arguments); +// if($storage){ +// OC_FILESYSTEM::mount($storage,$storageConfig['mountpoint']); +// } +// } +// } + + //jail the user into his "home" directory + OC_FILESYSTEM::chroot("/$user/$root"); + self::$fsSetup=true; + } + } + + /** + * get the current installed version of ownCloud + * @return array + */ + public static function getVersion(){ + return array(1,60,0); + } + + /** + * add a javascript file + * + * @param url $url + */ + public static function addScript( $application, $file = null ){ + if( is_null( $file )){ + $file = $application; + $application = ""; + } + if( !empty( $application )){ + self::$scripts[] = "$application/js/$file"; + }else{ + self::$scripts[] = "js/$file"; + } + } + + /** + * add a css file + * + * @param url $url + */ + public static function addStyle( $application, $file = null ){ + if( is_null( $file )){ + $file = $application; + $application = ""; + } + if( !empty( $application )){ + self::$styles[] = "$application/css/$file"; + }else{ + self::$styles[] = "css/$file"; + } + } + + /** + * formats a timestamp in the "right" way + * + * @param int timestamp $timestamp + * @param bool dateOnly option to ommit time from the result + */ + public static function formatDate( $timestamp,$dateOnly=false){ + $timeformat=$dateOnly?'F j, Y':'F j, Y, H:i'; + return date($timeformat,$timestamp); + } + + /** + * Shows a pagenavi widget where you can jump to different pages. + * + * @param int $pagecount + * @param int $page + * @param string $url + * @return OC_TEMPLATE + */ + public static function getPageNavi($pagecount,$page,$url) { + + $pagelinkcount=8; + if ($pagecount>1) { + $pagestart=$page-$pagelinkcount; + if($pagestart<0) $pagestart=0; + $pagestop=$page+$pagelinkcount; + if($pagestop>$pagecount) $pagestop=$pagecount; + + $tmpl = new OC_TEMPLATE( '', 'part.pagenavi', '' ); + $tmpl->assign('page',$page); + $tmpl->assign('pagecount',$pagecount); + $tmpl->assign('pagestart',$pagestart); + $tmpl->assign('pagestop',$pagestop); + $tmpl->assign('url',$url); + return $tmpl; + } + } + + + + /** + * check if the current server configuration is suitable for ownCloud + * @return array arrays with error messages and hints + */ + public static function checkServer(){ + global $SERVERROOT; + global $CONFIG_DATADIRECTORY; + + $CONFIG_DATADIRECTORY_ROOT = OC_CONFIG::getValue( "datadirectory", "$SERVERROOT/data" );; + $CONFIG_BACKUPDIRECTORY = OC_CONFIG::getValue( "backupdirectory", "$SERVERROOT/backup" ); + $CONFIG_INSTALLED = OC_CONFIG::getValue( "installed", false ); + $errors=array(); + + //check for database drivers + if(!is_callable('sqlite_open') and !is_callable('mysql_connect')){ + $errors[]=array('error'=>'No database drivers (sqlite or mysql) installed.<br/>','hint'=>'');//TODO: sane hint + } + $CONFIG_DBTYPE = OC_CONFIG::getValue( "dbtype", "sqlite" ); + $CONFIG_DBNAME = OC_CONFIG::getValue( "dbname", "owncloud" ); + + //try to get the username the httpd server runs on, used in hints + $stat=stat($_SERVER['DOCUMENT_ROOT']); + if(is_callable('posix_getpwuid')){ + $serverUser=posix_getpwuid($stat['uid']); + $serverUser='\''.$serverUser['name'].'\''; + }else{ + $serverUser='\'www-data\' for ubuntu/debian';//TODO: try to detect the distro and give a guess based on that + } + + //common hint for all file permissons error messages + $permissionsHint="Permissions can usually be fixed by setting the owner of the file or directory to the user the web server runs as ($serverUser)"; + + //check for correct file permissions + if(!stristr(PHP_OS, 'WIN')){ + $prems=substr(decoct(fileperms($CONFIG_DATADIRECTORY_ROOT)),-3); + if(substr($prems,-1)!='0'){ + OC_HELPER::chmodr($CONFIG_DATADIRECTORY_ROOT,0770); + clearstatcache(); + $prems=substr(decoct(fileperms($CONFIG_DATADIRECTORY_ROOT)),-3); + if(substr($prems,2,1)!='0'){ + $errors[]=array('error'=>'Data directory ('.$CONFIG_DATADIRECTORY_ROOT.') is readable from the web<br/>','hint'=>$permissionsHint); + } + } + if( OC_CONFIG::getValue( "enablebackup", false )){ + $prems=substr(decoct(fileperms($CONFIG_BACKUPDIRECTORY)),-3); + if(substr($prems,-1)!='0'){ + OC_HELPER::chmodr($CONFIG_BACKUPDIRECTORY,0770); + clearstatcache(); + $prems=substr(decoct(fileperms($CONFIG_BACKUPDIRECTORY)),-3); + if(substr($prems,2,1)!='0'){ + $errors[]=array('error'=>'Data directory ('.$CONFIG_BACKUPDIRECTORY.') is readable from the web<br/>','hint'=>$permissionsHint); + } + } + } + }else{ + //TODO: premisions checks for windows hosts + } + if(is_dir($CONFIG_DATADIRECTORY_ROOT) and !is_writable($CONFIG_DATADIRECTORY_ROOT)){ + $errors[]=array('error'=>'Data directory ('.$CONFIG_DATADIRECTORY_ROOT.') not writable by ownCloud<br/>','hint'=>$permissionsHint); + } + + //TODO: check for php modules + + return $errors; + } +} + +/** + * This class manages the hooks. It basically provides two functions: adding + * slots and emitting signals. + */ +class OC_HOOK{ + static private $registered = array(); + + /** + * @brief connects a function to a hook + * @param $signalclass class name of emitter + * @param $signalname name of signal + * @param $slotclass class name of slot + * @param $slotname name of slot + * @returns true/false + * + * This function makes it very easy to connect to use hooks. + * + * TODO: write example + */ + static public function connect( $signalclass, $signalname, $slotclass, $slotname ){ + // Cerate the data structure + if( !array_key_exists( $signalclass, self::$registered )){ + self::$registered[$signalclass] = array(); + } + if( !array_key_exists( $signalname, self::$registered[$signalclass] )){ + self::$registered[$signalclass][$signalname] = array(); + } + + // register hook + self::$registered[$signalclass][$signalname][] = array( + "class" => $slotclass, + "name" => $slotname ); + + // No chance for failure ;-) + return true; + } + + /** + * @brief emitts a signal + * @param $signalclass class name of emitter + * @param $signalname name of signal + * @param $params defautl: array() array with additional data + * @returns true if slots exists or false if not + * + * Emits a signal. To get data from the slot use references! + * + * TODO: write example + */ + static public function emit( $signalclass, $signalname, $params = array()){ + // Return false if there are no slots + if( !array_key_exists( $signalclass, self::$registered )){ + return false; + } + if( !array_key_exists( $signalname, self::$registered[$signalclass] )){ + return false; + } + + // Call all slots + foreach( self::$registered[$signalclass][$signalname] as $i ){ + call_user_func( array( $i["class"], $i["name"] ), $params ); + } + + // return true + return true; + } +} +?> diff --git a/lib/config.php b/lib/config.php new file mode 100644 index 0000000000000000000000000000000000000000..6af9fcbe5ada3ddf34e3aafa03f70ee93871aa6e --- /dev/null +++ b/lib/config.php @@ -0,0 +1,188 @@ +<?php +/** + * ownCloud + * + * @author Frank Karlitschek + * @author Jakob Sack + * @copyright 2010 Frank Karlitschek karlitschek@kde.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ +/* + * + * An example of config.php + * + * <?php + * $CONFIG = array( + * "database" => "mysql", + * "firstrun" => false, + * "pi" => 3.14 + * ); + * ?> + * + */ + +/** + * This class is responsible for reading and writing config.php, the very basic + * configuration file of owncloud. + */ +class OC_CONFIG{ + // associative array key => value + private static $cache = array(); + + // Is the cache filled? + private static $init = false; + + /** + * @brief Lists all available config keys + * @returns array with key names + * + * This function returns all keys saved in config.php. Please note that it + * does not return the values. + */ + public static function getKeys(){ + self::readData(); + + return array_keys( self::$cache ); + } + + /** + * @brief Gets a value from config.php + * @param $key key + * @param $default = null default value + * @returns the value or $default + * + * This function gets the value from config.php. If it does not exist, + * $default will be returned. + */ + public static function getValue( $key, $default = null ){ + self::readData(); + + if( array_key_exists( $key, self::$cache )){ + return self::$cache[$key]; + } + + return $default; + } + + /** + * @brief Sets a value + * @param $key key + * @param $value value + * @returns true/false + * + * This function sets the value and writes the config.php. If the file can + * not be written, false will be returned. + */ + public static function setValue( $key, $value ){ + self::readData(); + + // Add change + self::$cache[$key] = $value; + + // Write changes + self::writeData(); + + return true; + } + + /** + * @brief Removes a key from the config + * @param $key key + * @returns true/false + * + * This function removes a key from the config.php. If owncloud has no + * write access to config.php, the function will return false. + */ + public static function deleteKey( $key ){ + self::readData(); + + if( array_key_exists( $key, self::$cache )){ + // Delete key from cache + unset( self::$cache[$key] ); + + // Write changes + self::writeData(); + } + + return true; + } + + /** + * @brief Loads the config file + * @returns true/false + * + * Reads the config file and saves it to the cache + */ + private static function readData(){ + if( self::$init ){ + return true; + } + + global $SERVERROOT; + + if( !file_exists( "$SERVERROOT/config/config.php" )){ + return false; + } + + // Include the file, save the data from $CONFIG + include( "$SERVERROOT/config/config.php" ); + if( isset( $CONFIG ) || is_array( $CONFIG )){ + self::$cache = $CONFIG; + } + + // We cached everything + self::$init = true; + + return true; + } + + /** + * @brief Writes the config file + * @returns true/false + * + * Saves the config to the config file. + * + * Known flaws: Strings are not escaped properly + */ + public static function writeData(){ + // We need the serverroot path + global $SERVERROOT; + + // Create a php file ... + $content = "<?php\n\$CONFIG = array(\n"; + + foreach( self::$cache as $key => $value ){ + if( is_bool( $value )){ + $value = $value ? 'true' : 'false'; + $content .= "\"$key\" => $value,\n"; + } + elseif( is_numeric( $value )){ + $content .= "\"$key\" => $value,\n"; + } + else{ + $value = str_replace( "'", "\\'", $value ); + $content .= "\"$key\" => '$value',\n"; + } + } + $content .= ");\n?>\n"; + + // Write the file + file_put_contents( "$SERVERROOT/config/config.php", $content ); + + return true; + } +} +?> diff --git a/inc/lib_connect.php b/lib/connect.php similarity index 92% rename from inc/lib_connect.php rename to lib/connect.php index 695ae482451f724d58ee54863f0b6420b6b96e1f..6fc8f2165cf51043066b62ceb80acb088a111ca7 100644 --- a/inc/lib_connect.php +++ b/lib/connect.php @@ -3,22 +3,22 @@ /** * ownCloud * -* @author Frank Karlitschek -* @copyright 2010 Frank Karlitschek karlitschek@kde.org -* +* @author Frank Karlitschek +* @copyright 2010 Frank Karlitschek karlitschek@kde.org +* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either +* License as published by the Free Software Foundation; either * version 3 of the License, or any later version. -* +* * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public +* +* You should have received a copy of the GNU Affero General Public * License along with this library. If not, see <http://www.gnu.org/licenses/>. -* +* */ /** @@ -27,7 +27,7 @@ */ class OC_CONNECT{ static private $clouds=array(); - + static function connect($path,$user,$password){ $cloud=new OC_REMOTE_CLOUD($path,$user,$password); if($cloud->connected){ @@ -48,7 +48,7 @@ class OC_REMOTE_CLOUD{ private $path; private $connected=false; private $cookiefile=false; - + /** * make an api call to the remote cloud * @param string $action @@ -72,8 +72,8 @@ class OC_REMOTE_CLOUD{ curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_POST,count($parameters)); curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string); - curl_setopt($ch, CURLOPT_COOKIEFILE,$this->cookiefile); - curl_setopt($ch, CURLOPT_COOKIEJAR,$this->cookiefile); + curl_setopt($ch, CURLOPT_COOKIEFILE,$this->cookiefile); + curl_setopt($ch, CURLOPT_COOKIEJAR,$this->cookiefile); curl_setopt($ch,CURLOPT_RETURNTRANSFER,true); $result=curl_exec($ch); $result=trim($result); @@ -86,12 +86,12 @@ class OC_REMOTE_CLOUD{ return false; } } - + public function __construct($path,$user,$password){ $this->path=$path; $this->connected=$this->apiCall('login',array('username'=>$user,'password'=>$password)); } - + /** * check if we are stull logged in on the remote cloud * @@ -102,14 +102,14 @@ class OC_REMOTE_CLOUD{ } return $this->apiCall('checklogin'); } - + public function __get($name){ switch($name){ case 'connected': return $this->connected; } } - + /** * disconnect from the remote cloud * @@ -121,7 +121,7 @@ class OC_REMOTE_CLOUD{ } $this->cookiefile=false; } - + /** * create a new file or directory * @param string $dir @@ -134,7 +134,7 @@ class OC_REMOTE_CLOUD{ } return $this->apiCall('new',array('dir'=>$dir,'name'=>$name,'type'=>$type),true); } - + /** * deletes a file or directory * @param string $dir @@ -146,7 +146,7 @@ class OC_REMOTE_CLOUD{ } return $this->apiCall('delete',array('dir'=>$dir,'file'=>$name),true); } - + /** * moves a file or directory * @param string $sorceDir @@ -160,7 +160,7 @@ class OC_REMOTE_CLOUD{ } return $this->apiCall('move',array('sourcedir'=>$sourceDir,'source'=>$sourceFile,'targetdir'=>$targetDir,'target'=>$targetFile),true); } - + /** * copies a file or directory * @param string $sorceDir @@ -174,7 +174,7 @@ class OC_REMOTE_CLOUD{ } return $this->apiCall('copy',array('sourcedir'=>$sourceDir,'source'=>$sourceFile,'targetdir'=>$targetDir,'target'=>$targetFile),true); } - + /** * get a file tree * @param string $dir @@ -185,7 +185,7 @@ class OC_REMOTE_CLOUD{ } return $this->apiCall('gettree',array('dir'=>$dir),true); } - + /** * get the files inside a directory of the remote cloud * @param string $dir @@ -196,7 +196,7 @@ class OC_REMOTE_CLOUD{ } return $this->apiCall('getfiles',array('dir'=>$dir),true); } - + /** * get a remove file and save it in a temporary file and return the path of the temporary file * @param string $dir @@ -215,28 +215,28 @@ class OC_REMOTE_CLOUD{ $fp=fopen($tmpfile,'w+'); $url=$this->path.="/files/api.php?action=get&dir=$dir&file=$file"; curl_setopt($ch,CURLOPT_URL,$url); - curl_setopt($ch, CURLOPT_COOKIEFILE,$this->cookiefile); - curl_setopt($ch, CURLOPT_COOKIEJAR,$this->cookiefile); + curl_setopt($ch, CURLOPT_COOKIEFILE,$this->cookiefile); + curl_setopt($ch, CURLOPT_COOKIEJAR,$this->cookiefile); curl_setopt($ch, CURLOPT_FILE, $fp); curl_exec($ch); fclose($fp); curl_close($ch); return $tmpfile; } - + public function sendFile($sourceDir,$sourceFile,$targetDir,$targetFile){ global $WEBROOT; $source=$sourceDir.'/'.$sourceFile; $tmp=OC_FILESYSTEM::toTmpFile($source); return $this->sendTmpFile($tmp,$targetDir,$targetFile); } - + public function sendTmpFile($tmp,$targetDir,$targetFile){ $token=sha1(uniqid().$tmp); global $WEBROOT; $file=sys_get_temp_dir().'/'.'remoteCloudFile'.$token; rename($tmp,$file); - if((isset($CONFIG_HTTPFORCESSL) and $CONFIG_HTTPFORCESSL) or isset($_SERVER['HTTPS']) and $_SERVER['HTTPS'] == 'on') { + if( OC_CONFIG::getValue( "forcessl", false ) or isset($_SERVER['HTTPS']) and $_SERVER['HTTPS'] == 'on') { $url = "https://". $_SERVER['SERVER_NAME'] . $WEBROOT; }else{ $url = "http://". $_SERVER['SERVER_NAME'] . $WEBROOT; diff --git a/lib/database.php b/lib/database.php new file mode 100644 index 0000000000000000000000000000000000000000..728e73590407416e3d0586b8937c312ec319d064 --- /dev/null +++ b/lib/database.php @@ -0,0 +1,325 @@ +<?php +/** + * ownCloud + * + * @author Frank Karlitschek + * @copyright 2010 Frank Karlitschek karlitschek@kde.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ + +/** + * This class manages the access to the database. It basically is a wrapper for + * MDB2 with some adaptions. + */ +class OC_DB { + static private $DBConnection=false; + static private $schema=false; + static private $affected=0; + static private $result=false; + + /** + * @brief connects to the database + * @returns true if connection can be established or nothing (die()) + * + * Connects to the database as specified in config.php + */ + static public function connect(){ + // The global data we need + $CONFIG_DBNAME = OC_CONFIG::getValue( "dbname", "owncloud" );; + $CONFIG_DBHOST = OC_CONFIG::getValue( "dbhost", "" );; + $CONFIG_DBUSER = OC_CONFIG::getValue( "dbuser", "" );; + $CONFIG_DBPASSWORD = OC_CONFIG::getValue( "dbpassword", "" );; + $CONFIG_DBTYPE = OC_CONFIG::getValue( "dbtype", "sqlite" );; + global $SERVERROOT; + $datadir=OC_CONFIG::getValue( "datadirectory", "$SERVERROOT/data" ); + + // do nothing if the connection already has been established + if(!self::$DBConnection){ + // Require MDB2.php (not required in the head of the file so we only load it when needed) + require_once('MDB2.php'); + + // Prepare options array + $options = array( + 'portability' => MDB2_PORTABILITY_ALL, + 'log_line_break' => '<br>', + 'idxname_format' => '%s', + 'debug' => true, + 'quote_identifier' => true ); + + // Add the dsn according to the database type + if( $CONFIG_DBTYPE == 'sqlite' ){ + // sqlite + $dsn = array( + 'phptype' => 'sqlite', + 'database' => "$datadir/$CONFIG_DBNAME.db", + 'mode' => '0644' ); + } + elseif( $CONFIG_DBTYPE == 'mysql' ){ + // MySQL + $dsn = array( + 'phptype' => 'mysql', + 'username' => $CONFIG_DBUSER, + 'password' => $CONFIG_DBPASSWORD, + 'hostspec' => $CONFIG_DBHOST, + 'database' => $CONFIG_DBNAME ); + } + elseif( $CONFIG_DBTYPE == 'pgsql' ){ + // PostgreSQL + $dsn = array( + 'phptype' => 'pgsql', + 'username' => $CONFIG_DBUSER, + 'password' => $CONFIG_DBPASSWORD, + 'hostspec' => $CONFIG_DBHOST, + 'database' => $CONFIG_DBNAME ); + } + + // Try to establish connection + self::$DBConnection = MDB2::factory( $dsn, $options ); + + // Die if we could not connect + if( PEAR::isError( self::$DBConnection )){ + echo( '<b>can not connect to database, using '.$CONFIG_DBTYPE.'. ('.self::$DBConnection->getUserInfo().')</center>'); + $error = self::$DBConnection->getMessage(); + error_log( $error); + error_log( self::$DBConnection->getUserInfo()); + die( $error ); + } + + // We always, really always want associative arrays + self::$DBConnection->setFetchMode(MDB2_FETCHMODE_ASSOC); + } + + // we are done. great! + return true; + } + + /** + * @brief SQL query + * @param $query Query string + * @returns result as MDB2_Result + * + * SQL query via MDB2 query() + */ + static public function query( $query ){ + // Optimize the query + $query = self::processQuery( $query ); + + self::connect(); + //fix differences between sql versions + + // return the result + $result = self::$DBConnection->exec( $query ); + + // Die if we have an error (error means: bad query, not 0 results!) + if( PEAR::isError($result)) { + $entry = 'DB Error: "'.$result->getMessage().'"<br />'; + $entry .= 'Offending command was: '.$cmd.'<br />'; + error_log( $entry ); + die( $entry ); + } + + return $result; + } + + /** + * @brief Prepare a SQL query + * @param $query Query string + * @returns prepared SQL query + * + * SQL query via MDB2 prepare(), needs to be execute()'d! + */ + static public function prepare( $query ){ + // Optimize the query + $query = self::processQuery( $query ); + + self::connect(); + // return the result + $result = self::$DBConnection->prepare( $query ); + + // Die if we have an error (error means: bad query, not 0 results!) + if( PEAR::isError($result)) { + $entry = 'DB Error: "'.$result->getMessage().'"<br />'; + $entry .= 'Offending command was: '.$query.'<br />'; + error_log( $entry ); + die( $entry ); + } + + return $result; + } + + /** + * @brief gets last value of autoincrement + * @returns id + * + * MDB2 lastInsertID() + * + * Call this method right after the insert command or other functions may + * cause trouble! + */ + public static function insertid(){ + self::connect(); + return self::$DBConnection->lastInsertID(); + } + + /** + * @brief Disconnect + * @returns true/false + * + * This is good bye, good bye, yeah! + */ + public static function disconnect(){ + // Cut connection if required + if(self::$DBConnection){ + self::$DBConnection->disconnect(); + self::$DBConnection=false; + } + + return true; + } + + /** + * @brief Escapes bad characters + * @param $string string with dangerous characters + * @returns escaped string + * + * MDB2 escape() + */ + public static function escape( $string ){ + self::connect(); + return self::$DBConnection->escape( $string ); + } + + /** + * @brief saves database scheme to xml file + * @param $file name of file + * @returns true/false + * + * TODO: write more documentation + */ + public static function getDbStructure( $file ){ + self::connectScheme(); + + // write the scheme + $definition = self::$schema->getDefinitionFromDatabase(); + $dump_options = array( + 'output_mode' => 'file', + 'output' => $file, + 'end_of_line' => "\n" + ); + self::$schema->dumpDatabase( $definition, $dump_options, MDB2_SCHEMA_DUMP_STRUCTURE ); + + return true; + } + + /** + * @brief Creates tables from XML file + * @param $file file to read structure from + * @returns true/false + * + * TODO: write more documentation + */ + public static function createDbFromStructure( $file ){ + $CONFIG_DBNAME = OC_CONFIG::getValue( "dbname", "owncloud" ); + $CONFIG_DBTABLEPREFIX = OC_CONFIG::getValue( "dbtableprefix", "oc_" ); + + self::connectScheme(); + + // read file + $content = file_get_contents( $file ); + + // Make changes and save them to a temporary file + $file2 = tempnam( sys_get_temp_dir(), 'oc_db_scheme_' ); + $content = str_replace( '*dbname*', $CONFIG_DBNAME, $content ); + $content = str_replace( '*dbprefix*', $CONFIG_DBTABLEPREFIX, $content ); + file_put_contents( $file2, $content ); + + // Try to create tables + $definition = self::$schema->parseDatabaseDefinitionFile( $file2 ); + + // Delete our temporary file + unlink( $file2 ); + + // Die in case something went wrong + if( $definition instanceof MDB2_Schema_Error ){ + die( $definition->getMessage().': '.$definition->getUserInfo()); + } +// if(OC_CONFIG::getValue('dbtype','sqlite')=='sqlite'){ +// $definition['overwrite']=true;//always overwrite for sqlite +// } + $ret=self::$schema->createDatabase( $definition ); + + // Die in case something went wrong + if( $ret instanceof MDB2_Error ){ + die ($ret->getMessage() . ': ' . $ret->getUserInfo()); + } + + return true; + } + + /** + * @brief connects to a MDB2 database scheme + * @returns true/false + * + * Connects to a MDB2 database scheme + */ + private static function connectScheme(){ + // We need a database connection + self::connect(); + + // Connect if this did not happen before + if(!self::$schema){ + require_once('MDB2/Schema.php'); + self::$schema=MDB2_Schema::factory(self::$DBConnection); + } + + return true; + } + + /** + * @brief does minor chages to query + * @param $query Query string + * @returns corrected query string + * + * This function replaces *PREFIX* with the value of $CONFIG_DBTABLEPREFIX + * and replaces the ` woth ' or " according to the database driver. + */ + private static function processQuery( $query ){ + // We need Database type and table prefix + $CONFIG_DBTYPE = OC_CONFIG::getValue( "dbtype", "sqlite" ); + $CONFIG_DBTABLEPREFIX = OC_CONFIG::getValue( "dbtableprefix", "oc_" ); + + // differences is getting the current timestamp + if( $CONFIG_DBTYPE == 'sqlite' ){ + $query = str_replace( 'NOW()', "strftime('%s', 'now')", $query ); + $query = str_replace( 'now()', "strftime('%s', 'now')", $query ); + } + + // differences in escaping of table names (` for mysql) + // Problem: what if there is a ` in the value we want to insert? + if( $CONFIG_DBTYPE == 'sqlite' ){ + $query = str_replace( '`', '\'', $query ); + } + elseif( $CONFIG_DBTYPE == 'pgsql' ){ + $query = str_replace( '`', '"', $query ); + } + + // replace table name prefix + $query = str_replace( '*PREFIX*', $CONFIG_DBTABLEPREFIX, $query ); + + return $query; + } +} +?> \ No newline at end of file diff --git a/inc/lib_files.php b/lib/files.php similarity index 86% rename from inc/lib_files.php rename to lib/files.php index 5ec934a47a2f519a80106dbcc51671a42df17b11..9e66f9dab827a985fec04d34ac48a2df087ccd36 100644 --- a/inc/lib_files.php +++ b/lib/files.php @@ -21,7 +21,7 @@ * */ -oc_require_once("lib_log.php"); +require_once("log.php"); /** @@ -64,6 +64,7 @@ class OC_FILES { $file['directory']=$directory; $stat=OC_FILESYSTEM::stat($directory.'/'.$filename); $file=array_merge($file,$stat); + $file['size']=OC_FILESYSTEM::filesize($directory.'/'.$filename); $file['mime']=OC_FILES::getMimeType($directory .'/'. $filename); $file['readable']=OC_FILESYSTEM::is_readable($directory .'/'. $filename); $file['writeable']=OC_FILESYSTEM::is_writeable($directory .'/'. $filename); @@ -78,8 +79,8 @@ class OC_FILES { closedir($dh); } } - ksort($dirs); - ksort($files); + uksort($dirs, "strnatcasecmp"); + uksort($files, "strnatcasecmp"); $content=array_merge($dirs,$files); if($filesfound){ return $content; @@ -94,12 +95,13 @@ class OC_FILES { * return the content of a file or return a zip file containning multiply files * * @param dir $dir - * @param file $file + * @param file $file ; seperated list of files to download */ public static function get($dir,$files){ if(strpos($files,';')){ $files=explode(';',$files); } + echo 't'; if(is_array($files)){ $zip = new ZipArchive(); $filename = sys_get_temp_dir()."/ownCloud.zip"; @@ -131,7 +133,7 @@ class OC_FILES { $filename=$dir.'/'.$files; } if($zip or OC_FILESYSTEM::is_readable($filename)){ - header('Content-Disposition: attachment; filename="'.basename($filename).'"'); + header('Content-Disposition: attachment; filename='.basename($filename)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); @@ -145,13 +147,16 @@ class OC_FILES { } }elseif($zip or !OC_FILESYSTEM::file_exists($filename)){ header("HTTP/1.0 404 Not Found"); - die('404 Not Found'); + $tmpl = new OC_TEMPLATE( '', '404', 'guest' ); + $tmpl->assign('file',$filename); + $tmpl->printPage(); +// die('404 Not Found'); }else{ header("HTTP/1.0 403 Forbidden"); die('403 Forbidden'); } ob_end_clean(); - OC_LOG::event($_SESSION['username'],3,"$dir/$files"); +// OC_LOG::event($_SESSION['username'],3,"$dir/$files"); if($zip){ readfile($filename); unlink($filename); @@ -213,7 +218,7 @@ class OC_FILES { $fileHandle=OC_FILESYSTEM::fopen($file, 'w'); if($fileHandle){ fclose($fileHandle); - OC_LOG::event($_SESSION['username'],4,"$dir/$name"); +// OC_LOG::event($_SESSION['username'],4,"$dir/$name"); return true; }else{ return false; @@ -248,7 +253,7 @@ class OC_FILES { static function getMimeType($path){ return OC_FILESYSTEM::getMimeType($path); } - + /** * get a file tree * @@ -258,7 +263,7 @@ class OC_FILES { static function getTree($path){ return OC_FILESYSTEM::getTree($path); } - + /** * pull a file from a remote server * @param string source @@ -286,6 +291,24 @@ class OC_FILES { return false; } } + + /** + * set the maximum upload size limit for apache hosts using .htaccess + * @param int size filesisze in bytes + */ + static function setUploadLimit($size){ + global $SERVERROOT; + global $WEBROOT; + $size=OC_HELPER::humanFileSize($size); + echo $size; + $size=substr($size,0,-1);//strip the B + $size=str_replace(' ','',$size); //remove the space between the size and the postfix + $content = "ErrorDocument 404 /$WEBROOT/templates/404.php\n";//custom 404 error page + $content.= "php_value upload_max_filesize $size\n";//upload limit + $content.= "php_value post_max_size $size\n"; + $content.= "SetEnv htaccessWorking true\n"; + @file_put_contents($SERVERROOT.'/.htaccess', $content); //supress errors in case we don't have permissions for it + } } function zipAddDir($dir,$zip,$internalDir=''){ @@ -306,24 +329,6 @@ function zipAddDir($dir,$zip,$internalDir=''){ } } -//remove a dir and it's content -function delTree($dir) { - if (!file_exists($dir)) return true; - if (!is_dir($dir) || is_link($dir)) return unlink($dir); - foreach (scandir($dir) as $item) { - if ($item == '.' || $item == '..') continue; - if(is_file($dir.'/'.$item)){ - unlink($dir.'/'.$item); - }elseif(is_dir($dir.'/'.$item)){ - if (!delTree($dir. "/" . $item)){ - return false; - }; - } - } - $return=rmdir($dir); - return $return; -} - if(!function_exists('sys_get_temp_dir')) { function sys_get_temp_dir() { if( $temp=getenv('TMP') ) return $temp; @@ -338,22 +343,6 @@ if(!function_exists('sys_get_temp_dir')) { } } -function recursive_copy($src,$dst) { - $dir = opendir($src); - @mkdir($dst); - while(false !== ( $file = readdir($dir)) ) { - if (( $file != '.' ) && ( $file != '..' )) { - if ( is_dir($src . '/' . $file) ) { - recursive_copy($src . '/' . $file,$dst . '/' . $file); - } - else { - copy($src . '/' . $file,$dst . '/' . $file); - } - } - } - closedir($dir); -} - global $FAKEDIRS; $FAKEDIRS=array(); @@ -361,7 +350,7 @@ class fakeDirStream{ private $name; private $data; private $index; - + public function dir_opendir($path,$options){ global $FAKEDIRS; $url=parse_url($path); @@ -374,7 +363,7 @@ class fakeDirStream{ } return true; } - + public function dir_readdir(){ if($this->index>=count($this->data)){ return false; @@ -383,7 +372,7 @@ class fakeDirStream{ $this->index++; return $filename; } - + public function dir_closedir() { $this->data=false; $this->name=''; @@ -396,4 +385,4 @@ class fakeDirStream{ } } stream_wrapper_register("fakedir", "fakeDirStream"); -?> \ No newline at end of file +?> diff --git a/inc/lib_filestorage.php b/lib/filestorage.php similarity index 72% rename from inc/lib_filestorage.php rename to lib/filestorage.php index 68f232d3a607681b9cc2da721e5acc6a53c643a3..d4db77f2c89762124279f53736e4818f33cd202e 100644 --- a/inc/lib_filestorage.php +++ b/lib/filestorage.php @@ -24,27 +24,6 @@ * Privde a common interface to all different storage options */ class OC_FILESTORAGE{ - private $observers=array(); - /** - * add an observer to the list - * @param OC_FILEOBERSER observer - */ - public function addObserver($observer){ - $this->observers[]=$observer; - } - /** - * notify the observers about an action - * @param int action a combination of OC_FILEACTION_WRITE and OC_FILEACTION_READ - * @param string path relative path of the file - */ - public function notifyObservers($path,$action){ - foreach($this->observers as $observer){ - if($observer->mask & $action){ - $observer->notify($path,$action,$this); - } - } - } - public function __construct($parameters){} public function mkdir($path){} public function rmdir($path){} @@ -69,11 +48,14 @@ class OC_FILESTORAGE{ public function fopen($path,$mode){} public function toTmpFile($path){}//copy the file to a temporary file, used for cross-storage file actions public function fromTmpFile($tmpPath,$path){}//copy a file from a temporary file, used for cross-storage file actions + public function fromUploadedFile($tmpPath,$path){}//copy a file from a temporary file, used for cross-storage file actions public function getMimeType($path){} public function delTree($path){} public function find($path){} public function getTree($path){} public function hash($type,$path,$raw){} + public function free_space($path){} + public function search($query){} } @@ -91,21 +73,18 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{ } public function mkdir($path){ if($return=mkdir($this->datadir.$path)){ - $this->notifyObservers($path,OC_FILEACTION_CREATE); + $this->clearFolderSizeCache($path); } return $return; } public function rmdir($path){ if($return=rmdir($this->datadir.$path)){ - $this->notifyObservers($path,OC_FILEACTION_DELETE); + $this->clearFolderSizeCache($path); } return $return; } public function opendir($path){ - if($return=opendir($this->datadir.$path)){ - $this->notifyObservers($path,OC_FILEACTION_READ); - } - return $return; + return opendir($this->datadir.$path); } public function is_dir($path){ return (is_dir($this->datadir.$path) or substr($path,-1)=='/'); @@ -124,7 +103,11 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{ return $filetype; } public function filesize($path){ - return filesize($this->datadir.$path); + if($this->is_dir($path)){ + return $this->getFolderSize($path); + }else{ + return filesize($this->datadir.$path); + } } public function is_readable($path){ return is_readable($this->datadir.$path); @@ -136,10 +119,7 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{ return file_exists($this->datadir.$path); } public function readfile($path){ - if($return=readfile($this->datadir.$path)){ - $this->notifyObservers($path,OC_FILEACTION_READ); - } - return $return; + return readfile($this->datadir.$path); } public function filectime($path){ return filectime($this->datadir.$path); @@ -151,25 +131,23 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{ return fileatime($this->datadir.$path); } public function file_get_contents($path){ - if($return=file_get_contents($this->datadir.$path)){ - $this->notifyObservers($path,OC_FILEACTION_READ); - } - return $return; + return file_get_contents($this->datadir.$path); } public function file_put_contents($path,$data){ if($return=file_put_contents($this->datadir.$path,$data)){ - $this->notifyObservers($path,OC_FILEACTION_WRITE); + $this->clearFolderSizeCache($path); } } public function unlink($path){ if($return=unlink($this->datadir.$path)){ - $this->notifyObservers($path,OC_FILEACTION_DELETE); + $this->clearFolderSizeCache($path); } return $return; } public function rename($path1,$path2){ if($return=rename($this->datadir.$path1,$this->datadir.$path2)){ - $this->notifyObservers($path1.'->'.$path2,OC_FILEACTION_RENAME); + $this->clearFolderSizeCache($path1); + $this->clearFolderSizeCache($path2); } return $return; } @@ -182,7 +160,7 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{ $path2.=$source; } if($return=copy($this->datadir.$path1,$this->datadir.$path2)){ - $this->notifyObservers($path2,OC_FILEACTION_CREATE); + $this->clearFolderSizeCache($path2); } return $return; } @@ -190,18 +168,17 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{ if($return=fopen($this->datadir.$path,$mode)){ switch($mode){ case 'r': - $this->notifyObservers($path,OC_FILEACTION_READ); break; case 'r+': case 'w+': case 'x+': case 'a+': - $this->notifyObservers($path,OC_FILEACTION_READ | OC_FILEACTION_WRITE); + $this->clearFolderSizeCache($path); break; case 'w': case 'x': case 'a': - $this->notifyObservers($path,OC_FILEACTION_WRITE); + $this->clearFolderSizeCache($path); break; } } @@ -363,7 +340,6 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{ $fileStats = stat($this->datadir.$path); if(copy($this->datadir.$path,$filename)){ touch($filename, $fileStats['mtime'], $fileStats['atime']); - $this->notifyObservers($path,OC_FILEACTION_READ); return $filename; }else{ return false; @@ -374,7 +350,18 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{ $fileStats = stat($tmpFile); if(rename($tmpFile,$this->datadir.$path)){ touch($this->datadir.$path, $fileStats['mtime'], $fileStats['atime']); - $this->notifyObservers($path,OC_FILEACTION_CREATE); + $this->clearFolderSizeCache($path); + return true; + }else{ + return false; + } + } + + public function fromUploadedFile($tmpFile,$path){ + $fileStats = stat($tmpFile); + if(move_uploaded_file($tmpFile,$this->datadir.$path)){ + touch($this->datadir.$path, $fileStats['mtime'], $fileStats['atime']); + $this->clearFolderSizeCache($path); return true; }else{ return false; @@ -390,7 +377,7 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{ if ($item == '.' || $item == '..') continue; if(is_file($dir.'/'.$item)){ if(unlink($dir.'/'.$item)){ - $this->notifyObservers($dir.'/'.$item,OC_FILEACTION_DELETE); + $this->clearFolderSizeCache($path); } }elseif(is_dir($dir.'/'.$item)){ if (!$this->delTree($dirRelative. "/" . $item)){ @@ -399,7 +386,7 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{ } } if($return=rmdir($dir)){ - $this->notifyObservers($dir,OC_FILEACTION_DELETE); + $this->clearFolderSizeCache($path); } return $return; } @@ -435,10 +422,107 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{ } public function hash($type,$path,$raw){ - if($return=hash_file($type,$this->datadir.$path,$raw)){ - $this->notifyObservers($path,OC_FILEACTION_READ); + return hash_file($type,$this->datadir.$path,$raw); + } + + public function free_space($path){ + return disk_free_space($this->datadir.$path); + } + + public function search($query){ + return $this->searchInDir($query); + } + + private function searchInDir($query,$dir=''){ + $files=array(); + foreach (scandir($this->datadir.$dir) as $item) { + if ($item == '.' || $item == '..') continue; + if(strstr(strtolower($item),strtolower($query))!==false){ + $files[]=$dir.'/'.$item; + } + if(is_dir($this->datadir.$dir.'/'.$item)){ + $files=array_merge($files,$this->searchInDir($query,$dir.'/'.$item)); + } + } + return $files; + } + + /** + * @brief get the size of folder and it's content + * @param string $path file path + * @return int size of folder and it's content + */ + public function getFolderSize($path){ + $path=str_replace('//','/',$path); + if($this->is_dir($path) and substr($path,-1)!='/'){ + $path.='/'; + } + $query=OC_DB::prepare("SELECT size FROM *PREFIX*foldersize WHERE path=?"); + $size=$query->execute(array($path))->fetchAll(); + if(count($size)>0){// we already the size, just return it + return $size[0]['size']; + }else{//the size of the folder isn't know, calulate it + return $this->calculateFolderSize($path); + } + } + + /** + * @brief calulate the size of folder and it's content and cache it + * @param string $path file path + * @return int size of folder and it's content + */ + public function calculateFolderSize($path){ + if($this->is_file($path)){ + $path=dirname($path); + } + $path=str_replace('//','/',$path); + if($this->is_dir($path) and substr($path,-1)!='/'){ + $path.='/'; + } + $size=0; + if ($dh = $this->opendir($path)) { + while (($filename = readdir($dh)) !== false) { + if($filename!='.' and $filename!='..'){ + $subFile=$path.'/'.$filename; + if($this->is_file($subFile)){ + $size+=$this->filesize($subFile); + }else{ + $size+=$this->getFolderSize($subFile); + } + } + } + if($size>0){ + $query=OC_DB::prepare("INSERT INTO *PREFIX*foldersize VALUES(?,?)"); + $result=$query->execute(array($path,$size)); + } + } + return $size; + } + + /** + * @brief clear the folder size cache of folders containing a file + * @param string $path + */ + public function clearFolderSizeCache($path){ + if($this->is_file($path)){ + $path=dirname($path); + } + $path=str_replace('//','/',$path); + if($this->is_dir($path) and substr($path,-1)!='/'){ + $path.='/'; + } + $query=OC_DB::prepare("DELETE FROM *PREFIX*foldersize WHERE path = ?"); + $result=$query->execute(array($path)); + if($path!='/' and $path!=''){ + $parts=explode('/',$path); + //pop empty part + $part=array_pop($parts); + if(empty($part)){ + array_pop($parts); + } + $parent=implode('/',$parts); + $this->clearFolderSizeCache($parent); } - return $return; } } ?> \ No newline at end of file diff --git a/inc/lib_filesystem.php b/lib/filesystem.php similarity index 77% rename from inc/lib_filesystem.php rename to lib/filesystem.php index 66da4fc3145f17f66f8bda572d491449c36871f1..2b5c3a56b6e3e90574649e8286fef6e484fad4f5 100644 --- a/inc/lib_filesystem.php +++ b/lib/filesystem.php @@ -26,6 +26,13 @@ * Class for abstraction of filesystem functions * This class won't call any filesystem functions for itself but but will pass them to the correct OC_FILESTORAGE object * this class should also handle all the file premission related stuff + * + * Hooks provided: + * read(path) + * write(path) + * create(path) (when a file is created both, write and create will be emited) + * delete(path) + * rename(oldpath,newpath) */ class OC_FILESYSTEM{ static private $storages=array(); @@ -187,20 +194,35 @@ class OC_FILESYSTEM{ } return $foundMountPoint; } + /** + * return the path to a local version of the file + * we need this because we can't know if a file is stored local or not from outside the filestorage and for some purposes a local file is needed + * @param string path + * @return string + */ + static public function getLocalFile($path){ + $parent=substr($path,0,strrpos($path,'/')); + if(self::canRead($parent) and $storage=self::getStorage($path)){ + return $storage->getLocalFile(self::getInternalPath($path)); + } + } static public function mkdir($path){ $parent=substr($path,0,strrpos($path,'/')); if(self::canWrite($parent) and $storage=self::getStorage($path)){ + OC_HOOK::emit( 'OC_FILESYSTEM', 'create', array( 'path' => $path)); return $storage->mkdir(self::getInternalPath($path)); } } static public function rmdir($path){ if(self::canWrite($path) and $storage=self::getStorage($path)){ + OC_HOOK::emit( 'OC_FILESYSTEM', 'delete', array( 'path' => $path)); return $storage->rmdir(self::getInternalPath($path)); } } static public function opendir($path){ if(self::canRead($path) and $storage=self::getStorage($path)){ + OC_HOOK::emit( 'OC_FILESYSTEM', 'read', array( 'path' => $path)); return $storage->opendir(self::getInternalPath($path)); } } @@ -237,6 +259,7 @@ class OC_FILESYSTEM{ } static public function readfile($path){ if(self::canRead($path) and $storage=self::getStorage($path)){ + OC_HOOK::emit( 'OC_FILESYSTEM', 'read', array( 'path' => $path)); return $storage->readfile(self::getInternalPath($path)); } } @@ -278,16 +301,22 @@ class OC_FILESYSTEM{ } static public function file_get_contents($path){ if(self::canRead($path) and $storage=self::getStorage($path)){ + OC_HOOK::emit( 'OC_FILESYSTEM', 'read', array( 'path' => $path)); return $storage->file_get_contents(self::getInternalPath($path)); } } static public function file_put_contents($path,$data){ if(self::canWrite($path) and $storage=self::getStorage($path)){ + OC_HOOK::emit( 'OC_FILESYSTEM', 'write', array( 'path' => $path)); + if(!self::file_exists($path)){ + OC_HOOK::emit( 'OC_FILESYSTEM', 'create', array( 'path' => $path)); + } return $storage->file_put_contents(self::getInternalPath($path),$data); } } static public function unlink($path){ if(self::canWrite($path) and $storage=self::getStorage($path)){ + OC_HOOK::emit( 'OC_FILESYSTEM', 'delete', array( 'path' => $path)); return $storage->unlink(self::getInternalPath($path)); } } @@ -305,6 +334,7 @@ class OC_FILESYSTEM{ $storage1->unlink(self::getInternalPath($path1)); return $result; } + OC_HOOK::emit( 'OC_FILESYSTEM', 'rename', array( 'oldpath' => $path1 ,'newpath'=>$path2)); } } static public function copy($path1,$path2){ @@ -319,26 +349,64 @@ class OC_FILESYSTEM{ $tmpFile=$storage1->toTmpFile(self::getInternalPath($path1)); return $storage2->fromTmpFile(self::getInternalPath($path2)); } + OC_HOOK::emit( 'OC_FILESYSTEM', 'create', array( 'path' => $path2)); } } static public function fopen($path,$mode){ $allowed=((strpos($path,'r')===false and strpos($path,'r+')!==false and self::canRead) or self::canWrite($path)); if($allowed){ if($storage=self::getStorage($path)){ + switch($mode){ + case 'r': + OC_HOOK::emit( 'OC_FILESYSTEM', 'read', array( 'path' => $path)); + break; + case 'r+': + case 'w+': + case 'x+': + case 'a+': + OC_HOOK::emit( 'OC_FILESYSTEM', 'read', array( 'path' => $path)); + OC_HOOK::emit( 'OC_FILESYSTEM', 'write', array( 'path' => $path)); + if(!self::file_exists($path)){ + OC_HOOK::emit( 'OC_FILESYSTEM', 'create', array( 'path' => $path)); + } + break; + case 'w': + case 'x': + case 'a': + OC_HOOK::emit( 'OC_FILESYSTEM', 'write', array( 'path' => $path)); + if(!self::file_exists($path)){ + OC_HOOK::emit( 'OC_FILESYSTEM', 'create', array( 'path' => $path)); + } + break; + } return $storage->fopen(self::getInternalPath($path),$mode); } } } static public function toTmpFile($path){ if(self::canRead($path) and $storage=self::getStorage($path)){ + OC_HOOK::emit( 'OC_FILESYSTEM', 'read', array( 'path' => $path)); return $storage->toTmpFile(self::getInternalPath($path)); } } static public function fromTmpFile($tmpFile,$path){ if(self::canWrite($path) and $storage=self::getStorage($path)){ + OC_HOOK::emit( 'OC_FILESYSTEM', 'write', array( 'path' => $path)); + if(!self::file_exists($path)){ + OC_HOOK::emit( 'OC_FILESYSTEM', 'create', array( 'path' => $path)); + } return $storage->fromTmpFile($tmpFile,self::getInternalPath($path)); } } + static public function fromUploadedFile($tmpFile,$path){ + if(self::canWrite($path) and $storage=self::getStorage($path)){ + OC_HOOK::emit( 'OC_FILESYSTEM', 'write', array( 'path' => $path)); + if(!self::file_exists($path)){ + OC_HOOK::emit( 'OC_FILESYSTEM', 'create', array( 'path' => $path)); + } + return $storage->fromUploadedFile($tmpFile,self::getInternalPath($path)); + } + } static public function getMimeType($path){ if(self::canRead($path) and $storage=self::getStorage($path)){ return $storage->getMimeType(self::getInternalPath($path)); @@ -346,6 +414,7 @@ class OC_FILESYSTEM{ } static public function delTree($path){ if(self::canWrite($path) and $storage=self::getStorage($path)){ + OC_HOOK::emit( 'OC_FILESYSTEM', 'delete', array( 'path' => $path)); return $storage->delTree(self::getInternalPath($path)); } } @@ -378,8 +447,30 @@ class OC_FILESYSTEM{ } static public function hash($type,$path,$raw=false){ if(self::canRead($path) and $storage=self::getStorage($path)){ + OC_HOOK::emit( 'OC_FILESYSTEM', 'read', array( 'path' => $path)); return $storage->hash($type,self::getInternalPath($path),$raw); } } + + static public function free_space($path='/'){ + if(self::canRead($path) and $storage=self::getStorage($path)){ + return $storage->free_space($path); + } + } + + static public function search($query){ + $files=array(); + $fakeRootLength=strlen(self::$fakeRoot); + foreach(self::$storages as $mountpoint=>$storage){ + $results=$storage->search($query); + foreach($results as $result){ + $file=str_replace('//','/',$mountpoint.$result); + $file=substr($file,$fakeRootLength); + $files[]=$file; + } + } + return $files; + + } } ?> diff --git a/lib/group.php b/lib/group.php new file mode 100644 index 0000000000000000000000000000000000000000..6510838ccfc47971bedd1c7016a423a5f0597f15 --- /dev/null +++ b/lib/group.php @@ -0,0 +1,238 @@ +<?php +/** + * ownCloud + * + * @author Frank Karlitschek + * @copyright 2010 Frank Karlitschek karlitschek@kde.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ + +/** + * This class provides all methods needed for managing groups. + * + * Hooks provided: + * pre_createGroup(&run, gid) + * post_createGroup(gid) + * pre_deleteGroup(&run, gid) + * post_deleteGroup(gid) + * pre_addToGroup(&run, uid, gid) + * post_addToGroup(uid, gid) + * pre_removeFromGroup(&run, uid, gid) + * post_removeFromGroup(uid, gid) + */ +class OC_GROUP { + // The backend used for user management + private static $_backend; + + // Backends available (except database) + private static $_backends = array(); + + /** + * @brief registers backend + * @param $name name of the backend + * @returns true/false + * + * Makes a list of backends that can be used by other modules + */ + public static function registerBackend( $name ){ + self::$_backends[] = $name; + return true; + } + + /** + * @brief gets available backends + * @returns array of backends + * + * Returns the names of all backends. + */ + public static function getBackends(){ + return self::$_backends; + } + + /** + * @brief set the group backend + * @param string $backend The backend to use for user managment + * @returns true/false + */ + public static function setBackend( $backend = 'database' ){ + // You'll never know what happens + if( null === $backend OR !is_string( $backend )){ + $backend = 'database'; + } + + // Load backend + switch( $backend ){ + case 'database': + case 'mysql': + case 'sqlite': + require_once('Group/database.php'); + self::$_backend = new OC_GROUP_DATABASE(); + break; + default: + $className = 'OC_GROUP_' . strToUpper($backend); + self::$_backend = new $className(); + break; + } + } + + /** + * @brief Try to create a new group + * @param $gid The name of the group to create + * @returns true/false + * + * Trys to create a new group. If the group name already exists, false will + * be returned. Basic checking of Group name + * + * Allowed characters in the username are: "a-z", "A-Z", "0-9" and "_.@-" + */ + public static function createGroup( $gid ){ + // Check the name for bad characters + // Allowed are: "a-z", "A-Z", "0-9" and "_.@-" + if( preg_match( '/[^a-zA-Z0-9 _\.@\-]/', $gid )){ + return false; + } + // No empty group names! + if( !$gid ){ + return false; + } + // No duplicate group names + if( in_array( $gid, self::getGroups())){ + return false; + } + + $run = true; + OC_HOOK::emit( "OC_GROUP", "pre_createGroup", array( "run" => &$run, "gid" => $gid )); + + if( $run && self::$_backend->createGroup( $gid )){ + OC_HOOK::emit( "OC_GROUP", "post_createGroup", array( "gid" => $gid )); + return true; + } + else{ + return false; + } + } + + /** + * @brief delete a group + * @param $gid gid of the group to delete + * @returns true/false + * + * Deletes a group and removes it from the group_user-table + */ + public static function deleteGroup( $gid ){ + // Prevent users from deleting group admin + if( $gid == "admin" ){ + return false; + } + + $run = true; + OC_HOOK::emit( "OC_GROUP", "pre_deleteGroup", array( "run" => &$run, "gid" => $gid )); + + if( $run && self::$_backend->deleteGroup( $gid )){ + OC_HOOK::emit( "OC_GROUP", "post_deleteGroup", array( "gid" => $gid )); + return true; + } + else{ + return false; + } + } + + /** + * @brief is user in group? + * @param $uid uid of the user + * @param $gid gid of the group + * @returns true/false + * + * Checks whether the user is member of a group or not. + */ + public static function inGroup( $uid, $gid ){ + return self::$_backend->inGroup($uid, $gid); + } + + /** + * @brief Add a user to a group + * @param $uid Name of the user to add to group + * @param $gid Name of the group in which add the user + * @returns true/false + * + * Adds a user to a group. + */ + public static function addToGroup( $uid, $gid ){ + // Does the user exist? + if( !in_array( $uid, OC_USER::getUsers())){ + return false; + } + // Does the group exist? + if( !in_array( $gid, self::getGroups())){ + return false; + } + + // Go go go + $run = true; + OC_HOOK::emit( "OC_GROUP", "pre_addToGroup", array( "run" => &$run, "uid" => $uid, "gid" => $gid )); + + if( $run && self::$_backend->addToGroup( $uid, $gid )){ + OC_HOOK::emit( "OC_GROUP", "post_addToGroup", array( "uid" => $uid, "gid" => $gid )); + return true; + } + else{ + return false; + } + } + + /** + * @brief Removes a user from a group + * @param $uid Name of the user to remove from group + * @param $gid Name of the group from which remove the user + * @returns true/false + * + * removes the user from a group. + */ + public static function removeFromGroup( $uid, $gid ){ + $run = true; + OC_HOOK::emit( "OC_GROUP", "pre_removeFromGroup", array( "run" => &$run, "uid" => $uid, "gid" => $gid )); + + if( $run && self::$_backend->removeFromGroup( $uid, $gid )){ + OC_HOOK::emit( "OC_GROUP", "post_removeFromGroup", array( "uid" => $uid, "gid" => $gid )); + return true; + } + else{ + return false; + } + } + + /** + * @brief Get all groups a user belongs to + * @param $uid Name of the user + * @returns array with group names + * + * This function fetches all groups a user belongs to. It does not check + * if the user exists at all. + */ + public static function getUserGroups( $uid ){ + return self::$_backend->getUserGroups($uid); + } + + /** + * @brief get a list of all groups + * @returns array with group names + * + * Returns a list with all groups + */ + public static function getGroups(){ + return self::$_backend->getGroups(); + } +} diff --git a/lib/helper.php b/lib/helper.php new file mode 100644 index 0000000000000000000000000000000000000000..072607f742ba3e6781e0798dd12d780f666fac8c --- /dev/null +++ b/lib/helper.php @@ -0,0 +1,253 @@ +<?php +/** + * ownCloud + * + * @author Frank Karlitschek + * @author Jakob Sack + * @copyright 2010 Frank Karlitschek karlitschek@kde.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ + +/** + * Collection of useful functions + */ +class OC_HELPER { + /** + * @brief Creates an url + * @param $app app + * @param $file file + * @returns the url + * + * Returns a url to the given app and file. + */ + public static function linkTo( $app, $file ){ + global $WEBROOT; + global $SERVERROOT; + + if(!empty($app)) { + $app .= '/'; + // Check if the app is in the app folder + if( file_exists( $SERVERROOT . '/apps/'. $app )){ + return $WEBROOT . '/apps/' . $app . $file; + } + } + return $WEBROOT . '/' . $app . $file; + } + + /** + * @brief Creates path to an image + * @param $app app + * @param $image image name + * @returns the url + * + * Returns the path to the image. + */ + public static function imagePath( $app, $image ){ + global $SERVERROOT; + global $WEBROOT; + // Check if the app is in the app folder + if( file_exists( "$SERVERROOT/apps/$app/img/$image" )){ + return "$WEBROOT/apps/$app/img/$image"; + } + if( !empty( $app )){ + return "$WEBROOT/$app/img/$image"; + }else{ + return "$WEBROOT/img/$image"; + } + } + + /** + * @brief get path to icon of mime type + * @param $mimetype mimetype + * @returns the url + * + * Returns the path to the image of this mime type. + */ + public static function mimetypeIcon( $mimetype ){ + global $SERVERROOT; + global $WEBROOT; + // Replace slash with a minus + $mimetype = str_replace( "/", "-", $mimetype ); + + // Is it a dir? + if( $mimetype == "dir" ){ + return "$WEBROOT/img/places/folder.png"; + } + + // Icon exists? + if( file_exists( "$SERVERROOT/img/mimetypes/$mimetype.png" )){ + return "$WEBROOT/img/mimetypes/$mimetype.png"; + } + else{ + return "$WEBROOT/img/mimetypes/file.png"; + } + } + + /** + * @brief Make a human file size + * @param $bytes file size in bytes + * @returns a human readable file size + * + * Makes 2048 to 2 kB. + */ + public static function humanFileSize( $bytes ){ + if( $bytes < 1024 ){ + return "$bytes B"; + } + $bytes = round( $bytes / 1024, 1 ); + if( $bytes < 1024 ){ + return "$bytes kB"; + } + $bytes = round( $bytes / 1024, 1 ); + if( $bytes < 1024 ){ + return "$bytes MB"; + } + + // Wow, heavy duty for owncloud + $bytes = round( $bytes / 1024, 1 ); + return "$bytes GB"; + } + + /** + * @brief Make a computer file size + * @param $str file size in a fancy format + * @returns a file size in bytes + * + * Makes 2kB to 2048. + * + * Inspired by: http://www.php.net/manual/en/function.filesize.php#92418 + */ + public static function computerFileSize( $str ){ + $bytes = 0; + + $bytes_array = array( + 'B' => 1, + 'K' => 1024, + 'KB' => 1024, + 'MB' => 1024 * 1024, + 'M' => 1024 * 1024, + 'GB' => 1024 * 1024 * 1024, + 'G' => 1024 * 1024 * 1024, + 'TB' => 1024 * 1024 * 1024 * 1024, + 'T' => 1024 * 1024 * 1024 * 1024, + 'PB' => 1024 * 1024 * 1024 * 1024 * 1024, + 'P' => 1024 * 1024 * 1024 * 1024 * 1024, + ); + + $bytes = floatval($str); + + if (preg_match('#([KMGTP]?B?)$#si', $str, $matches) && !empty($bytes_array[$matches[1]])) { + $bytes *= $bytes_array[$matches[1]]; + } + + $bytes = intval(round($bytes, 2)); + + return $bytes; + } + + /** + * @brief Recusive editing of file permissions + * @param $path path to file or folder + * @param $filemode unix style file permissions as integer + * + */ + static function chmodr($path, $filemode) { + if (!is_dir($path)) + return chmod($path, $filemode); + $dh = opendir($path); + while (($file = readdir($dh)) !== false) { + if($file != '.' && $file != '..') { + $fullpath = $path.'/'.$file; + if(is_link($fullpath)) + return FALSE; + elseif(!is_dir($fullpath) && !chmod($fullpath, $filemode)) + return FALSE; + elseif(!self::chmodr($fullpath, $filemode)) + return FALSE; + } + } + closedir($dh); + if(chmod($path, $filemode)) + return TRUE; + else + return FALSE; + } + + /** + * @brief Recusive copying of folders + * @param string $src source folder + * @param string $dest target folder + * + */ + static function copyr($src, $dest) { + if(is_dir($src)){ + if(!is_dir($dest)){ + mkdir($dest); + } + $files = scandir($src); + foreach ($files as $file){ + if ($file != "." && $file != ".."){ + self::copyr("$src/$file", "$dest/$file"); + } + } + }elseif(file_exists($src)){ + copy($src, $dest); + } + } + + /** + * @brief Recusive deletion of folders + * @param string $dir path to the folder + * + */ + static function rmdirr($dir) { + if(is_dir($dir)) { + $files=scandir($dir); + foreach($files as $file){ + if ($file != "." && $file != ".."){ + self::rmdirr("$dir/$file"); + } + } + rmdir($dir); + }elseif(file_exists($dir)){ + unlink($dir); + } + } + + /** + * @brief Checks $_REQUEST contains a var for the $s key. If so, returns the html-escaped value of this var; otherwise returns the default value provided by $d. + * @param $s name of the var to escape, if set. + * @param $d default value. + * @returns the print-safe value. + * + */ + + //FIXME: should also check for value validation (i.e. the email is an email). + public static function init_var($s, $d="") { + $r = $d; + if(isset($_REQUEST[$s]) && !empty($_REQUEST[$s])) + $r = stripslashes(htmlspecialchars($_REQUEST[$s])); + + return $r; + } + + public static function init_radio($s, $v, $d) { + if((isset($_REQUEST[$s]) && $_REQUEST[$s]==$v) || $v == $d) + print "checked=\"checked\" "; + } +} + +?> diff --git a/lib/installer.php b/lib/installer.php new file mode 100644 index 0000000000000000000000000000000000000000..7ab07bf50778d8fe373fa2e6ba9e1d21c2b9a3bd --- /dev/null +++ b/lib/installer.php @@ -0,0 +1,212 @@ +<?php +/** + * ownCloud + * + * @author Robin Appelman + * @copyright 2010 Frank Karlitschek karlitschek@kde.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ + +/** + * This class provides the functionality needed to install, update and remove plugins/apps + */ +class OC_INSTALLER{ + /** + * @brief Installs an app + * @param $data array with all information + * @returns integer + * + * This function installs an app. All information needed are passed in the + * associative array $data. + * The following keys are required: + * - source: string, can be "path" or "http" + * + * One of the following keys is required: + * - path: path to the file containing the app + * - href: link to the downloadable file containing the app + * + * The following keys are optional: + * - pretend: boolean, if set true the system won't do anything + * - noinstall: boolean, if true appinfo/install.php won't be loaded + * - inactive: boolean, if set true the appconfig/app.sample.php won't be + * renamed + * + * This function works as follows + * -# fetching the file + * -# unzipping it + * -# installing the database at appinfo/database.xml + * -# including appinfo/install.php + * -# setting the installed version + * + * It is the task of oc_app_install to create the tables and do whatever is + * needed to get the app working. + */ + public static function installApp( $data = array()){ + global $SERVERROOT; + + if(!isset($data['source'])){ + error_log("No source specified when installing app"); + return; + } + + //download the file if necesary + if($data['source']=='http'){ + $path=tempnam(sys_get_temp_dir(),'oc_installer_'); + if(!isset($data['href'])){ + error_log("No href specified when installing app from http"); + return; + } + copy($data['href'],$path); + }else{ + if(!isset($data['path'])){ + error_log("No path specified when installing app from local file"); + return; + } + $path=$data['path']; + } + + //extract the archive in a temporary folder + $extractDir=tempnam(sys_get_temp_dir(),'oc_installer_uncompressed_'); + unlink($extractDir); + mkdir($extractDir); + $zip = new ZipArchive; + if($zip->open($path)===true){ + $zip->extractTo($extractDir); + $zip->close(); + } else { + error_log("Failed to open archive when installing app"); + OC_HELPER::rmdirr($extractDir); + if($data['source']=='http'){ + unlink($path); + } + return; + } + + //load the info.xml file of the app + if(!is_file($extractDir.'/appinfo/info.xml')){ + error_log("App does not provide an info.xml file"); + OC_HELPER::rmdirr($extractDir); + if($data['source']=='http'){ + unlink($path); + } + return; + } + $info=OC_APP::getAppInfo($extractDir.'/appinfo/info.xml'); + $basedir=$SERVERROOT.'/apps/'.$info['id']; + + //check if an app with the same id is already installed + if(is_dir($basedir)){ + error_log("App already installed"); + OC_HELPER::rmdirr($extractDir); + if($data['source']=='http'){ + unlink($path); + } + return; + } + + if(isset($data['pretent']) and $data['pretent']==true){ + return; + } + + //copy the app to the correct place + if(!mkdir($basedir)){ + error_log('Can\'t create app folder ('.$basedir.')'); + OC_HELPER::rmdirr($extractDir); + if($data['source']=='http'){ + unlink($path); + } + return; + } + OC_HELPER::copyr($extractDir,$basedir); + + //remove temporary files + OC_HELPER::rmdirr($extractDir); + if($data['source']=='http'){ + unlink($path); + } + + //install the database + if(is_file($basedir.'/appinfo/database.xml')){ + OC_DB::createDbFromStructure($basedir.'/appinfo/database.xml'); + } + + //run appinfo/install.php + if(!isset($data['noinstall']) or $data['noinstall']==false and is_file($basedir.'/appinfo/install.php')){ + include($basedir.'/appinfo/install.php'); + } + + //set the installed version + OC_APPCONFIG::setValue($info['id'],'installed_version',$info['version']); + return true; + } + + /** + * @brief Update an application + * @param $data array with all information + * @returns integer + * + * This function installs an app. All information needed are passed in the + * associative array $data. + * The following keys are required: + * - source: string, can be "path" or "http" + * + * One of the following keys is required: + * - path: path to the file containing the app + * - href: link to the downloadable file containing the app + * + * The following keys are optional: + * - pretend: boolean, if set true the system won't do anything + * - noupgrade: boolean, if true appinfo/upgrade.php won't be loaded + * + * This function works as follows + * -# fetching the file + * -# removing the old files + * -# unzipping new file + * -# including appinfo/upgrade.php + * -# setting the installed version + * + * upgrade.php can determine the current installed version of the app using "OC_APPCONFIG::getValue($appid,'installed_version')" + */ + public static function upgradeApp( $data = array()){ + // TODO: write function + return true; + } + + /** + * @brief Removes an app + * @param $name name of the application to remove + * @param $options array with options + * @returns true/false + * + * This function removes an app. $options is an associative array. The + * following keys are optional:ja + * - keeppreferences: boolean, if true the user preferences won't be deleted + * - keepappconfig: boolean, if true the config will be kept + * - keeptables: boolean, if true the database will be kept + * - keepfiles: boolean, if true the user files will be kept + * + * This function works as follows + * -# including appinfo/remove.php + * -# removing the files + * + * The function will not delete preferences, tables and the configuration, + * this has to be done by the function oc_app_uninstall(). + */ + public static function removeApp( $name, $options = array()){ + // TODO: write function + return true; + } +} diff --git a/lib/log.php b/lib/log.php new file mode 100644 index 0000000000000000000000000000000000000000..aebeba7d4b354bc84140af6bbb71163dfadbb49d --- /dev/null +++ b/lib/log.php @@ -0,0 +1,143 @@ +<?php +/** + * ownCloud + * + * @author Frank Karlitschek + * @author Jakob Sack + * @copyright 2010 Frank Karlitschek karlitschek@kde.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ +/* + * + * The following SQL statement is just a help for developers and will not be + * executed! + * + * CREATE TABLE `log` ( + * `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , + * `moment` DATETIME NOT NULL , + * `appid` VARCHAR( 255 ) NOT NULL , + * `user` VARCHAR( 255 ) NOT NULL , + * `action` VARCHAR( 255 ) NOT NULL , + * `info` TEXT NOT NULL + * ) ENGINE = MYISAM ; + * + */ + +/** + * This class is for logging + */ +class OC_LOG { + /** + * @brief adds an entry to the log + * @param $appid id of the app + * @param $subject username + * @param $predicate action + * @param $object = null; additional information + * @returns true/false + * + * This function adds another entry to the log database + */ + public static function add( $appid, $subject, $predicate, $object = ' ' ){ + $query=OC_DB::prepare("INSERT INTO *PREFIX*log(moment,appid,user,action,info) VALUES(NOW(),?,?,?,?)"); + $result=$query->execute(array($appid,$subject,$predicate,$object)); + // Die if we have an error + if( PEAR::isError($result)) { + $entry = 'DB Error: "'.$result->getMessage().'"<br />'; + $entry .= 'Offending command was: '.$query.'<br />'; + error_log( $entry ); + die( $entry ); + } + return true; + } + + /** + * @brief Fetches log entries + * @param $filter = array(); array with filter options + * @returns array with entries + * + * This function fetches the log entries according to the filter options + * passed. + * + * $filter is an associative array. + * The following keys are optional: + * - from: all entries after this date + * - until: all entries until this date + * - user: username (default: current user) + * - app: only entries for this app + */ + public static function get( $filter = array()){ + $queryString='SELECT * FROM *PREFIX*log WHERE 1=1 '; + $params=array(); + if(isset($filter['from'])){ + $queryString.='AND moment>? '; + array_push($params,$filter('from')); + } + if(isset($filter['until'])){ + $queryString.='AND moment<? '; + array_push($params,$filter('until')); + } + if(isset($filter['user'])){ + $queryString.='AND user=? '; + array_push($params,$filter('user')); + } + if(isset($filter['app'])){ + $queryString.='AND appid=? '; + array_push($params,$filter('app')); + } + $query=OC_DB::prepare($queryString); + $result=$query->execute($params)->fetchAll(); + if(count($result)>0 and is_numeric($result[0]['moment'])){ + foreach($result as &$row){ + $row['moment']=OC_UTIL::formatDate($row['moment']); + } + } + return $result; + + } + + /** + * @brief removes log entries + * @param $date delete entries older than this date + * @returns true/false + * + * This function deletes all entries that are older than $date. + */ + public static function deleteBefore( $date ){ + $query=OC_DB::prepare("DELETE FROM *PREFIX*log WHERE moment<?"); + $query->execute(array($date)); + return true; + } + + /** + * @brief filter an array of log entries on action + * @param array $logs the log entries to filter + * @param array $actions an array of actions to filter for + * @returns array + */ + public static function filterAction($logs,$actions){ + $filteredLogs=array(); + foreach($logs as $log){ + if(array_search($log['action'],$actions)!==false){ + $filteredLogs[]=$log; + } + } + return $filteredLogs; + } +} + + + +?> diff --git a/inc/lib_ocs.php b/lib/ocs.php similarity index 90% rename from inc/lib_ocs.php rename to lib/ocs.php index 2b1e706462a5deb2f67ab556b92c80f7d3abef1b..4e9e6522e8b067332a5aa5da9166342f42323c9d 100644 --- a/inc/lib_ocs.php +++ b/lib/ocs.php @@ -400,16 +400,16 @@ class OC_OCS { * @return string xml/json */ private static function activityGet($format,$page,$pagesize) { - global $CONFIG_DBTABLEPREFIX; - $user=OC_OCS::checkpassword(); - - $result = OC_DB::query("select count(*) as co from {$CONFIG_DBTABLEPREFIX}log"); + + $query = OC_DB::prepare('select count(*) as co from *PREFIX*log'); + $result = $query->execute(); $entry=$result->fetchRow(); $totalcount=$entry['co']; - OC_DB::free_result($result); - - $result = OC_DB::select("select id,timestamp,user,type,message from {$CONFIG_DBTABLEPREFIX}log order by timestamp desc limit " . ($page*$pagesize) . ",$pagesize"); + + $query=OC_DB::prepare('select id,timestamp,user,type,message from *PREFIX*log order by timestamp desc limit ?,?'); + $result = $query->execute(array(($page*$pagesize),$pagesize))->fetchAll(); + $itemscount=count($result); $url='http://'.substr($_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'],0,-11).''; @@ -512,24 +512,24 @@ class OC_OCS { * @return array */ public static function getData($user,$app="",$key="",$like=false) { - global $CONFIG_DBTABLEPREFIX; - $user=OC_DB::escape($user); - $key=OC_DB::escape($key); - $app=OC_DB::escape($app); $key="$user::$key";//ugly hack for the sake of keeping database scheme compatibiliy, needs to be replaced with a seperate user field the next time we break db compatibiliy $compareFunction=($like)?'LIKE':'='; if($app){ if (!trim($key)) { - $result = OC_DB::select("select app, `key`,value,`timestamp` from {$CONFIG_DBTABLEPREFIX}privatedata where app='$app' order by `timestamp` desc"); + $query = OC_DB::prepare('select app, `key`,value,`timestamp` from *PREFIX*privatedata where app=? order by `timestamp` desc'); + $result=$query->execute(array($app))->fetchAll(); } else { - $result = OC_DB::select("select app, `key`,value,`timestamp` from {$CONFIG_DBTABLEPREFIX}privatedata where app='$app' and `key` $compareFunction '$key' order by `timestamp` desc"); + $query = OC_DB::prepare("select app, `key`,value,`timestamp` from *PREFIX*privatedata where app=? and `key` $compareFunction ? order by `timestamp` desc"); + $result=$query->execute(array($app,$key))->fetchAll(); } }else{ if (!trim($key)) { - $result = OC_DB::select("select app, `key`,value,`timestamp` from {$CONFIG_DBTABLEPREFIX}privatedata order by `timestamp` desc"); + $query = OC_DB::prepare('select app, `key`,value,`timestamp` from *PREFIX*privatedata order by `timestamp` desc'); + $result=$query->execute()->fetchAll(); } else { - $result = OC_DB::select("select app, `key`,value,`timestamp` from {$CONFIG_DBTABLEPREFIX}privatedata where `key` $compareFunction '$key' order by `timestamp` desc"); + $query = OC_DB::prepare("select app, `key`,value,`timestamp` from *PREFIX*privatedata where `key` $compareFunction ? order by `timestamp` desc"); + $result=$query->execute(array($key))->fetchAll(); } } $result=self::trimKeys($result,$user); @@ -545,20 +545,18 @@ class OC_OCS { * @return bool */ public static function setData($user, $app, $key, $value) { - global $CONFIG_DBTABLEPREFIX; - $app=OC_DB::escape($app); - $key=OC_DB::escape($key); - $user=OC_DB::escape($user); - $value=OC_DB::escape($value); $key="$user::$key";//ugly hack for the sake of keeping database scheme compatibiliy - //TODO: prepared statements, locking tables, fancy stuff, error checking/handling - $result=OC_DB::select("select count(*) as co from {$CONFIG_DBTABLEPREFIX}privatedata where `key` = '$key' and app = '$app'"); + //TODO: locking tables, fancy stuff, error checking/handling + $query=OC_DB::prepare("select count(*) as co from *PREFIX*privatedata where `key` = ? and app = ?"); + $result=$query->execute(array($key,$app))->fetchAll(); $totalcount=$result[0]['co']; if ($totalcount != 0) { - $result = OC_DB::query("update {$CONFIG_DBTABLEPREFIX}privatedata set value='$value', `timestamp` = now() where `key` = '$key' and app = '$app'"); + $query=OC_DB::prepare("update *PREFIX*privatedata set value=?, `timestamp` = now() where `key` = ? and app = ?"); + } else { - $result = OC_DB::query("insert into {$CONFIG_DBTABLEPREFIX}privatedata(app, `key`, value, `timestamp`) values('$app', '$key', '$value', now())"); + $result = OC_DB::prepare("insert into *PREFIX*privatedata(value, `key`, app, `timestamp`) values(?, ?, ?, now())"); } + $result = $query->execute(array($value,$key,$app)); if (PEAR::isError($result)){ $entry='DB Error: "'.$result->getMessage().'"<br />'; error_log($entry); @@ -576,13 +574,10 @@ class OC_OCS { * @return string xml/json */ public static function deleteData($user, $app, $key) { - global $CONFIG_DBTABLEPREFIX; - $app=OC_DB::escape($app); - $key=OC_DB::escape($key); - $user=OC_DB::escape($user); $key="$user::$key";//ugly hack for the sake of keeping database scheme compatibiliy //TODO: prepared statements, locking tables, fancy stuff, error checking/handling - $result = OC_DB::query("delete from {$CONFIG_DBTABLEPREFIX}privatedata where `key` = '$key' and app = '$app'"); + $query=OC_DB::prepare("delete from *PREFIX*privatedata where `key` = ? and app = ?"); + $result = $query->execute(array($key,$app)); if (PEAR::isError($result)){ $entry='DB Error: "'.$result->getMessage().'"<br />'; error_log($entry); diff --git a/lib/ocsclient.php b/lib/ocsclient.php new file mode 100644 index 0000000000000000000000000000000000000000..a3c4659c6e46aeca839f30a74d7be2824a49cf45 --- /dev/null +++ b/lib/ocsclient.php @@ -0,0 +1,151 @@ +<?php +/** + * ownCloud + * + * @author Frank Karlitschek + * @author Jakob Sack + * @copyright 2010 Frank Karlitschek karlitschek@kde.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ + +/** + * This class provides an easy way for apps to store config values in the + * database. + */ + +class OC_OCSCLIENT{ + + /** + * @brief Get all the categories from the OCS server + * @returns array with category ids + * + * This function returns a list of all the application categories on the OCS server + */ + public static function getCategories(){ + $url='http://api.apps.owncloud.com/v1/content/categories'; + + $xml=file_get_contents($url); + $data=simplexml_load_string($xml); + + $tmp=$data->data; + $cats=array(); + + foreach($tmp->category as $key=>$value) { + + $id= (int) $value->id; + $name= (string) $value->name; + $cats[$id]=$name; + + } + + return $cats; + } + + /** + * @brief Get all the applications from the OCS server + * @returns array with application data + * + * This function returns a list of all the applications on the OCS server + */ + public static function getApplications($categories){ + if(is_array($categories)) { + $categoriesstring=implode('x',$categories); + }else{ + $categoriesstring=$categories; + } + $url='http://api.apps.owncloud.com/v1/content/data?categories='.urlencode($categoriesstring).'&sortmode=new&page=0&pagesize=10'; + $apps=array(); + $xml=file_get_contents($url); + $data=simplexml_load_string($xml); + + $tmp=$data->data->content; + for($i = 0; $i < count($tmp); $i++) { + $app=array(); + $app['id']=$tmp[$i]->id; + $app['name']=$tmp[$i]->name; + $app['type']=$tmp[$i]->typeid; + $app['typename']=$tmp[$i]->typename; + $app['personid']=$tmp[$i]->personid; + $app['detailpage']=$tmp[$i]->detailpage; + $app['preview']=$tmp[$i]->smallpreviewpic1; + $app['changed']=strtotime($tmp[$i]->changed); + $app['description']=$tmp[$i]->description; + + $apps[]=$app; + } + return $apps; + } + + + /** + * @brief Get an the applications from the OCS server + * @returns array with application data + * + * This function returns an applications from the OCS server + */ + public static function getApplication($id){ + $url='http://api.apps.owncloud.com/v1/content/data/'.urlencode($id); + + $xml=file_get_contents($url); + $data=simplexml_load_string($xml); + + $tmp=$data->data->content; + $app=array(); + $app['id']=$tmp->id; + $app['name']=$tmp->name; + $app['type']=$tmp->typeid; + $app['typename']=$tmp->typename; + $app['personid']=$tmp->personid; + $app['detailpage']=$tmp->detailpage; + $app['preview1']=$tmp->smallpreviewpic1; + $app['preview2']=$tmp->smallpreviewpic2; + $app['preview3']=$tmp->smallpreviewpic3; + $app['changed']=strtotime($tmp->changed); + $app['description']=$tmp->description; + + return $app; + } + + /** + * @brief Get all the knowledgebase entries from the OCS server + * @returns array with q and a data + * + * This function returns a list of all the knowledgebase entries from the OCS server + */ + public static function getKnownledgebaseEntries(){ + $url='http://api.apps.owncloud.com/v1/knowledgebase/data?type=150&page=0&pagesize=10'; + + $kbe=array(); + $xml=file_get_contents($url); + $data=simplexml_load_string($xml); + + $tmp=$data->data->content; + for($i = 0; $i < count($tmp); $i++) { + $kb=array(); + $kb['id']=$tmp[$i]->id; + $kb['name']=$tmp[$i]->name; + $kb['description']=$tmp[$i]->description; + $kb['answer']=$tmp[$i]->answer; + $kb['preview1']=$tmp[$i]->smallpreviewpic1; + $kbe[]=$kb; + } + return $kbe; + } + + + +} +?> diff --git a/lib/preferences.php b/lib/preferences.php new file mode 100644 index 0000000000000000000000000000000000000000..5a9ed39508544136eb1debcfbe6c0b4be1724640 --- /dev/null +++ b/lib/preferences.php @@ -0,0 +1,218 @@ +<?php +/** + * ownCloud + * + * @author Frank Karlitschek + * @author Jakob Sack + * @copyright 2010 Frank Karlitschek karlitschek@kde.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ +/* + * + * The following SQL statement is just a help for developers and will not be + * executed! + * + * CREATE TABLE `preferences` ( + * `userid` VARCHAR( 255 ) NOT NULL , + * `appid` VARCHAR( 255 ) NOT NULL , + * `configkey` VARCHAR( 255 ) NOT NULL , + * `configvalue` VARCHAR( 255 ) NOT NULL + * ) + * + */ + +/** + * This class provides an easy way for storing user preferences. + */ +class OC_PREFERENCES{ + /** + * @brief Get all users using the preferences + * @returns array with user ids + * + * This function returns a list of all users that have at least one entry + * in the preferences table. + */ + public static function getUsers(){ + // No need for more comments + $query = OC_DB::prepare( 'SELECT DISTINCT( userid ) FROM *PREFIX*preferences' ); + $result = $query->execute(); + + $users = array(); + while( $row = $result->fetchRow()){ + $users[] = $row["userid"]; + } + + return $users; + } + + /** + * @brief Get all apps of a user + * @param $user user + * @returns array with app ids + * + * This function returns a list of all apps of the userthat have at least + * one entry in the preferences table. + */ + public static function getApps( $user ){ + // No need for more comments + $query = OC_DB::prepare( 'SELECT DISTINCT( appid ) FROM *PREFIX*preferences WHERE userid = ?' ); + $result = $query->execute( array( $user )); + + $apps = array(); + while( $row = $result->fetchRow()){ + $apps[] = $row["appid"]; + } + + return $apps; + } + + /** + * @brief Get the available keys for an app + * @param $user user + * @param $app the app we are looking for + * @returns array with key names + * + * This function gets all keys of an app of an user. Please note that the + * values are not returned. + */ + public static function getKeys( $user, $app ){ + // No need for more comments + $query = OC_DB::prepare( 'SELECT configkey FROM *PREFIX*preferences WHERE userid = ? AND appid = ?' ); + $result = $query->execute( array( $user, $app )); + + $keys = array(); + while( $row = $result->fetchRow()){ + $keys[] = $row["configkey"]; + } + + return $keys; + } + + /** + * @brief Gets the preference + * @param $user user + * @param $app app + * @param $key key + * @param $default = null, default value if the key does not exist + * @returns the value or $default + * + * This function gets a value from the prefernces table. If the key does + * not exist the default value will be returnes + */ + public static function getValue( $user, $app, $key, $default = null ){ + // Try to fetch the value, return default if not exists. + $query = OC_DB::prepare( 'SELECT configvalue FROM *PREFIX*preferences WHERE userid = ? AND appid = ? AND configkey = ?' ); + $result = $query->execute( array( $user, $app, $key )); + + if( !$result->numRows()){ + return $default; + } + + $row = $result->fetchRow(); + + return $row["configvalue"]; + } + + /** + * @brief sets a value in the preferences + * @param $user user + * @param $app app + * @param $key key + * @param $value value + * @returns true/false + * + * Adds a value to the preferences. If the key did not exist before, it + * will be added automagically. + */ + public static function setValue( $user, $app, $key, $value ){ + // Check if the key does exist + $exists = self::getValue( $user, $app, $key, null ); + + // null: does not exist. Insert. + if( is_null( $exists )){ + $query = OC_DB::prepare( 'INSERT INTO *PREFIX*preferences ( userid, appid, configkey, configvalue ) VALUES( ?, ?, ?, ? )' ); + $query->execute( array( $user, $app, $key, $value )); + } + else{ + $query = OC_DB::prepare( 'UPDATE *PREFIX*preferences SET configvalue = ? WHERE userid = ? AND appid = ? AND configkey = ?' ); + $query->execute( array( $value, $user, $app, $key )); + } + } + + /** + * @brief Deletes a key + * @param $user user + * @param $app app + * @param $key key + * @returns true/false + * + * Deletes a key. + */ + public static function deleteKey( $user, $app, $key ){ + // No need for more comments + $query = OC_DB::prepare( 'DELETE FROM *PREFIX*preferences WHERE userid = ? AND appid = ? AND configkey = ?' ); + $result = $query->execute( array( $user, $app, $key )); + + return true; + } + + /** + * @brief Remove app of user from preferences + * @param $user user + * @param $app app + * @returns true/false + * + * Removes all keys in appconfig belonging to the app and the user. + */ + public static function deleteApp( $user, $app ){ + // No need for more comments + $query = OC_DB::prepare( 'DELETE FROM *PREFIX*preferences WHERE userid = ? AND appid = ?' ); + $result = $query->execute( array( $user, $app )); + + return true; + } + + /** + * @brief Remove user from preferences + * @param $user user + * @returns true/false + * + * Removes all keys in appconfig belonging to the user. + */ + public static function deleteUser( $user ){ + // No need for more comments + $query = OC_DB::prepare( 'DELETE FROM *PREFIX*preferences WHERE userid = ?' ); + $result = $query->execute( array( $user )); + + return true; + } + + /** + * @brief Remove app from all users + * @param $app app + * @returns true/false + * + * Removes all keys in preferences belonging to the app. + */ + public static function deleteAppFromAllUsers( $app ){ + // No need for more comments + $query = OC_DB::prepare( 'DELETE FROM *PREFIX*preferences WHERE appid = ?' ); + $result = $query->execute( array( $app )); + + return true; + } +} +?> diff --git a/inc/lib_remotestorage.php b/lib/remotestorage.php similarity index 100% rename from inc/lib_remotestorage.php rename to lib/remotestorage.php diff --git a/lib/search.php b/lib/search.php new file mode 100644 index 0000000000000000000000000000000000000000..ef82e225f3d8693e04ca0bd671d44cec7bd4e0f7 --- /dev/null +++ b/lib/search.php @@ -0,0 +1,121 @@ +<?php +/** + * ownCloud + * + * @author Frank Karlitschek + * @copyright 2010 Frank Karlitschek karlitschek@kde.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ + + +/** + * provides an interface to all search providers + */ +class OC_SEARCH{ + static private $providers=array(); + + /** + * register a new search provider to be used + * @param OC_SearchProvider $provider + */ + public static function registerProvider($provider){ + self::$providers[]=$provider; + } + + /** + * search all provider for $query + * @param string query + * @return array An array of OC_SearchResult's + */ + public static function search($query){ + $results=array(); + foreach(self::$providers as $provider){ + $results=array_merge($results,$provider->search($query)); + } + return $results; + } +} + +/** + * provides search functionalty + */ +abstract class OC_SearchProvider{ + public function __construct(){ + OC_SEARCH::registerProvider($this); + } + + /** + * search for $query + * @param string $query + * @return array An array of OC_SearchResult's + */ + abstract function search($query); +} + +/** + * a result of a search + */ +class OC_SearchResult{ + private $name; + private $text; + private $link; + private $type; + + /** + * create a new search result + * @param string $name short name for the result + * @param string $text some more information about the result + * @param string $link link for the result + * @param string $type the type of result as human readable string ('File', 'Music', etc) + */ + public function __construct($name,$text,$link,$type){ + $this->name=$name; + $this->text=$text; + $this->link=$link; + $this->type=$type; + } + + public function __get($name){ + switch($name){ + case 'name': + return $this->name; + case 'text': + return $this->text; + case 'link': + return $this->link; + case 'type': + return $this->type; + } + } +} + +class OC_FileSearchProvider extends OC_SearchProvider{ + function search($query){ + $files=OC_FILESYSTEM::search($query); + $results=array(); + foreach($files as $file){ + if(OC_FILESYSTEM::is_dir($file)){ + $results[]=new OC_SearchResult(basename($file),$file,OC_HELPER::linkTo( 'files', 'index.php?dir='.$file ),'Files'); + }else{ + $results[]=new OC_SearchResult(basename($file),$file,OC_HELPER::linkTo( 'files', 'download.php?file='.$file ),'Files'); + } + } + return $results; + } +} + +new OC_FileSearchProvider(); +?> \ No newline at end of file diff --git a/lib/setup.php b/lib/setup.php new file mode 100644 index 0000000000000000000000000000000000000000..72507f221b9f0ecf5f8bf6fe4f2e9b8ff0e8b2b8 --- /dev/null +++ b/lib/setup.php @@ -0,0 +1,181 @@ +<?php + +$hasSQLite = is_callable('sqlite_open'); +$hasMySQL = is_callable('mysql_connect'); +$datadir = OC_CONFIG::getValue('datadir', $SERVERROOT.'/data'); +$opts = array( + 'hasSQLite' => $hasSQLite, + 'hasMySQL' => $hasMySQL, + 'directory' => $datadir, + 'errors' => array(), +); + +if(isset($_POST['install']) AND $_POST['install']=='true') { + // We have to launch the installation process : + $e = OC_SETUP::install($_POST); + $errors = array('errors' => $e); + + if(count($e) > 0) { + //OC_TEMPLATE::printGuestPage("", "error", array("errors" => $errors)); + $options = array_merge($_POST, $opts, $errors); + OC_TEMPLATE::printGuestPage("", "installation", $options); + } + else { + header("Location: $WEBROOT"); + exit(); + } +} +else { + OC_TEMPLATE::printGuestPage("", "installation", $opts); +} + +class OC_SETUP { + public static function install($options) { + $error = array(); + $dbtype = $options['dbtype']; + + if(empty($options['adminlogin'])) { + $error[] = 'STEP 1 : admin login is not set.'; + } + if(empty($options['adminpass'])) { + $error[] = 'STEP 1 : admin password is not set.'; + } + if(empty($options['directory'])) { + $error[] = 'STEP 2 : data directory path is not set.'; + } + if($dbtype=='mysql') { //mysql needs more config options + if(empty($options['dbuser'])) { + $error[] = 'STEP 3 : MySQL database user is not set.'; + } + if(empty($options['dbpass'])) { + $error[] = 'STEP 3 : MySQL database password is not set.'; + } + if(empty($options['dbname'])) { + $error[] = 'STEP 3 : MySQL database name is not set.'; + } + if(empty($options['dbhost'])) { + $error[] = 'STEP 3 : MySQL database host is not set.'; + } + if(!isset($options['dbtableprefix'])) { + $error[] = 'STEP 3 : MySQL database table prefix is not set.'; + } + } + + if(count($error) == 0) { //no errors, good + $username = htmlspecialchars_decode($options['adminlogin']); + $password = htmlspecialchars_decode($options['adminpass']); + $datadir = htmlspecialchars_decode($options['directory']); + + //write the config file + OC_CONFIG::setValue('datadirectory', $datadir); + OC_CONFIG::setValue('dbtype', $dbtype); + if($dbtype == 'mysql') { + $dbuser = $options['dbuser']; + $dbpass = $options['dbpass']; + $dbname = $options['dbname']; + $dbhost = $options['dbhost']; + $dbtableprefix = $options['dbtableprefix']; + OC_CONFIG::setValue('dbname', $dbname); + OC_CONFIG::setValue('dbhost', $dbhost); + OC_CONFIG::setValue('dbtableprefix', $dbtableprefix); + + //check if the database user has admin right + $connection = @mysql_connect($dbhost, $dbuser, $dbpass); + if(!$connection) { + $error[] = array( + 'error' => 'mysql username and/or password not valid', + 'hint' => 'you need to enter either an existing account, or the administrative account if you wish to create a new user for ownCloud' + ); + } + else { + $query="SELECT user FROM mysql.user WHERE user='$dbuser'"; //this should be enough to check for admin rights in mysql + if(mysql_query($query, $connection)) { + self::createDBUser($username, $password, $connection); + //use the admin login data for the new database user + OC_CONFIG::setValue('dbuser', $username); + OC_CONFIG::setValue('dbpassword', $password); + + //create the database + self::createDatabase($dbname, $username, $connection); + } + else { + OC_CONFIG::setValue('dbuser', $dbuser); + OC_CONFIG::setValue('dbpassword', $dbpass); + + //create the database + self::createDatabase($dbname, $dbuser, $connection); + } + + //fill the database if needed + $query="SELECT * FROM $dbname.{$dbtableprefix}users"; + $result = mysql_query($query,$connection); + if(!$result) { + OC_DB::createDbFromStructure('db_structure.xml'); + } + mysql_close($connection); + } + } + else { + //delete the old sqlite database first, might cause infinte loops otherwise + unlink("$datadir/owncloud.db"); + //in case of sqlite, we can always fill the database + OC_DB::createDbFromStructure('db_structure.xml'); + } + + if(count($error) == 0) { + //create the user and group + OC_USER::createUser($username, $password); + OC_GROUP::createGroup('admin'); + OC_GROUP::addToGroup($username, 'admin'); + + //create htaccess files for apache hosts + self::createHtaccess(); //TODO detect if apache is used + + //and we are done + OC_CONFIG::setValue('installed', true); + } + } + + return $error; + } + + public static function createDatabase($name,$user,$connection) { + //we cant user OC_BD functions here because we need to connect as the administrative user. + $query = "CREATE DATABASE IF NOT EXISTS `$name`"; + $result = mysql_query($query, $connection); + if(!$result) { + $entry='DB Error: "'.mysql_error($connection).'"<br />'; + $entry.='Offending command was: '.$query.'<br />'; + echo($entry); + } + $query="GRANT ALL PRIVILEGES ON `$name` . * TO '$user'"; + $result = mysql_query($query, $connection); //this query will fail if there aren't the right permissons, ignore the error + } + + private static function createDBUser($name,$password,$connection) { + // we need to create 2 accounts, one for global use and one for local user. if we don't speccify the local one, + // the anonymous user would take precedence when there is one. + $query = "CREATE USER '$name'@'localhost' IDENTIFIED BY '$password'"; + $result = mysql_query($query, $connection); + $query = "CREATE USER '$name'@'%' IDENTIFIED BY '$password'"; + $result = mysql_query($query, $connection); + } + + /** + * create .htaccess files for apache hosts + */ + private static function createHtaccess() { + global $SERVERROOT; + global $WEBROOT; + $content = "ErrorDocument 404 /$WEBROOT/templates/404.php\n";//custom 404 error page + $content.= "php_value upload_max_filesize 20M\n";//upload limit + $content.= "php_value post_max_size 20M\n"; + $content.= "SetEnv htaccessWorking true\n"; + @file_put_contents($SERVERROOT.'/.htaccess', $content); //supress errors in case we don't have permissions for it + + $content = "deny from all"; + file_put_contents(OC_CONFIG::getValue('datadirectory', $SERVERROOT.'/data').'/.htaccess', $content); + } +} + +?> \ No newline at end of file diff --git a/lib/template.php b/lib/template.php new file mode 100644 index 0000000000000000000000000000000000000000..0d6776aa26d22230fd6038daa6b760d226c5fe46 --- /dev/null +++ b/lib/template.php @@ -0,0 +1,311 @@ +<?php +/** + * ownCloud + * + * @author Frank Karlitschek + * @author Jakob Sack + * @copyright 2010 Frank Karlitschek karlitschek@kde.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ + +/** + * @brief make OC_HELPER::linkTo available as a simple function + * @param $app app + * @param $file file + * @returns link to the file + * + * For further information have a look at OC_HELPER::linkTo + */ +function link_to( $app, $file ){ + return OC_HELPER::linkTo( $app, $file ); +} + +/** + * @brief make OC_HELPER::imagePath available as a simple function + * @param $app app + * @param $image image + * @returns link to the image + * + * For further information have a look at OC_HELPER::imagePath + */ +function image_path( $app, $image ){ + return OC_HELPER::imagePath( $app, $image ); +} + +/** + * @brief make OC_HELPER::mimetypeIcon available as a simple function + * @param $mimetype mimetype + * @returns link to the image + * + * For further information have a look at OC_HELPER::mimetypeIcon + */ +function mimetype_icon( $mimetype ){ + return OC_HELPER::mimetypeIcon( $mimetype ); +} + +/** + * @brief make OC_HELPER::humanFileSize available as a simple function + * @param $bytes size in bytes + * @returns size as string + * + * For further information have a look at OC_HELPER::humanFileSize + */ +function human_file_size( $bytes ){ + return OC_HELPER::humanFileSize( $bytes ); +} + +/** + * This class provides the templates for owncloud. + */ +class OC_TEMPLATE{ + private $renderas; // Create a full page? + private $application; // template Application + private $vars; // The smarty object + private $template; // The smarty object + + /** + * @brief Constructor + * @param $app app providing the template + * @param $file name of the tempalte file (without suffix) + * @param $renderas = ""; produce a full page + * @returns OC_TEMPLATE object + * + * This function creates an OC_TEMPLATE object. + * + * If $renderas is set, OC_TEMPLATE will try to produce a full page in the + * according layout. For now, renderas can be set to "guest", "user" or + * "admin". + */ + public function __construct( $app, $name, $renderas = "" ){ + // Global vars we need + global $SERVERROOT; + + // Get the right template folder + $template = "$SERVERROOT/templates/"; + if( $app != "core" && $app != "" ){ + // Check if the app is in the app folder + if( file_exists( "$SERVERROOT/apps/$app/templates/" )){ + $template = "$SERVERROOT/apps/$app/templates/"; + } + else{ + $template = "$SERVERROOT/$app/templates/"; + } + } + + // Templates have the ending .php + $template .= "$name.php"; + + // Set the private data + $this->renderas = $renderas; + $this->application = $app; + $this->template = $template; + $this->vars = array(); + } + + /** + * @brief Assign variables + * @param $key key + * @param $value value + * @returns true + * + * This function assigns a variable. It can be accessed via $_[$key] in + * the template. + * + * If the key existed before, it will be overwritten + */ + public function assign( $key, $value ){ + $this->vars[$key] = $value; + return true; + } + + /** + * @brief Appends a variable + * @param $key key + * @param $value value + * @returns true + * + * This function assigns a variable in an array context. If the key already + * exists, the value will be appended. It can be accessed via + * $_[$key][$position] in the template. + */ + public function append( $key, $value ){ + if( array_key_exists( $key, $this->vars )){ + $this->vars[$key][] = $value; + } + else{ + $this->vars[$key] = array( $value ); + } + } + + /** + * @brief Prints the proceeded template + * @returns true/false + * + * This function proceeds the template and prints its output. + */ + public function printPage() + { + $data = $this->fetchPage(); + if( $data === false ) + { + return false; + } + else + { + print $data; + return true; + } + } + + /** + * @brief Proceeds the template + * @returns content + * + * This function proceeds the template. If $this->renderas is set, it will + * will produce a full page. + */ + public function fetchPage() + { + // global Data we need + global $WEBROOT; + global $SERVERROOT; + $data = $this->_fetch(); + + if( $this->renderas ) + { + // Decide which page we show + if( $this->renderas == "user" ) + { + $page = new OC_TEMPLATE( "core", "layout.user" ); + $search=new OC_TEMPLATE( 'core', 'part.searchbox'); + $search->assign('searchurl',OC_HELPER::linkTo( 'search', 'index.php' )); + $page->assign('searchbox', $search->fetchPage()); + // Add menu data + + // Add navigation entry + $page->assign( "navigation", OC_APP::getNavigation()); + } + elseif( $this->renderas == "admin" ) + { + $page = new OC_TEMPLATE( "core", "layout.admin" ); + $search=new OC_TEMPLATE( 'core', 'part.searchbox'); + $search->assign('searchurl',OC_HELPER::linkTo( 'search', 'index.php' )); + $page->assign('searchbox', $search->fetchPage()); + // Add menu data + if( OC_GROUP::inGroup( $_SESSION["user_id"], "admin" )){ + $page->assign( "settingsnavigation", OC_APP::getSettingsNavigation()); + } + $page->assign( "adminnavigation", OC_APP::getAdminNavigation()); + } + else + { + $page = new OC_TEMPLATE( "core", "layout.guest" ); + // Add data if required + } + + // Add the css and js files + foreach(OC_UTIL::$scripts as $script){ + if(is_file("$SERVERROOT/apps/$script.js" )){ + $page->append( "jsfiles", "$WEBROOT/apps/$script.js" ); + }else{ + $page->append( "jsfiles", "$WEBROOT/$script.js" ); + } + } + foreach(OC_UTIL::$styles as $style){ + if(is_file("$SERVERROOT/apps/$style.css" )){ + $page->append( "cssfiles", "$WEBROOT/apps/$style.css" ); + }else{ + $page->append( "cssfiles", "$WEBROOT/$style.css" ); + } + } + + // Add css files and js files + $page->assign( "content", $data ); + return $page->fetchPage(); + } + else + { + return $data; + } + } + + /** + * @brief doing the actual work + * @returns content + * + * Includes the template file, fetches its output + */ + private function _fetch(){ + // Register the variables + $_ = $this->vars; + + // Execute the template + ob_start(); + include( $this->template ); // <-- we have to use include because we pass $_! + $data = ob_get_contents(); + ob_end_clean(); + + // return the data + return $data; + } + + /** + * @brief Shortcut to print a simple page for users + * @param $application The application we render the template for + * @param $name Name of the template + * @param $parameters Parameters for the template + * @returns true/false + */ + public static function printUserPage( $application, $name, $parameters = array() ){ + $content = new OC_TEMPLATE( $application, $name, "user" ); + foreach( $parameters as $key => $value ){ + $content->assign( $key, $value ); + } + print $content->printPage(); + } + + /** + * @brief Shortcut to print a simple page for admins + * @param $application The application we render the template for + * @param $name Name of the template + * @param $parameters Parameters for the template + * @returns true/false + */ + public static function printAdminPage( $application, $name, $parameters = array() ){ + $content = new OC_TEMPLATE( $application, $name, "admin" ); + foreach( $parameters as $key => $value ){ + $content->assign( $key, $value ); + } + return $content->printPage(); + } + + /** + * @brief Shortcut to print a simple page for guests + * @param $application The application we render the template for + * @param $name Name of the template + * @param $parameters Parameters for the template + * @returns true/false + */ + public static function printGuestPage( $application, $name, $parameters = array() ){ + $content = new OC_TEMPLATE( $application, $name, "guest" ); + foreach( $parameters as $key => $value ){ + $content->assign( $key, $value ); + } + return $content->printPage(); + } +} + +?> diff --git a/lib/user.php b/lib/user.php new file mode 100644 index 0000000000000000000000000000000000000000..09501e59c5887afd179f8fc58d141056388d421d --- /dev/null +++ b/lib/user.php @@ -0,0 +1,259 @@ +<?php +/** + * ownCloud + * + * @author Frank Karlitschek + * @copyright 2010 Frank Karlitschek karlitschek@kde.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ + +if( !OC_CONFIG::getValue( "installed", false )){ + $_SESSION['user_id'] = ''; +} + +/** + * This class provides all methods for user management. + * + * Hooks provided: + * pre_createUser(&run, uid, password) + * post_createUser(uid, password) + * pre_deleteUser(&run, uid) + * post_deleteUser(uid) + * pre_setPassword(&run, uid, password) + * post_setPassword(uid, password) + * pre_login(&run, uid) + * post_login(uid) + * logout() + */ +class OC_USER { + // The backend used for user management + private static $_backend = null; + + // Backends available (except database) + private static $_backends = array(); + + /** + * @brief registers backend + * @param $name name of the backend + * @returns true/false + * + * Makes a list of backends that can be used by other modules + */ + public static function registerBackend( $name ){ + self::$_backends[] = $name; + return true; + } + + /** + * @brief gets available backends + * @returns array of backends + * + * Returns the names of all backends. + */ + public static function getBackends(){ + return self::$_backends; + } + + /** + * @brief Sets the backend + * @param $backend default: database The backend to use for user managment + * @returns true/false + * + * Set the User Authentication Module + */ + public static function setBackend( $backend = 'database' ){ + // You'll never know what happens + if( null === $backend OR !is_string( $backend )){ + $backend = 'database'; + } + + // Load backend + switch( $backend ){ + case 'database': + case 'mysql': + case 'sqlite': + require_once('User/database.php'); + self::$_backend = new OC_USER_DATABASE(); + break; + default: + $className = 'OC_USER_' . strToUpper($backend); + self::$_backend = new $className(); + break; + } + + true; + } + + /** + * @brief Create a new user + * @param $uid The username of the user to create + * @param $password The password of the new user + * @returns true/false + * + * Creates a new user. Basic checking of username is done in OC_USER + * itself, not in its subclasses. + * + * Allowed characters in the username are: "a-z", "A-Z", "0-9" and "_.@-" + */ + public static function createUser( $uid, $password ){ + // Check the name for bad characters + // Allowed are: "a-z", "A-Z", "0-9" and "_.@-" + if( preg_match( '/[^a-zA-Z0-9 _\.@\-]/', $uid )){ + return false; + } + // No empty username + if( !$uid ){ + return false; + } + // Check if user already exists + if( in_array( $uid, self::getUsers())){ + return false; + } + + + $run = true; + OC_HOOK::emit( "OC_USER", "pre_createUser", array( "run" => &$run, "uid" => $uid, "password" => $password )); + + if( $run && self::$_backend->createUser( $uid, $password )){ + OC_HOOK::emit( "OC_USER", "post_createUser", array( "uid" => $uid, "password" => $password )); + return true; + } + else{ + return false; + } + } + + /** + * @brief delete a user + * @param $uid The username of the user to delete + * @returns true/false + * + * Deletes a user + */ + public static function deleteUser( $uid ){ + $run = true; + OC_HOOK::emit( "OC_USER", "pre_deleteUser", array( "run" => &$run, "uid" => $uid )); + + if( $run && self::$_backend->deleteUser( $uid )){ + // We have to delete the user from all groups + foreach( OC_GROUP::getUserGroups( $uid ) as $i ){ + OC_GROUP::removeFromGroup( $uid, $i ); + } + + // Emit and exit + OC_HOOK::emit( "OC_USER", "post_deleteUser", array( "uid" => $uid )); + return true; + } + else{ + return false; + } + } + + /** + * @brief Try to login a user + * @param $uid The username of the user to log in + * @param $password The password of the user + * @returns true/false + * + * Log in a user - if the password is ok + */ + public static function login( $uid, $password ){ + $run = true; + OC_HOOK::emit( "OC_USER", "pre_login", array( "run" => &$run, "uid" => $uid )); + + if( $run && self::$_backend->login( $uid, $password )){ + OC_HOOK::emit( "OC_USER", "post_login", array( "uid" => $uid )); + return true; + } + else{ + return false; + } + } + + /** + * @brief Kick the user + * @returns true + * + * Logout, destroys session + */ + public static function logout(){ + OC_HOOK::emit( "OC_USER", "logout", array()); + return self::$_backend->logout(); + } + + /** + * @brief Check if the user is logged in + * @returns true/false + * + * Checks if the user is logged in + */ + public static function isLoggedIn(){ + return self::$_backend->isLoggedIn(); + } + + /** + * @brief Autogenerate a password + * @returns string + * + * generates a password + */ + public static function generatePassword(){ + return substr( md5( uniqId().time()), 0, 10 ); + } + + /** + * @brief Set password + * @param $uid The username + * @param $password The new password + * @returns true/false + * + * Change the password of a user + */ + public static function setPassword( $uid, $password ){ + $run = true; + OC_HOOK::emit( "OC_USER", "pre_setPassword", array( "run" => &$run, "uid" => $uid, "password" => $password )); + + if( $run && self::$_backend->setPassword( $uid, $password )){ + OC_HOOK::emit( "OC_USER", "post_setPassword", array( "uid" => $uid, "password" => $password )); + return true; + } + else{ + return false; + } + } + + /** + * @brief Check if the password is correct + * @param $uid The username + * @param $password The password + * @returns true/false + * + * Check if the password is correct without logging in the user + */ + public static function checkPassword( $uid, $password ){ + return self::$_backend->checkPassword( $uid, $password ); + } + + /** + * @brief Get a list of all users + * @returns array with all uids + * + * Get a list of all users. + */ + public static function getUsers(){ + return self::$_backend->getUsers(); + } +} diff --git a/log/appinfo/app.php b/log/appinfo/app.php new file mode 100644 index 0000000000000000000000000000000000000000..7247104b95d8334d43a35ffa5f3aa842d1f96445 --- /dev/null +++ b/log/appinfo/app.php @@ -0,0 +1,6 @@ +<?php + +OC_APP::register( array( "order" => 1, "id" => "log", "name" => "Log" )); +OC_APP::addSettingsPage( array( "id" => "log", "order" => 999, "href" => OC_HELPER::linkTo( "log", "index.php" ), "name" => "Log", "icon" => OC_HELPER::imagePath( "log", "logs.png" ))); + +?> diff --git a/log/img/logs.png b/log/img/logs.png new file mode 100644 index 0000000000000000000000000000000000000000..c3fad71133a3de35266b1c28328212cde86f09cd Binary files /dev/null and b/log/img/logs.png differ diff --git a/log/index.php b/log/index.php index da76d2e0e5b1f28347db80bcf181997db3c165a2..675396a4d100a4ebb09041bca8e57f1ad9fee724 100644 --- a/log/index.php +++ b/log/index.php @@ -1,31 +1,95 @@ <?php /** -* ownCloud +* ownCloud - ajax frontend +* +* @author Robin Appelman +* @copyright 2010 Robin Appelman icewind1991@gmail.com * -* @author Frank Karlitschek -* @copyright 2010 Frank Karlitschek karlitschek@kde.org -* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either +* License as published by the Free Software Foundation; either * version 3 of the License, or any later version. -* +* * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public +* +* You should have received a copy of the GNU Affero General Public * License along with this library. If not, see <http://www.gnu.org/licenses/>. -* +* */ -require_once('../inc/lib_base.php'); +//require_once('../../config/config.php'); +require_once('../lib/base.php'); +require( 'template.php' ); +require( 'preferences.php' ); + +if( !OC_USER::isLoggedIn()){ + header( 'Location: '.OC_HELPER::linkTo( 'index.php' )); + exit(); +} + +//load the script +OC_UTIL::addScript( "log", "log" ); + +$allActions=array('login','logout','read','write','create','delete'); + +//check for a submited config +if(isset($_POST['size'])){ + $selectedActions=array(); + foreach($allActions as $action){ + if(isset($_POST[$action]) and $_POST[$action]=='on'){ + $selectedActions[]=$action; + } + } + OC_PREFERENCES::setValue($_SESSION['user_id'],'log','actions',implode(',',$selectedActions)); + OC_PREFERENCES::setValue($_SESSION['user_id'],'log','pagesize',$_POST['size']); +} + +OC_APP::setActiveNavigationEntry( 'log' ); +$logs=OC_LOG::get(); + +$selectedActions=explode(',',OC_PREFERENCES::getValue($_SESSION['user_id'],'log','actions',implode(',',$allActions))); +$logs=OC_LOG::filterAction($logs,$selectedActions); + +$pageSize=OC_PREFERENCES::getValue($_SESSION['user_id'],'log','pagesize',20); +$pageCount=ceil(count($logs)/$pageSize); +$page=isset($_GET['page'])?$_GET['page']:0; +if($page>=$pageCount){ + $page=$pageCount-1; +} + +$logs=array_slice($logs,$page*$pageSize,$pageSize); + +foreach( $logs as &$i ){ + $i['date'] =$i['moment']; +} + +$url=OC_HELPER::linkTo( 'log', 'index.php' ).'?page='; +$pager=OC_UTIL::getPageNavi($pageCount,$page,$url); +if($pager){ + $pagerHTML=$pager->fetchPage(); +}else{ + $pagerHTML=''; +} + +$showActions=array(); +foreach($allActions as $action){ + if(array_search($action,$selectedActions)!==false){ + $showActions[$action]='checked="checked"'; + }else{ + $showActions[$action]=''; + } +} -OC_UTIL::showheader(); -OC_LOG::show(); -OC_UTIL::showfooter(); +$tmpl = new OC_TEMPLATE( 'log', 'index', 'admin' ); +$tmpl->assign( 'logs', $logs ); +$tmpl->assign( 'pager', $pagerHTML ); +$tmpl->assign( 'size', $pageSize ); +$tmpl->assign( 'showActions', $showActions ); +$tmpl->printPage(); ?> diff --git a/log/js/log.js b/log/js/log.js new file mode 100644 index 0000000000000000000000000000000000000000..47c20b3e8603d7f2f648a8521a76847cb727bb51 --- /dev/null +++ b/log/js/log.js @@ -0,0 +1,21 @@ +$(document).ready(function() { + // Sets the select_all checkbox behaviour : + $('#all').click(function() { + if($(this).attr('checked')){ + // Check all + $('input.action:checkbox').attr('checked', true); + }else{ + // Uncheck all + $('input.action:checkbox').attr('checked', false); + } + }); + $('input.action:checkbox').click(function() { + if(!$(this).attr('checked')){ + $('#all').attr('checked',false); + }else{ + if($('input.action:checkbox:checked').length==$('input.action:checkbox').length){ + $('#all').attr('checked',true); + } + } + }); +}); \ No newline at end of file diff --git a/log/templates/index.php b/log/templates/index.php new file mode 100644 index 0000000000000000000000000000000000000000..1e294091e3fa11803d99bc7f30c4beb16c915ed5 --- /dev/null +++ b/log/templates/index.php @@ -0,0 +1,40 @@ +<div class="controls"> + <form id="logs_options" method='post'> + <p> + <span>Filter :</span> + + <input type="checkbox" checked="" name="all" id="all" /> <label for="all">All</label> + <input type="checkbox" class='action' <?php echo $_['showActions']['login']?> name="login" id="logins" /> <label for="logins">Logins</label> + <input type="checkbox" class='action' <?php echo $_['showActions']['logout']?> name="logout" id="logouts" /> <label for="logouts">Logouts</label> + <input type="checkbox" class='action' <?php echo $_['showActions']['read']?> name="read" id="downloads" /> <label for="downloads">Downloads</label> + <input type="checkbox" class='action' <?php echo $_['showActions']['write']?> name="write" id="uploads" /> <label for="uploads">Uploads</label> + <input type="checkbox" class='action' <?php echo $_['showActions']['create']?> name="create" id="creations" /> <label for="creations">Creations</label> + <input type="checkbox" class='action' <?php echo $_['showActions']['delete']?> name="delete" id="deletions" /> <label for="deletions">Deletions</label> + </p> + <p> + <span>Show :</span> + <input type="text" maxlength="3" size="3" value="<?php echo $_['size']?>" name='size'/> entries per page. + <input class="prettybutton" type="submit" value="Save" /> + + </p> + </form> +</div> + +<table cellspacing="0"> + <thead> + <tr> + <th>What</th> + <th>When</th> + </tr> + </thead> + <tbody> + <?php foreach($_["logs"] as $entry): ?> + <tr> + <td class="<?php echo $entry["action"]; ?>"><em><?php echo $entry["action"]; ?> <?php echo $entry["user"]; ?></em> <?php echo $entry["info"]; ?></td> + <td class="date"><?php echo $entry["date"]; ?></td> + </tr> + <?php endforeach; ?> + </tbody> +</table> + +<?php echo $_['pager'];?> diff --git a/plugins/audioplayer/README b/plugins/audioplayer/README deleted file mode 100644 index 5de1324d56a04047262d0b4e7b475281548456af..0000000000000000000000000000000000000000 --- a/plugins/audioplayer/README +++ /dev/null @@ -1,9 +0,0 @@ -This plugin implements a very basic HTML5 audio preview for ownCloud. - -Only formats supported by the browser can be played. -Sadly, those are very limited and not coherent among browsers, see http://html5doctor.com/native-audio-in-the-browser/ for more info. - -Ideas to change that (TODO): -- Flashplayer fallback -and/or -- on-the-fly transcoding diff --git a/plugins/audioplayer/audioplayer.js b/plugins/audioplayer/audioplayer.js deleted file mode 100644 index 817cc7d374c6e5a7c7bb6b3877bbad8d543d371e..0000000000000000000000000000000000000000 --- a/plugins/audioplayer/audioplayer.js +++ /dev/null @@ -1,66 +0,0 @@ -OC_AudioPlayer = new Object(); - -OC_AudioPlayer.playAudio = function(dir, file, type) { - var path = WEBROOT + '/files/api.php?action=get&dir='+encodeURIComponent(dir)+'&file='+encodeURIComponent(file); - - OC_AudioPlayer.audioFrame = document.createElement('div'); - OC_AudioPlayer.audioFrame.setAttribute('id', 'audioframe'); - OC_AudioPlayer.audioFrame.setAttribute('class', 'center'); - var div = document.createElement('div'); - var inner = document.createElement('div'); - var audio = document.createElement('audio'); - var source = document.createElement('source'); - -// if (!(!!(audio.canPlayType) && (audio.canPlayType(type) != "no") && (audio.canPlayType(type) != ""))) { -// // use a flash player fallback -// // or implement some nice on-the-fly recoding here -// alert("Native playing of '"+type+"' format is not supported by your browser."); -// return; -// } - audio.setAttribute('controls', 'controls'); - audio.setAttribute('preload', 'auto'); - audio.setAttribute('autoplay', 'autoplay'); - audio.setAttribute('autobuffer', 'autobuffer'); - source.setAttribute('src', path); - source.setAttribute('type', type); - - audio.appendChild(source); - inner.appendChild(audio); - div.appendChild(inner); - OC_AudioPlayer.audioFrame.appendChild(div); - - OC_AudioPlayer.audioFrame.addEvent('onclick', OC_AudioPlayer.hidePlayer); - inner.addEvent('onclick', function(e){e.stopPropagation();}); // don't close if clicked on player - - body = document.getElementsByTagName('body').item(0); - body.appendChild(OC_AudioPlayer.audioFrame); -} - -OC_AudioPlayer.hidePlayer = function(){ - var div = document.getElementById('audioframe'); - div.parentNode.removeChild(div); -} - -// only register "play" option for file formats the browser claims to support -OC_AudioPlayer.formats = { - 'audio/mpeg':"mp3", - 'audio/ogg':"ogg", - 'application/ogg':"ogg", - 'audio/wav':"wav", - 'audio/wave':"wav", - 'audio/x-wav':"wav", - 'audio/basic':"au", - 'audio/x-aiff':"aif" -}; -var audio = document.createElement('audio'); -for(format in OC_AudioPlayer.formats) { - if (!!(audio.canPlayType) && (audio.canPlayType(format) != "no") && (audio.canPlayType(format) != "")) { - if(!OC_FILES.fileActions[format]) { - OC_FILES.fileActions[format] = new Object(); - } - OC_FILES.fileActions[format].play = function() { - OC_AudioPlayer.playAudio(this.dir, this.file, this.mime); - } - OC_FILES.fileActions[format]['default'] = OC_FILES.fileActions[format].play; - } -} diff --git a/plugins/audioplayer/lib_audioplayer.php b/plugins/audioplayer/lib_audioplayer.php deleted file mode 100644 index 206f76bb561fd24146597cb893c6242dd6cf2cb8..0000000000000000000000000000000000000000 --- a/plugins/audioplayer/lib_audioplayer.php +++ /dev/null @@ -1,5 +0,0 @@ -<?php -//load the required js and css files -OC_UTIL::addScript('plugins/audioplayer/audioplayer.js'); -OC_UTIL::addStyle('plugins/audioplayer/style.css'); -?> diff --git a/plugins/audioplayer/plugin.xml b/plugins/audioplayer/plugin.xml deleted file mode 100644 index ea58af245ec1a8f01fb74122781326dbd9af167b..0000000000000000000000000000000000000000 --- a/plugins/audioplayer/plugin.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0"?> -<plugin version='1.0'> - <info> - <id>audioplayer</id> - <name>A simple HTML5 based audio player for ownCloud</name> - <version>0.1</version> - <licence>AGPL</licence> - <author>ente</author> - <require>1.1</require> - </info> - <runtime> - <include>lib_audioplayer.php</include> - </runtime> -</plugin> - diff --git a/plugins/audioplayer/style.css b/plugins/audioplayer/style.css deleted file mode 100644 index 689a04940ed11c19f81663128f643f2474060c93..0000000000000000000000000000000000000000 --- a/plugins/audioplayer/style.css +++ /dev/null @@ -1,21 +0,0 @@ -#audioframe{ - position:absolute; - top:0px; - left:0px; - height:100%; - width:100%; - background:rgb(20,20,20); - background:rgba(20,20,20,0.9); - text-align:center; - display:table; -} - -#audioframe>div{ - display:table-cell; - vertical-align:middle; -} - -#audioframe>div>div{ - display:inline-block; -} - diff --git a/plugins/blacklist.txt b/plugins/blacklist.txt deleted file mode 100644 index 9daeafb9864cf43055ae93beb0afd6c7d144bfa4..0000000000000000000000000000000000000000 --- a/plugins/blacklist.txt +++ /dev/null @@ -1 +0,0 @@ -test diff --git a/plugins/ldap/lib_ldap.php b/plugins/ldap/lib_ldap.php deleted file mode 100644 index 383e7f7ab0a70f1f70ff7ca68c57c05a1133c35b..0000000000000000000000000000000000000000 --- a/plugins/ldap/lib_ldap.php +++ /dev/null @@ -1,230 +0,0 @@ -<?php - -/** -* ownCloud -* -* @author Frank Karlitschek -* @copyright 2010 Frank Karlitschek karlitschek@kde.org -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either -* version 3 of the License, or any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. -* -*/ - -oc_require_once('inc/User/backend.php'); - - - -/** - * Class for user management - * - */ -class OC_USER_LDAP extends OC_USER_BACKEND { - - /** - * Check if the login button is pressed and log the user in - * - */ - public static function loginListener() { - return(''); - } - - /** - * Try to create a new user - * - * @param string $username The username of the user to create - * @param string $password The password of the new user - */ - public static function createUser($username, $password) { - return false; - } - - /** - * Try to login a user - * - * @param string $username The username of the user to log in - * @param string $password The password of the user - */ - public static function login($username, $password) { - if ( isset($_SERVER['PHP_AUTH_USER']) AND ('' != $_SERVER['PHP_AUTH_USER']) ) { - $_SESSION['user_id'] = $_SERVER['PHP_AUTH_USER']; - $_SESSION['username'] = $_SERVER['PHP_AUTH_USER']; - $_SESSION['username_clean'] = $_SERVER['PHP_AUTH_USER']; - return true; - } - return false; - } - - /** - * Check if the logout button is pressed and logout the user - * - */ - public static function logoutListener() { - if ( isset($_GET['logoutbutton']) AND isset($_SESSION['username']) ) { - header('WWW-Authenticate: Basic realm="ownCloud"'); - header('HTTP/1.0 401 Unauthorized'); - die('401 Unauthorized'); - } - } - - /** - * Check if the user is logged in - * - */ - public static function isLoggedIn(){ - if ( isset($_SESSION['user_id']) AND $_SESSION['user_id'] ) { - return true; - } else { - if ( isset($_SERVER['PHP_AUTH_USER']) AND ('' != $_SERVER["PHP_AUTH_USER"]) ) { - $_SESSION['user_id'] = $_SERVER['PHP_AUTH_USER']; - $_SESSION['username'] = $_SERVER['PHP_AUTH_USER']; - $_SESSION['username_clean'] = $_SERVER['PHP_AUTH_USER']; - return true; - } - } - return false; - } - - /** - * Try to create a new group - * - * @param string $groupName The name of the group to create - */ - public static function createGroup($groupName) { - // does not work with MOD_AUTH (only or some modules) - return false; - } - - /** - * Get the ID of a user - * - * @param string $username Name of the user to find the ID - * @param boolean $noCache If false the cache is used to find the ID - */ - public static function getUserId($username, $noCache=false) { - // does not work with MOD_AUTH (only or some modules) - return 0; - } - - /** - * Get the ID of a group - * - * @param string $groupName Name of the group to find the ID - * @param boolean $noCache If false the cache is used to find the ID - */ - public static function getGroupId($groupName, $noCache=false) { - // does not work with MOD_AUTH (only or some modules) - return 0; - } - - /** - * Get the name of a group - * - * @param string $groupId ID of the group - * @param boolean $noCache If false the cache is used to find the name of the group - */ - public static function getGroupName($groupId, $noCache=false) { - // does not work with MOD_AUTH (only or some modules) - return 0; - } - - /** - * Check if a user belongs to a group - * - * @param string $username Name of the user to check - * @param string $groupName Name of the group - */ - public static function inGroup($username, $groupName) { - // does not work with MOD_AUTH (only or some modules) - return false; - } - - /** - * Add a user to a group - * - * @param string $username Name of the user to add to group - * @param string $groupName Name of the group in which add the user - */ - public static function addToGroup($username, $groupName) { - // does not work with MOD_AUTH (only or some modules) - return false; - } - - /** - * Remove a user from a group - * - * @param string $username Name of the user to remove from group - * @param string $groupName Name of the group from which remove the user - */ - public static function removeFromGroup($username,$groupName){ - // does not work with MOD_AUTH (only or some modules) - return false; - } - - /** - * Generate a random password - */ - public static function generatePassword() { - return uniqId(); - } - - /** - * Get all groups the user belongs to - * - * @param string $username Name of the user - */ - public static function getUserGroups($username) { - // does not work with MOD_AUTH (only or some modules) - $groups=array(); - return $groups; - } - - /** - * Set the password of a user - * - * @param string $username User who password will be changed - * @param string $password The new password for the user - */ - public static function setPassword($username, $password) { - return false; - } - - /** - * Check if the password of the user is correct - * - * @param string $username Name of the user - * @param string $password Password of the user - */ - public static function checkPassword($username, $password) { - // does not work with MOD_AUTH (only or some modules) - return false; - } - - /** - * get a list of all users - * - */ - public static function getUsers(){ - // does not work with MOD_AUTH (only or some modules) - return false; - } - - /** - * get a list of all groups - * - */ - public static function getGroups(){ - // does not work with MOD_AUTH (only or some modules) - return false; - } -} diff --git a/plugins/ldap/plugin.xml b/plugins/ldap/plugin.xml deleted file mode 100644 index 2127d13e08df554d46f6a455097b3c4e1c82dff2..0000000000000000000000000000000000000000 --- a/plugins/ldap/plugin.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0"?> -<plugin version='1.0'> - <info> - <id>ldap</id> - <name>LDAP support for ownCloud</name> - <version>0.1</version> - <licence>AGPL</licence> - <author>fabian</author> - <require>1.1</require> - </info> - <runtime> - <include>lib_ldap.php</include> - </runtime> -</plugin> \ No newline at end of file diff --git a/plugins/test/index.php b/plugins/test/index.php deleted file mode 100644 index c277d9b018eb62a8e329cd02da228be49cb48a31..0000000000000000000000000000000000000000 --- a/plugins/test/index.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php - -/** -* ownCloud -* -* @author Frank Karlitschek -* @copyright 2010 Frank Karlitschek karlitschek@kde.org -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either -* version 3 of the License, or any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. -* -*/ - - -require_once('../../inc/lib_base.php'); - - -OC_UTIL::showheader(); - -echo('<div class="center">'); -echo('nothing here yet :-)'); -echo('</div>'); - - -OC_UTIL::showfooter(); - -?> diff --git a/plugins/test/lib_test.php b/plugins/test/lib_test.php deleted file mode 100644 index f28fd0d527b0e70acbf5afdde817b0dab38a4325..0000000000000000000000000000000000000000 --- a/plugins/test/lib_test.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php - -/** -* ownCloud -* -* @author Frank Karlitschek -* @copyright 2010 Frank Karlitschek karlitschek@kde.org -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either -* version 3 of the License, or any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. -* -*/ - - -// register navigation entry -OC_UTIL::addnavigationentry('Test','/plugins/test'); - -// nothing here yet - - -?> diff --git a/plugins/test/plugin.xml b/plugins/test/plugin.xml deleted file mode 100644 index b9207c27637a15244f7ed9032bb3341f4bc509af..0000000000000000000000000000000000000000 --- a/plugins/test/plugin.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0"?> -<plugin version='1.0'> - <info> - <id>test</id> - <name>Test plugin</name> - <version>0.1</version> - <licence>AGPL</licence> - <author>2010 Frank Karlitschek karlitschek@kde.org</author> - <require>1.1</require> - </info> - <runtime> - <include>lib_test.php</include> - </runtime> -</plugin> - diff --git a/plugins/textviewer/lib_textviewer.php b/plugins/textviewer/lib_textviewer.php deleted file mode 100644 index 2853ee2f9a5ae5c786ed7c1a89cf8aa23b9f5658..0000000000000000000000000000000000000000 --- a/plugins/textviewer/lib_textviewer.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php -//load the required js and css files -OC_UTIL::addScript('plugins/textviewer/textviewer.js'); -OC_UTIL::addStyle('plugins/textviewer/style.css'); - -//load SyntaxHighligher -OC_UTIL::addScript('plugins/textviewer/syntaxhighlighter/scripts/shCore.js'); -OC_UTIL::addStyle('plugins/textviewer/syntaxhighlighter/styles/shCoreDefault.css'); -OC_UTIL::addStyle('plugins/textviewer/syntaxhighlighter/styles/shCore.css'); -OC_UTIL::addStyle('plugins/textviewer/syntaxhighlighter/styles/shThemeDefault.css'); -?> diff --git a/plugins/textviewer/plugin.xml b/plugins/textviewer/plugin.xml deleted file mode 100644 index fe2cd6335f4745f4d8a49fe457bb9132cf2c0dc9..0000000000000000000000000000000000000000 --- a/plugins/textviewer/plugin.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0"?> -<plugin version='1.0'> - <info> - <id>textviewer</id> - <name>A simple text viewer for ownCloud</name> - <version>0.2</version> - <licence>AGPL</licence> - <author>Icewind</author> - <require>1.1</require> - </info> - <runtime> - <include>lib_textviewer.php</include> - </runtime> -</plugin> diff --git a/plugins/textviewer/style.css b/plugins/textviewer/style.css deleted file mode 100644 index d12710474c442e791acec095369b0c2e3a27f7d1..0000000000000000000000000000000000000000 --- a/plugins/textviewer/style.css +++ /dev/null @@ -1,37 +0,0 @@ -#textframe{ - position:absolute; - top:0px; - left:0px; - height:100%; - width:100%; - background:rgb(20,20,20); - background:rgba(20,20,20,0.9); - text-align:center; -} - -#textframe>div{ - vertical-align:middle; - text-align:left; - height:auto; - max-height:90%; - max-width:90%; - margin:20px; - margin-left:auto; - margin-right:auto; - margin-bottom:10px; - padding:0px; - border: black solid 3px; - background:black; - color:white; - overflow:auto; -} - -#textframe>div>div>div{ - margin:0px !important; - top:0px !important; - height:100% !important; -} - -#textframe>div div,#textframe>div td{ - overflow:hidden !important; -} diff --git a/plugins/textviewer/syntaxhighlighter/LGPL-LICENSE b/plugins/textviewer/syntaxhighlighter/LGPL-LICENSE deleted file mode 100644 index 3f9959fc566752e1cb49215957764d4b135fccdd..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/LGPL-LICENSE +++ /dev/null @@ -1,165 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. \ No newline at end of file diff --git a/plugins/textviewer/syntaxhighlighter/MIT-LICENSE b/plugins/textviewer/syntaxhighlighter/MIT-LICENSE deleted file mode 100644 index e7c70ba14a4a2ba8771dcf6dcd9fb460d6a0352c..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/MIT-LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2003, 2004 Jim Weirich - -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. diff --git a/plugins/textviewer/syntaxhighlighter/compass/_theme_template.scss b/plugins/textviewer/syntaxhighlighter/compass/_theme_template.scss deleted file mode 100644 index 53f4df533b08b9be448f931314ad50e03e3f6bbf..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/compass/_theme_template.scss +++ /dev/null @@ -1,120 +0,0 @@ -$background: white !default; - -$line_alt1_background: $background !default; -$line_alt2_background: $background !default; - -$line_highlighted_background: #e0e0e0 !default; -$line_highlighted_number: black !default; - -$gutter_text: #afafaf !default; -$gutter_border_color: #6ce26c !default; -$gutter_border: 3px solid $gutter_border_color !default; - -$toolbar_collapsed_a: #00f !default; -$toolbar_collapsed_a_hover: #f00 !default; -$toolbar_collapsed_background: #fff !default; -$toolbar_collapsed_border: 1px solid $gutter_border_color !default; - -$toolbar_a: #fff !default; -$toolbar_a_hover: #000 !default; -$toolbar_background: $gutter_border_color !default; -$toolbar_border: none !default; - -$code_plain: black !default; -$code_comments: #008200 !default; -$code_string: blue !default; -$code_keyword: #006699 !default; -$code_preprocessor: gray !default; -$code_variable: #aa7700 !default; -$code_value: #009900 !default; -$code_functions: #ff1493 !default; -$code_constants: #0066cc !default; -$code_script: $code_keyword !default; -$code_script_background: none !default; -$code_color1: gray !default; -$code_color2: #ff1493 !default; -$code_color3: red !default; - -$caption_color: $code_plain !default; - -// Interface elements. -.syntaxhighlighter { - background-color: $background !important; - - // Highlighed line number - .line { - &.alt1 { background-color: $line_alt1_background !important; } - &.alt2 { background-color: $line_alt2_background !important; } - - // Highlighed line - &.highlighted { - &.alt1, &.alt2 { background-color: $line_highlighted_background !important; } - &.number { color: $line_highlighted_number !important; } - } - } - - table { - caption { - color: $caption_color !important; - } - } - - // Add border to the lines - .gutter { - color: $gutter_text !important; - .line { - border-right: $gutter_border !important; - - &.highlighted { - background-color: $gutter_border_color !important; - color: $background !important; - } - } - } - - &.printing .line .content { border: none !important; } - - &.collapsed { - overflow: visible !important; - - .toolbar { - color: $toolbar_collapsed_a !important; - background: $toolbar_collapsed_background !important; - border: $toolbar_collapsed_border !important; - - a { - color: $toolbar_collapsed_a !important; - &:hover { color: $toolbar_collapsed_a_hover !important; } - } - } - } - - .toolbar { - color: $toolbar_a !important; - background: $toolbar_background !important; - border: $toolbar_border !important; - a { - color: $toolbar_a !important; - &:hover { color: $toolbar_a_hover !important; } - } - } - - // Actual syntax highlighter colors. - .plain, .plain a { color: $code_plain !important; } - .comments, .comments a { color: $code_comments !important; } - .string, .string a { color: $code_string !important; } - .keyword { color: $code_keyword !important; } - .preprocessor { color: $code_preprocessor !important; } - .variable { color: $code_variable !important; } - .value { color: $code_value !important; } - .functions { color: $code_functions !important; } - .constants { color: $code_constants !important; } - .script { - font-weight: bold !important; - color: $code_script !important; - background-color: $code_script_background !important; - } - .color1, .color1 a { color: $code_color1 !important; } - .color2, .color2 a { color: $code_color2 !important; } - .color3, .color3 a { color: $code_color3 !important; } -} diff --git a/plugins/textviewer/syntaxhighlighter/compass/config.rb b/plugins/textviewer/syntaxhighlighter/compass/config.rb deleted file mode 100644 index 6f82de12e75a37c8acf5c178b522dd9508890f15..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/compass/config.rb +++ /dev/null @@ -1,14 +0,0 @@ -environment = :production -project_type = :stand_alone -http_path = "/" -css_dir = "../styles" -sass_dir = "." -images_dir = "images" -sass_options = { - :line_numbers => false, - :debug_info => false -} - -# output_style = :compressed -# output_style = :compact -output_style = :expanded diff --git a/plugins/textviewer/syntaxhighlighter/compass/shCore.scss b/plugins/textviewer/syntaxhighlighter/compass/shCore.scss deleted file mode 100644 index a67e4f908a26366e257003689345db0172e2cbef..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/compass/shCore.scss +++ /dev/null @@ -1,216 +0,0 @@ -@mixin round_corners_custom($top, $right, $bottom, $left) { - -moz-border-radius: $top $right $bottom $left !important; - -webkit-border-radius: $top $right $bottom $left !important; -} - -@mixin round_corners($radius) { - @include round_corners_custom($radius, $radius, $radius, $radius); -} - -.syntaxhighlighter { - a, - div, - code, - table, - table td, - table tr, - table tbody, - table thead, - table caption, - textarea { - @include round_corners(0); - - background: none !important; - border: 0 !important; - bottom: auto !important; - float: none !important; - height: auto !important; - left: auto !important; - line-height: 1.1em !important; - margin: 0 !important; - outline: 0 !important; - overflow: visible !important; - padding: 0 !important; - position: static !important; - right: auto !important; - text-align: left !important; - top: auto !important; - vertical-align: baseline !important; - width: auto !important; - box-sizing: content-box !important; - font: { - family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; - weight: normal !important; - style: normal !important; - size: 1em !important; - } - min: { - // For IE8, FF & WebKit - height: inherit !important; - // For IE7 - height: auto !important; - } - } -} - -.syntaxhighlighter { - width: 100% !important; - margin: 1em 0 1em 0 !important; - - position: relative !important; - overflow: auto !important; - font-size: 1em !important; - - &.source { overflow: hidden !important; } - - // set up bold and italic - .bold { font-weight: bold !important; } - .italic { font-style: italic !important; } - - .line { white-space: pre !important; } - - // main table and columns - table { - width: 100% !important; - caption { - text-align: left !important; - padding: .5em 0 0.5em 1em !important; - } - - td.code { - width: 100% !important; - - .container { - position: relative !important; - - textarea { - box-sizing: border-box !important; - position: absolute !important; - left: 0 !important; - top: 0 !important; - width: 100% !important; - height: 100% !important; - border: none !important; - background: white !important; - padding-left: 1em !important; - overflow: hidden !important; - white-space: pre !important; - } - } - } - - // middle spacing between line numbers and lines - td.gutter .line { - text-align: right !important; - padding: 0 0.5em 0 1em !important; - } - - td.code .line { - padding: 0 1em !important; - } - } - - &.nogutter { - td.code { - .container textarea, .line { padding-left: 0em !important; } - } - } - - &.show { display: block !important; } - - // Adjust some properties when collapsed - &.collapsed { - table { display: none !important; } - - .toolbar { - padding: 0.1em 0.8em 0em 0.8em !important; - font-size: 1em !important; - position: static !important; - width: auto !important; - height: auto !important; - - span { - display: inline !important; - margin-right: 1em !important; - - a { - padding: 0 !important; - display: none !important; - &.expandSource { display: inline !important; } - } - } - } - } - - // Styles for the toolbar - .toolbar { - position: absolute !important; - right: 1px !important; - top: 1px !important; - width: 11px !important; - height: 11px !important; - font-size: 10px !important; - z-index: 10 !important; - - span.title { display: inline !important; } - - a { - display: block !important; - text-align: center !important; - text-decoration: none !important; - padding-top: 1px !important; - - &.expandSource { display: none !important; } - } - } - - &.ie { - font-size: .9em !important; - padding: 1px 0 1px 0 !important; - - .toolbar { - line-height: 8px !important; - a { - padding-top: 0px !important; - } - } - } - - // Print view. - // Colors are based on the default theme without background. - &.printing { - .line.alt1 .content, - .line.alt2 .content, - .line.highlighted .number, - .line.highlighted.alt1 .content, - .line.highlighted.alt2 .content { background: none !important; } - - // Gutter line numbers - .line { - .number { color: #bbbbbb !important; } - // Add border to the lines - .content { color: black !important; } - } - - // Toolbar when visible - .toolbar { display: none !important; } - a { text-decoration: none !important; } - .plain, .plain a { color: black !important; } - .comments, .comments a { color: #008200 !important; } - .string, .string a { color: blue !important; } - .keyword { - color: #006699 !important; - font-weight: bold !important; - } - .preprocessor { color: gray !important; } - .variable { color: #aa7700 !important; } - .value { color: #009900 !important; } - .functions { color: #ff1493 !important; } - .constants { color: #0066cc !important; } - .script { font-weight: bold !important; } - .color1, .color1 a { color: gray !important; } - .color2, .color2 a { color: #ff1493 !important; } - .color3, .color3 a { color: red !important; } - .break, .break a { color: black !important; } - } -} \ No newline at end of file diff --git a/plugins/textviewer/syntaxhighlighter/compass/shCoreDefault.scss b/plugins/textviewer/syntaxhighlighter/compass/shCoreDefault.scss deleted file mode 100644 index ff80c7ffbb5438f2a082718e27a46d8e3b83b935..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/compass/shCoreDefault.scss +++ /dev/null @@ -1,2 +0,0 @@ -@import "shCore.scss"; -@import "shThemeDefault.scss"; diff --git a/plugins/textviewer/syntaxhighlighter/compass/shCoreDjango.scss b/plugins/textviewer/syntaxhighlighter/compass/shCoreDjango.scss deleted file mode 100644 index ef572e9d69e977fd5428d650c4a627fbfcdf3849..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/compass/shCoreDjango.scss +++ /dev/null @@ -1,2 +0,0 @@ -@import "shCore.scss"; -@import "shThemeDjango.scss"; diff --git a/plugins/textviewer/syntaxhighlighter/compass/shCoreEclipse.scss b/plugins/textviewer/syntaxhighlighter/compass/shCoreEclipse.scss deleted file mode 100644 index 9767f5373db061319ac13c0c7e5a77eedcde3e50..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/compass/shCoreEclipse.scss +++ /dev/null @@ -1,2 +0,0 @@ -@import "shCore.scss"; -@import "shThemeEclipse.scss"; diff --git a/plugins/textviewer/syntaxhighlighter/compass/shCoreEmacs.scss b/plugins/textviewer/syntaxhighlighter/compass/shCoreEmacs.scss deleted file mode 100644 index 5e466f36b26668079d45e0deab83d13681622b6e..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/compass/shCoreEmacs.scss +++ /dev/null @@ -1,2 +0,0 @@ -@import "shCore.scss"; -@import "shThemeEmacs.scss"; diff --git a/plugins/textviewer/syntaxhighlighter/compass/shCoreFadeToGrey.scss b/plugins/textviewer/syntaxhighlighter/compass/shCoreFadeToGrey.scss deleted file mode 100644 index 46285950fee3cff6cef8a758e90dd33c5b43cd77..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/compass/shCoreFadeToGrey.scss +++ /dev/null @@ -1,2 +0,0 @@ -@import "shCore.scss"; -@import "shThemeFadeToGrey.scss"; diff --git a/plugins/textviewer/syntaxhighlighter/compass/shCoreMDUltra.scss b/plugins/textviewer/syntaxhighlighter/compass/shCoreMDUltra.scss deleted file mode 100644 index 10ad4c5b035eb1a1b55dca1131d2bfcbe937254c..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/compass/shCoreMDUltra.scss +++ /dev/null @@ -1,2 +0,0 @@ -@import "shCore.scss"; -@import "shThemeMDUltra.scss"; diff --git a/plugins/textviewer/syntaxhighlighter/compass/shCoreMidnight.scss b/plugins/textviewer/syntaxhighlighter/compass/shCoreMidnight.scss deleted file mode 100644 index e357eb28f979b2c862afe77e45fe1f6f494b8fce..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/compass/shCoreMidnight.scss +++ /dev/null @@ -1,2 +0,0 @@ -@import "shCore.scss"; -@import "shThemeMidnight.scss"; diff --git a/plugins/textviewer/syntaxhighlighter/compass/shCoreRDark.scss b/plugins/textviewer/syntaxhighlighter/compass/shCoreRDark.scss deleted file mode 100644 index 5c26da34415712dd7eae626295feee23aab40973..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/compass/shCoreRDark.scss +++ /dev/null @@ -1,2 +0,0 @@ -@import "shCore.scss"; -@import "shThemeRDark.scss"; diff --git a/plugins/textviewer/syntaxhighlighter/compass/shThemeDefault.scss b/plugins/textviewer/syntaxhighlighter/compass/shThemeDefault.scss deleted file mode 100644 index 1574dae8053ace55d3a4823c9971f573056353a6..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/compass/shThemeDefault.scss +++ /dev/null @@ -1,7 +0,0 @@ -// Default Syntax Highlighter theme. - -@import "_theme_template.scss"; - -.syntaxhighlighter { - .keyword { font-weight: bold !important; } -} diff --git a/plugins/textviewer/syntaxhighlighter/compass/shThemeDjango.scss b/plugins/textviewer/syntaxhighlighter/compass/shThemeDjango.scss deleted file mode 100644 index 8e95c567aebc1ca1fb5e5b2fc1f5824364f19f30..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/compass/shThemeDjango.scss +++ /dev/null @@ -1,36 +0,0 @@ -// Django SyntaxHighlighter theme - -$background: #0a2b1d !default; - -$line_highlighted_background: #233729 !default; -$line_highlighted_number: white !default; - -$gutter_text: #497958 !default; -$gutter_border_color: #41a83e !default; - -$toolbar_collapsed_a: #96dd3b !default; -$toolbar_collapsed_a_hover: #fff !default; -$toolbar_collapsed_background: #000 !default; - -$toolbar_a: #fff !default; -$toolbar_a_hover: #ffe862 !default; - -$code_plain: #f8f8f8 !default; -$code_comments: #336442 !default; -$code_string: #9df39f !default; -$code_keyword: #96dd3b !default; -$code_preprocessor: #91bb9e !default; -$code_variable: #ffaa3e !default; -$code_value: #f7e741 !default; -$code_functions: #ffaa3e !default; -$code_constants: #e0e8ff !default; -$code_color1: #eb939a !default; -$code_color2: #91bb9e !default; -$code_color3: #edef7d !default; - -@import "_theme_template.scss"; - -.syntaxhighlighter { - .comments { font-style: italic !important; } - .keyword { font-weight: bold !important; } -} diff --git a/plugins/textviewer/syntaxhighlighter/compass/shThemeEclipse.scss b/plugins/textviewer/syntaxhighlighter/compass/shThemeEclipse.scss deleted file mode 100644 index 193fb1d877a6d78649773eb687497309c77f418e..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/compass/shThemeEclipse.scss +++ /dev/null @@ -1,48 +0,0 @@ -// Eclipse IDE SyntaxHighlighter color theme -// (C) Code-House -// :http//blog.code-house.org/2009/10/xml-i-adnotacje-kod-ogolnego-przeznaczenia-i-jpa/ - -$background: #fff !default; - -$line_highlighted_background: #c3defe !default; -$line_highlighted_number: #fff !default; - -$gutter_text: #787878 !default; -$gutter_border_color: #d4d0c8 !default; - -$toolbar_collapsed_a: #3f5fbf !default; -$toolbar_collapsed_a_hover: #aa7700 !default; -$toolbar_collapsed_background: #fff !default; - -$toolbar_a: #a0a0a0 !default; -$toolbar_a_hover: red !default; - -$code_plain: black !default; -$code_comments: #3f5fbf !default; -$code_string: #2a00ff !default; -$code_keyword: #7f0055 !default; -$code_preprocessor: #646464 !default; -$code_variable: #aa7700 !default; -$code_value: #009900 !default; -$code_functions: #ff1493 !default; -$code_constants: #0066cc !default; -$code_color1: gray !default; -$code_color2: #ff1493 !default; -$code_color3: red !default; - -@import "_theme_template.scss"; - -.syntaxhighlighter { - .keyword { font-weight: bold !important; } - - .xml { - .keyword { - color: #3f7f7f !important; - font-weight: normal !important; } - .color1, .color1 a { color: #7f007f !important; } - .string { - font-style: italic !important; - color: #2a00ff !important; - } - } -} diff --git a/plugins/textviewer/syntaxhighlighter/compass/shThemeEmacs.scss b/plugins/textviewer/syntaxhighlighter/compass/shThemeEmacs.scss deleted file mode 100644 index 11c9deb4d08130c60a655a644968fa370ccd5307..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/compass/shThemeEmacs.scss +++ /dev/null @@ -1,32 +0,0 @@ -// Emacs SyntaxHighlighter theme based on theme by Joshua Emmons -// http://www.skia.net/ - -$background: black !default; - -$line_highlighted_background: #2A3133 !default; -$line_highlighted_number: white !default; - -$gutter_text: #d3d3d3 !default; -$gutter_border_color: #990000 !default; - -$toolbar_collapsed_a: #ebdb8d !default; -$toolbar_collapsed_a_hover: #ff7d27 !default; -$toolbar_collapsed_background: black !default; - -$toolbar_a: #fff !default; -$toolbar_a_hover: #9ccff4 !default; - -$code_plain: #d3d3d3 !default; -$code_comments: #ff7d27 !default; -$code_string: #ff9e7b !default; -$code_keyword: aqua !default; -$code_preprocessor: #aec4de !default; -$code_variable: #ffaa3e !default; -$code_value: #009900 !default; -$code_functions: #81cef9 !default; -$code_constants: #ff9e7b !default; -$code_color1: #ebdb8d !default; -$code_color2: #ff7d27 !default; -$code_color3: #aec4de !default; - -@import "_theme_template.scss"; diff --git a/plugins/textviewer/syntaxhighlighter/compass/shThemeFadeToGrey.scss b/plugins/textviewer/syntaxhighlighter/compass/shThemeFadeToGrey.scss deleted file mode 100644 index 7963814952f64c54a90fcfc40b7bbc028fb8c51f..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/compass/shThemeFadeToGrey.scss +++ /dev/null @@ -1,36 +0,0 @@ -// Fade to Grey SyntaxHighlighter theme based on theme by Brasten Sager -// :http//www.ibrasten.com/ - -$background: #121212 !default; - -$line_highlighted_background: #2C2C29 !default; -$line_highlighted_number: white !default; - -$gutter_text: #afafaf !default; -$gutter_border_color: #3185b9 !default; - -$toolbar_collapsed_a: #3185b9 !default; -$toolbar_collapsed_a_hover: #d01d33 !default; -$toolbar_collapsed_background: black !default; - -$toolbar_a: #fff !default; -$toolbar_a_hover: #96daff !default; - -$code_plain: white !default; -$code_comments: #696854 !default; -$code_string: #e3e658 !default; -$code_keyword: #d01d33 !default; -$code_preprocessor: #435a5f !default; -$code_variable: #898989 !default; -$code_value: #009900 !default; -$code_functions: #aaaaaa !default; -$code_constants: #96daff !default; -$code_color1: #ffc074 !default; -$code_color2: #4a8cdb !default; -$code_color3: #96daff !default; - -@import "_theme_template.scss"; - -.syntaxhighlighter { - .functions { font-weight: bold !important; } -} diff --git a/plugins/textviewer/syntaxhighlighter/compass/shThemeMDUltra.scss b/plugins/textviewer/syntaxhighlighter/compass/shThemeMDUltra.scss deleted file mode 100644 index 0356fa6c934644569cc464366ef09fcb7ea9558f..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/compass/shThemeMDUltra.scss +++ /dev/null @@ -1,32 +0,0 @@ -// MDUltra SyntaxHighlighter theme based on Midnight Theme -// http://www.mddev.co.uk/ - -$background: #222222 !default; - -$line_highlighted_background: #253e5a !default; -$line_highlighted_number: white !default; - -$gutter_text: #38566f !default; -$gutter_border_color: #435a5f !default; - -$toolbar_collapsed_a: #428bdd !default; -$toolbar_collapsed_a_hover: lime !default; -$toolbar_collapsed_background: black !default; - -$toolbar_a: #aaaaff !default; -$toolbar_a_hover: #9ccff4 !default; - -$code_plain: lime !default; -$code_comments: #428bdd !default; -$code_string: lime !default; -$code_keyword: #aaaaff !default; -$code_preprocessor: #8aa6c1 !default; -$code_variable: aqua !default; -$code_value: #f7e741 !default; -$code_functions: #ff8000 !default; -$code_constants: yellow !default; -$code_color1: red !default; -$code_color2: yellow !default; -$code_color3: #ffaa3e !default; - -@import "_theme_template.scss"; diff --git a/plugins/textviewer/syntaxhighlighter/compass/shThemeMidnight.scss b/plugins/textviewer/syntaxhighlighter/compass/shThemeMidnight.scss deleted file mode 100644 index a4dae02305f00ebbef91279bf13420d0955f447d..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/compass/shThemeMidnight.scss +++ /dev/null @@ -1,32 +0,0 @@ -// Midnight SyntaxHighlighter theme based on theme by J.D. Myers -// http://webdesign.lsnjd.com/ - -$background: #0f192a !default; - -$line_highlighted_background: #253e5a !default; -$line_highlighted_number: #38566f !default; - -$gutter_text: #afafaf !default; -$gutter_border_color: #435a5f !default; - -$toolbar_collapsed_a: #428bdd !default; -$toolbar_collapsed_a_hover: #1dc116 !default; -$toolbar_collapsed_background: #000 !default; - -$toolbar_a: #D1EDFF !default; -$toolbar_a_hover: #8aa6c1 !default; - -$code_plain: #d1edff !default; -$code_comments: #428bdd !default; -$code_string: #1dc116 !default; -$code_keyword: #b43d3d !default; -$code_preprocessor: #8aa6c1 !default; -$code_variable: #ffaa3e !default; -$code_value: #f7e741 !default; -$code_functions: #ffaa3e !default; -$code_constants: #e0e8ff !default; -$code_color1: #f8bb00 !default; -$code_color2: white !default; -$code_color3: #ffaa3e !default; - -@import "_theme_template.scss"; diff --git a/plugins/textviewer/syntaxhighlighter/compass/shThemeRDark.scss b/plugins/textviewer/syntaxhighlighter/compass/shThemeRDark.scss deleted file mode 100644 index 3b67b15372159a7be62db5fb90a9b972f45c16d0..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/compass/shThemeRDark.scss +++ /dev/null @@ -1,32 +0,0 @@ -// RDark SyntaxHighlighter theme based on theme by Radu Dineiu -// http://www.vim.org/scripts/script.php?script_id=1732 - -$background: #1b2426 !default; - -$line_highlighted_background: #323E41 !default; -$line_highlighted_number: #b9bdb6 !default; - -$gutter_text: #afafaf !default; -$gutter_border_color: #435a5f !default; - -$toolbar_collapsed_a: #5ba1cf !default; -$toolbar_collapsed_a_hover: #5ce638 !default; -$toolbar_collapsed_background: #000 !default; - -$toolbar_a: #fff !default; -$toolbar_a_hover: #e0e8ff !default; - -$code_plain: #b9bdb6 !default; -$code_comments: #878a85 !default; -$code_string: #5ce638 !default; -$code_keyword: #5ba1cf !default; -$code_preprocessor: #435a5f !default; -$code_variable: #ffaa3e !default; -$code_value: #009900 !default; -$code_functions: #ffaa3e !default; -$code_constants: #e0e8ff !default; -$code_color1: #e0e8ff !default; -$code_color2: white !default; -$code_color3: #ffaa3e !default; - -@import "_theme_template.scss"; diff --git a/plugins/textviewer/syntaxhighlighter/index.html b/plugins/textviewer/syntaxhighlighter/index.html deleted file mode 100644 index 60908f4ad738bb8e003e78c6ad2c5850a84d0890..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/index.html +++ /dev/null @@ -1,22 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> - <title>Hello SyntaxHighlighter</title> - <script type="text/javascript" src="scripts/shCore.js"></script> - <script type="text/javascript" src="scripts/shBrushJScript.js"></script> - <link type="text/css" rel="stylesheet" href="styles/shCoreDefault.css"/> - <script type="text/javascript">SyntaxHighlighter.all();</script> -</head> - -<body style="background: white; font-family: Helvetica"> - -<h1>Hello SyntaxHighlighter</h1> -<pre class="brush: js;"> -function helloSyntaxHighlighter() -{ - return "hi!"; -} -</pre> - -</html> diff --git a/plugins/textviewer/syntaxhighlighter/scripts/shAutoloader.js b/plugins/textviewer/syntaxhighlighter/scripts/shAutoloader.js deleted file mode 100644 index 4e29bddecbbcdb01c669fb2c89aca4a2505a59bc..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/scripts/shAutoloader.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('(2(){1 h=5;h.I=2(){2 n(c,a){4(1 d=0;d<c.9;d++)i[c[d]]=a}2 o(c){1 a=r.H("J"),d=3;a.K=c;a.M="L/t";a.G="t";a.u=a.v=2(){6(!d&&(!8.7||8.7=="F"||8.7=="z")){d=q;e[c]=q;a:{4(1 p y e)6(e[p]==3)B a;j&&5.C(k)}a.u=a.v=x;a.D.O(a)}};r.N.R(a)}1 f=Q,l=h.P(),i={},e={},j=3,k=x,b;5.T=2(c){k=c;j=q};4(b=0;b<f.9;b++){1 m=f[b].w?f[b]:f[b].S(/\\s+/),g=m.w();n(m,g)}4(b=0;b<l.9;b++)6(g=i[l[b].E.A]){e[g]=3;o(g)}}})();',56,56,'|var|function|false|for|SyntaxHighlighter|if|readyState|this|length|||||||||||||||||true|document||javascript|onload|onreadystatechange|pop|null|in|complete|brush|break|highlight|parentNode|params|loaded|language|createElement|autoloader|script|src|text|type|body|removeChild|findElements|arguments|appendChild|split|all'.split('|'),0,{})) diff --git a/plugins/textviewer/syntaxhighlighter/scripts/shBrushAS3.js b/plugins/textviewer/syntaxhighlighter/scripts/shBrushAS3.js deleted file mode 100644 index 8aa3ed2732adc3bb5ca65124348d2438efdd2ba0..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/scripts/shBrushAS3.js +++ /dev/null @@ -1,59 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -;(function() -{ - // CommonJS - typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; - - function Brush() - { - // Created by Peter Atoria @ http://iAtoria.com - - var inits = 'class interface function package'; - - var keywords = '-Infinity ...rest Array as AS3 Boolean break case catch const continue Date decodeURI ' + - 'decodeURIComponent default delete do dynamic each else encodeURI encodeURIComponent escape ' + - 'extends false final finally flash_proxy for get if implements import in include Infinity ' + - 'instanceof int internal is isFinite isNaN isXMLName label namespace NaN native new null ' + - 'Null Number Object object_proxy override parseFloat parseInt private protected public ' + - 'return set static String super switch this throw true try typeof uint undefined unescape ' + - 'use void while with' - ; - - this.regexList = [ - { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments - { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments - { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings - { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings - { regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers - { regex: new RegExp(this.getKeywords(inits), 'gm'), css: 'color3' }, // initializations - { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords - { regex: new RegExp('var', 'gm'), css: 'variable' }, // variable - { regex: new RegExp('trace', 'gm'), css: 'color1' } // trace - ]; - - this.forHtmlScript(SyntaxHighlighter.regexLib.scriptScriptTags); - }; - - Brush.prototype = new SyntaxHighlighter.Highlighter(); - Brush.aliases = ['actionscript3', 'as3']; - - SyntaxHighlighter.brushes.AS3 = Brush; - - // CommonJS - typeof(exports) != 'undefined' ? exports.Brush = Brush : null; -})(); diff --git a/plugins/textviewer/syntaxhighlighter/scripts/shBrushAppleScript.js b/plugins/textviewer/syntaxhighlighter/scripts/shBrushAppleScript.js deleted file mode 100644 index d40bbd7dd262cad9bad0184b46f1641cfe5e9950..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/scripts/shBrushAppleScript.js +++ /dev/null @@ -1,75 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -;(function() -{ - // CommonJS - typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; - - function Brush() - { - // AppleScript brush by David Chambers - // http://davidchambersdesign.com/ - var keywords = 'after before beginning continue copy each end every from return get global in local named of set some that the then times to where whose with without'; - var ordinals = 'first second third fourth fifth sixth seventh eighth ninth tenth last front back middle'; - var specials = 'activate add alias AppleScript ask attachment boolean class constant delete duplicate empty exists false id integer list make message modal modified new no paragraph pi properties quit real record remove rest result reveal reverse run running save string true word yes'; - - this.regexList = [ - - { regex: /(--|#).*$/gm, - css: 'comments' }, - - { regex: /\(\*(?:[\s\S]*?\(\*[\s\S]*?\*\))*[\s\S]*?\*\)/gm, // support nested comments - css: 'comments' }, - - { regex: /"[\s\S]*?"/gm, - css: 'string' }, - - { regex: /(?:,|:|¬|'s\b|\(|\)|\{|\}|«|\b\w*»)/g, - css: 'color1' }, - - { regex: /(-)?(\d)+(\.(\d)?)?(E\+(\d)+)?/g, // numbers - css: 'color1' }, - - { regex: /(?:&(amp;|gt;|lt;)?|=|� |>|<|≥|>=|≤|<=|\*|\+|-|\/|÷|\^)/g, - css: 'color2' }, - - { regex: /\b(?:and|as|div|mod|not|or|return(?!\s&)(ing)?|equals|(is(n't| not)? )?equal( to)?|does(n't| not) equal|(is(n't| not)? )?(greater|less) than( or equal( to)?)?|(comes|does(n't| not) come) (after|before)|is(n't| not)?( in)? (back|front) of|is(n't| not)? behind|is(n't| not)?( (in|contained by))?|does(n't| not) contain|contain(s)?|(start|begin|end)(s)? with|((but|end) )?(consider|ignor)ing|prop(erty)?|(a )?ref(erence)?( to)?|repeat (until|while|with)|((end|exit) )?repeat|((else|end) )?if|else|(end )?(script|tell|try)|(on )?error|(put )?into|(of )?(it|me)|its|my|with (timeout( of)?|transaction)|end (timeout|transaction))\b/g, - css: 'keyword' }, - - { regex: /\b\d+(st|nd|rd|th)\b/g, // ordinals - css: 'keyword' }, - - { regex: /\b(?:about|above|against|around|at|below|beneath|beside|between|by|(apart|aside) from|(instead|out) of|into|on(to)?|over|since|thr(ough|u)|under)\b/g, - css: 'color3' }, - - { regex: /\b(?:adding folder items to|after receiving|choose( ((remote )?application|color|folder|from list|URL))?|clipboard info|set the clipboard to|(the )?clipboard|entire contents|display(ing| (alert|dialog|mode))?|document( (edited|file|nib name))?|file( (name|type))?|(info )?for|giving up after|(name )?extension|quoted form|return(ed)?|second(?! item)(s)?|list (disks|folder)|text item(s| delimiters)?|(Unicode )?text|(disk )?item(s)?|((current|list) )?view|((container|key) )?window|with (data|icon( (caution|note|stop))?|parameter(s)?|prompt|properties|seed|title)|case|diacriticals|hyphens|numeric strings|punctuation|white space|folder creation|application(s( folder)?| (processes|scripts position|support))?|((desktop )?(pictures )?|(documents|downloads|favorites|home|keychain|library|movies|music|public|scripts|sites|system|users|utilities|workflows) )folder|desktop|Folder Action scripts|font(s| panel)?|help|internet plugins|modem scripts|(system )?preferences|printer descriptions|scripting (additions|components)|shared (documents|libraries)|startup (disk|items)|temporary items|trash|on server|in AppleTalk zone|((as|long|short) )?user name|user (ID|locale)|(with )?password|in (bundle( with identifier)?|directory)|(close|open for) access|read|write( permission)?|(g|s)et eof|using( delimiters)?|starting at|default (answer|button|color|country code|entr(y|ies)|identifiers|items|name|location|script editor)|hidden( answer)?|open(ed| (location|untitled))?|error (handling|reporting)|(do( shell)?|load|run|store) script|administrator privileges|altering line endings|get volume settings|(alert|boot|input|mount|output|set) volume|output muted|(fax|random )?number|round(ing)?|up|down|toward zero|to nearest|as taught in school|system (attribute|info)|((AppleScript( Studio)?|system) )?version|(home )?directory|(IPv4|primary Ethernet) address|CPU (type|speed)|physical memory|time (stamp|to GMT)|replacing|ASCII (character|number)|localized string|from table|offset|summarize|beep|delay|say|(empty|multiple) selections allowed|(of|preferred) type|invisibles|showing( package contents)?|editable URL|(File|FTP|News|Media|Web) [Ss]ervers|Telnet hosts|Directory services|Remote applications|waiting until completion|saving( (in|to))?|path (for|to( (((current|frontmost) )?application|resource))?)|POSIX (file|path)|(background|RGB) color|(OK|cancel) button name|cancel button|button(s)?|cubic ((centi)?met(re|er)s|yards|feet|inches)|square ((kilo)?met(re|er)s|miles|yards|feet)|(centi|kilo)?met(re|er)s|miles|yards|feet|inches|lit(re|er)s|gallons|quarts|(kilo)?grams|ounces|pounds|degrees (Celsius|Fahrenheit|Kelvin)|print( (dialog|settings))?|clos(e(able)?|ing)|(de)?miniaturized|miniaturizable|zoom(ed|able)|attribute run|action (method|property|title)|phone|email|((start|end)ing|home) page|((birth|creation|current|custom|modification) )?date|((((phonetic )?(first|last|middle))|computer|host|maiden|related) |nick)?name|aim|icq|jabber|msn|yahoo|address(es)?|save addressbook|should enable action|city|country( code)?|formatte(r|d address)|(palette )?label|state|street|zip|AIM [Hh]andle(s)?|my card|select(ion| all)?|unsaved|(alpha )?value|entr(y|ies)|group|(ICQ|Jabber|MSN) handle|person|people|company|department|icon image|job title|note|organization|suffix|vcard|url|copies|collating|pages (across|down)|request print time|target( printer)?|((GUI Scripting|Script menu) )?enabled|show Computer scripts|(de)?activated|awake from nib|became (key|main)|call method|of (class|object)|center|clicked toolbar item|closed|for document|exposed|(can )?hide|idle|keyboard (down|up)|event( (number|type))?|launch(ed)?|load (image|movie|nib|sound)|owner|log|mouse (down|dragged|entered|exited|moved|up)|move|column|localization|resource|script|register|drag (info|types)|resigned (active|key|main)|resiz(e(d)?|able)|right mouse (down|dragged|up)|scroll wheel|(at )?index|should (close|open( untitled)?|quit( after last window closed)?|zoom)|((proposed|screen) )?bounds|show(n)?|behind|in front of|size (mode|to fit)|update(d| toolbar item)?|was (hidden|miniaturized)|will (become active|close|finish launching|hide|miniaturize|move|open|quit|(resign )?active|((maximum|minimum|proposed) )?size|show|zoom)|bundle|data source|movie|pasteboard|sound|tool(bar| tip)|(color|open|save) panel|coordinate system|frontmost|main( (bundle|menu|window))?|((services|(excluded from )?windows) )?menu|((executable|frameworks|resource|scripts|shared (frameworks|support)) )?path|(selected item )?identifier|data|content(s| view)?|character(s)?|click count|(command|control|option|shift) key down|context|delta (x|y|z)|key( code)?|location|pressure|unmodified characters|types|(first )?responder|playing|(allowed|selectable) identifiers|allows customization|(auto saves )?configuration|visible|image( name)?|menu form representation|tag|user(-| )defaults|associated file name|(auto|needs) display|current field editor|floating|has (resize indicator|shadow)|hides when deactivated|level|minimized (image|title)|opaque|position|release when closed|sheet|title(d)?)\b/g, - css: 'color3' }, - - { regex: new RegExp(this.getKeywords(specials), 'gm'), css: 'color3' }, - { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, - { regex: new RegExp(this.getKeywords(ordinals), 'gm'), css: 'keyword' } - ]; - }; - - Brush.prototype = new SyntaxHighlighter.Highlighter(); - Brush.aliases = ['applescript']; - - SyntaxHighlighter.brushes.AppleScript = Brush; - - // CommonJS - typeof(exports) != 'undefined' ? exports.Brush = Brush : null; -})(); diff --git a/plugins/textviewer/syntaxhighlighter/scripts/shBrushBash.js b/plugins/textviewer/syntaxhighlighter/scripts/shBrushBash.js deleted file mode 100644 index 8c296969ff440083931c6208855617723db152f1..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/scripts/shBrushBash.js +++ /dev/null @@ -1,59 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -;(function() -{ - // CommonJS - typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; - - function Brush() - { - var keywords = 'if fi then elif else for do done until while break continue case function return in eq ne ge le'; - var commands = 'alias apropos awk basename bash bc bg builtin bzip2 cal cat cd cfdisk chgrp chmod chown chroot' + - 'cksum clear cmp comm command cp cron crontab csplit cut date dc dd ddrescue declare df ' + - 'diff diff3 dig dir dircolors dirname dirs du echo egrep eject enable env ethtool eval ' + - 'exec exit expand export expr false fdformat fdisk fg fgrep file find fmt fold format ' + - 'free fsck ftp gawk getopts grep groups gzip hash head history hostname id ifconfig ' + - 'import install join kill less let ln local locate logname logout look lpc lpr lprint ' + - 'lprintd lprintq lprm ls lsof make man mkdir mkfifo mkisofs mknod more mount mtools ' + - 'mv netstat nice nl nohup nslookup open op passwd paste pathchk ping popd pr printcap ' + - 'printenv printf ps pushd pwd quota quotacheck quotactl ram rcp read readonly renice ' + - 'remsync rm rmdir rsync screen scp sdiff sed select seq set sftp shift shopt shutdown ' + - 'sleep sort source split ssh strace su sudo sum symlink sync tail tar tee test time ' + - 'times touch top traceroute trap tr true tsort tty type ulimit umask umount unalias ' + - 'uname unexpand uniq units unset unshar useradd usermod users uuencode uudecode v vdir ' + - 'vi watch wc whereis which who whoami Wget xargs yes' - ; - - this.regexList = [ - { regex: /^#!.*$/gm, css: 'preprocessor bold' }, - { regex: /\/[\w-\/]+/gm, css: 'plain' }, - { regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, // one line comments - { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings - { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings - { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords - { regex: new RegExp(this.getKeywords(commands), 'gm'), css: 'functions' } // commands - ]; - } - - Brush.prototype = new SyntaxHighlighter.Highlighter(); - Brush.aliases = ['bash', 'shell']; - - SyntaxHighlighter.brushes.Bash = Brush; - - // CommonJS - typeof(exports) != 'undefined' ? exports.Brush = Brush : null; -})(); diff --git a/plugins/textviewer/syntaxhighlighter/scripts/shBrushCSharp.js b/plugins/textviewer/syntaxhighlighter/scripts/shBrushCSharp.js deleted file mode 100644 index 079214efe11da48fd686db1dab4ae700de86dfa5..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/scripts/shBrushCSharp.js +++ /dev/null @@ -1,65 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -;(function() -{ - // CommonJS - typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; - - function Brush() - { - var keywords = 'abstract as base bool break byte case catch char checked class const ' + - 'continue decimal default delegate do double else enum event explicit ' + - 'extern false finally fixed float for foreach get goto if implicit in int ' + - 'interface internal is lock long namespace new null object operator out ' + - 'override params private protected public readonly ref return sbyte sealed set ' + - 'short sizeof stackalloc static string struct switch this throw true try ' + - 'typeof uint ulong unchecked unsafe ushort using virtual void while'; - - function fixComments(match, regexInfo) - { - var css = (match[0].indexOf("///") == 0) - ? 'color1' - : 'comments' - ; - - return [new SyntaxHighlighter.Match(match[0], match.index, css)]; - } - - this.regexList = [ - { regex: SyntaxHighlighter.regexLib.singleLineCComments, func : fixComments }, // one line comments - { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments - { regex: /@"(?:[^"]|"")*"/g, css: 'string' }, // @-quoted strings - { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings - { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings - { regex: /^\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion - { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // c# keyword - { regex: /\bpartial(?=\s+(?:class|interface|struct)\b)/g, css: 'keyword' }, // contextual keyword: 'partial' - { regex: /\byield(?=\s+(?:return|break)\b)/g, css: 'keyword' } // contextual keyword: 'yield' - ]; - - this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); - }; - - Brush.prototype = new SyntaxHighlighter.Highlighter(); - Brush.aliases = ['c#', 'c-sharp', 'csharp']; - - SyntaxHighlighter.brushes.CSharp = Brush; - - // CommonJS - typeof(exports) != 'undefined' ? exports.Brush = Brush : null; -})(); - diff --git a/plugins/textviewer/syntaxhighlighter/scripts/shBrushColdFusion.js b/plugins/textviewer/syntaxhighlighter/scripts/shBrushColdFusion.js deleted file mode 100644 index 627dbb9b76e181ea7ae7253099bf41b7142cd45d..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/scripts/shBrushColdFusion.js +++ /dev/null @@ -1,100 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -;(function() -{ - // CommonJS - typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; - - function Brush() - { - // Contributed by Jen - // http://www.jensbits.com/2009/05/14/coldfusion-brush-for-syntaxhighlighter-plus - - var funcs = 'Abs ACos AddSOAPRequestHeader AddSOAPResponseHeader AjaxLink AjaxOnLoad ArrayAppend ArrayAvg ArrayClear ArrayDeleteAt ' + - 'ArrayInsertAt ArrayIsDefined ArrayIsEmpty ArrayLen ArrayMax ArrayMin ArraySet ArraySort ArraySum ArraySwap ArrayToList ' + - 'Asc ASin Atn BinaryDecode BinaryEncode BitAnd BitMaskClear BitMaskRead BitMaskSet BitNot BitOr BitSHLN BitSHRN BitXor ' + - 'Ceiling CharsetDecode CharsetEncode Chr CJustify Compare CompareNoCase Cos CreateDate CreateDateTime CreateObject ' + - 'CreateODBCDate CreateODBCDateTime CreateODBCTime CreateTime CreateTimeSpan CreateUUID DateAdd DateCompare DateConvert ' + - 'DateDiff DateFormat DatePart Day DayOfWeek DayOfWeekAsString DayOfYear DaysInMonth DaysInYear DE DecimalFormat DecrementValue ' + - 'Decrypt DecryptBinary DeleteClientVariable DeserializeJSON DirectoryExists DollarFormat DotNetToCFType Duplicate Encrypt ' + - 'EncryptBinary Evaluate Exp ExpandPath FileClose FileCopy FileDelete FileExists FileIsEOF FileMove FileOpen FileRead ' + - 'FileReadBinary FileReadLine FileSetAccessMode FileSetAttribute FileSetLastModified FileWrite Find FindNoCase FindOneOf ' + - 'FirstDayOfMonth Fix FormatBaseN GenerateSecretKey GetAuthUser GetBaseTagData GetBaseTagList GetBaseTemplatePath ' + - 'GetClientVariablesList GetComponentMetaData GetContextRoot GetCurrentTemplatePath GetDirectoryFromPath GetEncoding ' + - 'GetException GetFileFromPath GetFileInfo GetFunctionList GetGatewayHelper GetHttpRequestData GetHttpTimeString ' + - 'GetK2ServerDocCount GetK2ServerDocCountLimit GetLocale GetLocaleDisplayName GetLocalHostIP GetMetaData GetMetricData ' + - 'GetPageContext GetPrinterInfo GetProfileSections GetProfileString GetReadableImageFormats GetSOAPRequest GetSOAPRequestHeader ' + - 'GetSOAPResponse GetSOAPResponseHeader GetTempDirectory GetTempFile GetTemplatePath GetTickCount GetTimeZoneInfo GetToken ' + - 'GetUserRoles GetWriteableImageFormats Hash Hour HTMLCodeFormat HTMLEditFormat IIf ImageAddBorder ImageBlur ImageClearRect ' + - 'ImageCopy ImageCrop ImageDrawArc ImageDrawBeveledRect ImageDrawCubicCurve ImageDrawLine ImageDrawLines ImageDrawOval ' + - 'ImageDrawPoint ImageDrawQuadraticCurve ImageDrawRect ImageDrawRoundRect ImageDrawText ImageFlip ImageGetBlob ImageGetBufferedImage ' + - 'ImageGetEXIFTag ImageGetHeight ImageGetIPTCTag ImageGetWidth ImageGrayscale ImageInfo ImageNegative ImageNew ImageOverlay ImagePaste ' + - 'ImageRead ImageReadBase64 ImageResize ImageRotate ImageRotateDrawingAxis ImageScaleToFit ImageSetAntialiasing ImageSetBackgroundColor ' + - 'ImageSetDrawingColor ImageSetDrawingStroke ImageSetDrawingTransparency ImageSharpen ImageShear ImageShearDrawingAxis ImageTranslate ' + - 'ImageTranslateDrawingAxis ImageWrite ImageWriteBase64 ImageXORDrawingMode IncrementValue InputBaseN Insert Int IsArray IsBinary ' + - 'IsBoolean IsCustomFunction IsDate IsDDX IsDebugMode IsDefined IsImage IsImageFile IsInstanceOf IsJSON IsLeapYear IsLocalHost ' + - 'IsNumeric IsNumericDate IsObject IsPDFFile IsPDFObject IsQuery IsSimpleValue IsSOAPRequest IsStruct IsUserInAnyRole IsUserInRole ' + - 'IsUserLoggedIn IsValid IsWDDX IsXML IsXmlAttribute IsXmlDoc IsXmlElem IsXmlNode IsXmlRoot JavaCast JSStringFormat LCase Left Len ' + - 'ListAppend ListChangeDelims ListContains ListContainsNoCase ListDeleteAt ListFind ListFindNoCase ListFirst ListGetAt ListInsertAt ' + - 'ListLast ListLen ListPrepend ListQualify ListRest ListSetAt ListSort ListToArray ListValueCount ListValueCountNoCase LJustify Log ' + - 'Log10 LSCurrencyFormat LSDateFormat LSEuroCurrencyFormat LSIsCurrency LSIsDate LSIsNumeric LSNumberFormat LSParseCurrency LSParseDateTime ' + - 'LSParseEuroCurrency LSParseNumber LSTimeFormat LTrim Max Mid Min Minute Month MonthAsString Now NumberFormat ParagraphFormat ParseDateTime ' + - 'Pi PrecisionEvaluate PreserveSingleQuotes Quarter QueryAddColumn QueryAddRow QueryConvertForGrid QueryNew QuerySetCell QuotedValueList Rand ' + - 'Randomize RandRange REFind REFindNoCase ReleaseComObject REMatch REMatchNoCase RemoveChars RepeatString Replace ReplaceList ReplaceNoCase ' + - 'REReplace REReplaceNoCase Reverse Right RJustify Round RTrim Second SendGatewayMessage SerializeJSON SetEncoding SetLocale SetProfileString ' + - 'SetVariable Sgn Sin Sleep SpanExcluding SpanIncluding Sqr StripCR StructAppend StructClear StructCopy StructCount StructDelete StructFind ' + - 'StructFindKey StructFindValue StructGet StructInsert StructIsEmpty StructKeyArray StructKeyExists StructKeyList StructKeyList StructNew ' + - 'StructSort StructUpdate Tan TimeFormat ToBase64 ToBinary ToScript ToString Trim UCase URLDecode URLEncodedFormat URLSessionFormat Val ' + - 'ValueList VerifyClient Week Wrap Wrap WriteOutput XmlChildPos XmlElemNew XmlFormat XmlGetNodeType XmlNew XmlParse XmlSearch XmlTransform ' + - 'XmlValidate Year YesNoFormat'; - - var keywords = 'cfabort cfajaximport cfajaxproxy cfapplet cfapplication cfargument cfassociate cfbreak cfcache cfcalendar ' + - 'cfcase cfcatch cfchart cfchartdata cfchartseries cfcol cfcollection cfcomponent cfcontent cfcookie cfdbinfo ' + - 'cfdefaultcase cfdirectory cfdiv cfdocument cfdocumentitem cfdocumentsection cfdump cfelse cfelseif cferror ' + - 'cfexchangecalendar cfexchangeconnection cfexchangecontact cfexchangefilter cfexchangemail cfexchangetask ' + - 'cfexecute cfexit cffeed cffile cfflush cfform cfformgroup cfformitem cfftp cffunction cfgrid cfgridcolumn ' + - 'cfgridrow cfgridupdate cfheader cfhtmlhead cfhttp cfhttpparam cfif cfimage cfimport cfinclude cfindex ' + - 'cfinput cfinsert cfinterface cfinvoke cfinvokeargument cflayout cflayoutarea cfldap cflocation cflock cflog ' + - 'cflogin cfloginuser cflogout cfloop cfmail cfmailparam cfmailpart cfmenu cfmenuitem cfmodule cfNTauthenticate ' + - 'cfobject cfobjectcache cfoutput cfparam cfpdf cfpdfform cfpdfformparam cfpdfparam cfpdfsubform cfpod cfpop ' + - 'cfpresentation cfpresentationslide cfpresenter cfprint cfprocessingdirective cfprocparam cfprocresult ' + - 'cfproperty cfquery cfqueryparam cfregistry cfreport cfreportparam cfrethrow cfreturn cfsavecontent cfschedule ' + - 'cfscript cfsearch cfselect cfset cfsetting cfsilent cfslider cfsprydataset cfstoredproc cfswitch cftable ' + - 'cftextarea cfthread cfthrow cftimer cftooltip cftrace cftransaction cftree cftreeitem cftry cfupdate cfwddx ' + - 'cfwindow cfxml cfzip cfzipparam'; - - var operators = 'all and any between cross in join like not null or outer some'; - - this.regexList = [ - { regex: new RegExp('--(.*)$', 'gm'), css: 'comments' }, // one line and multiline comments - { regex: SyntaxHighlighter.regexLib.xmlComments, css: 'comments' }, // single quoted strings - { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings - { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings - { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }, // functions - { regex: new RegExp(this.getKeywords(operators), 'gmi'), css: 'color1' }, // operators and such - { regex: new RegExp(this.getKeywords(keywords), 'gmi'), css: 'keyword' } // keyword - ]; - } - - Brush.prototype = new SyntaxHighlighter.Highlighter(); - Brush.aliases = ['coldfusion','cf']; - - SyntaxHighlighter.brushes.ColdFusion = Brush; - - // CommonJS - typeof(exports) != 'undefined' ? exports.Brush = Brush : null; -})(); diff --git a/plugins/textviewer/syntaxhighlighter/scripts/shBrushCpp.js b/plugins/textviewer/syntaxhighlighter/scripts/shBrushCpp.js deleted file mode 100644 index 9f70d3aed60d815bb2700f4e29565a4c8be51009..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/scripts/shBrushCpp.js +++ /dev/null @@ -1,97 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -;(function() -{ - // CommonJS - typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; - - function Brush() - { - // Copyright 2006 Shin, YoungJin - - var datatypes = 'ATOM BOOL BOOLEAN BYTE CHAR COLORREF DWORD DWORDLONG DWORD_PTR ' + - 'DWORD32 DWORD64 FLOAT HACCEL HALF_PTR HANDLE HBITMAP HBRUSH ' + - 'HCOLORSPACE HCONV HCONVLIST HCURSOR HDC HDDEDATA HDESK HDROP HDWP ' + - 'HENHMETAFILE HFILE HFONT HGDIOBJ HGLOBAL HHOOK HICON HINSTANCE HKEY ' + - 'HKL HLOCAL HMENU HMETAFILE HMODULE HMONITOR HPALETTE HPEN HRESULT ' + - 'HRGN HRSRC HSZ HWINSTA HWND INT INT_PTR INT32 INT64 LANGID LCID LCTYPE ' + - 'LGRPID LONG LONGLONG LONG_PTR LONG32 LONG64 LPARAM LPBOOL LPBYTE LPCOLORREF ' + - 'LPCSTR LPCTSTR LPCVOID LPCWSTR LPDWORD LPHANDLE LPINT LPLONG LPSTR LPTSTR ' + - 'LPVOID LPWORD LPWSTR LRESULT PBOOL PBOOLEAN PBYTE PCHAR PCSTR PCTSTR PCWSTR ' + - 'PDWORDLONG PDWORD_PTR PDWORD32 PDWORD64 PFLOAT PHALF_PTR PHANDLE PHKEY PINT ' + - 'PINT_PTR PINT32 PINT64 PLCID PLONG PLONGLONG PLONG_PTR PLONG32 PLONG64 POINTER_32 ' + - 'POINTER_64 PSHORT PSIZE_T PSSIZE_T PSTR PTBYTE PTCHAR PTSTR PUCHAR PUHALF_PTR ' + - 'PUINT PUINT_PTR PUINT32 PUINT64 PULONG PULONGLONG PULONG_PTR PULONG32 PULONG64 ' + - 'PUSHORT PVOID PWCHAR PWORD PWSTR SC_HANDLE SC_LOCK SERVICE_STATUS_HANDLE SHORT ' + - 'SIZE_T SSIZE_T TBYTE TCHAR UCHAR UHALF_PTR UINT UINT_PTR UINT32 UINT64 ULONG ' + - 'ULONGLONG ULONG_PTR ULONG32 ULONG64 USHORT USN VOID WCHAR WORD WPARAM WPARAM WPARAM ' + - 'char bool short int __int32 __int64 __int8 __int16 long float double __wchar_t ' + - 'clock_t _complex _dev_t _diskfree_t div_t ldiv_t _exception _EXCEPTION_POINTERS ' + - 'FILE _finddata_t _finddatai64_t _wfinddata_t _wfinddatai64_t __finddata64_t ' + - '__wfinddata64_t _FPIEEE_RECORD fpos_t _HEAPINFO _HFILE lconv intptr_t ' + - 'jmp_buf mbstate_t _off_t _onexit_t _PNH ptrdiff_t _purecall_handler ' + - 'sig_atomic_t size_t _stat __stat64 _stati64 terminate_function ' + - 'time_t __time64_t _timeb __timeb64 tm uintptr_t _utimbuf ' + - 'va_list wchar_t wctrans_t wctype_t wint_t signed'; - - var keywords = 'break case catch class const __finally __exception __try ' + - 'const_cast continue private public protected __declspec ' + - 'default delete deprecated dllexport dllimport do dynamic_cast ' + - 'else enum explicit extern if for friend goto inline ' + - 'mutable naked namespace new noinline noreturn nothrow ' + - 'register reinterpret_cast return selectany ' + - 'sizeof static static_cast struct switch template this ' + - 'thread throw true false try typedef typeid typename union ' + - 'using uuid virtual void volatile whcar_t while'; - - var functions = 'assert isalnum isalpha iscntrl isdigit isgraph islower isprint' + - 'ispunct isspace isupper isxdigit tolower toupper errno localeconv ' + - 'setlocale acos asin atan atan2 ceil cos cosh exp fabs floor fmod ' + - 'frexp ldexp log log10 modf pow sin sinh sqrt tan tanh jmp_buf ' + - 'longjmp setjmp raise signal sig_atomic_t va_arg va_end va_start ' + - 'clearerr fclose feof ferror fflush fgetc fgetpos fgets fopen ' + - 'fprintf fputc fputs fread freopen fscanf fseek fsetpos ftell ' + - 'fwrite getc getchar gets perror printf putc putchar puts remove ' + - 'rename rewind scanf setbuf setvbuf sprintf sscanf tmpfile tmpnam ' + - 'ungetc vfprintf vprintf vsprintf abort abs atexit atof atoi atol ' + - 'bsearch calloc div exit free getenv labs ldiv malloc mblen mbstowcs ' + - 'mbtowc qsort rand realloc srand strtod strtol strtoul system ' + - 'wcstombs wctomb memchr memcmp memcpy memmove memset strcat strchr ' + - 'strcmp strcoll strcpy strcspn strerror strlen strncat strncmp ' + - 'strncpy strpbrk strrchr strspn strstr strtok strxfrm asctime ' + - 'clock ctime difftime gmtime localtime mktime strftime time'; - - this.regexList = [ - { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments - { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments - { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings - { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings - { regex: /^ *#.*/gm, css: 'preprocessor' }, - { regex: new RegExp(this.getKeywords(datatypes), 'gm'), css: 'color1 bold' }, - { regex: new RegExp(this.getKeywords(functions), 'gm'), css: 'functions bold' }, - { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword bold' } - ]; - }; - - Brush.prototype = new SyntaxHighlighter.Highlighter(); - Brush.aliases = ['cpp', 'c']; - - SyntaxHighlighter.brushes.Cpp = Brush; - - // CommonJS - typeof(exports) != 'undefined' ? exports.Brush = Brush : null; -})(); diff --git a/plugins/textviewer/syntaxhighlighter/scripts/shBrushCss.js b/plugins/textviewer/syntaxhighlighter/scripts/shBrushCss.js deleted file mode 100644 index 4297a9a6486b6c93e335a2d2805c2bf91e04dbf8..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/scripts/shBrushCss.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -;(function() -{ - // CommonJS - typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; - - function Brush() - { - function getKeywordsCSS(str) - { - return '\\b([a-z_]|)' + str.replace(/ /g, '(?=:)\\b|\\b([a-z_\\*]|\\*|)') + '(?=:)\\b'; - }; - - function getValuesCSS(str) - { - return '\\b' + str.replace(/ /g, '(?!-)(?!:)\\b|\\b()') + '\:\\b'; - }; - - var keywords = 'ascent azimuth background-attachment background-color background-image background-position ' + - 'background-repeat background baseline bbox border-collapse border-color border-spacing border-style border-top ' + - 'border-right border-bottom border-left border-top-color border-right-color border-bottom-color border-left-color ' + - 'border-top-style border-right-style border-bottom-style border-left-style border-top-width border-right-width ' + - 'border-bottom-width border-left-width border-width border bottom cap-height caption-side centerline clear clip color ' + - 'content counter-increment counter-reset cue-after cue-before cue cursor definition-src descent direction display ' + - 'elevation empty-cells float font-size-adjust font-family font-size font-stretch font-style font-variant font-weight font ' + - 'height left letter-spacing line-height list-style-image list-style-position list-style-type list-style margin-top ' + - 'margin-right margin-bottom margin-left margin marker-offset marks mathline max-height max-width min-height min-width orphans ' + - 'outline-color outline-style outline-width outline overflow padding-top padding-right padding-bottom padding-left padding page ' + - 'page-break-after page-break-before page-break-inside pause pause-after pause-before pitch pitch-range play-during position ' + - 'quotes right richness size slope src speak-header speak-numeral speak-punctuation speak speech-rate stemh stemv stress ' + - 'table-layout text-align top text-decoration text-indent text-shadow text-transform unicode-bidi unicode-range units-per-em ' + - 'vertical-align visibility voice-family volume white-space widows width widths word-spacing x-height z-index'; - - var values = 'above absolute all always aqua armenian attr aural auto avoid baseline behind below bidi-override black blink block blue bold bolder '+ - 'both bottom braille capitalize caption center center-left center-right circle close-quote code collapse compact condensed '+ - 'continuous counter counters crop cross crosshair cursive dashed decimal decimal-leading-zero default digits disc dotted double '+ - 'embed embossed e-resize expanded extra-condensed extra-expanded fantasy far-left far-right fast faster fixed format fuchsia '+ - 'gray green groove handheld hebrew help hidden hide high higher icon inline-table inline inset inside invert italic '+ - 'justify landscape large larger left-side left leftwards level lighter lime line-through list-item local loud lower-alpha '+ - 'lowercase lower-greek lower-latin lower-roman lower low ltr marker maroon medium message-box middle mix move narrower '+ - 'navy ne-resize no-close-quote none no-open-quote no-repeat normal nowrap n-resize nw-resize oblique olive once open-quote outset '+ - 'outside overline pointer portrait pre print projection purple red relative repeat repeat-x repeat-y rgb ridge right right-side '+ - 'rightwards rtl run-in screen scroll semi-condensed semi-expanded separate se-resize show silent silver slower slow '+ - 'small small-caps small-caption smaller soft solid speech spell-out square s-resize static status-bar sub super sw-resize '+ - 'table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group teal '+ - 'text-bottom text-top thick thin top transparent tty tv ultra-condensed ultra-expanded underline upper-alpha uppercase upper-latin '+ - 'upper-roman url visible wait white wider w-resize x-fast x-high x-large x-loud x-low x-slow x-small x-soft xx-large xx-small yellow'; - - var fonts = '[mM]onospace [tT]ahoma [vV]erdana [aA]rial [hH]elvetica [sS]ans-serif [sS]erif [cC]ourier mono sans serif'; - - this.regexList = [ - { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments - { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings - { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings - { regex: /\#[a-fA-F0-9]{3,6}/g, css: 'value' }, // html colors - { regex: /(-?\d+)(\.\d+)?(px|em|pt|\:|\%|)/g, css: 'value' }, // sizes - { regex: /!important/g, css: 'color3' }, // !important - { regex: new RegExp(getKeywordsCSS(keywords), 'gm'), css: 'keyword' }, // keywords - { regex: new RegExp(getValuesCSS(values), 'g'), css: 'value' }, // values - { regex: new RegExp(this.getKeywords(fonts), 'g'), css: 'color1' } // fonts - ]; - - this.forHtmlScript({ - left: /(<|<)\s*style.*?(>|>)/gi, - right: /(<|<)\/\s*style\s*(>|>)/gi - }); - }; - - Brush.prototype = new SyntaxHighlighter.Highlighter(); - Brush.aliases = ['css']; - - SyntaxHighlighter.brushes.CSS = Brush; - - // CommonJS - typeof(exports) != 'undefined' ? exports.Brush = Brush : null; -})(); diff --git a/plugins/textviewer/syntaxhighlighter/scripts/shBrushDelphi.js b/plugins/textviewer/syntaxhighlighter/scripts/shBrushDelphi.js deleted file mode 100644 index e1060d44688c3b7db155c61f39e53f152e9b4007..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/scripts/shBrushDelphi.js +++ /dev/null @@ -1,55 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -;(function() -{ - // CommonJS - typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; - - function Brush() - { - var keywords = 'abs addr and ansichar ansistring array as asm begin boolean byte cardinal ' + - 'case char class comp const constructor currency destructor div do double ' + - 'downto else end except exports extended false file finalization finally ' + - 'for function goto if implementation in inherited int64 initialization ' + - 'integer interface is label library longint longword mod nil not object ' + - 'of on or packed pansichar pansistring pchar pcurrency pdatetime pextended ' + - 'pint64 pointer private procedure program property pshortstring pstring ' + - 'pvariant pwidechar pwidestring protected public published raise real real48 ' + - 'record repeat set shl shortint shortstring shr single smallint string then ' + - 'threadvar to true try type unit until uses val var varirnt while widechar ' + - 'widestring with word write writeln xor'; - - this.regexList = [ - { regex: /\(\*[\s\S]*?\*\)/gm, css: 'comments' }, // multiline comments (* *) - { regex: /{(?!\$)[\s\S]*?}/gm, css: 'comments' }, // multiline comments { } - { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line - { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings - { regex: /\{\$[a-zA-Z]+ .+\}/g, css: 'color1' }, // compiler Directives and Region tags - { regex: /\b[\d\.]+\b/g, css: 'value' }, // numbers 12345 - { regex: /\$[a-zA-Z0-9]+\b/g, css: 'value' }, // numbers $F5D3 - { regex: new RegExp(this.getKeywords(keywords), 'gmi'), css: 'keyword' } // keyword - ]; - }; - - Brush.prototype = new SyntaxHighlighter.Highlighter(); - Brush.aliases = ['delphi', 'pascal', 'pas']; - - SyntaxHighlighter.brushes.Delphi = Brush; - - // CommonJS - typeof(exports) != 'undefined' ? exports.Brush = Brush : null; -})(); diff --git a/plugins/textviewer/syntaxhighlighter/scripts/shBrushDiff.js b/plugins/textviewer/syntaxhighlighter/scripts/shBrushDiff.js deleted file mode 100644 index e9b14fc580a4826ad762b742e9102f4bfb8a152a..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/scripts/shBrushDiff.js +++ /dev/null @@ -1,41 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -;(function() -{ - // CommonJS - typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; - - function Brush() - { - this.regexList = [ - { regex: /^\+\+\+.*$/gm, css: 'color2' }, - { regex: /^\-\-\-.*$/gm, css: 'color2' }, - { regex: /^\s.*$/gm, css: 'color1' }, - { regex: /^@@.*@@$/gm, css: 'variable' }, - { regex: /^\+[^\+]{1}.*$/gm, css: 'string' }, - { regex: /^\-[^\-]{1}.*$/gm, css: 'comments' } - ]; - }; - - Brush.prototype = new SyntaxHighlighter.Highlighter(); - Brush.aliases = ['diff', 'patch']; - - SyntaxHighlighter.brushes.Diff = Brush; - - // CommonJS - typeof(exports) != 'undefined' ? exports.Brush = Brush : null; -})(); diff --git a/plugins/textviewer/syntaxhighlighter/scripts/shBrushErlang.js b/plugins/textviewer/syntaxhighlighter/scripts/shBrushErlang.js deleted file mode 100644 index 6ba7d9da871a2fb656bfb736715a2433289f3400..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/scripts/shBrushErlang.js +++ /dev/null @@ -1,52 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -;(function() -{ - // CommonJS - typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; - - function Brush() - { - // Contributed by Jean-Lou Dupont - // http://jldupont.blogspot.com/2009/06/erlang-syntax-highlighter.html - - // According to: http://erlang.org/doc/reference_manual/introduction.html#1.5 - var keywords = 'after and andalso band begin bnot bor bsl bsr bxor '+ - 'case catch cond div end fun if let not of or orelse '+ - 'query receive rem try when xor'+ - // additional - ' module export import define'; - - this.regexList = [ - { regex: new RegExp("[A-Z][A-Za-z0-9_]+", 'g'), css: 'constants' }, - { regex: new RegExp("\\%.+", 'gm'), css: 'comments' }, - { regex: new RegExp("\\?[A-Za-z0-9_]+", 'g'), css: 'preprocessor' }, - { regex: new RegExp("[a-z0-9_]+:[a-z0-9_]+", 'g'), css: 'functions' }, - { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, - { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, - { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } - ]; - }; - - Brush.prototype = new SyntaxHighlighter.Highlighter(); - Brush.aliases = ['erl', 'erlang']; - - SyntaxHighlighter.brushes.Erland = Brush; - - // CommonJS - typeof(exports) != 'undefined' ? exports.Brush = Brush : null; -})(); diff --git a/plugins/textviewer/syntaxhighlighter/scripts/shBrushGroovy.js b/plugins/textviewer/syntaxhighlighter/scripts/shBrushGroovy.js deleted file mode 100644 index 6ec5c18521a1830d653a01080ccba937d1541533..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/scripts/shBrushGroovy.js +++ /dev/null @@ -1,67 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -;(function() -{ - // CommonJS - typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; - - function Brush() - { - // Contributed by Andres Almiray - // http://jroller.com/aalmiray/entry/nice_source_code_syntax_highlighter - - var keywords = 'as assert break case catch class continue def default do else extends finally ' + - 'if in implements import instanceof interface new package property return switch ' + - 'throw throws try while public protected private static'; - var types = 'void boolean byte char short int long float double'; - var constants = 'null'; - var methods = 'allProperties count get size '+ - 'collect each eachProperty eachPropertyName eachWithIndex find findAll ' + - 'findIndexOf grep inject max min reverseEach sort ' + - 'asImmutable asSynchronized flatten intersect join pop reverse subMap toList ' + - 'padRight padLeft contains eachMatch toCharacter toLong toUrl tokenize ' + - 'eachFile eachFileRecurse eachB yte eachLine readBytes readLine getText ' + - 'splitEachLine withReader append encodeBase64 decodeBase64 filterLine ' + - 'transformChar transformLine withOutputStream withPrintWriter withStream ' + - 'withStreams withWriter withWriterAppend write writeLine '+ - 'dump inspect invokeMethod print println step times upto use waitForOrKill '+ - 'getText'; - - this.regexList = [ - { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments - { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments - { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings - { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings - { regex: /""".*"""/g, css: 'string' }, // GStrings - { regex: new RegExp('\\b([\\d]+(\\.[\\d]+)?|0x[a-f0-9]+)\\b', 'gi'), css: 'value' }, // numbers - { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // goovy keyword - { regex: new RegExp(this.getKeywords(types), 'gm'), css: 'color1' }, // goovy/java type - { regex: new RegExp(this.getKeywords(constants), 'gm'), css: 'constants' }, // constants - { regex: new RegExp(this.getKeywords(methods), 'gm'), css: 'functions' } // methods - ]; - - this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); - } - - Brush.prototype = new SyntaxHighlighter.Highlighter(); - Brush.aliases = ['groovy']; - - SyntaxHighlighter.brushes.Groovy = Brush; - - // CommonJS - typeof(exports) != 'undefined' ? exports.Brush = Brush : null; -})(); diff --git a/plugins/textviewer/syntaxhighlighter/scripts/shBrushJScript.js b/plugins/textviewer/syntaxhighlighter/scripts/shBrushJScript.js deleted file mode 100644 index ff98daba16e4974421df1396ba26053091c0f58b..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/scripts/shBrushJScript.js +++ /dev/null @@ -1,52 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -;(function() -{ - // CommonJS - typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; - - function Brush() - { - var keywords = 'break case catch continue ' + - 'default delete do else false ' + - 'for function if in instanceof ' + - 'new null return super switch ' + - 'this throw true try typeof var while with' - ; - - var r = SyntaxHighlighter.regexLib; - - this.regexList = [ - { regex: r.multiLineDoubleQuotedString, css: 'string' }, // double quoted strings - { regex: r.multiLineSingleQuotedString, css: 'string' }, // single quoted strings - { regex: r.singleLineCComments, css: 'comments' }, // one line comments - { regex: r.multiLineCComments, css: 'comments' }, // multiline comments - { regex: /\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion - { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keywords - ]; - - this.forHtmlScript(r.scriptScriptTags); - }; - - Brush.prototype = new SyntaxHighlighter.Highlighter(); - Brush.aliases = ['js', 'jscript', 'javascript']; - - SyntaxHighlighter.brushes.JScript = Brush; - - // CommonJS - typeof(exports) != 'undefined' ? exports.Brush = Brush : null; -})(); diff --git a/plugins/textviewer/syntaxhighlighter/scripts/shBrushJava.js b/plugins/textviewer/syntaxhighlighter/scripts/shBrushJava.js deleted file mode 100644 index d692fd63828bce4de6b961299f2dd23cc271c4b0..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/scripts/shBrushJava.js +++ /dev/null @@ -1,57 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -;(function() -{ - // CommonJS - typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; - - function Brush() - { - var keywords = 'abstract assert boolean break byte case catch char class const ' + - 'continue default do double else enum extends ' + - 'false final finally float for goto if implements import ' + - 'instanceof int interface long native new null ' + - 'package private protected public return ' + - 'short static strictfp super switch synchronized this throw throws true ' + - 'transient try void volatile while'; - - this.regexList = [ - { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments - { regex: /\/\*([^\*][\s\S]*)?\*\//gm, css: 'comments' }, // multiline comments - { regex: /\/\*(?!\*\/)\*[\s\S]*?\*\//gm, css: 'preprocessor' }, // documentation comments - { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings - { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings - { regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers - { regex: /(?!\@interface\b)\@[\$\w]+\b/g, css: 'color1' }, // annotation @anno - { regex: /\@interface\b/g, css: 'color2' }, // @interface keyword - { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // java keyword - ]; - - this.forHtmlScript({ - left : /(<|<)%[@!=]?/g, - right : /%(>|>)/g - }); - }; - - Brush.prototype = new SyntaxHighlighter.Highlighter(); - Brush.aliases = ['java']; - - SyntaxHighlighter.brushes.Java = Brush; - - // CommonJS - typeof(exports) != 'undefined' ? exports.Brush = Brush : null; -})(); diff --git a/plugins/textviewer/syntaxhighlighter/scripts/shBrushJavaFX.js b/plugins/textviewer/syntaxhighlighter/scripts/shBrushJavaFX.js deleted file mode 100644 index 1a150a6ad33469887aa4b747723580b0360afad6..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/scripts/shBrushJavaFX.js +++ /dev/null @@ -1,58 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -;(function() -{ - // CommonJS - typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; - - function Brush() - { - // Contributed by Patrick Webster - // http://patrickwebster.blogspot.com/2009/04/javafx-brush-for-syntaxhighlighter.html - var datatypes = 'Boolean Byte Character Double Duration ' - + 'Float Integer Long Number Short String Void' - ; - - var keywords = 'abstract after and as assert at before bind bound break catch class ' - + 'continue def delete else exclusive extends false finally first for from ' - + 'function if import in indexof init insert instanceof into inverse last ' - + 'lazy mixin mod nativearray new not null on or override package postinit ' - + 'protected public public-init public-read replace return reverse sizeof ' - + 'step super then this throw true try tween typeof var where while with ' - + 'attribute let private readonly static trigger' - ; - - this.regexList = [ - { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, - { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, - { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, - { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, - { regex: /(-?\.?)(\b(\d*\.?\d+|\d+\.?\d*)(e[+-]?\d+)?|0x[a-f\d]+)\b\.?/gi, css: 'color2' }, // numbers - { regex: new RegExp(this.getKeywords(datatypes), 'gm'), css: 'variable' }, // datatypes - { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } - ]; - this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); - }; - - Brush.prototype = new SyntaxHighlighter.Highlighter(); - Brush.aliases = ['jfx', 'javafx']; - - SyntaxHighlighter.brushes.JavaFX = Brush; - - // CommonJS - typeof(exports) != 'undefined' ? exports.Brush = Brush : null; -})(); diff --git a/plugins/textviewer/syntaxhighlighter/scripts/shBrushPerl.js b/plugins/textviewer/syntaxhighlighter/scripts/shBrushPerl.js deleted file mode 100644 index d94a2e0ec52b65a8ac81409dd7098f2da8e867dd..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/scripts/shBrushPerl.js +++ /dev/null @@ -1,72 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -;(function() -{ - // CommonJS - typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; - - function Brush() - { - // Contributed by David Simmons-Duffin and Marty Kube - - var funcs = - 'abs accept alarm atan2 bind binmode chdir chmod chomp chop chown chr ' + - 'chroot close closedir connect cos crypt defined delete each endgrent ' + - 'endhostent endnetent endprotoent endpwent endservent eof exec exists ' + - 'exp fcntl fileno flock fork format formline getc getgrent getgrgid ' + - 'getgrnam gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr ' + - 'getnetbyname getnetent getpeername getpgrp getppid getpriority ' + - 'getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid ' + - 'getservbyname getservbyport getservent getsockname getsockopt glob ' + - 'gmtime grep hex index int ioctl join keys kill lc lcfirst length link ' + - 'listen localtime lock log lstat map mkdir msgctl msgget msgrcv msgsnd ' + - 'oct open opendir ord pack pipe pop pos print printf prototype push ' + - 'quotemeta rand read readdir readline readlink readpipe recv rename ' + - 'reset reverse rewinddir rindex rmdir scalar seek seekdir select semctl ' + - 'semget semop send setgrent sethostent setnetent setpgrp setpriority ' + - 'setprotoent setpwent setservent setsockopt shift shmctl shmget shmread ' + - 'shmwrite shutdown sin sleep socket socketpair sort splice split sprintf ' + - 'sqrt srand stat study substr symlink syscall sysopen sysread sysseek ' + - 'system syswrite tell telldir time times tr truncate uc ucfirst umask ' + - 'undef unlink unpack unshift utime values vec wait waitpid warn write'; - - var keywords = - 'bless caller continue dbmclose dbmopen die do dump else elsif eval exit ' + - 'for foreach goto if import last local my next no our package redo ref ' + - 'require return sub tie tied unless untie until use wantarray while'; - - this.regexList = [ - { regex: new RegExp('#[^!].*$', 'gm'), css: 'comments' }, - { regex: new RegExp('^\\s*#!.*$', 'gm'), css: 'preprocessor' }, // shebang - { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, - { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, - { regex: new RegExp('(\\$|@|%)\\w+', 'g'), css: 'variable' }, - { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }, - { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } - ]; - - this.forHtmlScript(SyntaxHighlighter.regexLib.phpScriptTags); - } - - Brush.prototype = new SyntaxHighlighter.Highlighter(); - Brush.aliases = ['perl', 'Perl', 'pl']; - - SyntaxHighlighter.brushes.Perl = Brush; - - // CommonJS - typeof(exports) != 'undefined' ? exports.Brush = Brush : null; -})(); diff --git a/plugins/textviewer/syntaxhighlighter/scripts/shBrushPhp.js b/plugins/textviewer/syntaxhighlighter/scripts/shBrushPhp.js deleted file mode 100644 index 95e6e4325bb44aa6caf4c40d914810f25616db88..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/scripts/shBrushPhp.js +++ /dev/null @@ -1,88 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -;(function() -{ - // CommonJS - typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; - - function Brush() - { - var funcs = 'abs acos acosh addcslashes addslashes ' + - 'array_change_key_case array_chunk array_combine array_count_values array_diff '+ - 'array_diff_assoc array_diff_key array_diff_uassoc array_diff_ukey array_fill '+ - 'array_filter array_flip array_intersect array_intersect_assoc array_intersect_key '+ - 'array_intersect_uassoc array_intersect_ukey array_key_exists array_keys array_map '+ - 'array_merge array_merge_recursive array_multisort array_pad array_pop array_product '+ - 'array_push array_rand array_reduce array_reverse array_search array_shift '+ - 'array_slice array_splice array_sum array_udiff array_udiff_assoc '+ - 'array_udiff_uassoc array_uintersect array_uintersect_assoc '+ - 'array_uintersect_uassoc array_unique array_unshift array_values array_walk '+ - 'array_walk_recursive atan atan2 atanh base64_decode base64_encode base_convert '+ - 'basename bcadd bccomp bcdiv bcmod bcmul bindec bindtextdomain bzclose bzcompress '+ - 'bzdecompress bzerrno bzerror bzerrstr bzflush bzopen bzread bzwrite ceil chdir '+ - 'checkdate checkdnsrr chgrp chmod chop chown chr chroot chunk_split class_exists '+ - 'closedir closelog copy cos cosh count count_chars date decbin dechex decoct '+ - 'deg2rad delete ebcdic2ascii echo empty end ereg ereg_replace eregi eregi_replace error_log '+ - 'error_reporting escapeshellarg escapeshellcmd eval exec exit exp explode extension_loaded '+ - 'feof fflush fgetc fgetcsv fgets fgetss file_exists file_get_contents file_put_contents '+ - 'fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype '+ - 'floatval flock floor flush fmod fnmatch fopen fpassthru fprintf fputcsv fputs fread fscanf '+ - 'fseek fsockopen fstat ftell ftok getallheaders getcwd getdate getenv gethostbyaddr gethostbyname '+ - 'gethostbynamel getimagesize getlastmod getmxrr getmygid getmyinode getmypid getmyuid getopt '+ - 'getprotobyname getprotobynumber getrandmax getrusage getservbyname getservbyport gettext '+ - 'gettimeofday gettype glob gmdate gmmktime ini_alter ini_get ini_get_all ini_restore ini_set '+ - 'interface_exists intval ip2long is_a is_array is_bool is_callable is_dir is_double '+ - 'is_executable is_file is_finite is_float is_infinite is_int is_integer is_link is_long '+ - 'is_nan is_null is_numeric is_object is_readable is_real is_resource is_scalar is_soap_fault '+ - 'is_string is_subclass_of is_uploaded_file is_writable is_writeable mkdir mktime nl2br '+ - 'parse_ini_file parse_str parse_url passthru pathinfo print readlink realpath rewind rewinddir rmdir '+ - 'round str_ireplace str_pad str_repeat str_replace str_rot13 str_shuffle str_split '+ - 'str_word_count strcasecmp strchr strcmp strcoll strcspn strftime strip_tags stripcslashes '+ - 'stripos stripslashes stristr strlen strnatcasecmp strnatcmp strncasecmp strncmp strpbrk '+ - 'strpos strptime strrchr strrev strripos strrpos strspn strstr strtok strtolower strtotime '+ - 'strtoupper strtr strval substr substr_compare'; - - var keywords = 'abstract and array as break case catch cfunction class clone const continue declare default die do ' + - 'else elseif enddeclare endfor endforeach endif endswitch endwhile extends final for foreach ' + - 'function include include_once global goto if implements interface instanceof namespace new ' + - 'old_function or private protected public return require require_once static switch ' + - 'throw try use var while xor '; - - var constants = '__FILE__ __LINE__ __METHOD__ __FUNCTION__ __CLASS__'; - - this.regexList = [ - { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments - { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments - { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings - { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings - { regex: /\$\w+/g, css: 'variable' }, // variables - { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }, // common functions - { regex: new RegExp(this.getKeywords(constants), 'gmi'), css: 'constants' }, // constants - { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keyword - ]; - - this.forHtmlScript(SyntaxHighlighter.regexLib.phpScriptTags); - }; - - Brush.prototype = new SyntaxHighlighter.Highlighter(); - Brush.aliases = ['php']; - - SyntaxHighlighter.brushes.Php = Brush; - - // CommonJS - typeof(exports) != 'undefined' ? exports.Brush = Brush : null; -})(); diff --git a/plugins/textviewer/syntaxhighlighter/scripts/shBrushPlain.js b/plugins/textviewer/syntaxhighlighter/scripts/shBrushPlain.js deleted file mode 100644 index 9f7d9e90c32f797e89bd00efd24162ec1c1e33a8..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/scripts/shBrushPlain.js +++ /dev/null @@ -1,33 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -;(function() -{ - // CommonJS - typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; - - function Brush() - { - }; - - Brush.prototype = new SyntaxHighlighter.Highlighter(); - Brush.aliases = ['text', 'plain']; - - SyntaxHighlighter.brushes.Plain = Brush; - - // CommonJS - typeof(exports) != 'undefined' ? exports.Brush = Brush : null; -})(); diff --git a/plugins/textviewer/syntaxhighlighter/scripts/shBrushPowerShell.js b/plugins/textviewer/syntaxhighlighter/scripts/shBrushPowerShell.js deleted file mode 100644 index 0be175296894671b466de8b4548243ba8e333c06..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/scripts/shBrushPowerShell.js +++ /dev/null @@ -1,74 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -;(function() -{ - // CommonJS - typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; - - function Brush() - { - // Contributes by B.v.Zanten, Getronics - // http://confluence.atlassian.com/display/CONFEXT/New+Code+Macro - - var keywords = 'Add-Content Add-History Add-Member Add-PSSnapin Clear(-Content)? Clear-Item ' + - 'Clear-ItemProperty Clear-Variable Compare-Object ConvertFrom-SecureString Convert-Path ' + - 'ConvertTo-Html ConvertTo-SecureString Copy(-Item)? Copy-ItemProperty Export-Alias ' + - 'Export-Clixml Export-Console Export-Csv ForEach(-Object)? Format-Custom Format-List ' + - 'Format-Table Format-Wide Get-Acl Get-Alias Get-AuthenticodeSignature Get-ChildItem Get-Command ' + - 'Get-Content Get-Credential Get-Culture Get-Date Get-EventLog Get-ExecutionPolicy ' + - 'Get-Help Get-History Get-Host Get-Item Get-ItemProperty Get-Location Get-Member ' + - 'Get-PfxCertificate Get-Process Get-PSDrive Get-PSProvider Get-PSSnapin Get-Service ' + - 'Get-TraceSource Get-UICulture Get-Unique Get-Variable Get-WmiObject Group-Object ' + - 'Import-Alias Import-Clixml Import-Csv Invoke-Expression Invoke-History Invoke-Item ' + - 'Join-Path Measure-Command Measure-Object Move(-Item)? Move-ItemProperty New-Alias ' + - 'New-Item New-ItemProperty New-Object New-PSDrive New-Service New-TimeSpan ' + - 'New-Variable Out-Default Out-File Out-Host Out-Null Out-Printer Out-String Pop-Location ' + - 'Push-Location Read-Host Remove-Item Remove-ItemProperty Remove-PSDrive Remove-PSSnapin ' + - 'Remove-Variable Rename-Item Rename-ItemProperty Resolve-Path Restart-Service Resume-Service ' + - 'Select-Object Select-String Set-Acl Set-Alias Set-AuthenticodeSignature Set-Content ' + - 'Set-Date Set-ExecutionPolicy Set-Item Set-ItemProperty Set-Location Set-PSDebug ' + - 'Set-Service Set-TraceSource Set(-Variable)? Sort-Object Split-Path Start-Service ' + - 'Start-Sleep Start-Transcript Stop-Process Stop-Service Stop-Transcript Suspend-Service ' + - 'Tee-Object Test-Path Trace-Command Update-FormatData Update-TypeData Where(-Object)? ' + - 'Write-Debug Write-Error Write(-Host)? Write-Output Write-Progress Write-Verbose Write-Warning'; - var alias = 'ac asnp clc cli clp clv cpi cpp cvpa diff epal epcsv fc fl ' + - 'ft fw gal gc gci gcm gdr ghy gi gl gm gp gps group gsv ' + - 'gsnp gu gv gwmi iex ihy ii ipal ipcsv mi mp nal ndr ni nv oh rdr ' + - 'ri rni rnp rp rsnp rv rvpa sal sasv sc select si sl sleep sort sp ' + - 'spps spsv sv tee cat cd cp h history kill lp ls ' + - 'mount mv popd ps pushd pwd r rm rmdir echo cls chdir del dir ' + - 'erase rd ren type % \\?'; - - this.regexList = [ - { regex: /#.*$/gm, css: 'comments' }, // one line comments - { regex: /\$[a-zA-Z0-9]+\b/g, css: 'value' }, // variables $Computer1 - { regex: /\-[a-zA-Z]+\b/g, css: 'keyword' }, // Operators -not -and -eq - { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings - { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings - { regex: new RegExp(this.getKeywords(keywords), 'gmi'), css: 'keyword' }, - { regex: new RegExp(this.getKeywords(alias), 'gmi'), css: 'keyword' } - ]; - }; - - Brush.prototype = new SyntaxHighlighter.Highlighter(); - Brush.aliases = ['powershell', 'ps']; - - SyntaxHighlighter.brushes.PowerShell = Brush; - - // CommonJS - typeof(exports) != 'undefined' ? exports.Brush = Brush : null; -})(); diff --git a/plugins/textviewer/syntaxhighlighter/scripts/shBrushPython.js b/plugins/textviewer/syntaxhighlighter/scripts/shBrushPython.js deleted file mode 100644 index ce77462975f8c1b9ddc2d4e6d3bfb384971303de..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/scripts/shBrushPython.js +++ /dev/null @@ -1,64 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -;(function() -{ - // CommonJS - typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; - - function Brush() - { - // Contributed by Gheorghe Milas and Ahmad Sherif - - var keywords = 'and assert break class continue def del elif else ' + - 'except exec finally for from global if import in is ' + - 'lambda not or pass print raise return try yield while'; - - var funcs = '__import__ abs all any apply basestring bin bool buffer callable ' + - 'chr classmethod cmp coerce compile complex delattr dict dir ' + - 'divmod enumerate eval execfile file filter float format frozenset ' + - 'getattr globals hasattr hash help hex id input int intern ' + - 'isinstance issubclass iter len list locals long map max min next ' + - 'object oct open ord pow print property range raw_input reduce ' + - 'reload repr reversed round set setattr slice sorted staticmethod ' + - 'str sum super tuple type type unichr unicode vars xrange zip'; - - var special = 'None True False self cls class_'; - - this.regexList = [ - { regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, - { regex: /^\s*@\w+/gm, css: 'decorator' }, - { regex: /(['\"]{3})([^\1])*?\1/gm, css: 'comments' }, - { regex: /"(?!")(?:\.|\\\"|[^\""\n])*"/gm, css: 'string' }, - { regex: /'(?!')(?:\.|(\\\')|[^\''\n])*'/gm, css: 'string' }, - { regex: /\+|\-|\*|\/|\%|=|==/gm, css: 'keyword' }, - { regex: /\b\d+\.?\w*/g, css: 'value' }, - { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }, - { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, - { regex: new RegExp(this.getKeywords(special), 'gm'), css: 'color1' } - ]; - - this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); - }; - - Brush.prototype = new SyntaxHighlighter.Highlighter(); - Brush.aliases = ['py', 'python']; - - SyntaxHighlighter.brushes.Python = Brush; - - // CommonJS - typeof(exports) != 'undefined' ? exports.Brush = Brush : null; -})(); diff --git a/plugins/textviewer/syntaxhighlighter/scripts/shBrushRuby.js b/plugins/textviewer/syntaxhighlighter/scripts/shBrushRuby.js deleted file mode 100644 index ff82130a7af0dffa8723e5c00622924c13451a53..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/scripts/shBrushRuby.js +++ /dev/null @@ -1,55 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -;(function() -{ - // CommonJS - typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; - - function Brush() - { - // Contributed by Erik Peterson. - - var keywords = 'alias and BEGIN begin break case class def define_method defined do each else elsif ' + - 'END end ensure false for if in module new next nil not or raise redo rescue retry return ' + - 'self super then throw true undef unless until when while yield'; - - var builtins = 'Array Bignum Binding Class Continuation Dir Exception FalseClass File::Stat File Fixnum Fload ' + - 'Hash Integer IO MatchData Method Module NilClass Numeric Object Proc Range Regexp String Struct::TMS Symbol ' + - 'ThreadGroup Thread Time TrueClass'; - - this.regexList = [ - { regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, // one line comments - { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings - { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings - { regex: /\b[A-Z0-9_]+\b/g, css: 'constants' }, // constants - { regex: /:[a-z][A-Za-z0-9_]*/g, css: 'color2' }, // symbols - { regex: /(\$|@@|@)\w+/g, css: 'variable bold' }, // $global, @instance, and @@class variables - { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords - { regex: new RegExp(this.getKeywords(builtins), 'gm'), css: 'color1' } // builtins - ]; - - this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); - }; - - Brush.prototype = new SyntaxHighlighter.Highlighter(); - Brush.aliases = ['ruby', 'rails', 'ror', 'rb']; - - SyntaxHighlighter.brushes.Ruby = Brush; - - // CommonJS - typeof(exports) != 'undefined' ? exports.Brush = Brush : null; -})(); diff --git a/plugins/textviewer/syntaxhighlighter/scripts/shBrushSass.js b/plugins/textviewer/syntaxhighlighter/scripts/shBrushSass.js deleted file mode 100644 index aa04da0996b13343d3faa59aaf968288915c7cc3..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/scripts/shBrushSass.js +++ /dev/null @@ -1,94 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -;(function() -{ - // CommonJS - typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; - - function Brush() - { - function getKeywordsCSS(str) - { - return '\\b([a-z_]|)' + str.replace(/ /g, '(?=:)\\b|\\b([a-z_\\*]|\\*|)') + '(?=:)\\b'; - }; - - function getValuesCSS(str) - { - return '\\b' + str.replace(/ /g, '(?!-)(?!:)\\b|\\b()') + '\:\\b'; - }; - - var keywords = 'ascent azimuth background-attachment background-color background-image background-position ' + - 'background-repeat background baseline bbox border-collapse border-color border-spacing border-style border-top ' + - 'border-right border-bottom border-left border-top-color border-right-color border-bottom-color border-left-color ' + - 'border-top-style border-right-style border-bottom-style border-left-style border-top-width border-right-width ' + - 'border-bottom-width border-left-width border-width border bottom cap-height caption-side centerline clear clip color ' + - 'content counter-increment counter-reset cue-after cue-before cue cursor definition-src descent direction display ' + - 'elevation empty-cells float font-size-adjust font-family font-size font-stretch font-style font-variant font-weight font ' + - 'height left letter-spacing line-height list-style-image list-style-position list-style-type list-style margin-top ' + - 'margin-right margin-bottom margin-left margin marker-offset marks mathline max-height max-width min-height min-width orphans ' + - 'outline-color outline-style outline-width outline overflow padding-top padding-right padding-bottom padding-left padding page ' + - 'page-break-after page-break-before page-break-inside pause pause-after pause-before pitch pitch-range play-during position ' + - 'quotes right richness size slope src speak-header speak-numeral speak-punctuation speak speech-rate stemh stemv stress ' + - 'table-layout text-align top text-decoration text-indent text-shadow text-transform unicode-bidi unicode-range units-per-em ' + - 'vertical-align visibility voice-family volume white-space widows width widths word-spacing x-height z-index'; - - var values = 'above absolute all always aqua armenian attr aural auto avoid baseline behind below bidi-override black blink block blue bold bolder '+ - 'both bottom braille capitalize caption center center-left center-right circle close-quote code collapse compact condensed '+ - 'continuous counter counters crop cross crosshair cursive dashed decimal decimal-leading-zero digits disc dotted double '+ - 'embed embossed e-resize expanded extra-condensed extra-expanded fantasy far-left far-right fast faster fixed format fuchsia '+ - 'gray green groove handheld hebrew help hidden hide high higher icon inline-table inline inset inside invert italic '+ - 'justify landscape large larger left-side left leftwards level lighter lime line-through list-item local loud lower-alpha '+ - 'lowercase lower-greek lower-latin lower-roman lower low ltr marker maroon medium message-box middle mix move narrower '+ - 'navy ne-resize no-close-quote none no-open-quote no-repeat normal nowrap n-resize nw-resize oblique olive once open-quote outset '+ - 'outside overline pointer portrait pre print projection purple red relative repeat repeat-x repeat-y rgb ridge right right-side '+ - 'rightwards rtl run-in screen scroll semi-condensed semi-expanded separate se-resize show silent silver slower slow '+ - 'small small-caps small-caption smaller soft solid speech spell-out square s-resize static status-bar sub super sw-resize '+ - 'table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group teal '+ - 'text-bottom text-top thick thin top transparent tty tv ultra-condensed ultra-expanded underline upper-alpha uppercase upper-latin '+ - 'upper-roman url visible wait white wider w-resize x-fast x-high x-large x-loud x-low x-slow x-small x-soft xx-large xx-small yellow'; - - var fonts = '[mM]onospace [tT]ahoma [vV]erdana [aA]rial [hH]elvetica [sS]ans-serif [sS]erif [cC]ourier mono sans serif'; - - var statements = '!important !default'; - var preprocessor = '@import @extend @debug @warn @if @for @while @mixin @include'; - - var r = SyntaxHighlighter.regexLib; - - this.regexList = [ - { regex: r.multiLineCComments, css: 'comments' }, // multiline comments - { regex: r.singleLineCComments, css: 'comments' }, // singleline comments - { regex: r.doubleQuotedString, css: 'string' }, // double quoted strings - { regex: r.singleQuotedString, css: 'string' }, // single quoted strings - { regex: /\#[a-fA-F0-9]{3,6}/g, css: 'value' }, // html colors - { regex: /\b(-?\d+)(\.\d+)?(px|em|pt|\:|\%|)\b/g, css: 'value' }, // sizes - { regex: /\$\w+/g, css: 'variable' }, // variables - { regex: new RegExp(this.getKeywords(statements), 'g'), css: 'color3' }, // statements - { regex: new RegExp(this.getKeywords(preprocessor), 'g'), css: 'preprocessor' }, // preprocessor - { regex: new RegExp(getKeywordsCSS(keywords), 'gm'), css: 'keyword' }, // keywords - { regex: new RegExp(getValuesCSS(values), 'g'), css: 'value' }, // values - { regex: new RegExp(this.getKeywords(fonts), 'g'), css: 'color1' } // fonts - ]; - }; - - Brush.prototype = new SyntaxHighlighter.Highlighter(); - Brush.aliases = ['sass', 'scss']; - - SyntaxHighlighter.brushes.Sass = Brush; - - // CommonJS - typeof(exports) != 'undefined' ? exports.Brush = Brush : null; -})(); diff --git a/plugins/textviewer/syntaxhighlighter/scripts/shBrushScala.js b/plugins/textviewer/syntaxhighlighter/scripts/shBrushScala.js deleted file mode 100644 index 4b0b6f04d2982779675a4e005072cdec4c63b9d5..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/scripts/shBrushScala.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -;(function() -{ - // CommonJS - typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; - - function Brush() - { - // Contributed by Yegor Jbanov and David Bernard. - - var keywords = 'val sealed case def true trait implicit forSome import match object null finally super ' + - 'override try lazy for var catch throw type extends class while with new final yield abstract ' + - 'else do if return protected private this package false'; - - var keyops = '[_:=><%#@]+'; - - this.regexList = [ - { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments - { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments - { regex: SyntaxHighlighter.regexLib.multiLineSingleQuotedString, css: 'string' }, // multi-line strings - { regex: SyntaxHighlighter.regexLib.multiLineDoubleQuotedString, css: 'string' }, // double-quoted string - { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings - { regex: /0x[a-f0-9]+|\d+(\.\d+)?/gi, css: 'value' }, // numbers - { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords - { regex: new RegExp(keyops, 'gm'), css: 'keyword' } // scala keyword - ]; - } - - Brush.prototype = new SyntaxHighlighter.Highlighter(); - Brush.aliases = ['scala']; - - SyntaxHighlighter.brushes.Scala = Brush; - - // CommonJS - typeof(exports) != 'undefined' ? exports.Brush = Brush : null; -})(); diff --git a/plugins/textviewer/syntaxhighlighter/scripts/shBrushSql.js b/plugins/textviewer/syntaxhighlighter/scripts/shBrushSql.js deleted file mode 100644 index 5c2cd8806ffed9b2002446b3cb6e1ddc70231f3a..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/scripts/shBrushSql.js +++ /dev/null @@ -1,66 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -;(function() -{ - // CommonJS - typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; - - function Brush() - { - var funcs = 'abs avg case cast coalesce convert count current_timestamp ' + - 'current_user day isnull left lower month nullif replace right ' + - 'session_user space substring sum system_user upper user year'; - - var keywords = 'absolute action add after alter as asc at authorization begin bigint ' + - 'binary bit by cascade char character check checkpoint close collate ' + - 'column commit committed connect connection constraint contains continue ' + - 'create cube current current_date current_time cursor database date ' + - 'deallocate dec decimal declare default delete desc distinct double drop ' + - 'dynamic else end end-exec escape except exec execute false fetch first ' + - 'float for force foreign forward free from full function global goto grant ' + - 'group grouping having hour ignore index inner insensitive insert instead ' + - 'int integer intersect into is isolation key last level load local max min ' + - 'minute modify move name national nchar next no numeric of off on only ' + - 'open option order out output partial password precision prepare primary ' + - 'prior privileges procedure public read real references relative repeatable ' + - 'restrict return returns revoke rollback rollup rows rule schema scroll ' + - 'second section select sequence serializable set size smallint static ' + - 'statistics table temp temporary then time timestamp to top transaction ' + - 'translation trigger true truncate uncommitted union unique update values ' + - 'varchar varying view when where with work'; - - var operators = 'all and any between cross in join like not null or outer some'; - - this.regexList = [ - { regex: /--(.*)$/gm, css: 'comments' }, // one line and multiline comments - { regex: SyntaxHighlighter.regexLib.multiLineDoubleQuotedString, css: 'string' }, // double quoted strings - { regex: SyntaxHighlighter.regexLib.multiLineSingleQuotedString, css: 'string' }, // single quoted strings - { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'color2' }, // functions - { regex: new RegExp(this.getKeywords(operators), 'gmi'), css: 'color1' }, // operators and such - { regex: new RegExp(this.getKeywords(keywords), 'gmi'), css: 'keyword' } // keyword - ]; - }; - - Brush.prototype = new SyntaxHighlighter.Highlighter(); - Brush.aliases = ['sql']; - - SyntaxHighlighter.brushes.Sql = Brush; - - // CommonJS - typeof(exports) != 'undefined' ? exports.Brush = Brush : null; -})(); - diff --git a/plugins/textviewer/syntaxhighlighter/scripts/shBrushVb.js b/plugins/textviewer/syntaxhighlighter/scripts/shBrushVb.js deleted file mode 100644 index be845dc0b30131bcc5294f7313225e2f59ab1aae..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/scripts/shBrushVb.js +++ /dev/null @@ -1,56 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -;(function() -{ - // CommonJS - typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; - - function Brush() - { - var keywords = 'AddHandler AddressOf AndAlso Alias And Ansi As Assembly Auto ' + - 'Boolean ByRef Byte ByVal Call Case Catch CBool CByte CChar CDate ' + - 'CDec CDbl Char CInt Class CLng CObj Const CShort CSng CStr CType ' + - 'Date Decimal Declare Default Delegate Dim DirectCast Do Double Each ' + - 'Else ElseIf End Enum Erase Error Event Exit False Finally For Friend ' + - 'Function Get GetType GoSub GoTo Handles If Implements Imports In ' + - 'Inherits Integer Interface Is Let Lib Like Long Loop Me Mod Module ' + - 'MustInherit MustOverride MyBase MyClass Namespace New Next Not Nothing ' + - 'NotInheritable NotOverridable Object On Option Optional Or OrElse ' + - 'Overloads Overridable Overrides ParamArray Preserve Private Property ' + - 'Protected Public RaiseEvent ReadOnly ReDim REM RemoveHandler Resume ' + - 'Return Select Set Shadows Shared Short Single Static Step Stop String ' + - 'Structure Sub SyncLock Then Throw To True Try TypeOf Unicode Until ' + - 'Variant When While With WithEvents WriteOnly Xor'; - - this.regexList = [ - { regex: /'.*$/gm, css: 'comments' }, // one line comments - { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings - { regex: /^\s*#.*$/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion - { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // vb keyword - ]; - - this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); - }; - - Brush.prototype = new SyntaxHighlighter.Highlighter(); - Brush.aliases = ['vb', 'vbnet']; - - SyntaxHighlighter.brushes.Vb = Brush; - - // CommonJS - typeof(exports) != 'undefined' ? exports.Brush = Brush : null; -})(); diff --git a/plugins/textviewer/syntaxhighlighter/scripts/shBrushXml.js b/plugins/textviewer/syntaxhighlighter/scripts/shBrushXml.js deleted file mode 100644 index 69d9fd0b1f4405a03aaa8c41d0b089168aefa43e..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/scripts/shBrushXml.js +++ /dev/null @@ -1,69 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -;(function() -{ - // CommonJS - typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; - - function Brush() - { - function process(match, regexInfo) - { - var constructor = SyntaxHighlighter.Match, - code = match[0], - tag = new XRegExp('(<|<)[\\s\\/\\?]*(?<name>[:\\w-\\.]+)', 'xg').exec(code), - result = [] - ; - - if (match.attributes != null) - { - var attributes, - regex = new XRegExp('(?<name> [\\w:\\-\\.]+)' + - '\\s*=\\s*' + - '(?<value> ".*?"|\'.*?\'|\\w+)', - 'xg'); - - while ((attributes = regex.exec(code)) != null) - { - result.push(new constructor(attributes.name, match.index + attributes.index, 'color1')); - result.push(new constructor(attributes.value, match.index + attributes.index + attributes[0].indexOf(attributes.value), 'string')); - } - } - - if (tag != null) - result.push( - new constructor(tag.name, match.index + tag[0].indexOf(tag.name), 'keyword') - ); - - return result; - } - - this.regexList = [ - { regex: new XRegExp('(\\<|<)\\!\\[[\\w\\s]*?\\[(.|\\s)*?\\]\\](\\>|>)', 'gm'), css: 'color2' }, // <![ ... [ ... ]]> - { regex: SyntaxHighlighter.regexLib.xmlComments, css: 'comments' }, // <!-- ... --> - { regex: new XRegExp('(<|<)[\\s\\/\\?]*(\\w+)(?<attributes>.*?)[\\s\\/\\?]*(>|>)', 'sg'), func: process } - ]; - }; - - Brush.prototype = new SyntaxHighlighter.Highlighter(); - Brush.aliases = ['xml', 'xhtml', 'xslt', 'html']; - - SyntaxHighlighter.brushes.Xml = Brush; - - // CommonJS - typeof(exports) != 'undefined' ? exports.Brush = Brush : null; -})(); diff --git a/plugins/textviewer/syntaxhighlighter/scripts/shCore.js b/plugins/textviewer/syntaxhighlighter/scripts/shCore.js deleted file mode 100644 index b47b6454721504abf3ebe05dad4c903142f843f7..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/scripts/shCore.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('K M;I(M)1S 2U("2a\'t 4k M 4K 2g 3l 4G 4H");(6(){6 r(f,e){I(!M.1R(f))1S 3m("3s 15 4R");K a=f.1w;f=M(f.1m,t(f)+(e||""));I(a)f.1w={1m:a.1m,19:a.19?a.19.1a(0):N};H f}6 t(f){H(f.1J?"g":"")+(f.4s?"i":"")+(f.4p?"m":"")+(f.4v?"x":"")+(f.3n?"y":"")}6 B(f,e,a,b){K c=u.L,d,h,g;v=R;5K{O(;c--;){g=u[c];I(a&g.3r&&(!g.2p||g.2p.W(b))){g.2q.12=e;I((h=g.2q.X(f))&&h.P===e){d={3k:g.2b.W(b,h,a),1C:h};1N}}}}5v(i){1S i}5q{v=11}H d}6 p(f,e,a){I(3b.Z.1i)H f.1i(e,a);O(a=a||0;a<f.L;a++)I(f[a]===e)H a;H-1}M=6(f,e){K a=[],b=M.1B,c=0,d,h;I(M.1R(f)){I(e!==1d)1S 3m("2a\'t 5r 5I 5F 5B 5C 15 5E 5p");H r(f)}I(v)1S 2U("2a\'t W 3l M 59 5m 5g 5x 5i");e=e||"";O(d={2N:11,19:[],2K:6(g){H e.1i(g)>-1},3d:6(g){e+=g}};c<f.L;)I(h=B(f,c,b,d)){a.U(h.3k);c+=h.1C[0].L||1}Y I(h=n.X.W(z[b],f.1a(c))){a.U(h[0]);c+=h[0].L}Y{h=f.3a(c);I(h==="[")b=M.2I;Y I(h==="]")b=M.1B;a.U(h);c++}a=15(a.1K(""),n.Q.W(e,w,""));a.1w={1m:f,19:d.2N?d.19:N};H a};M.3v="1.5.0";M.2I=1;M.1B=2;K C=/\\$(?:(\\d\\d?|[$&`\'])|{([$\\w]+)})/g,w=/[^5h]+|([\\s\\S])(?=[\\s\\S]*\\1)/g,A=/^(?:[?*+]|{\\d+(?:,\\d*)?})\\??/,v=11,u=[],n={X:15.Z.X,1A:15.Z.1A,1C:1r.Z.1C,Q:1r.Z.Q,1e:1r.Z.1e},x=n.X.W(/()??/,"")[1]===1d,D=6(){K f=/^/g;n.1A.W(f,"");H!f.12}(),y=6(){K f=/x/g;n.Q.W("x",f,"");H!f.12}(),E=15.Z.3n!==1d,z={};z[M.2I]=/^(?:\\\\(?:[0-3][0-7]{0,2}|[4-7][0-7]?|x[\\29-26-f]{2}|u[\\29-26-f]{4}|c[A-3o-z]|[\\s\\S]))/;z[M.1B]=/^(?:\\\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9]\\d*|x[\\29-26-f]{2}|u[\\29-26-f]{4}|c[A-3o-z]|[\\s\\S])|\\(\\?[:=!]|[?*+]\\?|{\\d+(?:,\\d*)?}\\??)/;M.1h=6(f,e,a,b){u.U({2q:r(f,"g"+(E?"y":"")),2b:e,3r:a||M.1B,2p:b||N})};M.2n=6(f,e){K a=f+"/"+(e||"");H M.2n[a]||(M.2n[a]=M(f,e))};M.3c=6(f){H r(f,"g")};M.5l=6(f){H f.Q(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g,"\\\\$&")};M.5e=6(f,e,a,b){e=r(e,"g"+(b&&E?"y":""));e.12=a=a||0;f=e.X(f);H b?f&&f.P===a?f:N:f};M.3q=6(){M.1h=6(){1S 2U("2a\'t 55 1h 54 3q")}};M.1R=6(f){H 53.Z.1q.W(f)==="[2m 15]"};M.3p=6(f,e,a,b){O(K c=r(e,"g"),d=-1,h;h=c.X(f);){a.W(b,h,++d,f,c);c.12===h.P&&c.12++}I(e.1J)e.12=0};M.57=6(f,e){H 6 a(b,c){K d=e[c].1I?e[c]:{1I:e[c]},h=r(d.1I,"g"),g=[],i;O(i=0;i<b.L;i++)M.3p(b[i],h,6(k){g.U(d.3j?k[d.3j]||"":k[0])});H c===e.L-1||!g.L?g:a(g,c+1)}([f],0)};15.Z.1p=6(f,e){H J.X(e[0])};15.Z.W=6(f,e){H J.X(e)};15.Z.X=6(f){K e=n.X.1p(J,14),a;I(e){I(!x&&e.L>1&&p(e,"")>-1){a=15(J.1m,n.Q.W(t(J),"g",""));n.Q.W(f.1a(e.P),a,6(){O(K c=1;c<14.L-2;c++)I(14[c]===1d)e[c]=1d})}I(J.1w&&J.1w.19)O(K b=1;b<e.L;b++)I(a=J.1w.19[b-1])e[a]=e[b];!D&&J.1J&&!e[0].L&&J.12>e.P&&J.12--}H e};I(!D)15.Z.1A=6(f){(f=n.X.W(J,f))&&J.1J&&!f[0].L&&J.12>f.P&&J.12--;H!!f};1r.Z.1C=6(f){M.1R(f)||(f=15(f));I(f.1J){K e=n.1C.1p(J,14);f.12=0;H e}H f.X(J)};1r.Z.Q=6(f,e){K a=M.1R(f),b,c;I(a&&1j e.58()==="3f"&&e.1i("${")===-1&&y)H n.Q.1p(J,14);I(a){I(f.1w)b=f.1w.19}Y f+="";I(1j e==="6")c=n.Q.W(J,f,6(){I(b){14[0]=1f 1r(14[0]);O(K d=0;d<b.L;d++)I(b[d])14[0][b[d]]=14[d+1]}I(a&&f.1J)f.12=14[14.L-2]+14[0].L;H e.1p(N,14)});Y{c=J+"";c=n.Q.W(c,f,6(){K d=14;H n.Q.W(e,C,6(h,g,i){I(g)5b(g){24"$":H"$";24"&":H d[0];24"`":H d[d.L-1].1a(0,d[d.L-2]);24"\'":H d[d.L-1].1a(d[d.L-2]+d[0].L);5a:i="";g=+g;I(!g)H h;O(;g>d.L-3;){i=1r.Z.1a.W(g,-1)+i;g=1Q.3i(g/10)}H(g?d[g]||"":"$")+i}Y{g=+i;I(g<=d.L-3)H d[g];g=b?p(b,i):-1;H g>-1?d[g+1]:h}})})}I(a&&f.1J)f.12=0;H c};1r.Z.1e=6(f,e){I(!M.1R(f))H n.1e.1p(J,14);K a=J+"",b=[],c=0,d,h;I(e===1d||+e<0)e=5D;Y{e=1Q.3i(+e);I(!e)H[]}O(f=M.3c(f);d=f.X(a);){I(f.12>c){b.U(a.1a(c,d.P));d.L>1&&d.P<a.L&&3b.Z.U.1p(b,d.1a(1));h=d[0].L;c=f.12;I(b.L>=e)1N}f.12===d.P&&f.12++}I(c===a.L){I(!n.1A.W(f,"")||h)b.U("")}Y b.U(a.1a(c));H b.L>e?b.1a(0,e):b};M.1h(/\\(\\?#[^)]*\\)/,6(f){H n.1A.W(A,f.2S.1a(f.P+f[0].L))?"":"(?:)"});M.1h(/\\((?!\\?)/,6(){J.19.U(N);H"("});M.1h(/\\(\\?<([$\\w]+)>/,6(f){J.19.U(f[1]);J.2N=R;H"("});M.1h(/\\\\k<([\\w$]+)>/,6(f){K e=p(J.19,f[1]);H e>-1?"\\\\"+(e+1)+(3R(f.2S.3a(f.P+f[0].L))?"":"(?:)"):f[0]});M.1h(/\\[\\^?]/,6(f){H f[0]==="[]"?"\\\\b\\\\B":"[\\\\s\\\\S]"});M.1h(/^\\(\\?([5A]+)\\)/,6(f){J.3d(f[1]);H""});M.1h(/(?:\\s+|#.*)+/,6(f){H n.1A.W(A,f.2S.1a(f.P+f[0].L))?"":"(?:)"},M.1B,6(){H J.2K("x")});M.1h(/\\./,6(){H"[\\\\s\\\\S]"},M.1B,6(){H J.2K("s")})})();1j 2e!="1d"&&(2e.M=M);K 1v=6(){6 r(a,b){a.1l.1i(b)!=-1||(a.1l+=" "+b)}6 t(a){H a.1i("3e")==0?a:"3e"+a}6 B(a){H e.1Y.2A[t(a)]}6 p(a,b,c){I(a==N)H N;K d=c!=R?a.3G:[a.2G],h={"#":"1c",".":"1l"}[b.1o(0,1)]||"3h",g,i;g=h!="3h"?b.1o(1):b.5u();I((a[h]||"").1i(g)!=-1)H a;O(a=0;d&&a<d.L&&i==N;a++)i=p(d[a],b,c);H i}6 C(a,b){K c={},d;O(d 2g a)c[d]=a[d];O(d 2g b)c[d]=b[d];H c}6 w(a,b,c,d){6 h(g){g=g||1P.5y;I(!g.1F){g.1F=g.52;g.3N=6(){J.5w=11}}c.W(d||1P,g)}a.3g?a.3g("4U"+b,h):a.4y(b,h,11)}6 A(a,b){K c=e.1Y.2j,d=N;I(c==N){c={};O(K h 2g e.1U){K g=e.1U[h];d=g.4x;I(d!=N){g.1V=h.4w();O(g=0;g<d.L;g++)c[d[g]]=h}}e.1Y.2j=c}d=e.1U[c[a]];d==N&&b!=11&&1P.1X(e.13.1x.1X+(e.13.1x.3E+a));H d}6 v(a,b){O(K c=a.1e("\\n"),d=0;d<c.L;d++)c[d]=b(c[d],d);H c.1K("\\n")}6 u(a,b){I(a==N||a.L==0||a=="\\n")H a;a=a.Q(/</g,"&1y;");a=a.Q(/ {2,}/g,6(c){O(K d="",h=0;h<c.L-1;h++)d+=e.13.1W;H d+" "});I(b!=N)a=v(a,6(c){I(c.L==0)H"";K d="";c=c.Q(/^(&2s;| )+/,6(h){d=h;H""});I(c.L==0)H d;H d+\'<17 1g="\'+b+\'">\'+c+"</17>"});H a}6 n(a,b){a.1e("\\n");O(K c="",d=0;d<50;d++)c+=" ";H a=v(a,6(h){I(h.1i("\\t")==-1)H h;O(K g=0;(g=h.1i("\\t"))!=-1;)h=h.1o(0,g)+c.1o(0,b-g%b)+h.1o(g+1,h.L);H h})}6 x(a){H a.Q(/^\\s+|\\s+$/g,"")}6 D(a,b){I(a.P<b.P)H-1;Y I(a.P>b.P)H 1;Y I(a.L<b.L)H-1;Y I(a.L>b.L)H 1;H 0}6 y(a,b){6 c(k){H k[0]}O(K d=N,h=[],g=b.2D?b.2D:c;(d=b.1I.X(a))!=N;){K i=g(d,b);I(1j i=="3f")i=[1f e.2L(i,d.P,b.23)];h=h.1O(i)}H h}6 E(a){K b=/(.*)((&1G;|&1y;).*)/;H a.Q(e.3A.3M,6(c){K d="",h=N;I(h=b.X(c)){c=h[1];d=h[2]}H\'<a 2h="\'+c+\'">\'+c+"</a>"+d})}6 z(){O(K a=1E.36("1k"),b=[],c=0;c<a.L;c++)a[c].3s=="20"&&b.U(a[c]);H b}6 f(a){a=a.1F;K b=p(a,".20",R);a=p(a,".3O",R);K c=1E.4i("3t");I(!(!a||!b||p(a,"3t"))){B(b.1c);r(b,"1m");O(K d=a.3G,h=[],g=0;g<d.L;g++)h.U(d[g].4z||d[g].4A);h=h.1K("\\r");c.39(1E.4D(h));a.39(c);c.2C();c.4C();w(c,"4u",6(){c.2G.4E(c);b.1l=b.1l.Q("1m","")})}}I(1j 3F!="1d"&&1j M=="1d")M=3F("M").M;K e={2v:{"1g-27":"","2i-1s":1,"2z-1s-2t":11,1M:N,1t:N,"42-45":R,"43-22":4,1u:R,16:R,"3V-17":R,2l:11,"41-40":R,2k:11,"1z-1k":11},13:{1W:"&2s;",2M:R,46:11,44:11,34:"4n",1x:{21:"4o 1m",2P:"?",1X:"1v\\n\\n",3E:"4r\'t 4t 1D O: ",4g:"4m 4B\'t 51 O 1z-1k 4F: ",37:\'<!4T 1z 4S "-//4V//3H 4W 1.0 4Z//4Y" "1Z://2y.3L.3K/4X/3I/3H/3I-4P.4J"><1z 4I="1Z://2y.3L.3K/4L/5L"><3J><4N 1Z-4M="5G-5M" 6K="2O/1z; 6J=6I-8" /><1t>6L 1v</1t></3J><3B 1L="25-6M:6Q,6P,6O,6N-6F;6y-2f:#6x;2f:#6w;25-22:6v;2O-3D:3C;"><T 1L="2O-3D:3C;3w-32:1.6z;"><T 1L="25-22:6A-6E;">1v</T><T 1L="25-22:.6C;3w-6B:6R;"><T>3v 3.0.76 (72 73 3x)</T><T><a 2h="1Z://3u.2w/1v" 1F="38" 1L="2f:#3y">1Z://3u.2w/1v</a></T><T>70 17 6U 71.</T><T>6T 6X-3x 6Y 6D.</T></T><T>6t 61 60 J 1k, 5Z <a 2h="6u://2y.62.2w/63-66/65?64=5X-5W&5P=5O" 1L="2f:#3y">5R</a> 5V <2R/>5U 5T 5S!</T></T></3B></1z>\'}},1Y:{2j:N,2A:{}},1U:{},3A:{6n:/\\/\\*[\\s\\S]*?\\*\\//2c,6m:/\\/\\/.*$/2c,6l:/#.*$/2c,6k:/"([^\\\\"\\n]|\\\\.)*"/g,6o:/\'([^\\\\\'\\n]|\\\\.)*\'/g,6p:1f M(\'"([^\\\\\\\\"]|\\\\\\\\.)*"\',"3z"),6s:1f M("\'([^\\\\\\\\\']|\\\\\\\\.)*\'","3z"),6q:/(&1y;|<)!--[\\s\\S]*?--(&1G;|>)/2c,3M:/\\w+:\\/\\/[\\w-.\\/?%&=:@;]*/g,6a:{18:/(&1y;|<)\\?=?/g,1b:/\\?(&1G;|>)/g},69:{18:/(&1y;|<)%=?/g,1b:/%(&1G;|>)/g},6d:{18:/(&1y;|<)\\s*1k.*?(&1G;|>)/2T,1b:/(&1y;|<)\\/\\s*1k\\s*(&1G;|>)/2T}},16:{1H:6(a){6 b(i,k){H e.16.2o(i,k,e.13.1x[k])}O(K c=\'<T 1g="16">\',d=e.16.2x,h=d.2X,g=0;g<h.L;g++)c+=(d[h[g]].1H||b)(a,h[g]);c+="</T>";H c},2o:6(a,b,c){H\'<2W><a 2h="#" 1g="6e 6h\'+b+" "+b+\'">\'+c+"</a></2W>"},2b:6(a){K b=a.1F,c=b.1l||"";b=B(p(b,".20",R).1c);K d=6(h){H(h=15(h+"6f(\\\\w+)").X(c))?h[1]:N}("6g");b&&d&&e.16.2x[d].2B(b);a.3N()},2x:{2X:["21","2P"],21:{1H:6(a){I(a.V("2l")!=R)H"";K b=a.V("1t");H e.16.2o(a,"21",b?b:e.13.1x.21)},2B:6(a){a=1E.6j(t(a.1c));a.1l=a.1l.Q("47","")}},2P:{2B:6(){K a="68=0";a+=", 18="+(31.30-33)/2+", 32="+(31.2Z-2Y)/2+", 30=33, 2Z=2Y";a=a.Q(/^,/,"");a=1P.6Z("","38",a);a.2C();K b=a.1E;b.6W(e.13.1x.37);b.6V();a.2C()}}}},35:6(a,b){K c;I(b)c=[b];Y{c=1E.36(e.13.34);O(K d=[],h=0;h<c.L;h++)d.U(c[h]);c=d}c=c;d=[];I(e.13.2M)c=c.1O(z());I(c.L===0)H d;O(h=0;h<c.L;h++){O(K g=c[h],i=a,k=c[h].1l,j=3W 0,l={},m=1f M("^\\\\[(?<2V>(.*?))\\\\]$"),s=1f M("(?<27>[\\\\w-]+)\\\\s*:\\\\s*(?<1T>[\\\\w-%#]+|\\\\[.*?\\\\]|\\".*?\\"|\'.*?\')\\\\s*;?","g");(j=s.X(k))!=N;){K o=j.1T.Q(/^[\'"]|[\'"]$/g,"");I(o!=N&&m.1A(o)){o=m.X(o);o=o.2V.L>0?o.2V.1e(/\\s*,\\s*/):[]}l[j.27]=o}g={1F:g,1n:C(i,l)};g.1n.1D!=N&&d.U(g)}H d},1M:6(a,b){K c=J.35(a,b),d=N,h=e.13;I(c.L!==0)O(K g=0;g<c.L;g++){b=c[g];K i=b.1F,k=b.1n,j=k.1D,l;I(j!=N){I(k["1z-1k"]=="R"||e.2v["1z-1k"]==R){d=1f e.4l(j);j="4O"}Y I(d=A(j))d=1f d;Y 6H;l=i.3X;I(h.2M){l=l;K m=x(l),s=11;I(m.1i("<![6G[")==0){m=m.4h(9);s=R}K o=m.L;I(m.1i("]]\\>")==o-3){m=m.4h(0,o-3);s=R}l=s?m:l}I((i.1t||"")!="")k.1t=i.1t;k.1D=j;d.2Q(k);b=d.2F(l);I((i.1c||"")!="")b.1c=i.1c;i.2G.74(b,i)}}},2E:6(a){w(1P,"4k",6(){e.1M(a)})}};e.2E=e.2E;e.1M=e.1M;e.2L=6(a,b,c){J.1T=a;J.P=b;J.L=a.L;J.23=c;J.1V=N};e.2L.Z.1q=6(){H J.1T};e.4l=6(a){6 b(j,l){O(K m=0;m<j.L;m++)j[m].P+=l}K c=A(a),d,h=1f e.1U.5Y,g=J,i="2F 1H 2Q".1e(" ");I(c!=N){d=1f c;O(K k=0;k<i.L;k++)(6(){K j=i[k];g[j]=6(){H h[j].1p(h,14)}})();d.28==N?1P.1X(e.13.1x.1X+(e.13.1x.4g+a)):h.2J.U({1I:d.28.17,2D:6(j){O(K l=j.17,m=[],s=d.2J,o=j.P+j.18.L,F=d.28,q,G=0;G<s.L;G++){q=y(l,s[G]);b(q,o);m=m.1O(q)}I(F.18!=N&&j.18!=N){q=y(j.18,F.18);b(q,j.P);m=m.1O(q)}I(F.1b!=N&&j.1b!=N){q=y(j.1b,F.1b);b(q,j.P+j[0].5Q(j.1b));m=m.1O(q)}O(j=0;j<m.L;j++)m[j].1V=c.1V;H m}})}};e.4j=6(){};e.4j.Z={V:6(a,b){K c=J.1n[a];c=c==N?b:c;K d={"R":R,"11":11}[c];H d==N?c:d},3Y:6(a){H 1E.4i(a)},4c:6(a,b){K c=[];I(a!=N)O(K d=0;d<a.L;d++)I(1j a[d]=="2m")c=c.1O(y(b,a[d]));H J.4e(c.6b(D))},4e:6(a){O(K b=0;b<a.L;b++)I(a[b]!==N)O(K c=a[b],d=c.P+c.L,h=b+1;h<a.L&&a[b]!==N;h++){K g=a[h];I(g!==N)I(g.P>d)1N;Y I(g.P==c.P&&g.L>c.L)a[b]=N;Y I(g.P>=c.P&&g.P<d)a[h]=N}H a},4d:6(a){K b=[],c=2u(J.V("2i-1s"));v(a,6(d,h){b.U(h+c)});H b},3U:6(a){K b=J.V("1M",[]);I(1j b!="2m"&&b.U==N)b=[b];a:{a=a.1q();K c=3W 0;O(c=c=1Q.6c(c||0,0);c<b.L;c++)I(b[c]==a){b=c;1N a}b=-1}H b!=-1},2r:6(a,b,c){a=["1s","6i"+b,"P"+a,"6r"+(b%2==0?1:2).1q()];J.3U(b)&&a.U("67");b==0&&a.U("1N");H\'<T 1g="\'+a.1K(" ")+\'">\'+c+"</T>"},3Q:6(a,b){K c="",d=a.1e("\\n").L,h=2u(J.V("2i-1s")),g=J.V("2z-1s-2t");I(g==R)g=(h+d-1).1q().L;Y I(3R(g)==R)g=0;O(K i=0;i<d;i++){K k=b?b[i]:h+i,j;I(k==0)j=e.13.1W;Y{j=g;O(K l=k.1q();l.L<j;)l="0"+l;j=l}a=j;c+=J.2r(i,k,a)}H c},49:6(a,b){a=x(a);K c=a.1e("\\n");J.V("2z-1s-2t");K d=2u(J.V("2i-1s"));a="";O(K h=J.V("1D"),g=0;g<c.L;g++){K i=c[g],k=/^(&2s;|\\s)+/.X(i),j=N,l=b?b[g]:d+g;I(k!=N){j=k[0].1q();i=i.1o(j.L);j=j.Q(" ",e.13.1W)}i=x(i);I(i.L==0)i=e.13.1W;a+=J.2r(g,l,(j!=N?\'<17 1g="\'+h+\' 5N">\'+j+"</17>":"")+i)}H a},4f:6(a){H a?"<4a>"+a+"</4a>":""},4b:6(a,b){6 c(l){H(l=l?l.1V||g:g)?l+" ":""}O(K d=0,h="",g=J.V("1D",""),i=0;i<b.L;i++){K k=b[i],j;I(!(k===N||k.L===0)){j=c(k);h+=u(a.1o(d,k.P-d),j+"48")+u(k.1T,j+k.23);d=k.P+k.L+(k.75||0)}}h+=u(a.1o(d),c()+"48");H h},1H:6(a){K b="",c=["20"],d;I(J.V("2k")==R)J.1n.16=J.1n.1u=11;1l="20";J.V("2l")==R&&c.U("47");I((1u=J.V("1u"))==11)c.U("6S");c.U(J.V("1g-27"));c.U(J.V("1D"));a=a.Q(/^[ ]*[\\n]+|[\\n]*[ ]*$/g,"").Q(/\\r/g," ");b=J.V("43-22");I(J.V("42-45")==R)a=n(a,b);Y{O(K h="",g=0;g<b;g++)h+=" ";a=a.Q(/\\t/g,h)}a=a;a:{b=a=a;h=/<2R\\s*\\/?>|&1y;2R\\s*\\/?&1G;/2T;I(e.13.46==R)b=b.Q(h,"\\n");I(e.13.44==R)b=b.Q(h,"");b=b.1e("\\n");h=/^\\s*/;g=4Q;O(K i=0;i<b.L&&g>0;i++){K k=b[i];I(x(k).L!=0){k=h.X(k);I(k==N){a=a;1N a}g=1Q.4q(k[0].L,g)}}I(g>0)O(i=0;i<b.L;i++)b[i]=b[i].1o(g);a=b.1K("\\n")}I(1u)d=J.4d(a);b=J.4c(J.2J,a);b=J.4b(a,b);b=J.49(b,d);I(J.V("41-40"))b=E(b);1j 2H!="1d"&&2H.3S&&2H.3S.1C(/5s/)&&c.U("5t");H b=\'<T 1c="\'+t(J.1c)+\'" 1g="\'+c.1K(" ")+\'">\'+(J.V("16")?e.16.1H(J):"")+\'<3Z 5z="0" 5H="0" 5J="0">\'+J.4f(J.V("1t"))+"<3T><3P>"+(1u?\'<2d 1g="1u">\'+J.3Q(a)+"</2d>":"")+\'<2d 1g="17"><T 1g="3O">\'+b+"</T></2d></3P></3T></3Z></T>"},2F:6(a){I(a===N)a="";J.17=a;K b=J.3Y("T");b.3X=J.1H(a);J.V("16")&&w(p(b,".16"),"5c",e.16.2b);J.V("3V-17")&&w(p(b,".17"),"56",f);H b},2Q:6(a){J.1c=""+1Q.5d(1Q.5n()*5k).1q();e.1Y.2A[t(J.1c)]=J;J.1n=C(e.2v,a||{});I(J.V("2k")==R)J.1n.16=J.1n.1u=11},5j:6(a){a=a.Q(/^\\s+|\\s+$/g,"").Q(/\\s+/g,"|");H"\\\\b(?:"+a+")\\\\b"},5f:6(a){J.28={18:{1I:a.18,23:"1k"},1b:{1I:a.1b,23:"1k"},17:1f M("(?<18>"+a.18.1m+")(?<17>.*?)(?<1b>"+a.1b.1m+")","5o")}}};H e}();1j 2e!="1d"&&(2e.1v=1v);',62,441,'||||||function|||||||||||||||||||||||||||||||||||||return|if|this|var|length|XRegExp|null|for|index|replace|true||div|push|getParam|call|exec|else|prototype||false|lastIndex|config|arguments|RegExp|toolbar|code|left|captureNames|slice|right|id|undefined|split|new|class|addToken|indexOf|typeof|script|className|source|params|substr|apply|toString|String|line|title|gutter|SyntaxHighlighter|_xregexp|strings|lt|html|test|OUTSIDE_CLASS|match|brush|document|target|gt|getHtml|regex|global|join|style|highlight|break|concat|window|Math|isRegExp|throw|value|brushes|brushName|space|alert|vars|http|syntaxhighlighter|expandSource|size|css|case|font|Fa|name|htmlScript|dA|can|handler|gm|td|exports|color|in|href|first|discoveredBrushes|light|collapse|object|cache|getButtonHtml|trigger|pattern|getLineHtml|nbsp|numbers|parseInt|defaults|com|items|www|pad|highlighters|execute|focus|func|all|getDiv|parentNode|navigator|INSIDE_CLASS|regexList|hasFlag|Match|useScriptTags|hasNamedCapture|text|help|init|br|input|gi|Error|values|span|list|250|height|width|screen|top|500|tagName|findElements|getElementsByTagName|aboutDialog|_blank|appendChild|charAt|Array|copyAsGlobal|setFlag|highlighter_|string|attachEvent|nodeName|floor|backref|output|the|TypeError|sticky|Za|iterate|freezeTokens|scope|type|textarea|alexgorbatchev|version|margin|2010|005896|gs|regexLib|body|center|align|noBrush|require|childNodes|DTD|xhtml1|head|org|w3|url|preventDefault|container|tr|getLineNumbersHtml|isNaN|userAgent|tbody|isLineHighlighted|quick|void|innerHTML|create|table|links|auto|smart|tab|stripBrs|tabs|bloggerMode|collapsed|plain|getCodeLinesHtml|caption|getMatchesHtml|findMatches|figureOutLineNumbers|removeNestedMatches|getTitleHtml|brushNotHtmlScript|substring|createElement|Highlighter|load|HtmlScript|Brush|pre|expand|multiline|min|Can|ignoreCase|find|blur|extended|toLowerCase|aliases|addEventListener|innerText|textContent|wasn|select|createTextNode|removeChild|option|same|frame|xmlns|dtd|twice|1999|equiv|meta|htmlscript|transitional|1E3|expected|PUBLIC|DOCTYPE|on|W3C|XHTML|TR|EN|Transitional||configured|srcElement|Object|after|run|dblclick|matchChain|valueOf|constructor|default|switch|click|round|execAt|forHtmlScript|token|gimy|functions|getKeywords|1E6|escape|within|random|sgi|another|finally|supply|MSIE|ie|toUpperCase|catch|returnValue|definition|event|border|imsx|constructing|one|Infinity|from|when|Content|cellpadding|flags|cellspacing|try|xhtml|Type|spaces|2930402|hosted_button_id|lastIndexOf|donate|active|development|keep|to|xclick|_s|Xml|please|like|you|paypal|cgi|cmd|webscr|bin|highlighted|scrollbars|aspScriptTags|phpScriptTags|sort|max|scriptScriptTags|toolbar_item|_|command|command_|number|getElementById|doubleQuotedString|singleLinePerlComments|singleLineCComments|multiLineCComments|singleQuotedString|multiLineDoubleQuotedString|xmlComments|alt|multiLineSingleQuotedString|If|https|1em|000|fff|background|5em|xx|bottom|75em|Gorbatchev|large|serif|CDATA|continue|utf|charset|content|About|family|sans|Helvetica|Arial|Geneva|3em|nogutter|Copyright|syntax|close|write|2004|Alex|open|JavaScript|highlighter|July|02|replaceChild|offset|83'.split('|'),0,{})) diff --git a/plugins/textviewer/syntaxhighlighter/scripts/shLegacy.js b/plugins/textviewer/syntaxhighlighter/scripts/shLegacy.js deleted file mode 100644 index 6d9fd4d19f678550adbc8dc4204cb09a42d06ab8..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/scripts/shLegacy.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('3 u={8:{}};u.8={A:4(c,k,l,m,n,o){4 d(a,b){2 a!=1?a:b}4 f(a){2 a!=1?a.E():1}c=c.I(":");3 g=c[0],e={};t={"r":K};M=1;5=8.5;9(3 j R c)e[c[j]]="r";k=f(d(k,5.C));l=f(d(l,5.D));m=f(d(m,5.s));o=f(d(o,5.Q));n=f(d(n,5["x-y"]));2{P:g,C:d(t[e.O],k),D:d(t[e.N],l),s:d({"r":r}[e.s],m),"x-y":d(4(a,b){9(3 h=T S("^"+b+"\\\\[(?<q>\\\\w+)\\\\]$","U"),i=1,p=0;p<a.7;p++)6((i=h.J(a[p]))!=1)2 i.q;2 1}(c,"G"),n)}},F:4(c,k,l,m,n,o){4 d(){9(3 a=H,b=0;b<a.7;b++)6(a[b]!==1){6(z a[b]=="L"&&a[b]!="")2 a[b]+"";6(z a[b]=="X"&&a[b].q!="")2 a[b].q+""}2 1}4 f(a,b,h){h=12.13(h);9(3 i=0;i<h.7;i++)h[i].V("15")==b&&a.Y(h[i])}3 g=[];f(g,c,"Z");f(g,c,"W");6(g.7!==0)9(c=0;c<g.7;c++){3 e=g[c],j=d(e.B["14"],e.10,e.B.v,e.v);6(j!==1){j=u.8.A(j,k,l,m,n,o);8.11(j,e)}}}};',62,68,'|null|return|var|function|defaults|if|length|SyntaxHighlighter|for|||||||||||||||||value|true|collapse|reverse|dp|language||first|line|typeof|parseParams|attributes|gutter|toolbar|toString|HighlightAll|firstline|arguments|split|exec|false|string|result|nocontrols|nogutter|brush|ruler|in|XRegExp|new|gi|getAttribute|textarea|object|push|pre|className|highlight|document|getElementsByTagName|class|name'.split('|'),0,{})) diff --git a/plugins/textviewer/syntaxhighlighter/src/shAutoloader.js b/plugins/textviewer/syntaxhighlighter/src/shAutoloader.js deleted file mode 100644 index 3a95449afbb410f3ff6a435be51f85d784b35278..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/src/shAutoloader.js +++ /dev/null @@ -1,130 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -(function() { - -var sh = SyntaxHighlighter; - -/** - * Provides functionality to dynamically load only the brushes that a needed to render the current page. - * - * There are two syntaxes that autoload understands. For example: - * - * SyntaxHighlighter.autoloader( - * [ 'applescript', 'Scripts/shBrushAppleScript.js' ], - * [ 'actionscript3', 'as3', 'Scripts/shBrushAS3.js' ] - * ); - * - * or a more easily comprehendable one: - * - * SyntaxHighlighter.autoloader( - * 'applescript Scripts/shBrushAppleScript.js', - * 'actionscript3 as3 Scripts/shBrushAS3.js' - * ); - */ -sh.autoloader = function() -{ - var list = arguments, - elements = sh.findElements(), - brushes = {}, - scripts = {}, - all = SyntaxHighlighter.all, - allCalled = false, - allParams = null, - i - ; - - SyntaxHighlighter.all = function(params) - { - allParams = params; - allCalled = true; - }; - - function addBrush(aliases, url) - { - for (var i = 0; i < aliases.length; i++) - brushes[aliases[i]] = url; - }; - - function getAliases(item) - { - return item.pop - ? item - : item.split(/\s+/) - ; - } - - // create table of aliases and script urls - for (i = 0; i < list.length; i++) - { - var aliases = getAliases(list[i]), - url = aliases.pop() - ; - - addBrush(aliases, url); - } - - // dynamically add <script /> tags to the document body - for (i = 0; i < elements.length; i++) - { - var url = brushes[elements[i].params.brush]; - - if (!url) - continue; - - scripts[url] = false; - loadScript(url); - } - - function loadScript(url) - { - var script = document.createElement('script'), - done = false - ; - - script.src = url; - script.type = 'text/javascript'; - script.language = 'javascript'; - script.onload = script.onreadystatechange = function() - { - if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) - { - done = true; - scripts[url] = true; - checkAll(); - - // Handle memory leak in IE - script.onload = script.onreadystatechange = null; - script.parentNode.removeChild(script); - } - }; - - // sync way of adding script tags to the page - document.body.appendChild(script); - }; - - function checkAll() - { - for(var url in scripts) - if (scripts[url] == false) - return; - - if (allCalled) - SyntaxHighlighter.highlight(allParams); - }; -}; - -})(); diff --git a/plugins/textviewer/syntaxhighlighter/src/shCore.js b/plugins/textviewer/syntaxhighlighter/src/shCore.js deleted file mode 100644 index 9b8f7fbc796d13b08694e300924b99f914853136..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/src/shCore.js +++ /dev/null @@ -1,1721 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -// -// Begin anonymous function. This is used to contain local scope variables without polutting global scope. -// -var SyntaxHighlighter = function() { - -// CommonJS -if (typeof(require) != 'undefined' && typeof(XRegExp) == 'undefined') -{ - XRegExp = require('XRegExp').XRegExp; -} - -// Shortcut object which will be assigned to the SyntaxHighlighter variable. -// This is a shorthand for local reference in order to avoid long namespace -// references to SyntaxHighlighter.whatever... -var sh = { - defaults : { - /** Additional CSS class names to be added to highlighter elements. */ - 'class-name' : '', - - /** First line number. */ - 'first-line' : 1, - - /** - * Pads line numbers. Possible values are: - * - * false - don't pad line numbers. - * true - automaticaly pad numbers with minimum required number of leading zeroes. - * [int] - length up to which pad line numbers. - */ - 'pad-line-numbers' : false, - - /** Lines to highlight. */ - 'highlight' : null, - - /** Title to be displayed above the code block. */ - 'title' : null, - - /** Enables or disables smart tabs. */ - 'smart-tabs' : true, - - /** Gets or sets tab size. */ - 'tab-size' : 4, - - /** Enables or disables gutter. */ - 'gutter' : true, - - /** Enables or disables toolbar. */ - 'toolbar' : true, - - /** Enables quick code copy and paste from double click. */ - 'quick-code' : true, - - /** Forces code view to be collapsed. */ - 'collapse' : false, - - /** Enables or disables automatic links. */ - 'auto-links' : true, - - /** Gets or sets light mode. Equavalent to turning off gutter and toolbar. */ - 'light' : false, - - 'html-script' : false - }, - - config : { - space : ' ', - - /** Enables use of <SCRIPT type="syntaxhighlighter" /> tags. */ - useScriptTags : true, - - /** Blogger mode flag. */ - bloggerMode : false, - - stripBrs : false, - - /** Name of the tag that SyntaxHighlighter will automatically look for. */ - tagName : 'pre', - - strings : { - expandSource : 'expand source', - help : '?', - alert: 'SyntaxHighlighter\n\n', - noBrush : 'Can\'t find brush for: ', - brushNotHtmlScript : 'Brush wasn\'t configured for html-script option: ', - - // this is populated by the build script - aboutDialog : '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>About SyntaxHighlighter</title></head><body style="font-family:Geneva,Arial,Helvetica,sans-serif;background-color:#fff;color:#000;font-size:1em;text-align:center;"><div style="text-align:center;margin-top:1.5em;"><div style="font-size:xx-large;">SyntaxHighlighter</div><div style="font-size:.75em;margin-bottom:3em;"><div>version 3.0.83 (July 02 2010)</div><div><a href="http://alexgorbatchev.com/SyntaxHighlighter" target="_blank" style="color:#005896">http://alexgorbatchev.com/SyntaxHighlighter</a></div><div>JavaScript code syntax highlighter.</div><div>Copyright 2004-2010 Alex Gorbatchev.</div></div><div>If you like this script, please <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2930402" style="color:#005896">donate</a> to <br/>keep development active!</div></div></body></html>' - } - }, - - /** Internal 'global' variables. */ - vars : { - discoveredBrushes : null, - highlighters : {} - }, - - /** This object is populated by user included external brush files. */ - brushes : {}, - - /** Common regular expressions. */ - regexLib : { - multiLineCComments : /\/\*[\s\S]*?\*\//gm, - singleLineCComments : /\/\/.*$/gm, - singleLinePerlComments : /#.*$/gm, - doubleQuotedString : /"([^\\"\n]|\\.)*"/g, - singleQuotedString : /'([^\\'\n]|\\.)*'/g, - multiLineDoubleQuotedString : new XRegExp('"([^\\\\"]|\\\\.)*"', 'gs'), - multiLineSingleQuotedString : new XRegExp("'([^\\\\']|\\\\.)*'", 'gs'), - xmlComments : /(<|<)!--[\s\S]*?--(>|>)/gm, - url : /\w+:\/\/[\w-.\/?%&=:@;]*/g, - - /** <?= ?> tags. */ - phpScriptTags : { left: /(<|<)\?=?/g, right: /\?(>|>)/g }, - - /** <%= %> tags. */ - aspScriptTags : { left: /(<|<)%=?/g, right: /%(>|>)/g }, - - /** <script></script> tags. */ - scriptScriptTags : { left: /(<|<)\s*script.*?(>|>)/gi, right: /(<|<)\/\s*script\s*(>|>)/gi } - }, - - toolbar: { - /** - * Generates HTML markup for the toolbar. - * @param {Highlighter} highlighter Highlighter instance. - * @return {String} Returns HTML markup. - */ - getHtml: function(highlighter) - { - var html = '<div class="toolbar">', - items = sh.toolbar.items, - list = items.list - ; - - function defaultGetHtml(highlighter, name) - { - return sh.toolbar.getButtonHtml(highlighter, name, sh.config.strings[name]); - }; - - for (var i = 0; i < list.length; i++) - html += (items[list[i]].getHtml || defaultGetHtml)(highlighter, list[i]); - - html += '</div>'; - - return html; - }, - - /** - * Generates HTML markup for a regular button in the toolbar. - * @param {Highlighter} highlighter Highlighter instance. - * @param {String} commandName Command name that would be executed. - * @param {String} label Label text to display. - * @return {String} Returns HTML markup. - */ - getButtonHtml: function(highlighter, commandName, label) - { - return '<span><a href="#" class="toolbar_item' - + ' command_' + commandName - + ' ' + commandName - + '">' + label + '</a></span>' - ; - }, - - /** - * Event handler for a toolbar anchor. - */ - handler: function(e) - { - var target = e.target, - className = target.className || '' - ; - - function getValue(name) - { - var r = new RegExp(name + '_(\\w+)'), - match = r.exec(className) - ; - - return match ? match[1] : null; - }; - - var highlighter = getHighlighterById(findParentElement(target, '.syntaxhighlighter').id), - commandName = getValue('command') - ; - - // execute the toolbar command - if (highlighter && commandName) - sh.toolbar.items[commandName].execute(highlighter); - - // disable default A click behaviour - e.preventDefault(); - }, - - /** Collection of toolbar items. */ - items : { - // Ordered lis of items in the toolbar. Can't expect `for (var n in items)` to be consistent. - list: ['expandSource', 'help'], - - expandSource: { - getHtml: function(highlighter) - { - if (highlighter.getParam('collapse') != true) - return ''; - - var title = highlighter.getParam('title'); - return sh.toolbar.getButtonHtml(highlighter, 'expandSource', title ? title : sh.config.strings.expandSource); - }, - - execute: function(highlighter) - { - var div = getHighlighterDivById(highlighter.id); - removeClass(div, 'collapsed'); - } - }, - - /** Command to display the about dialog window. */ - help: { - execute: function(highlighter) - { - var wnd = popup('', '_blank', 500, 250, 'scrollbars=0'), - doc = wnd.document - ; - - doc.write(sh.config.strings.aboutDialog); - doc.close(); - wnd.focus(); - } - } - } - }, - - /** - * Finds all elements on the page which should be processes by SyntaxHighlighter. - * - * @param {Object} globalParams Optional parameters which override element's - * parameters. Only used if element is specified. - * - * @param {Object} element Optional element to highlight. If none is - * provided, all elements in the current document - * are returned which qualify. - * - * @return {Array} Returns list of <code>{ target: DOMElement, params: Object }</code> objects. - */ - findElements: function(globalParams, element) - { - var elements = element ? [element] : toArray(document.getElementsByTagName(sh.config.tagName)), - conf = sh.config, - result = [] - ; - - // support for <SCRIPT TYPE="syntaxhighlighter" /> feature - if (conf.useScriptTags) - elements = elements.concat(getSyntaxHighlighterScriptTags()); - - if (elements.length === 0) - return result; - - for (var i = 0; i < elements.length; i++) - { - var item = { - target: elements[i], - // local params take precedence over globals - params: merge(globalParams, parseParams(elements[i].className)) - }; - - if (item.params['brush'] == null) - continue; - - result.push(item); - } - - return result; - }, - - /** - * Shorthand to highlight all elements on the page that are marked as - * SyntaxHighlighter source code. - * - * @param {Object} globalParams Optional parameters which override element's - * parameters. Only used if element is specified. - * - * @param {Object} element Optional element to highlight. If none is - * provided, all elements in the current document - * are highlighted. - */ - highlight: function(globalParams, element) - { - var elements = this.findElements(globalParams, element), - propertyName = 'innerHTML', - highlighter = null, - conf = sh.config - ; - - if (elements.length === 0) - return; - - for (var i = 0; i < elements.length; i++) - { - var element = elements[i], - target = element.target, - params = element.params, - brushName = params.brush, - code - ; - - if (brushName == null) - continue; - - // Instantiate a brush - if (params['html-script'] == 'true' || sh.defaults['html-script'] == true) - { - highlighter = new sh.HtmlScript(brushName); - brushName = 'htmlscript'; - } - else - { - var brush = findBrush(brushName); - - if (brush) - highlighter = new brush(); - else - continue; - } - - code = target[propertyName]; - - // remove CDATA from <SCRIPT/> tags if it's present - if (conf.useScriptTags) - code = stripCData(code); - - // Inject title if the attribute is present - if ((target.title || '') != '') - params.title = target.title; - - params['brush'] = brushName; - highlighter.init(params); - element = highlighter.getDiv(code); - - // carry over ID - if ((target.id || '') != '') - element.id = target.id; - - target.parentNode.replaceChild(element, target); - } - }, - - /** - * Main entry point for the SyntaxHighlighter. - * @param {Object} params Optional params to apply to all highlighted elements. - */ - all: function(params) - { - attachEvent( - window, - 'load', - function() { sh.highlight(params); } - ); - } -}; // end of sh - -sh['all'] = sh.all; -sh['highlight'] = sh.highlight; - -/** - * Checks if target DOM elements has specified CSS class. - * @param {DOMElement} target Target DOM element to check. - * @param {String} className Name of the CSS class to check for. - * @return {Boolean} Returns true if class name is present, false otherwise. - */ -function hasClass(target, className) -{ - return target.className.indexOf(className) != -1; -}; - -/** - * Adds CSS class name to the target DOM element. - * @param {DOMElement} target Target DOM element. - * @param {String} className New CSS class to add. - */ -function addClass(target, className) -{ - if (!hasClass(target, className)) - target.className += ' ' + className; -}; - -/** - * Removes CSS class name from the target DOM element. - * @param {DOMElement} target Target DOM element. - * @param {String} className CSS class to remove. - */ -function removeClass(target, className) -{ - target.className = target.className.replace(className, ''); -}; - -/** - * Converts the source to array object. Mostly used for function arguments and - * lists returned by getElementsByTagName() which aren't Array objects. - * @param {List} source Source list. - * @return {Array} Returns array. - */ -function toArray(source) -{ - var result = []; - - for (var i = 0; i < source.length; i++) - result.push(source[i]); - - return result; -}; - -/** - * Splits block of text into lines. - * @param {String} block Block of text. - * @return {Array} Returns array of lines. - */ -function splitLines(block) -{ - return block.split('\n'); -} - -/** - * Generates HTML ID for the highlighter. - * @param {String} highlighterId Highlighter ID. - * @return {String} Returns HTML ID. - */ -function getHighlighterId(id) -{ - var prefix = 'highlighter_'; - return id.indexOf(prefix) == 0 ? id : prefix + id; -}; - -/** - * Finds Highlighter instance by ID. - * @param {String} highlighterId Highlighter ID. - * @return {Highlighter} Returns instance of the highlighter. - */ -function getHighlighterById(id) -{ - return sh.vars.highlighters[getHighlighterId(id)]; -}; - -/** - * Finds highlighter's DIV container. - * @param {String} highlighterId Highlighter ID. - * @return {Element} Returns highlighter's DIV element. - */ -function getHighlighterDivById(id) -{ - return document.getElementById(getHighlighterId(id)); -}; - -/** - * Stores highlighter so that getHighlighterById() can do its thing. Each - * highlighter must call this method to preserve itself. - * @param {Highilghter} highlighter Highlighter instance. - */ -function storeHighlighter(highlighter) -{ - sh.vars.highlighters[getHighlighterId(highlighter.id)] = highlighter; -}; - -/** - * Looks for a child or parent node which has specified classname. - * Equivalent to jQuery's $(container).find(".className") - * @param {Element} target Target element. - * @param {String} search Class name or node name to look for. - * @param {Boolean} reverse If set to true, will go up the node tree instead of down. - * @return {Element} Returns found child or parent element on null. - */ -function findElement(target, search, reverse /* optional */) -{ - if (target == null) - return null; - - var nodes = reverse != true ? target.childNodes : [ target.parentNode ], - propertyToFind = { '#' : 'id', '.' : 'className' }[search.substr(0, 1)] || 'nodeName', - expectedValue, - found - ; - - expectedValue = propertyToFind != 'nodeName' - ? search.substr(1) - : search.toUpperCase() - ; - - // main return of the found node - if ((target[propertyToFind] || '').indexOf(expectedValue) != -1) - return target; - - for (var i = 0; nodes && i < nodes.length && found == null; i++) - found = findElement(nodes[i], search, reverse); - - return found; -}; - -/** - * Looks for a parent node which has specified classname. - * This is an alias to <code>findElement(container, className, true)</code>. - * @param {Element} target Target element. - * @param {String} className Class name to look for. - * @return {Element} Returns found parent element on null. - */ -function findParentElement(target, className) -{ - return findElement(target, className, true); -}; - -/** - * Finds an index of element in the array. - * @ignore - * @param {Object} searchElement - * @param {Number} fromIndex - * @return {Number} Returns index of element if found; -1 otherwise. - */ -function indexOf(array, searchElement, fromIndex) -{ - fromIndex = Math.max(fromIndex || 0, 0); - - for (var i = fromIndex; i < array.length; i++) - if(array[i] == searchElement) - return i; - - return -1; -}; - -/** - * Generates a unique element ID. - */ -function guid(prefix) -{ - return (prefix || '') + Math.round(Math.random() * 1000000).toString(); -}; - -/** - * Merges two objects. Values from obj2 override values in obj1. - * Function is NOT recursive and works only for one dimensional objects. - * @param {Object} obj1 First object. - * @param {Object} obj2 Second object. - * @return {Object} Returns combination of both objects. - */ -function merge(obj1, obj2) -{ - var result = {}, name; - - for (name in obj1) - result[name] = obj1[name]; - - for (name in obj2) - result[name] = obj2[name]; - - return result; -}; - -/** - * Attempts to convert string to boolean. - * @param {String} value Input string. - * @return {Boolean} Returns true if input was "true", false if input was "false" and value otherwise. - */ -function toBoolean(value) -{ - var result = { "true" : true, "false" : false }[value]; - return result == null ? value : result; -}; - -/** - * Opens up a centered popup window. - * @param {String} url URL to open in the window. - * @param {String} name Popup name. - * @param {int} width Popup width. - * @param {int} height Popup height. - * @param {String} options window.open() options. - * @return {Window} Returns window instance. - */ -function popup(url, name, width, height, options) -{ - var x = (screen.width - width) / 2, - y = (screen.height - height) / 2 - ; - - options += ', left=' + x + - ', top=' + y + - ', width=' + width + - ', height=' + height - ; - options = options.replace(/^,/, ''); - - var win = window.open(url, name, options); - win.focus(); - return win; -}; - -/** - * Adds event handler to the target object. - * @param {Object} obj Target object. - * @param {String} type Name of the event. - * @param {Function} func Handling function. - */ -function attachEvent(obj, type, func, scope) -{ - function handler(e) - { - e = e || window.event; - - if (!e.target) - { - e.target = e.srcElement; - e.preventDefault = function() - { - this.returnValue = false; - }; - } - - func.call(scope || window, e); - }; - - if (obj.attachEvent) - { - obj.attachEvent('on' + type, handler); - } - else - { - obj.addEventListener(type, handler, false); - } -}; - -/** - * Displays an alert. - * @param {String} str String to display. - */ -function alert(str) -{ - window.alert(sh.config.strings.alert + str); -}; - -/** - * Finds a brush by its alias. - * - * @param {String} alias Brush alias. - * @param {Boolean} showAlert Suppresses the alert if false. - * @return {Brush} Returns bursh constructor if found, null otherwise. - */ -function findBrush(alias, showAlert) -{ - var brushes = sh.vars.discoveredBrushes, - result = null - ; - - if (brushes == null) - { - brushes = {}; - - // Find all brushes - for (var brush in sh.brushes) - { - var info = sh.brushes[brush], - aliases = info.aliases - ; - - if (aliases == null) - continue; - - // keep the brush name - info.brushName = brush.toLowerCase(); - - for (var i = 0; i < aliases.length; i++) - brushes[aliases[i]] = brush; - } - - sh.vars.discoveredBrushes = brushes; - } - - result = sh.brushes[brushes[alias]]; - - if (result == null && showAlert != false) - alert(sh.config.strings.noBrush + alias); - - return result; -}; - -/** - * Executes a callback on each line and replaces each line with result from the callback. - * @param {Object} str Input string. - * @param {Object} callback Callback function taking one string argument and returning a string. - */ -function eachLine(str, callback) -{ - var lines = splitLines(str); - - for (var i = 0; i < lines.length; i++) - lines[i] = callback(lines[i], i); - - return lines.join('\n'); -}; - -/** - * This is a special trim which only removes first and last empty lines - * and doesn't affect valid leading space on the first line. - * - * @param {String} str Input string - * @return {String} Returns string without empty first and last lines. - */ -function trimFirstAndLastLines(str) -{ - return str.replace(/^[ ]*[\n]+|[\n]*[ ]*$/g, ''); -}; - -/** - * Parses key/value pairs into hash object. - * - * Understands the following formats: - * - name: word; - * - name: [word, word]; - * - name: "string"; - * - name: 'string'; - * - * For example: - * name1: value; name2: [value, value]; name3: 'value' - * - * @param {String} str Input string. - * @return {Object} Returns deserialized object. - */ -function parseParams(str) -{ - var match, - result = {}, - arrayRegex = new XRegExp("^\\[(?<values>(.*?))\\]$"), - regex = new XRegExp( - "(?<name>[\\w-]+)" + - "\\s*:\\s*" + - "(?<value>" + - "[\\w-%#]+|" + // word - "\\[.*?\\]|" + // [] array - '".*?"|' + // "" string - "'.*?'" + // '' string - ")\\s*;?", - "g" - ) - ; - - while ((match = regex.exec(str)) != null) - { - var value = match.value - .replace(/^['"]|['"]$/g, '') // strip quotes from end of strings - ; - - // try to parse array value - if (value != null && arrayRegex.test(value)) - { - var m = arrayRegex.exec(value); - value = m.values.length > 0 ? m.values.split(/\s*,\s*/) : []; - } - - result[match.name] = value; - } - - return result; -}; - -/** - * Wraps each line of the string into <code/> tag with given style applied to it. - * - * @param {String} str Input string. - * @param {String} css Style name to apply to the string. - * @return {String} Returns input string with each line surrounded by <span/> tag. - */ -function wrapLinesWithCode(str, css) -{ - if (str == null || str.length == 0 || str == '\n') - return str; - - str = str.replace(/</g, '<'); - - // Replace two or more sequential spaces with leaving last space untouched. - str = str.replace(/ {2,}/g, function(m) - { - var spaces = ''; - - for (var i = 0; i < m.length - 1; i++) - spaces += sh.config.space; - - return spaces + ' '; - }); - - // Split each line and apply <span class="...">...</span> to them so that - // leading spaces aren't included. - if (css != null) - str = eachLine(str, function(line) - { - if (line.length == 0) - return ''; - - var spaces = ''; - - line = line.replace(/^( | )+/, function(s) - { - spaces = s; - return ''; - }); - - if (line.length == 0) - return spaces; - - return spaces + '<code class="' + css + '">' + line + '</code>'; - }); - - return str; -}; - -/** - * Pads number with zeros until it's length is the same as given length. - * - * @param {Number} number Number to pad. - * @param {Number} length Max string length with. - * @return {String} Returns a string padded with proper amount of '0'. - */ -function padNumber(number, length) -{ - var result = number.toString(); - - while (result.length < length) - result = '0' + result; - - return result; -}; - -/** - * Replaces tabs with spaces. - * - * @param {String} code Source code. - * @param {Number} tabSize Size of the tab. - * @return {String} Returns code with all tabs replaces by spaces. - */ -function processTabs(code, tabSize) -{ - var tab = ''; - - for (var i = 0; i < tabSize; i++) - tab += ' '; - - return code.replace(/\t/g, tab); -}; - -/** - * Replaces tabs with smart spaces. - * - * @param {String} code Code to fix the tabs in. - * @param {Number} tabSize Number of spaces in a column. - * @return {String} Returns code with all tabs replaces with roper amount of spaces. - */ -function processSmartTabs(code, tabSize) -{ - var lines = splitLines(code), - tab = '\t', - spaces = '' - ; - - // Create a string with 1000 spaces to copy spaces from... - // It's assumed that there would be no indentation longer than that. - for (var i = 0; i < 50; i++) - spaces += ' '; // 20 spaces * 50 - - // This function inserts specified amount of spaces in the string - // where a tab is while removing that given tab. - function insertSpaces(line, pos, count) - { - return line.substr(0, pos) - + spaces.substr(0, count) - + line.substr(pos + 1, line.length) // pos + 1 will get rid of the tab - ; - }; - - // Go through all the lines and do the 'smart tabs' magic. - code = eachLine(code, function(line) - { - if (line.indexOf(tab) == -1) - return line; - - var pos = 0; - - while ((pos = line.indexOf(tab)) != -1) - { - // This is pretty much all there is to the 'smart tabs' logic. - // Based on the position within the line and size of a tab, - // calculate the amount of spaces we need to insert. - var spaces = tabSize - pos % tabSize; - line = insertSpaces(line, pos, spaces); - } - - return line; - }); - - return code; -}; - -/** - * Performs various string fixes based on configuration. - */ -function fixInputString(str) -{ - var br = /<br\s*\/?>|<br\s*\/?>/gi; - - if (sh.config.bloggerMode == true) - str = str.replace(br, '\n'); - - if (sh.config.stripBrs == true) - str = str.replace(br, ''); - - return str; -}; - -/** - * Removes all white space at the begining and end of a string. - * - * @param {String} str String to trim. - * @return {String} Returns string without leading and following white space characters. - */ -function trim(str) -{ - return str.replace(/^\s+|\s+$/g, ''); -}; - -/** - * Unindents a block of text by the lowest common indent amount. - * @param {String} str Text to unindent. - * @return {String} Returns unindented text block. - */ -function unindent(str) -{ - var lines = splitLines(fixInputString(str)), - indents = new Array(), - regex = /^\s*/, - min = 1000 - ; - - // go through every line and check for common number of indents - for (var i = 0; i < lines.length && min > 0; i++) - { - var line = lines[i]; - - if (trim(line).length == 0) - continue; - - var matches = regex.exec(line); - - // In the event that just one line doesn't have leading white space - // we can't unindent anything, so bail completely. - if (matches == null) - return str; - - min = Math.min(matches[0].length, min); - } - - // trim minimum common number of white space from the begining of every line - if (min > 0) - for (var i = 0; i < lines.length; i++) - lines[i] = lines[i].substr(min); - - return lines.join('\n'); -}; - -/** - * Callback method for Array.sort() which sorts matches by - * index position and then by length. - * - * @param {Match} m1 Left object. - * @param {Match} m2 Right object. - * @return {Number} Returns -1, 0 or -1 as a comparison result. - */ -function matchesSortCallback(m1, m2) -{ - // sort matches by index first - if(m1.index < m2.index) - return -1; - else if(m1.index > m2.index) - return 1; - else - { - // if index is the same, sort by length - if(m1.length < m2.length) - return -1; - else if(m1.length > m2.length) - return 1; - } - - return 0; -}; - -/** - * Executes given regular expression on provided code and returns all - * matches that are found. - * - * @param {String} code Code to execute regular expression on. - * @param {Object} regex Regular expression item info from <code>regexList</code> collection. - * @return {Array} Returns a list of Match objects. - */ -function getMatches(code, regexInfo) -{ - function defaultAdd(match, regexInfo) - { - return match[0]; - }; - - var index = 0, - match = null, - matches = [], - func = regexInfo.func ? regexInfo.func : defaultAdd - ; - - while((match = regexInfo.regex.exec(code)) != null) - { - var resultMatch = func(match, regexInfo); - - if (typeof(resultMatch) == 'string') - resultMatch = [new sh.Match(resultMatch, match.index, regexInfo.css)]; - - matches = matches.concat(resultMatch); - } - - return matches; -}; - -/** - * Turns all URLs in the code into <a/> tags. - * @param {String} code Input code. - * @return {String} Returns code with </a> tags. - */ -function processUrls(code) -{ - var gt = /(.*)((>|<).*)/; - - return code.replace(sh.regexLib.url, function(m) - { - var suffix = '', - match = null - ; - - // We include < and > in the URL for the common cases like <http://google.com> - // The problem is that they get transformed into <http://google.com> - // Where as > easily looks like part of the URL string. - - if (match = gt.exec(m)) - { - m = match[1]; - suffix = match[2]; - } - - return '<a href="' + m + '">' + m + '</a>' + suffix; - }); -}; - -/** - * Finds all <SCRIPT TYPE="syntaxhighlighter" /> elementss. - * @return {Array} Returns array of all found SyntaxHighlighter tags. - */ -function getSyntaxHighlighterScriptTags() -{ - var tags = document.getElementsByTagName('script'), - result = [] - ; - - for (var i = 0; i < tags.length; i++) - if (tags[i].type == 'syntaxhighlighter') - result.push(tags[i]); - - return result; -}; - -/** - * Strips <![CDATA[]]> from <SCRIPT /> content because it should be used - * there in most cases for XHTML compliance. - * @param {String} original Input code. - * @return {String} Returns code without leading <![CDATA[]]> tags. - */ -function stripCData(original) -{ - var left = '<![CDATA[', - right = ']]>', - // for some reason IE inserts some leading blanks here - copy = trim(original), - changed = false, - leftLength = left.length, - rightLength = right.length - ; - - if (copy.indexOf(left) == 0) - { - copy = copy.substring(leftLength); - changed = true; - } - - var copyLength = copy.length; - - if (copy.indexOf(right) == copyLength - rightLength) - { - copy = copy.substring(0, copyLength - rightLength); - changed = true; - } - - return changed ? copy : original; -}; - - -/** - * Quick code mouse double click handler. - */ -function quickCodeHandler(e) -{ - var target = e.target, - highlighterDiv = findParentElement(target, '.syntaxhighlighter'), - container = findParentElement(target, '.container'), - textarea = document.createElement('textarea'), - highlighter - ; - - if (!container || !highlighterDiv || findElement(container, 'textarea')) - return; - - highlighter = getHighlighterById(highlighterDiv.id); - - // add source class name - addClass(highlighterDiv, 'source'); - - // Have to go over each line and grab it's text, can't just do it on the - // container because Firefox loses all \n where as Webkit doesn't. - var lines = container.childNodes, - code = [] - ; - - for (var i = 0; i < lines.length; i++) - code.push(lines[i].innerText || lines[i].textContent); - - // using \r instead of \r or \r\n makes this work equally well on IE, FF and Webkit - code = code.join('\r'); - - // inject <textarea/> tag - textarea.appendChild(document.createTextNode(code)); - container.appendChild(textarea); - - // preselect all text - textarea.focus(); - textarea.select(); - - // set up handler for lost focus - attachEvent(textarea, 'blur', function(e) - { - textarea.parentNode.removeChild(textarea); - removeClass(highlighterDiv, 'source'); - }); -}; - -/** - * Match object. - */ -sh.Match = function(value, index, css) -{ - this.value = value; - this.index = index; - this.length = value.length; - this.css = css; - this.brushName = null; -}; - -sh.Match.prototype.toString = function() -{ - return this.value; -}; - -/** - * Simulates HTML code with a scripting language embedded. - * - * @param {String} scriptBrushName Brush name of the scripting language. - */ -sh.HtmlScript = function(scriptBrushName) -{ - var brushClass = findBrush(scriptBrushName), - scriptBrush, - xmlBrush = new sh.brushes.Xml(), - bracketsRegex = null, - ref = this, - methodsToExpose = 'getDiv getHtml init'.split(' ') - ; - - if (brushClass == null) - return; - - scriptBrush = new brushClass(); - - for(var i = 0; i < methodsToExpose.length; i++) - // make a closure so we don't lose the name after i changes - (function() { - var name = methodsToExpose[i]; - - ref[name] = function() - { - return xmlBrush[name].apply(xmlBrush, arguments); - }; - })(); - - if (scriptBrush.htmlScript == null) - { - alert(sh.config.strings.brushNotHtmlScript + scriptBrushName); - return; - } - - xmlBrush.regexList.push( - { regex: scriptBrush.htmlScript.code, func: process } - ); - - function offsetMatches(matches, offset) - { - for (var j = 0; j < matches.length; j++) - matches[j].index += offset; - } - - function process(match, info) - { - var code = match.code, - matches = [], - regexList = scriptBrush.regexList, - offset = match.index + match.left.length, - htmlScript = scriptBrush.htmlScript, - result - ; - - // add all matches from the code - for (var i = 0; i < regexList.length; i++) - { - result = getMatches(code, regexList[i]); - offsetMatches(result, offset); - matches = matches.concat(result); - } - - // add left script bracket - if (htmlScript.left != null && match.left != null) - { - result = getMatches(match.left, htmlScript.left); - offsetMatches(result, match.index); - matches = matches.concat(result); - } - - // add right script bracket - if (htmlScript.right != null && match.right != null) - { - result = getMatches(match.right, htmlScript.right); - offsetMatches(result, match.index + match[0].lastIndexOf(match.right)); - matches = matches.concat(result); - } - - for (var j = 0; j < matches.length; j++) - matches[j].brushName = brushClass.brushName; - - return matches; - } -}; - -/** - * Main Highlither class. - * @constructor - */ -sh.Highlighter = function() -{ - // not putting any code in here because of the prototype inheritance -}; - -sh.Highlighter.prototype = { - /** - * Returns value of the parameter passed to the highlighter. - * @param {String} name Name of the parameter. - * @param {Object} defaultValue Default value. - * @return {Object} Returns found value or default value otherwise. - */ - getParam: function(name, defaultValue) - { - var result = this.params[name]; - return toBoolean(result == null ? defaultValue : result); - }, - - /** - * Shortcut to document.createElement(). - * @param {String} name Name of the element to create (DIV, A, etc). - * @return {HTMLElement} Returns new HTML element. - */ - create: function(name) - { - return document.createElement(name); - }, - - /** - * Applies all regular expression to the code and stores all found - * matches in the `this.matches` array. - * @param {Array} regexList List of regular expressions. - * @param {String} code Source code. - * @return {Array} Returns list of matches. - */ - findMatches: function(regexList, code) - { - var result = []; - - if (regexList != null) - for (var i = 0; i < regexList.length; i++) - // BUG: length returns len+1 for array if methods added to prototype chain (oising@gmail.com) - if (typeof (regexList[i]) == "object") - result = result.concat(getMatches(code, regexList[i])); - - // sort and remove nested the matches - return this.removeNestedMatches(result.sort(matchesSortCallback)); - }, - - /** - * Checks to see if any of the matches are inside of other matches. - * This process would get rid of highligted strings inside comments, - * keywords inside strings and so on. - */ - removeNestedMatches: function(matches) - { - // Optimized by Jose Prado (http://joseprado.com) - for (var i = 0; i < matches.length; i++) - { - if (matches[i] === null) - continue; - - var itemI = matches[i], - itemIEndPos = itemI.index + itemI.length - ; - - for (var j = i + 1; j < matches.length && matches[i] !== null; j++) - { - var itemJ = matches[j]; - - if (itemJ === null) - continue; - else if (itemJ.index > itemIEndPos) - break; - else if (itemJ.index == itemI.index && itemJ.length > itemI.length) - matches[i] = null; - else if (itemJ.index >= itemI.index && itemJ.index < itemIEndPos) - matches[j] = null; - } - } - - return matches; - }, - - /** - * Creates an array containing integer line numbers starting from the 'first-line' param. - * @return {Array} Returns array of integers. - */ - figureOutLineNumbers: function(code) - { - var lines = [], - firstLine = parseInt(this.getParam('first-line')) - ; - - eachLine(code, function(line, index) - { - lines.push(index + firstLine); - }); - - return lines; - }, - - /** - * Determines if specified line number is in the highlighted list. - */ - isLineHighlighted: function(lineNumber) - { - var list = this.getParam('highlight', []); - - if (typeof(list) != 'object' && list.push == null) - list = [ list ]; - - return indexOf(list, lineNumber.toString()) != -1; - }, - - /** - * Generates HTML markup for a single line of code while determining alternating line style. - * @param {Integer} lineNumber Line number. - * @param {String} code Line HTML markup. - * @return {String} Returns HTML markup. - */ - getLineHtml: function(lineIndex, lineNumber, code) - { - var classes = [ - 'line', - 'number' + lineNumber, - 'index' + lineIndex, - 'alt' + (lineNumber % 2 == 0 ? 1 : 2).toString() - ]; - - if (this.isLineHighlighted(lineNumber)) - classes.push('highlighted'); - - if (lineNumber == 0) - classes.push('break'); - - return '<div class="' + classes.join(' ') + '">' + code + '</div>'; - }, - - /** - * Generates HTML markup for line number column. - * @param {String} code Complete code HTML markup. - * @param {Array} lineNumbers Calculated line numbers. - * @return {String} Returns HTML markup. - */ - getLineNumbersHtml: function(code, lineNumbers) - { - var html = '', - count = splitLines(code).length, - firstLine = parseInt(this.getParam('first-line')), - pad = this.getParam('pad-line-numbers') - ; - - if (pad == true) - pad = (firstLine + count - 1).toString().length; - else if (isNaN(pad) == true) - pad = 0; - - for (var i = 0; i < count; i++) - { - var lineNumber = lineNumbers ? lineNumbers[i] : firstLine + i, - code = lineNumber == 0 ? sh.config.space : padNumber(lineNumber, pad) - ; - - html += this.getLineHtml(i, lineNumber, code); - } - - return html; - }, - - /** - * Splits block of text into individual DIV lines. - * @param {String} code Code to highlight. - * @param {Array} lineNumbers Calculated line numbers. - * @return {String} Returns highlighted code in HTML form. - */ - getCodeLinesHtml: function(html, lineNumbers) - { - html = trim(html); - - var lines = splitLines(html), - padLength = this.getParam('pad-line-numbers'), - firstLine = parseInt(this.getParam('first-line')), - html = '', - brushName = this.getParam('brush') - ; - - for (var i = 0; i < lines.length; i++) - { - var line = lines[i], - indent = /^( |\s)+/.exec(line), - spaces = null, - lineNumber = lineNumbers ? lineNumbers[i] : firstLine + i; - ; - - if (indent != null) - { - spaces = indent[0].toString(); - line = line.substr(spaces.length); - spaces = spaces.replace(' ', sh.config.space); - } - - line = trim(line); - - if (line.length == 0) - line = sh.config.space; - - html += this.getLineHtml( - i, - lineNumber, - (spaces != null ? '<code class="' + brushName + ' spaces">' + spaces + '</code>' : '') + line - ); - } - - return html; - }, - - /** - * Returns HTML for the table title or empty string if title is null. - */ - getTitleHtml: function(title) - { - return title ? '<caption>' + title + '</caption>' : ''; - }, - - /** - * Finds all matches in the source code. - * @param {String} code Source code to process matches in. - * @param {Array} matches Discovered regex matches. - * @return {String} Returns formatted HTML with processed mathes. - */ - getMatchesHtml: function(code, matches) - { - var pos = 0, - result = '', - brushName = this.getParam('brush', '') - ; - - function getBrushNameCss(match) - { - var result = match ? (match.brushName || brushName) : brushName; - return result ? result + ' ' : ''; - }; - - // Finally, go through the final list of matches and pull the all - // together adding everything in between that isn't a match. - for (var i = 0; i < matches.length; i++) - { - var match = matches[i], - matchBrushName - ; - - if (match === null || match.length === 0) - continue; - - matchBrushName = getBrushNameCss(match); - - result += wrapLinesWithCode(code.substr(pos, match.index - pos), matchBrushName + 'plain') - + wrapLinesWithCode(match.value, matchBrushName + match.css) - ; - - pos = match.index + match.length + (match.offset || 0); - } - - // don't forget to add whatever's remaining in the string - result += wrapLinesWithCode(code.substr(pos), getBrushNameCss() + 'plain'); - - return result; - }, - - /** - * Generates HTML markup for the whole syntax highlighter. - * @param {String} code Source code. - * @return {String} Returns HTML markup. - */ - getHtml: function(code) - { - var html = '', - classes = [ 'syntaxhighlighter' ], - tabSize, - matches, - lineNumbers - ; - - // process light mode - if (this.getParam('light') == true) - this.params.toolbar = this.params.gutter = false; - - className = 'syntaxhighlighter'; - - if (this.getParam('collapse') == true) - classes.push('collapsed'); - - if ((gutter = this.getParam('gutter')) == false) - classes.push('nogutter'); - - // add custom user style name - classes.push(this.getParam('class-name')); - - // add brush alias to the class name for custom CSS - classes.push(this.getParam('brush')); - - code = trimFirstAndLastLines(code) - .replace(/\r/g, ' ') // IE lets these buggers through - ; - - tabSize = this.getParam('tab-size'); - - // replace tabs with spaces - code = this.getParam('smart-tabs') == true - ? processSmartTabs(code, tabSize) - : processTabs(code, tabSize) - ; - - // unindent code by the common indentation - code = unindent(code); - - if (gutter) - lineNumbers = this.figureOutLineNumbers(code); - - // find matches in the code using brushes regex list - matches = this.findMatches(this.regexList, code); - // processes found matches into the html - html = this.getMatchesHtml(code, matches); - // finally, split all lines so that they wrap well - html = this.getCodeLinesHtml(html, lineNumbers); - - // finally, process the links - if (this.getParam('auto-links')) - html = processUrls(html); - - if (typeof(navigator) != 'undefined' && navigator.userAgent && navigator.userAgent.match(/MSIE/)) - classes.push('ie'); - - html = - '<div id="' + getHighlighterId(this.id) + '" class="' + classes.join(' ') + '">' - + (this.getParam('toolbar') ? sh.toolbar.getHtml(this) : '') - + '<table border="0" cellpadding="0" cellspacing="0">' - + this.getTitleHtml(this.getParam('title')) - + '<tbody>' - + '<tr>' - + (gutter ? '<td class="gutter">' + this.getLineNumbersHtml(code) + '</td>' : '') - + '<td class="code">' - + '<div class="container">' - + html - + '</div>' - + '</td>' - + '</tr>' - + '</tbody>' - + '</table>' - + '</div>' - ; - - return html; - }, - - /** - * Highlights the code and returns complete HTML. - * @param {String} code Code to highlight. - * @return {Element} Returns container DIV element with all markup. - */ - getDiv: function(code) - { - if (code === null) - code = ''; - - this.code = code; - - var div = this.create('div'); - - // create main HTML - div.innerHTML = this.getHtml(code); - - // set up click handlers - if (this.getParam('toolbar')) - attachEvent(findElement(div, '.toolbar'), 'click', sh.toolbar.handler); - - if (this.getParam('quick-code')) - attachEvent(findElement(div, '.code'), 'dblclick', quickCodeHandler); - - return div; - }, - - /** - * Initializes the highlighter/brush. - * - * Constructor isn't used for initialization so that nothing executes during necessary - * `new SyntaxHighlighter.Highlighter()` call when setting up brush inheritence. - * - * @param {Hash} params Highlighter parameters. - */ - init: function(params) - { - this.id = guid(); - - // register this instance in the highlighters list - storeHighlighter(this); - - // local params take precedence over defaults - this.params = merge(sh.defaults, params || {}) - - // process light mode - if (this.getParam('light') == true) - this.params.toolbar = this.params.gutter = false; - }, - - /** - * Converts space separated list of keywords into a regular expression string. - * @param {String} str Space separated keywords. - * @return {String} Returns regular expression string. - */ - getKeywords: function(str) - { - str = str - .replace(/^\s+|\s+$/g, '') - .replace(/\s+/g, '|') - ; - - return '\\b(?:' + str + ')\\b'; - }, - - /** - * Makes a brush compatible with the `html-script` functionality. - * @param {Object} regexGroup Object containing `left` and `right` regular expressions. - */ - forHtmlScript: function(regexGroup) - { - this.htmlScript = { - left : { regex: regexGroup.left, css: 'script' }, - right : { regex: regexGroup.right, css: 'script' }, - code : new XRegExp( - "(?<left>" + regexGroup.left.source + ")" + - "(?<code>.*?)" + - "(?<right>" + regexGroup.right.source + ")", - "sgi" - ) - }; - } -}; // end of Highlighter - -return sh; -}(); // end of anonymous function - -// CommonJS -typeof(exports) != 'undefined' ? exports['SyntaxHighlighter'] = SyntaxHighlighter : null; diff --git a/plugins/textviewer/syntaxhighlighter/src/shLegacy.js b/plugins/textviewer/syntaxhighlighter/src/shLegacy.js deleted file mode 100644 index 36951c93a8723ca7092981d5cd709af6ee77d3b2..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/src/shLegacy.js +++ /dev/null @@ -1,157 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -var dp = { - SyntaxHighlighter : {} -}; - -dp.SyntaxHighlighter = { - parseParams: function( - input, - showGutter, - showControls, - collapseAll, - firstLine, - showColumns - ) - { - function getValue(list, name) - { - var regex = new XRegExp('^' + name + '\\[(?<value>\\w+)\\]$', 'gi'), - match = null - ; - - for (var i = 0; i < list.length; i++) - if ((match = regex.exec(list[i])) != null) - return match.value; - - return null; - }; - - function defaultValue(value, def) - { - return value != null ? value : def; - }; - - function asString(value) - { - return value != null ? value.toString() : null; - }; - - var parts = input.split(':'), - brushName = parts[0], - options = {}, - straight = { 'true' : true } - reverse = { 'true' : false }, - result = null, - defaults = SyntaxHighlighter.defaults - ; - - for (var i in parts) - options[parts[i]] = 'true'; - - showGutter = asString(defaultValue(showGutter, defaults.gutter)); - showControls = asString(defaultValue(showControls, defaults.toolbar)); - collapseAll = asString(defaultValue(collapseAll, defaults.collapse)); - showColumns = asString(defaultValue(showColumns, defaults.ruler)); - firstLine = asString(defaultValue(firstLine, defaults['first-line'])); - - return { - brush : brushName, - gutter : defaultValue(reverse[options.nogutter], showGutter), - toolbar : defaultValue(reverse[options.nocontrols], showControls), - collapse : defaultValue(straight[options.collapse], collapseAll), - // ruler : defaultValue(straight[options.showcolumns], showColumns), - 'first-line' : defaultValue(getValue(parts, 'firstline'), firstLine) - }; - }, - - HighlightAll: function( - name, - showGutter /* optional */, - showControls /* optional */, - collapseAll /* optional */, - firstLine /* optional */, - showColumns /* optional */ - ) - { - function findValue() - { - var a = arguments; - - for (var i = 0; i < a.length; i++) - { - if (a[i] === null) - continue; - - if (typeof(a[i]) == 'string' && a[i] != '') - return a[i] + ''; - - if (typeof(a[i]) == 'object' && a[i].value != '') - return a[i].value + ''; - } - - return null; - }; - - function findTagsByName(list, name, tagName) - { - var tags = document.getElementsByTagName(tagName); - - for (var i = 0; i < tags.length; i++) - if (tags[i].getAttribute('name') == name) - list.push(tags[i]); - } - - var elements = [], - highlighter = null, - registered = {}, - propertyName = 'innerHTML' - ; - - // for some reason IE doesn't find <pre/> by name, however it does see them just fine by tag name... - findTagsByName(elements, name, 'pre'); - findTagsByName(elements, name, 'textarea'); - - if (elements.length === 0) - return; - - for (var i = 0; i < elements.length; i++) - { - var element = elements[i], - params = findValue( - element.attributes['class'], element.className, - element.attributes['language'], element.language - ), - language = '' - ; - - if (params === null) - continue; - - params = dp.SyntaxHighlighter.parseParams( - params, - showGutter, - showControls, - collapseAll, - firstLine, - showColumns - ); - - SyntaxHighlighter.highlight(params, element); - } - } -}; diff --git a/plugins/textviewer/syntaxhighlighter/styles/shCore.css b/plugins/textviewer/syntaxhighlighter/styles/shCore.css deleted file mode 100644 index 34f6864a155b18bcca36d86f39c3034cc6d49424..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/styles/shCore.css +++ /dev/null @@ -1,226 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -.syntaxhighlighter a, -.syntaxhighlighter div, -.syntaxhighlighter code, -.syntaxhighlighter table, -.syntaxhighlighter table td, -.syntaxhighlighter table tr, -.syntaxhighlighter table tbody, -.syntaxhighlighter table thead, -.syntaxhighlighter table caption, -.syntaxhighlighter textarea { - -moz-border-radius: 0 0 0 0 !important; - -webkit-border-radius: 0 0 0 0 !important; - background: none !important; - border: 0 !important; - bottom: auto !important; - float: none !important; - height: auto !important; - left: auto !important; - line-height: 1.1em !important; - margin: 0 !important; - outline: 0 !important; - overflow: visible !important; - padding: 0 !important; - position: static !important; - right: auto !important; - text-align: left !important; - top: auto !important; - vertical-align: baseline !important; - width: auto !important; - box-sizing: content-box !important; - font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; - font-weight: normal !important; - font-style: normal !important; - font-size: 1em !important; - min-height: inherit !important; - min-height: auto !important; -} - -.syntaxhighlighter { - width: 100% !important; - margin: 1em 0 1em 0 !important; - position: relative !important; - overflow: auto !important; - font-size: 1em !important; -} -.syntaxhighlighter.source { - overflow: hidden !important; -} -.syntaxhighlighter .bold { - font-weight: bold !important; -} -.syntaxhighlighter .italic { - font-style: italic !important; -} -.syntaxhighlighter .line { - white-space: pre !important; -} -.syntaxhighlighter table { - width: 100% !important; -} -.syntaxhighlighter table caption { - text-align: left !important; - padding: .5em 0 0.5em 1em !important; -} -.syntaxhighlighter table td.code { - width: 100% !important; -} -.syntaxhighlighter table td.code .container { - position: relative !important; -} -.syntaxhighlighter table td.code .container textarea { - box-sizing: border-box !important; - position: absolute !important; - left: 0 !important; - top: 0 !important; - width: 100% !important; - height: 100% !important; - border: none !important; - background: white !important; - padding-left: 1em !important; - overflow: hidden !important; - white-space: pre !important; -} -.syntaxhighlighter table td.gutter .line { - text-align: right !important; - padding: 0 0.5em 0 1em !important; -} -.syntaxhighlighter table td.code .line { - padding: 0 1em !important; -} -.syntaxhighlighter.nogutter td.code .container textarea, .syntaxhighlighter.nogutter td.code .line { - padding-left: 0em !important; -} -.syntaxhighlighter.show { - display: block !important; -} -.syntaxhighlighter.collapsed table { - display: none !important; -} -.syntaxhighlighter.collapsed .toolbar { - padding: 0.1em 0.8em 0em 0.8em !important; - font-size: 1em !important; - position: static !important; - width: auto !important; - height: auto !important; -} -.syntaxhighlighter.collapsed .toolbar span { - display: inline !important; - margin-right: 1em !important; -} -.syntaxhighlighter.collapsed .toolbar span a { - padding: 0 !important; - display: none !important; -} -.syntaxhighlighter.collapsed .toolbar span a.expandSource { - display: inline !important; -} -.syntaxhighlighter .toolbar { - position: absolute !important; - right: 1px !important; - top: 1px !important; - width: 11px !important; - height: 11px !important; - font-size: 10px !important; - z-index: 10 !important; -} -.syntaxhighlighter .toolbar span.title { - display: inline !important; -} -.syntaxhighlighter .toolbar a { - display: block !important; - text-align: center !important; - text-decoration: none !important; - padding-top: 1px !important; -} -.syntaxhighlighter .toolbar a.expandSource { - display: none !important; -} -.syntaxhighlighter.ie { - font-size: .9em !important; - padding: 1px 0 1px 0 !important; -} -.syntaxhighlighter.ie .toolbar { - line-height: 8px !important; -} -.syntaxhighlighter.ie .toolbar a { - padding-top: 0px !important; -} -.syntaxhighlighter.printing .line.alt1 .content, -.syntaxhighlighter.printing .line.alt2 .content, -.syntaxhighlighter.printing .line.highlighted .number, -.syntaxhighlighter.printing .line.highlighted.alt1 .content, -.syntaxhighlighter.printing .line.highlighted.alt2 .content { - background: none !important; -} -.syntaxhighlighter.printing .line .number { - color: #bbbbbb !important; -} -.syntaxhighlighter.printing .line .content { - color: black !important; -} -.syntaxhighlighter.printing .toolbar { - display: none !important; -} -.syntaxhighlighter.printing a { - text-decoration: none !important; -} -.syntaxhighlighter.printing .plain, .syntaxhighlighter.printing .plain a { - color: black !important; -} -.syntaxhighlighter.printing .comments, .syntaxhighlighter.printing .comments a { - color: #008200 !important; -} -.syntaxhighlighter.printing .string, .syntaxhighlighter.printing .string a { - color: blue !important; -} -.syntaxhighlighter.printing .keyword { - color: #006699 !important; - font-weight: bold !important; -} -.syntaxhighlighter.printing .preprocessor { - color: gray !important; -} -.syntaxhighlighter.printing .variable { - color: #aa7700 !important; -} -.syntaxhighlighter.printing .value { - color: #009900 !important; -} -.syntaxhighlighter.printing .functions { - color: #ff1493 !important; -} -.syntaxhighlighter.printing .constants { - color: #0066cc !important; -} -.syntaxhighlighter.printing .script { - font-weight: bold !important; -} -.syntaxhighlighter.printing .color1, .syntaxhighlighter.printing .color1 a { - color: gray !important; -} -.syntaxhighlighter.printing .color2, .syntaxhighlighter.printing .color2 a { - color: #ff1493 !important; -} -.syntaxhighlighter.printing .color3, .syntaxhighlighter.printing .color3 a { - color: red !important; -} -.syntaxhighlighter.printing .break, .syntaxhighlighter.printing .break a { - color: black !important; -} diff --git a/plugins/textviewer/syntaxhighlighter/styles/shCoreDefault.css b/plugins/textviewer/syntaxhighlighter/styles/shCoreDefault.css deleted file mode 100644 index 08f9e10e4ea57944826f5c22baedbd1dc1627771..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/styles/shCoreDefault.css +++ /dev/null @@ -1,328 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -.syntaxhighlighter a, -.syntaxhighlighter div, -.syntaxhighlighter code, -.syntaxhighlighter table, -.syntaxhighlighter table td, -.syntaxhighlighter table tr, -.syntaxhighlighter table tbody, -.syntaxhighlighter table thead, -.syntaxhighlighter table caption, -.syntaxhighlighter textarea { - -moz-border-radius: 0 0 0 0 !important; - -webkit-border-radius: 0 0 0 0 !important; - background: none !important; - border: 0 !important; - bottom: auto !important; - float: none !important; - height: auto !important; - left: auto !important; - line-height: 1.1em !important; - margin: 0 !important; - outline: 0 !important; - overflow: visible !important; - padding: 0 !important; - position: static !important; - right: auto !important; - text-align: left !important; - top: auto !important; - vertical-align: baseline !important; - width: auto !important; - box-sizing: content-box !important; - font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; - font-weight: normal !important; - font-style: normal !important; - font-size: 1em !important; - min-height: inherit !important; - min-height: auto !important; -} - -.syntaxhighlighter { - width: 100% !important; - margin: 1em 0 1em 0 !important; - position: relative !important; - overflow: auto !important; - font-size: 1em !important; -} -.syntaxhighlighter.source { - overflow: hidden !important; -} -.syntaxhighlighter .bold { - font-weight: bold !important; -} -.syntaxhighlighter .italic { - font-style: italic !important; -} -.syntaxhighlighter .line { - white-space: pre !important; -} -.syntaxhighlighter table { - width: 100% !important; -} -.syntaxhighlighter table caption { - text-align: left !important; - padding: .5em 0 0.5em 1em !important; -} -.syntaxhighlighter table td.code { - width: 100% !important; -} -.syntaxhighlighter table td.code .container { - position: relative !important; -} -.syntaxhighlighter table td.code .container textarea { - box-sizing: border-box !important; - position: absolute !important; - left: 0 !important; - top: 0 !important; - width: 100% !important; - height: 100% !important; - border: none !important; - background: white !important; - padding-left: 1em !important; - overflow: hidden !important; - white-space: pre !important; -} -.syntaxhighlighter table td.gutter .line { - text-align: right !important; - padding: 0 0.5em 0 1em !important; -} -.syntaxhighlighter table td.code .line { - padding: 0 1em !important; -} -.syntaxhighlighter.nogutter td.code .container textarea, .syntaxhighlighter.nogutter td.code .line { - padding-left: 0em !important; -} -.syntaxhighlighter.show { - display: block !important; -} -.syntaxhighlighter.collapsed table { - display: none !important; -} -.syntaxhighlighter.collapsed .toolbar { - padding: 0.1em 0.8em 0em 0.8em !important; - font-size: 1em !important; - position: static !important; - width: auto !important; - height: auto !important; -} -.syntaxhighlighter.collapsed .toolbar span { - display: inline !important; - margin-right: 1em !important; -} -.syntaxhighlighter.collapsed .toolbar span a { - padding: 0 !important; - display: none !important; -} -.syntaxhighlighter.collapsed .toolbar span a.expandSource { - display: inline !important; -} -.syntaxhighlighter .toolbar { - position: absolute !important; - right: 1px !important; - top: 1px !important; - width: 11px !important; - height: 11px !important; - font-size: 10px !important; - z-index: 10 !important; -} -.syntaxhighlighter .toolbar span.title { - display: inline !important; -} -.syntaxhighlighter .toolbar a { - display: block !important; - text-align: center !important; - text-decoration: none !important; - padding-top: 1px !important; -} -.syntaxhighlighter .toolbar a.expandSource { - display: none !important; -} -.syntaxhighlighter.ie { - font-size: .9em !important; - padding: 1px 0 1px 0 !important; -} -.syntaxhighlighter.ie .toolbar { - line-height: 8px !important; -} -.syntaxhighlighter.ie .toolbar a { - padding-top: 0px !important; -} -.syntaxhighlighter.printing .line.alt1 .content, -.syntaxhighlighter.printing .line.alt2 .content, -.syntaxhighlighter.printing .line.highlighted .number, -.syntaxhighlighter.printing .line.highlighted.alt1 .content, -.syntaxhighlighter.printing .line.highlighted.alt2 .content { - background: none !important; -} -.syntaxhighlighter.printing .line .number { - color: #bbbbbb !important; -} -.syntaxhighlighter.printing .line .content { - color: black !important; -} -.syntaxhighlighter.printing .toolbar { - display: none !important; -} -.syntaxhighlighter.printing a { - text-decoration: none !important; -} -.syntaxhighlighter.printing .plain, .syntaxhighlighter.printing .plain a { - color: black !important; -} -.syntaxhighlighter.printing .comments, .syntaxhighlighter.printing .comments a { - color: #008200 !important; -} -.syntaxhighlighter.printing .string, .syntaxhighlighter.printing .string a { - color: blue !important; -} -.syntaxhighlighter.printing .keyword { - color: #006699 !important; - font-weight: bold !important; -} -.syntaxhighlighter.printing .preprocessor { - color: gray !important; -} -.syntaxhighlighter.printing .variable { - color: #aa7700 !important; -} -.syntaxhighlighter.printing .value { - color: #009900 !important; -} -.syntaxhighlighter.printing .functions { - color: #ff1493 !important; -} -.syntaxhighlighter.printing .constants { - color: #0066cc !important; -} -.syntaxhighlighter.printing .script { - font-weight: bold !important; -} -.syntaxhighlighter.printing .color1, .syntaxhighlighter.printing .color1 a { - color: gray !important; -} -.syntaxhighlighter.printing .color2, .syntaxhighlighter.printing .color2 a { - color: #ff1493 !important; -} -.syntaxhighlighter.printing .color3, .syntaxhighlighter.printing .color3 a { - color: red !important; -} -.syntaxhighlighter.printing .break, .syntaxhighlighter.printing .break a { - color: black !important; -} - -.syntaxhighlighter { - background-color: white !important; -} -.syntaxhighlighter .line.alt1 { - background-color: white !important; -} -.syntaxhighlighter .line.alt2 { - background-color: white !important; -} -.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { - background-color: #e0e0e0 !important; -} -.syntaxhighlighter .line.highlighted.number { - color: black !important; -} -.syntaxhighlighter table caption { - color: black !important; -} -.syntaxhighlighter .gutter { - color: #afafaf !important; -} -.syntaxhighlighter .gutter .line { - border-right: 3px solid #6ce26c !important; -} -.syntaxhighlighter .gutter .line.highlighted { - background-color: #6ce26c !important; - color: white !important; -} -.syntaxhighlighter.printing .line .content { - border: none !important; -} -.syntaxhighlighter.collapsed { - overflow: visible !important; -} -.syntaxhighlighter.collapsed .toolbar { - color: blue !important; - background: white !important; - border: 1px solid #6ce26c !important; -} -.syntaxhighlighter.collapsed .toolbar a { - color: blue !important; -} -.syntaxhighlighter.collapsed .toolbar a:hover { - color: red !important; -} -.syntaxhighlighter .toolbar { - color: white !important; - background: #6ce26c !important; - border: none !important; -} -.syntaxhighlighter .toolbar a { - color: white !important; -} -.syntaxhighlighter .toolbar a:hover { - color: black !important; -} -.syntaxhighlighter .plain, .syntaxhighlighter .plain a { - color: black !important; -} -.syntaxhighlighter .comments, .syntaxhighlighter .comments a { - color: #008200 !important; -} -.syntaxhighlighter .string, .syntaxhighlighter .string a { - color: blue !important; -} -.syntaxhighlighter .keyword { - color: #006699 !important; -} -.syntaxhighlighter .preprocessor { - color: gray !important; -} -.syntaxhighlighter .variable { - color: #aa7700 !important; -} -.syntaxhighlighter .value { - color: #009900 !important; -} -.syntaxhighlighter .functions { - color: #ff1493 !important; -} -.syntaxhighlighter .constants { - color: #0066cc !important; -} -.syntaxhighlighter .script { - font-weight: bold !important; - color: #006699 !important; - background-color: none !important; -} -.syntaxhighlighter .color1, .syntaxhighlighter .color1 a { - color: gray !important; -} -.syntaxhighlighter .color2, .syntaxhighlighter .color2 a { - color: #ff1493 !important; -} -.syntaxhighlighter .color3, .syntaxhighlighter .color3 a { - color: red !important; -} - -.syntaxhighlighter .keyword { - font-weight: bold !important; -} diff --git a/plugins/textviewer/syntaxhighlighter/styles/shCoreDjango.css b/plugins/textviewer/syntaxhighlighter/styles/shCoreDjango.css deleted file mode 100644 index 1db1f70cb0d047242c62fc795a54dd61277544c2..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/styles/shCoreDjango.css +++ /dev/null @@ -1,331 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -.syntaxhighlighter a, -.syntaxhighlighter div, -.syntaxhighlighter code, -.syntaxhighlighter table, -.syntaxhighlighter table td, -.syntaxhighlighter table tr, -.syntaxhighlighter table tbody, -.syntaxhighlighter table thead, -.syntaxhighlighter table caption, -.syntaxhighlighter textarea { - -moz-border-radius: 0 0 0 0 !important; - -webkit-border-radius: 0 0 0 0 !important; - background: none !important; - border: 0 !important; - bottom: auto !important; - float: none !important; - height: auto !important; - left: auto !important; - line-height: 1.1em !important; - margin: 0 !important; - outline: 0 !important; - overflow: visible !important; - padding: 0 !important; - position: static !important; - right: auto !important; - text-align: left !important; - top: auto !important; - vertical-align: baseline !important; - width: auto !important; - box-sizing: content-box !important; - font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; - font-weight: normal !important; - font-style: normal !important; - font-size: 1em !important; - min-height: inherit !important; - min-height: auto !important; -} - -.syntaxhighlighter { - width: 100% !important; - margin: 1em 0 1em 0 !important; - position: relative !important; - overflow: auto !important; - font-size: 1em !important; -} -.syntaxhighlighter.source { - overflow: hidden !important; -} -.syntaxhighlighter .bold { - font-weight: bold !important; -} -.syntaxhighlighter .italic { - font-style: italic !important; -} -.syntaxhighlighter .line { - white-space: pre !important; -} -.syntaxhighlighter table { - width: 100% !important; -} -.syntaxhighlighter table caption { - text-align: left !important; - padding: .5em 0 0.5em 1em !important; -} -.syntaxhighlighter table td.code { - width: 100% !important; -} -.syntaxhighlighter table td.code .container { - position: relative !important; -} -.syntaxhighlighter table td.code .container textarea { - box-sizing: border-box !important; - position: absolute !important; - left: 0 !important; - top: 0 !important; - width: 100% !important; - height: 100% !important; - border: none !important; - background: white !important; - padding-left: 1em !important; - overflow: hidden !important; - white-space: pre !important; -} -.syntaxhighlighter table td.gutter .line { - text-align: right !important; - padding: 0 0.5em 0 1em !important; -} -.syntaxhighlighter table td.code .line { - padding: 0 1em !important; -} -.syntaxhighlighter.nogutter td.code .container textarea, .syntaxhighlighter.nogutter td.code .line { - padding-left: 0em !important; -} -.syntaxhighlighter.show { - display: block !important; -} -.syntaxhighlighter.collapsed table { - display: none !important; -} -.syntaxhighlighter.collapsed .toolbar { - padding: 0.1em 0.8em 0em 0.8em !important; - font-size: 1em !important; - position: static !important; - width: auto !important; - height: auto !important; -} -.syntaxhighlighter.collapsed .toolbar span { - display: inline !important; - margin-right: 1em !important; -} -.syntaxhighlighter.collapsed .toolbar span a { - padding: 0 !important; - display: none !important; -} -.syntaxhighlighter.collapsed .toolbar span a.expandSource { - display: inline !important; -} -.syntaxhighlighter .toolbar { - position: absolute !important; - right: 1px !important; - top: 1px !important; - width: 11px !important; - height: 11px !important; - font-size: 10px !important; - z-index: 10 !important; -} -.syntaxhighlighter .toolbar span.title { - display: inline !important; -} -.syntaxhighlighter .toolbar a { - display: block !important; - text-align: center !important; - text-decoration: none !important; - padding-top: 1px !important; -} -.syntaxhighlighter .toolbar a.expandSource { - display: none !important; -} -.syntaxhighlighter.ie { - font-size: .9em !important; - padding: 1px 0 1px 0 !important; -} -.syntaxhighlighter.ie .toolbar { - line-height: 8px !important; -} -.syntaxhighlighter.ie .toolbar a { - padding-top: 0px !important; -} -.syntaxhighlighter.printing .line.alt1 .content, -.syntaxhighlighter.printing .line.alt2 .content, -.syntaxhighlighter.printing .line.highlighted .number, -.syntaxhighlighter.printing .line.highlighted.alt1 .content, -.syntaxhighlighter.printing .line.highlighted.alt2 .content { - background: none !important; -} -.syntaxhighlighter.printing .line .number { - color: #bbbbbb !important; -} -.syntaxhighlighter.printing .line .content { - color: black !important; -} -.syntaxhighlighter.printing .toolbar { - display: none !important; -} -.syntaxhighlighter.printing a { - text-decoration: none !important; -} -.syntaxhighlighter.printing .plain, .syntaxhighlighter.printing .plain a { - color: black !important; -} -.syntaxhighlighter.printing .comments, .syntaxhighlighter.printing .comments a { - color: #008200 !important; -} -.syntaxhighlighter.printing .string, .syntaxhighlighter.printing .string a { - color: blue !important; -} -.syntaxhighlighter.printing .keyword { - color: #006699 !important; - font-weight: bold !important; -} -.syntaxhighlighter.printing .preprocessor { - color: gray !important; -} -.syntaxhighlighter.printing .variable { - color: #aa7700 !important; -} -.syntaxhighlighter.printing .value { - color: #009900 !important; -} -.syntaxhighlighter.printing .functions { - color: #ff1493 !important; -} -.syntaxhighlighter.printing .constants { - color: #0066cc !important; -} -.syntaxhighlighter.printing .script { - font-weight: bold !important; -} -.syntaxhighlighter.printing .color1, .syntaxhighlighter.printing .color1 a { - color: gray !important; -} -.syntaxhighlighter.printing .color2, .syntaxhighlighter.printing .color2 a { - color: #ff1493 !important; -} -.syntaxhighlighter.printing .color3, .syntaxhighlighter.printing .color3 a { - color: red !important; -} -.syntaxhighlighter.printing .break, .syntaxhighlighter.printing .break a { - color: black !important; -} - -.syntaxhighlighter { - background-color: #0a2b1d !important; -} -.syntaxhighlighter .line.alt1 { - background-color: #0a2b1d !important; -} -.syntaxhighlighter .line.alt2 { - background-color: #0a2b1d !important; -} -.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { - background-color: #233729 !important; -} -.syntaxhighlighter .line.highlighted.number { - color: white !important; -} -.syntaxhighlighter table caption { - color: #f8f8f8 !important; -} -.syntaxhighlighter .gutter { - color: #497958 !important; -} -.syntaxhighlighter .gutter .line { - border-right: 3px solid #41a83e !important; -} -.syntaxhighlighter .gutter .line.highlighted { - background-color: #41a83e !important; - color: #0a2b1d !important; -} -.syntaxhighlighter.printing .line .content { - border: none !important; -} -.syntaxhighlighter.collapsed { - overflow: visible !important; -} -.syntaxhighlighter.collapsed .toolbar { - color: #96dd3b !important; - background: black !important; - border: 1px solid #41a83e !important; -} -.syntaxhighlighter.collapsed .toolbar a { - color: #96dd3b !important; -} -.syntaxhighlighter.collapsed .toolbar a:hover { - color: white !important; -} -.syntaxhighlighter .toolbar { - color: white !important; - background: #41a83e !important; - border: none !important; -} -.syntaxhighlighter .toolbar a { - color: white !important; -} -.syntaxhighlighter .toolbar a:hover { - color: #ffe862 !important; -} -.syntaxhighlighter .plain, .syntaxhighlighter .plain a { - color: #f8f8f8 !important; -} -.syntaxhighlighter .comments, .syntaxhighlighter .comments a { - color: #336442 !important; -} -.syntaxhighlighter .string, .syntaxhighlighter .string a { - color: #9df39f !important; -} -.syntaxhighlighter .keyword { - color: #96dd3b !important; -} -.syntaxhighlighter .preprocessor { - color: #91bb9e !important; -} -.syntaxhighlighter .variable { - color: #ffaa3e !important; -} -.syntaxhighlighter .value { - color: #f7e741 !important; -} -.syntaxhighlighter .functions { - color: #ffaa3e !important; -} -.syntaxhighlighter .constants { - color: #e0e8ff !important; -} -.syntaxhighlighter .script { - font-weight: bold !important; - color: #96dd3b !important; - background-color: none !important; -} -.syntaxhighlighter .color1, .syntaxhighlighter .color1 a { - color: #eb939a !important; -} -.syntaxhighlighter .color2, .syntaxhighlighter .color2 a { - color: #91bb9e !important; -} -.syntaxhighlighter .color3, .syntaxhighlighter .color3 a { - color: #edef7d !important; -} - -.syntaxhighlighter .comments { - font-style: italic !important; -} -.syntaxhighlighter .keyword { - font-weight: bold !important; -} diff --git a/plugins/textviewer/syntaxhighlighter/styles/shCoreEclipse.css b/plugins/textviewer/syntaxhighlighter/styles/shCoreEclipse.css deleted file mode 100644 index a45de9fd8e34e6c73fe0b85043c9a068bdf88081..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/styles/shCoreEclipse.css +++ /dev/null @@ -1,339 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -.syntaxhighlighter a, -.syntaxhighlighter div, -.syntaxhighlighter code, -.syntaxhighlighter table, -.syntaxhighlighter table td, -.syntaxhighlighter table tr, -.syntaxhighlighter table tbody, -.syntaxhighlighter table thead, -.syntaxhighlighter table caption, -.syntaxhighlighter textarea { - -moz-border-radius: 0 0 0 0 !important; - -webkit-border-radius: 0 0 0 0 !important; - background: none !important; - border: 0 !important; - bottom: auto !important; - float: none !important; - height: auto !important; - left: auto !important; - line-height: 1.1em !important; - margin: 0 !important; - outline: 0 !important; - overflow: visible !important; - padding: 0 !important; - position: static !important; - right: auto !important; - text-align: left !important; - top: auto !important; - vertical-align: baseline !important; - width: auto !important; - box-sizing: content-box !important; - font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; - font-weight: normal !important; - font-style: normal !important; - font-size: 1em !important; - min-height: inherit !important; - min-height: auto !important; -} - -.syntaxhighlighter { - width: 100% !important; - margin: 1em 0 1em 0 !important; - position: relative !important; - overflow: auto !important; - font-size: 1em !important; -} -.syntaxhighlighter.source { - overflow: hidden !important; -} -.syntaxhighlighter .bold { - font-weight: bold !important; -} -.syntaxhighlighter .italic { - font-style: italic !important; -} -.syntaxhighlighter .line { - white-space: pre !important; -} -.syntaxhighlighter table { - width: 100% !important; -} -.syntaxhighlighter table caption { - text-align: left !important; - padding: .5em 0 0.5em 1em !important; -} -.syntaxhighlighter table td.code { - width: 100% !important; -} -.syntaxhighlighter table td.code .container { - position: relative !important; -} -.syntaxhighlighter table td.code .container textarea { - box-sizing: border-box !important; - position: absolute !important; - left: 0 !important; - top: 0 !important; - width: 100% !important; - height: 100% !important; - border: none !important; - background: white !important; - padding-left: 1em !important; - overflow: hidden !important; - white-space: pre !important; -} -.syntaxhighlighter table td.gutter .line { - text-align: right !important; - padding: 0 0.5em 0 1em !important; -} -.syntaxhighlighter table td.code .line { - padding: 0 1em !important; -} -.syntaxhighlighter.nogutter td.code .container textarea, .syntaxhighlighter.nogutter td.code .line { - padding-left: 0em !important; -} -.syntaxhighlighter.show { - display: block !important; -} -.syntaxhighlighter.collapsed table { - display: none !important; -} -.syntaxhighlighter.collapsed .toolbar { - padding: 0.1em 0.8em 0em 0.8em !important; - font-size: 1em !important; - position: static !important; - width: auto !important; - height: auto !important; -} -.syntaxhighlighter.collapsed .toolbar span { - display: inline !important; - margin-right: 1em !important; -} -.syntaxhighlighter.collapsed .toolbar span a { - padding: 0 !important; - display: none !important; -} -.syntaxhighlighter.collapsed .toolbar span a.expandSource { - display: inline !important; -} -.syntaxhighlighter .toolbar { - position: absolute !important; - right: 1px !important; - top: 1px !important; - width: 11px !important; - height: 11px !important; - font-size: 10px !important; - z-index: 10 !important; -} -.syntaxhighlighter .toolbar span.title { - display: inline !important; -} -.syntaxhighlighter .toolbar a { - display: block !important; - text-align: center !important; - text-decoration: none !important; - padding-top: 1px !important; -} -.syntaxhighlighter .toolbar a.expandSource { - display: none !important; -} -.syntaxhighlighter.ie { - font-size: .9em !important; - padding: 1px 0 1px 0 !important; -} -.syntaxhighlighter.ie .toolbar { - line-height: 8px !important; -} -.syntaxhighlighter.ie .toolbar a { - padding-top: 0px !important; -} -.syntaxhighlighter.printing .line.alt1 .content, -.syntaxhighlighter.printing .line.alt2 .content, -.syntaxhighlighter.printing .line.highlighted .number, -.syntaxhighlighter.printing .line.highlighted.alt1 .content, -.syntaxhighlighter.printing .line.highlighted.alt2 .content { - background: none !important; -} -.syntaxhighlighter.printing .line .number { - color: #bbbbbb !important; -} -.syntaxhighlighter.printing .line .content { - color: black !important; -} -.syntaxhighlighter.printing .toolbar { - display: none !important; -} -.syntaxhighlighter.printing a { - text-decoration: none !important; -} -.syntaxhighlighter.printing .plain, .syntaxhighlighter.printing .plain a { - color: black !important; -} -.syntaxhighlighter.printing .comments, .syntaxhighlighter.printing .comments a { - color: #008200 !important; -} -.syntaxhighlighter.printing .string, .syntaxhighlighter.printing .string a { - color: blue !important; -} -.syntaxhighlighter.printing .keyword { - color: #006699 !important; - font-weight: bold !important; -} -.syntaxhighlighter.printing .preprocessor { - color: gray !important; -} -.syntaxhighlighter.printing .variable { - color: #aa7700 !important; -} -.syntaxhighlighter.printing .value { - color: #009900 !important; -} -.syntaxhighlighter.printing .functions { - color: #ff1493 !important; -} -.syntaxhighlighter.printing .constants { - color: #0066cc !important; -} -.syntaxhighlighter.printing .script { - font-weight: bold !important; -} -.syntaxhighlighter.printing .color1, .syntaxhighlighter.printing .color1 a { - color: gray !important; -} -.syntaxhighlighter.printing .color2, .syntaxhighlighter.printing .color2 a { - color: #ff1493 !important; -} -.syntaxhighlighter.printing .color3, .syntaxhighlighter.printing .color3 a { - color: red !important; -} -.syntaxhighlighter.printing .break, .syntaxhighlighter.printing .break a { - color: black !important; -} - -.syntaxhighlighter { - background-color: white !important; -} -.syntaxhighlighter .line.alt1 { - background-color: white !important; -} -.syntaxhighlighter .line.alt2 { - background-color: white !important; -} -.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { - background-color: #c3defe !important; -} -.syntaxhighlighter .line.highlighted.number { - color: white !important; -} -.syntaxhighlighter table caption { - color: black !important; -} -.syntaxhighlighter .gutter { - color: #787878 !important; -} -.syntaxhighlighter .gutter .line { - border-right: 3px solid #d4d0c8 !important; -} -.syntaxhighlighter .gutter .line.highlighted { - background-color: #d4d0c8 !important; - color: white !important; -} -.syntaxhighlighter.printing .line .content { - border: none !important; -} -.syntaxhighlighter.collapsed { - overflow: visible !important; -} -.syntaxhighlighter.collapsed .toolbar { - color: #3f5fbf !important; - background: white !important; - border: 1px solid #d4d0c8 !important; -} -.syntaxhighlighter.collapsed .toolbar a { - color: #3f5fbf !important; -} -.syntaxhighlighter.collapsed .toolbar a:hover { - color: #aa7700 !important; -} -.syntaxhighlighter .toolbar { - color: #a0a0a0 !important; - background: #d4d0c8 !important; - border: none !important; -} -.syntaxhighlighter .toolbar a { - color: #a0a0a0 !important; -} -.syntaxhighlighter .toolbar a:hover { - color: red !important; -} -.syntaxhighlighter .plain, .syntaxhighlighter .plain a { - color: black !important; -} -.syntaxhighlighter .comments, .syntaxhighlighter .comments a { - color: #3f5fbf !important; -} -.syntaxhighlighter .string, .syntaxhighlighter .string a { - color: #2a00ff !important; -} -.syntaxhighlighter .keyword { - color: #7f0055 !important; -} -.syntaxhighlighter .preprocessor { - color: #646464 !important; -} -.syntaxhighlighter .variable { - color: #aa7700 !important; -} -.syntaxhighlighter .value { - color: #009900 !important; -} -.syntaxhighlighter .functions { - color: #ff1493 !important; -} -.syntaxhighlighter .constants { - color: #0066cc !important; -} -.syntaxhighlighter .script { - font-weight: bold !important; - color: #7f0055 !important; - background-color: none !important; -} -.syntaxhighlighter .color1, .syntaxhighlighter .color1 a { - color: gray !important; -} -.syntaxhighlighter .color2, .syntaxhighlighter .color2 a { - color: #ff1493 !important; -} -.syntaxhighlighter .color3, .syntaxhighlighter .color3 a { - color: red !important; -} - -.syntaxhighlighter .keyword { - font-weight: bold !important; -} -.syntaxhighlighter .xml .keyword { - color: #3f7f7f !important; - font-weight: normal !important; -} -.syntaxhighlighter .xml .color1, .syntaxhighlighter .xml .color1 a { - color: #7f007f !important; -} -.syntaxhighlighter .xml .string { - font-style: italic !important; - color: #2a00ff !important; -} diff --git a/plugins/textviewer/syntaxhighlighter/styles/shCoreEmacs.css b/plugins/textviewer/syntaxhighlighter/styles/shCoreEmacs.css deleted file mode 100644 index 706c77a0a8562a24a8975e68d0af50dba06fbc51..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/styles/shCoreEmacs.css +++ /dev/null @@ -1,324 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -.syntaxhighlighter a, -.syntaxhighlighter div, -.syntaxhighlighter code, -.syntaxhighlighter table, -.syntaxhighlighter table td, -.syntaxhighlighter table tr, -.syntaxhighlighter table tbody, -.syntaxhighlighter table thead, -.syntaxhighlighter table caption, -.syntaxhighlighter textarea { - -moz-border-radius: 0 0 0 0 !important; - -webkit-border-radius: 0 0 0 0 !important; - background: none !important; - border: 0 !important; - bottom: auto !important; - float: none !important; - height: auto !important; - left: auto !important; - line-height: 1.1em !important; - margin: 0 !important; - outline: 0 !important; - overflow: visible !important; - padding: 0 !important; - position: static !important; - right: auto !important; - text-align: left !important; - top: auto !important; - vertical-align: baseline !important; - width: auto !important; - box-sizing: content-box !important; - font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; - font-weight: normal !important; - font-style: normal !important; - font-size: 1em !important; - min-height: inherit !important; - min-height: auto !important; -} - -.syntaxhighlighter { - width: 100% !important; - margin: 1em 0 1em 0 !important; - position: relative !important; - overflow: auto !important; - font-size: 1em !important; -} -.syntaxhighlighter.source { - overflow: hidden !important; -} -.syntaxhighlighter .bold { - font-weight: bold !important; -} -.syntaxhighlighter .italic { - font-style: italic !important; -} -.syntaxhighlighter .line { - white-space: pre !important; -} -.syntaxhighlighter table { - width: 100% !important; -} -.syntaxhighlighter table caption { - text-align: left !important; - padding: .5em 0 0.5em 1em !important; -} -.syntaxhighlighter table td.code { - width: 100% !important; -} -.syntaxhighlighter table td.code .container { - position: relative !important; -} -.syntaxhighlighter table td.code .container textarea { - box-sizing: border-box !important; - position: absolute !important; - left: 0 !important; - top: 0 !important; - width: 100% !important; - height: 100% !important; - border: none !important; - background: white !important; - padding-left: 1em !important; - overflow: hidden !important; - white-space: pre !important; -} -.syntaxhighlighter table td.gutter .line { - text-align: right !important; - padding: 0 0.5em 0 1em !important; -} -.syntaxhighlighter table td.code .line { - padding: 0 1em !important; -} -.syntaxhighlighter.nogutter td.code .container textarea, .syntaxhighlighter.nogutter td.code .line { - padding-left: 0em !important; -} -.syntaxhighlighter.show { - display: block !important; -} -.syntaxhighlighter.collapsed table { - display: none !important; -} -.syntaxhighlighter.collapsed .toolbar { - padding: 0.1em 0.8em 0em 0.8em !important; - font-size: 1em !important; - position: static !important; - width: auto !important; - height: auto !important; -} -.syntaxhighlighter.collapsed .toolbar span { - display: inline !important; - margin-right: 1em !important; -} -.syntaxhighlighter.collapsed .toolbar span a { - padding: 0 !important; - display: none !important; -} -.syntaxhighlighter.collapsed .toolbar span a.expandSource { - display: inline !important; -} -.syntaxhighlighter .toolbar { - position: absolute !important; - right: 1px !important; - top: 1px !important; - width: 11px !important; - height: 11px !important; - font-size: 10px !important; - z-index: 10 !important; -} -.syntaxhighlighter .toolbar span.title { - display: inline !important; -} -.syntaxhighlighter .toolbar a { - display: block !important; - text-align: center !important; - text-decoration: none !important; - padding-top: 1px !important; -} -.syntaxhighlighter .toolbar a.expandSource { - display: none !important; -} -.syntaxhighlighter.ie { - font-size: .9em !important; - padding: 1px 0 1px 0 !important; -} -.syntaxhighlighter.ie .toolbar { - line-height: 8px !important; -} -.syntaxhighlighter.ie .toolbar a { - padding-top: 0px !important; -} -.syntaxhighlighter.printing .line.alt1 .content, -.syntaxhighlighter.printing .line.alt2 .content, -.syntaxhighlighter.printing .line.highlighted .number, -.syntaxhighlighter.printing .line.highlighted.alt1 .content, -.syntaxhighlighter.printing .line.highlighted.alt2 .content { - background: none !important; -} -.syntaxhighlighter.printing .line .number { - color: #bbbbbb !important; -} -.syntaxhighlighter.printing .line .content { - color: black !important; -} -.syntaxhighlighter.printing .toolbar { - display: none !important; -} -.syntaxhighlighter.printing a { - text-decoration: none !important; -} -.syntaxhighlighter.printing .plain, .syntaxhighlighter.printing .plain a { - color: black !important; -} -.syntaxhighlighter.printing .comments, .syntaxhighlighter.printing .comments a { - color: #008200 !important; -} -.syntaxhighlighter.printing .string, .syntaxhighlighter.printing .string a { - color: blue !important; -} -.syntaxhighlighter.printing .keyword { - color: #006699 !important; - font-weight: bold !important; -} -.syntaxhighlighter.printing .preprocessor { - color: gray !important; -} -.syntaxhighlighter.printing .variable { - color: #aa7700 !important; -} -.syntaxhighlighter.printing .value { - color: #009900 !important; -} -.syntaxhighlighter.printing .functions { - color: #ff1493 !important; -} -.syntaxhighlighter.printing .constants { - color: #0066cc !important; -} -.syntaxhighlighter.printing .script { - font-weight: bold !important; -} -.syntaxhighlighter.printing .color1, .syntaxhighlighter.printing .color1 a { - color: gray !important; -} -.syntaxhighlighter.printing .color2, .syntaxhighlighter.printing .color2 a { - color: #ff1493 !important; -} -.syntaxhighlighter.printing .color3, .syntaxhighlighter.printing .color3 a { - color: red !important; -} -.syntaxhighlighter.printing .break, .syntaxhighlighter.printing .break a { - color: black !important; -} - -.syntaxhighlighter { - background-color: black !important; -} -.syntaxhighlighter .line.alt1 { - background-color: black !important; -} -.syntaxhighlighter .line.alt2 { - background-color: black !important; -} -.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { - background-color: #2a3133 !important; -} -.syntaxhighlighter .line.highlighted.number { - color: white !important; -} -.syntaxhighlighter table caption { - color: #d3d3d3 !important; -} -.syntaxhighlighter .gutter { - color: #d3d3d3 !important; -} -.syntaxhighlighter .gutter .line { - border-right: 3px solid #990000 !important; -} -.syntaxhighlighter .gutter .line.highlighted { - background-color: #990000 !important; - color: black !important; -} -.syntaxhighlighter.printing .line .content { - border: none !important; -} -.syntaxhighlighter.collapsed { - overflow: visible !important; -} -.syntaxhighlighter.collapsed .toolbar { - color: #ebdb8d !important; - background: black !important; - border: 1px solid #990000 !important; -} -.syntaxhighlighter.collapsed .toolbar a { - color: #ebdb8d !important; -} -.syntaxhighlighter.collapsed .toolbar a:hover { - color: #ff7d27 !important; -} -.syntaxhighlighter .toolbar { - color: white !important; - background: #990000 !important; - border: none !important; -} -.syntaxhighlighter .toolbar a { - color: white !important; -} -.syntaxhighlighter .toolbar a:hover { - color: #9ccff4 !important; -} -.syntaxhighlighter .plain, .syntaxhighlighter .plain a { - color: #d3d3d3 !important; -} -.syntaxhighlighter .comments, .syntaxhighlighter .comments a { - color: #ff7d27 !important; -} -.syntaxhighlighter .string, .syntaxhighlighter .string a { - color: #ff9e7b !important; -} -.syntaxhighlighter .keyword { - color: aqua !important; -} -.syntaxhighlighter .preprocessor { - color: #aec4de !important; -} -.syntaxhighlighter .variable { - color: #ffaa3e !important; -} -.syntaxhighlighter .value { - color: #009900 !important; -} -.syntaxhighlighter .functions { - color: #81cef9 !important; -} -.syntaxhighlighter .constants { - color: #ff9e7b !important; -} -.syntaxhighlighter .script { - font-weight: bold !important; - color: aqua !important; - background-color: none !important; -} -.syntaxhighlighter .color1, .syntaxhighlighter .color1 a { - color: #ebdb8d !important; -} -.syntaxhighlighter .color2, .syntaxhighlighter .color2 a { - color: #ff7d27 !important; -} -.syntaxhighlighter .color3, .syntaxhighlighter .color3 a { - color: #aec4de !important; -} diff --git a/plugins/textviewer/syntaxhighlighter/styles/shCoreFadeToGrey.css b/plugins/textviewer/syntaxhighlighter/styles/shCoreFadeToGrey.css deleted file mode 100644 index 6101eba51f0bbe078a1d83e4b08066453778c8e6..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/styles/shCoreFadeToGrey.css +++ /dev/null @@ -1,328 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -.syntaxhighlighter a, -.syntaxhighlighter div, -.syntaxhighlighter code, -.syntaxhighlighter table, -.syntaxhighlighter table td, -.syntaxhighlighter table tr, -.syntaxhighlighter table tbody, -.syntaxhighlighter table thead, -.syntaxhighlighter table caption, -.syntaxhighlighter textarea { - -moz-border-radius: 0 0 0 0 !important; - -webkit-border-radius: 0 0 0 0 !important; - background: none !important; - border: 0 !important; - bottom: auto !important; - float: none !important; - height: auto !important; - left: auto !important; - line-height: 1.1em !important; - margin: 0 !important; - outline: 0 !important; - overflow: visible !important; - padding: 0 !important; - position: static !important; - right: auto !important; - text-align: left !important; - top: auto !important; - vertical-align: baseline !important; - width: auto !important; - box-sizing: content-box !important; - font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; - font-weight: normal !important; - font-style: normal !important; - font-size: 1em !important; - min-height: inherit !important; - min-height: auto !important; -} - -.syntaxhighlighter { - width: 100% !important; - margin: 1em 0 1em 0 !important; - position: relative !important; - overflow: auto !important; - font-size: 1em !important; -} -.syntaxhighlighter.source { - overflow: hidden !important; -} -.syntaxhighlighter .bold { - font-weight: bold !important; -} -.syntaxhighlighter .italic { - font-style: italic !important; -} -.syntaxhighlighter .line { - white-space: pre !important; -} -.syntaxhighlighter table { - width: 100% !important; -} -.syntaxhighlighter table caption { - text-align: left !important; - padding: .5em 0 0.5em 1em !important; -} -.syntaxhighlighter table td.code { - width: 100% !important; -} -.syntaxhighlighter table td.code .container { - position: relative !important; -} -.syntaxhighlighter table td.code .container textarea { - box-sizing: border-box !important; - position: absolute !important; - left: 0 !important; - top: 0 !important; - width: 100% !important; - height: 100% !important; - border: none !important; - background: white !important; - padding-left: 1em !important; - overflow: hidden !important; - white-space: pre !important; -} -.syntaxhighlighter table td.gutter .line { - text-align: right !important; - padding: 0 0.5em 0 1em !important; -} -.syntaxhighlighter table td.code .line { - padding: 0 1em !important; -} -.syntaxhighlighter.nogutter td.code .container textarea, .syntaxhighlighter.nogutter td.code .line { - padding-left: 0em !important; -} -.syntaxhighlighter.show { - display: block !important; -} -.syntaxhighlighter.collapsed table { - display: none !important; -} -.syntaxhighlighter.collapsed .toolbar { - padding: 0.1em 0.8em 0em 0.8em !important; - font-size: 1em !important; - position: static !important; - width: auto !important; - height: auto !important; -} -.syntaxhighlighter.collapsed .toolbar span { - display: inline !important; - margin-right: 1em !important; -} -.syntaxhighlighter.collapsed .toolbar span a { - padding: 0 !important; - display: none !important; -} -.syntaxhighlighter.collapsed .toolbar span a.expandSource { - display: inline !important; -} -.syntaxhighlighter .toolbar { - position: absolute !important; - right: 1px !important; - top: 1px !important; - width: 11px !important; - height: 11px !important; - font-size: 10px !important; - z-index: 10 !important; -} -.syntaxhighlighter .toolbar span.title { - display: inline !important; -} -.syntaxhighlighter .toolbar a { - display: block !important; - text-align: center !important; - text-decoration: none !important; - padding-top: 1px !important; -} -.syntaxhighlighter .toolbar a.expandSource { - display: none !important; -} -.syntaxhighlighter.ie { - font-size: .9em !important; - padding: 1px 0 1px 0 !important; -} -.syntaxhighlighter.ie .toolbar { - line-height: 8px !important; -} -.syntaxhighlighter.ie .toolbar a { - padding-top: 0px !important; -} -.syntaxhighlighter.printing .line.alt1 .content, -.syntaxhighlighter.printing .line.alt2 .content, -.syntaxhighlighter.printing .line.highlighted .number, -.syntaxhighlighter.printing .line.highlighted.alt1 .content, -.syntaxhighlighter.printing .line.highlighted.alt2 .content { - background: none !important; -} -.syntaxhighlighter.printing .line .number { - color: #bbbbbb !important; -} -.syntaxhighlighter.printing .line .content { - color: black !important; -} -.syntaxhighlighter.printing .toolbar { - display: none !important; -} -.syntaxhighlighter.printing a { - text-decoration: none !important; -} -.syntaxhighlighter.printing .plain, .syntaxhighlighter.printing .plain a { - color: black !important; -} -.syntaxhighlighter.printing .comments, .syntaxhighlighter.printing .comments a { - color: #008200 !important; -} -.syntaxhighlighter.printing .string, .syntaxhighlighter.printing .string a { - color: blue !important; -} -.syntaxhighlighter.printing .keyword { - color: #006699 !important; - font-weight: bold !important; -} -.syntaxhighlighter.printing .preprocessor { - color: gray !important; -} -.syntaxhighlighter.printing .variable { - color: #aa7700 !important; -} -.syntaxhighlighter.printing .value { - color: #009900 !important; -} -.syntaxhighlighter.printing .functions { - color: #ff1493 !important; -} -.syntaxhighlighter.printing .constants { - color: #0066cc !important; -} -.syntaxhighlighter.printing .script { - font-weight: bold !important; -} -.syntaxhighlighter.printing .color1, .syntaxhighlighter.printing .color1 a { - color: gray !important; -} -.syntaxhighlighter.printing .color2, .syntaxhighlighter.printing .color2 a { - color: #ff1493 !important; -} -.syntaxhighlighter.printing .color3, .syntaxhighlighter.printing .color3 a { - color: red !important; -} -.syntaxhighlighter.printing .break, .syntaxhighlighter.printing .break a { - color: black !important; -} - -.syntaxhighlighter { - background-color: #121212 !important; -} -.syntaxhighlighter .line.alt1 { - background-color: #121212 !important; -} -.syntaxhighlighter .line.alt2 { - background-color: #121212 !important; -} -.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { - background-color: #2c2c29 !important; -} -.syntaxhighlighter .line.highlighted.number { - color: white !important; -} -.syntaxhighlighter table caption { - color: white !important; -} -.syntaxhighlighter .gutter { - color: #afafaf !important; -} -.syntaxhighlighter .gutter .line { - border-right: 3px solid #3185b9 !important; -} -.syntaxhighlighter .gutter .line.highlighted { - background-color: #3185b9 !important; - color: #121212 !important; -} -.syntaxhighlighter.printing .line .content { - border: none !important; -} -.syntaxhighlighter.collapsed { - overflow: visible !important; -} -.syntaxhighlighter.collapsed .toolbar { - color: #3185b9 !important; - background: black !important; - border: 1px solid #3185b9 !important; -} -.syntaxhighlighter.collapsed .toolbar a { - color: #3185b9 !important; -} -.syntaxhighlighter.collapsed .toolbar a:hover { - color: #d01d33 !important; -} -.syntaxhighlighter .toolbar { - color: white !important; - background: #3185b9 !important; - border: none !important; -} -.syntaxhighlighter .toolbar a { - color: white !important; -} -.syntaxhighlighter .toolbar a:hover { - color: #96daff !important; -} -.syntaxhighlighter .plain, .syntaxhighlighter .plain a { - color: white !important; -} -.syntaxhighlighter .comments, .syntaxhighlighter .comments a { - color: #696854 !important; -} -.syntaxhighlighter .string, .syntaxhighlighter .string a { - color: #e3e658 !important; -} -.syntaxhighlighter .keyword { - color: #d01d33 !important; -} -.syntaxhighlighter .preprocessor { - color: #435a5f !important; -} -.syntaxhighlighter .variable { - color: #898989 !important; -} -.syntaxhighlighter .value { - color: #009900 !important; -} -.syntaxhighlighter .functions { - color: #aaaaaa !important; -} -.syntaxhighlighter .constants { - color: #96daff !important; -} -.syntaxhighlighter .script { - font-weight: bold !important; - color: #d01d33 !important; - background-color: none !important; -} -.syntaxhighlighter .color1, .syntaxhighlighter .color1 a { - color: #ffc074 !important; -} -.syntaxhighlighter .color2, .syntaxhighlighter .color2 a { - color: #4a8cdb !important; -} -.syntaxhighlighter .color3, .syntaxhighlighter .color3 a { - color: #96daff !important; -} - -.syntaxhighlighter .functions { - font-weight: bold !important; -} diff --git a/plugins/textviewer/syntaxhighlighter/styles/shCoreMDUltra.css b/plugins/textviewer/syntaxhighlighter/styles/shCoreMDUltra.css deleted file mode 100644 index 2923ce7367b54cb7124ae253e4d58a0fd141b96d..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/styles/shCoreMDUltra.css +++ /dev/null @@ -1,324 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -.syntaxhighlighter a, -.syntaxhighlighter div, -.syntaxhighlighter code, -.syntaxhighlighter table, -.syntaxhighlighter table td, -.syntaxhighlighter table tr, -.syntaxhighlighter table tbody, -.syntaxhighlighter table thead, -.syntaxhighlighter table caption, -.syntaxhighlighter textarea { - -moz-border-radius: 0 0 0 0 !important; - -webkit-border-radius: 0 0 0 0 !important; - background: none !important; - border: 0 !important; - bottom: auto !important; - float: none !important; - height: auto !important; - left: auto !important; - line-height: 1.1em !important; - margin: 0 !important; - outline: 0 !important; - overflow: visible !important; - padding: 0 !important; - position: static !important; - right: auto !important; - text-align: left !important; - top: auto !important; - vertical-align: baseline !important; - width: auto !important; - box-sizing: content-box !important; - font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; - font-weight: normal !important; - font-style: normal !important; - font-size: 1em !important; - min-height: inherit !important; - min-height: auto !important; -} - -.syntaxhighlighter { - width: 100% !important; - margin: 1em 0 1em 0 !important; - position: relative !important; - overflow: auto !important; - font-size: 1em !important; -} -.syntaxhighlighter.source { - overflow: hidden !important; -} -.syntaxhighlighter .bold { - font-weight: bold !important; -} -.syntaxhighlighter .italic { - font-style: italic !important; -} -.syntaxhighlighter .line { - white-space: pre !important; -} -.syntaxhighlighter table { - width: 100% !important; -} -.syntaxhighlighter table caption { - text-align: left !important; - padding: .5em 0 0.5em 1em !important; -} -.syntaxhighlighter table td.code { - width: 100% !important; -} -.syntaxhighlighter table td.code .container { - position: relative !important; -} -.syntaxhighlighter table td.code .container textarea { - box-sizing: border-box !important; - position: absolute !important; - left: 0 !important; - top: 0 !important; - width: 100% !important; - height: 100% !important; - border: none !important; - background: white !important; - padding-left: 1em !important; - overflow: hidden !important; - white-space: pre !important; -} -.syntaxhighlighter table td.gutter .line { - text-align: right !important; - padding: 0 0.5em 0 1em !important; -} -.syntaxhighlighter table td.code .line { - padding: 0 1em !important; -} -.syntaxhighlighter.nogutter td.code .container textarea, .syntaxhighlighter.nogutter td.code .line { - padding-left: 0em !important; -} -.syntaxhighlighter.show { - display: block !important; -} -.syntaxhighlighter.collapsed table { - display: none !important; -} -.syntaxhighlighter.collapsed .toolbar { - padding: 0.1em 0.8em 0em 0.8em !important; - font-size: 1em !important; - position: static !important; - width: auto !important; - height: auto !important; -} -.syntaxhighlighter.collapsed .toolbar span { - display: inline !important; - margin-right: 1em !important; -} -.syntaxhighlighter.collapsed .toolbar span a { - padding: 0 !important; - display: none !important; -} -.syntaxhighlighter.collapsed .toolbar span a.expandSource { - display: inline !important; -} -.syntaxhighlighter .toolbar { - position: absolute !important; - right: 1px !important; - top: 1px !important; - width: 11px !important; - height: 11px !important; - font-size: 10px !important; - z-index: 10 !important; -} -.syntaxhighlighter .toolbar span.title { - display: inline !important; -} -.syntaxhighlighter .toolbar a { - display: block !important; - text-align: center !important; - text-decoration: none !important; - padding-top: 1px !important; -} -.syntaxhighlighter .toolbar a.expandSource { - display: none !important; -} -.syntaxhighlighter.ie { - font-size: .9em !important; - padding: 1px 0 1px 0 !important; -} -.syntaxhighlighter.ie .toolbar { - line-height: 8px !important; -} -.syntaxhighlighter.ie .toolbar a { - padding-top: 0px !important; -} -.syntaxhighlighter.printing .line.alt1 .content, -.syntaxhighlighter.printing .line.alt2 .content, -.syntaxhighlighter.printing .line.highlighted .number, -.syntaxhighlighter.printing .line.highlighted.alt1 .content, -.syntaxhighlighter.printing .line.highlighted.alt2 .content { - background: none !important; -} -.syntaxhighlighter.printing .line .number { - color: #bbbbbb !important; -} -.syntaxhighlighter.printing .line .content { - color: black !important; -} -.syntaxhighlighter.printing .toolbar { - display: none !important; -} -.syntaxhighlighter.printing a { - text-decoration: none !important; -} -.syntaxhighlighter.printing .plain, .syntaxhighlighter.printing .plain a { - color: black !important; -} -.syntaxhighlighter.printing .comments, .syntaxhighlighter.printing .comments a { - color: #008200 !important; -} -.syntaxhighlighter.printing .string, .syntaxhighlighter.printing .string a { - color: blue !important; -} -.syntaxhighlighter.printing .keyword { - color: #006699 !important; - font-weight: bold !important; -} -.syntaxhighlighter.printing .preprocessor { - color: gray !important; -} -.syntaxhighlighter.printing .variable { - color: #aa7700 !important; -} -.syntaxhighlighter.printing .value { - color: #009900 !important; -} -.syntaxhighlighter.printing .functions { - color: #ff1493 !important; -} -.syntaxhighlighter.printing .constants { - color: #0066cc !important; -} -.syntaxhighlighter.printing .script { - font-weight: bold !important; -} -.syntaxhighlighter.printing .color1, .syntaxhighlighter.printing .color1 a { - color: gray !important; -} -.syntaxhighlighter.printing .color2, .syntaxhighlighter.printing .color2 a { - color: #ff1493 !important; -} -.syntaxhighlighter.printing .color3, .syntaxhighlighter.printing .color3 a { - color: red !important; -} -.syntaxhighlighter.printing .break, .syntaxhighlighter.printing .break a { - color: black !important; -} - -.syntaxhighlighter { - background-color: #222222 !important; -} -.syntaxhighlighter .line.alt1 { - background-color: #222222 !important; -} -.syntaxhighlighter .line.alt2 { - background-color: #222222 !important; -} -.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { - background-color: #253e5a !important; -} -.syntaxhighlighter .line.highlighted.number { - color: white !important; -} -.syntaxhighlighter table caption { - color: lime !important; -} -.syntaxhighlighter .gutter { - color: #38566f !important; -} -.syntaxhighlighter .gutter .line { - border-right: 3px solid #435a5f !important; -} -.syntaxhighlighter .gutter .line.highlighted { - background-color: #435a5f !important; - color: #222222 !important; -} -.syntaxhighlighter.printing .line .content { - border: none !important; -} -.syntaxhighlighter.collapsed { - overflow: visible !important; -} -.syntaxhighlighter.collapsed .toolbar { - color: #428bdd !important; - background: black !important; - border: 1px solid #435a5f !important; -} -.syntaxhighlighter.collapsed .toolbar a { - color: #428bdd !important; -} -.syntaxhighlighter.collapsed .toolbar a:hover { - color: lime !important; -} -.syntaxhighlighter .toolbar { - color: #aaaaff !important; - background: #435a5f !important; - border: none !important; -} -.syntaxhighlighter .toolbar a { - color: #aaaaff !important; -} -.syntaxhighlighter .toolbar a:hover { - color: #9ccff4 !important; -} -.syntaxhighlighter .plain, .syntaxhighlighter .plain a { - color: lime !important; -} -.syntaxhighlighter .comments, .syntaxhighlighter .comments a { - color: #428bdd !important; -} -.syntaxhighlighter .string, .syntaxhighlighter .string a { - color: lime !important; -} -.syntaxhighlighter .keyword { - color: #aaaaff !important; -} -.syntaxhighlighter .preprocessor { - color: #8aa6c1 !important; -} -.syntaxhighlighter .variable { - color: aqua !important; -} -.syntaxhighlighter .value { - color: #f7e741 !important; -} -.syntaxhighlighter .functions { - color: #ff8000 !important; -} -.syntaxhighlighter .constants { - color: yellow !important; -} -.syntaxhighlighter .script { - font-weight: bold !important; - color: #aaaaff !important; - background-color: none !important; -} -.syntaxhighlighter .color1, .syntaxhighlighter .color1 a { - color: red !important; -} -.syntaxhighlighter .color2, .syntaxhighlighter .color2 a { - color: yellow !important; -} -.syntaxhighlighter .color3, .syntaxhighlighter .color3 a { - color: #ffaa3e !important; -} diff --git a/plugins/textviewer/syntaxhighlighter/styles/shCoreMidnight.css b/plugins/textviewer/syntaxhighlighter/styles/shCoreMidnight.css deleted file mode 100644 index e3733eed566d76ba97db8f15fdcb63f809a6fd30..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/styles/shCoreMidnight.css +++ /dev/null @@ -1,324 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -.syntaxhighlighter a, -.syntaxhighlighter div, -.syntaxhighlighter code, -.syntaxhighlighter table, -.syntaxhighlighter table td, -.syntaxhighlighter table tr, -.syntaxhighlighter table tbody, -.syntaxhighlighter table thead, -.syntaxhighlighter table caption, -.syntaxhighlighter textarea { - -moz-border-radius: 0 0 0 0 !important; - -webkit-border-radius: 0 0 0 0 !important; - background: none !important; - border: 0 !important; - bottom: auto !important; - float: none !important; - height: auto !important; - left: auto !important; - line-height: 1.1em !important; - margin: 0 !important; - outline: 0 !important; - overflow: visible !important; - padding: 0 !important; - position: static !important; - right: auto !important; - text-align: left !important; - top: auto !important; - vertical-align: baseline !important; - width: auto !important; - box-sizing: content-box !important; - font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; - font-weight: normal !important; - font-style: normal !important; - font-size: 1em !important; - min-height: inherit !important; - min-height: auto !important; -} - -.syntaxhighlighter { - width: 100% !important; - margin: 1em 0 1em 0 !important; - position: relative !important; - overflow: auto !important; - font-size: 1em !important; -} -.syntaxhighlighter.source { - overflow: hidden !important; -} -.syntaxhighlighter .bold { - font-weight: bold !important; -} -.syntaxhighlighter .italic { - font-style: italic !important; -} -.syntaxhighlighter .line { - white-space: pre !important; -} -.syntaxhighlighter table { - width: 100% !important; -} -.syntaxhighlighter table caption { - text-align: left !important; - padding: .5em 0 0.5em 1em !important; -} -.syntaxhighlighter table td.code { - width: 100% !important; -} -.syntaxhighlighter table td.code .container { - position: relative !important; -} -.syntaxhighlighter table td.code .container textarea { - box-sizing: border-box !important; - position: absolute !important; - left: 0 !important; - top: 0 !important; - width: 100% !important; - height: 100% !important; - border: none !important; - background: white !important; - padding-left: 1em !important; - overflow: hidden !important; - white-space: pre !important; -} -.syntaxhighlighter table td.gutter .line { - text-align: right !important; - padding: 0 0.5em 0 1em !important; -} -.syntaxhighlighter table td.code .line { - padding: 0 1em !important; -} -.syntaxhighlighter.nogutter td.code .container textarea, .syntaxhighlighter.nogutter td.code .line { - padding-left: 0em !important; -} -.syntaxhighlighter.show { - display: block !important; -} -.syntaxhighlighter.collapsed table { - display: none !important; -} -.syntaxhighlighter.collapsed .toolbar { - padding: 0.1em 0.8em 0em 0.8em !important; - font-size: 1em !important; - position: static !important; - width: auto !important; - height: auto !important; -} -.syntaxhighlighter.collapsed .toolbar span { - display: inline !important; - margin-right: 1em !important; -} -.syntaxhighlighter.collapsed .toolbar span a { - padding: 0 !important; - display: none !important; -} -.syntaxhighlighter.collapsed .toolbar span a.expandSource { - display: inline !important; -} -.syntaxhighlighter .toolbar { - position: absolute !important; - right: 1px !important; - top: 1px !important; - width: 11px !important; - height: 11px !important; - font-size: 10px !important; - z-index: 10 !important; -} -.syntaxhighlighter .toolbar span.title { - display: inline !important; -} -.syntaxhighlighter .toolbar a { - display: block !important; - text-align: center !important; - text-decoration: none !important; - padding-top: 1px !important; -} -.syntaxhighlighter .toolbar a.expandSource { - display: none !important; -} -.syntaxhighlighter.ie { - font-size: .9em !important; - padding: 1px 0 1px 0 !important; -} -.syntaxhighlighter.ie .toolbar { - line-height: 8px !important; -} -.syntaxhighlighter.ie .toolbar a { - padding-top: 0px !important; -} -.syntaxhighlighter.printing .line.alt1 .content, -.syntaxhighlighter.printing .line.alt2 .content, -.syntaxhighlighter.printing .line.highlighted .number, -.syntaxhighlighter.printing .line.highlighted.alt1 .content, -.syntaxhighlighter.printing .line.highlighted.alt2 .content { - background: none !important; -} -.syntaxhighlighter.printing .line .number { - color: #bbbbbb !important; -} -.syntaxhighlighter.printing .line .content { - color: black !important; -} -.syntaxhighlighter.printing .toolbar { - display: none !important; -} -.syntaxhighlighter.printing a { - text-decoration: none !important; -} -.syntaxhighlighter.printing .plain, .syntaxhighlighter.printing .plain a { - color: black !important; -} -.syntaxhighlighter.printing .comments, .syntaxhighlighter.printing .comments a { - color: #008200 !important; -} -.syntaxhighlighter.printing .string, .syntaxhighlighter.printing .string a { - color: blue !important; -} -.syntaxhighlighter.printing .keyword { - color: #006699 !important; - font-weight: bold !important; -} -.syntaxhighlighter.printing .preprocessor { - color: gray !important; -} -.syntaxhighlighter.printing .variable { - color: #aa7700 !important; -} -.syntaxhighlighter.printing .value { - color: #009900 !important; -} -.syntaxhighlighter.printing .functions { - color: #ff1493 !important; -} -.syntaxhighlighter.printing .constants { - color: #0066cc !important; -} -.syntaxhighlighter.printing .script { - font-weight: bold !important; -} -.syntaxhighlighter.printing .color1, .syntaxhighlighter.printing .color1 a { - color: gray !important; -} -.syntaxhighlighter.printing .color2, .syntaxhighlighter.printing .color2 a { - color: #ff1493 !important; -} -.syntaxhighlighter.printing .color3, .syntaxhighlighter.printing .color3 a { - color: red !important; -} -.syntaxhighlighter.printing .break, .syntaxhighlighter.printing .break a { - color: black !important; -} - -.syntaxhighlighter { - background-color: #0f192a !important; -} -.syntaxhighlighter .line.alt1 { - background-color: #0f192a !important; -} -.syntaxhighlighter .line.alt2 { - background-color: #0f192a !important; -} -.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { - background-color: #253e5a !important; -} -.syntaxhighlighter .line.highlighted.number { - color: #38566f !important; -} -.syntaxhighlighter table caption { - color: #d1edff !important; -} -.syntaxhighlighter .gutter { - color: #afafaf !important; -} -.syntaxhighlighter .gutter .line { - border-right: 3px solid #435a5f !important; -} -.syntaxhighlighter .gutter .line.highlighted { - background-color: #435a5f !important; - color: #0f192a !important; -} -.syntaxhighlighter.printing .line .content { - border: none !important; -} -.syntaxhighlighter.collapsed { - overflow: visible !important; -} -.syntaxhighlighter.collapsed .toolbar { - color: #428bdd !important; - background: black !important; - border: 1px solid #435a5f !important; -} -.syntaxhighlighter.collapsed .toolbar a { - color: #428bdd !important; -} -.syntaxhighlighter.collapsed .toolbar a:hover { - color: #1dc116 !important; -} -.syntaxhighlighter .toolbar { - color: #d1edff !important; - background: #435a5f !important; - border: none !important; -} -.syntaxhighlighter .toolbar a { - color: #d1edff !important; -} -.syntaxhighlighter .toolbar a:hover { - color: #8aa6c1 !important; -} -.syntaxhighlighter .plain, .syntaxhighlighter .plain a { - color: #d1edff !important; -} -.syntaxhighlighter .comments, .syntaxhighlighter .comments a { - color: #428bdd !important; -} -.syntaxhighlighter .string, .syntaxhighlighter .string a { - color: #1dc116 !important; -} -.syntaxhighlighter .keyword { - color: #b43d3d !important; -} -.syntaxhighlighter .preprocessor { - color: #8aa6c1 !important; -} -.syntaxhighlighter .variable { - color: #ffaa3e !important; -} -.syntaxhighlighter .value { - color: #f7e741 !important; -} -.syntaxhighlighter .functions { - color: #ffaa3e !important; -} -.syntaxhighlighter .constants { - color: #e0e8ff !important; -} -.syntaxhighlighter .script { - font-weight: bold !important; - color: #b43d3d !important; - background-color: none !important; -} -.syntaxhighlighter .color1, .syntaxhighlighter .color1 a { - color: #f8bb00 !important; -} -.syntaxhighlighter .color2, .syntaxhighlighter .color2 a { - color: white !important; -} -.syntaxhighlighter .color3, .syntaxhighlighter .color3 a { - color: #ffaa3e !important; -} diff --git a/plugins/textviewer/syntaxhighlighter/styles/shCoreRDark.css b/plugins/textviewer/syntaxhighlighter/styles/shCoreRDark.css deleted file mode 100644 index d09368384dafd9b1f9650fe012f4c590a52312d3..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/styles/shCoreRDark.css +++ /dev/null @@ -1,324 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -.syntaxhighlighter a, -.syntaxhighlighter div, -.syntaxhighlighter code, -.syntaxhighlighter table, -.syntaxhighlighter table td, -.syntaxhighlighter table tr, -.syntaxhighlighter table tbody, -.syntaxhighlighter table thead, -.syntaxhighlighter table caption, -.syntaxhighlighter textarea { - -moz-border-radius: 0 0 0 0 !important; - -webkit-border-radius: 0 0 0 0 !important; - background: none !important; - border: 0 !important; - bottom: auto !important; - float: none !important; - height: auto !important; - left: auto !important; - line-height: 1.1em !important; - margin: 0 !important; - outline: 0 !important; - overflow: visible !important; - padding: 0 !important; - position: static !important; - right: auto !important; - text-align: left !important; - top: auto !important; - vertical-align: baseline !important; - width: auto !important; - box-sizing: content-box !important; - font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; - font-weight: normal !important; - font-style: normal !important; - font-size: 1em !important; - min-height: inherit !important; - min-height: auto !important; -} - -.syntaxhighlighter { - width: 100% !important; - margin: 1em 0 1em 0 !important; - position: relative !important; - overflow: auto !important; - font-size: 1em !important; -} -.syntaxhighlighter.source { - overflow: hidden !important; -} -.syntaxhighlighter .bold { - font-weight: bold !important; -} -.syntaxhighlighter .italic { - font-style: italic !important; -} -.syntaxhighlighter .line { - white-space: pre !important; -} -.syntaxhighlighter table { - width: 100% !important; -} -.syntaxhighlighter table caption { - text-align: left !important; - padding: .5em 0 0.5em 1em !important; -} -.syntaxhighlighter table td.code { - width: 100% !important; -} -.syntaxhighlighter table td.code .container { - position: relative !important; -} -.syntaxhighlighter table td.code .container textarea { - box-sizing: border-box !important; - position: absolute !important; - left: 0 !important; - top: 0 !important; - width: 100% !important; - height: 100% !important; - border: none !important; - background: white !important; - padding-left: 1em !important; - overflow: hidden !important; - white-space: pre !important; -} -.syntaxhighlighter table td.gutter .line { - text-align: right !important; - padding: 0 0.5em 0 1em !important; -} -.syntaxhighlighter table td.code .line { - padding: 0 1em !important; -} -.syntaxhighlighter.nogutter td.code .container textarea, .syntaxhighlighter.nogutter td.code .line { - padding-left: 0em !important; -} -.syntaxhighlighter.show { - display: block !important; -} -.syntaxhighlighter.collapsed table { - display: none !important; -} -.syntaxhighlighter.collapsed .toolbar { - padding: 0.1em 0.8em 0em 0.8em !important; - font-size: 1em !important; - position: static !important; - width: auto !important; - height: auto !important; -} -.syntaxhighlighter.collapsed .toolbar span { - display: inline !important; - margin-right: 1em !important; -} -.syntaxhighlighter.collapsed .toolbar span a { - padding: 0 !important; - display: none !important; -} -.syntaxhighlighter.collapsed .toolbar span a.expandSource { - display: inline !important; -} -.syntaxhighlighter .toolbar { - position: absolute !important; - right: 1px !important; - top: 1px !important; - width: 11px !important; - height: 11px !important; - font-size: 10px !important; - z-index: 10 !important; -} -.syntaxhighlighter .toolbar span.title { - display: inline !important; -} -.syntaxhighlighter .toolbar a { - display: block !important; - text-align: center !important; - text-decoration: none !important; - padding-top: 1px !important; -} -.syntaxhighlighter .toolbar a.expandSource { - display: none !important; -} -.syntaxhighlighter.ie { - font-size: .9em !important; - padding: 1px 0 1px 0 !important; -} -.syntaxhighlighter.ie .toolbar { - line-height: 8px !important; -} -.syntaxhighlighter.ie .toolbar a { - padding-top: 0px !important; -} -.syntaxhighlighter.printing .line.alt1 .content, -.syntaxhighlighter.printing .line.alt2 .content, -.syntaxhighlighter.printing .line.highlighted .number, -.syntaxhighlighter.printing .line.highlighted.alt1 .content, -.syntaxhighlighter.printing .line.highlighted.alt2 .content { - background: none !important; -} -.syntaxhighlighter.printing .line .number { - color: #bbbbbb !important; -} -.syntaxhighlighter.printing .line .content { - color: black !important; -} -.syntaxhighlighter.printing .toolbar { - display: none !important; -} -.syntaxhighlighter.printing a { - text-decoration: none !important; -} -.syntaxhighlighter.printing .plain, .syntaxhighlighter.printing .plain a { - color: black !important; -} -.syntaxhighlighter.printing .comments, .syntaxhighlighter.printing .comments a { - color: #008200 !important; -} -.syntaxhighlighter.printing .string, .syntaxhighlighter.printing .string a { - color: blue !important; -} -.syntaxhighlighter.printing .keyword { - color: #006699 !important; - font-weight: bold !important; -} -.syntaxhighlighter.printing .preprocessor { - color: gray !important; -} -.syntaxhighlighter.printing .variable { - color: #aa7700 !important; -} -.syntaxhighlighter.printing .value { - color: #009900 !important; -} -.syntaxhighlighter.printing .functions { - color: #ff1493 !important; -} -.syntaxhighlighter.printing .constants { - color: #0066cc !important; -} -.syntaxhighlighter.printing .script { - font-weight: bold !important; -} -.syntaxhighlighter.printing .color1, .syntaxhighlighter.printing .color1 a { - color: gray !important; -} -.syntaxhighlighter.printing .color2, .syntaxhighlighter.printing .color2 a { - color: #ff1493 !important; -} -.syntaxhighlighter.printing .color3, .syntaxhighlighter.printing .color3 a { - color: red !important; -} -.syntaxhighlighter.printing .break, .syntaxhighlighter.printing .break a { - color: black !important; -} - -.syntaxhighlighter { - background-color: #1b2426 !important; -} -.syntaxhighlighter .line.alt1 { - background-color: #1b2426 !important; -} -.syntaxhighlighter .line.alt2 { - background-color: #1b2426 !important; -} -.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { - background-color: #323e41 !important; -} -.syntaxhighlighter .line.highlighted.number { - color: #b9bdb6 !important; -} -.syntaxhighlighter table caption { - color: #b9bdb6 !important; -} -.syntaxhighlighter .gutter { - color: #afafaf !important; -} -.syntaxhighlighter .gutter .line { - border-right: 3px solid #435a5f !important; -} -.syntaxhighlighter .gutter .line.highlighted { - background-color: #435a5f !important; - color: #1b2426 !important; -} -.syntaxhighlighter.printing .line .content { - border: none !important; -} -.syntaxhighlighter.collapsed { - overflow: visible !important; -} -.syntaxhighlighter.collapsed .toolbar { - color: #5ba1cf !important; - background: black !important; - border: 1px solid #435a5f !important; -} -.syntaxhighlighter.collapsed .toolbar a { - color: #5ba1cf !important; -} -.syntaxhighlighter.collapsed .toolbar a:hover { - color: #5ce638 !important; -} -.syntaxhighlighter .toolbar { - color: white !important; - background: #435a5f !important; - border: none !important; -} -.syntaxhighlighter .toolbar a { - color: white !important; -} -.syntaxhighlighter .toolbar a:hover { - color: #e0e8ff !important; -} -.syntaxhighlighter .plain, .syntaxhighlighter .plain a { - color: #b9bdb6 !important; -} -.syntaxhighlighter .comments, .syntaxhighlighter .comments a { - color: #878a85 !important; -} -.syntaxhighlighter .string, .syntaxhighlighter .string a { - color: #5ce638 !important; -} -.syntaxhighlighter .keyword { - color: #5ba1cf !important; -} -.syntaxhighlighter .preprocessor { - color: #435a5f !important; -} -.syntaxhighlighter .variable { - color: #ffaa3e !important; -} -.syntaxhighlighter .value { - color: #009900 !important; -} -.syntaxhighlighter .functions { - color: #ffaa3e !important; -} -.syntaxhighlighter .constants { - color: #e0e8ff !important; -} -.syntaxhighlighter .script { - font-weight: bold !important; - color: #5ba1cf !important; - background-color: none !important; -} -.syntaxhighlighter .color1, .syntaxhighlighter .color1 a { - color: #e0e8ff !important; -} -.syntaxhighlighter .color2, .syntaxhighlighter .color2 a { - color: white !important; -} -.syntaxhighlighter .color3, .syntaxhighlighter .color3 a { - color: #ffaa3e !important; -} diff --git a/plugins/textviewer/syntaxhighlighter/styles/shThemeDefault.css b/plugins/textviewer/syntaxhighlighter/styles/shThemeDefault.css deleted file mode 100644 index 136541172dc3be4c5d5e7b2731d6453cc38897ca..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/styles/shThemeDefault.css +++ /dev/null @@ -1,117 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -.syntaxhighlighter { - background-color: white !important; -} -.syntaxhighlighter .line.alt1 { - background-color: white !important; -} -.syntaxhighlighter .line.alt2 { - background-color: white !important; -} -.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { - background-color: #e0e0e0 !important; -} -.syntaxhighlighter .line.highlighted.number { - color: black !important; -} -.syntaxhighlighter table caption { - color: black !important; -} -.syntaxhighlighter .gutter { - color: #afafaf !important; -} -.syntaxhighlighter .gutter .line { - border-right: 3px solid #6ce26c !important; -} -.syntaxhighlighter .gutter .line.highlighted { - background-color: #6ce26c !important; - color: white !important; -} -.syntaxhighlighter.printing .line .content { - border: none !important; -} -.syntaxhighlighter.collapsed { - overflow: visible !important; -} -.syntaxhighlighter.collapsed .toolbar { - color: blue !important; - background: white !important; - border: 1px solid #6ce26c !important; -} -.syntaxhighlighter.collapsed .toolbar a { - color: blue !important; -} -.syntaxhighlighter.collapsed .toolbar a:hover { - color: red !important; -} -.syntaxhighlighter .toolbar { - color: white !important; - background: #6ce26c !important; - border: none !important; -} -.syntaxhighlighter .toolbar a { - color: white !important; -} -.syntaxhighlighter .toolbar a:hover { - color: black !important; -} -.syntaxhighlighter .plain, .syntaxhighlighter .plain a { - color: black !important; -} -.syntaxhighlighter .comments, .syntaxhighlighter .comments a { - color: #008200 !important; -} -.syntaxhighlighter .string, .syntaxhighlighter .string a { - color: blue !important; -} -.syntaxhighlighter .keyword { - color: #006699 !important; -} -.syntaxhighlighter .preprocessor { - color: gray !important; -} -.syntaxhighlighter .variable { - color: #aa7700 !important; -} -.syntaxhighlighter .value { - color: #009900 !important; -} -.syntaxhighlighter .functions { - color: #ff1493 !important; -} -.syntaxhighlighter .constants { - color: #0066cc !important; -} -.syntaxhighlighter .script { - font-weight: bold !important; - color: #006699 !important; - background-color: none !important; -} -.syntaxhighlighter .color1, .syntaxhighlighter .color1 a { - color: gray !important; -} -.syntaxhighlighter .color2, .syntaxhighlighter .color2 a { - color: #ff1493 !important; -} -.syntaxhighlighter .color3, .syntaxhighlighter .color3 a { - color: red !important; -} - -.syntaxhighlighter .keyword { - font-weight: bold !important; -} diff --git a/plugins/textviewer/syntaxhighlighter/styles/shThemeDjango.css b/plugins/textviewer/syntaxhighlighter/styles/shThemeDjango.css deleted file mode 100644 index d8b4313433d107db3eaa13447994c62adc3cb339..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/styles/shThemeDjango.css +++ /dev/null @@ -1,120 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -.syntaxhighlighter { - background-color: #0a2b1d !important; -} -.syntaxhighlighter .line.alt1 { - background-color: #0a2b1d !important; -} -.syntaxhighlighter .line.alt2 { - background-color: #0a2b1d !important; -} -.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { - background-color: #233729 !important; -} -.syntaxhighlighter .line.highlighted.number { - color: white !important; -} -.syntaxhighlighter table caption { - color: #f8f8f8 !important; -} -.syntaxhighlighter .gutter { - color: #497958 !important; -} -.syntaxhighlighter .gutter .line { - border-right: 3px solid #41a83e !important; -} -.syntaxhighlighter .gutter .line.highlighted { - background-color: #41a83e !important; - color: #0a2b1d !important; -} -.syntaxhighlighter.printing .line .content { - border: none !important; -} -.syntaxhighlighter.collapsed { - overflow: visible !important; -} -.syntaxhighlighter.collapsed .toolbar { - color: #96dd3b !important; - background: black !important; - border: 1px solid #41a83e !important; -} -.syntaxhighlighter.collapsed .toolbar a { - color: #96dd3b !important; -} -.syntaxhighlighter.collapsed .toolbar a:hover { - color: white !important; -} -.syntaxhighlighter .toolbar { - color: white !important; - background: #41a83e !important; - border: none !important; -} -.syntaxhighlighter .toolbar a { - color: white !important; -} -.syntaxhighlighter .toolbar a:hover { - color: #ffe862 !important; -} -.syntaxhighlighter .plain, .syntaxhighlighter .plain a { - color: #f8f8f8 !important; -} -.syntaxhighlighter .comments, .syntaxhighlighter .comments a { - color: #336442 !important; -} -.syntaxhighlighter .string, .syntaxhighlighter .string a { - color: #9df39f !important; -} -.syntaxhighlighter .keyword { - color: #96dd3b !important; -} -.syntaxhighlighter .preprocessor { - color: #91bb9e !important; -} -.syntaxhighlighter .variable { - color: #ffaa3e !important; -} -.syntaxhighlighter .value { - color: #f7e741 !important; -} -.syntaxhighlighter .functions { - color: #ffaa3e !important; -} -.syntaxhighlighter .constants { - color: #e0e8ff !important; -} -.syntaxhighlighter .script { - font-weight: bold !important; - color: #96dd3b !important; - background-color: none !important; -} -.syntaxhighlighter .color1, .syntaxhighlighter .color1 a { - color: #eb939a !important; -} -.syntaxhighlighter .color2, .syntaxhighlighter .color2 a { - color: #91bb9e !important; -} -.syntaxhighlighter .color3, .syntaxhighlighter .color3 a { - color: #edef7d !important; -} - -.syntaxhighlighter .comments { - font-style: italic !important; -} -.syntaxhighlighter .keyword { - font-weight: bold !important; -} diff --git a/plugins/textviewer/syntaxhighlighter/styles/shThemeEclipse.css b/plugins/textviewer/syntaxhighlighter/styles/shThemeEclipse.css deleted file mode 100644 index 77377d9533477c6b808306a9c04bec2ffa528103..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/styles/shThemeEclipse.css +++ /dev/null @@ -1,128 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -.syntaxhighlighter { - background-color: white !important; -} -.syntaxhighlighter .line.alt1 { - background-color: white !important; -} -.syntaxhighlighter .line.alt2 { - background-color: white !important; -} -.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { - background-color: #c3defe !important; -} -.syntaxhighlighter .line.highlighted.number { - color: white !important; -} -.syntaxhighlighter table caption { - color: black !important; -} -.syntaxhighlighter .gutter { - color: #787878 !important; -} -.syntaxhighlighter .gutter .line { - border-right: 3px solid #d4d0c8 !important; -} -.syntaxhighlighter .gutter .line.highlighted { - background-color: #d4d0c8 !important; - color: white !important; -} -.syntaxhighlighter.printing .line .content { - border: none !important; -} -.syntaxhighlighter.collapsed { - overflow: visible !important; -} -.syntaxhighlighter.collapsed .toolbar { - color: #3f5fbf !important; - background: white !important; - border: 1px solid #d4d0c8 !important; -} -.syntaxhighlighter.collapsed .toolbar a { - color: #3f5fbf !important; -} -.syntaxhighlighter.collapsed .toolbar a:hover { - color: #aa7700 !important; -} -.syntaxhighlighter .toolbar { - color: #a0a0a0 !important; - background: #d4d0c8 !important; - border: none !important; -} -.syntaxhighlighter .toolbar a { - color: #a0a0a0 !important; -} -.syntaxhighlighter .toolbar a:hover { - color: red !important; -} -.syntaxhighlighter .plain, .syntaxhighlighter .plain a { - color: black !important; -} -.syntaxhighlighter .comments, .syntaxhighlighter .comments a { - color: #3f5fbf !important; -} -.syntaxhighlighter .string, .syntaxhighlighter .string a { - color: #2a00ff !important; -} -.syntaxhighlighter .keyword { - color: #7f0055 !important; -} -.syntaxhighlighter .preprocessor { - color: #646464 !important; -} -.syntaxhighlighter .variable { - color: #aa7700 !important; -} -.syntaxhighlighter .value { - color: #009900 !important; -} -.syntaxhighlighter .functions { - color: #ff1493 !important; -} -.syntaxhighlighter .constants { - color: #0066cc !important; -} -.syntaxhighlighter .script { - font-weight: bold !important; - color: #7f0055 !important; - background-color: none !important; -} -.syntaxhighlighter .color1, .syntaxhighlighter .color1 a { - color: gray !important; -} -.syntaxhighlighter .color2, .syntaxhighlighter .color2 a { - color: #ff1493 !important; -} -.syntaxhighlighter .color3, .syntaxhighlighter .color3 a { - color: red !important; -} - -.syntaxhighlighter .keyword { - font-weight: bold !important; -} -.syntaxhighlighter .xml .keyword { - color: #3f7f7f !important; - font-weight: normal !important; -} -.syntaxhighlighter .xml .color1, .syntaxhighlighter .xml .color1 a { - color: #7f007f !important; -} -.syntaxhighlighter .xml .string { - font-style: italic !important; - color: #2a00ff !important; -} diff --git a/plugins/textviewer/syntaxhighlighter/styles/shThemeEmacs.css b/plugins/textviewer/syntaxhighlighter/styles/shThemeEmacs.css deleted file mode 100644 index dae5053fea8a6cef6b763f97a6461e307a50107d..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/styles/shThemeEmacs.css +++ /dev/null @@ -1,113 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -.syntaxhighlighter { - background-color: black !important; -} -.syntaxhighlighter .line.alt1 { - background-color: black !important; -} -.syntaxhighlighter .line.alt2 { - background-color: black !important; -} -.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { - background-color: #2a3133 !important; -} -.syntaxhighlighter .line.highlighted.number { - color: white !important; -} -.syntaxhighlighter table caption { - color: #d3d3d3 !important; -} -.syntaxhighlighter .gutter { - color: #d3d3d3 !important; -} -.syntaxhighlighter .gutter .line { - border-right: 3px solid #990000 !important; -} -.syntaxhighlighter .gutter .line.highlighted { - background-color: #990000 !important; - color: black !important; -} -.syntaxhighlighter.printing .line .content { - border: none !important; -} -.syntaxhighlighter.collapsed { - overflow: visible !important; -} -.syntaxhighlighter.collapsed .toolbar { - color: #ebdb8d !important; - background: black !important; - border: 1px solid #990000 !important; -} -.syntaxhighlighter.collapsed .toolbar a { - color: #ebdb8d !important; -} -.syntaxhighlighter.collapsed .toolbar a:hover { - color: #ff7d27 !important; -} -.syntaxhighlighter .toolbar { - color: white !important; - background: #990000 !important; - border: none !important; -} -.syntaxhighlighter .toolbar a { - color: white !important; -} -.syntaxhighlighter .toolbar a:hover { - color: #9ccff4 !important; -} -.syntaxhighlighter .plain, .syntaxhighlighter .plain a { - color: #d3d3d3 !important; -} -.syntaxhighlighter .comments, .syntaxhighlighter .comments a { - color: #ff7d27 !important; -} -.syntaxhighlighter .string, .syntaxhighlighter .string a { - color: #ff9e7b !important; -} -.syntaxhighlighter .keyword { - color: aqua !important; -} -.syntaxhighlighter .preprocessor { - color: #aec4de !important; -} -.syntaxhighlighter .variable { - color: #ffaa3e !important; -} -.syntaxhighlighter .value { - color: #009900 !important; -} -.syntaxhighlighter .functions { - color: #81cef9 !important; -} -.syntaxhighlighter .constants { - color: #ff9e7b !important; -} -.syntaxhighlighter .script { - font-weight: bold !important; - color: aqua !important; - background-color: none !important; -} -.syntaxhighlighter .color1, .syntaxhighlighter .color1 a { - color: #ebdb8d !important; -} -.syntaxhighlighter .color2, .syntaxhighlighter .color2 a { - color: #ff7d27 !important; -} -.syntaxhighlighter .color3, .syntaxhighlighter .color3 a { - color: #aec4de !important; -} diff --git a/plugins/textviewer/syntaxhighlighter/styles/shThemeFadeToGrey.css b/plugins/textviewer/syntaxhighlighter/styles/shThemeFadeToGrey.css deleted file mode 100644 index 8fbd871fb5bc1a33b3a4b35bccdcbf5baab553da..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/styles/shThemeFadeToGrey.css +++ /dev/null @@ -1,117 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -.syntaxhighlighter { - background-color: #121212 !important; -} -.syntaxhighlighter .line.alt1 { - background-color: #121212 !important; -} -.syntaxhighlighter .line.alt2 { - background-color: #121212 !important; -} -.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { - background-color: #2c2c29 !important; -} -.syntaxhighlighter .line.highlighted.number { - color: white !important; -} -.syntaxhighlighter table caption { - color: white !important; -} -.syntaxhighlighter .gutter { - color: #afafaf !important; -} -.syntaxhighlighter .gutter .line { - border-right: 3px solid #3185b9 !important; -} -.syntaxhighlighter .gutter .line.highlighted { - background-color: #3185b9 !important; - color: #121212 !important; -} -.syntaxhighlighter.printing .line .content { - border: none !important; -} -.syntaxhighlighter.collapsed { - overflow: visible !important; -} -.syntaxhighlighter.collapsed .toolbar { - color: #3185b9 !important; - background: black !important; - border: 1px solid #3185b9 !important; -} -.syntaxhighlighter.collapsed .toolbar a { - color: #3185b9 !important; -} -.syntaxhighlighter.collapsed .toolbar a:hover { - color: #d01d33 !important; -} -.syntaxhighlighter .toolbar { - color: white !important; - background: #3185b9 !important; - border: none !important; -} -.syntaxhighlighter .toolbar a { - color: white !important; -} -.syntaxhighlighter .toolbar a:hover { - color: #96daff !important; -} -.syntaxhighlighter .plain, .syntaxhighlighter .plain a { - color: white !important; -} -.syntaxhighlighter .comments, .syntaxhighlighter .comments a { - color: #696854 !important; -} -.syntaxhighlighter .string, .syntaxhighlighter .string a { - color: #e3e658 !important; -} -.syntaxhighlighter .keyword { - color: #d01d33 !important; -} -.syntaxhighlighter .preprocessor { - color: #435a5f !important; -} -.syntaxhighlighter .variable { - color: #898989 !important; -} -.syntaxhighlighter .value { - color: #009900 !important; -} -.syntaxhighlighter .functions { - color: #aaaaaa !important; -} -.syntaxhighlighter .constants { - color: #96daff !important; -} -.syntaxhighlighter .script { - font-weight: bold !important; - color: #d01d33 !important; - background-color: none !important; -} -.syntaxhighlighter .color1, .syntaxhighlighter .color1 a { - color: #ffc074 !important; -} -.syntaxhighlighter .color2, .syntaxhighlighter .color2 a { - color: #4a8cdb !important; -} -.syntaxhighlighter .color3, .syntaxhighlighter .color3 a { - color: #96daff !important; -} - -.syntaxhighlighter .functions { - font-weight: bold !important; -} diff --git a/plugins/textviewer/syntaxhighlighter/styles/shThemeMDUltra.css b/plugins/textviewer/syntaxhighlighter/styles/shThemeMDUltra.css deleted file mode 100644 index f4db39cd8392096234ced3928d3d58cf806c03b2..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/styles/shThemeMDUltra.css +++ /dev/null @@ -1,113 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -.syntaxhighlighter { - background-color: #222222 !important; -} -.syntaxhighlighter .line.alt1 { - background-color: #222222 !important; -} -.syntaxhighlighter .line.alt2 { - background-color: #222222 !important; -} -.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { - background-color: #253e5a !important; -} -.syntaxhighlighter .line.highlighted.number { - color: white !important; -} -.syntaxhighlighter table caption { - color: lime !important; -} -.syntaxhighlighter .gutter { - color: #38566f !important; -} -.syntaxhighlighter .gutter .line { - border-right: 3px solid #435a5f !important; -} -.syntaxhighlighter .gutter .line.highlighted { - background-color: #435a5f !important; - color: #222222 !important; -} -.syntaxhighlighter.printing .line .content { - border: none !important; -} -.syntaxhighlighter.collapsed { - overflow: visible !important; -} -.syntaxhighlighter.collapsed .toolbar { - color: #428bdd !important; - background: black !important; - border: 1px solid #435a5f !important; -} -.syntaxhighlighter.collapsed .toolbar a { - color: #428bdd !important; -} -.syntaxhighlighter.collapsed .toolbar a:hover { - color: lime !important; -} -.syntaxhighlighter .toolbar { - color: #aaaaff !important; - background: #435a5f !important; - border: none !important; -} -.syntaxhighlighter .toolbar a { - color: #aaaaff !important; -} -.syntaxhighlighter .toolbar a:hover { - color: #9ccff4 !important; -} -.syntaxhighlighter .plain, .syntaxhighlighter .plain a { - color: lime !important; -} -.syntaxhighlighter .comments, .syntaxhighlighter .comments a { - color: #428bdd !important; -} -.syntaxhighlighter .string, .syntaxhighlighter .string a { - color: lime !important; -} -.syntaxhighlighter .keyword { - color: #aaaaff !important; -} -.syntaxhighlighter .preprocessor { - color: #8aa6c1 !important; -} -.syntaxhighlighter .variable { - color: aqua !important; -} -.syntaxhighlighter .value { - color: #f7e741 !important; -} -.syntaxhighlighter .functions { - color: #ff8000 !important; -} -.syntaxhighlighter .constants { - color: yellow !important; -} -.syntaxhighlighter .script { - font-weight: bold !important; - color: #aaaaff !important; - background-color: none !important; -} -.syntaxhighlighter .color1, .syntaxhighlighter .color1 a { - color: red !important; -} -.syntaxhighlighter .color2, .syntaxhighlighter .color2 a { - color: yellow !important; -} -.syntaxhighlighter .color3, .syntaxhighlighter .color3 a { - color: #ffaa3e !important; -} diff --git a/plugins/textviewer/syntaxhighlighter/styles/shThemeMidnight.css b/plugins/textviewer/syntaxhighlighter/styles/shThemeMidnight.css deleted file mode 100644 index c49563cc9dbf5d71be4157ae4805f0fc2a4d0e1d..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/styles/shThemeMidnight.css +++ /dev/null @@ -1,113 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -.syntaxhighlighter { - background-color: #0f192a !important; -} -.syntaxhighlighter .line.alt1 { - background-color: #0f192a !important; -} -.syntaxhighlighter .line.alt2 { - background-color: #0f192a !important; -} -.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { - background-color: #253e5a !important; -} -.syntaxhighlighter .line.highlighted.number { - color: #38566f !important; -} -.syntaxhighlighter table caption { - color: #d1edff !important; -} -.syntaxhighlighter .gutter { - color: #afafaf !important; -} -.syntaxhighlighter .gutter .line { - border-right: 3px solid #435a5f !important; -} -.syntaxhighlighter .gutter .line.highlighted { - background-color: #435a5f !important; - color: #0f192a !important; -} -.syntaxhighlighter.printing .line .content { - border: none !important; -} -.syntaxhighlighter.collapsed { - overflow: visible !important; -} -.syntaxhighlighter.collapsed .toolbar { - color: #428bdd !important; - background: black !important; - border: 1px solid #435a5f !important; -} -.syntaxhighlighter.collapsed .toolbar a { - color: #428bdd !important; -} -.syntaxhighlighter.collapsed .toolbar a:hover { - color: #1dc116 !important; -} -.syntaxhighlighter .toolbar { - color: #d1edff !important; - background: #435a5f !important; - border: none !important; -} -.syntaxhighlighter .toolbar a { - color: #d1edff !important; -} -.syntaxhighlighter .toolbar a:hover { - color: #8aa6c1 !important; -} -.syntaxhighlighter .plain, .syntaxhighlighter .plain a { - color: #d1edff !important; -} -.syntaxhighlighter .comments, .syntaxhighlighter .comments a { - color: #428bdd !important; -} -.syntaxhighlighter .string, .syntaxhighlighter .string a { - color: #1dc116 !important; -} -.syntaxhighlighter .keyword { - color: #b43d3d !important; -} -.syntaxhighlighter .preprocessor { - color: #8aa6c1 !important; -} -.syntaxhighlighter .variable { - color: #ffaa3e !important; -} -.syntaxhighlighter .value { - color: #f7e741 !important; -} -.syntaxhighlighter .functions { - color: #ffaa3e !important; -} -.syntaxhighlighter .constants { - color: #e0e8ff !important; -} -.syntaxhighlighter .script { - font-weight: bold !important; - color: #b43d3d !important; - background-color: none !important; -} -.syntaxhighlighter .color1, .syntaxhighlighter .color1 a { - color: #f8bb00 !important; -} -.syntaxhighlighter .color2, .syntaxhighlighter .color2 a { - color: white !important; -} -.syntaxhighlighter .color3, .syntaxhighlighter .color3 a { - color: #ffaa3e !important; -} diff --git a/plugins/textviewer/syntaxhighlighter/styles/shThemeRDark.css b/plugins/textviewer/syntaxhighlighter/styles/shThemeRDark.css deleted file mode 100644 index 6305a10e4ebb09f56b8da07f8d15918f6001d863..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/styles/shThemeRDark.css +++ /dev/null @@ -1,113 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ -.syntaxhighlighter { - background-color: #1b2426 !important; -} -.syntaxhighlighter .line.alt1 { - background-color: #1b2426 !important; -} -.syntaxhighlighter .line.alt2 { - background-color: #1b2426 !important; -} -.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { - background-color: #323e41 !important; -} -.syntaxhighlighter .line.highlighted.number { - color: #b9bdb6 !important; -} -.syntaxhighlighter table caption { - color: #b9bdb6 !important; -} -.syntaxhighlighter .gutter { - color: #afafaf !important; -} -.syntaxhighlighter .gutter .line { - border-right: 3px solid #435a5f !important; -} -.syntaxhighlighter .gutter .line.highlighted { - background-color: #435a5f !important; - color: #1b2426 !important; -} -.syntaxhighlighter.printing .line .content { - border: none !important; -} -.syntaxhighlighter.collapsed { - overflow: visible !important; -} -.syntaxhighlighter.collapsed .toolbar { - color: #5ba1cf !important; - background: black !important; - border: 1px solid #435a5f !important; -} -.syntaxhighlighter.collapsed .toolbar a { - color: #5ba1cf !important; -} -.syntaxhighlighter.collapsed .toolbar a:hover { - color: #5ce638 !important; -} -.syntaxhighlighter .toolbar { - color: white !important; - background: #435a5f !important; - border: none !important; -} -.syntaxhighlighter .toolbar a { - color: white !important; -} -.syntaxhighlighter .toolbar a:hover { - color: #e0e8ff !important; -} -.syntaxhighlighter .plain, .syntaxhighlighter .plain a { - color: #b9bdb6 !important; -} -.syntaxhighlighter .comments, .syntaxhighlighter .comments a { - color: #878a85 !important; -} -.syntaxhighlighter .string, .syntaxhighlighter .string a { - color: #5ce638 !important; -} -.syntaxhighlighter .keyword { - color: #5ba1cf !important; -} -.syntaxhighlighter .preprocessor { - color: #435a5f !important; -} -.syntaxhighlighter .variable { - color: #ffaa3e !important; -} -.syntaxhighlighter .value { - color: #009900 !important; -} -.syntaxhighlighter .functions { - color: #ffaa3e !important; -} -.syntaxhighlighter .constants { - color: #e0e8ff !important; -} -.syntaxhighlighter .script { - font-weight: bold !important; - color: #5ba1cf !important; - background-color: none !important; -} -.syntaxhighlighter .color1, .syntaxhighlighter .color1 a { - color: #e0e8ff !important; -} -.syntaxhighlighter .color2, .syntaxhighlighter .color2 a { - color: white !important; -} -.syntaxhighlighter .color3, .syntaxhighlighter .color3 a { - color: #ffaa3e !important; -} diff --git a/plugins/textviewer/syntaxhighlighter/tests/.rvmrc b/plugins/textviewer/syntaxhighlighter/tests/.rvmrc deleted file mode 100644 index 8cb2ee336aa215bf558a812e4106e25090886694..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/tests/.rvmrc +++ /dev/null @@ -1 +0,0 @@ -rvm 1.8.7-p249@copydeca \ No newline at end of file diff --git a/plugins/textviewer/syntaxhighlighter/tests/brushes/sass.html b/plugins/textviewer/syntaxhighlighter/tests/brushes/sass.html deleted file mode 100644 index f41568455eccbc20691eb211cdda2f8e493cd99c..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/tests/brushes/sass.html +++ /dev/null @@ -1,204 +0,0 @@ -<script class="brush: sass;" type="syntaxhighlighter"> -@mixin round_corners_custom($top, $right, $bottom, $left) { - -moz-border-radius: $top $right $bottom $left !important; - -webkit-border-radius: $top $right $bottom $left !important; -} - -@mixin round_corners($radius) { - @include round_corners_custom($radius, $radius, $radius, $radius); -} - -.syntaxhighlighter { - a, - div, - code, - table, - table td, - table tr, - table tbody, - table thead, - table caption, - textarea { - @include round_corners(0); - - background: none !important; - border: 0 !important; - bottom: auto !important; - float: none !important; - height: auto !important; - left: auto !important; - line-height: 1.1em !important; - margin: 0 !important; - outline: 0 !important; - overflow: visible !important; - padding: 0 !important; - position: static !important; - right: auto !important; - text-align: left !important; - top: auto !important; - vertical-align: baseline !important; - width: auto !important; - font: { - family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; - weight: normal !important; - style: normal !important; - size: 1em !important; - } - min: { - // For IE8, FF & WebKit - height: inherit !important; - // For IE7 - height: auto !important; - } - } -} - -.syntaxhighlighter { - width: 100% !important; - margin: 1em 0 1em 0 !important; - - position: relative !important; - overflow: auto !important; - font-size: 1em !important; - - &.source { overflow: hidden !important; } - - // set up bold and italic - .bold { font-weight: bold !important; } - .italic { font-style: italic !important; } - - .line { white-space: pre !important; } - - // main table and columns - table { - width: 100% !important; - caption { - text-align: left !important; - padding: .5em 0 0.5em 1em !important; - } - - td.code { - width: 100% !important; - - .container { - position: relative !important; - - textarea { - position: absolute !important; - left: 0 !important; - top: 0 !important; - width: 100% !important; - height: 120% !important; - border: none !important; - background: white !important; - padding-left: 1em !important; - overflow: hidden !important; - white-space: pre !important; - } - } - } - - // middle spacing between line numbers and lines - td.gutter .line { - text-align: right !important; - padding: 0 0.5em 0 1em !important; - } - - td.code .line { - padding: 0 1em !important; - } - } - - &.nogutter { - td.code { - .container textarea, .line { padding-left: 0em !important; } - } - } - - &.show { display: block !important; } - - // Adjust some properties when collapsed - &.collapsed { - table { display: none !important; } - - .toolbar { - padding: 0.1em 0.8em 0em 0.8em !important; - font-size: 1em !important; - position: static !important; - width: auto !important; - height: auto !important; - - span { - display: inline !important; - margin-right: 1em !important; - - a { - padding: 0 !important; - display: none !important; - &.expandSource, &.help { display: inline !important; } - } - } - } - } - - // Styles for the toolbar - .toolbar { - position: absolute !important; - right: 1px !important; - top: 1px !important; - width: 11px !important; - height: 11px !important; - font-size: 10px !important; - z-index: 10 !important; - - span.title { display: inline !important; } - - a { - display: block !important; - text-align: center !important; - text-decoration: none !important; - padding-top: 1px !important; - - &.expandSource { display: none !important; } - } - } - - // Print view. - // Colors are based on the default theme without background. - &.printing { - .line.alt1 .content, - .line.alt2 .content, - .line.highlighted .number, - .line.highlighted.alt1 .content, - .line.highlighted.alt2 .content { background: none !important; } - - // Gutter line numbers - .line { - .number { color: #bbbbbb !important; } - // Add border to the lines - .content { color: black !important; } - } - - // Toolbar when visible - .toolbar { display: none !important; } - a { text-decoration: none !important; } - .plain, .plain a { color: black !important; } - .comments, .comments a { color: #008200 !important; } - .string, .string a { color: blue !important; } - .keyword { - color: #006699 !important; - font-weight: bold !important; - } - .preprocessor { color: gray !important; } - .variable { color: #aa7700 !important; } - .value { color: #009900 !important; } - .functions { color: #ff1493 !important; } - .constants { color: #0066cc !important; } - .script { font-weight: bold !important; } - .color1, .color1 a { color: gray !important; } - .color2, .color2 a { color: #ff1493 !important; } - .color3, .color3 a { color: red !important; } - .break, .break a { color: black !important; } - } -} -</script> \ No newline at end of file diff --git a/plugins/textviewer/syntaxhighlighter/tests/brushes_tests.html b/plugins/textviewer/syntaxhighlighter/tests/brushes_tests.html deleted file mode 100644 index e1e20686a27727c3ecc57e905938f81a0210d771..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/tests/brushes_tests.html +++ /dev/null @@ -1,136 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> - <title>SyntaxHighlighter Brushes Tests</title> - <script type="text/javascript" src="/js/jquery-1.4.2.js"></script> - - <!-- SyntaxHighlighter --> - <script type="text/javascript" src="/sh/scripts/XRegExp.js"></script> <!-- XRegExp is bundled with the final shCore.js during build --> - <script type="text/javascript" src="/sh/scripts/shCore.js"></script> - <script type="text/javascript" src="/sh/scripts/shAutoloader.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushAppleScript.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushAS3.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushBash.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushColdFusion.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushCpp.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushCSharp.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushCss.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushDelphi.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushDiff.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushErlang.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushGroovy.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushJava.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushJavaFx.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushJScript.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushPerl.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushPhp.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushPlain.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushPowerShell.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushPython.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushRuby.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushSass.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushScala.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushSql.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushVb.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushXml.js"></script> - - <link type="text/css" rel="stylesheet" href="/sh/styles/shCoreDefault.css"/> -</head> - -<body> - -<div id="output"></div> - -<style> -body { - background: white; - font-family: Helvetica; -} - -.test-wrap { - width: 100%; - height: 800px; - overflow: auto; - border: none; -} -</style> - -<script type="text/javascript"> -var brushes = [ - 'AS3', - 'AppleScript', - 'Bash', - 'CSharp', - 'ColdFusion', - 'Cpp', - 'Css', - 'Delphi', - 'Diff', - 'Erlang', - 'Groovy', - 'JScript', - 'Java', - 'JavaFX', - 'Perl', - 'Php', - 'Plain', - 'PowerShell', - 'Python', - 'Ruby', - 'Sass', - 'Scala', - 'Sql', - 'Vb', - 'Xml' - ]; - -$(document).ready(function() -{ - var html = ''; - - $.each(brushes, function(index) - { - var name = this; - - html += '' - + '<div class="test-wrap">' - + '<h1>' - + '<a href="#theme' + (index + 1) + '">next</a> ' - + '<a name="theme' + index + '">' - + name - + '</a>' - + '</h1>' - ; - - $.ajax({ - url: 'brushes/' + name.toLowerCase() + '.html', - type: 'GET', - dataType: 'text', - async: false, - success: function(data) - { - html += data; - }, - error: function() - { - html += '<p>Not found...</p>'; - } - }); - - html += '</div>\n'; - - if (index % 2 != 0) - html += '<div style="clear:both"></div>\n'; - }); - - $('#output')[0].innerHTML = html; - $('#output a[name]:first').attr('name', 'top'); - $('#output a[href]:last').attr('href', '#top').html('top'); - - SyntaxHighlighter.highlight(); -}); -</script> - -</body> -</html> diff --git a/plugins/textviewer/syntaxhighlighter/tests/cases/001_basic.html b/plugins/textviewer/syntaxhighlighter/tests/cases/001_basic.html deleted file mode 100644 index 1d57334c188f55feee5a755a8ce697ed2fe1e40c..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/tests/cases/001_basic.html +++ /dev/null @@ -1,42 +0,0 @@ -<pre id="sh_001_basic" class="brush: js;" title="Title/caption should render"> - /** - * multiline comment - */ - - text - - // single line comment - - text - - "string" text 'string' text "string" - "string with \" escape" text 'string with \' escape' text "string with \" escape" - - var code = '\ - function helloWorld()\ - {\ - // this is great!\ - for(var i = 0; i <= 1; i++)\ - alert("yay");\ - }\ - '; -</pre> - -<script type="text/javascript"> -queue(function() -{ - var $sh; - - module('001_basic'); - - test('basic html check of default elements', function() - { - $sh = $('#sh_001_basic'); - ok_sh($sh); - ok_toolbar($sh); - ok_caption($sh, 'Title/caption should render'); - ok_gutter($sh); - ok_code($sh); - }); -}); -</script> diff --git a/plugins/textviewer/syntaxhighlighter/tests/cases/002_brushes.html b/plugins/textviewer/syntaxhighlighter/tests/cases/002_brushes.html deleted file mode 100644 index e9c64e2a09191363d7164b2fcb8aa5fe5f273b0a..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/tests/cases/002_brushes.html +++ /dev/null @@ -1,50 +0,0 @@ -<div id="sh_002_brushes"> - <pre class="brush: applescript;">test</pre> - <pre class="brush: as3;">test</pre> - <pre class="brush: bash;">test</pre> - <pre class="brush: cf;">test</pre> - <pre class="brush: cpp;">test</pre> - <pre class="brush: csharp;">test</pre> - <pre class="brush: css;">test</pre> - <pre class="brush: delphi;">test</pre> - <pre class="brush: diff;">test</pre> - <pre class="brush: erlang;">test</pre> - <pre class="brush: groovy;">test</pre> - <pre class="brush: java;">test</pre> - <pre class="brush: javafx;">test</pre> - <pre class="brush: jscript;">test</pre> - <pre class="brush: perl;">test</pre> - <pre class="brush: php;">test</pre> - <pre class="brush: plain;">test</pre> - <pre class="brush: powershell;">test</pre> - <pre class="brush: python;">test</pre> - <pre class="brush: ruby;">test</pre> - <pre class="brush: sass;">test</pre> - <pre class="brush: scala;">test</pre> - <pre class="brush: sql;">test</pre> - <pre class="brush: vb;">test</pre> - <pre class="brush: xml;">test</pre> -</div> - -<script type="text/javascript"> -queue(function() -{ - var $sh; - - module('002_brushes'); - - test('check that all brushes loaded and rendered', function() - { - $sh = $('#sh_002_brushes'); - - $sh.find('> div > .syntaxhighlighter').each(function() - { - var $sh = $(this).parent(); - ok_sh($sh); - ok_sh($sh); - ok_toolbar($sh); - ok_code($sh); - }); - }); -}); -</script> diff --git a/plugins/textviewer/syntaxhighlighter/tests/cases/003_script_tag.html b/plugins/textviewer/syntaxhighlighter/tests/cases/003_script_tag.html deleted file mode 100644 index 9b442925719ad942a81106b8c93a26ed94a91453..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/tests/cases/003_script_tag.html +++ /dev/null @@ -1,42 +0,0 @@ -<div> -<script id="sh_003_script_tag" type="syntaxhighlighter" class="brush: csharp" title="Title/caption should render"><![CDATA[ - partial class Foo - { - function test() - { - yield return; - yield break; - } - } - - function foo() - { - var vector:Vector.<Vector.<String>> = new Vector<Vector.String>>(); - - for (var i = 0; i < 10; i++) - { - /* comments */ - } - } -]]></script> -</div> - -<script type="text/javascript"> -queue(function() -{ - var $sh; - - module('003_script_tag'); - - test('basic html check of default elements', function() - { - $sh = $('#sh_003_script_tag'); - - ok_sh($sh); - ok_toolbar($sh); - ok_caption($sh, 'Title/caption should render'); - ok_gutter($sh); - ok_code($sh); - }); -}); -</script> diff --git a/plugins/textviewer/syntaxhighlighter/tests/cases/004_url_parsing.html b/plugins/textviewer/syntaxhighlighter/tests/cases/004_url_parsing.html deleted file mode 100644 index d489a66940a0eb90105f606dcdcd77605a577e03..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/tests/cases/004_url_parsing.html +++ /dev/null @@ -1,43 +0,0 @@ -<pre id="sh_004_url_parsing" class="brush: as3;"> -/** - * Please see <http://www.alexgorbatchev.come/?test=1&y=2> - */ -var home = "http://www.alexgorbatchev.come/?test=1&y=2;test/1/2/3;"; -// < http://www.gnu.org/licenses/?test=1&y=2 >. - -// Test embedded URLs that terminate at a left angle bracket. -// See bug #28: http://bitbucket.org/alexg/syntaxhighlighter/issue/28/ -"<location>http://www.example.com/song2.mp3</location>"; -</pre> - -<script type="text/javascript"> -queue(function() -{ - var $sh; - - module('004_url_parsing'); - - test('check that urls are present', function() - { - $sh = $('#sh_004_url_parsing'); - - ok_sh($sh); - ok_toolbar($sh); - ok_code($sh); - - var expected = [ - 'http://www.alexgorbatchev.come/?test=1&y=2', - 'http://www.alexgorbatchev.come/?test=1&y=2;test/1/2/3;', - 'http://www.gnu.org/licenses/?test=1&y=2', - 'http://bitbucket.org/alexg/syntaxhighlighter/issue/28/', - 'http://www.example.com/song2.mp3' - ]; - - $sh.find('td.code a').each(function(index) - { - equal($(this).attr('href'), expected[index], 'href'); - equal($(this).text(), expected[index], 'text'); - }) - }); -}); -</script> \ No newline at end of file diff --git a/plugins/textviewer/syntaxhighlighter/tests/cases/005_no_gutter.html b/plugins/textviewer/syntaxhighlighter/tests/cases/005_no_gutter.html deleted file mode 100644 index 6e6b1be0799819d16a760fa4015f510f346c1d44..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/tests/cases/005_no_gutter.html +++ /dev/null @@ -1,33 +0,0 @@ -<pre id="sh_005_no_gutter" class="brush: java; gutter: false;"> - public Image getImage(URL url, String name) { - try { - /* - Regular multiline comment. - */ - return getImage(new URL(url, name)); - } catch (MalformedURLException e) { - return null; - } - } -</pre> - -<script type="text/javascript"> -queue(function() -{ - var $sh; - - module('005_no_gutter'); - - test('check that there is no gutter', function() - { - $sh = $('#sh_005_no_gutter'); - - ok_sh($sh); - ok_toolbar($sh); - ok_code($sh); - - ok($sh.find('> .syntaxhighlighter.nogutter').length == 1, '.nogutter present'); - ok($sh.find('> .syntaxhighlighter > table > tbody > tr > .gutter').length == 0, 'Gutter not present'); - }); -}); -</script> diff --git a/plugins/textviewer/syntaxhighlighter/tests/cases/006_pad_line_numbers.html b/plugins/textviewer/syntaxhighlighter/tests/cases/006_pad_line_numbers.html deleted file mode 100644 index 8ebdd55b4ea22fe9ad37a05b9b541ea6e822a48c..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/tests/cases/006_pad_line_numbers.html +++ /dev/null @@ -1,39 +0,0 @@ -<pre id="sh_006_pad_line_numbers" class="brush: java; pad-line-numbers: true"> -/** - * Returns an Image object that can then be painted on the screen. - * The url argument must specify an absolute {@link URL}. The name - * argument is a specifier that is relative to the url argument. - * - * @param url an absolute URL giving the base location of the image - * @param name the location of the image, relative to the url argument - * @return the image at the specified URL - * @see Image - */ -</pre> - -<script type="text/javascript"> -queue(function() -{ - var $sh; - - module('006_pad_line_numbers'); - - test('check that line numbers are padded with zeroes', function() - { - $sh = $('#sh_006_pad_line_numbers'); - - ok_sh($sh); - ok_toolbar($sh); - ok_gutter($sh); - ok_code($sh); - - $sh.find('.gutter > .line').each(function(index) - { - var text = $(this).text(); - - if (parseInt(text) < 10) - ok(text.charAt(0) == '0', 'Line ' + index + ' has leading zero: ' + text); - }); - }); -}); -</script> diff --git a/plugins/textviewer/syntaxhighlighter/tests/cases/007_collapse.html b/plugins/textviewer/syntaxhighlighter/tests/cases/007_collapse.html deleted file mode 100644 index 2643bb559d9f8585298a5b0a893f65134a088bfe..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/tests/cases/007_collapse.html +++ /dev/null @@ -1,60 +0,0 @@ -<pre id="sh_007_collapse_a" class="brush: groovy; collapse: true" title="This is a title for collapsed block"> - /** - * Returns an Image object that can then be painted on the screen. - * The url argument must specify an absolute {@link URL}. The name - * argument is a specifier that is relative to the url argument. - * - * @param url an absolute URL giving the base location of the image - * @param name the location of the image, relative to the url argument - * @return the image at the specified URL - * @see Image - */ -</pre> - -<pre id="sh_007_collapse_b" class="brush: groovy; collapse: true"> - /** - * Returns an Image object that can then be painted on the screen. - * The url argument must specify an absolute {@link URL}. The name - * argument is a specifier that is relative to the url argument. - * - * @param url an absolute URL giving the base location of the image - * @param name the location of the image, relative to the url argument - * @return the image at the specified URL - * @see Image - */ -</pre> - -<script type="text/javascript"> -queue(function() -{ - var $sh; - - module('007_collapse'); - - test('collapsed block with title', function() - { - $sh = $('#sh_007_collapse_a'); - - ok_sh($sh); - ok_toolbar($sh); - ok_collapsed($sh); - - var $title = $sh.find('.toolbar a.toolbar_item.command_expandSource'); - ok($title.length == 1, 'Expand present'); - equal($title.text(), 'This is a title for collapsed block', 'Expand text'); - }); - - test('collapsed block without title', function() - { - $sh = $('#sh_007_collapse_b'); - - ok_sh($sh); - ok_toolbar($sh); - ok_collapsed($sh); - - var $title = $sh.find('.toolbar a.toolbar_item.command_expandSource'); - ok($title.length == 1, 'Expand present'); - equal($title.text(), SyntaxHighlighter.config.strings.expandSource, 'Expand text'); - }); -}); -</script> diff --git a/plugins/textviewer/syntaxhighlighter/tests/cases/007_collapse_interaction.html b/plugins/textviewer/syntaxhighlighter/tests/cases/007_collapse_interaction.html deleted file mode 100644 index ea72046e66ab9da4d4c9adda87bfabc3777bca52..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/tests/cases/007_collapse_interaction.html +++ /dev/null @@ -1,44 +0,0 @@ -<script type="text/javascript"> -queue(function() -{ - var $sh; - - module('007_collapse_interaction'); - - function clickA($a) - { - SyntaxHighlighter.toolbar.handler({ - target: $a[0], - preventDefault: function() {} - }); - }; - - test('expand collapsed block with title', function() - { - $sh = $('#sh_007_collapse_a'); - - ok_sh($sh); - ok_toolbar($sh); - ok_collapsed($sh); - - var $a = $sh.find('.toolbar a.toolbar_item.command_expandSource'); - clickA($a); - ok($a.not(':visible'), 'Expand not visible'); - ok_code($sh); - }); - - test('expand collapsed block without title', function() - { - $sh = $('#sh_007_collapse_b'); - - ok_sh($sh); - ok_toolbar($sh); - ok_collapsed($sh); - - var $a = $sh.find('.toolbar a.toolbar_item.command_expandSource'); - clickA($a); - ok($a.not(':visible'), 'Expand not visible'); - ok_code($sh); - }); -}); -</script> diff --git a/plugins/textviewer/syntaxhighlighter/tests/cases/008_first_line.html b/plugins/textviewer/syntaxhighlighter/tests/cases/008_first_line.html deleted file mode 100644 index 169dc38c87e56aa63a580fa2c419b2bc1062f111..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/tests/cases/008_first_line.html +++ /dev/null @@ -1,29 +0,0 @@ -<pre id="sh_008_first_line" class="brush: java; first-line: 10"> - partial class Foo - { - function test() - { - yield return; - } - } -</pre> - -<script type="text/javascript"> -queue(function() -{ - var $sh; - - module('008_first_line'); - - test('check the first line', function() - { - $sh = $('#sh_008_first_line'); - - ok_sh($sh); - ok_toolbar($sh); - ok_gutter($sh); - ok_code($sh); - equals($sh.find('.gutter .index0').text(), '10', 'First line'); - }); -}); -</script> diff --git a/plugins/textviewer/syntaxhighlighter/tests/cases/009_class_name.html b/plugins/textviewer/syntaxhighlighter/tests/cases/009_class_name.html deleted file mode 100644 index f2437d58bea1273b97b83d91081b751e44519b2f..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/tests/cases/009_class_name.html +++ /dev/null @@ -1,32 +0,0 @@ -<pre id="sh_009_class_name" class="brush: java; class-name: 'custom class here'"> - public Image getImage(URL url, String name) { - try { - /* - Regular multiline comment. - */ - return getImage(new URL(url, name)); - } catch (MalformedURLException e) { - return null; - } - } -</pre> - -<script type="text/javascript"> -queue(function() -{ - var $sh; - - module('009_class_name'); - - test('check custom classes', function() - { - $sh = $('#sh_009_class_name'); - - ok_sh($sh); - ok_toolbar($sh); - ok_gutter($sh); - ok_code($sh); - ok($sh.find('.syntaxhighlighter').is('.custom.class.here'), 'Check custom classes'); - }); -}); -</script> diff --git a/plugins/textviewer/syntaxhighlighter/tests/cases/010_highlight.html b/plugins/textviewer/syntaxhighlighter/tests/cases/010_highlight.html deleted file mode 100644 index 64b6613037768e7bd6ec54e15cc22090b8d40d1f..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/tests/cases/010_highlight.html +++ /dev/null @@ -1,70 +0,0 @@ -<pre id="sh_010_highlight_a" class="brush: groovy; highlight: 2"> - public function validateStrongPassword(password:String):Boolean - { - if (password == null || password.length <= 0) - { - return false; - } - - return STRONG_PASSWORD_PATTERN.test(password); - } -</pre> -<script id="sh_010_highlight_b" type="syntaxhighlighter" class="brush: as3; highlight: [2, 4, 12]"><![CDATA[ - /** - * Checks a password and returns a value indicating whether the password is a "strong" - * password. The criteria for a strong password are: - * - * <ul> - * <li>Minimum 8 characters</li> - * <li>Maxmium 32 characters</li> - * <li>Contains at least one lowercase letter</li> - * <li>Contains at least one uppercase letter</li> - * <li>Contains at least one number or symbol character</li> - * </ul> - * - * @param password The password to check - * - * @return A value indicating whether the password is a strong password (<code>true</code>) - * or not (<code>false</code>). - */ - public function validateStrongPassword(password:String):Boolean - { - if (password == null || password.length <= 0) - { - return false; - } - - return STRONG_PASSWORD_PATTERN.test(password); - } -]]></script> - -<script type="text/javascript"> -queue(function() -{ - var $sh; - - module('010_highlight'); - - test('one highlighted line', function() - { - $sh = $('#sh_010_highlight_a'); - - ok_sh($sh); - ok_toolbar($sh); - ok_code($sh); - ok($sh.find('.gutter .number2').is('.highlighted'), 'Line 2 is highlighted'); - }); - - test('multiple highlighted lines', function() - { - $sh = $('#sh_010_highlight_b'); - - ok_sh($sh); - ok_toolbar($sh); - ok_code($sh); - ok($sh.find('.gutter .number2').is('.highlighted'), 'Line 2 is highlighted'); - ok($sh.find('.gutter .number4').is('.highlighted'), 'Line 4 is highlighted'); - ok($sh.find('.gutter .number12').is('.highlighted'), 'Line 12 is highlighted'); - }); -}); -</script> diff --git a/plugins/textviewer/syntaxhighlighter/tests/cases/011_smart_tabs.html b/plugins/textviewer/syntaxhighlighter/tests/cases/011_smart_tabs.html deleted file mode 100644 index d6d62fc867bb112fd5005b2bb37a7732b207af42..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/tests/cases/011_smart_tabs.html +++ /dev/null @@ -1,98 +0,0 @@ -<pre id="sh_011_smart_tabs_a" class="brush: plain;"> - the words in this paragraph - should look like they are - evenly spaced between columns -</pre> - -<pre id="sh_011_smart_tabs_b" class="brush: plain; tab-size: 8;"> - the words in this paragraph - should look like they are - evenly spaced between columns -</pre> - -<pre id="sh_011_smart_tabs_c" class="brush: plain; smart-tabs: false"> - the words in this paragraph - should look out of whack - because smart tabs are disabled -</pre> - -<script type="text/javascript"> -queue(function() -{ - var $sh; - - module('011_smart_tabs'); - - var evenLines = [ - 'the words in this paragraph', - 'should look like they are', - 'evenly spaced between columns' - ], - unevenLines = [ - 'the words in this paragraph', - 'should look out of whack', - 'because smart tabs are disabled' - ] - ; - - function fixSpaces(s) - { - s = encodeURIComponent(s).replace(/%C2%A0/g, '%20'); - return unescape(s).replace(/\s+$/g, ''); - }; - - test('default tab size is 4', function() - { - $sh = $('#sh_011_smart_tabs_a'); - - ok_sh($sh); - ok_toolbar($sh); - ok_code($sh); - - $sh.find('.code .line').each(function(index) - { - var s1 = fixSpaces($(this).text()), - s2 = fixSpaces(evenLines[index]) - ; - - equal(s1, s2, 'Line ' + index); - }); - }); - - test('tab size changed to 8', function() - { - $sh = $('#sh_011_smart_tabs_b'); - - ok_sh($sh); - ok_toolbar($sh); - ok_code($sh); - - $sh.find('.code .line').each(function(index) - { - var s1 = fixSpaces($(this).text()), - s2 = fixSpaces(evenLines[index]) - ; - - equal(s1, s2, 'Line ' + index); - }); - }); - - test('smart tabs are off', function() - { - $sh = $('#sh_011_smart_tabs_c'); - - ok_sh($sh); - ok_toolbar($sh); - ok_code($sh); - - $sh.find('.code .line').each(function(index) - { - var s1 = fixSpaces($(this).text()), - s2 = fixSpaces(unevenLines[index]) - ; - - equal(s1, s2, 'Line ' + index); - }); - }); -}); -</script> diff --git a/plugins/textviewer/syntaxhighlighter/tests/cases/012_server_side.html b/plugins/textviewer/syntaxhighlighter/tests/cases/012_server_side.html deleted file mode 100644 index 1bb421737a669150e9707775295e2a9b2203c00f..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/tests/cases/012_server_side.html +++ /dev/null @@ -1,35 +0,0 @@ -<script id="sh_012_server_side_input" type="text/plain"> -function helloWorld() -{ - // this is great! - for(var i = 0; i <= 1; i++) - alert("yay"); -} -</script> - -<div id="sh_012_server_side_output"> -</div> - -<script type="text/javascript"> -queue(function() -{ - var $sh; - - module('012_server_side'); - - test('generate markup', function() - { - var brush = new SyntaxHighlighter.brushes.JScript(), - code = $('#sh_012_server_side_input').html() - ; - - brush.init({ toolbar: false }); - $sh = $('#sh_012_server_side_output'); - $sh.html(brush.getHtml(code)); - - ok_sh($sh); - ok_gutter($sh); - ok_code($sh); - }); -}); -</script> \ No newline at end of file diff --git a/plugins/textviewer/syntaxhighlighter/tests/cases/013_html_script.html b/plugins/textviewer/syntaxhighlighter/tests/cases/013_html_script.html deleted file mode 100644 index c0a1201934df0870801f8f60a4c340a76e20337d..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/tests/cases/013_html_script.html +++ /dev/null @@ -1,34 +0,0 @@ -<pre id="sh_013_html_script" class="brush: groovy; html-script: true"> -<hello> - <% - package free.cafekiwi.gotapi; - %> -</hello> - -<!-- - Comments here ---> -<%= print(); %> -</pre> - -<script type="text/javascript"> -queue(function() -{ - var $sh; - - module('013_html_script'); - - test('check markup', function() - { - $sh = $('#sh_013_html_script'); - - ok_sh($sh); - ok_gutter($sh); - ok_code($sh); - - ok($sh.find('.code .number1 > .htmlscript').length > 0, 'Has .htmlscript on line 1'); - ok($sh.find('.code .number3 > .groovy').length > 0, 'Has .groovy on line 3'); - ok($sh.find('.code .number10 > .groovy').length > 0, 'Has .groovy on line 10'); - }); -}); -</script> \ No newline at end of file diff --git a/plugins/textviewer/syntaxhighlighter/tests/cases/014_legacy.html b/plugins/textviewer/syntaxhighlighter/tests/cases/014_legacy.html deleted file mode 100644 index eb4343e2c2d6790f676cc2291338d8e304f4716b..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/tests/cases/014_legacy.html +++ /dev/null @@ -1,70 +0,0 @@ -<pre id="sh_014_legacy_a" name="code" class="plain">basic check</pre> -<pre id="sh_014_legacy_b" name="code" class="plain:nocontrols">no toolbar</pre> -<pre id="sh_014_legacy_c" name="code" class="plain:nogutter">no gutter</pre> -<pre id="sh_014_legacy_d" name="code" class="plain:collapse">collapsed</pre> -<pre id="sh_014_legacy_e" name="code" class="plain:firstline[10]">first line</pre> - -<script type="text/javascript"> -queue(function() -{ - var $sh; - - dp.SyntaxHighlighter.HighlightAll('code'); - - module('014_legacy'); - - test('basic check', function() - { - $sh = $('#sh_014_legacy_a'); - - ok_sh($sh); - ok_toolbar($sh); - ok_code($sh); - }); - - test('no toolbar', function() - { - $sh = $('#sh_014_legacy_b'); - - ok_sh($sh); - ok_code($sh); - ok($sh.find('> .syntaxhighlighter > .toolbar').length == 0, 'Toolbar not present'); - }); - - test('no gutter', function() - { - $sh = $('#sh_014_legacy_c'); - - ok_sh($sh); - ok_toolbar($sh); - ok_code($sh); - - ok($sh.find('> .syntaxhighlighter.nogutter').length == 1, '.nogutter present'); - ok($sh.find('> .syntaxhighlighter > table > tbody > tr > .gutter').length == 0, 'Gutter not present'); - }); - - test('collapsed check', function() - { - $sh = $('#sh_014_legacy_d'); - - ok_sh($sh); - ok_toolbar($sh); - ok_collapsed($sh); - - var $title = $sh.find('.toolbar a.toolbar_item.command_expandSource'); - ok($title.length == 1, 'Expand present'); - equal($title.text(), SyntaxHighlighter.config.strings.expandSource, 'Expand text'); - }); - - test('first line check', function() - { - $sh = $('#sh_014_legacy_e'); - - ok_sh($sh); - ok_toolbar($sh); - ok_gutter($sh); - ok_code($sh); - equals($sh.find('.gutter .index0').text(), '10', 'First line'); - }); -}); -</script> diff --git a/plugins/textviewer/syntaxhighlighter/tests/commonjs_tests.js b/plugins/textviewer/syntaxhighlighter/tests/commonjs_tests.js deleted file mode 100644 index cda8162ebcf809da05bf43b07bfc26feae336125..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/tests/commonjs_tests.js +++ /dev/null @@ -1,52 +0,0 @@ -/** - * This is a CommonJS compatibility test. You can run this file with node. - */ -require.paths.unshift(__dirname + '/../scripts'); - -var sys = require('sys'), - shSyntaxHighlighter = require('shCore').SyntaxHighlighter, - code = 'test', - brushes = [ - 'AS3', - 'AppleScript', - 'Bash', - 'CSharp', - 'ColdFusion', - 'Cpp', - 'Css', - 'Delphi', - 'Diff', - 'Erlang', - 'Groovy', - 'JScript', - 'Java', - 'JavaFX', - 'Perl', - 'Php', - 'Plain', - 'PowerShell', - 'Python', - 'Ruby', - 'Sass', - 'Scala', - 'Sql', - 'Vb', - 'Xml' - ] - ; - -brushes.sort(); - -for (var i = 0; i < brushes.length; i++) -{ - var name = brushes[i], - brush = require('shBrush' + name).Brush - ; - - brush = new brush(); - brush.init({ toolbar: false }); - - var result = brush.getHtml(code); - - sys.puts(name + (result != null ? ': ok' : ': NOT OK')); -} diff --git a/plugins/textviewer/syntaxhighlighter/tests/js/jquery-1.4.2.js b/plugins/textviewer/syntaxhighlighter/tests/js/jquery-1.4.2.js deleted file mode 100644 index e414a7ecb012a21ce02eef24a4045ac47c44fcaa..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/tests/js/jquery-1.4.2.js +++ /dev/null @@ -1,6240 +0,0 @@ -/*! - * jQuery JavaScript Library v1.4.2 - * http://jquery.com/ - * - * Copyright 2010, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2010, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Sat Feb 13 22:33:48 2010 -0500 - */ -(function( window, undefined ) { - -// Define a local copy of jQuery -var jQuery = function( selector, context ) { - // The jQuery object is actually just the init constructor 'enhanced' - return new jQuery.fn.init( selector, context ); - }, - - // Map over jQuery in case of overwrite - _jQuery = window.jQuery, - - // Map over the $ in case of overwrite - _$ = window.$, - - // Use the correct document accordingly with window argument (sandbox) - document = window.document, - - // A central reference to the root jQuery(document) - rootjQuery, - - // A simple way to check for HTML strings or ID strings - // (both of which we optimize for) - quickExpr = /^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/, - - // Is it a simple selector - isSimple = /^.[^:#\[\.,]*$/, - - // Check if a string has a non-whitespace character in it - rnotwhite = /\S/, - - // Used for trimming whitespace - rtrim = /^(\s|\u00A0)+|(\s|\u00A0)+$/g, - - // Match a standalone tag - rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, - - // Keep a UserAgent string for use with jQuery.browser - userAgent = navigator.userAgent, - - // For matching the engine and version of the browser - browserMatch, - - // Has the ready events already been bound? - readyBound = false, - - // The functions to execute on DOM ready - readyList = [], - - // The ready event handler - DOMContentLoaded, - - // Save a reference to some core methods - toString = Object.prototype.toString, - hasOwnProperty = Object.prototype.hasOwnProperty, - push = Array.prototype.push, - slice = Array.prototype.slice, - indexOf = Array.prototype.indexOf; - -jQuery.fn = jQuery.prototype = { - init: function( selector, context ) { - var match, elem, ret, doc; - - // Handle $(""), $(null), or $(undefined) - if ( !selector ) { - return this; - } - - // Handle $(DOMElement) - if ( selector.nodeType ) { - this.context = this[0] = selector; - this.length = 1; - return this; - } - - // The body element only exists once, optimize finding it - if ( selector === "body" && !context ) { - this.context = document; - this[0] = document.body; - this.selector = "body"; - this.length = 1; - return this; - } - - // Handle HTML strings - if ( typeof selector === "string" ) { - // Are we dealing with HTML string or an ID? - match = quickExpr.exec( selector ); - - // Verify a match, and that no context was specified for #id - if ( match && (match[1] || !context) ) { - - // HANDLE: $(html) -> $(array) - if ( match[1] ) { - doc = (context ? context.ownerDocument || context : document); - - // If a single string is passed in and it's a single tag - // just do a createElement and skip the rest - ret = rsingleTag.exec( selector ); - - if ( ret ) { - if ( jQuery.isPlainObject( context ) ) { - selector = [ document.createElement( ret[1] ) ]; - jQuery.fn.attr.call( selector, context, true ); - - } else { - selector = [ doc.createElement( ret[1] ) ]; - } - - } else { - ret = buildFragment( [ match[1] ], [ doc ] ); - selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes; - } - - return jQuery.merge( this, selector ); - - // HANDLE: $("#id") - } else { - elem = document.getElementById( match[2] ); - - if ( elem ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id !== match[2] ) { - return rootjQuery.find( selector ); - } - - // Otherwise, we inject the element directly into the jQuery object - this.length = 1; - this[0] = elem; - } - - this.context = document; - this.selector = selector; - return this; - } - - // HANDLE: $("TAG") - } else if ( !context && /^\w+$/.test( selector ) ) { - this.selector = selector; - this.context = document; - selector = document.getElementsByTagName( selector ); - return jQuery.merge( this, selector ); - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return (context || rootjQuery).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return jQuery( context ).find( selector ); - } - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) { - return rootjQuery.ready( selector ); - } - - if (selector.selector !== undefined) { - this.selector = selector.selector; - this.context = selector.context; - } - - return jQuery.makeArray( selector, this ); - }, - - // Start with an empty selector - selector: "", - - // The current version of jQuery being used - jquery: "1.4.2", - - // The default length of a jQuery object is 0 - length: 0, - - // The number of elements contained in the matched element set - size: function() { - return this.length; - }, - - toArray: function() { - return slice.call( this, 0 ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - return num == null ? - - // Return a 'clean' array - this.toArray() : - - // Return just the object - ( num < 0 ? this.slice(num)[ 0 ] : this[ num ] ); - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems, name, selector ) { - // Build a new jQuery matched element set - var ret = jQuery(); - - if ( jQuery.isArray( elems ) ) { - push.apply( ret, elems ); - - } else { - jQuery.merge( ret, elems ); - } - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - - ret.context = this.context; - - if ( name === "find" ) { - ret.selector = this.selector + (this.selector ? " " : "") + selector; - } else if ( name ) { - ret.selector = this.selector + "." + name + "(" + selector + ")"; - } - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - // (You can seed the arguments with an array of args, but this is - // only used internally.) - each: function( callback, args ) { - return jQuery.each( this, callback, args ); - }, - - ready: function( fn ) { - // Attach the listeners - jQuery.bindReady(); - - // If the DOM is already ready - if ( jQuery.isReady ) { - // Execute the function immediately - fn.call( document, jQuery ); - - // Otherwise, remember the function for later - } else if ( readyList ) { - // Add the function to the wait list - readyList.push( fn ); - } - - return this; - }, - - eq: function( i ) { - return i === -1 ? - this.slice( i ) : - this.slice( i, +i + 1 ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - slice: function() { - return this.pushStack( slice.apply( this, arguments ), - "slice", slice.call(arguments).join(",") ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map(this, function( elem, i ) { - return callback.call( elem, i, elem ); - })); - }, - - end: function() { - return this.prevObject || jQuery(null); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: push, - sort: [].sort, - splice: [].splice -}; - -// Give the init function the jQuery prototype for later instantiation -jQuery.fn.init.prototype = jQuery.fn; - -jQuery.extend = jQuery.fn.extend = function() { - // copy reference to target object - var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options, name, src, copy; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction(target) ) { - target = {}; - } - - // extend jQuery itself if only one argument is passed - if ( length === i ) { - target = this; - --i; - } - - for ( ; i < length; i++ ) { - // Only deal with non-null/undefined values - if ( (options = arguments[ i ]) != null ) { - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - - // Recurse if we're merging object literal values or arrays - if ( deep && copy && ( jQuery.isPlainObject(copy) || jQuery.isArray(copy) ) ) { - var clone = src && ( jQuery.isPlainObject(src) || jQuery.isArray(src) ) ? src - : jQuery.isArray(copy) ? [] : {}; - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend({ - noConflict: function( deep ) { - window.$ = _$; - - if ( deep ) { - window.jQuery = _jQuery; - } - - return jQuery; - }, - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // Handle when the DOM is ready - ready: function() { - // Make sure that the DOM is not already loaded - if ( !jQuery.isReady ) { - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( !document.body ) { - return setTimeout( jQuery.ready, 13 ); - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If there are functions bound, to execute - if ( readyList ) { - // Execute all of them - var fn, i = 0; - while ( (fn = readyList[ i++ ]) ) { - fn.call( document, jQuery ); - } - - // Reset the list of functions - readyList = null; - } - - // Trigger any bound ready events - if ( jQuery.fn.triggerHandler ) { - jQuery( document ).triggerHandler( "ready" ); - } - } - }, - - bindReady: function() { - if ( readyBound ) { - return; - } - - readyBound = true; - - // Catch cases where $(document).ready() is called after the - // browser event has already occurred. - if ( document.readyState === "complete" ) { - return jQuery.ready(); - } - - // Mozilla, Opera and webkit nightlies currently support this event - if ( document.addEventListener ) { - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", jQuery.ready, false ); - - // If IE event model is used - } else if ( document.attachEvent ) { - // ensure firing before onload, - // maybe late but safe also for iframes - document.attachEvent("onreadystatechange", DOMContentLoaded); - - // A fallback to window.onload, that will always work - window.attachEvent( "onload", jQuery.ready ); - - // If IE and not a frame - // continually check to see if the document is ready - var toplevel = false; - - try { - toplevel = window.frameElement == null; - } catch(e) {} - - if ( document.documentElement.doScroll && toplevel ) { - doScrollCheck(); - } - } - }, - - // See test/unit/core.js for details concerning isFunction. - // Since version 1.3, DOM methods and functions like alert - // aren't supported. They return false on IE (#2968). - isFunction: function( obj ) { - return toString.call(obj) === "[object Function]"; - }, - - isArray: function( obj ) { - return toString.call(obj) === "[object Array]"; - }, - - isPlainObject: function( obj ) { - // Must be an Object. - // Because of IE, we also have to check the presence of the constructor property. - // Make sure that DOM nodes and window objects don't pass through, as well - if ( !obj || toString.call(obj) !== "[object Object]" || obj.nodeType || obj.setInterval ) { - return false; - } - - // Not own constructor property must be Object - if ( obj.constructor - && !hasOwnProperty.call(obj, "constructor") - && !hasOwnProperty.call(obj.constructor.prototype, "isPrototypeOf") ) { - return false; - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - - var key; - for ( key in obj ) {} - - return key === undefined || hasOwnProperty.call( obj, key ); - }, - - isEmptyObject: function( obj ) { - for ( var name in obj ) { - return false; - } - return true; - }, - - error: function( msg ) { - throw msg; - }, - - parseJSON: function( data ) { - if ( typeof data !== "string" || !data ) { - return null; - } - - // Make sure leading/trailing whitespace is removed (IE can't handle it) - data = jQuery.trim( data ); - - // Make sure the incoming data is actual JSON - // Logic borrowed from http://json.org/json2.js - if ( /^[\],:{}\s]*$/.test(data.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@") - .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]") - .replace(/(?:^|:|,)(?:\s*\[)+/g, "")) ) { - - // Try to use the native JSON parser first - return window.JSON && window.JSON.parse ? - window.JSON.parse( data ) : - (new Function("return " + data))(); - - } else { - jQuery.error( "Invalid JSON: " + data ); - } - }, - - noop: function() {}, - - // Evalulates a script in a global context - globalEval: function( data ) { - if ( data && rnotwhite.test(data) ) { - // Inspired by code by Andrea Giammarchi - // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html - var head = document.getElementsByTagName("head")[0] || document.documentElement, - script = document.createElement("script"); - - script.type = "text/javascript"; - - if ( jQuery.support.scriptEval ) { - script.appendChild( document.createTextNode( data ) ); - } else { - script.text = data; - } - - // Use insertBefore instead of appendChild to circumvent an IE6 bug. - // This arises when a base node is used (#2709). - head.insertBefore( script, head.firstChild ); - head.removeChild( script ); - } - }, - - nodeName: function( elem, name ) { - return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); - }, - - // args is for internal usage only - each: function( object, callback, args ) { - var name, i = 0, - length = object.length, - isObj = length === undefined || jQuery.isFunction(object); - - if ( args ) { - if ( isObj ) { - for ( name in object ) { - if ( callback.apply( object[ name ], args ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.apply( object[ i++ ], args ) === false ) { - break; - } - } - } - - // A special, fast, case for the most common use of each - } else { - if ( isObj ) { - for ( name in object ) { - if ( callback.call( object[ name ], name, object[ name ] ) === false ) { - break; - } - } - } else { - for ( var value = object[0]; - i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {} - } - } - - return object; - }, - - trim: function( text ) { - return (text || "").replace( rtrim, "" ); - }, - - // results is for internal usage only - makeArray: function( array, results ) { - var ret = results || []; - - if ( array != null ) { - // The window, strings (and functions) also have 'length' - // The extra typeof function check is to prevent crashes - // in Safari 2 (See: #3039) - if ( array.length == null || typeof array === "string" || jQuery.isFunction(array) || (typeof array !== "function" && array.setInterval) ) { - push.call( ret, array ); - } else { - jQuery.merge( ret, array ); - } - } - - return ret; - }, - - inArray: function( elem, array ) { - if ( array.indexOf ) { - return array.indexOf( elem ); - } - - for ( var i = 0, length = array.length; i < length; i++ ) { - if ( array[ i ] === elem ) { - return i; - } - } - - return -1; - }, - - merge: function( first, second ) { - var i = first.length, j = 0; - - if ( typeof second.length === "number" ) { - for ( var l = second.length; j < l; j++ ) { - first[ i++ ] = second[ j ]; - } - - } else { - while ( second[j] !== undefined ) { - first[ i++ ] = second[ j++ ]; - } - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, inv ) { - var ret = []; - - // Go through the array, only saving the items - // that pass the validator function - for ( var i = 0, length = elems.length; i < length; i++ ) { - if ( !inv !== !callback( elems[ i ], i ) ) { - ret.push( elems[ i ] ); - } - } - - return ret; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var ret = [], value; - - // Go through the array, translating each of the items to their - // new value (or values). - for ( var i = 0, length = elems.length; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - - return ret.concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - proxy: function( fn, proxy, thisObject ) { - if ( arguments.length === 2 ) { - if ( typeof proxy === "string" ) { - thisObject = fn; - fn = thisObject[ proxy ]; - proxy = undefined; - - } else if ( proxy && !jQuery.isFunction( proxy ) ) { - thisObject = proxy; - proxy = undefined; - } - } - - if ( !proxy && fn ) { - proxy = function() { - return fn.apply( thisObject || this, arguments ); - }; - } - - // Set the guid of unique handler to the same of original handler, so it can be removed - if ( fn ) { - proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; - } - - // So proxy can be declared as an argument - return proxy; - }, - - // Use of jQuery.browser is frowned upon. - // More details: http://docs.jquery.com/Utilities/jQuery.browser - uaMatch: function( ua ) { - ua = ua.toLowerCase(); - - var match = /(webkit)[ \/]([\w.]+)/.exec( ua ) || - /(opera)(?:.*version)?[ \/]([\w.]+)/.exec( ua ) || - /(msie) ([\w.]+)/.exec( ua ) || - !/compatible/.test( ua ) && /(mozilla)(?:.*? rv:([\w.]+))?/.exec( ua ) || - []; - - return { browser: match[1] || "", version: match[2] || "0" }; - }, - - browser: {} -}); - -browserMatch = jQuery.uaMatch( userAgent ); -if ( browserMatch.browser ) { - jQuery.browser[ browserMatch.browser ] = true; - jQuery.browser.version = browserMatch.version; -} - -// Deprecated, use jQuery.browser.webkit instead -if ( jQuery.browser.webkit ) { - jQuery.browser.safari = true; -} - -if ( indexOf ) { - jQuery.inArray = function( elem, array ) { - return indexOf.call( array, elem ); - }; -} - -// All jQuery objects should point back to these -rootjQuery = jQuery(document); - -// Cleanup functions for the document ready method -if ( document.addEventListener ) { - DOMContentLoaded = function() { - document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - jQuery.ready(); - }; - -} else if ( document.attachEvent ) { - DOMContentLoaded = function() { - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( document.readyState === "complete" ) { - document.detachEvent( "onreadystatechange", DOMContentLoaded ); - jQuery.ready(); - } - }; -} - -// The DOM ready check for Internet Explorer -function doScrollCheck() { - if ( jQuery.isReady ) { - return; - } - - try { - // If IE is used, use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ - document.documentElement.doScroll("left"); - } catch( error ) { - setTimeout( doScrollCheck, 1 ); - return; - } - - // and execute any waiting functions - jQuery.ready(); -} - -function evalScript( i, elem ) { - if ( elem.src ) { - jQuery.ajax({ - url: elem.src, - async: false, - dataType: "script" - }); - } else { - jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); - } - - if ( elem.parentNode ) { - elem.parentNode.removeChild( elem ); - } -} - -// Mutifunctional method to get and set values to a collection -// The value/s can be optionally by executed if its a function -function access( elems, key, value, exec, fn, pass ) { - var length = elems.length; - - // Setting many attributes - if ( typeof key === "object" ) { - for ( var k in key ) { - access( elems, k, key[k], exec, fn, value ); - } - return elems; - } - - // Setting one attribute - if ( value !== undefined ) { - // Optionally, function values get executed if exec is true - exec = !pass && exec && jQuery.isFunction(value); - - for ( var i = 0; i < length; i++ ) { - fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); - } - - return elems; - } - - // Getting an attribute - return length ? fn( elems[0], key ) : undefined; -} - -function now() { - return (new Date).getTime(); -} -(function() { - - jQuery.support = {}; - - var root = document.documentElement, - script = document.createElement("script"), - div = document.createElement("div"), - id = "script" + now(); - - div.style.display = "none"; - div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>"; - - var all = div.getElementsByTagName("*"), - a = div.getElementsByTagName("a")[0]; - - // Can't get basic test support - if ( !all || !all.length || !a ) { - return; - } - - jQuery.support = { - // IE strips leading whitespace when .innerHTML is used - leadingWhitespace: div.firstChild.nodeType === 3, - - // Make sure that tbody elements aren't automatically inserted - // IE will insert them into empty tables - tbody: !div.getElementsByTagName("tbody").length, - - // Make sure that link elements get serialized correctly by innerHTML - // This requires a wrapper element in IE - htmlSerialize: !!div.getElementsByTagName("link").length, - - // Get the style information from getAttribute - // (IE uses .cssText insted) - style: /red/.test( a.getAttribute("style") ), - - // Make sure that URLs aren't manipulated - // (IE normalizes it by default) - hrefNormalized: a.getAttribute("href") === "/a", - - // Make sure that element opacity exists - // (IE uses filter instead) - // Use a regex to work around a WebKit issue. See #5145 - opacity: /^0.55$/.test( a.style.opacity ), - - // Verify style float existence - // (IE uses styleFloat instead of cssFloat) - cssFloat: !!a.style.cssFloat, - - // Make sure that if no value is specified for a checkbox - // that it defaults to "on". - // (WebKit defaults to "" instead) - checkOn: div.getElementsByTagName("input")[0].value === "on", - - // Make sure that a selected-by-default option has a working selected property. - // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) - optSelected: document.createElement("select").appendChild( document.createElement("option") ).selected, - - parentNode: div.removeChild( div.appendChild( document.createElement("div") ) ).parentNode === null, - - // Will be defined later - deleteExpando: true, - checkClone: false, - scriptEval: false, - noCloneEvent: true, - boxModel: null - }; - - script.type = "text/javascript"; - try { - script.appendChild( document.createTextNode( "window." + id + "=1;" ) ); - } catch(e) {} - - root.insertBefore( script, root.firstChild ); - - // Make sure that the execution of code works by injecting a script - // tag with appendChild/createTextNode - // (IE doesn't support this, fails, and uses .text instead) - if ( window[ id ] ) { - jQuery.support.scriptEval = true; - delete window[ id ]; - } - - // Test to see if it's possible to delete an expando from an element - // Fails in Internet Explorer - try { - delete script.test; - - } catch(e) { - jQuery.support.deleteExpando = false; - } - - root.removeChild( script ); - - if ( div.attachEvent && div.fireEvent ) { - div.attachEvent("onclick", function click() { - // Cloning a node shouldn't copy over any - // bound event handlers (IE does this) - jQuery.support.noCloneEvent = false; - div.detachEvent("onclick", click); - }); - div.cloneNode(true).fireEvent("onclick"); - } - - div = document.createElement("div"); - div.innerHTML = "<input type='radio' name='radiotest' checked='checked'/>"; - - var fragment = document.createDocumentFragment(); - fragment.appendChild( div.firstChild ); - - // WebKit doesn't clone checked state correctly in fragments - jQuery.support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked; - - // Figure out if the W3C box model works as expected - // document.body must exist before we can do this - jQuery(function() { - var div = document.createElement("div"); - div.style.width = div.style.paddingLeft = "1px"; - - document.body.appendChild( div ); - jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2; - document.body.removeChild( div ).style.display = 'none'; - - div = null; - }); - - // Technique from Juriy Zaytsev - // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/ - var eventSupported = function( eventName ) { - var el = document.createElement("div"); - eventName = "on" + eventName; - - var isSupported = (eventName in el); - if ( !isSupported ) { - el.setAttribute(eventName, "return;"); - isSupported = typeof el[eventName] === "function"; - } - el = null; - - return isSupported; - }; - - jQuery.support.submitBubbles = eventSupported("submit"); - jQuery.support.changeBubbles = eventSupported("change"); - - // release memory in IE - root = script = div = all = a = null; -})(); - -jQuery.props = { - "for": "htmlFor", - "class": "className", - readonly: "readOnly", - maxlength: "maxLength", - cellspacing: "cellSpacing", - rowspan: "rowSpan", - colspan: "colSpan", - tabindex: "tabIndex", - usemap: "useMap", - frameborder: "frameBorder" -}; -var expando = "jQuery" + now(), uuid = 0, windowData = {}; - -jQuery.extend({ - cache: {}, - - expando:expando, - - // The following elements throw uncatchable exceptions if you - // attempt to add expando properties to them. - noData: { - "embed": true, - "object": true, - "applet": true - }, - - data: function( elem, name, data ) { - if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) { - return; - } - - elem = elem == window ? - windowData : - elem; - - var id = elem[ expando ], cache = jQuery.cache, thisCache; - - if ( !id && typeof name === "string" && data === undefined ) { - return null; - } - - // Compute a unique ID for the element - if ( !id ) { - id = ++uuid; - } - - // Avoid generating a new cache unless none exists and we - // want to manipulate it. - if ( typeof name === "object" ) { - elem[ expando ] = id; - thisCache = cache[ id ] = jQuery.extend(true, {}, name); - - } else if ( !cache[ id ] ) { - elem[ expando ] = id; - cache[ id ] = {}; - } - - thisCache = cache[ id ]; - - // Prevent overriding the named cache with undefined values - if ( data !== undefined ) { - thisCache[ name ] = data; - } - - return typeof name === "string" ? thisCache[ name ] : thisCache; - }, - - removeData: function( elem, name ) { - if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) { - return; - } - - elem = elem == window ? - windowData : - elem; - - var id = elem[ expando ], cache = jQuery.cache, thisCache = cache[ id ]; - - // If we want to remove a specific section of the element's data - if ( name ) { - if ( thisCache ) { - // Remove the section of cache data - delete thisCache[ name ]; - - // If we've removed all the data, remove the element's cache - if ( jQuery.isEmptyObject(thisCache) ) { - jQuery.removeData( elem ); - } - } - - // Otherwise, we want to remove all of the element's data - } else { - if ( jQuery.support.deleteExpando ) { - delete elem[ jQuery.expando ]; - - } else if ( elem.removeAttribute ) { - elem.removeAttribute( jQuery.expando ); - } - - // Completely remove the data cache - delete cache[ id ]; - } - } -}); - -jQuery.fn.extend({ - data: function( key, value ) { - if ( typeof key === "undefined" && this.length ) { - return jQuery.data( this[0] ); - - } else if ( typeof key === "object" ) { - return this.each(function() { - jQuery.data( this, key ); - }); - } - - var parts = key.split("."); - parts[1] = parts[1] ? "." + parts[1] : ""; - - if ( value === undefined ) { - var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); - - if ( data === undefined && this.length ) { - data = jQuery.data( this[0], key ); - } - return data === undefined && parts[1] ? - this.data( parts[0] ) : - data; - } else { - return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function() { - jQuery.data( this, key, value ); - }); - } - }, - - removeData: function( key ) { - return this.each(function() { - jQuery.removeData( this, key ); - }); - } -}); -jQuery.extend({ - queue: function( elem, type, data ) { - if ( !elem ) { - return; - } - - type = (type || "fx") + "queue"; - var q = jQuery.data( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( !data ) { - return q || []; - } - - if ( !q || jQuery.isArray(data) ) { - q = jQuery.data( elem, type, jQuery.makeArray(data) ); - - } else { - q.push( data ); - } - - return q; - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), fn = queue.shift(); - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - } - - if ( fn ) { - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift("inprogress"); - } - - fn.call(elem, function() { - jQuery.dequeue(elem, type); - }); - } - } -}); - -jQuery.fn.extend({ - queue: function( type, data ) { - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - } - - if ( data === undefined ) { - return jQuery.queue( this[0], type ); - } - return this.each(function( i, elem ) { - var queue = jQuery.queue( this, type, data ); - - if ( type === "fx" && queue[0] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - }); - }, - dequeue: function( type ) { - return this.each(function() { - jQuery.dequeue( this, type ); - }); - }, - - // Based off of the plugin by Clint Helfers, with permission. - // http://blindsignals.com/index.php/2009/07/jquery-delay/ - delay: function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[time] || time : time; - type = type || "fx"; - - return this.queue( type, function() { - var elem = this; - setTimeout(function() { - jQuery.dequeue( elem, type ); - }, time ); - }); - }, - - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - } -}); -var rclass = /[\n\t]/g, - rspace = /\s+/, - rreturn = /\r/g, - rspecialurl = /href|src|style/, - rtype = /(button|input)/i, - rfocusable = /(button|input|object|select|textarea)/i, - rclickable = /^(a|area)$/i, - rradiocheck = /radio|checkbox/; - -jQuery.fn.extend({ - attr: function( name, value ) { - return access( this, name, value, true, jQuery.attr ); - }, - - removeAttr: function( name, fn ) { - return this.each(function(){ - jQuery.attr( this, name, "" ); - if ( this.nodeType === 1 ) { - this.removeAttribute( name ); - } - }); - }, - - addClass: function( value ) { - if ( jQuery.isFunction(value) ) { - return this.each(function(i) { - var self = jQuery(this); - self.addClass( value.call(this, i, self.attr("class")) ); - }); - } - - if ( value && typeof value === "string" ) { - var classNames = (value || "").split( rspace ); - - for ( var i = 0, l = this.length; i < l; i++ ) { - var elem = this[i]; - - if ( elem.nodeType === 1 ) { - if ( !elem.className ) { - elem.className = value; - - } else { - var className = " " + elem.className + " ", setClass = elem.className; - for ( var c = 0, cl = classNames.length; c < cl; c++ ) { - if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) { - setClass += " " + classNames[c]; - } - } - elem.className = jQuery.trim( setClass ); - } - } - } - } - - return this; - }, - - removeClass: function( value ) { - if ( jQuery.isFunction(value) ) { - return this.each(function(i) { - var self = jQuery(this); - self.removeClass( value.call(this, i, self.attr("class")) ); - }); - } - - if ( (value && typeof value === "string") || value === undefined ) { - var classNames = (value || "").split(rspace); - - for ( var i = 0, l = this.length; i < l; i++ ) { - var elem = this[i]; - - if ( elem.nodeType === 1 && elem.className ) { - if ( value ) { - var className = (" " + elem.className + " ").replace(rclass, " "); - for ( var c = 0, cl = classNames.length; c < cl; c++ ) { - className = className.replace(" " + classNames[c] + " ", " "); - } - elem.className = jQuery.trim( className ); - - } else { - elem.className = ""; - } - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value, isBool = typeof stateVal === "boolean"; - - if ( jQuery.isFunction( value ) ) { - return this.each(function(i) { - var self = jQuery(this); - self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal ); - }); - } - - return this.each(function() { - if ( type === "string" ) { - // toggle individual class names - var className, i = 0, self = jQuery(this), - state = stateVal, - classNames = value.split( rspace ); - - while ( (className = classNames[ i++ ]) ) { - // check each className given, space seperated list - state = isBool ? state : !self.hasClass( className ); - self[ state ? "addClass" : "removeClass" ]( className ); - } - - } else if ( type === "undefined" || type === "boolean" ) { - if ( this.className ) { - // store className if set - jQuery.data( this, "__className__", this.className ); - } - - // toggle whole className - this.className = this.className || value === false ? "" : jQuery.data( this, "__className__" ) || ""; - } - }); - }, - - hasClass: function( selector ) { - var className = " " + selector + " "; - for ( var i = 0, l = this.length; i < l; i++ ) { - if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { - return true; - } - } - - return false; - }, - - val: function( value ) { - if ( value === undefined ) { - var elem = this[0]; - - if ( elem ) { - if ( jQuery.nodeName( elem, "option" ) ) { - return (elem.attributes.value || {}).specified ? elem.value : elem.text; - } - - // We need to handle select boxes special - if ( jQuery.nodeName( elem, "select" ) ) { - var index = elem.selectedIndex, - values = [], - options = elem.options, - one = elem.type === "select-one"; - - // Nothing was selected - if ( index < 0 ) { - return null; - } - - // Loop through all the selected options - for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { - var option = options[ i ]; - - if ( option.selected ) { - // Get the specifc value for the option - value = jQuery(option).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - return values; - } - - // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified - if ( rradiocheck.test( elem.type ) && !jQuery.support.checkOn ) { - return elem.getAttribute("value") === null ? "on" : elem.value; - } - - - // Everything else, we just grab the value - return (elem.value || "").replace(rreturn, ""); - - } - - return undefined; - } - - var isFunction = jQuery.isFunction(value); - - return this.each(function(i) { - var self = jQuery(this), val = value; - - if ( this.nodeType !== 1 ) { - return; - } - - if ( isFunction ) { - val = value.call(this, i, self.val()); - } - - // Typecast each time if the value is a Function and the appended - // value is therefore different each time. - if ( typeof val === "number" ) { - val += ""; - } - - if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) { - this.checked = jQuery.inArray( self.val(), val ) >= 0; - - } else if ( jQuery.nodeName( this, "select" ) ) { - var values = jQuery.makeArray(val); - - jQuery( "option", this ).each(function() { - this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; - }); - - if ( !values.length ) { - this.selectedIndex = -1; - } - - } else { - this.value = val; - } - }); - } -}); - -jQuery.extend({ - attrFn: { - val: true, - css: true, - html: true, - text: true, - data: true, - width: true, - height: true, - offset: true - }, - - attr: function( elem, name, value, pass ) { - // don't set attributes on text and comment nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) { - return undefined; - } - - if ( pass && name in jQuery.attrFn ) { - return jQuery(elem)[name](value); - } - - var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ), - // Whether we are setting (or getting) - set = value !== undefined; - - // Try to normalize/fix the name - name = notxml && jQuery.props[ name ] || name; - - // Only do all the following if this is a node (faster for style) - if ( elem.nodeType === 1 ) { - // These attributes require special treatment - var special = rspecialurl.test( name ); - - // Safari mis-reports the default selected property of an option - // Accessing the parent's selectedIndex property fixes it - if ( name === "selected" && !jQuery.support.optSelected ) { - var parent = elem.parentNode; - if ( parent ) { - parent.selectedIndex; - - // Make sure that it also works with optgroups, see #5701 - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - } - - // If applicable, access the attribute via the DOM 0 way - if ( name in elem && notxml && !special ) { - if ( set ) { - // We can't allow the type property to be changed (since it causes problems in IE) - if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) { - jQuery.error( "type property can't be changed" ); - } - - elem[ name ] = value; - } - - // browsers index elements by id/name on forms, give priority to attributes. - if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) { - return elem.getAttributeNode( name ).nodeValue; - } - - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - if ( name === "tabIndex" ) { - var attributeNode = elem.getAttributeNode( "tabIndex" ); - - return attributeNode && attributeNode.specified ? - attributeNode.value : - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? - 0 : - undefined; - } - - return elem[ name ]; - } - - if ( !jQuery.support.style && notxml && name === "style" ) { - if ( set ) { - elem.style.cssText = "" + value; - } - - return elem.style.cssText; - } - - if ( set ) { - // convert the value to a string (all browsers do this but IE) see #1070 - elem.setAttribute( name, "" + value ); - } - - var attr = !jQuery.support.hrefNormalized && notxml && special ? - // Some attributes require a special call on IE - elem.getAttribute( name, 2 ) : - elem.getAttribute( name ); - - // Non-existent attributes return null, we normalize to undefined - return attr === null ? undefined : attr; - } - - // elem is actually elem.style ... set the style - // Using attr for specific style information is now deprecated. Use style instead. - return jQuery.style( elem, name, value ); - } -}); -var rnamespaces = /\.(.*)$/, - fcleanup = function( nm ) { - return nm.replace(/[^\w\s\.\|`]/g, function( ch ) { - return "\\" + ch; - }); - }; - -/* - * A number of helper functions used for managing events. - * Many of the ideas behind this code originated from - * Dean Edwards' addEvent library. - */ -jQuery.event = { - - // Bind an event to an element - // Original by Dean Edwards - add: function( elem, types, handler, data ) { - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { - return; - } - - // For whatever reason, IE has trouble passing the window object - // around, causing it to be cloned in the process - if ( elem.setInterval && ( elem !== window && !elem.frameElement ) ) { - elem = window; - } - - var handleObjIn, handleObj; - - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - } - - // Make sure that the function being executed has a unique ID - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure - var elemData = jQuery.data( elem ); - - // If no elemData is found then we must be trying to bind to one of the - // banned noData elements - if ( !elemData ) { - return; - } - - var events = elemData.events = elemData.events || {}, - eventHandle = elemData.handle, eventHandle; - - if ( !eventHandle ) { - elemData.handle = eventHandle = function() { - // Handle the second event of a trigger and when - // an event is called after a page has unloaded - return typeof jQuery !== "undefined" && !jQuery.event.triggered ? - jQuery.event.handle.apply( eventHandle.elem, arguments ) : - undefined; - }; - } - - // Add elem as a property of the handle function - // This is to prevent a memory leak with non-native events in IE. - eventHandle.elem = elem; - - // Handle multiple events separated by a space - // jQuery(...).bind("mouseover mouseout", fn); - types = types.split(" "); - - var type, i = 0, namespaces; - - while ( (type = types[ i++ ]) ) { - handleObj = handleObjIn ? - jQuery.extend({}, handleObjIn) : - { handler: handler, data: data }; - - // Namespaced event handlers - if ( type.indexOf(".") > -1 ) { - namespaces = type.split("."); - type = namespaces.shift(); - handleObj.namespace = namespaces.slice(0).sort().join("."); - - } else { - namespaces = []; - handleObj.namespace = ""; - } - - handleObj.type = type; - handleObj.guid = handler.guid; - - // Get the current list of functions bound to this event - var handlers = events[ type ], - special = jQuery.event.special[ type ] || {}; - - // Init the event handler queue - if ( !handlers ) { - handlers = events[ type ] = []; - - // Check for a special event handler - // Only use addEventListener/attachEvent if the special - // events handler returns false - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - // Bind the global event handler to the element - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle, false ); - - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add the function to the element's handler list - handlers.push( handleObj ); - - // Keep track of which events have been used, for global triggering - jQuery.event.global[ type ] = true; - } - - // Nullify elem to prevent memory leaks in IE - elem = null; - }, - - global: {}, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, pos ) { - // don't do events on text and comment nodes - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { - return; - } - - var ret, type, fn, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType, - elemData = jQuery.data( elem ), - events = elemData && elemData.events; - - if ( !elemData || !events ) { - return; - } - - // types is actually an event object here - if ( types && types.type ) { - handler = types.handler; - types = types.type; - } - - // Unbind all events for the element - if ( !types || typeof types === "string" && types.charAt(0) === "." ) { - types = types || ""; - - for ( type in events ) { - jQuery.event.remove( elem, type + types ); - } - - return; - } - - // Handle multiple events separated by a space - // jQuery(...).unbind("mouseover mouseout", fn); - types = types.split(" "); - - while ( (type = types[ i++ ]) ) { - origType = type; - handleObj = null; - all = type.indexOf(".") < 0; - namespaces = []; - - if ( !all ) { - // Namespaced event handlers - namespaces = type.split("."); - type = namespaces.shift(); - - namespace = new RegExp("(^|\\.)" + - jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)") - } - - eventType = events[ type ]; - - if ( !eventType ) { - continue; - } - - if ( !handler ) { - for ( var j = 0; j < eventType.length; j++ ) { - handleObj = eventType[ j ]; - - if ( all || namespace.test( handleObj.namespace ) ) { - jQuery.event.remove( elem, origType, handleObj.handler, j ); - eventType.splice( j--, 1 ); - } - } - - continue; - } - - special = jQuery.event.special[ type ] || {}; - - for ( var j = pos || 0; j < eventType.length; j++ ) { - handleObj = eventType[ j ]; - - if ( handler.guid === handleObj.guid ) { - // remove the given handler for the given type - if ( all || namespace.test( handleObj.namespace ) ) { - if ( pos == null ) { - eventType.splice( j--, 1 ); - } - - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - - if ( pos != null ) { - break; - } - } - } - - // remove generic event handler if no more handlers exist - if ( eventType.length === 0 || pos != null && eventType.length === 1 ) { - if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { - removeEvent( elem, type, elemData.handle ); - } - - ret = null; - delete events[ type ]; - } - } - - // Remove the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - var handle = elemData.handle; - if ( handle ) { - handle.elem = null; - } - - delete elemData.events; - delete elemData.handle; - - if ( jQuery.isEmptyObject( elemData ) ) { - jQuery.removeData( elem ); - } - } - }, - - // bubbling is internal - trigger: function( event, data, elem /*, bubbling */ ) { - // Event object or event type - var type = event.type || event, - bubbling = arguments[3]; - - if ( !bubbling ) { - event = typeof event === "object" ? - // jQuery.Event object - event[expando] ? event : - // Object literal - jQuery.extend( jQuery.Event(type), event ) : - // Just the event type (string) - jQuery.Event(type); - - if ( type.indexOf("!") >= 0 ) { - event.type = type = type.slice(0, -1); - event.exclusive = true; - } - - // Handle a global trigger - if ( !elem ) { - // Don't bubble custom events when global (to avoid too much overhead) - event.stopPropagation(); - - // Only trigger if we've ever bound an event for it - if ( jQuery.event.global[ type ] ) { - jQuery.each( jQuery.cache, function() { - if ( this.events && this.events[type] ) { - jQuery.event.trigger( event, data, this.handle.elem ); - } - }); - } - } - - // Handle triggering a single element - - // don't do events on text and comment nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) { - return undefined; - } - - // Clean up in case it is reused - event.result = undefined; - event.target = elem; - - // Clone the incoming data, if any - data = jQuery.makeArray( data ); - data.unshift( event ); - } - - event.currentTarget = elem; - - // Trigger the event, it is assumed that "handle" is a function - var handle = jQuery.data( elem, "handle" ); - if ( handle ) { - handle.apply( elem, data ); - } - - var parent = elem.parentNode || elem.ownerDocument; - - // Trigger an inline bound script - try { - if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) { - if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) { - event.result = false; - } - } - - // prevent IE from throwing an error for some elements with some event types, see #3533 - } catch (e) {} - - if ( !event.isPropagationStopped() && parent ) { - jQuery.event.trigger( event, data, parent, true ); - - } else if ( !event.isDefaultPrevented() ) { - var target = event.target, old, - isClick = jQuery.nodeName(target, "a") && type === "click", - special = jQuery.event.special[ type ] || {}; - - if ( (!special._default || special._default.call( elem, event ) === false) && - !isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) { - - try { - if ( target[ type ] ) { - // Make sure that we don't accidentally re-trigger the onFOO events - old = target[ "on" + type ]; - - if ( old ) { - target[ "on" + type ] = null; - } - - jQuery.event.triggered = true; - target[ type ](); - } - - // prevent IE from throwing an error for some elements with some event types, see #3533 - } catch (e) {} - - if ( old ) { - target[ "on" + type ] = old; - } - - jQuery.event.triggered = false; - } - } - }, - - handle: function( event ) { - var all, handlers, namespaces, namespace, events; - - event = arguments[0] = jQuery.event.fix( event || window.event ); - event.currentTarget = this; - - // Namespaced event handlers - all = event.type.indexOf(".") < 0 && !event.exclusive; - - if ( !all ) { - namespaces = event.type.split("."); - event.type = namespaces.shift(); - namespace = new RegExp("(^|\\.)" + namespaces.slice(0).sort().join("\\.(?:.*\\.)?") + "(\\.|$)"); - } - - var events = jQuery.data(this, "events"), handlers = events[ event.type ]; - - if ( events && handlers ) { - // Clone the handlers to prevent manipulation - handlers = handlers.slice(0); - - for ( var j = 0, l = handlers.length; j < l; j++ ) { - var handleObj = handlers[ j ]; - - // Filter the functions by class - if ( all || namespace.test( handleObj.namespace ) ) { - // Pass in a reference to the handler function itself - // So that we can later remove it - event.handler = handleObj.handler; - event.data = handleObj.data; - event.handleObj = handleObj; - - var ret = handleObj.handler.apply( this, arguments ); - - if ( ret !== undefined ) { - event.result = ret; - if ( ret === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - - if ( event.isImmediatePropagationStopped() ) { - break; - } - } - } - } - - return event.result; - }, - - props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), - - fix: function( event ) { - if ( event[ expando ] ) { - return event; - } - - // store a copy of the original event object - // and "clone" to set read-only properties - var originalEvent = event; - event = jQuery.Event( originalEvent ); - - for ( var i = this.props.length, prop; i; ) { - prop = this.props[ --i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Fix target property, if necessary - if ( !event.target ) { - event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either - } - - // check if target is a textnode (safari) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - // Add relatedTarget, if necessary - if ( !event.relatedTarget && event.fromElement ) { - event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement; - } - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && event.clientX != null ) { - var doc = document.documentElement, body = document.body; - event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); - event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); - } - - // Add which for key events - if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) ) { - event.which = event.charCode || event.keyCode; - } - - // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs) - if ( !event.metaKey && event.ctrlKey ) { - event.metaKey = event.ctrlKey; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && event.button !== undefined ) { - event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) )); - } - - return event; - }, - - // Deprecated, use jQuery.guid instead - guid: 1E8, - - // Deprecated, use jQuery.proxy instead - proxy: jQuery.proxy, - - special: { - ready: { - // Make sure the ready event is setup - setup: jQuery.bindReady, - teardown: jQuery.noop - }, - - live: { - add: function( handleObj ) { - jQuery.event.add( this, handleObj.origType, jQuery.extend({}, handleObj, {handler: liveHandler}) ); - }, - - remove: function( handleObj ) { - var remove = true, - type = handleObj.origType.replace(rnamespaces, ""); - - jQuery.each( jQuery.data(this, "events").live || [], function() { - if ( type === this.origType.replace(rnamespaces, "") ) { - remove = false; - return false; - } - }); - - if ( remove ) { - jQuery.event.remove( this, handleObj.origType, liveHandler ); - } - } - - }, - - beforeunload: { - setup: function( data, namespaces, eventHandle ) { - // We only want to do this special case on windows - if ( this.setInterval ) { - this.onbeforeunload = eventHandle; - } - - return false; - }, - teardown: function( namespaces, eventHandle ) { - if ( this.onbeforeunload === eventHandle ) { - this.onbeforeunload = null; - } - } - } - } -}; - -var removeEvent = document.removeEventListener ? - function( elem, type, handle ) { - elem.removeEventListener( type, handle, false ); - } : - function( elem, type, handle ) { - elem.detachEvent( "on" + type, handle ); - }; - -jQuery.Event = function( src ) { - // Allow instantiation without the 'new' keyword - if ( !this.preventDefault ) { - return new jQuery.Event( src ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - // Event type - } else { - this.type = src; - } - - // timeStamp is buggy for some events on Firefox(#3843) - // So we won't rely on the native value - this.timeStamp = now(); - - // Mark it as fixed - this[ expando ] = true; -}; - -function returnFalse() { - return false; -} -function returnTrue() { - return true; -} - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - preventDefault: function() { - this.isDefaultPrevented = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - - // if preventDefault exists run it on the original event - if ( e.preventDefault ) { - e.preventDefault(); - } - // otherwise set the returnValue property of the original event to false (IE) - e.returnValue = false; - }, - stopPropagation: function() { - this.isPropagationStopped = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - // if stopPropagation exists run it on the original event - if ( e.stopPropagation ) { - e.stopPropagation(); - } - // otherwise set the cancelBubble property of the original event to true (IE) - e.cancelBubble = true; - }, - stopImmediatePropagation: function() { - this.isImmediatePropagationStopped = returnTrue; - this.stopPropagation(); - }, - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse -}; - -// Checks if an event happened on an element within another element -// Used in jQuery.event.special.mouseenter and mouseleave handlers -var withinElement = function( event ) { - // Check if mouse(over|out) are still within the same parent element - var parent = event.relatedTarget; - - // Firefox sometimes assigns relatedTarget a XUL element - // which we cannot access the parentNode property of - try { - // Traverse up the tree - while ( parent && parent !== this ) { - parent = parent.parentNode; - } - - if ( parent !== this ) { - // set the correct event type - event.type = event.data; - - // handle event if we actually just moused on to a non sub-element - jQuery.event.handle.apply( this, arguments ); - } - - // assuming we've left the element since we most likely mousedover a xul element - } catch(e) { } -}, - -// In case of event delegation, we only need to rename the event.type, -// liveHandler will take care of the rest. -delegate = function( event ) { - event.type = event.data; - jQuery.event.handle.apply( this, arguments ); -}; - -// Create mouseenter and mouseleave events -jQuery.each({ - mouseenter: "mouseover", - mouseleave: "mouseout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - setup: function( data ) { - jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig ); - }, - teardown: function( data ) { - jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement ); - } - }; -}); - -// submit delegation -if ( !jQuery.support.submitBubbles ) { - - jQuery.event.special.submit = { - setup: function( data, namespaces ) { - if ( this.nodeName.toLowerCase() !== "form" ) { - jQuery.event.add(this, "click.specialSubmit", function( e ) { - var elem = e.target, type = elem.type; - - if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) { - return trigger( "submit", this, arguments ); - } - }); - - jQuery.event.add(this, "keypress.specialSubmit", function( e ) { - var elem = e.target, type = elem.type; - - if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) { - return trigger( "submit", this, arguments ); - } - }); - - } else { - return false; - } - }, - - teardown: function( namespaces ) { - jQuery.event.remove( this, ".specialSubmit" ); - } - }; - -} - -// change delegation, happens here so we have bind. -if ( !jQuery.support.changeBubbles ) { - - var formElems = /textarea|input|select/i, - - changeFilters, - - getVal = function( elem ) { - var type = elem.type, val = elem.value; - - if ( type === "radio" || type === "checkbox" ) { - val = elem.checked; - - } else if ( type === "select-multiple" ) { - val = elem.selectedIndex > -1 ? - jQuery.map( elem.options, function( elem ) { - return elem.selected; - }).join("-") : - ""; - - } else if ( elem.nodeName.toLowerCase() === "select" ) { - val = elem.selectedIndex; - } - - return val; - }, - - testChange = function testChange( e ) { - var elem = e.target, data, val; - - if ( !formElems.test( elem.nodeName ) || elem.readOnly ) { - return; - } - - data = jQuery.data( elem, "_change_data" ); - val = getVal(elem); - - // the current data will be also retrieved by beforeactivate - if ( e.type !== "focusout" || elem.type !== "radio" ) { - jQuery.data( elem, "_change_data", val ); - } - - if ( data === undefined || val === data ) { - return; - } - - if ( data != null || val ) { - e.type = "change"; - return jQuery.event.trigger( e, arguments[1], elem ); - } - }; - - jQuery.event.special.change = { - filters: { - focusout: testChange, - - click: function( e ) { - var elem = e.target, type = elem.type; - - if ( type === "radio" || type === "checkbox" || elem.nodeName.toLowerCase() === "select" ) { - return testChange.call( this, e ); - } - }, - - // Change has to be called before submit - // Keydown will be called before keypress, which is used in submit-event delegation - keydown: function( e ) { - var elem = e.target, type = elem.type; - - if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") || - (e.keyCode === 32 && (type === "checkbox" || type === "radio")) || - type === "select-multiple" ) { - return testChange.call( this, e ); - } - }, - - // Beforeactivate happens also before the previous element is blurred - // with this event you can't trigger a change event, but you can store - // information/focus[in] is not needed anymore - beforeactivate: function( e ) { - var elem = e.target; - jQuery.data( elem, "_change_data", getVal(elem) ); - } - }, - - setup: function( data, namespaces ) { - if ( this.type === "file" ) { - return false; - } - - for ( var type in changeFilters ) { - jQuery.event.add( this, type + ".specialChange", changeFilters[type] ); - } - - return formElems.test( this.nodeName ); - }, - - teardown: function( namespaces ) { - jQuery.event.remove( this, ".specialChange" ); - - return formElems.test( this.nodeName ); - } - }; - - changeFilters = jQuery.event.special.change.filters; -} - -function trigger( type, elem, args ) { - args[0].type = type; - return jQuery.event.handle.apply( elem, args ); -} - -// Create "bubbling" focus and blur events -if ( document.addEventListener ) { - jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - jQuery.event.special[ fix ] = { - setup: function() { - this.addEventListener( orig, handler, true ); - }, - teardown: function() { - this.removeEventListener( orig, handler, true ); - } - }; - - function handler( e ) { - e = jQuery.event.fix( e ); - e.type = fix; - return jQuery.event.handle.call( this, e ); - } - }); -} - -jQuery.each(["bind", "one"], function( i, name ) { - jQuery.fn[ name ] = function( type, data, fn ) { - // Handle object literals - if ( typeof type === "object" ) { - for ( var key in type ) { - this[ name ](key, data, type[key], fn); - } - return this; - } - - if ( jQuery.isFunction( data ) ) { - fn = data; - data = undefined; - } - - var handler = name === "one" ? jQuery.proxy( fn, function( event ) { - jQuery( this ).unbind( event, handler ); - return fn.apply( this, arguments ); - }) : fn; - - if ( type === "unload" && name !== "one" ) { - this.one( type, data, fn ); - - } else { - for ( var i = 0, l = this.length; i < l; i++ ) { - jQuery.event.add( this[i], type, handler, data ); - } - } - - return this; - }; -}); - -jQuery.fn.extend({ - unbind: function( type, fn ) { - // Handle object literals - if ( typeof type === "object" && !type.preventDefault ) { - for ( var key in type ) { - this.unbind(key, type[key]); - } - - } else { - for ( var i = 0, l = this.length; i < l; i++ ) { - jQuery.event.remove( this[i], type, fn ); - } - } - - return this; - }, - - delegate: function( selector, types, data, fn ) { - return this.live( types, data, fn, selector ); - }, - - undelegate: function( selector, types, fn ) { - if ( arguments.length === 0 ) { - return this.unbind( "live" ); - - } else { - return this.die( types, null, fn, selector ); - } - }, - - trigger: function( type, data ) { - return this.each(function() { - jQuery.event.trigger( type, data, this ); - }); - }, - - triggerHandler: function( type, data ) { - if ( this[0] ) { - var event = jQuery.Event( type ); - event.preventDefault(); - event.stopPropagation(); - jQuery.event.trigger( event, data, this[0] ); - return event.result; - } - }, - - toggle: function( fn ) { - // Save reference to arguments for access in closure - var args = arguments, i = 1; - - // link all the functions, so any of them can unbind this click handler - while ( i < args.length ) { - jQuery.proxy( fn, args[ i++ ] ); - } - - return this.click( jQuery.proxy( fn, function( event ) { - // Figure out which function to execute - var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i; - jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 ); - - // Make sure that clicks stop - event.preventDefault(); - - // and execute the function - return args[ lastToggle ].apply( this, arguments ) || false; - })); - }, - - hover: function( fnOver, fnOut ) { - return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); - } -}); - -var liveMap = { - focus: "focusin", - blur: "focusout", - mouseenter: "mouseover", - mouseleave: "mouseout" -}; - -jQuery.each(["live", "die"], function( i, name ) { - jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) { - var type, i = 0, match, namespaces, preType, - selector = origSelector || this.selector, - context = origSelector ? this : jQuery( this.context ); - - if ( jQuery.isFunction( data ) ) { - fn = data; - data = undefined; - } - - types = (types || "").split(" "); - - while ( (type = types[ i++ ]) != null ) { - match = rnamespaces.exec( type ); - namespaces = ""; - - if ( match ) { - namespaces = match[0]; - type = type.replace( rnamespaces, "" ); - } - - if ( type === "hover" ) { - types.push( "mouseenter" + namespaces, "mouseleave" + namespaces ); - continue; - } - - preType = type; - - if ( type === "focus" || type === "blur" ) { - types.push( liveMap[ type ] + namespaces ); - type = type + namespaces; - - } else { - type = (liveMap[ type ] || type) + namespaces; - } - - if ( name === "live" ) { - // bind live handler - context.each(function(){ - jQuery.event.add( this, liveConvert( type, selector ), - { data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } ); - }); - - } else { - // unbind live handler - context.unbind( liveConvert( type, selector ), fn ); - } - } - - return this; - } -}); - -function liveHandler( event ) { - var stop, elems = [], selectors = [], args = arguments, - related, match, handleObj, elem, j, i, l, data, - events = jQuery.data( this, "events" ); - - // Make sure we avoid non-left-click bubbling in Firefox (#3861) - if ( event.liveFired === this || !events || !events.live || event.button && event.type === "click" ) { - return; - } - - event.liveFired = this; - - var live = events.live.slice(0); - - for ( j = 0; j < live.length; j++ ) { - handleObj = live[j]; - - if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) { - selectors.push( handleObj.selector ); - - } else { - live.splice( j--, 1 ); - } - } - - match = jQuery( event.target ).closest( selectors, event.currentTarget ); - - for ( i = 0, l = match.length; i < l; i++ ) { - for ( j = 0; j < live.length; j++ ) { - handleObj = live[j]; - - if ( match[i].selector === handleObj.selector ) { - elem = match[i].elem; - related = null; - - // Those two events require additional checking - if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) { - related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0]; - } - - if ( !related || related !== elem ) { - elems.push({ elem: elem, handleObj: handleObj }); - } - } - } - } - - for ( i = 0, l = elems.length; i < l; i++ ) { - match = elems[i]; - event.currentTarget = match.elem; - event.data = match.handleObj.data; - event.handleObj = match.handleObj; - - if ( match.handleObj.origHandler.apply( match.elem, args ) === false ) { - stop = false; - break; - } - } - - return stop; -} - -function liveConvert( type, selector ) { - return "live." + (type && type !== "*" ? type + "." : "") + selector.replace(/\./g, "`").replace(/ /g, "&"); -} - -jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + - "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + - "change select submit keydown keypress keyup error").split(" "), function( i, name ) { - - // Handle event binding - jQuery.fn[ name ] = function( fn ) { - return fn ? this.bind( name, fn ) : this.trigger( name ); - }; - - if ( jQuery.attrFn ) { - jQuery.attrFn[ name ] = true; - } -}); - -// Prevent memory leaks in IE -// Window isn't included so as not to unbind existing unload events -// More info: -// - http://isaacschlueter.com/2006/10/msie-memory-leaks/ -if ( window.attachEvent && !window.addEventListener ) { - window.attachEvent("onunload", function() { - for ( var id in jQuery.cache ) { - if ( jQuery.cache[ id ].handle ) { - // Try/Catch is to handle iframes being unloaded, see #4280 - try { - jQuery.event.remove( jQuery.cache[ id ].handle.elem ); - } catch(e) {} - } - } - }); -} -/*! - * Sizzle CSS Selector Engine - v1.0 - * Copyright 2009, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * More information: http://sizzlejs.com/ - */ -(function(){ - -var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, - done = 0, - toString = Object.prototype.toString, - hasDuplicate = false, - baseHasDuplicate = true; - -// Here we check if the JavaScript engine is using some sort of -// optimization where it does not always call our comparision -// function. If that is the case, discard the hasDuplicate value. -// Thus far that includes Google Chrome. -[0, 0].sort(function(){ - baseHasDuplicate = false; - return 0; -}); - -var Sizzle = function(selector, context, results, seed) { - results = results || []; - var origContext = context = context || document; - - if ( context.nodeType !== 1 && context.nodeType !== 9 ) { - return []; - } - - if ( !selector || typeof selector !== "string" ) { - return results; - } - - var parts = [], m, set, checkSet, extra, prune = true, contextXML = isXML(context), - soFar = selector; - - // Reset the position of the chunker regexp (start from head) - while ( (chunker.exec(""), m = chunker.exec(soFar)) !== null ) { - soFar = m[3]; - - parts.push( m[1] ); - - if ( m[2] ) { - extra = m[3]; - break; - } - } - - if ( parts.length > 1 && origPOS.exec( selector ) ) { - if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { - set = posProcess( parts[0] + parts[1], context ); - } else { - set = Expr.relative[ parts[0] ] ? - [ context ] : - Sizzle( parts.shift(), context ); - - while ( parts.length ) { - selector = parts.shift(); - - if ( Expr.relative[ selector ] ) { - selector += parts.shift(); - } - - set = posProcess( selector, set ); - } - } - } else { - // Take a shortcut and set the context if the root selector is an ID - // (but not if it'll be faster if the inner selector is an ID) - if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && - Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { - var ret = Sizzle.find( parts.shift(), context, contextXML ); - context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0]; - } - - if ( context ) { - var ret = seed ? - { expr: parts.pop(), set: makeArray(seed) } : - Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); - set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set; - - if ( parts.length > 0 ) { - checkSet = makeArray(set); - } else { - prune = false; - } - - while ( parts.length ) { - var cur = parts.pop(), pop = cur; - - if ( !Expr.relative[ cur ] ) { - cur = ""; - } else { - pop = parts.pop(); - } - - if ( pop == null ) { - pop = context; - } - - Expr.relative[ cur ]( checkSet, pop, contextXML ); - } - } else { - checkSet = parts = []; - } - } - - if ( !checkSet ) { - checkSet = set; - } - - if ( !checkSet ) { - Sizzle.error( cur || selector ); - } - - if ( toString.call(checkSet) === "[object Array]" ) { - if ( !prune ) { - results.push.apply( results, checkSet ); - } else if ( context && context.nodeType === 1 ) { - for ( var i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) { - results.push( set[i] ); - } - } - } else { - for ( var i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && checkSet[i].nodeType === 1 ) { - results.push( set[i] ); - } - } - } - } else { - makeArray( checkSet, results ); - } - - if ( extra ) { - Sizzle( extra, origContext, results, seed ); - Sizzle.uniqueSort( results ); - } - - return results; -}; - -Sizzle.uniqueSort = function(results){ - if ( sortOrder ) { - hasDuplicate = baseHasDuplicate; - results.sort(sortOrder); - - if ( hasDuplicate ) { - for ( var i = 1; i < results.length; i++ ) { - if ( results[i] === results[i-1] ) { - results.splice(i--, 1); - } - } - } - } - - return results; -}; - -Sizzle.matches = function(expr, set){ - return Sizzle(expr, null, null, set); -}; - -Sizzle.find = function(expr, context, isXML){ - var set, match; - - if ( !expr ) { - return []; - } - - for ( var i = 0, l = Expr.order.length; i < l; i++ ) { - var type = Expr.order[i], match; - - if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { - var left = match[1]; - match.splice(1,1); - - if ( left.substr( left.length - 1 ) !== "\\" ) { - match[1] = (match[1] || "").replace(/\\/g, ""); - set = Expr.find[ type ]( match, context, isXML ); - if ( set != null ) { - expr = expr.replace( Expr.match[ type ], "" ); - break; - } - } - } - } - - if ( !set ) { - set = context.getElementsByTagName("*"); - } - - return {set: set, expr: expr}; -}; - -Sizzle.filter = function(expr, set, inplace, not){ - var old = expr, result = [], curLoop = set, match, anyFound, - isXMLFilter = set && set[0] && isXML(set[0]); - - while ( expr && set.length ) { - for ( var type in Expr.filter ) { - if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { - var filter = Expr.filter[ type ], found, item, left = match[1]; - anyFound = false; - - match.splice(1,1); - - if ( left.substr( left.length - 1 ) === "\\" ) { - continue; - } - - if ( curLoop === result ) { - result = []; - } - - if ( Expr.preFilter[ type ] ) { - match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); - - if ( !match ) { - anyFound = found = true; - } else if ( match === true ) { - continue; - } - } - - if ( match ) { - for ( var i = 0; (item = curLoop[i]) != null; i++ ) { - if ( item ) { - found = filter( item, match, i, curLoop ); - var pass = not ^ !!found; - - if ( inplace && found != null ) { - if ( pass ) { - anyFound = true; - } else { - curLoop[i] = false; - } - } else if ( pass ) { - result.push( item ); - anyFound = true; - } - } - } - } - - if ( found !== undefined ) { - if ( !inplace ) { - curLoop = result; - } - - expr = expr.replace( Expr.match[ type ], "" ); - - if ( !anyFound ) { - return []; - } - - break; - } - } - } - - // Improper expression - if ( expr === old ) { - if ( anyFound == null ) { - Sizzle.error( expr ); - } else { - break; - } - } - - old = expr; - } - - return curLoop; -}; - -Sizzle.error = function( msg ) { - throw "Syntax error, unrecognized expression: " + msg; -}; - -var Expr = Sizzle.selectors = { - order: [ "ID", "NAME", "TAG" ], - match: { - ID: /#((?:[\w\u00c0-\uFFFF-]|\\.)+)/, - CLASS: /\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/, - NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/, - ATTR: /\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/, - TAG: /^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/, - CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/, - POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/, - PSEUDO: /:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ - }, - leftMatch: {}, - attrMap: { - "class": "className", - "for": "htmlFor" - }, - attrHandle: { - href: function(elem){ - return elem.getAttribute("href"); - } - }, - relative: { - "+": function(checkSet, part){ - var isPartStr = typeof part === "string", - isTag = isPartStr && !/\W/.test(part), - isPartStrNotTag = isPartStr && !isTag; - - if ( isTag ) { - part = part.toLowerCase(); - } - - for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { - if ( (elem = checkSet[i]) ) { - while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} - - checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? - elem || false : - elem === part; - } - } - - if ( isPartStrNotTag ) { - Sizzle.filter( part, checkSet, true ); - } - }, - ">": function(checkSet, part){ - var isPartStr = typeof part === "string"; - - if ( isPartStr && !/\W/.test(part) ) { - part = part.toLowerCase(); - - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - if ( elem ) { - var parent = elem.parentNode; - checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; - } - } - } else { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - if ( elem ) { - checkSet[i] = isPartStr ? - elem.parentNode : - elem.parentNode === part; - } - } - - if ( isPartStr ) { - Sizzle.filter( part, checkSet, true ); - } - } - }, - "": function(checkSet, part, isXML){ - var doneName = done++, checkFn = dirCheck; - - if ( typeof part === "string" && !/\W/.test(part) ) { - var nodeCheck = part = part.toLowerCase(); - checkFn = dirNodeCheck; - } - - checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML); - }, - "~": function(checkSet, part, isXML){ - var doneName = done++, checkFn = dirCheck; - - if ( typeof part === "string" && !/\W/.test(part) ) { - var nodeCheck = part = part.toLowerCase(); - checkFn = dirNodeCheck; - } - - checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML); - } - }, - find: { - ID: function(match, context, isXML){ - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - return m ? [m] : []; - } - }, - NAME: function(match, context){ - if ( typeof context.getElementsByName !== "undefined" ) { - var ret = [], results = context.getElementsByName(match[1]); - - for ( var i = 0, l = results.length; i < l; i++ ) { - if ( results[i].getAttribute("name") === match[1] ) { - ret.push( results[i] ); - } - } - - return ret.length === 0 ? null : ret; - } - }, - TAG: function(match, context){ - return context.getElementsByTagName(match[1]); - } - }, - preFilter: { - CLASS: function(match, curLoop, inplace, result, not, isXML){ - match = " " + match[1].replace(/\\/g, "") + " "; - - if ( isXML ) { - return match; - } - - for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { - if ( elem ) { - if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n]/g, " ").indexOf(match) >= 0) ) { - if ( !inplace ) { - result.push( elem ); - } - } else if ( inplace ) { - curLoop[i] = false; - } - } - } - - return false; - }, - ID: function(match){ - return match[1].replace(/\\/g, ""); - }, - TAG: function(match, curLoop){ - return match[1].toLowerCase(); - }, - CHILD: function(match){ - if ( match[1] === "nth" ) { - // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' - var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec( - match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || - !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); - - // calculate the numbers (first)n+(last) including if they are negative - match[2] = (test[1] + (test[2] || 1)) - 0; - match[3] = test[3] - 0; - } - - // TODO: Move to normal caching system - match[0] = done++; - - return match; - }, - ATTR: function(match, curLoop, inplace, result, not, isXML){ - var name = match[1].replace(/\\/g, ""); - - if ( !isXML && Expr.attrMap[name] ) { - match[1] = Expr.attrMap[name]; - } - - if ( match[2] === "~=" ) { - match[4] = " " + match[4] + " "; - } - - return match; - }, - PSEUDO: function(match, curLoop, inplace, result, not){ - if ( match[1] === "not" ) { - // If we're dealing with a complex expression, or a simple one - if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { - match[3] = Sizzle(match[3], null, null, curLoop); - } else { - var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); - if ( !inplace ) { - result.push.apply( result, ret ); - } - return false; - } - } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { - return true; - } - - return match; - }, - POS: function(match){ - match.unshift( true ); - return match; - } - }, - filters: { - enabled: function(elem){ - return elem.disabled === false && elem.type !== "hidden"; - }, - disabled: function(elem){ - return elem.disabled === true; - }, - checked: function(elem){ - return elem.checked === true; - }, - selected: function(elem){ - // Accessing this property makes selected-by-default - // options in Safari work properly - elem.parentNode.selectedIndex; - return elem.selected === true; - }, - parent: function(elem){ - return !!elem.firstChild; - }, - empty: function(elem){ - return !elem.firstChild; - }, - has: function(elem, i, match){ - return !!Sizzle( match[3], elem ).length; - }, - header: function(elem){ - return /h\d/i.test( elem.nodeName ); - }, - text: function(elem){ - return "text" === elem.type; - }, - radio: function(elem){ - return "radio" === elem.type; - }, - checkbox: function(elem){ - return "checkbox" === elem.type; - }, - file: function(elem){ - return "file" === elem.type; - }, - password: function(elem){ - return "password" === elem.type; - }, - submit: function(elem){ - return "submit" === elem.type; - }, - image: function(elem){ - return "image" === elem.type; - }, - reset: function(elem){ - return "reset" === elem.type; - }, - button: function(elem){ - return "button" === elem.type || elem.nodeName.toLowerCase() === "button"; - }, - input: function(elem){ - return /input|select|textarea|button/i.test(elem.nodeName); - } - }, - setFilters: { - first: function(elem, i){ - return i === 0; - }, - last: function(elem, i, match, array){ - return i === array.length - 1; - }, - even: function(elem, i){ - return i % 2 === 0; - }, - odd: function(elem, i){ - return i % 2 === 1; - }, - lt: function(elem, i, match){ - return i < match[3] - 0; - }, - gt: function(elem, i, match){ - return i > match[3] - 0; - }, - nth: function(elem, i, match){ - return match[3] - 0 === i; - }, - eq: function(elem, i, match){ - return match[3] - 0 === i; - } - }, - filter: { - PSEUDO: function(elem, match, i, array){ - var name = match[1], filter = Expr.filters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - } else if ( name === "contains" ) { - return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0; - } else if ( name === "not" ) { - var not = match[3]; - - for ( var i = 0, l = not.length; i < l; i++ ) { - if ( not[i] === elem ) { - return false; - } - } - - return true; - } else { - Sizzle.error( "Syntax error, unrecognized expression: " + name ); - } - }, - CHILD: function(elem, match){ - var type = match[1], node = elem; - switch (type) { - case 'only': - case 'first': - while ( (node = node.previousSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - if ( type === "first" ) { - return true; - } - node = elem; - case 'last': - while ( (node = node.nextSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - return true; - case 'nth': - var first = match[2], last = match[3]; - - if ( first === 1 && last === 0 ) { - return true; - } - - var doneName = match[0], - parent = elem.parentNode; - - if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) { - var count = 0; - for ( node = parent.firstChild; node; node = node.nextSibling ) { - if ( node.nodeType === 1 ) { - node.nodeIndex = ++count; - } - } - parent.sizcache = doneName; - } - - var diff = elem.nodeIndex - last; - if ( first === 0 ) { - return diff === 0; - } else { - return ( diff % first === 0 && diff / first >= 0 ); - } - } - }, - ID: function(elem, match){ - return elem.nodeType === 1 && elem.getAttribute("id") === match; - }, - TAG: function(elem, match){ - return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match; - }, - CLASS: function(elem, match){ - return (" " + (elem.className || elem.getAttribute("class")) + " ") - .indexOf( match ) > -1; - }, - ATTR: function(elem, match){ - var name = match[1], - result = Expr.attrHandle[ name ] ? - Expr.attrHandle[ name ]( elem ) : - elem[ name ] != null ? - elem[ name ] : - elem.getAttribute( name ), - value = result + "", - type = match[2], - check = match[4]; - - return result == null ? - type === "!=" : - type === "=" ? - value === check : - type === "*=" ? - value.indexOf(check) >= 0 : - type === "~=" ? - (" " + value + " ").indexOf(check) >= 0 : - !check ? - value && result !== false : - type === "!=" ? - value !== check : - type === "^=" ? - value.indexOf(check) === 0 : - type === "$=" ? - value.substr(value.length - check.length) === check : - type === "|=" ? - value === check || value.substr(0, check.length + 1) === check + "-" : - false; - }, - POS: function(elem, match, i, array){ - var name = match[2], filter = Expr.setFilters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - } - } - } -}; - -var origPOS = Expr.match.POS; - -for ( var type in Expr.match ) { - Expr.match[ type ] = new RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source ); - Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, function(all, num){ - return "\\" + (num - 0 + 1); - })); -} - -var makeArray = function(array, results) { - array = Array.prototype.slice.call( array, 0 ); - - if ( results ) { - results.push.apply( results, array ); - return results; - } - - return array; -}; - -// Perform a simple check to determine if the browser is capable of -// converting a NodeList to an array using builtin methods. -// Also verifies that the returned array holds DOM nodes -// (which is not the case in the Blackberry browser) -try { - Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; - -// Provide a fallback method if it does not work -} catch(e){ - makeArray = function(array, results) { - var ret = results || []; - - if ( toString.call(array) === "[object Array]" ) { - Array.prototype.push.apply( ret, array ); - } else { - if ( typeof array.length === "number" ) { - for ( var i = 0, l = array.length; i < l; i++ ) { - ret.push( array[i] ); - } - } else { - for ( var i = 0; array[i]; i++ ) { - ret.push( array[i] ); - } - } - } - - return ret; - }; -} - -var sortOrder; - -if ( document.documentElement.compareDocumentPosition ) { - sortOrder = function( a, b ) { - if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { - if ( a == b ) { - hasDuplicate = true; - } - return a.compareDocumentPosition ? -1 : 1; - } - - var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1; - if ( ret === 0 ) { - hasDuplicate = true; - } - return ret; - }; -} else if ( "sourceIndex" in document.documentElement ) { - sortOrder = function( a, b ) { - if ( !a.sourceIndex || !b.sourceIndex ) { - if ( a == b ) { - hasDuplicate = true; - } - return a.sourceIndex ? -1 : 1; - } - - var ret = a.sourceIndex - b.sourceIndex; - if ( ret === 0 ) { - hasDuplicate = true; - } - return ret; - }; -} else if ( document.createRange ) { - sortOrder = function( a, b ) { - if ( !a.ownerDocument || !b.ownerDocument ) { - if ( a == b ) { - hasDuplicate = true; - } - return a.ownerDocument ? -1 : 1; - } - - var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange(); - aRange.setStart(a, 0); - aRange.setEnd(a, 0); - bRange.setStart(b, 0); - bRange.setEnd(b, 0); - var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange); - if ( ret === 0 ) { - hasDuplicate = true; - } - return ret; - }; -} - -// Utility function for retreiving the text value of an array of DOM nodes -function getText( elems ) { - var ret = "", elem; - - for ( var i = 0; elems[i]; i++ ) { - elem = elems[i]; - - // Get the text from text nodes and CDATA nodes - if ( elem.nodeType === 3 || elem.nodeType === 4 ) { - ret += elem.nodeValue; - - // Traverse everything else, except comment nodes - } else if ( elem.nodeType !== 8 ) { - ret += getText( elem.childNodes ); - } - } - - return ret; -} - -// Check to see if the browser returns elements by name when -// querying by getElementById (and provide a workaround) -(function(){ - // We're going to inject a fake input element with a specified name - var form = document.createElement("div"), - id = "script" + (new Date).getTime(); - form.innerHTML = "<a name='" + id + "'/>"; - - // Inject it into the root element, check its status, and remove it quickly - var root = document.documentElement; - root.insertBefore( form, root.firstChild ); - - // The workaround has to do additional checks after a getElementById - // Which slows things down for other browsers (hence the branching) - if ( document.getElementById( id ) ) { - Expr.find.ID = function(match, context, isXML){ - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : []; - } - }; - - Expr.filter.ID = function(elem, match){ - var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); - return elem.nodeType === 1 && node && node.nodeValue === match; - }; - } - - root.removeChild( form ); - root = form = null; // release memory in IE -})(); - -(function(){ - // Check to see if the browser returns only elements - // when doing getElementsByTagName("*") - - // Create a fake element - var div = document.createElement("div"); - div.appendChild( document.createComment("") ); - - // Make sure no comments are found - if ( div.getElementsByTagName("*").length > 0 ) { - Expr.find.TAG = function(match, context){ - var results = context.getElementsByTagName(match[1]); - - // Filter out possible comments - if ( match[1] === "*" ) { - var tmp = []; - - for ( var i = 0; results[i]; i++ ) { - if ( results[i].nodeType === 1 ) { - tmp.push( results[i] ); - } - } - - results = tmp; - } - - return results; - }; - } - - // Check to see if an attribute returns normalized href attributes - div.innerHTML = "<a href='#'></a>"; - if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && - div.firstChild.getAttribute("href") !== "#" ) { - Expr.attrHandle.href = function(elem){ - return elem.getAttribute("href", 2); - }; - } - - div = null; // release memory in IE -})(); - -if ( document.querySelectorAll ) { - (function(){ - var oldSizzle = Sizzle, div = document.createElement("div"); - div.innerHTML = "<p class='TEST'></p>"; - - // Safari can't handle uppercase or unicode characters when - // in quirks mode. - if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { - return; - } - - Sizzle = function(query, context, extra, seed){ - context = context || document; - - // Only use querySelectorAll on non-XML documents - // (ID selectors don't work in non-HTML documents) - if ( !seed && context.nodeType === 9 && !isXML(context) ) { - try { - return makeArray( context.querySelectorAll(query), extra ); - } catch(e){} - } - - return oldSizzle(query, context, extra, seed); - }; - - for ( var prop in oldSizzle ) { - Sizzle[ prop ] = oldSizzle[ prop ]; - } - - div = null; // release memory in IE - })(); -} - -(function(){ - var div = document.createElement("div"); - - div.innerHTML = "<div class='test e'></div><div class='test'></div>"; - - // Opera can't find a second classname (in 9.6) - // Also, make sure that getElementsByClassName actually exists - if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) { - return; - } - - // Safari caches class attributes, doesn't catch changes (in 3.2) - div.lastChild.className = "e"; - - if ( div.getElementsByClassName("e").length === 1 ) { - return; - } - - Expr.order.splice(1, 0, "CLASS"); - Expr.find.CLASS = function(match, context, isXML) { - if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { - return context.getElementsByClassName(match[1]); - } - }; - - div = null; // release memory in IE -})(); - -function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - if ( elem ) { - elem = elem[dir]; - var match = false; - - while ( elem ) { - if ( elem.sizcache === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 && !isXML ){ - elem.sizcache = doneName; - elem.sizset = i; - } - - if ( elem.nodeName.toLowerCase() === cur ) { - match = elem; - break; - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - if ( elem ) { - elem = elem[dir]; - var match = false; - - while ( elem ) { - if ( elem.sizcache === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 ) { - if ( !isXML ) { - elem.sizcache = doneName; - elem.sizset = i; - } - if ( typeof cur !== "string" ) { - if ( elem === cur ) { - match = true; - break; - } - - } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { - match = elem; - break; - } - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -var contains = document.compareDocumentPosition ? function(a, b){ - return !!(a.compareDocumentPosition(b) & 16); -} : function(a, b){ - return a !== b && (a.contains ? a.contains(b) : true); -}; - -var isXML = function(elem){ - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -var posProcess = function(selector, context){ - var tmpSet = [], later = "", match, - root = context.nodeType ? [context] : context; - - // Position selectors must be done after the filter - // And so must :not(positional) so we move all PSEUDOs to the end - while ( (match = Expr.match.PSEUDO.exec( selector )) ) { - later += match[0]; - selector = selector.replace( Expr.match.PSEUDO, "" ); - } - - selector = Expr.relative[selector] ? selector + "*" : selector; - - for ( var i = 0, l = root.length; i < l; i++ ) { - Sizzle( selector, root[i], tmpSet ); - } - - return Sizzle.filter( later, tmpSet ); -}; - -// EXPOSE -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; -jQuery.expr[":"] = jQuery.expr.filters; -jQuery.unique = Sizzle.uniqueSort; -jQuery.text = getText; -jQuery.isXMLDoc = isXML; -jQuery.contains = contains; - -return; - -window.Sizzle = Sizzle; - -})(); -var runtil = /Until$/, - rparentsprev = /^(?:parents|prevUntil|prevAll)/, - // Note: This RegExp should be improved, or likely pulled from Sizzle - rmultiselector = /,/, - slice = Array.prototype.slice; - -// Implement the identical functionality for filter and not -var winnow = function( elements, qualifier, keep ) { - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep(elements, function( elem, i ) { - return !!qualifier.call( elem, i, elem ) === keep; - }); - - } else if ( qualifier.nodeType ) { - return jQuery.grep(elements, function( elem, i ) { - return (elem === qualifier) === keep; - }); - - } else if ( typeof qualifier === "string" ) { - var filtered = jQuery.grep(elements, function( elem ) { - return elem.nodeType === 1; - }); - - if ( isSimple.test( qualifier ) ) { - return jQuery.filter(qualifier, filtered, !keep); - } else { - qualifier = jQuery.filter( qualifier, filtered ); - } - } - - return jQuery.grep(elements, function( elem, i ) { - return (jQuery.inArray( elem, qualifier ) >= 0) === keep; - }); -}; - -jQuery.fn.extend({ - find: function( selector ) { - var ret = this.pushStack( "", "find", selector ), length = 0; - - for ( var i = 0, l = this.length; i < l; i++ ) { - length = ret.length; - jQuery.find( selector, this[i], ret ); - - if ( i > 0 ) { - // Make sure that the results are unique - for ( var n = length; n < ret.length; n++ ) { - for ( var r = 0; r < length; r++ ) { - if ( ret[r] === ret[n] ) { - ret.splice(n--, 1); - break; - } - } - } - } - } - - return ret; - }, - - has: function( target ) { - var targets = jQuery( target ); - return this.filter(function() { - for ( var i = 0, l = targets.length; i < l; i++ ) { - if ( jQuery.contains( this, targets[i] ) ) { - return true; - } - } - }); - }, - - not: function( selector ) { - return this.pushStack( winnow(this, selector, false), "not", selector); - }, - - filter: function( selector ) { - return this.pushStack( winnow(this, selector, true), "filter", selector ); - }, - - is: function( selector ) { - return !!selector && jQuery.filter( selector, this ).length > 0; - }, - - closest: function( selectors, context ) { - if ( jQuery.isArray( selectors ) ) { - var ret = [], cur = this[0], match, matches = {}, selector; - - if ( cur && selectors.length ) { - for ( var i = 0, l = selectors.length; i < l; i++ ) { - selector = selectors[i]; - - if ( !matches[selector] ) { - matches[selector] = jQuery.expr.match.POS.test( selector ) ? - jQuery( selector, context || this.context ) : - selector; - } - } - - while ( cur && cur.ownerDocument && cur !== context ) { - for ( selector in matches ) { - match = matches[selector]; - - if ( match.jquery ? match.index(cur) > -1 : jQuery(cur).is(match) ) { - ret.push({ selector: selector, elem: cur }); - delete matches[selector]; - } - } - cur = cur.parentNode; - } - } - - return ret; - } - - var pos = jQuery.expr.match.POS.test( selectors ) ? - jQuery( selectors, context || this.context ) : null; - - return this.map(function( i, cur ) { - while ( cur && cur.ownerDocument && cur !== context ) { - if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selectors) ) { - return cur; - } - cur = cur.parentNode; - } - return null; - }); - }, - - // Determine the position of an element within - // the matched set of elements - index: function( elem ) { - if ( !elem || typeof elem === "string" ) { - return jQuery.inArray( this[0], - // If it receives a string, the selector is used - // If it receives nothing, the siblings are used - elem ? jQuery( elem ) : this.parent().children() ); - } - // Locate the position of the desired element - return jQuery.inArray( - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[0] : elem, this ); - }, - - add: function( selector, context ) { - var set = typeof selector === "string" ? - jQuery( selector, context || this.context ) : - jQuery.makeArray( selector ), - all = jQuery.merge( this.get(), set ); - - return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? - all : - jQuery.unique( all ) ); - }, - - andSelf: function() { - return this.add( this.prevObject ); - } -}); - -// A painfully simple check to see if an element is disconnected -// from a document (should be improved, where feasible). -function isDisconnected( node ) { - return !node || !node.parentNode || node.parentNode.nodeType === 11; -} - -jQuery.each({ - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return jQuery.dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return jQuery.dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return jQuery.nth( elem, 2, "nextSibling" ); - }, - prev: function( elem ) { - return jQuery.nth( elem, 2, "previousSibling" ); - }, - nextAll: function( elem ) { - return jQuery.dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return jQuery.dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return jQuery.dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return jQuery.dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return jQuery.sibling( elem.parentNode.firstChild, elem ); - }, - children: function( elem ) { - return jQuery.sibling( elem.firstChild ); - }, - contents: function( elem ) { - return jQuery.nodeName( elem, "iframe" ) ? - elem.contentDocument || elem.contentWindow.document : - jQuery.makeArray( elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var ret = jQuery.map( this, fn, until ); - - if ( !runtil.test( name ) ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - ret = jQuery.filter( selector, ret ); - } - - ret = this.length > 1 ? jQuery.unique( ret ) : ret; - - if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { - ret = ret.reverse(); - } - - return this.pushStack( ret, name, slice.call(arguments).join(",") ); - }; -}); - -jQuery.extend({ - filter: function( expr, elems, not ) { - if ( not ) { - expr = ":not(" + expr + ")"; - } - - return jQuery.find.matches(expr, elems); - }, - - dir: function( elem, dir, until ) { - var matched = [], cur = elem[dir]; - while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { - if ( cur.nodeType === 1 ) { - matched.push( cur ); - } - cur = cur[dir]; - } - return matched; - }, - - nth: function( cur, result, dir, elem ) { - result = result || 1; - var num = 0; - - for ( ; cur; cur = cur[dir] ) { - if ( cur.nodeType === 1 && ++num === result ) { - break; - } - } - - return cur; - }, - - sibling: function( n, elem ) { - var r = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - r.push( n ); - } - } - - return r; - } -}); -var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, - rleadingWhitespace = /^\s+/, - rxhtmlTag = /(<([\w:]+)[^>]*?)\/>/g, - rselfClosing = /^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i, - rtagName = /<([\w:]+)/, - rtbody = /<tbody/i, - rhtml = /<|&#?\w+;/, - rnocache = /<script|<object|<embed|<option|<style/i, - rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, // checked="checked" or checked (html5) - fcloseTag = function( all, front, tag ) { - return rselfClosing.test( tag ) ? - all : - front + "></" + tag + ">"; - }, - wrapMap = { - option: [ 1, "<select multiple='multiple'>", "</select>" ], - legend: [ 1, "<fieldset>", "</fieldset>" ], - thead: [ 1, "<table>", "</table>" ], - tr: [ 2, "<table><tbody>", "</tbody></table>" ], - td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], - col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ], - area: [ 1, "<map>", "</map>" ], - _default: [ 0, "", "" ] - }; - -wrapMap.optgroup = wrapMap.option; -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -// IE can't serialize <link> and <script> tags normally -if ( !jQuery.support.htmlSerialize ) { - wrapMap._default = [ 1, "div<div>", "</div>" ]; -} - -jQuery.fn.extend({ - text: function( text ) { - if ( jQuery.isFunction(text) ) { - return this.each(function(i) { - var self = jQuery(this); - self.text( text.call(this, i, self.text()) ); - }); - } - - if ( typeof text !== "object" && text !== undefined ) { - return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); - } - - return jQuery.text( this ); - }, - - wrapAll: function( html ) { - if ( jQuery.isFunction( html ) ) { - return this.each(function(i) { - jQuery(this).wrapAll( html.call(this, i) ); - }); - } - - if ( this[0] ) { - // The elements to wrap the target around - var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); - - if ( this[0].parentNode ) { - wrap.insertBefore( this[0] ); - } - - wrap.map(function() { - var elem = this; - - while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { - elem = elem.firstChild; - } - - return elem; - }).append(this); - } - - return this; - }, - - wrapInner: function( html ) { - if ( jQuery.isFunction( html ) ) { - return this.each(function(i) { - jQuery(this).wrapInner( html.call(this, i) ); - }); - } - - return this.each(function() { - var self = jQuery( this ), contents = self.contents(); - - if ( contents.length ) { - contents.wrapAll( html ); - - } else { - self.append( html ); - } - }); - }, - - wrap: function( html ) { - return this.each(function() { - jQuery( this ).wrapAll( html ); - }); - }, - - unwrap: function() { - return this.parent().each(function() { - if ( !jQuery.nodeName( this, "body" ) ) { - jQuery( this ).replaceWith( this.childNodes ); - } - }).end(); - }, - - append: function() { - return this.domManip(arguments, true, function( elem ) { - if ( this.nodeType === 1 ) { - this.appendChild( elem ); - } - }); - }, - - prepend: function() { - return this.domManip(arguments, true, function( elem ) { - if ( this.nodeType === 1 ) { - this.insertBefore( elem, this.firstChild ); - } - }); - }, - - before: function() { - if ( this[0] && this[0].parentNode ) { - return this.domManip(arguments, false, function( elem ) { - this.parentNode.insertBefore( elem, this ); - }); - } else if ( arguments.length ) { - var set = jQuery(arguments[0]); - set.push.apply( set, this.toArray() ); - return this.pushStack( set, "before", arguments ); - } - }, - - after: function() { - if ( this[0] && this[0].parentNode ) { - return this.domManip(arguments, false, function( elem ) { - this.parentNode.insertBefore( elem, this.nextSibling ); - }); - } else if ( arguments.length ) { - var set = this.pushStack( this, "after", arguments ); - set.push.apply( set, jQuery(arguments[0]).toArray() ); - return set; - } - }, - - // keepData is for internal use only--do not document - remove: function( selector, keepData ) { - for ( var i = 0, elem; (elem = this[i]) != null; i++ ) { - if ( !selector || jQuery.filter( selector, [ elem ] ).length ) { - if ( !keepData && elem.nodeType === 1 ) { - jQuery.cleanData( elem.getElementsByTagName("*") ); - jQuery.cleanData( [ elem ] ); - } - - if ( elem.parentNode ) { - elem.parentNode.removeChild( elem ); - } - } - } - - return this; - }, - - empty: function() { - for ( var i = 0, elem; (elem = this[i]) != null; i++ ) { - // Remove element nodes and prevent memory leaks - if ( elem.nodeType === 1 ) { - jQuery.cleanData( elem.getElementsByTagName("*") ); - } - - // Remove any remaining nodes - while ( elem.firstChild ) { - elem.removeChild( elem.firstChild ); - } - } - - return this; - }, - - clone: function( events ) { - // Do the clone - var ret = this.map(function() { - if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) { - // IE copies events bound via attachEvent when - // using cloneNode. Calling detachEvent on the - // clone will also remove the events from the orignal - // In order to get around this, we use innerHTML. - // Unfortunately, this means some modifications to - // attributes in IE that are actually only stored - // as properties will not be copied (such as the - // the name attribute on an input). - var html = this.outerHTML, ownerDocument = this.ownerDocument; - if ( !html ) { - var div = ownerDocument.createElement("div"); - div.appendChild( this.cloneNode(true) ); - html = div.innerHTML; - } - - return jQuery.clean([html.replace(rinlinejQuery, "") - // Handle the case in IE 8 where action=/test/> self-closes a tag - .replace(/=([^="'>\s]+\/)>/g, '="$1">') - .replace(rleadingWhitespace, "")], ownerDocument)[0]; - } else { - return this.cloneNode(true); - } - }); - - // Copy the events from the original to the clone - if ( events === true ) { - cloneCopyEvent( this, ret ); - cloneCopyEvent( this.find("*"), ret.find("*") ); - } - - // Return the cloned set - return ret; - }, - - html: function( value ) { - if ( value === undefined ) { - return this[0] && this[0].nodeType === 1 ? - this[0].innerHTML.replace(rinlinejQuery, "") : - null; - - // See if we can take a shortcut and just use innerHTML - } else if ( typeof value === "string" && !rnocache.test( value ) && - (jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) && - !wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) { - - value = value.replace(rxhtmlTag, fcloseTag); - - try { - for ( var i = 0, l = this.length; i < l; i++ ) { - // Remove element nodes and prevent memory leaks - if ( this[i].nodeType === 1 ) { - jQuery.cleanData( this[i].getElementsByTagName("*") ); - this[i].innerHTML = value; - } - } - - // If using innerHTML throws an exception, use the fallback method - } catch(e) { - this.empty().append( value ); - } - - } else if ( jQuery.isFunction( value ) ) { - this.each(function(i){ - var self = jQuery(this), old = self.html(); - self.empty().append(function(){ - return value.call( this, i, old ); - }); - }); - - } else { - this.empty().append( value ); - } - - return this; - }, - - replaceWith: function( value ) { - if ( this[0] && this[0].parentNode ) { - // Make sure that the elements are removed from the DOM before they are inserted - // this can help fix replacing a parent with child elements - if ( jQuery.isFunction( value ) ) { - return this.each(function(i) { - var self = jQuery(this), old = self.html(); - self.replaceWith( value.call( this, i, old ) ); - }); - } - - if ( typeof value !== "string" ) { - value = jQuery(value).detach(); - } - - return this.each(function() { - var next = this.nextSibling, parent = this.parentNode; - - jQuery(this).remove(); - - if ( next ) { - jQuery(next).before( value ); - } else { - jQuery(parent).append( value ); - } - }); - } else { - return this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ); - } - }, - - detach: function( selector ) { - return this.remove( selector, true ); - }, - - domManip: function( args, table, callback ) { - var results, first, value = args[0], scripts = [], fragment, parent; - - // We can't cloneNode fragments that contain checked, in WebKit - if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) { - return this.each(function() { - jQuery(this).domManip( args, table, callback, true ); - }); - } - - if ( jQuery.isFunction(value) ) { - return this.each(function(i) { - var self = jQuery(this); - args[0] = value.call(this, i, table ? self.html() : undefined); - self.domManip( args, table, callback ); - }); - } - - if ( this[0] ) { - parent = value && value.parentNode; - - // If we're in a fragment, just use that instead of building a new one - if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) { - results = { fragment: parent }; - - } else { - results = buildFragment( args, this, scripts ); - } - - fragment = results.fragment; - - if ( fragment.childNodes.length === 1 ) { - first = fragment = fragment.firstChild; - } else { - first = fragment.firstChild; - } - - if ( first ) { - table = table && jQuery.nodeName( first, "tr" ); - - for ( var i = 0, l = this.length; i < l; i++ ) { - callback.call( - table ? - root(this[i], first) : - this[i], - i > 0 || results.cacheable || this.length > 1 ? - fragment.cloneNode(true) : - fragment - ); - } - } - - if ( scripts.length ) { - jQuery.each( scripts, evalScript ); - } - } - - return this; - - function root( elem, cur ) { - return jQuery.nodeName(elem, "table") ? - (elem.getElementsByTagName("tbody")[0] || - elem.appendChild(elem.ownerDocument.createElement("tbody"))) : - elem; - } - } -}); - -function cloneCopyEvent(orig, ret) { - var i = 0; - - ret.each(function() { - if ( this.nodeName !== (orig[i] && orig[i].nodeName) ) { - return; - } - - var oldData = jQuery.data( orig[i++] ), curData = jQuery.data( this, oldData ), events = oldData && oldData.events; - - if ( events ) { - delete curData.handle; - curData.events = {}; - - for ( var type in events ) { - for ( var handler in events[ type ] ) { - jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data ); - } - } - } - }); -} - -function buildFragment( args, nodes, scripts ) { - var fragment, cacheable, cacheresults, - doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document); - - // Only cache "small" (1/2 KB) strings that are associated with the main document - // Cloning options loses the selected state, so don't cache them - // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment - // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache - if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document && - !rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) { - - cacheable = true; - cacheresults = jQuery.fragments[ args[0] ]; - if ( cacheresults ) { - if ( cacheresults !== 1 ) { - fragment = cacheresults; - } - } - } - - if ( !fragment ) { - fragment = doc.createDocumentFragment(); - jQuery.clean( args, doc, fragment, scripts ); - } - - if ( cacheable ) { - jQuery.fragments[ args[0] ] = cacheresults ? fragment : 1; - } - - return { fragment: fragment, cacheable: cacheable }; -} - -jQuery.fragments = {}; - -jQuery.each({ - appendTo: "append", - prependTo: "prepend", - insertBefore: "before", - insertAfter: "after", - replaceAll: "replaceWith" -}, function( name, original ) { - jQuery.fn[ name ] = function( selector ) { - var ret = [], insert = jQuery( selector ), - parent = this.length === 1 && this[0].parentNode; - - if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) { - insert[ original ]( this[0] ); - return this; - - } else { - for ( var i = 0, l = insert.length; i < l; i++ ) { - var elems = (i > 0 ? this.clone(true) : this).get(); - jQuery.fn[ original ].apply( jQuery(insert[i]), elems ); - ret = ret.concat( elems ); - } - - return this.pushStack( ret, name, insert.selector ); - } - }; -}); - -jQuery.extend({ - clean: function( elems, context, fragment, scripts ) { - context = context || document; - - // !context.createElement fails in IE with an error but returns typeof 'object' - if ( typeof context.createElement === "undefined" ) { - context = context.ownerDocument || context[0] && context[0].ownerDocument || document; - } - - var ret = []; - - for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { - if ( typeof elem === "number" ) { - elem += ""; - } - - if ( !elem ) { - continue; - } - - // Convert html string into DOM nodes - if ( typeof elem === "string" && !rhtml.test( elem ) ) { - elem = context.createTextNode( elem ); - - } else if ( typeof elem === "string" ) { - // Fix "XHTML"-style tags in all browsers - elem = elem.replace(rxhtmlTag, fcloseTag); - - // Trim whitespace, otherwise indexOf won't work as expected - var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(), - wrap = wrapMap[ tag ] || wrapMap._default, - depth = wrap[0], - div = context.createElement("div"); - - // Go to html and back, then peel off extra wrappers - div.innerHTML = wrap[1] + elem + wrap[2]; - - // Move to the right depth - while ( depth-- ) { - div = div.lastChild; - } - - // Remove IE's autoinserted <tbody> from table fragments - if ( !jQuery.support.tbody ) { - - // String was a <table>, *may* have spurious <tbody> - var hasBody = rtbody.test(elem), - tbody = tag === "table" && !hasBody ? - div.firstChild && div.firstChild.childNodes : - - // String was a bare <thead> or <tfoot> - wrap[1] === "<table>" && !hasBody ? - div.childNodes : - []; - - for ( var j = tbody.length - 1; j >= 0 ; --j ) { - if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) { - tbody[ j ].parentNode.removeChild( tbody[ j ] ); - } - } - - } - - // IE completely kills leading whitespace when innerHTML is used - if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { - div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild ); - } - - elem = div.childNodes; - } - - if ( elem.nodeType ) { - ret.push( elem ); - } else { - ret = jQuery.merge( ret, elem ); - } - } - - if ( fragment ) { - for ( var i = 0; ret[i]; i++ ) { - if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) { - scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] ); - - } else { - if ( ret[i].nodeType === 1 ) { - ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) ); - } - fragment.appendChild( ret[i] ); - } - } - } - - return ret; - }, - - cleanData: function( elems ) { - var data, id, cache = jQuery.cache, - special = jQuery.event.special, - deleteExpando = jQuery.support.deleteExpando; - - for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { - id = elem[ jQuery.expando ]; - - if ( id ) { - data = cache[ id ]; - - if ( data.events ) { - for ( var type in data.events ) { - if ( special[ type ] ) { - jQuery.event.remove( elem, type ); - - } else { - removeEvent( elem, type, data.handle ); - } - } - } - - if ( deleteExpando ) { - delete elem[ jQuery.expando ]; - - } else if ( elem.removeAttribute ) { - elem.removeAttribute( jQuery.expando ); - } - - delete cache[ id ]; - } - } - } -}); -// exclude the following css properties to add px -var rexclude = /z-?index|font-?weight|opacity|zoom|line-?height/i, - ralpha = /alpha\([^)]*\)/, - ropacity = /opacity=([^)]*)/, - rfloat = /float/i, - rdashAlpha = /-([a-z])/ig, - rupper = /([A-Z])/g, - rnumpx = /^-?\d+(?:px)?$/i, - rnum = /^-?\d/, - - cssShow = { position: "absolute", visibility: "hidden", display:"block" }, - cssWidth = [ "Left", "Right" ], - cssHeight = [ "Top", "Bottom" ], - - // cache check for defaultView.getComputedStyle - getComputedStyle = document.defaultView && document.defaultView.getComputedStyle, - // normalize float css property - styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat", - fcamelCase = function( all, letter ) { - return letter.toUpperCase(); - }; - -jQuery.fn.css = function( name, value ) { - return access( this, name, value, true, function( elem, name, value ) { - if ( value === undefined ) { - return jQuery.curCSS( elem, name ); - } - - if ( typeof value === "number" && !rexclude.test(name) ) { - value += "px"; - } - - jQuery.style( elem, name, value ); - }); -}; - -jQuery.extend({ - style: function( elem, name, value ) { - // don't set styles on text and comment nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) { - return undefined; - } - - // ignore negative width and height values #1599 - if ( (name === "width" || name === "height") && parseFloat(value) < 0 ) { - value = undefined; - } - - var style = elem.style || elem, set = value !== undefined; - - // IE uses filters for opacity - if ( !jQuery.support.opacity && name === "opacity" ) { - if ( set ) { - // IE has trouble with opacity if it does not have layout - // Force it by setting the zoom level - style.zoom = 1; - - // Set the alpha filter to set the opacity - var opacity = parseInt( value, 10 ) + "" === "NaN" ? "" : "alpha(opacity=" + value * 100 + ")"; - var filter = style.filter || jQuery.curCSS( elem, "filter" ) || ""; - style.filter = ralpha.test(filter) ? filter.replace(ralpha, opacity) : opacity; - } - - return style.filter && style.filter.indexOf("opacity=") >= 0 ? - (parseFloat( ropacity.exec(style.filter)[1] ) / 100) + "": - ""; - } - - // Make sure we're using the right name for getting the float value - if ( rfloat.test( name ) ) { - name = styleFloat; - } - - name = name.replace(rdashAlpha, fcamelCase); - - if ( set ) { - style[ name ] = value; - } - - return style[ name ]; - }, - - css: function( elem, name, force, extra ) { - if ( name === "width" || name === "height" ) { - var val, props = cssShow, which = name === "width" ? cssWidth : cssHeight; - - function getWH() { - val = name === "width" ? elem.offsetWidth : elem.offsetHeight; - - if ( extra === "border" ) { - return; - } - - jQuery.each( which, function() { - if ( !extra ) { - val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0; - } - - if ( extra === "margin" ) { - val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0; - } else { - val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0; - } - }); - } - - if ( elem.offsetWidth !== 0 ) { - getWH(); - } else { - jQuery.swap( elem, props, getWH ); - } - - return Math.max(0, Math.round(val)); - } - - return jQuery.curCSS( elem, name, force ); - }, - - curCSS: function( elem, name, force ) { - var ret, style = elem.style, filter; - - // IE uses filters for opacity - if ( !jQuery.support.opacity && name === "opacity" && elem.currentStyle ) { - ret = ropacity.test(elem.currentStyle.filter || "") ? - (parseFloat(RegExp.$1) / 100) + "" : - ""; - - return ret === "" ? - "1" : - ret; - } - - // Make sure we're using the right name for getting the float value - if ( rfloat.test( name ) ) { - name = styleFloat; - } - - if ( !force && style && style[ name ] ) { - ret = style[ name ]; - - } else if ( getComputedStyle ) { - - // Only "float" is needed here - if ( rfloat.test( name ) ) { - name = "float"; - } - - name = name.replace( rupper, "-$1" ).toLowerCase(); - - var defaultView = elem.ownerDocument.defaultView; - - if ( !defaultView ) { - return null; - } - - var computedStyle = defaultView.getComputedStyle( elem, null ); - - if ( computedStyle ) { - ret = computedStyle.getPropertyValue( name ); - } - - // We should always get a number back from opacity - if ( name === "opacity" && ret === "" ) { - ret = "1"; - } - - } else if ( elem.currentStyle ) { - var camelCase = name.replace(rdashAlpha, fcamelCase); - - ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ]; - - // From the awesome hack by Dean Edwards - // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 - - // If we're not dealing with a regular pixel number - // but a number that has a weird ending, we need to convert it to pixels - if ( !rnumpx.test( ret ) && rnum.test( ret ) ) { - // Remember the original values - var left = style.left, rsLeft = elem.runtimeStyle.left; - - // Put in the new values to get a computed value out - elem.runtimeStyle.left = elem.currentStyle.left; - style.left = camelCase === "fontSize" ? "1em" : (ret || 0); - ret = style.pixelLeft + "px"; - - // Revert the changed values - style.left = left; - elem.runtimeStyle.left = rsLeft; - } - } - - return ret; - }, - - // A method for quickly swapping in/out CSS properties to get correct calculations - swap: function( elem, options, callback ) { - var old = {}; - - // Remember the old values, and insert the new ones - for ( var name in options ) { - old[ name ] = elem.style[ name ]; - elem.style[ name ] = options[ name ]; - } - - callback.call( elem ); - - // Revert the old values - for ( var name in options ) { - elem.style[ name ] = old[ name ]; - } - } -}); - -if ( jQuery.expr && jQuery.expr.filters ) { - jQuery.expr.filters.hidden = function( elem ) { - var width = elem.offsetWidth, height = elem.offsetHeight, - skip = elem.nodeName.toLowerCase() === "tr"; - - return width === 0 && height === 0 && !skip ? - true : - width > 0 && height > 0 && !skip ? - false : - jQuery.curCSS(elem, "display") === "none"; - }; - - jQuery.expr.filters.visible = function( elem ) { - return !jQuery.expr.filters.hidden( elem ); - }; -} -var jsc = now(), - rscript = /<script(.|\s)*?\/script>/gi, - rselectTextarea = /select|textarea/i, - rinput = /color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i, - jsre = /=\?(&|$)/, - rquery = /\?/, - rts = /(\?|&)_=.*?(&|$)/, - rurl = /^(\w+:)?\/\/([^\/?#]+)/, - r20 = /%20/g, - - // Keep a copy of the old load method - _load = jQuery.fn.load; - -jQuery.fn.extend({ - load: function( url, params, callback ) { - if ( typeof url !== "string" ) { - return _load.call( this, url ); - - // Don't do a request if no elements are being requested - } else if ( !this.length ) { - return this; - } - - var off = url.indexOf(" "); - if ( off >= 0 ) { - var selector = url.slice(off, url.length); - url = url.slice(0, off); - } - - // Default to a GET request - var type = "GET"; - - // If the second parameter was provided - if ( params ) { - // If it's a function - if ( jQuery.isFunction( params ) ) { - // We assume that it's the callback - callback = params; - params = null; - - // Otherwise, build a param string - } else if ( typeof params === "object" ) { - params = jQuery.param( params, jQuery.ajaxSettings.traditional ); - type = "POST"; - } - } - - var self = this; - - // Request the remote document - jQuery.ajax({ - url: url, - type: type, - dataType: "html", - data: params, - complete: function( res, status ) { - // If successful, inject the HTML into all the matched elements - if ( status === "success" || status === "notmodified" ) { - // See if a selector was specified - self.html( selector ? - // Create a dummy div to hold the results - jQuery("<div />") - // inject the contents of the document in, removing the scripts - // to avoid any 'Permission Denied' errors in IE - .append(res.responseText.replace(rscript, "")) - - // Locate the specified elements - .find(selector) : - - // If not, just inject the full result - res.responseText ); - } - - if ( callback ) { - self.each( callback, [res.responseText, status, res] ); - } - } - }); - - return this; - }, - - serialize: function() { - return jQuery.param(this.serializeArray()); - }, - serializeArray: function() { - return this.map(function() { - return this.elements ? jQuery.makeArray(this.elements) : this; - }) - .filter(function() { - return this.name && !this.disabled && - (this.checked || rselectTextarea.test(this.nodeName) || - rinput.test(this.type)); - }) - .map(function( i, elem ) { - var val = jQuery(this).val(); - - return val == null ? - null : - jQuery.isArray(val) ? - jQuery.map( val, function( val, i ) { - return { name: elem.name, value: val }; - }) : - { name: elem.name, value: val }; - }).get(); - } -}); - -// Attach a bunch of functions for handling common AJAX events -jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), function( i, o ) { - jQuery.fn[o] = function( f ) { - return this.bind(o, f); - }; -}); - -jQuery.extend({ - - get: function( url, data, callback, type ) { - // shift arguments if data argument was omited - if ( jQuery.isFunction( data ) ) { - type = type || callback; - callback = data; - data = null; - } - - return jQuery.ajax({ - type: "GET", - url: url, - data: data, - success: callback, - dataType: type - }); - }, - - getScript: function( url, callback ) { - return jQuery.get(url, null, callback, "script"); - }, - - getJSON: function( url, data, callback ) { - return jQuery.get(url, data, callback, "json"); - }, - - post: function( url, data, callback, type ) { - // shift arguments if data argument was omited - if ( jQuery.isFunction( data ) ) { - type = type || callback; - callback = data; - data = {}; - } - - return jQuery.ajax({ - type: "POST", - url: url, - data: data, - success: callback, - dataType: type - }); - }, - - ajaxSetup: function( settings ) { - jQuery.extend( jQuery.ajaxSettings, settings ); - }, - - ajaxSettings: { - url: location.href, - global: true, - type: "GET", - contentType: "application/x-www-form-urlencoded", - processData: true, - async: true, - /* - timeout: 0, - data: null, - username: null, - password: null, - traditional: false, - */ - // Create the request object; Microsoft failed to properly - // implement the XMLHttpRequest in IE7 (can't request local files), - // so we use the ActiveXObject when it is available - // This function can be overriden by calling jQuery.ajaxSetup - xhr: window.XMLHttpRequest && (window.location.protocol !== "file:" || !window.ActiveXObject) ? - function() { - return new window.XMLHttpRequest(); - } : - function() { - try { - return new window.ActiveXObject("Microsoft.XMLHTTP"); - } catch(e) {} - }, - accepts: { - xml: "application/xml, text/xml", - html: "text/html", - script: "text/javascript, application/javascript", - json: "application/json, text/javascript", - text: "text/plain", - _default: "*/*" - } - }, - - // Last-Modified header cache for next request - lastModified: {}, - etag: {}, - - ajax: function( origSettings ) { - var s = jQuery.extend(true, {}, jQuery.ajaxSettings, origSettings); - - var jsonp, status, data, - callbackContext = origSettings && origSettings.context || s, - type = s.type.toUpperCase(); - - // convert data if not already a string - if ( s.data && s.processData && typeof s.data !== "string" ) { - s.data = jQuery.param( s.data, s.traditional ); - } - - // Handle JSONP Parameter Callbacks - if ( s.dataType === "jsonp" ) { - if ( type === "GET" ) { - if ( !jsre.test( s.url ) ) { - s.url += (rquery.test( s.url ) ? "&" : "?") + (s.jsonp || "callback") + "=?"; - } - } else if ( !s.data || !jsre.test(s.data) ) { - s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?"; - } - s.dataType = "json"; - } - - // Build temporary JSONP function - if ( s.dataType === "json" && (s.data && jsre.test(s.data) || jsre.test(s.url)) ) { - jsonp = s.jsonpCallback || ("jsonp" + jsc++); - - // Replace the =? sequence both in the query string and the data - if ( s.data ) { - s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1"); - } - - s.url = s.url.replace(jsre, "=" + jsonp + "$1"); - - // We need to make sure - // that a JSONP style response is executed properly - s.dataType = "script"; - - // Handle JSONP-style loading - window[ jsonp ] = window[ jsonp ] || function( tmp ) { - data = tmp; - success(); - complete(); - // Garbage collect - window[ jsonp ] = undefined; - - try { - delete window[ jsonp ]; - } catch(e) {} - - if ( head ) { - head.removeChild( script ); - } - }; - } - - if ( s.dataType === "script" && s.cache === null ) { - s.cache = false; - } - - if ( s.cache === false && type === "GET" ) { - var ts = now(); - - // try replacing _= if it is there - var ret = s.url.replace(rts, "$1_=" + ts + "$2"); - - // if nothing was replaced, add timestamp to the end - s.url = ret + ((ret === s.url) ? (rquery.test(s.url) ? "&" : "?") + "_=" + ts : ""); - } - - // If data is available, append data to url for get requests - if ( s.data && type === "GET" ) { - s.url += (rquery.test(s.url) ? "&" : "?") + s.data; - } - - // Watch for a new set of requests - if ( s.global && ! jQuery.active++ ) { - jQuery.event.trigger( "ajaxStart" ); - } - - // Matches an absolute URL, and saves the domain - var parts = rurl.exec( s.url ), - remote = parts && (parts[1] && parts[1] !== location.protocol || parts[2] !== location.host); - - // If we're requesting a remote document - // and trying to load JSON or Script with a GET - if ( s.dataType === "script" && type === "GET" && remote ) { - var head = document.getElementsByTagName("head")[0] || document.documentElement; - var script = document.createElement("script"); - script.src = s.url; - if ( s.scriptCharset ) { - script.charset = s.scriptCharset; - } - - // Handle Script loading - if ( !jsonp ) { - var done = false; - - // Attach handlers for all browsers - script.onload = script.onreadystatechange = function() { - if ( !done && (!this.readyState || - this.readyState === "loaded" || this.readyState === "complete") ) { - done = true; - success(); - complete(); - - // Handle memory leak in IE - script.onload = script.onreadystatechange = null; - if ( head && script.parentNode ) { - head.removeChild( script ); - } - } - }; - } - - // Use insertBefore instead of appendChild to circumvent an IE6 bug. - // This arises when a base node is used (#2709 and #4378). - head.insertBefore( script, head.firstChild ); - - // We handle everything using the script element injection - return undefined; - } - - var requestDone = false; - - // Create the request object - var xhr = s.xhr(); - - if ( !xhr ) { - return; - } - - // Open the socket - // Passing null username, generates a login popup on Opera (#2865) - if ( s.username ) { - xhr.open(type, s.url, s.async, s.username, s.password); - } else { - xhr.open(type, s.url, s.async); - } - - // Need an extra try/catch for cross domain requests in Firefox 3 - try { - // Set the correct header, if data is being sent - if ( s.data || origSettings && origSettings.contentType ) { - xhr.setRequestHeader("Content-Type", s.contentType); - } - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - if ( jQuery.lastModified[s.url] ) { - xhr.setRequestHeader("If-Modified-Since", jQuery.lastModified[s.url]); - } - - if ( jQuery.etag[s.url] ) { - xhr.setRequestHeader("If-None-Match", jQuery.etag[s.url]); - } - } - - // Set header so the called script knows that it's an XMLHttpRequest - // Only send the header if it's not a remote XHR - if ( !remote ) { - xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); - } - - // Set the Accepts header for the server, depending on the dataType - xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ? - s.accepts[ s.dataType ] + ", */*" : - s.accepts._default ); - } catch(e) {} - - // Allow custom headers/mimetypes and early abort - if ( s.beforeSend && s.beforeSend.call(callbackContext, xhr, s) === false ) { - // Handle the global AJAX counter - if ( s.global && ! --jQuery.active ) { - jQuery.event.trigger( "ajaxStop" ); - } - - // close opended socket - xhr.abort(); - return false; - } - - if ( s.global ) { - trigger("ajaxSend", [xhr, s]); - } - - // Wait for a response to come back - var onreadystatechange = xhr.onreadystatechange = function( isTimeout ) { - // The request was aborted - if ( !xhr || xhr.readyState === 0 || isTimeout === "abort" ) { - // Opera doesn't call onreadystatechange before this point - // so we simulate the call - if ( !requestDone ) { - complete(); - } - - requestDone = true; - if ( xhr ) { - xhr.onreadystatechange = jQuery.noop; - } - - // The transfer is complete and the data is available, or the request timed out - } else if ( !requestDone && xhr && (xhr.readyState === 4 || isTimeout === "timeout") ) { - requestDone = true; - xhr.onreadystatechange = jQuery.noop; - - status = isTimeout === "timeout" ? - "timeout" : - !jQuery.httpSuccess( xhr ) ? - "error" : - s.ifModified && jQuery.httpNotModified( xhr, s.url ) ? - "notmodified" : - "success"; - - var errMsg; - - if ( status === "success" ) { - // Watch for, and catch, XML document parse errors - try { - // process the data (runs the xml through httpData regardless of callback) - data = jQuery.httpData( xhr, s.dataType, s ); - } catch(err) { - status = "parsererror"; - errMsg = err; - } - } - - // Make sure that the request was successful or notmodified - if ( status === "success" || status === "notmodified" ) { - // JSONP handles its own success callback - if ( !jsonp ) { - success(); - } - } else { - jQuery.handleError(s, xhr, status, errMsg); - } - - // Fire the complete handlers - complete(); - - if ( isTimeout === "timeout" ) { - xhr.abort(); - } - - // Stop memory leaks - if ( s.async ) { - xhr = null; - } - } - }; - - // Override the abort handler, if we can (IE doesn't allow it, but that's OK) - // Opera doesn't fire onreadystatechange at all on abort - try { - var oldAbort = xhr.abort; - xhr.abort = function() { - if ( xhr ) { - oldAbort.call( xhr ); - } - - onreadystatechange( "abort" ); - }; - } catch(e) { } - - // Timeout checker - if ( s.async && s.timeout > 0 ) { - setTimeout(function() { - // Check to see if the request is still happening - if ( xhr && !requestDone ) { - onreadystatechange( "timeout" ); - } - }, s.timeout); - } - - // Send the data - try { - xhr.send( type === "POST" || type === "PUT" || type === "DELETE" ? s.data : null ); - } catch(e) { - jQuery.handleError(s, xhr, null, e); - // Fire the complete handlers - complete(); - } - - // firefox 1.5 doesn't fire statechange for sync requests - if ( !s.async ) { - onreadystatechange(); - } - - function success() { - // If a local callback was specified, fire it and pass it the data - if ( s.success ) { - s.success.call( callbackContext, data, status, xhr ); - } - - // Fire the global callback - if ( s.global ) { - trigger( "ajaxSuccess", [xhr, s] ); - } - } - - function complete() { - // Process result - if ( s.complete ) { - s.complete.call( callbackContext, xhr, status); - } - - // The request was completed - if ( s.global ) { - trigger( "ajaxComplete", [xhr, s] ); - } - - // Handle the global AJAX counter - if ( s.global && ! --jQuery.active ) { - jQuery.event.trigger( "ajaxStop" ); - } - } - - function trigger(type, args) { - (s.context ? jQuery(s.context) : jQuery.event).trigger(type, args); - } - - // return XMLHttpRequest to allow aborting the request etc. - return xhr; - }, - - handleError: function( s, xhr, status, e ) { - // If a local callback was specified, fire it - if ( s.error ) { - s.error.call( s.context || s, xhr, status, e ); - } - - // Fire the global callback - if ( s.global ) { - (s.context ? jQuery(s.context) : jQuery.event).trigger( "ajaxError", [xhr, s, e] ); - } - }, - - // Counter for holding the number of active queries - active: 0, - - // Determines if an XMLHttpRequest was successful or not - httpSuccess: function( xhr ) { - try { - // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450 - return !xhr.status && location.protocol === "file:" || - // Opera returns 0 when status is 304 - ( xhr.status >= 200 && xhr.status < 300 ) || - xhr.status === 304 || xhr.status === 1223 || xhr.status === 0; - } catch(e) {} - - return false; - }, - - // Determines if an XMLHttpRequest returns NotModified - httpNotModified: function( xhr, url ) { - var lastModified = xhr.getResponseHeader("Last-Modified"), - etag = xhr.getResponseHeader("Etag"); - - if ( lastModified ) { - jQuery.lastModified[url] = lastModified; - } - - if ( etag ) { - jQuery.etag[url] = etag; - } - - // Opera returns 0 when status is 304 - return xhr.status === 304 || xhr.status === 0; - }, - - httpData: function( xhr, type, s ) { - var ct = xhr.getResponseHeader("content-type") || "", - xml = type === "xml" || !type && ct.indexOf("xml") >= 0, - data = xml ? xhr.responseXML : xhr.responseText; - - if ( xml && data.documentElement.nodeName === "parsererror" ) { - jQuery.error( "parsererror" ); - } - - // Allow a pre-filtering function to sanitize the response - // s is checked to keep backwards compatibility - if ( s && s.dataFilter ) { - data = s.dataFilter( data, type ); - } - - // The filter can actually parse the response - if ( typeof data === "string" ) { - // Get the JavaScript object, if JSON is used. - if ( type === "json" || !type && ct.indexOf("json") >= 0 ) { - data = jQuery.parseJSON( data ); - - // If the type is "script", eval it in global context - } else if ( type === "script" || !type && ct.indexOf("javascript") >= 0 ) { - jQuery.globalEval( data ); - } - } - - return data; - }, - - // Serialize an array of form elements or a set of - // key/values into a query string - param: function( a, traditional ) { - var s = []; - - // Set traditional to true for jQuery <= 1.3.2 behavior. - if ( traditional === undefined ) { - traditional = jQuery.ajaxSettings.traditional; - } - - // If an array was passed in, assume that it is an array of form elements. - if ( jQuery.isArray(a) || a.jquery ) { - // Serialize the form elements - jQuery.each( a, function() { - add( this.name, this.value ); - }); - - } else { - // If traditional, encode the "old" way (the way 1.3.2 or older - // did it), otherwise encode params recursively. - for ( var prefix in a ) { - buildParams( prefix, a[prefix] ); - } - } - - // Return the resulting serialization - return s.join("&").replace(r20, "+"); - - function buildParams( prefix, obj ) { - if ( jQuery.isArray(obj) ) { - // Serialize array item. - jQuery.each( obj, function( i, v ) { - if ( traditional || /\[\]$/.test( prefix ) ) { - // Treat each array item as a scalar. - add( prefix, v ); - } else { - // If array item is non-scalar (array or object), encode its - // numeric index to resolve deserialization ambiguity issues. - // Note that rack (as of 1.0.0) can't currently deserialize - // nested arrays properly, and attempting to do so may cause - // a server error. Possible fixes are to modify rack's - // deserialization algorithm or to provide an option or flag - // to force array serialization to be shallow. - buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v ); - } - }); - - } else if ( !traditional && obj != null && typeof obj === "object" ) { - // Serialize object item. - jQuery.each( obj, function( k, v ) { - buildParams( prefix + "[" + k + "]", v ); - }); - - } else { - // Serialize scalar item. - add( prefix, obj ); - } - } - - function add( key, value ) { - // If value is a function, invoke it and return its value - value = jQuery.isFunction(value) ? value() : value; - s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value); - } - } -}); -var elemdisplay = {}, - rfxtypes = /toggle|show|hide/, - rfxnum = /^([+-]=)?([\d+-.]+)(.*)$/, - timerId, - fxAttrs = [ - // height animations - [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ], - // width animations - [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ], - // opacity animations - [ "opacity" ] - ]; - -jQuery.fn.extend({ - show: function( speed, callback ) { - if ( speed || speed === 0) { - return this.animate( genFx("show", 3), speed, callback); - - } else { - for ( var i = 0, l = this.length; i < l; i++ ) { - var old = jQuery.data(this[i], "olddisplay"); - - this[i].style.display = old || ""; - - if ( jQuery.css(this[i], "display") === "none" ) { - var nodeName = this[i].nodeName, display; - - if ( elemdisplay[ nodeName ] ) { - display = elemdisplay[ nodeName ]; - - } else { - var elem = jQuery("<" + nodeName + " />").appendTo("body"); - - display = elem.css("display"); - - if ( display === "none" ) { - display = "block"; - } - - elem.remove(); - - elemdisplay[ nodeName ] = display; - } - - jQuery.data(this[i], "olddisplay", display); - } - } - - // Set the display of the elements in a second loop - // to avoid the constant reflow - for ( var j = 0, k = this.length; j < k; j++ ) { - this[j].style.display = jQuery.data(this[j], "olddisplay") || ""; - } - - return this; - } - }, - - hide: function( speed, callback ) { - if ( speed || speed === 0 ) { - return this.animate( genFx("hide", 3), speed, callback); - - } else { - for ( var i = 0, l = this.length; i < l; i++ ) { - var old = jQuery.data(this[i], "olddisplay"); - if ( !old && old !== "none" ) { - jQuery.data(this[i], "olddisplay", jQuery.css(this[i], "display")); - } - } - - // Set the display of the elements in a second loop - // to avoid the constant reflow - for ( var j = 0, k = this.length; j < k; j++ ) { - this[j].style.display = "none"; - } - - return this; - } - }, - - // Save the old toggle function - _toggle: jQuery.fn.toggle, - - toggle: function( fn, fn2 ) { - var bool = typeof fn === "boolean"; - - if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) { - this._toggle.apply( this, arguments ); - - } else if ( fn == null || bool ) { - this.each(function() { - var state = bool ? fn : jQuery(this).is(":hidden"); - jQuery(this)[ state ? "show" : "hide" ](); - }); - - } else { - this.animate(genFx("toggle", 3), fn, fn2); - } - - return this; - }, - - fadeTo: function( speed, to, callback ) { - return this.filter(":hidden").css("opacity", 0).show().end() - .animate({opacity: to}, speed, callback); - }, - - animate: function( prop, speed, easing, callback ) { - var optall = jQuery.speed(speed, easing, callback); - - if ( jQuery.isEmptyObject( prop ) ) { - return this.each( optall.complete ); - } - - return this[ optall.queue === false ? "each" : "queue" ](function() { - var opt = jQuery.extend({}, optall), p, - hidden = this.nodeType === 1 && jQuery(this).is(":hidden"), - self = this; - - for ( p in prop ) { - var name = p.replace(rdashAlpha, fcamelCase); - - if ( p !== name ) { - prop[ name ] = prop[ p ]; - delete prop[ p ]; - p = name; - } - - if ( prop[p] === "hide" && hidden || prop[p] === "show" && !hidden ) { - return opt.complete.call(this); - } - - if ( ( p === "height" || p === "width" ) && this.style ) { - // Store display property - opt.display = jQuery.css(this, "display"); - - // Make sure that nothing sneaks out - opt.overflow = this.style.overflow; - } - - if ( jQuery.isArray( prop[p] ) ) { - // Create (if needed) and add to specialEasing - (opt.specialEasing = opt.specialEasing || {})[p] = prop[p][1]; - prop[p] = prop[p][0]; - } - } - - if ( opt.overflow != null ) { - this.style.overflow = "hidden"; - } - - opt.curAnim = jQuery.extend({}, prop); - - jQuery.each( prop, function( name, val ) { - var e = new jQuery.fx( self, opt, name ); - - if ( rfxtypes.test(val) ) { - e[ val === "toggle" ? hidden ? "show" : "hide" : val ]( prop ); - - } else { - var parts = rfxnum.exec(val), - start = e.cur(true) || 0; - - if ( parts ) { - var end = parseFloat( parts[2] ), - unit = parts[3] || "px"; - - // We need to compute starting value - if ( unit !== "px" ) { - self.style[ name ] = (end || 1) + unit; - start = ((end || 1) / e.cur(true)) * start; - self.style[ name ] = start + unit; - } - - // If a +=/-= token was provided, we're doing a relative animation - if ( parts[1] ) { - end = ((parts[1] === "-=" ? -1 : 1) * end) + start; - } - - e.custom( start, end, unit ); - - } else { - e.custom( start, val, "" ); - } - } - }); - - // For JS strict compliance - return true; - }); - }, - - stop: function( clearQueue, gotoEnd ) { - var timers = jQuery.timers; - - if ( clearQueue ) { - this.queue([]); - } - - this.each(function() { - // go in reverse order so anything added to the queue during the loop is ignored - for ( var i = timers.length - 1; i >= 0; i-- ) { - if ( timers[i].elem === this ) { - if (gotoEnd) { - // force the next step to be the last - timers[i](true); - } - - timers.splice(i, 1); - } - } - }); - - // start the next in the queue if the last step wasn't forced - if ( !gotoEnd ) { - this.dequeue(); - } - - return this; - } - -}); - -// Generate shortcuts for custom animations -jQuery.each({ - slideDown: genFx("show", 1), - slideUp: genFx("hide", 1), - slideToggle: genFx("toggle", 1), - fadeIn: { opacity: "show" }, - fadeOut: { opacity: "hide" } -}, function( name, props ) { - jQuery.fn[ name ] = function( speed, callback ) { - return this.animate( props, speed, callback ); - }; -}); - -jQuery.extend({ - speed: function( speed, easing, fn ) { - var opt = speed && typeof speed === "object" ? speed : { - complete: fn || !fn && easing || - jQuery.isFunction( speed ) && speed, - duration: speed, - easing: fn && easing || easing && !jQuery.isFunction(easing) && easing - }; - - opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : - jQuery.fx.speeds[opt.duration] || jQuery.fx.speeds._default; - - // Queueing - opt.old = opt.complete; - opt.complete = function() { - if ( opt.queue !== false ) { - jQuery(this).dequeue(); - } - if ( jQuery.isFunction( opt.old ) ) { - opt.old.call( this ); - } - }; - - return opt; - }, - - easing: { - linear: function( p, n, firstNum, diff ) { - return firstNum + diff * p; - }, - swing: function( p, n, firstNum, diff ) { - return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum; - } - }, - - timers: [], - - fx: function( elem, options, prop ) { - this.options = options; - this.elem = elem; - this.prop = prop; - - if ( !options.orig ) { - options.orig = {}; - } - } - -}); - -jQuery.fx.prototype = { - // Simple function for setting a style value - update: function() { - if ( this.options.step ) { - this.options.step.call( this.elem, this.now, this ); - } - - (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this ); - - // Set display property to block for height/width animations - if ( ( this.prop === "height" || this.prop === "width" ) && this.elem.style ) { - this.elem.style.display = "block"; - } - }, - - // Get the current size - cur: function( force ) { - if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) { - return this.elem[ this.prop ]; - } - - var r = parseFloat(jQuery.css(this.elem, this.prop, force)); - return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0; - }, - - // Start an animation from one number to another - custom: function( from, to, unit ) { - this.startTime = now(); - this.start = from; - this.end = to; - this.unit = unit || this.unit || "px"; - this.now = this.start; - this.pos = this.state = 0; - - var self = this; - function t( gotoEnd ) { - return self.step(gotoEnd); - } - - t.elem = this.elem; - - if ( t() && jQuery.timers.push(t) && !timerId ) { - timerId = setInterval(jQuery.fx.tick, 13); - } - }, - - // Simple 'show' function - show: function() { - // Remember where we started, so that we can go back to it later - this.options.orig[this.prop] = jQuery.style( this.elem, this.prop ); - this.options.show = true; - - // Begin the animation - // Make sure that we start at a small width/height to avoid any - // flash of content - this.custom(this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur()); - - // Start by showing the element - jQuery( this.elem ).show(); - }, - - // Simple 'hide' function - hide: function() { - // Remember where we started, so that we can go back to it later - this.options.orig[this.prop] = jQuery.style( this.elem, this.prop ); - this.options.hide = true; - - // Begin the animation - this.custom(this.cur(), 0); - }, - - // Each step of an animation - step: function( gotoEnd ) { - var t = now(), done = true; - - if ( gotoEnd || t >= this.options.duration + this.startTime ) { - this.now = this.end; - this.pos = this.state = 1; - this.update(); - - this.options.curAnim[ this.prop ] = true; - - for ( var i in this.options.curAnim ) { - if ( this.options.curAnim[i] !== true ) { - done = false; - } - } - - if ( done ) { - if ( this.options.display != null ) { - // Reset the overflow - this.elem.style.overflow = this.options.overflow; - - // Reset the display - var old = jQuery.data(this.elem, "olddisplay"); - this.elem.style.display = old ? old : this.options.display; - - if ( jQuery.css(this.elem, "display") === "none" ) { - this.elem.style.display = "block"; - } - } - - // Hide the element if the "hide" operation was done - if ( this.options.hide ) { - jQuery(this.elem).hide(); - } - - // Reset the properties, if the item has been hidden or shown - if ( this.options.hide || this.options.show ) { - for ( var p in this.options.curAnim ) { - jQuery.style(this.elem, p, this.options.orig[p]); - } - } - - // Execute the complete function - this.options.complete.call( this.elem ); - } - - return false; - - } else { - var n = t - this.startTime; - this.state = n / this.options.duration; - - // Perform the easing function, defaults to swing - var specialEasing = this.options.specialEasing && this.options.specialEasing[this.prop]; - var defaultEasing = this.options.easing || (jQuery.easing.swing ? "swing" : "linear"); - this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, 0, 1, this.options.duration); - this.now = this.start + ((this.end - this.start) * this.pos); - - // Perform the next step of the animation - this.update(); - } - - return true; - } -}; - -jQuery.extend( jQuery.fx, { - tick: function() { - var timers = jQuery.timers; - - for ( var i = 0; i < timers.length; i++ ) { - if ( !timers[i]() ) { - timers.splice(i--, 1); - } - } - - if ( !timers.length ) { - jQuery.fx.stop(); - } - }, - - stop: function() { - clearInterval( timerId ); - timerId = null; - }, - - speeds: { - slow: 600, - fast: 200, - // Default speed - _default: 400 - }, - - step: { - opacity: function( fx ) { - jQuery.style(fx.elem, "opacity", fx.now); - }, - - _default: function( fx ) { - if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) { - fx.elem.style[ fx.prop ] = (fx.prop === "width" || fx.prop === "height" ? Math.max(0, fx.now) : fx.now) + fx.unit; - } else { - fx.elem[ fx.prop ] = fx.now; - } - } - } -}); - -if ( jQuery.expr && jQuery.expr.filters ) { - jQuery.expr.filters.animated = function( elem ) { - return jQuery.grep(jQuery.timers, function( fn ) { - return elem === fn.elem; - }).length; - }; -} - -function genFx( type, num ) { - var obj = {}; - - jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() { - obj[ this ] = type; - }); - - return obj; -} -if ( "getBoundingClientRect" in document.documentElement ) { - jQuery.fn.offset = function( options ) { - var elem = this[0]; - - if ( options ) { - return this.each(function( i ) { - jQuery.offset.setOffset( this, options, i ); - }); - } - - if ( !elem || !elem.ownerDocument ) { - return null; - } - - if ( elem === elem.ownerDocument.body ) { - return jQuery.offset.bodyOffset( elem ); - } - - var box = elem.getBoundingClientRect(), doc = elem.ownerDocument, body = doc.body, docElem = doc.documentElement, - clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0, - top = box.top + (self.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop ) - clientTop, - left = box.left + (self.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft) - clientLeft; - - return { top: top, left: left }; - }; - -} else { - jQuery.fn.offset = function( options ) { - var elem = this[0]; - - if ( options ) { - return this.each(function( i ) { - jQuery.offset.setOffset( this, options, i ); - }); - } - - if ( !elem || !elem.ownerDocument ) { - return null; - } - - if ( elem === elem.ownerDocument.body ) { - return jQuery.offset.bodyOffset( elem ); - } - - jQuery.offset.initialize(); - - var offsetParent = elem.offsetParent, prevOffsetParent = elem, - doc = elem.ownerDocument, computedStyle, docElem = doc.documentElement, - body = doc.body, defaultView = doc.defaultView, - prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle, - top = elem.offsetTop, left = elem.offsetLeft; - - while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) { - if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) { - break; - } - - computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle; - top -= elem.scrollTop; - left -= elem.scrollLeft; - - if ( elem === offsetParent ) { - top += elem.offsetTop; - left += elem.offsetLeft; - - if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(elem.nodeName)) ) { - top += parseFloat( computedStyle.borderTopWidth ) || 0; - left += parseFloat( computedStyle.borderLeftWidth ) || 0; - } - - prevOffsetParent = offsetParent, offsetParent = elem.offsetParent; - } - - if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) { - top += parseFloat( computedStyle.borderTopWidth ) || 0; - left += parseFloat( computedStyle.borderLeftWidth ) || 0; - } - - prevComputedStyle = computedStyle; - } - - if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) { - top += body.offsetTop; - left += body.offsetLeft; - } - - if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) { - top += Math.max( docElem.scrollTop, body.scrollTop ); - left += Math.max( docElem.scrollLeft, body.scrollLeft ); - } - - return { top: top, left: left }; - }; -} - -jQuery.offset = { - initialize: function() { - var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.curCSS(body, "marginTop", true) ) || 0, - html = "<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>"; - - jQuery.extend( container.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" } ); - - container.innerHTML = html; - body.insertBefore( container, body.firstChild ); - innerDiv = container.firstChild; - checkDiv = innerDiv.firstChild; - td = innerDiv.nextSibling.firstChild.firstChild; - - this.doesNotAddBorder = (checkDiv.offsetTop !== 5); - this.doesAddBorderForTableAndCells = (td.offsetTop === 5); - - checkDiv.style.position = "fixed", checkDiv.style.top = "20px"; - // safari subtracts parent border width here which is 5px - this.supportsFixedPosition = (checkDiv.offsetTop === 20 || checkDiv.offsetTop === 15); - checkDiv.style.position = checkDiv.style.top = ""; - - innerDiv.style.overflow = "hidden", innerDiv.style.position = "relative"; - this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5); - - this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop); - - body.removeChild( container ); - body = container = innerDiv = checkDiv = table = td = null; - jQuery.offset.initialize = jQuery.noop; - }, - - bodyOffset: function( body ) { - var top = body.offsetTop, left = body.offsetLeft; - - jQuery.offset.initialize(); - - if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) { - top += parseFloat( jQuery.curCSS(body, "marginTop", true) ) || 0; - left += parseFloat( jQuery.curCSS(body, "marginLeft", true) ) || 0; - } - - return { top: top, left: left }; - }, - - setOffset: function( elem, options, i ) { - // set position first, in-case top/left are set even on static elem - if ( /static/.test( jQuery.curCSS( elem, "position" ) ) ) { - elem.style.position = "relative"; - } - var curElem = jQuery( elem ), - curOffset = curElem.offset(), - curTop = parseInt( jQuery.curCSS( elem, "top", true ), 10 ) || 0, - curLeft = parseInt( jQuery.curCSS( elem, "left", true ), 10 ) || 0; - - if ( jQuery.isFunction( options ) ) { - options = options.call( elem, i, curOffset ); - } - - var props = { - top: (options.top - curOffset.top) + curTop, - left: (options.left - curOffset.left) + curLeft - }; - - if ( "using" in options ) { - options.using.call( elem, props ); - } else { - curElem.css( props ); - } - } -}; - - -jQuery.fn.extend({ - position: function() { - if ( !this[0] ) { - return null; - } - - var elem = this[0], - - // Get *real* offsetParent - offsetParent = this.offsetParent(), - - // Get correct offsets - offset = this.offset(), - parentOffset = /^body|html$/i.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset(); - - // Subtract element margins - // note: when an element has margin: auto the offsetLeft and marginLeft - // are the same in Safari causing offset.left to incorrectly be 0 - offset.top -= parseFloat( jQuery.curCSS(elem, "marginTop", true) ) || 0; - offset.left -= parseFloat( jQuery.curCSS(elem, "marginLeft", true) ) || 0; - - // Add offsetParent borders - parentOffset.top += parseFloat( jQuery.curCSS(offsetParent[0], "borderTopWidth", true) ) || 0; - parentOffset.left += parseFloat( jQuery.curCSS(offsetParent[0], "borderLeftWidth", true) ) || 0; - - // Subtract the two offsets - return { - top: offset.top - parentOffset.top, - left: offset.left - parentOffset.left - }; - }, - - offsetParent: function() { - return this.map(function() { - var offsetParent = this.offsetParent || document.body; - while ( offsetParent && (!/^body|html$/i.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) { - offsetParent = offsetParent.offsetParent; - } - return offsetParent; - }); - } -}); - - -// Create scrollLeft and scrollTop methods -jQuery.each( ["Left", "Top"], function( i, name ) { - var method = "scroll" + name; - - jQuery.fn[ method ] = function(val) { - var elem = this[0], win; - - if ( !elem ) { - return null; - } - - if ( val !== undefined ) { - // Set the scroll offset - return this.each(function() { - win = getWindow( this ); - - if ( win ) { - win.scrollTo( - !i ? val : jQuery(win).scrollLeft(), - i ? val : jQuery(win).scrollTop() - ); - - } else { - this[ method ] = val; - } - }); - } else { - win = getWindow( elem ); - - // Return the scroll offset - return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] : - jQuery.support.boxModel && win.document.documentElement[ method ] || - win.document.body[ method ] : - elem[ method ]; - } - }; -}); - -function getWindow( elem ) { - return ("scrollTo" in elem && elem.document) ? - elem : - elem.nodeType === 9 ? - elem.defaultView || elem.parentWindow : - false; -} -// Create innerHeight, innerWidth, outerHeight and outerWidth methods -jQuery.each([ "Height", "Width" ], function( i, name ) { - - var type = name.toLowerCase(); - - // innerHeight and innerWidth - jQuery.fn["inner" + name] = function() { - return this[0] ? - jQuery.css( this[0], type, false, "padding" ) : - null; - }; - - // outerHeight and outerWidth - jQuery.fn["outer" + name] = function( margin ) { - return this[0] ? - jQuery.css( this[0], type, false, margin ? "margin" : "border" ) : - null; - }; - - jQuery.fn[ type ] = function( size ) { - // Get window width or height - var elem = this[0]; - if ( !elem ) { - return size == null ? null : this; - } - - if ( jQuery.isFunction( size ) ) { - return this.each(function( i ) { - var self = jQuery( this ); - self[ type ]( size.call( this, i, self[ type ]() ) ); - }); - } - - return ("scrollTo" in elem && elem.document) ? // does it walk and quack like a window? - // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode - elem.document.compatMode === "CSS1Compat" && elem.document.documentElement[ "client" + name ] || - elem.document.body[ "client" + name ] : - - // Get document width or height - (elem.nodeType === 9) ? // is it a document - // Either scroll[Width/Height] or offset[Width/Height], whichever is greater - Math.max( - elem.documentElement["client" + name], - elem.body["scroll" + name], elem.documentElement["scroll" + name], - elem.body["offset" + name], elem.documentElement["offset" + name] - ) : - - // Get or set width or height on the element - size === undefined ? - // Get width or height on the element - jQuery.css( elem, type ) : - - // Set the width or height on the element (default to pixels if value is unitless) - this.css( type, typeof size === "string" ? size : size + "px" ); - }; - -}); -// Expose jQuery to the global object -window.jQuery = window.$ = jQuery; - -})(window); \ No newline at end of file diff --git a/plugins/textviewer/syntaxhighlighter/tests/js/qunit.css b/plugins/textviewer/syntaxhighlighter/tests/js/qunit.css deleted file mode 100644 index cc54391715eb9670a860fa54e2b20227167f2162..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/tests/js/qunit.css +++ /dev/null @@ -1,135 +0,0 @@ -/** - * SyntaxHighlighter - * http://alexgorbatchev.com/SyntaxHighlighter - * - * SyntaxHighlighter is donationware. If you are using it, please donate. - * http://alexgorbatchev.com/SyntaxHighlighter/donate.html - * - * @version - * 3.0.83 (July 02 2010) - * - * @copyright - * Copyright (C) 2004-2010 Alex Gorbatchev. - * - * @license - * Dual licensed under the MIT and GPL licenses. - */ - -ol#qunit-tests { - font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial; - margin:0; - padding:0; - list-style-position:inside; - - font-size: smaller; -} -ol#qunit-tests li{ - padding:0.4em 0.5em 0.4em 2.5em; - border-bottom:1px solid #fff; - font-size:small; - list-style-position:inside; -} -ol#qunit-tests li ol{ - box-shadow: inset 0px 2px 13px #999; - -moz-box-shadow: inset 0px 2px 13px #999; - -webkit-box-shadow: inset 0px 2px 13px #999; - margin-top:0.5em; - margin-left:0; - padding:0.5em; - background-color:#fff; - border-radius:15px; - -moz-border-radius: 15px; - -webkit-border-radius: 15px; -} -ol#qunit-tests li li{ - border-bottom:none; - margin:0.5em; - background-color:#fff; - list-style-position: inside; - padding:0.4em 0.5em 0.4em 0.5em; -} - -ol#qunit-tests li li.pass{ - border-left:26px solid #C6E746; - background-color:#fff; - color:#5E740B; - } -ol#qunit-tests li li.fail{ - border-left:26px solid #EE5757; - background-color:#fff; - color:#710909; -} -ol#qunit-tests li.pass{ - background-color:#D2E0E6; - color:#528CE0; -} -ol#qunit-tests li.fail{ - background-color:#EE5757; - color:#000; -} -ol#qunit-tests li strong { - cursor:pointer; -} -h1#qunit-header{ - background-color:#0d3349; - margin:0; - padding:0.5em 0 0.5em 1em; - color:#fff; - font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial; - border-top-right-radius:15px; - border-top-left-radius:15px; - -moz-border-radius-topright:15px; - -moz-border-radius-topleft:15px; - -webkit-border-top-right-radius:15px; - -webkit-border-top-left-radius:15px; - text-shadow: rgba(0, 0, 0, 0.5) 4px 4px 1px; -} -h2#qunit-banner{ - font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial; - height:5px; - margin:0; - padding:0; -} -h2#qunit-banner.qunit-pass{ - background-color:#C6E746; -} -h2#qunit-banner.qunit-fail, #qunit-testrunner-toolbar { - background-color:#EE5757; -} -#qunit-testrunner-toolbar { - font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial; - padding:0; - /*width:80%;*/ - padding:0em 0 0.5em 2em; - font-size: small; -} -h2#qunit-userAgent { - font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial; - background-color:#2b81af; - margin:0; - padding:0; - color:#fff; - font-size: small; - padding:0.5em 0 0.5em 2.5em; - text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px; -} -p#qunit-testresult{ - font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial; - margin:0; - font-size: small; - color:#2b81af; - border-bottom-right-radius:15px; - border-bottom-left-radius:15px; - -moz-border-radius-bottomright:15px; - -moz-border-radius-bottomleft:15px; - -webkit-border-bottom-right-radius:15px; - -webkit-border-bottom-left-radius:15px; - background-color:#D2E0E6; - padding:0.5em 0.5em 0.5em 2.5em; -} -strong b.fail{ - color:#710909; - } -strong b.pass{ - color:#5E740B; - } diff --git a/plugins/textviewer/syntaxhighlighter/tests/js/qunit.js b/plugins/textviewer/syntaxhighlighter/tests/js/qunit.js deleted file mode 100644 index 9ef5f8d6f75f06151b31ecdf3489ce927a8b4576..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/tests/js/qunit.js +++ /dev/null @@ -1,1069 +0,0 @@ -/* - * QUnit - A JavaScript Unit Testing Framework - * - * http://docs.jquery.com/QUnit - * - * Copyright (c) 2009 John Resig, Jörn Zaefferer - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. - */ - -(function(window) { - -var QUnit = { - - // Initialize the configuration options - init: function() { - config = { - stats: { all: 0, bad: 0 }, - moduleStats: { all: 0, bad: 0 }, - started: +new Date, - updateRate: 1000, - blocking: false, - autorun: false, - assertions: [], - filters: [], - queue: [] - }; - - var tests = id("qunit-tests"), - banner = id("qunit-banner"), - result = id("qunit-testresult"); - - if ( tests ) { - tests.innerHTML = ""; - } - - if ( banner ) { - banner.className = ""; - } - - if ( result ) { - result.parentNode.removeChild( result ); - } - }, - - // call on start of module test to prepend name to all tests - module: function(name, testEnvironment) { - config.currentModule = name; - - synchronize(function() { - if ( config.currentModule ) { - QUnit.moduleDone( config.currentModule, config.moduleStats.bad, config.moduleStats.all ); - } - - config.currentModule = name; - config.moduleTestEnvironment = testEnvironment; - config.moduleStats = { all: 0, bad: 0 }; - - QUnit.moduleStart( name, testEnvironment ); - }); - }, - - asyncTest: function(testName, expected, callback) { - if ( arguments.length === 2 ) { - callback = expected; - expected = 0; - } - - QUnit.test(testName, expected, callback, true); - }, - - test: function(testName, expected, callback, async) { - var name = testName, testEnvironment, testEnvironmentArg; - - if ( arguments.length === 2 ) { - callback = expected; - expected = null; - } - // is 2nd argument a testEnvironment? - if ( expected && typeof expected === 'object') { - testEnvironmentArg = expected; - expected = null; - } - - if ( config.currentModule ) { - name = config.currentModule + " module: " + name; - } - - if ( !validTest(name) ) { - return; - } - - synchronize(function() { - QUnit.testStart( testName ); - - testEnvironment = extend({ - setup: function() {}, - teardown: function() {} - }, config.moduleTestEnvironment); - if (testEnvironmentArg) { - extend(testEnvironment,testEnvironmentArg); - } - - // allow utility functions to access the current test environment - QUnit.current_testEnvironment = testEnvironment; - - config.assertions = []; - config.expected = expected; - - try { - if ( !config.pollution ) { - saveGlobal(); - } - - testEnvironment.setup.call(testEnvironment); - } catch(e) { - QUnit.ok( false, "Setup failed on " + name + ": " + e.message ); - } - - if ( async ) { - QUnit.stop(); - } - - try { - callback.call(testEnvironment); - } catch(e) { - fail("Test " + name + " died, exception and test follows", e, callback); - QUnit.ok( false, "Died on test #" + (config.assertions.length + 1) + ": " + e.message ); - // else next test will carry the responsibility - saveGlobal(); - - // Restart the tests if they're blocking - if ( config.blocking ) { - start(); - } - } - }); - - synchronize(function() { - try { - checkPollution(); - testEnvironment.teardown.call(testEnvironment); - } catch(e) { - QUnit.ok( false, "Teardown failed on " + name + ": " + e.message ); - } - - try { - QUnit.reset(); - } catch(e) { - fail("reset() failed, following Test " + name + ", exception and reset fn follows", e, reset); - } - - if ( config.expected && config.expected != config.assertions.length ) { - QUnit.ok( false, "Expected " + config.expected + " assertions, but " + config.assertions.length + " were run" ); - } - - var good = 0, bad = 0, - tests = id("qunit-tests"); - - config.stats.all += config.assertions.length; - config.moduleStats.all += config.assertions.length; - - if ( tests ) { - var ol = document.createElement("ol"); - ol.style.display = "none"; - - for ( var i = 0; i < config.assertions.length; i++ ) { - var assertion = config.assertions[i]; - - var li = document.createElement("li"); - li.className = assertion.result ? "pass" : "fail"; - li.appendChild(document.createTextNode(assertion.message || "(no message)")); - ol.appendChild( li ); - - if ( assertion.result ) { - good++; - } else { - bad++; - config.stats.bad++; - config.moduleStats.bad++; - } - } - - var b = document.createElement("strong"); - b.innerHTML = name + " <b style='color:black;'>(<b class='fail'>" + bad + "</b>, <b class='pass'>" + good + "</b>, " + config.assertions.length + ")</b>"; - - addEvent(b, "click", function() { - var next = b.nextSibling, display = next.style.display; - next.style.display = display === "none" ? "block" : "none"; - }); - - addEvent(b, "dblclick", function(e) { - var target = e && e.target ? e.target : window.event.srcElement; - if ( target.nodeName.toLowerCase() === "strong" ) { - var text = "", node = target.firstChild; - - while ( node.nodeType === 3 ) { - text += node.nodeValue; - node = node.nextSibling; - } - - text = text.replace(/(^\s*|\s*$)/g, ""); - - if ( window.location ) { - window.location.href = window.location.href.match(/^(.+?)(\?.*)?$/)[1] + "?" + encodeURIComponent(text); - } - } - }); - - var li = document.createElement("li"); - li.className = bad ? "fail" : "pass"; - li.appendChild( b ); - li.appendChild( ol ); - tests.appendChild( li ); - - if ( bad ) { - var toolbar = id("qunit-testrunner-toolbar"); - if ( toolbar ) { - toolbar.style.display = "block"; - id("qunit-filter-pass").disabled = null; - id("qunit-filter-missing").disabled = null; - } - } - - } else { - for ( var i = 0; i < config.assertions.length; i++ ) { - if ( !config.assertions[i].result ) { - bad++; - config.stats.bad++; - config.moduleStats.bad++; - } - } - } - - QUnit.testDone( testName, bad, config.assertions.length ); - - if ( !window.setTimeout && !config.queue.length ) { - done(); - } - }); - - if ( window.setTimeout && !config.doneTimer ) { - config.doneTimer = window.setTimeout(function(){ - if ( !config.queue.length ) { - done(); - } else { - synchronize( done ); - } - }, 13); - } - }, - - /** - * Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through. - */ - expect: function(asserts) { - config.expected = asserts; - }, - - /** - * Asserts true. - * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" ); - */ - ok: function(a, msg) { - QUnit.log(a, msg); - - config.assertions.push({ - result: !!a, - message: msg - }); - }, - - /** - * Checks that the first two arguments are equal, with an optional message. - * Prints out both actual and expected values. - * - * Prefered to ok( actual == expected, message ) - * - * @example equal( format("Received {0} bytes.", 2), "Received 2 bytes." ); - * - * @param Object actual - * @param Object expected - * @param String message (optional) - */ - equal: function(actual, expected, message) { - push(expected == actual, actual, expected, message); - }, - - notEqual: function(actual, expected, message) { - push(expected != actual, actual, expected, message); - }, - - deepEqual: function(a, b, message) { - push(QUnit.equiv(a, b), a, b, message); - }, - - notDeepEqual: function(a, b, message) { - push(!QUnit.equiv(a, b), a, b, message); - }, - - strictEqual: function(actual, expected, message) { - push(expected === actual, actual, expected, message); - }, - - notStrictEqual: function(actual, expected, message) { - push(expected !== actual, actual, expected, message); - }, - - start: function() { - // A slight delay, to avoid any current callbacks - if ( window.setTimeout ) { - window.setTimeout(function() { - if ( config.timeout ) { - clearTimeout(config.timeout); - } - - config.blocking = false; - process(); - }, 13); - } else { - config.blocking = false; - process(); - } - }, - - stop: function(timeout) { - config.blocking = true; - - if ( timeout && window.setTimeout ) { - config.timeout = window.setTimeout(function() { - QUnit.ok( false, "Test timed out" ); - QUnit.start(); - }, timeout); - } - }, - - /** - * Resets the test setup. Useful for tests that modify the DOM. - */ - reset: function() { - if ( window.jQuery ) { - jQuery("#main").html( config.fixture ); - jQuery.event.global = {}; - jQuery.ajaxSettings = extend({}, config.ajaxSettings); - } - }, - - /** - * Trigger an event on an element. - * - * @example triggerEvent( document.body, "click" ); - * - * @param DOMElement elem - * @param String type - */ - triggerEvent: function( elem, type, event ) { - if ( document.createEvent ) { - event = document.createEvent("MouseEvents"); - event.initMouseEvent(type, true, true, elem.ownerDocument.defaultView, - 0, 0, 0, 0, 0, false, false, false, false, 0, null); - elem.dispatchEvent( event ); - - } else if ( elem.fireEvent ) { - elem.fireEvent("on"+type); - } - }, - - // Safe object type checking - is: function( type, obj ) { - return Object.prototype.toString.call( obj ) === "[object "+ type +"]"; - }, - - // Logging callbacks - done: function(failures, total) {}, - log: function(result, message) {}, - testStart: function(name) {}, - testDone: function(name, failures, total) {}, - moduleStart: function(name, testEnvironment) {}, - moduleDone: function(name, failures, total) {} -}; - -// Backwards compatibility, deprecated -QUnit.equals = QUnit.equal; -QUnit.same = QUnit.deepEqual; - -// Maintain internal state -var config = { - // The queue of tests to run - queue: [], - - // block until document ready - blocking: true -}; - -// Load paramaters -(function() { - var location = window.location || { search: "", protocol: "file:" }, - GETParams = location.search.slice(1).split('&'); - - for ( var i = 0; i < GETParams.length; i++ ) { - GETParams[i] = decodeURIComponent( GETParams[i] ); - if ( GETParams[i] === "noglobals" ) { - GETParams.splice( i, 1 ); - i--; - config.noglobals = true; - } else if ( GETParams[i].search('=') > -1 ) { - GETParams.splice( i, 1 ); - i--; - } - } - - // restrict modules/tests by get parameters - config.filters = GETParams; - - // Figure out if we're running the tests from a server or not - QUnit.isLocal = !!(location.protocol === 'file:'); -})(); - -// Expose the API as global variables, unless an 'exports' -// object exists, in that case we assume we're in CommonJS -if ( typeof exports === "undefined" || typeof require === "undefined" ) { - extend(window, QUnit); - window.QUnit = QUnit; -} else { - extend(exports, QUnit); - exports.QUnit = QUnit; -} - -if ( typeof document === "undefined" || document.readyState === "complete" ) { - config.autorun = true; -} - -addEvent(window, "load", function() { - // Initialize the config, saving the execution queue - var oldconfig = extend({}, config); - QUnit.init(); - extend(config, oldconfig); - - config.blocking = false; - - var userAgent = id("qunit-userAgent"); - if ( userAgent ) { - userAgent.innerHTML = navigator.userAgent; - } - - var toolbar = id("qunit-testrunner-toolbar"); - if ( toolbar ) { - toolbar.style.display = "none"; - - var filter = document.createElement("input"); - filter.type = "checkbox"; - filter.id = "qunit-filter-pass"; - filter.disabled = true; - addEvent( filter, "click", function() { - var li = document.getElementsByTagName("li"); - for ( var i = 0; i < li.length; i++ ) { - if ( li[i].className.indexOf("pass") > -1 ) { - li[i].style.display = filter.checked ? "none" : ""; - } - } - }); - toolbar.appendChild( filter ); - - var label = document.createElement("label"); - label.setAttribute("for", "qunit-filter-pass"); - label.innerHTML = "Hide passed tests"; - toolbar.appendChild( label ); - - var missing = document.createElement("input"); - missing.type = "checkbox"; - missing.id = "qunit-filter-missing"; - missing.disabled = true; - addEvent( missing, "click", function() { - var li = document.getElementsByTagName("li"); - for ( var i = 0; i < li.length; i++ ) { - if ( li[i].className.indexOf("fail") > -1 && li[i].innerHTML.indexOf('missing test - untested code is broken code') > - 1 ) { - li[i].parentNode.parentNode.style.display = missing.checked ? "none" : "block"; - } - } - }); - toolbar.appendChild( missing ); - - label = document.createElement("label"); - label.setAttribute("for", "qunit-filter-missing"); - label.innerHTML = "Hide missing tests (untested code is broken code)"; - toolbar.appendChild( label ); - } - - var main = id('main'); - if ( main ) { - config.fixture = main.innerHTML; - } - - if ( window.jQuery ) { - config.ajaxSettings = window.jQuery.ajaxSettings; - } - - QUnit.start(); -}); - -function done() { - if ( config.doneTimer && window.clearTimeout ) { - window.clearTimeout( config.doneTimer ); - config.doneTimer = null; - } - - if ( config.queue.length ) { - config.doneTimer = window.setTimeout(function(){ - if ( !config.queue.length ) { - done(); - } else { - synchronize( done ); - } - }, 13); - - return; - } - - config.autorun = true; - - // Log the last module results - if ( config.currentModule ) { - QUnit.moduleDone( config.currentModule, config.moduleStats.bad, config.moduleStats.all ); - } - - var banner = id("qunit-banner"), - tests = id("qunit-tests"), - html = ['Tests completed in ', - +new Date - config.started, ' milliseconds.<br/>', - '<span class="passed">', config.stats.all - config.stats.bad, '</span> tests of <span class="total">', config.stats.all, '</span> passed, <span class="failed">', config.stats.bad,'</span> failed.'].join(''); - - if ( banner ) { - banner.className = (config.stats.bad ? "qunit-fail" : "qunit-pass"); - } - - if ( tests ) { - var result = id("qunit-testresult"); - - if ( !result ) { - result = document.createElement("p"); - result.id = "qunit-testresult"; - result.className = "result"; - tests.parentNode.insertBefore( result, tests.nextSibling ); - } - - result.innerHTML = html; - } - - QUnit.done( config.stats.bad, config.stats.all ); -} - -function validTest( name ) { - var i = config.filters.length, - run = false; - - if ( !i ) { - return true; - } - - while ( i-- ) { - var filter = config.filters[i], - not = filter.charAt(0) == '!'; - - if ( not ) { - filter = filter.slice(1); - } - - if ( name.indexOf(filter) !== -1 ) { - return !not; - } - - if ( not ) { - run = true; - } - } - - return run; -} - -function push(result, actual, expected, message) { - message = message || (result ? "okay" : "failed"); - QUnit.ok( result, result ? message + ": " + QUnit.jsDump.parse(expected) : message + ", expected: " + QUnit.jsDump.parse(expected) + " result: " + QUnit.jsDump.parse(actual) ); -} - -function synchronize( callback ) { - config.queue.push( callback ); - - if ( config.autorun && !config.blocking ) { - process(); - } -} - -function process() { - var start = (new Date()).getTime(); - - while ( config.queue.length && !config.blocking ) { - if ( config.updateRate <= 0 || (((new Date()).getTime() - start) < config.updateRate) ) { - config.queue.shift()(); - - } else { - setTimeout( process, 13 ); - break; - } - } -} - -function saveGlobal() { - config.pollution = []; - - if ( config.noglobals ) { - for ( var key in window ) { - config.pollution.push( key ); - } - } -} - -function checkPollution( name ) { - var old = config.pollution; - saveGlobal(); - - var newGlobals = diff( old, config.pollution ); - if ( newGlobals.length > 0 ) { - ok( false, "Introduced global variable(s): " + newGlobals.join(", ") ); - config.expected++; - } - - var deletedGlobals = diff( config.pollution, old ); - if ( deletedGlobals.length > 0 ) { - ok( false, "Deleted global variable(s): " + deletedGlobals.join(", ") ); - config.expected++; - } -} - -// returns a new Array with the elements that are in a but not in b -function diff( a, b ) { - var result = a.slice(); - for ( var i = 0; i < result.length; i++ ) { - for ( var j = 0; j < b.length; j++ ) { - if ( result[i] === b[j] ) { - result.splice(i, 1); - i--; - break; - } - } - } - return result; -} - -function fail(message, exception, callback) { - if ( typeof console !== "undefined" && console.error && console.warn ) { - console.error(message); - console.error(exception); - console.warn(callback.toString()); - - } else if ( window.opera && opera.postError ) { - opera.postError(message, exception, callback.toString); - } -} - -function extend(a, b) { - for ( var prop in b ) { - a[prop] = b[prop]; - } - - return a; -} - -function addEvent(elem, type, fn) { - if ( elem.addEventListener ) { - elem.addEventListener( type, fn, false ); - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, fn ); - } else { - fn(); - } -} - -function id(name) { - return !!(typeof document !== "undefined" && document && document.getElementById) && - document.getElementById( name ); -} - -// Test for equality any JavaScript type. -// Discussions and reference: http://philrathe.com/articles/equiv -// Test suites: http://philrathe.com/tests/equiv -// Author: Philippe Rathé <prathe@gmail.com> -QUnit.equiv = function () { - - var innerEquiv; // the real equiv function - var callers = []; // stack to decide between skip/abort functions - var parents = []; // stack to avoiding loops from circular referencing - - - // Determine what is o. - function hoozit(o) { - if (QUnit.is("String", o)) { - return "string"; - - } else if (QUnit.is("Boolean", o)) { - return "boolean"; - - } else if (QUnit.is("Number", o)) { - - if (isNaN(o)) { - return "nan"; - } else { - return "number"; - } - - } else if (typeof o === "undefined") { - return "undefined"; - - // consider: typeof null === object - } else if (o === null) { - return "null"; - - // consider: typeof [] === object - } else if (QUnit.is( "Array", o)) { - return "array"; - - // consider: typeof new Date() === object - } else if (QUnit.is( "Date", o)) { - return "date"; - - // consider: /./ instanceof Object; - // /./ instanceof RegExp; - // typeof /./ === "function"; // => false in IE and Opera, - // true in FF and Safari - } else if (QUnit.is( "RegExp", o)) { - return "regexp"; - - } else if (typeof o === "object") { - return "object"; - - } else if (QUnit.is( "Function", o)) { - return "function"; - } else { - return undefined; - } - } - - // Call the o related callback with the given arguments. - function bindCallbacks(o, callbacks, args) { - var prop = hoozit(o); - if (prop) { - if (hoozit(callbacks[prop]) === "function") { - return callbacks[prop].apply(callbacks, args); - } else { - return callbacks[prop]; // or undefined - } - } - } - - var callbacks = function () { - - // for string, boolean, number and null - function useStrictEquality(b, a) { - if (b instanceof a.constructor || a instanceof b.constructor) { - // to catch short annotaion VS 'new' annotation of a declaration - // e.g. var i = 1; - // var j = new Number(1); - return a == b; - } else { - return a === b; - } - } - - return { - "string": useStrictEquality, - "boolean": useStrictEquality, - "number": useStrictEquality, - "null": useStrictEquality, - "undefined": useStrictEquality, - - "nan": function (b) { - return isNaN(b); - }, - - "date": function (b, a) { - return hoozit(b) === "date" && a.valueOf() === b.valueOf(); - }, - - "regexp": function (b, a) { - return hoozit(b) === "regexp" && - a.source === b.source && // the regex itself - a.global === b.global && // and its modifers (gmi) ... - a.ignoreCase === b.ignoreCase && - a.multiline === b.multiline; - }, - - // - skip when the property is a method of an instance (OOP) - // - abort otherwise, - // initial === would have catch identical references anyway - "function": function () { - var caller = callers[callers.length - 1]; - return caller !== Object && - typeof caller !== "undefined"; - }, - - "array": function (b, a) { - var i, j, loop; - var len; - - // b could be an object literal here - if ( ! (hoozit(b) === "array")) { - return false; - } - - len = a.length; - if (len !== b.length) { // safe and faster - return false; - } - - //track reference to avoid circular references - parents.push(a); - for (i = 0; i < len; i++) { - loop = false; - for(j=0;j<parents.length;j++){ - if(parents[j] === a[i]){ - loop = true;//dont rewalk array - } - } - if (!loop && ! innerEquiv(a[i], b[i])) { - parents.pop(); - return false; - } - } - parents.pop(); - return true; - }, - - "object": function (b, a) { - var i, j, loop; - var eq = true; // unless we can proove it - var aProperties = [], bProperties = []; // collection of strings - - // comparing constructors is more strict than using instanceof - if ( a.constructor !== b.constructor) { - return false; - } - - // stack constructor before traversing properties - callers.push(a.constructor); - //track reference to avoid circular references - parents.push(a); - - for (i in a) { // be strict: don't ensures hasOwnProperty and go deep - loop = false; - for(j=0;j<parents.length;j++){ - if(parents[j] === a[i]) - loop = true; //don't go down the same path twice - } - aProperties.push(i); // collect a's properties - - if (!loop && ! innerEquiv(a[i], b[i])) { - eq = false; - break; - } - } - - callers.pop(); // unstack, we are done - parents.pop(); - - for (i in b) { - bProperties.push(i); // collect b's properties - } - - // Ensures identical properties name - return eq && innerEquiv(aProperties.sort(), bProperties.sort()); - } - }; - }(); - - innerEquiv = function () { // can take multiple arguments - var args = Array.prototype.slice.apply(arguments); - if (args.length < 2) { - return true; // end transition - } - - return (function (a, b) { - if (a === b) { - return true; // catch the most you can - } else if (a === null || b === null || typeof a === "undefined" || typeof b === "undefined" || hoozit(a) !== hoozit(b)) { - return false; // don't lose time with error prone cases - } else { - return bindCallbacks(a, callbacks, [b, a]); - } - - // apply transition with (1..n) arguments - })(args[0], args[1]) && arguments.callee.apply(this, args.splice(1, args.length -1)); - }; - - return innerEquiv; - -}(); - -/** - * jsDump - * Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com - * Licensed under BSD (http://www.opensource.org/licenses/bsd-license.php) - * Date: 5/15/2008 - * @projectDescription Advanced and extensible data dumping for Javascript. - * @version 1.0.0 - * @author Ariel Flesler - * @link {http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html} - */ -QUnit.jsDump = (function() { - function quote( str ) { - return '"' + str.toString().replace(/"/g, '\\"') + '"'; - }; - function literal( o ) { - return o + ''; - }; - function join( pre, arr, post ) { - var s = jsDump.separator(), - base = jsDump.indent(), - inner = jsDump.indent(1); - if ( arr.join ) - arr = arr.join( ',' + s + inner ); - if ( !arr ) - return pre + post; - return [ pre, inner + arr, base + post ].join(s); - }; - function array( arr ) { - var i = arr.length, ret = Array(i); - this.up(); - while ( i-- ) - ret[i] = this.parse( arr[i] ); - this.down(); - return join( '[', ret, ']' ); - }; - - var reName = /^function (\w+)/; - - var jsDump = { - parse:function( obj, type ) { //type is used mostly internally, you can fix a (custom)type in advance - var parser = this.parsers[ type || this.typeOf(obj) ]; - type = typeof parser; - - return type == 'function' ? parser.call( this, obj ) : - type == 'string' ? parser : - this.parsers.error; - }, - typeOf:function( obj ) { - var type; - if ( obj === null ) { - type = "null"; - } else if (typeof obj === "undefined") { - type = "undefined"; - } else if (QUnit.is("RegExp", obj)) { - type = "regexp"; - } else if (QUnit.is("Date", obj)) { - type = "date"; - } else if (QUnit.is("Function", obj)) { - type = "function"; - } else if (obj.setInterval && obj.document && !obj.nodeType) { - type = "window"; - } else if (obj.nodeType === 9) { - type = "document"; - } else if (obj.nodeType) { - type = "node"; - } else if (typeof obj === "object" && typeof obj.length === "number" && obj.length >= 0) { - type = "array"; - } else { - type = typeof obj; - } - return type; - }, - separator:function() { - return this.multiline ? this.HTML ? '<br />' : '\n' : this.HTML ? ' ' : ' '; - }, - indent:function( extra ) {// extra can be a number, shortcut for increasing-calling-decreasing - if ( !this.multiline ) - return ''; - var chr = this.indentChar; - if ( this.HTML ) - chr = chr.replace(/\t/g,' ').replace(/ /g,' '); - return Array( this._depth_ + (extra||0) ).join(chr); - }, - up:function( a ) { - this._depth_ += a || 1; - }, - down:function( a ) { - this._depth_ -= a || 1; - }, - setParser:function( name, parser ) { - this.parsers[name] = parser; - }, - // The next 3 are exposed so you can use them - quote:quote, - literal:literal, - join:join, - // - _depth_: 1, - // This is the list of parsers, to modify them, use jsDump.setParser - parsers:{ - window: '[Window]', - document: '[Document]', - error:'[ERROR]', //when no parser is found, shouldn't happen - unknown: '[Unknown]', - 'null':'null', - undefined:'undefined', - 'function':function( fn ) { - var ret = 'function', - name = 'name' in fn ? fn.name : (reName.exec(fn)||[])[1];//functions never have name in IE - if ( name ) - ret += ' ' + name; - ret += '('; - - ret = [ ret, this.parse( fn, 'functionArgs' ), '){'].join(''); - return join( ret, this.parse(fn,'functionCode'), '}' ); - }, - array: array, - nodelist: array, - arguments: array, - object:function( map ) { - var ret = [ ]; - this.up(); - for ( var key in map ) - ret.push( this.parse(key,'key') + ': ' + this.parse(map[key]) ); - this.down(); - return join( '{', ret, '}' ); - }, - node:function( node ) { - var open = this.HTML ? '<' : '<', - close = this.HTML ? '>' : '>'; - - var tag = node.nodeName.toLowerCase(), - ret = open + tag; - - for ( var a in this.DOMAttrs ) { - var val = node[this.DOMAttrs[a]]; - if ( val ) - ret += ' ' + a + '=' + this.parse( val, 'attribute' ); - } - return ret + close + open + '/' + tag + close; - }, - functionArgs:function( fn ) {//function calls it internally, it's the arguments part of the function - var l = fn.length; - if ( !l ) return ''; - - var args = Array(l); - while ( l-- ) - args[l] = String.fromCharCode(97+l);//97 is 'a' - return ' ' + args.join(', ') + ' '; - }, - key:quote, //object calls it internally, the key part of an item in a map - functionCode:'[code]', //function calls it internally, it's the content of the function - attribute:quote, //node calls it internally, it's an html attribute value - string:quote, - date:quote, - regexp:literal, //regex - number:literal, - 'boolean':literal - }, - DOMAttrs:{//attributes to dump from nodes, name=>realName - id:'id', - name:'name', - 'class':'className' - }, - HTML:false,//if true, entities are escaped ( <, >, \t, space and \n ) - indentChar:' ',//indentation unit - multiline:false //if true, items in a collection, are separated by a \n, else just a space. - }; - - return jsDump; -})(); - -})(this); diff --git a/plugins/textviewer/syntaxhighlighter/tests/syntaxhighlighter_tests.html b/plugins/textviewer/syntaxhighlighter/tests/syntaxhighlighter_tests.html deleted file mode 100644 index 303fb392be634d2ab33b10bbfe0db86a84ec4dd0..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/tests/syntaxhighlighter_tests.html +++ /dev/null @@ -1,242 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> - <title>SyntaxHighlighter Highlight Tests</title> - - <!-- jQuery & QUnit --> - <script type="text/javascript" src="js/jquery-1.4.2.js"></script> - <script type="text/javascript" src="js/qunit.js"></script> - <link type="text/css" rel="stylesheet" href="js/qunit.css"/> - - <!-- SyntaxHighlighter --> - <script type="text/javascript" src="/sh/scripts/XRegExp.js"></script> <!-- XRegExp is bundled with the final shCore.js during build --> - <script type="text/javascript" src="/sh/scripts/shCore.js"></script> - <script type="text/javascript" src="/sh/scripts/shLegacy.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushAppleScript.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushAS3.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushBash.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushColdFusion.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushCpp.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushCSharp.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushCss.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushDelphi.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushDiff.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushErlang.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushGroovy.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushJava.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushJavaFx.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushJScript.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushPerl.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushPhp.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushPlain.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushPowerShell.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushPython.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushRuby.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushSass.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushScala.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushSql.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushVb.js"></script> - <script type="text/javascript" src="/sh/scripts/shBrushXml.js"></script> - - <link type="text/css" rel="stylesheet" href="/sh/styles/shCoreDefault.css"/> -</head> - -<body> - -<h1 id="qunit-header">SyntaxHighlighter Highlight Lines Test</h1> -<h2 id="qunit-banner"></h2> -<div id="qunit-testrunner-toolbar"></div> -<h2 id="qunit-userAgent"></h2> -<ol id="qunit-tests"></ol> - -<button id="interaction">Run interaction tests</button> - -<div id="output"> -</div> - -<style> -body { - background: white; -} - -#interaction { - margin-top: 1em; - padding: 1em; - font-size: 1.5em; -} - -.test-wrap { - width: 45%; - height: 400px; - overflow: auto; - float: left; - margin: 1em 1em 0 0; - border: 5px solid silver; - background: gray; - font-family: Helvetica; -} - -.test-wrap h3 { - margin: 1em 0 0 1em; - color: white; - font-size: 1em; - font-weight: normal; -} -</style> - -<script type="text/javascript"> -var testQueue = [], - renderTests = [ - '001_basic', - '002_brushes', - '003_script_tag', - '004_url_parsing', - '005_no_gutter', - '006_pad_line_numbers', - '007_collapse', - '008_first_line', - '009_class_name', - '010_highlight', - '011_smart_tabs', - '012_server_side', - '013_html_script', - '014_legacy' - ], - interactionTests = [ - '007_collapse_interaction' - ] - ; - -function queue(func) -{ - testQueue.push(func); -}; - -function ok_sh($sh) -{ - ok($sh.length > 0, 'Element present'); - ok($sh.is('div'), 'Element is DIV'); - ok($sh.find('> div').is('.syntaxhighlighter'), 'Nested DIV is a .syntaxhighlighter'); -}; - -function ok_toolbar($sh) -{ - var $target = $sh.find('> .syntaxhighlighter > .toolbar'); - ok($target.length > 0, 'Toolbar present'); - ok($target.is(':visible'), 'Toolbar visible'); -}; - -function ok_caption($sh, value) -{ - var $target = $sh.find('> .syntaxhighlighter > table > caption'); - ok($target.length > 0, 'Caption present'); - ok($target.is(':visible'), 'Caption visible'); - - if (value != null) - equals($target.text(), value, 'Caption text'); -}; - -function ok_gutter($sh) -{ - var $target = $sh.find('> .syntaxhighlighter > table > tbody > tr > .gutter'); - ok($target.length > 0, 'Gutter present'); - ok($target.is(':visible'), 'Gutter visible'); -}; - -function ok_code($sh) -{ - var $target = $sh.find('> .syntaxhighlighter > table > tbody > tr > .code'); - ok($target.length > 0, 'Code present'); - ok($target.is(':visible'), 'Code visible'); -}; - -function ok_collapsed($sh) -{ - ok($sh.find('> .syntaxhighlighter.collapsed').length == 1, '.collapsed present'); -}; - -function loadTests(tests, addHtml) -{ - var html = ''; - - $.each(tests, function(index) - { - var name = this; - - if (addHtml != false) - { - html += '<div class="test-wrap">\n' - html += '<h3>' + name + '</h3>\n'; - } - - $.ajax({ - url: 'cases/' + name + '.html', - type: 'GET', - dataType: 'text', - async: false, - success: function(data) - { - html += data; - }, - error: function() - { - html += '<p>Not found...</p>'; - } - }); - - if (addHtml != false) - { - html += '</div>\n'; - - if (index % 2 != 0) - html += '<div style="clear:both"></div>\n'; - } - }); - - // - // Looks like .html() is producing different results when it comes to - // content that has <script /> which type is NOT "text/javascript". - // $('#output').html(html); - // - $('#output')[0].innerHTML += html; - - // - // However, if HTML assigned to to .innerHTML container <script/> tags, - // they are not executed, so we have to manually walk all of them and - // eval() the content. - // - $('#output script[type="text/javascript"][class!="executed"]').each(function() - { - eval($(this).text() || $(this).html()); - $(this).addClass('executed') - }); -}; - -function runTestQueue() -{ - - $.each(testQueue, function() - { - this.apply(null); - }); - - testQueue = []; -}; - -$(document).ready(function() -{ - loadTests(renderTests); - SyntaxHighlighter.highlight(); - runTestQueue(); - - $('#interaction').click(function() - { - loadTests(interactionTests, false /* addHtml */); - runTestQueue(); - }); -}); -</script> - -</body> -</html> diff --git a/plugins/textviewer/syntaxhighlighter/tests/theme_tests.html b/plugins/textviewer/syntaxhighlighter/tests/theme_tests.html deleted file mode 100644 index da07ecfa1588148f9dfbd7ff62444893568a683c..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/tests/theme_tests.html +++ /dev/null @@ -1,134 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> - <title>SyntaxHighlighter Theme Tests</title> - <script type="text/javascript" src="/js/jquery-1.4.2.js"></script> -</head> - -<body> - -<div id="output"></div> - -<style> -body { - background: white; - font-family: Helvetica; -} - -.test-wrap { - width: 100%; - height: 800px; - overflow: auto; - border: none; -} -</style> - -<script id="sample" type="text/plain"> - <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> - <head> - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> - <title>SyntaxHighlighter Theme Tests</title> - </head> - - <body> - <script> - /** - * Looks for a child or parent node which has specified classname. - * Equivalent to jQuery's $(container).find(".className") - * @param {Element} target Target element. - * @param {String} search Class name or node name to look for. - * @param {Boolean} reverse If set to true, will go up the node tree instead of down. - * @return {Element} Returns found child or parent element on null. - */ - function findElement(target, search, reverse /* optional */) - { - if (target == null) - return null; - - var nodes = reverse != true ? target.childNodes : [ target.parentNode ], - propertyToFind = { '#' : 'id', '.' : 'className' }[search.substr(0, 1)] || 'nodeName', - expectedValue, - found - ; - - // main return of the found node - if ((target[propertyToFind] || '').indexOf(expectedValue) != -1) - return target; - - return found; - }; - </script> - - </body> - </html> -</script> - -<script type="text/javascript"> -var themes = [ - ['#fff', 'Default'], - ['#000', 'Django'], - ['#fff', 'Eclipse'], - ['#000', 'Emacs'], - ['#000', 'FadeToGrey'], - ['#000', 'MDUltra'], - ['#000', 'Midnight'], - ['#000', 'RDark'] - ]; - -$(document).ready(function() -{ - var sample = $('#sample').text().replace(/</g, '<'); - - $.each(themes, function(index) - { - var $iframe = $('<iframe class="test-wrap" src="about:blank" />'), - background = this[0], - themeName = this[1] - ; - - $('#output') - .append('' - + '<h1>' - + '<a href="#theme' + (index + 1) + '">next</a> ' - + '<a name="theme' + index + '">' - + themeName - + '</a>' - + '</h1>' - ) - .append($iframe) - ; - - $iframe.ready(function() - { - var doc = $iframe[0].contentDocument; - $iframe.css('background', background); - - doc.write('' - + '<scr' + 'ipt type="text/javascript" src="/sh/scripts/XRegExp.js"></scr' + 'ipt>' - + '<scr' + 'ipt type="text/javascript" src="/sh/scripts/shCore.js"></scr' + 'ipt>' - + '<scr' + 'ipt type="text/javascript" src="/sh/scripts/shBrushXml.js"></scr' + 'ipt>' - + '<scr' + 'ipt type="text/javascript" src="/sh/scripts/shBrushJScript.js"></scr' + 'ipt>' - + '<link type="text/css" rel="stylesheet" href="/sh/styles/shCore' + themeName + '.css"/>' - + '<pre type="syntaxhighlighter" class="brush: js; html-script: true; highlight: [5, 20]" title="This is SyntaxHighlighter theme ' + themeName + ' in action!">' - + sample - + '</pre>' - + '<pre type="syntaxhighlighter" class="brush: js; html-script: true; collapse: true">' - + sample - + '</pre>' - + '<scr' + 'ipt type="text/javascript">' - + 'SyntaxHighlighter.highlight();' - + '</scr' + 'ipt>' - ); - doc.close(); - }); - }); - - $('#output a[name]:first').attr('name', 'top'); - $('#output a[href]:last').attr('href', '#top').html('top'); -}); -</script> - -</body> -</html> diff --git a/plugins/textviewer/syntaxhighlighter/tests/webrick.rb b/plugins/textviewer/syntaxhighlighter/tests/webrick.rb deleted file mode 100644 index 0b3c93c6da62ab5794e34ec679548cbde6ec98c7..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/tests/webrick.rb +++ /dev/null @@ -1,11 +0,0 @@ -require 'webrick' -include WEBrick - -s = HTTPServer.new( - :Port => 2010, - :DocumentRoot => Dir::pwd -) -s.mount('/sh/scripts', WEBrick::HTTPServlet::FileHandler, '../scripts') -s.mount('/sh/styles', WEBrick::HTTPServlet::FileHandler, '../styles') -trap('INT') { s.stop } -s.start diff --git a/plugins/textviewer/syntaxhighlighter/tests/webrick.sh b/plugins/textviewer/syntaxhighlighter/tests/webrick.sh deleted file mode 100644 index 7e249f8e7e4a190e8150b3326b291c95d5fb51eb..0000000000000000000000000000000000000000 --- a/plugins/textviewer/syntaxhighlighter/tests/webrick.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -ruby webrick.rb diff --git a/plugins/textviewer/textviewer.js b/plugins/textviewer/textviewer.js deleted file mode 100644 index f71b63d7c1ead80fded0c64f12b769149eb469d4..0000000000000000000000000000000000000000 --- a/plugins/textviewer/textviewer.js +++ /dev/null @@ -1,106 +0,0 @@ -OC_TextViewer=new Object(); - -OC_TextViewer.type=''; -OC_TextViewer.types={ - 'ac3':'shBrushAS3.js', - 'applescript':'shBrushAppleScript.js', - 'bash':'shBrushBash.js', - 'sh':'shBrushBash.js', - 'csharp':'shBrushCSharp.js', - 'coldfusion':'shBrushColdFusion.js', - 'cpp':'shBrushCpp.js', - 'css':'shBrushCss.js', - 'delphi':'shBrushDelphi.js', - 'diff':'shBrushDiff.js', - 'erlang':'shBrushErlang.js', - 'groovy':'shBrushGroovy.js', - 'javascript':'shBrushJScript.js', - 'js':'shBrushJScript.js', - 'java':'shBrushJava.js', - 'javafx':'shBrushJavaFX.js', - 'perl':'shBrushPerl.js', - 'php':'shBrushPhp.js', - 'plain':'shBrushPlain.js', - 'powershell':'shBrushPowerShell.js', - 'python':'shBrushPython.js', - 'py':'shBrushPython.js', - 'ruby':'shBrushRuby.js', - 'sass':'shBrushSass.js', - 'scala':'shBrushScala.js', - 'sql':'shBrushSql.js', - 'vb':'shBrushVb.js', - 'xml':'shBrushXml.js', -} - -OC_TextViewer.loader=new OCXMLLoader(); -OC_TextViewer.showText=function(dir,file){ - var type; - var parts=file.split('.'); - var ext=parts[parts.length-1]; - if(OC_TextViewer.types[ext]){ - type=ext; - }else{ - type='plain'; - } - OC_TextViewer.type=type; - OC_TextViewer.loadHighlighter(); - var path=WEBROOT+'/files/open_file.php?dir='+encodeURIComponent(dir)+'&file='+encodeURIComponent(file); - var div=document.createElement('div'); - div.setAttribute('id','textframe'); - div.setAttribute('class','center'); - div.addEvent('onclick',OC_TextViewer.hideText) - OC_TextViewer.textFrame=document.createElement('div'); - OC_TextViewer.textFrame.addEvent('onclick',function(e){ - if(window.event = true){ - window.event.cancelBubble = true; - } - if(e.stopPropagation){ - e.stopPropagation(); - } - }); - OC_TextViewer.textFrame.pre=document.createElement('pre'); - div.appendChild(OC_TextViewer.textFrame); - OC_TextViewer.textFrame.appendChild(OC_TextViewer.textFrame.pre); - body=document.getElementsByTagName('body').item(0); - body.appendChild(div); - OC_TextViewer.loader.setCallBack(OC_TextViewer.showTexCallback); - OC_TextViewer.loader.load(path); -} - -OC_TextViewer.showTexCallback=function(req){ - var text=req.responseText; - OC_TextViewer.textFrame.pre.innerHTML=OC_TextViewer.prepareText(text); - OC_TextViewer.textFrame.pre.setAttribute('class','brush: '+OC_TextViewer.type+';'); - SyntaxHighlighter.highlight(null,OC_TextViewer.textFrame.pre); -} - -OC_TextViewer.hideText=function(){ - var div=document.getElementById('textframe'); - div.parentNode.removeChild(div); -} - -OC_TextViewer.prepareText=function(text){ - text=text.replace(/>/g,">"); - text=text.replace(/</g,"<"); - return text; -} - -OC_TextViewer.loadedTypes=new Array(); -OC_TextViewer.loadHighlighter=function(){ - OC_TextViewer.type=(OC_TextViewer.types[OC_TextViewer.type])?OC_TextViewer.type:'plain'; - if(!OC_TextViewer.loadedTypes[OC_TextViewer.type]){ - loadScript('plugins/textviewer/syntaxhighlighter/scripts/'+OC_TextViewer.types[OC_TextViewer.type]) - OC_TextViewer.loadedTypes[OC_TextViewer.type]=true; - SyntaxHighlighter.vars.discoveredBrushes=null; //force the highlighter to refresh it's cache - } -} - -if(!OC_FILES.fileActions.text){ - OC_FILES.fileActions.text=new Object() -} -OC_FILES.fileActions.text.show=function(){ - OC_TextViewer.showText(this.dir,this.file); -} - -OC_FILES.fileActions.text['default']=OC_FILES.fileActions.text.show; - diff --git a/search/appinfo/app.php b/search/appinfo/app.php new file mode 100644 index 0000000000000000000000000000000000000000..44834498fec14999f915fdd8a4b8fb6f23465a1a --- /dev/null +++ b/search/appinfo/app.php @@ -0,0 +1,5 @@ +<?php + +OC_APP::register( array( 'order' => 2, "id" => 'search', 'name' => 'Search' )); + +?> diff --git a/search/css/search.css b/search/css/search.css new file mode 100644 index 0000000000000000000000000000000000000000..df0712be03fdfd799f804c226363fef210d7eca1 --- /dev/null +++ b/search/css/search.css @@ -0,0 +1,17 @@ +#searchresults{ + margin: 2em; + list-style:none; + border: solid 1px #CCC; +} + +#searchresults li.resultHeader{ + font-size:1.2em; + font-weight:bold; + border-bottom: solid 1px #CCC; + padding:0.2em; + background-color:#eee; +} + +#searchresults li.result{ + margin-left:2em; +} \ No newline at end of file diff --git a/search/index.php b/search/index.php new file mode 100644 index 0000000000000000000000000000000000000000..e6f41528ea31eedec6f546ddf324dc0ab9e2fb27 --- /dev/null +++ b/search/index.php @@ -0,0 +1,55 @@ +<?php + +/** +* ownCloud - ajax frontend +* +* @author Robin Appelman +* @copyright 2010 Robin Appelman icewind1991@gmail.com +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU AFFERO GENERAL PUBLIC LICENSE for more details. +* +* You should have received a copy of the GNU Affero General Public +* License along with this library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + + +// Init owncloud +require_once('../lib/base.php'); +require( 'template.php' ); + +// Check if we are a user +if( !OC_USER::isLoggedIn()){ + header( "Location: ".OC_HELPER::linkTo( '', 'index.php' )); + exit(); +} + +// Load the files we need +OC_UTIL::addStyle( 'search', 'search' ); + +$query=(isset($_POST['query']))?$_POST['query']:''; +if($query){ + $results=OC_SEARCH::search($query); +} + +$resultTypes=array(); +foreach($results as $result){ + if(!isset($resultTypes[$result->type])){ + $resultTypes[$result->type]=array(); + } + $resultTypes[$result->type][]=$result; +} + +$tmpl = new OC_TEMPLATE( 'search', 'index', 'user' ); +$tmpl->assign('resultTypes',$resultTypes); +$tmpl->printPage(); + +?> diff --git a/search/templates/index.php b/search/templates/index.php new file mode 100644 index 0000000000000000000000000000000000000000..7241553e7fc085e166fcdce4eb01a88fbb5463b5 --- /dev/null +++ b/search/templates/index.php @@ -0,0 +1,17 @@ +<ul id='searchresults'> + <?php foreach($_['resultTypes'] as $resultType):?> + <li class='resultHeader'> + <p><?php echo $resultType[0]->type?></p> + </li> + <?php foreach($resultType as $result):?> + <li class='result'> + <p> + <a href='<?php echo $result->link?>' title='<?php echo $result->name?>'><?php echo $result->name?></a> + </p> + <p> + <?php echo $result->text?> + </p> + </li> + <?php endforeach;?> + <?php endforeach;?> +</ul> diff --git a/settings/ajax/changepassword.php b/settings/ajax/changepassword.php new file mode 100644 index 0000000000000000000000000000000000000000..1a9ad73610eea2aceb7ff66a8da6248b83f7b308 --- /dev/null +++ b/settings/ajax/changepassword.php @@ -0,0 +1,35 @@ +<?php + +// Init owncloud +require_once('../../lib/base.php'); + +// We send json data +header( "Content-Type: application/jsonrequest" ); + +// Check if we are a user +if( !OC_USER::isLoggedIn()){ + echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" ))); + exit(); +} + +// Get data +if( !isset( $_POST["password"] ) && !isset( $_POST["oldpassword"] )){ + echo json_encode( array( "status" => "error", "data" => array( "message" => "You have to enter the old and the new password!" ))); + exit(); +} + +// Check if the old password is correct +if( !OC_USER::checkPassword( $_SESSION["user_id"], $_POST["oldpassword"] )){ + echo json_encode( array( "status" => "error", "data" => array( "message" => "Your old password is wrong!" ))); + exit(); +} + +// Change password +if( OC_USER::setPassword( $_SESSION["user_id"], $_POST["password"] )){ + echo json_encode( array( "status" => "success", "data" => array( "message" => "Password changed" ))); +} +else{ + echo json_encode( array( "status" => "error", "data" => array( "message" => "Unable to change password" ))); +} + +?> diff --git a/settings/appinfo/app.php b/settings/appinfo/app.php new file mode 100644 index 0000000000000000000000000000000000000000..f0bf1c71bb4229ca77a38cb0bba08d86e8b7b670 --- /dev/null +++ b/settings/appinfo/app.php @@ -0,0 +1,6 @@ +<?php + +OC_APP::register( array( "id" => "settings", "name" => "Settings" )); +OC_APP::addSettingsPage( array( "id" => "settings", "order" => -1000, "href" => OC_HELPER::linkTo( "settings", "index.php" ), "name" => "Personal", "icon" => OC_HELPER::imagePath( "settings", "personal.png" ))); + +?> diff --git a/settings/css/settings.css b/settings/css/settings.css new file mode 100644 index 0000000000000000000000000000000000000000..23561ec367d08ec9b2950bcaedeae36c971d856c --- /dev/null +++ b/settings/css/settings.css @@ -0,0 +1,2 @@ +#passworderror{display:none;} +#passwordchanged{display:none;} \ No newline at end of file diff --git a/settings/img/personal.png b/settings/img/personal.png new file mode 100644 index 0000000000000000000000000000000000000000..ae22c1c1dabd45002a1248832fa1583f2c3e78c3 Binary files /dev/null and b/settings/img/personal.png differ diff --git a/settings/index.php b/settings/index.php index 66fc20565a4f949f527191b3a5f7633d01a56178..1a442eca8110028fa5668fd315f7ae56155fc34d 100644 --- a/settings/index.php +++ b/settings/index.php @@ -1,47 +1,28 @@ <?php -/** -* ownCloud -* -* @author Frank Karlitschek -* @copyright 2010 Frank Karlitschek karlitschek@kde.org -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either -* version 3 of the License, or any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. -* -*/ - -$CONFIG_ERROR=''; - -require_once('../inc/lib_base.php'); - - -OC_UTIL::showheader(); - -$FIRSTRUN=false; - -OC_CONFIG::addForm('User Settings','/inc/templates/configform.php'); -if(OC_USER::ingroup($_SESSION['username'],'admin')){ - OC_CONFIG::addForm('System Settings','/inc/templates/adminform.php'); - OC_CONFIG::addForm('User Management','/inc/templates/userform.php'); - OC_CONFIG::addForm('Plugin Management','/inc/templates/pluginform.php'); +require_once('../lib/base.php'); +require( 'template.php' ); +if( !OC_USER::isLoggedIn()){ + header( "Location: ".OC_HELPER::linkTo( "index.php" )); + exit(); } -echo('<div class="center">'); -OC_CONFIG::showSettings(); -echo('</div>'); - - -OC_UTIL::showfooter(); +// Highlight navigation entry +OC_APP::setActiveNavigationEntry( "settings" ); +OC_UTIL::addScript( "settings", "main" ); +OC_UTIL::addStyle( "settings", "settings" ); + +// calculate the disc space +$used=OC_FILESYSTEM::filesize('/'); +$free=OC_FILESYSTEM::free_space(); +$total=$free+$used; +$relative=round(($used/$total)*100); + +// Return template +$tmpl = new OC_TEMPLATE( "settings", "index", "admin"); +$tmpl->assign('usage',OC_HELPER::humanFileSize($used)); +$tmpl->assign('total_space',OC_HELPER::humanFileSize($total)); +$tmpl->assign('usage_relative',$relative); +$tmpl->printPage(); ?> diff --git a/settings/js/main.js b/settings/js/main.js new file mode 100644 index 0000000000000000000000000000000000000000..e05fc68743cd8256669df501fbaa1ffb51246bbe --- /dev/null +++ b/settings/js/main.js @@ -0,0 +1,21 @@ +$(document).ready(function(){ + $("#passwordbutton").click( function(){ + // Serialize the data + var post = $( "#passwordform" ).serialize(); + $('#passwordchanged').hide(); + $('#passworderror').hide(); + // Ajax foo + $.post( 'ajax/changepassword.php', post, function(data){ + if( data.status == "success" ){ + $('#pass1').val(''); + $('#pass2').val(''); + $('#passwordchanged').show(); + } + else{ + $('#passworderror').html( data.data.message ); + $('#passworderror').show(); + } + }); + return false; + }); +} ); diff --git a/settings/templates/index.php b/settings/templates/index.php new file mode 100644 index 0000000000000000000000000000000000000000..2d5e9d9140fcc8de707e7abbafb700857f6b2cf2 --- /dev/null +++ b/settings/templates/index.php @@ -0,0 +1,30 @@ +<form id="quota"> + <fieldset> + <legend>Account information</legend> + <div id="quota_indicator"><div style="width:<?php echo $_['usage_relative'] ?>%;"> </div></div> + <p>You're currently using <?php echo $_['usage_relative'] ?>% (<?php echo $_['usage'] ?>) of your <?php echo $_['total_space'] ?> space.</p> + </fieldset> +</form> + +<form id="passwordform"> + <fieldset> + <legend>Change Password</legend> + <div id="passwordchanged">You're password got changed</div> + <div id="passworderror"></div> + <p> + <label for="pass1">Old password:</label> + <input type="password" id="pass1" name="oldpassword" /> + </p> + <p> + <label for="pass2">New password :</label> + <input type="password" id="pass2" name="password" /> + </p> + <p> + <input type="checkbox" id="show" name="show" /> + <label for="show">Show new password</label> + </p> + <p class="form_footer"> + <input id="passwordbutton" class="prettybutton" type="submit" value="Save" /> + </p> + </fieldset> +</form> diff --git a/templates/404.php b/templates/404.php new file mode 100644 index 0000000000000000000000000000000000000000..8909db29a4033ba3eb45a6871be0f90142673f87 --- /dev/null +++ b/templates/404.php @@ -0,0 +1,19 @@ +<?php +if(!isset($_)){//also provide standalone error page + require_once '../lib/base.php'; + require( 'template.php' ); + + $tmpl = new OC_TEMPLATE( '', '404', 'guest' ); + $tmpl->printPage(); + exit; +} +?> +<div id="login"> + <img src="<?php echo image_path("", "weather-clear.png"); ?>" alt="ownCloud" /> + <ul> + <li class='error'> + Error 404, Cloud not found<br/> + <p class='hint'><?php if(isset($_['file'])) echo $_['file']?></p> + </li> + </ul> +</div> \ No newline at end of file diff --git a/templates/error.php b/templates/error.php new file mode 100644 index 0000000000000000000000000000000000000000..ae3f029708ff4fd4d6628dfa3963499e7210f779 --- /dev/null +++ b/templates/error.php @@ -0,0 +1,17 @@ +<?php +/* + * Template for error page + */ +?> +<div id="login"> + <img src="<?php echo image_path("", "owncloud-logo-medium-white.png"); ?>" alt="ownCloud" /> + <ul> + <?php foreach($_["errors"] as $error):?> + <li class='error'> + <?php echo $error['error'] ?><br/> + <p class='hint'><?php if(isset($error['hint']))echo $error['hint'] ?></p> + </li> + <?php endforeach ?> + </ul> +</div> + diff --git a/templates/installation.php b/templates/installation.php new file mode 100644 index 0000000000000000000000000000000000000000..880beb9a89e54a7d7c803d7e44c44e795e6fc2ec --- /dev/null +++ b/templates/installation.php @@ -0,0 +1,70 @@ +<div id="login"> + <img src="<?php echo image_path('', 'owncloud-logo-medium-white.png'); ?>" alt="ownCloud" /> + <form action="index.php" method="post" id="setup_form"> + <input type="hidden" name="install" value="true" /> + <p class="intro"> + Welcome to <strong>ownCloud</strong>, your personnal cloud.<br /> + To finish the installation, please follow the steps below. + </p> + + <?php if(count($_['errors']) > 0): ?> + <ul class="errors"> + <?php foreach($_['errors'] as $err): ?> + <li> + <?php if(is_array($err)):?> + <?php print $err['error']; ?> + <p class='hint'><?php print $err['hint']; ?></p> + <?php else: ?> + <?php print $err; ?> + <?php endif; ?> + </li> + <?php endforeach; ?> + </ul> + <?php endif; ?> + + <fieldset> + <legend>Create an <strong>admin account.</strong></legend> + <p><label for="adminlogin">Login :</label><input type="text" name="adminlogin" id="adminlogin" value="<?php print OC_HELPER::init_var('adminlogin'); ?>" /></p> + <p><label for="adminpass">Password :</label><input type="password" name="adminpass" id="adminpass" value="<?php print OC_HELPER::init_var('adminpass'); ?>" /></p> + </fieldset> + + <a id='showAdvanced'>Advanced <img src='<?php echo OC_HELPER::imagePath('','drop-arrow.png'); ?>'></img></a> + + <fieldset id='datadirField'> + <legend>Set where to store the data.</legend> + <p><label for="directory">Data directory :</label><input type="text" name="directory" id="directory" value="<?php print OC_HELPER::init_var('directory', $_['directory']); ?>" /></p> + </fieldset> + + <fieldset id='databaseField'> + <legend>Configure your database.</legend> + <?php if($_['hasSQLite']): ?> + <input type='hidden' id='hasSQLite' value='true'/> + <?php if(!$_['hasMySQL']): ?> + <p>I will use a SQLite database. You have nothing to do !</p> + <input type="hidden" id="dbtype" name="dbtype" value="sqlite" /> + <?php else: ?> + <p><label class="sqlite" for="sqlite">SQLite </label><input type="radio" name="dbtype" value='sqlite' id="sqlite" <?php OC_HELPER::init_radio('dbtype', 'sqlite', 'sqlite'); ?>/></p> + <?php endif; ?> + <?php endif; ?> + + <?php if($_['hasMySQL']): ?> + <input type='hidden' id='hasMySQL' value='true'/> + <?php if(!$_['hasSQLite']): ?> + <p>I will use a MySQL database.</p> + <input type="hidden" id="dbtype" name="dbtype" value="mysql" /> + <?php else: ?> + <p><label class="mysql" for="mysql">MySQL </label><input type="radio" name="dbtype" value='mysql' id="mysql" <?php OC_HELPER::init_radio('dbtype', 'mysql', 'sqlite'); ?>/></p> + <?php endif; ?> + <div id="use_mysql"> + <p><label for="dbhost">Host :</label><input type="text" name="dbhost" id="dbhost" value="<?php print OC_HELPER::init_var('dbhost', 'localhost'); ?>" /></p> + <p><label for="dbname">Database name :</label><input type="text" name="dbname" id="dbname" value="<?php print OC_HELPER::init_var('dbname'); ?>" /></p> + <p><label for="dbtableprefix">Table prefix :</label><input type="text" name="dbtableprefix" id="dbtableprefix" value="<?php print OC_HELPER::init_var('dbtableprefix', 'oc_'); ?>" /></p> + <p><label for="dbuser">MySQL user login :</label><input type="text" name="dbuser" id="dbuser" value="<?php print OC_HELPER::init_var('dbuser'); ?>" /></p> + <p><label for="dbpass">MySQL user password :</label><input type="password" name="dbpass" id="dbpass" value="<?php print OC_HELPER::init_var('dbpass'); ?>" /></p> + </div> + <?php endif; ?> + </fieldset> + + <p class="submit"><input type="submit" value="Finish setup" /></p> + </form> +</div> diff --git a/templates/layout.admin.php b/templates/layout.admin.php new file mode 100644 index 0000000000000000000000000000000000000000..541427f5d5ec1452b766474bccd4c999debc3c8e --- /dev/null +++ b/templates/layout.admin.php @@ -0,0 +1,52 @@ +<!DOCTYPE html> +<html> + <head> + <title>ownCloud</title> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <link rel="shortcut icon" href="<?php echo image_path('', 'favicon.png'); ?>" /><link rel="apple-touch-icon-precomposed" href="<?php echo image_path('', 'favicon-touch.png'); ?>" /> + <?php foreach($_['cssfiles'] as $cssfile): ?> + <link rel="stylesheet" href="<?php echo $cssfile; ?>" type="text/css" media="screen" /> + <?php endforeach; ?> + <?php foreach($_['jsfiles'] as $jsfile): ?> + <script type="text/javascript" src="<?php echo $jsfile; ?>"></script> + <?php endforeach; ?> + </head> + + <body id="body-settings"> + <div id="header"> + <a href="<?php echo link_to('', 'index.php'); ?>" title="" id="owncloud"><img src="<?php echo image_path('', 'owncloud-logo-small-white.png'); ?>" alt="ownCloud" /></a> + <?php echo $_['searchbox']?> + <ul id="metanav"> + <li><a href="<?php echo link_to('', 'index.php'); ?>" title="Back to files"><img src="<?php echo image_path('', 'layout/back.png'); ?>"></a></li> + <li><a href="<?php echo link_to('', 'index.php?logout=true'); ?>" title="Log out"><img src="<?php echo image_path('', 'layout/logout.png'); ?>"></a></li> + </ul> + </div> + + <div id="main"> + <div id="plugins"> + <ul> + <?php foreach($_['settingsnavigation'] as $entry):?> + <li><a style="background-image:url(<?php echo $entry['icon']; ?>)" href="<?php echo $entry['href']; ?>" title="" <?php if( $entry["active"] ): ?> class="active"<?php endif; ?>><?php echo $entry['name'] ?></a></li> + <?php if( sizeof( $entry["subnavigation"] )): ?> + <?php foreach($entry["subnavigation"] as $subentry):?> + <li><a style="background-color:#FF8800;" href="<?php echo $subentry['href']; ?>" title=""><?php echo $subentry['name'] ?></a></li> + <?php endforeach; ?> + <?php endif; ?> + <?php endforeach; ?> + <?php foreach($_['adminnavigation'] as $entry):?> + <li><a style="background-image:url(<?php echo $entry['icon']; ?>)" href="<?php echo $entry['href']; ?>" title="" <?php if( $entry["active"] ): ?> class="active"<?php endif; ?>><?php echo $entry['name'] ?></a></li> + <?php if( sizeof( $entry["subnavigation"] )): ?> + <?php foreach($entry["subnavigation"] as $subentry):?> + <li><a style="background-color:#FF8800;" href="<?php echo $subentry['href']; ?>" title=""><?php echo $subentry['name'] ?></a></li> + <?php endforeach; ?> + <?php endif; ?> + <?php endforeach; ?> + </ul> + </div> + + <div id="content"> + <?php echo $_['content']; ?> + </div> + </div> + </body> +</html> diff --git a/templates/layout.guest.php b/templates/layout.guest.php new file mode 100644 index 0000000000000000000000000000000000000000..c957553082010537f3570dcdb555325c450c773c --- /dev/null +++ b/templates/layout.guest.php @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<html> + <head> + <title>ownCloud</title> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <link rel="shortcut icon" href="<?php echo image_path('', 'favicon.png'); ?>" /><link rel="apple-touch-icon-precomposed" href="<?php echo image_path('', 'favicon-touch.png'); ?>" /> + <?php foreach($_['cssfiles'] as $cssfile): ?> + <link rel="stylesheet" href="<?php echo $cssfile; ?>" type="text/css" media="screen" /> + <?php endforeach; ?> + <?php foreach($_['jsfiles'] as $jsfile): ?> + <script type="text/javascript" src="<?php echo $jsfile; ?>"></script> + <?php endforeach; ?> + </head> + + <body id="body-login"> + <?php echo $_['content']; ?> + <p class="info"><a href="http://owncloud.org/">ownCloud</a> is a personal cloud which runs on your own server.</p> + </body> +</html> diff --git a/templates/layout.user.php b/templates/layout.user.php new file mode 100644 index 0000000000000000000000000000000000000000..da30df294f269a81b07d4dc58a5f9f67c6aa465f --- /dev/null +++ b/templates/layout.user.php @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<html> + <head> + <title>ownCloud</title> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <link rel="shortcut icon" href="<?php echo image_path('', 'favicon.png'); ?>" /><link rel="apple-touch-icon-precomposed" href="<?php echo image_path('', 'favicon-touch.png'); ?>" /> + <?php foreach($_['cssfiles'] as $cssfile): ?> + <link rel="stylesheet" href="<?php echo $cssfile; ?>" type="text/css" media="screen" /> + <?php endforeach; ?> + <?php foreach($_['jsfiles'] as $jsfile): ?> + <script type="text/javascript" src="<?php echo $jsfile; ?>"></script> + <?php endforeach; ?> + </head> + + <body id="body-user"> + <div id="header"> + <a href="<?php echo link_to('', 'index.php'); ?>" title="" id="owncloud"><img src="<?php echo image_path('', 'owncloud-logo-small-white.png'); ?>" alt="ownCloud" /></a> + <?php echo $_['searchbox']?> + <ul id="metanav"> + <li><a href="<?php echo link_to('settings', 'index.php'); ?>" title="Settings"><img src="<?php echo image_path('', 'layout/settings.png'); ?>"></a></li> + <li><a href="<?php echo link_to('', 'index.php'); ?>?logout=true" title="Log out"><img src="<?php echo image_path('', 'layout/logout.png'); ?>"></a></li> + </ul> + </div> + + <div id="main"> + <div id="plugins"> + <ul> + <?php foreach($_['navigation'] as $entry): ?> + <li><a style="background-image:url(<?php echo $entry['icon']; ?>)" href="<?php echo $entry['href']; ?>" title="" <?php if( $entry['active'] ): ?> class="active"<?php endif; ?>><?php echo $entry['name']; ?></a></li> + <?php endforeach; ?> + </ul> + </div> + + <div id="content"> + <?php echo $_['content']; ?> + </div> + </div> + </body> +</html> diff --git a/templates/login.php b/templates/login.php new file mode 100644 index 0000000000000000000000000000000000000000..845ae831a402a02f68ee578aba67112b1606c29d --- /dev/null +++ b/templates/login.php @@ -0,0 +1,14 @@ +<div id="login"> + <img src="<?php echo image_path('', 'owncloud-logo-medium-white.png'); ?>" alt="ownCloud" /> + <form action="index.php" method="post" id="login_form"> + <fieldset> + <?php if($_['error']): ?> + Login failed! + <?php endif; ?> + <input type="text" name="user" id="user" value="" /> + <input type="password" name="password" id="password" value="" /> + <input type="submit" value="Log in" /> + </fieldset> + </form> +</div> + diff --git a/templates/logout.php b/templates/logout.php new file mode 100644 index 0000000000000000000000000000000000000000..4a15998a5c048152755872e5224bb6b29d43cabf --- /dev/null +++ b/templates/logout.php @@ -0,0 +1 @@ +You are logged out. diff --git a/templates/part.pagenavi.php b/templates/part.pagenavi.php new file mode 100644 index 0000000000000000000000000000000000000000..d48d0cada32a1aa39c901e4fe61bae62b734a808 --- /dev/null +++ b/templates/part.pagenavi.php @@ -0,0 +1,31 @@ +<center> + <table class="pager" cellspacing="0" cellpadding="0" border="0"> + <tr> + <td width="1"> + <?php if($_['page']>0):?> + <span class="pagerbutton1"><a href="<?php echo $_['url'].($_['page']-1);?>">prev</a> </span> + <?php endif; ?> + </td> + <td> + <?php if ($_['pagestart']>0):?> + ... + <?php endif;?> + <?php for ($i=$_['pagestart']; $i < $_['pagestop'];$i++):?> + <?php if ($_['page']!=$i):?> + <a href="<?php echo $_['url'].$i;?>"><?php echo $i+1;?> </a> + <?php else:?> + <?php echo $i+1;?> + <?php endif?> + <?php endfor;?> + <?php if ($_['pagestop']<$_['pagecount']):?> + ... + <?php endif;?> + </td> + <td width="1"> + <?php if(($_['page']+1)<$_['pagecount']):?> + <span class="pagerbutton2"><a href="<?php echo $_['url'].($_['page']+1);?>">next</a></span> + <?php endif; ?> + </td> + </tr> + </table> +</center> \ No newline at end of file diff --git a/templates/part.searchbox.php b/templates/part.searchbox.php new file mode 100644 index 0000000000000000000000000000000000000000..910af81ebb20001ba0ba30018d450482523ad663 --- /dev/null +++ b/templates/part.searchbox.php @@ -0,0 +1,4 @@ +<form class='searchbox' action='<?php echo $_['searchurl']?>' method='post'> + <input name='query' value='<?php if(isset($_POST['query'])){echo $_POST['query'];};?>'/> + <input type='submit' value='Search' class='prettybutton'/> +</form> \ No newline at end of file