v7‰PNG  IHDR Ÿ f Õ†C1 sRGB ®Îé gAMA ± üa pHYs à ÃÇo¨d GIDATx^íÜL”÷ð÷Yçªö("Bh_ò«®¸¢§q5kÖ*:þ0A­ºšÖ¥]VkJ¢M»¶f¸±8\k2íll£1]q®ÙÔ‚ÆT PKq\ ΁22 Config.phpnu[_allowModifications = (boolean) $allowModifications; $this->_loadedSection = null; $this->_index = 0; $this->_data = array(); foreach ($array as $key => $value) { if (is_array($value)) { $this->_data[$key] = new self($value, $this->_allowModifications); } else { $this->_data[$key] = $value; } } $this->_count = count($this->_data); } /** * Retrieve a value and return $default if there is no element set. * * @param string $name * @param mixed $default * @return mixed */ public function get($name, $default = null) { $result = $default; if (array_key_exists($name, $this->_data)) { $result = $this->_data[$name]; } return $result; } /** * Magic function so that $obj->value will work. * * @param string $name * @return mixed */ public function __get($name) { return $this->get($name); } /** * Only allow setting of a property if $allowModifications * was set to true on construction. Otherwise, throw an exception. * * @param string $name * @param mixed $value * @throws Zend_Config_Exception * @return void */ public function __set($name, $value) { if ($this->_allowModifications) { if (is_array($value)) { $this->_data[$name] = new self($value, true); } else { $this->_data[$name] = $value; } $this->_count = count($this->_data); } else { /** @see Zend_Config_Exception */ //--//require_once 'Zend/Config/Exception.php'; throw new Zend_Config_Exception('Zend_Config is read only'); } } /** * Deep clone of this instance to ensure that nested Zend_Configs * are also cloned. * * @return void */ public function __clone() { $array = array(); foreach ($this->_data as $key => $value) { if ($value instanceof Zend_Config) { $array[$key] = clone $value; } else { $array[$key] = $value; } } $this->_data = $array; } /** * Return an associative array of the stored data. * * @return array */ public function toArray() { $array = array(); $data = $this->_data; foreach ($data as $key => $value) { if ($value instanceof Zend_Config) { $array[$key] = $value->toArray(); } else { $array[$key] = $value; } } return $array; } /** * Support isset() overloading on PHP 5.1 * * @param string $name * @return boolean */ public function __isset($name) { return isset($this->_data[$name]); } /** * Support unset() overloading on PHP 5.1 * * @param string $name * @throws Zend_Config_Exception * @return void */ public function __unset($name) { if ($this->_allowModifications) { unset($this->_data[$name]); $this->_count = count($this->_data); $this->_skipNextIteration = true; } else { /** @see Zend_Config_Exception */ //--//require_once 'Zend/Config/Exception.php'; throw new Zend_Config_Exception('Zend_Config is read only'); } } /** * Defined by Countable interface * * @return int */ public function count() { return $this->_count; } /** * Defined by Iterator interface * * @return mixed */ public function current() { $this->_skipNextIteration = false; return current($this->_data); } /** * Defined by Iterator interface * * @return mixed */ public function key() { return key($this->_data); } /** * Defined by Iterator interface * */ public function next() { if ($this->_skipNextIteration) { $this->_skipNextIteration = false; return; } next($this->_data); $this->_index++; } /** * Defined by Iterator interface * */ public function rewind() { $this->_skipNextIteration = false; reset($this->_data); $this->_index = 0; } /** * Defined by Iterator interface * * @return boolean */ public function valid() { return $this->_index < $this->_count; } /** * Returns the section name(s) loaded. * * @return mixed */ public function getSectionName() { if(is_array($this->_loadedSection) && count($this->_loadedSection) == 1) { $this->_loadedSection = $this->_loadedSection[0]; } return $this->_loadedSection; } /** * Returns true if all sections were loaded * * @return boolean */ public function areAllSectionsLoaded() { return $this->_loadedSection === null; } /** * Merge another Zend_Config with this one. The items * in $merge will override the same named items in * the current config. * * @param Zend_Config $merge * @return Zend_Config */ public function merge(Zend_Config $merge) { foreach($merge as $key => $item) { if(array_key_exists($key, $this->_data)) { if($item instanceof Zend_Config && $this->$key instanceof Zend_Config) { $this->$key = $this->$key->merge(new Zend_Config($item->toArray(), !$this->readOnly())); } else { $this->$key = $item; } } else { if($item instanceof Zend_Config) { $this->$key = new Zend_Config($item->toArray(), !$this->readOnly()); } else { $this->$key = $item; } } } return $this; } /** * Prevent any more modifications being made to this instance. Useful * after merge() has been used to merge multiple Zend_Config objects * into one object which should then not be modified again. * */ public function setReadOnly() { $this->_allowModifications = false; foreach ($this->_data as $key => $value) { if ($value instanceof Zend_Config) { $value->setReadOnly(); } } } /** * Returns if this Zend_Config object is read only or not. * * @return boolean */ public function readOnly() { return !$this->_allowModifications; } /** * Get the current extends * * @return array */ public function getExtends() { return $this->_extends; } /** * Set an extend for Zend_Config_Writer * * @param string $extendingSection * @param string $extendedSection * @return void */ public function setExtend($extendingSection, $extendedSection = null) { if ($extendedSection === null && isset($this->_extends[$extendingSection])) { unset($this->_extends[$extendingSection]); } else if ($extendedSection !== null) { $this->_extends[$extendingSection] = $extendedSection; } } /** * Throws an exception if $extendingSection may not extend $extendedSection, * and tracks the section extension if it is valid. * * @param string $extendingSection * @param string $extendedSection * @throws Zend_Config_Exception * @return void */ protected function _assertValidExtend($extendingSection, $extendedSection) { // detect circular section inheritance $extendedSectionCurrent = $extendedSection; while (array_key_exists($extendedSectionCurrent, $this->_extends)) { if ($this->_extends[$extendedSectionCurrent] == $extendingSection) { /** @see Zend_Config_Exception */ //--//require_once 'Zend/Config/Exception.php'; throw new Zend_Config_Exception('Illegal circular inheritance detected'); } $extendedSectionCurrent = $this->_extends[$extendedSectionCurrent]; } // remember that this section extends another section $this->_extends[$extendingSection] = $extendedSection; } /** * Handle any errors from simplexml_load_file or parse_ini_file * * @param integer $errno * @param string $errstr * @param string $errfile * @param integer $errline */ public function _loadFileErrorHandler($errno, $errstr, $errfile, $errline) { if ($this->_loadFileErrorStr === null) { $this->_loadFileErrorStr = $errstr; } else { $this->_loadFileErrorStr .= (PHP_EOL . $errstr); } } /** * Merge two arrays recursively, overwriting keys of the same name * in $firstArray with the value in $secondArray. * * @param mixed $firstArray First array * @param mixed $secondArray Second array to merge into first array * @return array */ protected function _arrayMergeRecursive($firstArray, $secondArray) { if (is_array($firstArray) && is_array($secondArray)) { foreach ($secondArray as $key => $value) { if (isset($firstArray[$key])) { $firstArray[$key] = $this->_arrayMergeRecursive($firstArray[$key], $value); } else { if($key === 0) { $firstArray= array(0=>$this->_arrayMergeRecursive($firstArray, $value)); } else { $firstArray[$key] = $value; } } } } else { $firstArray = $secondArray; } return $firstArray; } } PKq\^_^_^ Uri/Http.phpnu[_scheme = $scheme; // Set up grammar rules for validation via regular expressions. These // are to be used with slash-delimited regular expression strings. // Escaped special characters (eg. '%25' for '%') $this->_regex['escaped'] = '%[[:xdigit:]]{2}'; // Unreserved characters $this->_regex['unreserved'] = '[' . self::CHAR_ALNUM . self::CHAR_MARK . ']'; // Segment can use escaped, unreserved or a set of additional chars $this->_regex['segment'] = '(?:' . $this->_regex['escaped'] . '|[' . self::CHAR_ALNUM . self::CHAR_MARK . self::CHAR_SEGMENT . '])*'; // Path can be a series of segmets char strings seperated by '/' $this->_regex['path'] = '(?:\/(?:' . $this->_regex['segment'] . ')?)+'; // URI characters can be escaped, alphanumeric, mark or reserved chars $this->_regex['uric'] = '(?:' . $this->_regex['escaped'] . '|[' . self::CHAR_ALNUM . self::CHAR_MARK . self::CHAR_RESERVED . // If unwise chars are allowed, add them to the URI chars class (self::$_config['allow_unwise'] ? self::CHAR_UNWISE : '') . '])'; // If no scheme-specific part was supplied, the user intends to create // a new URI with this object. No further parsing is required. if (strlen($schemeSpecific) === 0) { return; } // Parse the scheme-specific URI parts into the instance variables. $this->_parseUri($schemeSpecific); // Validate the URI if ($this->valid() === false) { //--//require_once 'Zend/Uri/Exception.php'; throw new Zend_Uri_Exception('Invalid URI supplied'); } } /** * Creates a Zend_Uri_Http from the given string * * @param string $uri String to create URI from, must start with * 'http://' or 'https://' * @throws InvalidArgumentException When the given $uri is not a string or * does not start with http:// or https:// * @throws Zend_Uri_Exception When the given $uri is invalid * @return Zend_Uri_Http */ public static function fromString($uri) { if (is_string($uri) === false) { //--//require_once 'Zend/Uri/Exception.php'; throw new Zend_Uri_Exception('$uri is not a string'); } $uri = explode(':', $uri, 2); $scheme = strtolower($uri[0]); $schemeSpecific = isset($uri[1]) === true ? $uri[1] : ''; if (in_array($scheme, array('http', 'https')) === false) { //--//require_once 'Zend/Uri/Exception.php'; throw new Zend_Uri_Exception("Invalid scheme: '$scheme'"); } $schemeHandler = new Zend_Uri_Http($scheme, $schemeSpecific); return $schemeHandler; } /** * Parse the scheme-specific portion of the URI and place its parts into instance variables. * * @param string $schemeSpecific The scheme-specific portion to parse * @throws Zend_Uri_Exception When scheme-specific decoposition fails * @throws Zend_Uri_Exception When authority decomposition fails * @return void */ protected function _parseUri($schemeSpecific) { // High-level decomposition parser $pattern = '~^((//)([^/?#]*))([^?#]*)(\?([^#]*))?(#(.*))?$~'; $status = @preg_match($pattern, $schemeSpecific, $matches); if ($status === false) { //--//require_once 'Zend/Uri/Exception.php'; throw new Zend_Uri_Exception('Internal error: scheme-specific decomposition failed'); } // Failed decomposition; no further processing needed if ($status === false) { return; } // Save URI components that need no further decomposition $this->_path = isset($matches[4]) === true ? $matches[4] : ''; $this->_query = isset($matches[6]) === true ? $matches[6] : ''; $this->_fragment = isset($matches[8]) === true ? $matches[8] : ''; // Additional decomposition to get username, password, host, and port $combo = isset($matches[3]) === true ? $matches[3] : ''; $pattern = '~^(([^:@]*)(:([^@]*))?@)?((?(?=[[])[[][^]]+[]]|[^:]+))(:(.*))?$~'; $status = @preg_match($pattern, $combo, $matches); if ($status === false) { //--//require_once 'Zend/Uri/Exception.php'; throw new Zend_Uri_Exception('Internal error: authority decomposition failed'); } // Save remaining URI components $this->_username = isset($matches[2]) === true ? $matches[2] : ''; $this->_password = isset($matches[4]) === true ? $matches[4] : ''; $this->_host = isset($matches[5]) === true ? preg_replace('~^\[([^]]+)\]$~', '\1', $matches[5]) // Strip wrapper [] from IPv6 literal : ''; $this->_port = isset($matches[7]) === true ? $matches[7] : ''; } /** * Returns a URI based on current values of the instance variables. If any * part of the URI does not pass validation, then an exception is thrown. * * @throws Zend_Uri_Exception When one or more parts of the URI are invalid * @return string */ public function getUri() { if ($this->valid() === false) { //--//require_once 'Zend/Uri/Exception.php'; throw new Zend_Uri_Exception('One or more parts of the URI are invalid'); } $password = strlen($this->_password) > 0 ? ":$this->_password" : ''; $auth = strlen($this->_username) > 0 ? "$this->_username$password@" : ''; $port = strlen($this->_port) > 0 ? ":$this->_port" : ''; $query = strlen($this->_query) > 0 ? "?$this->_query" : ''; $fragment = strlen($this->_fragment) > 0 ? "#$this->_fragment" : ''; return $this->_scheme . '://' . $auth . $this->_host . $port . $this->_path . $query . $fragment; } /** * Validate the current URI from the instance variables. Returns true if and only if all * parts pass validation. * * @return boolean */ public function valid() { // Return true if and only if all parts of the URI have passed validation return $this->validateUsername() and $this->validatePassword() and $this->validateHost() and $this->validatePort() and $this->validatePath() and $this->validateQuery() and $this->validateFragment(); } /** * Returns the username portion of the URL, or FALSE if none. * * @return string */ public function getUsername() { return strlen($this->_username) > 0 ? $this->_username : false; } /** * Returns true if and only if the username passes validation. If no username is passed, * then the username contained in the instance variable is used. * * @param string $username The HTTP username * @throws Zend_Uri_Exception When username validation fails * @return boolean * @link http://www.faqs.org/rfcs/rfc2396.html */ public function validateUsername($username = null) { if ($username === null) { $username = $this->_username; } // If the username is empty, then it is considered valid if (strlen($username) === 0) { return true; } // Check the username against the allowed values $status = @preg_match('/^(?:' . $this->_regex['escaped'] . '|[' . self::CHAR_ALNUM . self::CHAR_MARK . ';:&=+$,' . '])+$/', $username); if ($status === false) { //--//require_once 'Zend/Uri/Exception.php'; throw new Zend_Uri_Exception('Internal error: username validation failed'); } return $status === 1; } /** * Sets the username for the current URI, and returns the old username * * @param string $username The HTTP username * @throws Zend_Uri_Exception When $username is not a valid HTTP username * @return string */ public function setUsername($username) { if ($this->validateUsername($username) === false) { //--//require_once 'Zend/Uri/Exception.php'; throw new Zend_Uri_Exception("Username \"$username\" is not a valid HTTP username"); } $oldUsername = $this->_username; $this->_username = $username; return $oldUsername; } /** * Returns the password portion of the URL, or FALSE if none. * * @return string */ public function getPassword() { return strlen($this->_password) > 0 ? $this->_password : false; } /** * Returns true if and only if the password passes validation. If no password is passed, * then the password contained in the instance variable is used. * * @param string $password The HTTP password * @throws Zend_Uri_Exception When password validation fails * @return boolean * @link http://www.faqs.org/rfcs/rfc2396.html */ public function validatePassword($password = null) { if ($password === null) { $password = $this->_password; } // If the password is empty, then it is considered valid if (strlen($password) === 0) { return true; } // If the password is nonempty, but there is no username, then it is considered invalid if (strlen($password) > 0 and strlen($this->_username) === 0) { return false; } // Check the password against the allowed values $status = @preg_match('/^(?:' . $this->_regex['escaped'] . '|[' . self::CHAR_ALNUM . self::CHAR_MARK . ';:&=+$,' . '])+$/', $password); if ($status === false) { //--//require_once 'Zend/Uri/Exception.php'; throw new Zend_Uri_Exception('Internal error: password validation failed.'); } return $status == 1; } /** * Sets the password for the current URI, and returns the old password * * @param string $password The HTTP password * @throws Zend_Uri_Exception When $password is not a valid HTTP password * @return string */ public function setPassword($password) { if ($this->validatePassword($password) === false) { //--//require_once 'Zend/Uri/Exception.php'; throw new Zend_Uri_Exception("Password \"$password\" is not a valid HTTP password."); } $oldPassword = $this->_password; $this->_password = $password; return $oldPassword; } /** * Returns the domain or host IP portion of the URL, or FALSE if none. * * @return string */ public function getHost() { return strlen($this->_host) > 0 ? $this->_host : false; } /** * Returns true if and only if the host string passes validation. If no host is passed, * then the host contained in the instance variable is used. * * @param string $host The HTTP host * @return boolean * @uses Zend_Filter */ public function validateHost($host = null) { if ($host === null) { $host = $this->_host; } // If the host is empty, then it is considered invalid if (strlen($host) === 0) { return false; } // Check the host against the allowed values; delegated to Zend_Filter. $validate = new Zend_Validate_Hostname(Zend_Validate_Hostname::ALLOW_ALL); return $validate->isValid($host); } /** * Sets the host for the current URI, and returns the old host * * @param string $host The HTTP host * @throws Zend_Uri_Exception When $host is nota valid HTTP host * @return string */ public function setHost($host) { if ($this->validateHost($host) === false) { //--//require_once 'Zend/Uri/Exception.php'; throw new Zend_Uri_Exception("Host \"$host\" is not a valid HTTP host"); } $oldHost = $this->_host; $this->_host = $host; return $oldHost; } /** * Returns the TCP port, or FALSE if none. * * @return string */ public function getPort() { return strlen($this->_port) > 0 ? $this->_port : false; } /** * Returns true if and only if the TCP port string passes validation. If no port is passed, * then the port contained in the instance variable is used. * * @param string $port The HTTP port * @return boolean */ public function validatePort($port = null) { if ($port === null) { $port = $this->_port; } // If the port is empty, then it is considered valid if (strlen($port) === 0) { return true; } // Check the port against the allowed values return ctype_digit((string) $port) and 1 <= $port and $port <= 65535; } /** * Sets the port for the current URI, and returns the old port * * @param string $port The HTTP port * @throws Zend_Uri_Exception When $port is not a valid HTTP port * @return string */ public function setPort($port) { if ($this->validatePort($port) === false) { //--//require_once 'Zend/Uri/Exception.php'; throw new Zend_Uri_Exception("Port \"$port\" is not a valid HTTP port."); } $oldPort = $this->_port; $this->_port = $port; return $oldPort; } /** * Returns the path and filename portion of the URL. * * @return string */ public function getPath() { return strlen($this->_path) > 0 ? $this->_path : '/'; } /** * Returns true if and only if the path string passes validation. If no path is passed, * then the path contained in the instance variable is used. * * @param string $path The HTTP path * @throws Zend_Uri_Exception When path validation fails * @return boolean */ public function validatePath($path = null) { if ($path === null) { $path = $this->_path; } // If the path is empty, then it is considered valid if (strlen($path) === 0) { return true; } // Determine whether the path is well-formed $pattern = '/^' . $this->_regex['path'] . '$/'; $status = @preg_match($pattern, $path); if ($status === false) { //--//require_once 'Zend/Uri/Exception.php'; throw new Zend_Uri_Exception('Internal error: path validation failed'); } return (boolean) $status; } /** * Sets the path for the current URI, and returns the old path * * @param string $path The HTTP path * @throws Zend_Uri_Exception When $path is not a valid HTTP path * @return string */ public function setPath($path) { if ($this->validatePath($path) === false) { //--//require_once 'Zend/Uri/Exception.php'; throw new Zend_Uri_Exception("Path \"$path\" is not a valid HTTP path"); } $oldPath = $this->_path; $this->_path = $path; return $oldPath; } /** * Returns the query portion of the URL (after ?), or FALSE if none. * * @return string */ public function getQuery() { return strlen($this->_query) > 0 ? $this->_query : false; } /** * Returns the query portion of the URL (after ?) as a * key-value-array. If the query is empty an empty array * is returned * * @return array */ public function getQueryAsArray() { $query = $this->getQuery(); $querryArray = array(); if ($query !== false) { parse_str($query, $querryArray); } return $querryArray; } /** * Returns true if and only if the query string passes validation. If no query is passed, * then the query string contained in the instance variable is used. * * @param string $query The query to validate * @throws Zend_Uri_Exception When query validation fails * @return boolean * @link http://www.faqs.org/rfcs/rfc2396.html */ public function validateQuery($query = null) { if ($query === null) { $query = $this->_query; } // If query is empty, it is considered to be valid if (strlen($query) === 0) { return true; } // Determine whether the query is well-formed $pattern = '/^' . $this->_regex['uric'] . '*$/'; $status = @preg_match($pattern, $query); if ($status === false) { //--//require_once 'Zend/Uri/Exception.php'; throw new Zend_Uri_Exception('Internal error: query validation failed'); } return $status == 1; } /** * Add or replace params in the query string for the current URI, and * return the old query. * * @param array $queryParams * @return string Old query string */ public function addReplaceQueryParameters(array $queryParams) { $queryParams = array_merge($this->getQueryAsArray(), $queryParams); return $this->setQuery($queryParams); } /** * Remove params in the query string for the current URI, and * return the old query. * * @param array $queryParamKeys * @return string Old query string */ public function removeQueryParameters(array $queryParamKeys) { $queryParams = array_diff_key($this->getQueryAsArray(), array_fill_keys($queryParamKeys, 0)); return $this->setQuery($queryParams); } /** * Set the query string for the current URI, and return the old query * string This method accepts both strings and arrays. * * @param string|array $query The query string or array * @throws Zend_Uri_Exception When $query is not a valid query string * @return string Old query string */ public function setQuery($query) { $oldQuery = $this->_query; // If query is empty, set an empty string if (empty($query) === true) { $this->_query = ''; return $oldQuery; } // If query is an array, make a string out of it if (is_array($query) === true) { $query = http_build_query($query, '', '&'); } else { // If it is a string, make sure it is valid. If not parse and encode it $query = (string) $query; if ($this->validateQuery($query) === false) { parse_str($query, $queryArray); $query = http_build_query($queryArray, '', '&'); } } // Make sure the query is valid, and set it if ($this->validateQuery($query) === false) { //--//require_once 'Zend/Uri/Exception.php'; throw new Zend_Uri_Exception("'$query' is not a valid query string"); } $this->_query = $query; return $oldQuery; } /** * Returns the fragment portion of the URL (after #), or FALSE if none. * * @return string|false */ public function getFragment() { return strlen($this->_fragment) > 0 ? $this->_fragment : false; } /** * Returns true if and only if the fragment passes validation. If no fragment is passed, * then the fragment contained in the instance variable is used. * * @param string $fragment Fragment of an URI * @throws Zend_Uri_Exception When fragment validation fails * @return boolean * @link http://www.faqs.org/rfcs/rfc2396.html */ public function validateFragment($fragment = null) { if ($fragment === null) { $fragment = $this->_fragment; } // If fragment is empty, it is considered to be valid if (strlen($fragment) === 0) { return true; } // Determine whether the fragment is well-formed $pattern = '/^' . $this->_regex['uric'] . '*$/'; $status = @preg_match($pattern, $fragment); if ($status === false) { //--//require_once 'Zend/Uri/Exception.php'; throw new Zend_Uri_Exception('Internal error: fragment validation failed'); } return (boolean) $status; } /** * Sets the fragment for the current URI, and returns the old fragment * * @param string $fragment Fragment of the current URI * @throws Zend_Uri_Exception When $fragment is not a valid HTTP fragment * @return string */ public function setFragment($fragment) { if ($this->validateFragment($fragment) === false) { //--//require_once 'Zend/Uri/Exception.php'; throw new Zend_Uri_Exception("Fragment \"$fragment\" is not a valid HTTP fragment"); } $oldFragment = $this->_fragment; $this->_fragment = $fragment; return $oldFragment; } } PKq\5]&&Uri/Exception.phpnu[_validators[] = array( 'instance' => $validator, 'breakChainOnFailure' => (boolean) $breakChainOnFailure ); return $this; } /** * Returns true if and only if $value passes all validations in the chain * * Validators are run in the order in which they were added to the chain (FIFO). * * @param mixed $value * @return boolean */ public function isValid($value) { $this->_messages = array(); $this->_errors = array(); $result = true; foreach ($this->_validators as $element) { $validator = $element['instance']; if ($validator->isValid($value)) { continue; } $result = false; $messages = $validator->getMessages(); $this->_messages = array_merge($this->_messages, $messages); $this->_errors = array_merge($this->_errors, array_keys($messages)); if ($element['breakChainOnFailure']) { break; } } return $result; } /** * Defined by Zend_Validate_Interface * * Returns array of validation failure messages * * @return array */ public function getMessages() { return $this->_messages; } /** * Defined by Zend_Validate_Interface * * Returns array of validation failure message codes * * @return array * @deprecated Since 1.5.0 */ public function getErrors() { return $this->_errors; } /** * Returns the set default namespaces * * @return array */ public static function getDefaultNamespaces() { return self::$_defaultNamespaces; } /** * Sets new default namespaces * * @param array|string $namespace * @return null */ public static function setDefaultNamespaces($namespace) { if (!is_array($namespace)) { $namespace = array((string) $namespace); } self::$_defaultNamespaces = $namespace; } /** * Adds a new default namespace * * @param array|string $namespace * @return null */ public static function addDefaultNamespaces($namespace) { if (!is_array($namespace)) { $namespace = array((string) $namespace); } self::$_defaultNamespaces = array_unique(array_merge(self::$_defaultNamespaces, $namespace)); } /** * Returns true when defaultNamespaces are set * * @return boolean */ public static function hasDefaultNamespaces() { return (!empty(self::$_defaultNamespaces)); } /** * @param mixed $value * @param string $classBaseName * @param array $args OPTIONAL * @param mixed $namespaces OPTIONAL * @return boolean * @throws Zend_Validate_Exception */ public static function is($value, $classBaseName, array $args = array(), $namespaces = array()) { $namespaces = array_merge((array) $namespaces, self::$_defaultNamespaces, array('Zend_Validate')); $className = ucfirst($classBaseName); try { if (!class_exists($className, false)) { //--//require_once 'Zend/Loader.php'; foreach($namespaces as $namespace) { $class = $namespace . '_' . $className; $file = str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php'; if (Zend_Loader::isReadable($file)) { Zend_Loader::loadClass($class); $className = $class; break; } } } $class = new ReflectionClass($className); if ($class->implementsInterface('Zend_Validate_Interface')) { if ($class->hasMethod('__construct')) { $keys = array_keys($args); $numeric = false; foreach($keys as $key) { if (is_numeric($key)) { $numeric = true; break; } } if ($numeric) { $object = $class->newInstanceArgs($args); } else { $object = $class->newInstance($args); } } else { $object = $class->newInstance(); } return $object->isValid($value); } } catch (Zend_Validate_Exception $ze) { // if there is an exception while validating throw it throw $ze; } catch (Exception $e) { // fallthrough and continue for missing validation classes } //--//require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception("Validate class not found from basename '$classBaseName'"); } /** * Returns the maximum allowed message length * * @return integer */ public static function getMessageLength() { //--//require_once 'Zend/Validate/Abstract.php'; return Zend_Validate_Abstract::getMessageLength(); } /** * Sets the maximum allowed message length * * @param integer $length */ public static function setMessageLength($length = -1) { //--//require_once 'Zend/Validate/Abstract.php'; Zend_Validate_Abstract::setMessageLength($length); } /** * Returns the default translation object * * @return Zend_Translate_Adapter|null */ public static function getDefaultTranslator($translator = null) { //--//require_once 'Zend/Validate/Abstract.php'; return Zend_Validate_Abstract::getDefaultTranslator(); } /** * Sets a default translation object for all validation objects * * @param Zend_Translate|Zend_Translate_Adapter|null $translator */ public static function setDefaultTranslator($translator = null) { //--//require_once 'Zend/Validate/Abstract.php'; Zend_Validate_Abstract::setDefaultTranslator($translator); } } PKq\y-Navigation.phpnu[addPages($pages); } elseif (null !== $pages) { //--//require_once 'Zend/Navigation/Exception.php'; throw new Zend_Navigation_Exception( 'Invalid argument: $pages must be an array, an ' . 'instance of Zend_Config, or null'); } } } PKq\J Mime/Part.phpnu[_content = $content; if (is_resource($content)) { $this->_isStream = true; } } /** * @todo setters/getters * @todo error checking for setting $type * @todo error checking for setting $encoding */ /** * check if this part can be read as a stream. * if true, getEncodedStream can be called, otherwise * only getContent can be used to fetch the encoded * content of the part * * @return bool */ public function isStream() { return $this->_isStream; } /** * if this was created with a stream, return a filtered stream for * reading the content. very useful for large file attachments. * * @return stream * @throws Zend_Mime_Exception if not a stream or unable to append filter */ public function getEncodedStream() { if (!$this->_isStream) { //--//require_once 'Zend/Mime/Exception.php'; throw new Zend_Mime_Exception('Attempt to get a stream from a string part'); } //stream_filter_remove(); // ??? is that right? switch ($this->encoding) { case Zend_Mime::ENCODING_QUOTEDPRINTABLE: $filter = stream_filter_append( $this->_content, 'convert.quoted-printable-encode', STREAM_FILTER_READ, array( 'line-length' => 76, 'line-break-chars' => Zend_Mime::LINEEND ) ); if (!is_resource($filter)) { //--//require_once 'Zend/Mime/Exception.php'; throw new Zend_Mime_Exception('Failed to append quoted-printable filter'); } break; case Zend_Mime::ENCODING_BASE64: $filter = stream_filter_append( $this->_content, 'convert.base64-encode', STREAM_FILTER_READ, array( 'line-length' => 76, 'line-break-chars' => Zend_Mime::LINEEND ) ); if (!is_resource($filter)) { //--//require_once 'Zend/Mime/Exception.php'; throw new Zend_Mime_Exception('Failed to append base64 filter'); } break; default: } return $this->_content; } /** * Get the Content of the current Mime Part in the given encoding. * * @return String */ public function getContent($EOL = Zend_Mime::LINEEND) { if ($this->_isStream) { return stream_get_contents($this->getEncodedStream()); } else { return Zend_Mime::encode($this->_content, $this->encoding, $EOL); } } /** * Get the RAW unencoded content from this part * @return string */ public function getRawContent() { if ($this->_isStream) { return stream_get_contents($this->_content); } else { return $this->_content; } } /** * Create and return the array of headers for this MIME part * * @access public * @return array */ public function getHeadersArray($EOL = Zend_Mime::LINEEND) { $headers = array(); $contentType = $this->type; if ($this->charset) { $contentType .= '; charset=' . $this->charset; } if ($this->boundary) { $contentType .= ';' . $EOL . " boundary=\"" . $this->boundary . '"'; } $headers[] = array('Content-Type', $contentType); if ($this->encoding) { $headers[] = array('Content-Transfer-Encoding', $this->encoding); } if ($this->id) { $headers[] = array('Content-ID', '<' . $this->id . '>'); } if ($this->disposition) { $disposition = $this->disposition; if ($this->filename) { $disposition .= '; filename="' . $this->filename . '"'; } $headers[] = array('Content-Disposition', $disposition); } if ($this->description) { $headers[] = array('Content-Description', $this->description); } if ($this->location) { $headers[] = array('Content-Location', $this->location); } if ($this->language){ $headers[] = array('Content-Language', $this->language); } return $headers; } /** * Return the headers for this part as a string * * @return String */ public function getHeaders($EOL = Zend_Mime::LINEEND) { $res = ''; foreach ($this->getHeadersArray($EOL) as $header) { $res .= $header[0] . ': ' . $header[1] . $EOL; } return $res; } } PKq\j|:":"Mime/Decode.phpnu[ array(name => value), 'body' => content), null if no parts found * @throws Zend_Exception */ public static function splitMessageStruct($message, $boundary, $EOL = Zend_Mime::LINEEND) { $parts = self::splitMime($message, $boundary); if (count($parts) <= 0) { return null; } $result = array(); foreach ($parts as $part) { self::splitMessage($part, $headers, $body, $EOL); $result[] = array('header' => $headers, 'body' => $body ); } return $result; } /** * split a message in header and body part, if no header or an * invalid header is found $headers is empty * * The charset of the returned headers depend on your iconv settings. * * @param string $message raw message with header and optional content * @param array $headers output param, array with headers as array(name => value) * @param string $body output param, content of message * @param string $EOL EOL string; defaults to {@link Zend_Mime::LINEEND} * @return null */ public static function splitMessage($message, &$headers, &$body, $EOL = Zend_Mime::LINEEND) { // check for valid header at first line $firstline = strtok($message, "\n"); if (!preg_match('%^[^\s]+[^:]*:%', $firstline)) { $headers = array(); // TODO: we're ignoring \r for now - is this function fast enough and is it safe to asume noone needs \r? $body = str_replace(array("\r", "\n"), array('', $EOL), $message); return; } // find an empty line between headers and body // default is set new line if (strpos($message, $EOL . $EOL)) { list($headers, $body) = explode($EOL . $EOL, $message, 2); // next is the standard new line } else if ($EOL != "\r\n" && strpos($message, "\r\n\r\n")) { list($headers, $body) = explode("\r\n\r\n", $message, 2); // next is the other "standard" new line } else if ($EOL != "\n" && strpos($message, "\n\n")) { list($headers, $body) = explode("\n\n", $message, 2); // at last resort find anything that looks like a new line } else { @list($headers, $body) = @preg_split("%([\r\n]+)\\1%U", $message, 2); } $headers = iconv_mime_decode_headers($headers, ICONV_MIME_DECODE_CONTINUE_ON_ERROR); if ($headers === false ) { // an error occurs during the decoding return; } // normalize header names foreach ($headers as $name => $header) { $lower = strtolower($name); if ($lower == $name) { continue; } unset($headers[$name]); if (!isset($headers[$lower])) { $headers[$lower] = $header; continue; } if (is_array($headers[$lower])) { $headers[$lower][] = $header; continue; } $headers[$lower] = array($headers[$lower], $header); } } /** * split a content type in its different parts * * @param string $type content-type * @param string $wantedPart the wanted part, else an array with all parts is returned * @return string|array wanted part or all parts as array('type' => content-type, partname => value) */ public static function splitContentType($type, $wantedPart = null) { return self::splitHeaderField($type, $wantedPart, 'type'); } /** * split a header field like content type in its different parts * * @param string $type header field * @param string $wantedPart the wanted part, else an array with all parts is returned * @param string $firstName key name for the first part * @return string|array wanted part or all parts as array($firstName => firstPart, partname => value) * @throws Zend_Exception */ public static function splitHeaderField($field, $wantedPart = null, $firstName = 0) { $wantedPart = strtolower($wantedPart); $firstName = strtolower($firstName); // special case - a bit optimized if ($firstName === $wantedPart) { $field = strtok($field, ';'); return $field[0] == '"' ? substr($field, 1, -1) : $field; } $field = $firstName . '=' . $field; if (!preg_match_all('%([^=\s]+)\s*=\s*("[^"]+"|[^;]+)(;\s*|$)%', $field, $matches)) { throw new Zend_Exception('not a valid header field'); } if ($wantedPart) { foreach ($matches[1] as $key => $name) { if (strcasecmp($name, $wantedPart)) { continue; } if ($matches[2][$key][0] != '"') { return $matches[2][$key]; } return substr($matches[2][$key], 1, -1); } return null; } $split = array(); foreach ($matches[1] as $key => $name) { $name = strtolower($name); if ($matches[2][$key][0] == '"') { $split[$name] = substr($matches[2][$key], 1, -1); } else { $split[$name] = $matches[2][$key]; } } return $split; } /** * decode a quoted printable encoded string * * The charset of the returned string depends on your iconv settings. * * @param string encoded string * @return string decoded string */ public static function decodeQuotedPrintable($string) { return quoted_printable_decode($string); } } PKq\ Mime/Exception.phpnu[_parts; } /** * Sets the given array of Zend_Mime_Parts as the array for the message * * @param array $parts */ public function setParts($parts) { $this->_parts = $parts; } /** * Append a new Zend_Mime_Part to the current message * * @param Zend_Mime_Part $part */ public function addPart(Zend_Mime_Part $part) { /** * @todo check for duplicate object handle */ $this->_parts[] = $part; } /** * Check if message needs to be sent as multipart * MIME message or if it has only one part. * * @return boolean */ public function isMultiPart() { return (count($this->_parts) > 1); } /** * Set Zend_Mime object for the message * * This can be used to set the boundary specifically or to use a subclass of * Zend_Mime for generating the boundary. * * @param Zend_Mime $mime */ public function setMime(Zend_Mime $mime) { $this->_mime = $mime; } /** * Returns the Zend_Mime object in use by the message * * If the object was not present, it is created and returned. Can be used to * determine the boundary used in this message. * * @return Zend_Mime */ public function getMime() { if ($this->_mime === null) { $this->_mime = new Zend_Mime(); } return $this->_mime; } /** * Generate MIME-compliant message from the current configuration * * This can be a multipart message if more than one MIME part was added. If * only one part is present, the content of this part is returned. If no * part had been added, an empty string is returned. * * Parts are seperated by the mime boundary as defined in Zend_Mime. If * {@link setMime()} has been called before this method, the Zend_Mime * object set by this call will be used. Otherwise, a new Zend_Mime object * is generated and used. * * @param string $EOL EOL string; defaults to {@link Zend_Mime::LINEEND} * @return string */ public function generateMessage($EOL = Zend_Mime::LINEEND) { if (! $this->isMultiPart()) { $body = array_shift($this->_parts); $body = $body->getContent($EOL); } else { $mime = $this->getMime(); $boundaryLine = $mime->boundaryLine($EOL); $body = 'This is a message in Mime Format. If you see this, ' . "your mail reader does not support this format." . $EOL; foreach (array_keys($this->_parts) as $p) { $body .= $boundaryLine . $this->getPartHeaders($p, $EOL) . $EOL . $this->getPartContent($p, $EOL); } $body .= $mime->mimeEnd($EOL); } return trim($body); } /** * Get the headers of a given part as an array * * @param int $partnum * @return array */ public function getPartHeadersArray($partnum) { return $this->_parts[$partnum]->getHeadersArray(); } /** * Get the headers of a given part as a string * * @param int $partnum * @return string */ public function getPartHeaders($partnum, $EOL = Zend_Mime::LINEEND) { return $this->_parts[$partnum]->getHeaders($EOL); } /** * Get the (encoded) content of a given part as a string * * @param int $partnum * @return string */ public function getPartContent($partnum, $EOL = Zend_Mime::LINEEND) { return $this->_parts[$partnum]->getContent($EOL); } /** * Explode MIME multipart string into seperate parts * * Parts consist of the header and the body of each MIME part. * * @param string $body * @param string $boundary * @return array */ protected static function _disassembleMime($body, $boundary) { $start = 0; $res = array(); // find every mime part limiter and cut out the // string before it. // the part before the first boundary string is discarded: $p = strpos($body, '--'.$boundary."\n", $start); if ($p === false) { // no parts found! return array(); } // position after first boundary line $start = $p + 3 + strlen($boundary); while (($p = strpos($body, '--' . $boundary . "\n", $start)) !== false) { $res[] = substr($body, $start, $p-$start); $start = $p + 3 + strlen($boundary); } // no more parts, find end boundary $p = strpos($body, '--' . $boundary . '--', $start); if ($p===false) { throw new Zend_Exception('Not a valid Mime Message: End Missing'); } // the remaining part also needs to be parsed: $res[] = substr($body, $start, $p-$start); return $res; } /** * Decodes a MIME encoded string and returns a Zend_Mime_Message object with * all the MIME parts set according to the given string * * @param string $message * @param string $boundary * @param string $EOL EOL string; defaults to {@link Zend_Mime::LINEEND} * @return Zend_Mime_Message */ public static function createFromMessage($message, $boundary, $EOL = Zend_Mime::LINEEND) { //--//require_once 'Zend/Mime/Decode.php'; $parts = Zend_Mime_Decode::splitMessageStruct($message, $boundary, $EOL); $res = new self(); foreach ($parts as $part) { // now we build a new MimePart for the current Message Part: $newPart = new Zend_Mime_Part($part['body']); foreach ($part['header'] as $key => $value) { /** * @todo check for characterset and filename */ switch(strtolower($key)) { case 'content-type': $newPart->type = $value; break; case 'content-transfer-encoding': $newPart->encoding = $value; break; case 'content-id': $newPart->id = trim($value,'<>'); break; case 'content-disposition': $newPart->disposition = $value; break; case 'content-description': $newPart->description = $value; break; case 'content-location': $newPart->location = $value; break; case 'content-language': $newPart->language = $value; break; default: throw new Zend_Exception('Unknown header ignored for MimePart:' . $key); } } $res->addPart($newPart); } return $res; } } PKq\[j2j2Mime.phpnu[ 0) { $ptr = strlen($str); if ($ptr > $lineLength) { $ptr = $lineLength; } // Ensure we are not splitting across an encoded character $pos = strrpos(substr($str, 0, $ptr), '='); if ($pos !== false && $pos >= $ptr - 2) { $ptr = $pos; } // Check if there is a space at the end of the line and rewind if ($ptr > 0 && $str[$ptr - 1] == ' ') { --$ptr; } // Add string and continue $out .= substr($str, 0, $ptr) . '=' . $lineEnd; $str = substr($str, $ptr); } $out = rtrim($out, $lineEnd); $out = rtrim($out, '='); return $out; } /** * Converts a string into quoted printable format. * * @param string $str * @return string */ private static function _encodeQuotedPrintable($str) { $str = str_replace('=', '=3D', $str); $str = str_replace(self::$qpKeys, self::$qpReplaceValues, $str); $str = rtrim($str); return $str; } /** * Encode a given string with the QUOTED_PRINTABLE mechanism for Mail Headers. * * Mail headers depend on an extended quoted printable algorithm otherwise * a range of bugs can occur. * * @param string $str * @param string $charset * @param int $lineLength Defaults to {@link LINELENGTH} * @param int $lineEnd Defaults to {@link LINEEND} * @return string */ public static function encodeQuotedPrintableHeader($str, $charset, $lineLength = self::LINELENGTH, $lineEnd = self::LINEEND) { // Reduce line-length by the length of the required delimiter, charsets and encoding $prefix = sprintf('=?%s?Q?', $charset); $lineLength = $lineLength-strlen($prefix)-3; $str = self::_encodeQuotedPrintable($str); // Mail-Header required chars have to be encoded also: $str = str_replace(array('?', ' ', '_', ','), array('=3F', '=20', '=5F', '=2C'), $str); // initialize first line, we need it anyways $lines = array(0 => ""); // Split encoded text into separate lines $tmp = ""; while(strlen($str) > 0) { $currentLine = max(count($lines)-1, 0); $token = self::getNextQuotedPrintableToken($str); $str = substr($str, strlen($token)); $tmp .= $token; if($token == '=20') { // only if we have a single char token or space, we can append the // tempstring it to the current line or start a new line if necessary. if(strlen($lines[$currentLine].$tmp) > $lineLength) { $lines[$currentLine+1] = $tmp; } else { $lines[$currentLine] .= $tmp; } $tmp = ""; } // don't forget to append the rest to the last line if(strlen($str) == 0) { $lines[$currentLine] .= $tmp; } } // assemble the lines together by pre- and appending delimiters, charset, encoding. for($i = 0; $i < count($lines); $i++) { $lines[$i] = " ".$prefix.$lines[$i]."?="; } $str = trim(implode($lineEnd, $lines)); return $str; } /** * Retrieves the first token from a quoted printable string. * * @param string $str * @return string */ private static function getNextQuotedPrintableToken($str) { if(substr($str, 0, 1) == "=") { $token = substr($str, 0, 3); } else { $token = substr($str, 0, 1); } return $token; } /** * Encode a given string in mail header compatible base64 encoding. * * @param string $str * @param string $charset * @param int $lineLength Defaults to {@link LINELENGTH} * @param int $lineEnd Defaults to {@link LINEEND} * @return string */ public static function encodeBase64Header($str, $charset, $lineLength = self::LINELENGTH, $lineEnd = self::LINEEND) { $prefix = '=?' . $charset . '?B?'; $suffix = '?='; $remainingLength = $lineLength - strlen($prefix) - strlen($suffix); $encodedValue = self::encodeBase64($str, $remainingLength, $lineEnd); $encodedValue = str_replace($lineEnd, $suffix . $lineEnd . ' ' . $prefix, $encodedValue); $encodedValue = $prefix . $encodedValue . $suffix; return $encodedValue; } /** * Encode a given string in base64 encoding and break lines * according to the maximum linelength. * * @param string $str * @param int $lineLength Defaults to {@link LINELENGTH} * @param int $lineEnd Defaults to {@link LINEEND} * @return string */ public static function encodeBase64($str, $lineLength = self::LINELENGTH, $lineEnd = self::LINEEND) { return rtrim(chunk_split(base64_encode($str), $lineLength, $lineEnd)); } /** * Constructor * * @param null|string $boundary * @access public * @return void */ public function __construct($boundary = null) { // This string needs to be somewhat unique if ($boundary === null) { $this->_boundary = '=_' . md5(microtime(1) . self::$makeUnique++); } else { $this->_boundary = $boundary; } } /** * Encode the given string with the given encoding. * * @param string $str * @param string $encoding * @param string $EOL EOL string; defaults to {@link Zend_Mime::LINEEND} * @return string */ public static function encode($str, $encoding, $EOL = self::LINEEND) { switch ($encoding) { case self::ENCODING_BASE64: return self::encodeBase64($str, self::LINELENGTH, $EOL); case self::ENCODING_QUOTEDPRINTABLE: return self::encodeQuotedPrintable($str, self::LINELENGTH, $EOL); default: /** * @todo 7Bit and 8Bit is currently handled the same way. */ return $str; } } /** * Return a MIME boundary * * @access public * @return string */ public function boundary() { return $this->_boundary; } /** * Return a MIME boundary line * * @param mixed $EOL Defaults to {@link LINEEND} * @access public * @return string */ public function boundaryLine($EOL = self::LINEEND) { return $EOL . '--' . $this->_boundary . $EOL; } /** * Return MIME ending * * @access public * @return string */ public function mimeEnd($EOL = self::LINEEND) { return $EOL . '--' . $this->_boundary . '--' . $EOL; } } PKq\@o@o Session.phpnu[0 - already called session_regenerate_id() * * @var int */ private static $_regenerateIdState = 0; /** * Private list of php's ini values for ext/session * null values will default to the php.ini value, otherwise * the value below will overwrite the default ini value, unless * the user has set an option explicity with setOptions() * * @var array */ private static $_defaultOptions = array( 'save_path' => null, 'name' => null, /* this should be set to a unique value for each application */ 'save_handler' => null, //'auto_start' => null, /* intentionally excluded (see manual) */ 'gc_probability' => null, 'gc_divisor' => null, 'gc_maxlifetime' => null, 'serialize_handler' => null, 'cookie_lifetime' => null, 'cookie_path' => null, 'cookie_domain' => null, 'cookie_secure' => null, 'cookie_httponly' => null, 'use_cookies' => null, 'use_only_cookies' => 'on', 'referer_check' => null, 'entropy_file' => null, 'entropy_length' => null, 'cache_limiter' => null, 'cache_expire' => null, 'use_trans_sid' => null, 'bug_compat_42' => null, 'bug_compat_warn' => null, 'hash_function' => null, 'hash_bits_per_character' => null ); /** * List of options pertaining to Zend_Session that can be set by developers * using Zend_Session::setOptions(). This list intentionally duplicates * the individual declaration of static "class" variables by the same names. * * @var array */ private static $_localOptions = array( 'strict' => '_strict', 'remember_me_seconds' => '_rememberMeSeconds', 'throw_startup_exceptions' => '_throwStartupExceptions' ); /** * Whether or not write close has been performed. * * @var bool */ private static $_writeClosed = false; /** * Whether or not session id cookie has been deleted * * @var bool */ private static $_sessionCookieDeleted = false; /** * Whether or not session has been destroyed via session_destroy() * * @var bool */ private static $_destroyed = false; /** * Whether or not session must be initiated before usage * * @var bool */ private static $_strict = false; /** * Default number of seconds the session will be remembered for when asked to be remembered * * @var int */ private static $_rememberMeSeconds = 1209600; // 2 weeks /** * Whether the default options listed in Zend_Session::$_localOptions have been set * * @var bool */ private static $_defaultOptionsSet = false; /** * A reference to the set session save handler * * @var Zend_Session_SaveHandler_Interface */ private static $_saveHandler = null; /** * Constructor overriding - make sure that a developer cannot instantiate */ protected function __construct() { } /** * setOptions - set both the class specified * * @param array $userOptions - pass-by-keyword style array of