list($this->_majorVersion, $this->_minorVersion) = explode('.', $version_string[1], 2);
$this->_minorVersion = intval($this->_minorVersion);
$this->setFeature('rte');
- } elseif ($this->_majorVersion >= 412) {
+ } elseif ($this->_majorVersion >= 412) {
$this->_majorVersion = 2;
$this->_minorVersion = 0;
} else {
$signature = hash('md5', serialize(array($driver, $params)));
if (!isset(self::$_instances[$signature])) {
- self::$_instances[$signature] = Horde_Cache::factory($driver, $params);
+ self::$_instances[$signature] = self::factory($driver, $params);
}
return self::$_instances[$signature];
*
* @return string The encrypted data.
*/
- function encrypt($cipher, $plaintext)
+ public function encrypt($cipher, $plaintext)
{
$encrypted = '';
*
* @return string The decrypted data.
*/
- function decrypt($cipher, $ciphertext)
+ public function decrypt($cipher, $ciphertext)
{
$decrypted = '';
throw new Horde_Exception(_("Invalid RAR data."));
}
+ $data_len = strlen($data);
$position = $blockStart + 7;
$return_array = array();
- while ($position < strlen($data)) {
+ while ($position < $data_len) {
$head_crc = substr($data, $position + 0, 2);
$head_type = ord(substr($data, $position + 2, 1));
$head_flags = unpack('vFlags', substr($data, $position + 3, 2));
*/
public function decompress($data, $params = array())
{
+ $data_len = strlen($data);
$position = 0;
$return_array = array();
- while ($position < strlen($data)) {
+ while ($position < $data_len) {
$info = @unpack("a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/a8checksum/Ctypeflag/a100link/a6magic/a2version/a32uname/a32gname/a8devmajor/a8devminor", substr($data, $position));
if (!$info) {
throw new Horde_Exception(_("Unable to decompress data."));
(($mode & 0x004) ? 'r' : '-') .
(($mode & 0x002) ? 'w' : '-') .
(($mode & 0x001) ? 'x' : '-');
- } else {
- /* Some other type. */
}
$return_array[] = $file;
$datalen = $length + ((4 - ($length % 4)) % 4);
if ($attr_type == self::MAPI_STRING) {
- $length -= 1;
+ --$length;
}
/* Read and truncate to length. */
/* Get details from local file header. */
$fhStart = strpos($data, self::FILE_HEADER);
+ $data_len = strlen($data);
+
do {
- if (strlen($data) < $fhStart + 34) {
+ if ($data_len < $fhStart + 34) {
throw new Horde_Exception(_("Invalid ZIP data"));
}
$info = unpack('vMethod/VTime/VCRC32/VCompressed/VUncompressed/vLength/vExtraLength', substr($data, $fhStart + 8, 25));
$name = substr($data, $fhStart + 30, $info['Length']);
$entries[$name]['_dataStart'] = $fhStart + 30 + $info['Length'] + $info['ExtraLength'];
- } while (strlen($data) > $fhStart + 30 + $info['Length'] &&
+ } while ($data_len > $fhStart + 30 + $info['Length'] &&
($fhStart = strpos($data, self::FILE_HEADER, $fhStart + 30 + $info['Length'])) !== false);
return array_values($entries);
$old_offset = ftell($this->_tmp);
fwrite($this->_tmp,
- self::FILE_HEADER . /* Begin creating the ZIP data. */
- $common . /* Common data. */
- $name . /* File name. */
- $zdata /* "File data" segment. */
+ self::FILE_HEADER . /* Begin creating the ZIP data. */
+ $common . /* Common data. */
+ $name . /* File name. */
+ $zdata /* "File data" segment. */
);
/* Add to central directory record. */
$this->_ctrldir[] =
self::CTRL_DIR_HEADER .
- "\x00\x00" . /* Version made by. */
- $common . /* Common data. */
- pack('v', 0) . /* File comment length. */
- pack('v', 0) . /* Disk number start. */
- pack('v', 0) . /* Internal file attributes. */
- pack('V', 32) . /* External file attributes -
- 'archive' bit set. */
- pack('V', $old_offset) . /* Relative offset of local
- header. */
- $name; /* File name. */
+ "\x00\x00" . /* Version made by. */
+ $common . /* Common data. */
+ pack('v', 0) . /* File comment length. */
+ pack('v', 0) . /* Disk number start. */
+ pack('v', 0) . /* Internal file attributes. */
+ pack('V', 32) . /* External file attributes -
+ * 'archive' bit set. */
+ pack('V', $old_offset) . /* Relative offset of local
+ * header. */
+ $name; /* File name. */
}
}
// Return an error if neither main or vhosted versions of the config
// file exist.
if (!$was_included) {
- Horde::logMessage(sprintf('Failed to import configuration file "%s".', $config_dir . $config_file), __FILE__, __LINE__, PEAR_LOG_DEBUG);
+ self::logMessage(sprintf('Failed to import configuration file "%s".', $config_dir . $config_file), __FILE__, __LINE__, PEAR_LOG_DEBUG);
return;
}
$url .= '/' . $key . '=' . rawurlencode(strval($val));
}
- return Horde::url($url);
+ return self::url($url);
}
}
$ctx = explode('|', $ctx);
$ptr = $this->_currentConfig;
- for ($i = 0; $i < count($ctx); ++$i) {
+ for ($i = 0, $ctx_count = count($ctx); $i < $ctx_count; ++$i) {
if (!isset($ptr[$ctx[$i]])) {
return array($default, true);
}
/* Sort to match explicitly set positions. */
ksort($this->_menu);
- if (!empty($GLOBALS['nls']['rtl'][$GLOBALS['language']])) {
- $this->_menu = array_reverse($this->_menu) ;
+ if (!empty($GLOBALS['nls']['rtl'][$GLOBALS['language']])) {
+ $this->_menu = array_reverse($this->_menu);
}
$menu_view = $prefs->getValue('menu_view');
$signature = hash('md5', serialize(array($driver, $params)));
if (!isset(self::$_instances[$signature])) {
- self::$_instances[$signature] = Horde_Crypt::factory($driver, $params);
+ self::$_instances[$signature] = self::factory($driver, $params);
}
return self::$_instances[$signature];
/* Try to decrypt the message. */
try {
- $this->decrypt($result, array('type' => 'message', 'pubkey' => $public_key, 'privkey' => $private_key, 'passphrase' => $passphrase));
+ $this->decrypt($result, array('type' => 'message', 'pubkey' => $public_key, 'privkey' => $private_key, 'passphrase' => $passphrase));
} catch (Horde_Exception $e) {
return false;
}
/* Setup the multipart MIME Part. */
$part = new Horde_Mime_Part();
$part->setType('multipart/signed');
- $part->setContents('This message is in MIME format and has been PGP signed.' . "\n");
+ $part->setContents("This message is in MIME format and has been PGP signed.\n");
$part->addPart($mime_part);
$part->addPart($pgp_sign);
$part->setContentTypeParameter('protocol', 'application/pgp-signature');
$part->setCharset($charset);
$part->setContentTypeParameter('protocol', 'application/pgp-encrypted');
$part->setDescription(Horde_String::convertCharset(_("PGP Encrypted Data"), Horde_Nls::getCharset(), $charset));
- $part->setContents('This message is in MIME format and has been PGP encrypted.' . "\n");
+ $part->setContents("This message is in MIME format and has been PGP encrypted.\n");
$part1 = new Horde_Mime_Part();
$part1->setType('application/pgp-encrypted');
* know whether a subclass has extended these methods. */
$part = $this->signMIMEPart($mime_part, $sign_params);
$part = $this->encryptMIMEPart($part, $encrypt_params);
- $part->setContents('This message is in MIME format and has been PGP signed and encrypted.' . "\n");
+ $part->setContents("This message is in MIME format and has been PGP signed and encrypted.\n");
$charset = Horde_Nls::getEmailCharset();
$part->setCharset($charset);
$cmdline = implode(' ', array_merge($this->_gnupg, $options));
if ($mode == 'w') {
- if ($fp = popen($cmdline, 'w')) {;
+ if ($fp = popen($cmdline, 'w')) {
$win32 = !strncasecmp(PHP_OS, 'WIN', 3);
if (!is_array($input)) {
$cmdline = array(
$keyring,
'--command-fd 0',
- '--gen-revoke' . ' ' . $email,
+ '--gen-revoke ' . $email,
);
$results = $this->_callGpg($cmdline, 'w', $input, true);
$smime_part = new Horde_Mime_Part();
$smime_part->setType('multipart/signed');
- $smime_part->setContents('This is a cryptographically signed message in MIME format.' . "\n");
+ $smime_part->setContents("This is a cryptographically signed message in MIME format.\n");
$smime_part->setContentTypeParameter('protocol', 'application/pkcs7-signature');
$smime_part->setContentTypeParameter('micalg', 'sha1');
$smime_part->addPart($mime_part);
$text .= " " . sprintf(_("RSA Public Key (%d bit)"), strlen($modulus_hex) * 4) . ":\n";
$modulus_str = '';
- for ($i = 0; $i < strlen($modulus_hex); $i += 2) {
+
+ for ($i = 0, $m_len = strlen($modulus_hex); $i < $m_len; $i += 2) {
if (($i % 32) == 0) {
$modulus_str .= "\n ";
}
foreach ($cert_details['fingerprints'] as $hash => $fingerprint) {
$label = sprintf(_("%s Fingerprint"), Horde_String::upper($hash));
$fingerprint_str = '';
- for ($i = 0; $i < strlen($fingerprint); $i += 2) {
+ for ($i = 0, $f_len = strlen($fingerprint); $i < $f_len; $i += 2) {
$fingerprint_str .= substr($fingerprint, $i, 2) . ':';
}
$text .= sprintf(" %s:\n %s\n", $label, $fingerprint_str);
$text .= sprintf(" %s:", _("Signature"));
$sig_str = '';
- for ($i = 0; $i < strlen($cert_details['signature']); $i++) {
+ for ($i = 0, $s_len = strlen($cert_details['signature']); $i < $s_len; ++$i) {
if (($i % 16) == 0) {
$sig_str .= "\n ";
}
$newVal = '';
- for ($i = 0; $i < strlen($val); $i++) {
+ for ($i = 0, $v_len = strlen($val); $i < $v_len; ++$i) {
$newVal .= sprintf("%02x:", ord($val[$i]));
}
$cert_details['certificate']['extensions'][$oid] = $newVal;
$val = $val[1];
$newVal = '';
- for ($i = 0; $i < strlen($val); $i++) {
+ for ($i = 0, $v_len = strlen($val); $i < $v_len; ++$i) {
$newVal .= sprintf("%02x:", ord($val[$i]));
}
$cert_details['certificate']['extensions'][$oid] = $newVal;
$value = 0;
if ($len <= 4) {
/* Method works fine for small integers */
- for ($i = 0; $i < strlen($integer_data); $i++) {
+ for ($i = 0, $i_len = strlen($integer_data); $i < $i_len; ++$i) {
$value = ($value << 8) | ord($integer_data[$i]);
}
} else {
/* Method works for arbitrary length integers */
if (Horde_Util::extensionExists('bcmath')) {
- for ($i = 0; $i < strlen($integer_data); $i++) {
+ for ($i = 0, $i_len = strlen($integer_data); $i < $i_len; ++$i) {
$value = bcadd(bcmul($value, 256), ord($integer_data[$i]));
}
} else {
$value = 0;
$i = 1;
- while ($i < strlen($oid_data)) {
+ $o_len = strlen($oid_data);
+
+ while ($i < $o_len) {
$value = $value << 7;
$value = $value | (ord($oid_data[$i]) & 0x7f);
$signature = serialize(array($driver, $params));
if (!array_key_exists($signature, $instances)) {
- $instances[$signature] = Horde_Editor::factory($driver, $params);
+ $instances[$signature] = self::factory($driver, $params);
}
return $instances[$signature];
return $ret;
}
- /**
+ /**
* Set the comparator to use for searching/sorting (RFC 5255).
*
* @param string $comparator The comparator string (see RFC 4790 [3.1] -
return parent::_search($query, $options);
}
- /**
+ /**
* Set the comparator to use for searching/sorting (RFC 5255).
*
* @param string $comparator The comparator string (see RFC 4790 [3.1] -
$this->_temp['threadparse'] = array('base' => null, 'resp' => array());
reset($data);
- while(list($k, $v) = each($data)) {
+ while (list($k, $v) = each($data)) {
$subject = empty($v['envelope']['subject'])
? ''
: $this->utils->getBaseSubject($v['envelope']['subject']);
$this->_temp['logout'] = true;
$this->logout();
if ($this->_debug) {
- fwrite($this->_debug, '[ERROR: IMAP server closed the connection.]' . "\n");
+ fwrite($this->_debug, "[ERROR: IMAP server closed the connection.]\n");
}
throw new Horde_Imap_Client_Exception('IMAP server closed the connection unexpectedly.', Horde_Imap_Client_Exception::DISCONNECT);
}
if (!$got_data) {
if ($this->_debug) {
- fwrite($this->_debug, '[ERROR: IMAP read/timeout error.]' . "\n");
+ fwrite($this->_debug, "[ERROR: IMAP read/timeout error.]\n");
}
throw new Horde_Imap_Client_Exception('IMAP read error or IMAP connection timed out.', Horde_Imap_Client_Exception::SERVER_READERROR);
}
return $ret;
}
- /**
+ /**
* Set the comparator to use for searching/sorting (RFC 5255).
*
* @param string $comparator The comparator string (see RFC 4790 [3.1] -
/* Only support deleting/undeleting messages. */
if (isset($options['replace'])) {
- $delete = (bool) (count(array_intersect($options['replace'], array('\\deleted'))));
+ $delete = (bool)(count(array_intersect($options['replace'], array('\\deleted'))));
$reset = !$delete;
} else {
if (!empty($options['add'])) {
- $delete = (bool) (count(array_intersect($options['add'], array('\\deleted'))));
+ $delete = (bool)(count(array_intersect($options['add'], array('\\deleted'))));
}
if (!empty($options['remove'])) {
- $reset = !(bool) (count(array_intersect($options['remove'], array('\\deleted'))));
+ $reset = !(bool)(count(array_intersect($options['remove'], array('\\deleted'))));
}
}
/* Convert objects to arrays. */
foreach (array_keys($ret) as $key) {
- $ret[$key] = (array) $ret[$key];
+ $ret[$key] = (array)$ret[$key];
if (isset($ret[$key]['addresses'])) {
$ptr = &$ret[$key]['addresses'];
foreach (array_keys($ptr) as $key2) {
- $ptr[$key2] = (array) $ptr[$key2];
+ $ptr[$key2] = (array)$ptr[$key2];
}
}
}
* @category Horde
* @package Horde_Mime
*/
-class Horde_Mime_Exception extends Horde_Exception {}
+class Horde_Mime_Exception extends Horde_Exception
+{
+}
* <pre>
* 'decode' - (boolean) MIME decode the value?
* 'params' - (array) MIME parameters for Content-Type or
- * Content-Disposition
+ * Content-Disposition.
* </pre>
*/
public function addHeader($header, $value, $options = array())
* <pre>
* 'decode' - (boolean) MIME decode the value?
* 'params' - (array) MIME parameters for Content-Type or
- * Content-Disposition
+ * Content-Disposition.
* </pre>
*
* @return boolean True if value was set.
public function setValue($header, $value, $options = array())
{
if (isset($this->_headers[Horde_String::lower($header)])) {
- $this->addHeader($header, $value, $decode);
+ $this->addHeader($header, $value, $options);
return true;
}
*/
public function listHeadersExist()
{
- return (bool) count(array_intersect(array_keys($this->listHeaders()), array_keys($this->_headers)));
+ return (bool)count(array_intersect(array_keys($this->listHeaders()), array_keys($this->_headers)));
}
/**
static public function extToMime($ext)
{
if (empty($ext)) {
- return 'application/octet-stream';
+ return 'application/octet-stream';
}
$ext = Horde_String::lower($ext);
*
* @throws Horde_Mime_Exception
*/
- function __construct($subject = null, $body = null, $to = null,
- $from = null, $charset = null)
+ public function __construct($subject = null, $body = null, $to = null,
+ $from = null, $charset = null)
{
/* Set SERVER_NAME. */
if (!isset($_SERVER['SERVER_NAME'])) {
*
* @param Horde_Mime_Headers $mime_headers A Horde_Mime_Headers object.
*/
- function __construct($headers = null)
+ public function __construct($headers = null)
{
$this->_headers = $headers;
}
* @return string The mimetype of this part (ex.: text/plain;
* charset=us-ascii) or false.
*/
- public function getType($charset = false)
- {
- if (empty($this->_type) || empty($this->_subtype)) {
- return false;
- }
+ public function getType($charset = false)
+ {
+ if (empty($this->_type) || empty($this->_subtype)) {
+ return false;
+ }
- $ptype = $this->getPrimaryType();
- $type = $ptype . '/' . $this->getSubType();
- if ($charset && ($ptype == 'text')) {
- $type .= '; charset=' . $this->getCharset();
- }
+ $ptype = $this->getPrimaryType();
+ $type = $ptype . '/' . $this->getSubType();
+ if ($charset && ($ptype == 'text')) {
+ $type .= '; charset=' . $this->getCharset();
+ }
- return $type;
- }
+ return $type;
+ }
/**
* If the subtype of a MIME part is unrecognized by an application, the
$localeinfo = Horde_Nls::getLocaleInfo();
return number_format($bytes / 1024, 2, $localeinfo['decimal_point'], $localeinfo['thousands_sep']);
- }
+ }
/**
* Sets the Content-ID header for this part.
}
$i = 1;
foreach (array_keys($this->_parts) as $val) {
- $this->_parts[$val]->buildMimeIds($id . $i++);
+ $this->_parts[$val]->buildMimeIds($id . ($i++));
}
}
} else {
} elseif (!empty($this->_parts)) {
$i = 1;
foreach (array_keys($this->_parts) as $val) {
- $this->_parts[$val]->buildMimeIds($id . $i++);
+ $this->_parts[$val]->buildMimeIds($id . ($i++));
}
}
}
* @author Anil Madhavapeddy <anil@recoil.org>
* @package Horde_Mime_Viewer
*/
-class Horde_Mime_Viewer_Default extends Horde_Mime_Viewer_Driver {}
+class Horde_Mime_Viewer_Default extends Horde_Mime_Viewer_Driver
+{
+}
/**
* Constructor.
*
- * @param Horde_Mime_Part &$mime_part Reference to an object with the
- * information to be rendered.
- * @param array $conf Configuration specific to the
- * driver.
+ * @param Horde_Mime_Part $mime_part Reference to an object with the
+ * information to be rendered.
+ * @param array $conf Configuration specific to the
+ * driver.
*/
- function __construct(&$mime_part, $conf = array())
+ public function __construct($mime_part, $conf = array())
{
$this->_mimepart = $mime_part;
$this->_conf = $conf;
{
return array(
$this->_mimepart->getMimeId() => array(
- 'data' => $this->_toHTML(false),
+ 'data' => $this->_toHTML(),
'status' => array(),
'type' => 'text/html; charset=' . Horde_Nls::getCharset()
)
{
return array(
$this->_mimepart->getMimeId() => array(
- 'data' => $this->_toHTML(true),
+ 'data' => $this->_toHTML(),
'status' => array(),
'type' => 'text/html; charset=' . Horde_Nls::getCharset()
)
/**
* Converts the code to HTML.
*
- * @param boolean $inline Is this an inline display?
- *
* @return string The HTML-ified version of the MIME part contents.
*/
- protected function _toHTML($inline)
+ protected function _toHTML()
{
/* Check to make sure the viewer program exists. */
if (!isset($this->_conf['location']) ||
* @author Michael Slusarz <slusarz@horde.org>
* @package Horde_Mime_Viewer
*/
-class Horde_Mime_Viewer_html extends Horde_Mime_Viewer_Driver
+class Horde_Mime_Viewer_Html extends Horde_Mime_Viewer_Driver
{
/**
* Can this driver render various views?
*
* @return string The code with line numbers added.
*/
- protected function _lineNumber($code, $linebreak = "\n")
+ protected function _lineNumber($code)
{
// Clean up.
$code = preg_replace(
$name = _("unnamed");
}
- $text = '<strong>' . htmlspecialchars(sprintf(_("Contents of \"%s\""), $name)) . ':</strong>' . "\n" .
+ $text = '<strong>' . htmlspecialchars(sprintf(_("Contents of \"%s\""), $name)) . ":</strong>\n" .
'<table><tr><td align="left"><tt><span class="fixed">' .
Horde_Text_Filter::filter(_("Archive Name") . ': ' . $name, 'space2html', array('charset' => $charset, 'encode' => true, 'encode_all' => true)) . "\n" .
Horde_Text_Filter::filter(_("Archive File Size") . ': ' . strlen($contents) . ' bytes', 'space2html', array('charset' => $charset, 'encode' => true, 'encode_all' => true)) . "\n" .
return array(
$this->_mimepart->getMimeId() => array(
- 'data' => nl2br($text . str_repeat('-', 106) . "\n" . '</span></tt></td></tr></table>'),
+ 'data' => nl2br($text . str_repeat('-', 106) . "\n</span></tt></td></tr></table>"),
'status' => array(),
'type' => 'text/html; charset=' . $charset
)
*/
protected function _typeToLang($type)
{
+ // TODO: 'prolog', 'flex', 'changelog', 'ruby'
+
switch ($type) {
case 'text/x-java':
return 'java';
case 'application/x-python':
return 'python';
-
- // TODO: 'prolog', 'flex', 'changelog', 'ruby'
}
}
}
$name = _("unnamed");
}
- $text = '<strong>' . htmlspecialchars(sprintf(_("Contents of \"%s\""), $name)) . ':</strong>' . "\n" .
+ $text = '<strong>' . htmlspecialchars(sprintf(_("Contents of \"%s\""), $name)) . ":</strong>\n" .
'<table><tr><td align="left"><tt><span class="fixed">' .
Horde_Text_Filter::filter(_("Archive Name") . ': ' . $name, 'space2html', array('charset' => $charset, 'encode' => true, 'encode_all' => true)) . "\n" .
Horde_Text_Filter::filter(_("Archive File Size") . ': ' . strlen($contents) . ' bytes', 'space2html', array('charset' => $charset, 'encode' => true, 'encode_all' => true)) . "\n" .
return array(
$this->_mimepart->getMimeId() => array(
- 'data' => nl2br($text . str_repeat('-', 106) . "\n" . '</span></tt></td></tr></table>'),
+ 'data' => nl2br($text . str_repeat('-', 106) . "\n</span></tt></td></tr></table>"),
'status' => array(),
'type' => 'text/html; charset=' . $charset
)
$name = _("unnamed");
}
- $text = '<strong>' . htmlspecialchars(sprintf(_("Contents of \"%s\""), $name)) . ':</strong>' . "\n" .
+ $text = '<strong>' . htmlspecialchars(sprintf(_("Contents of \"%s\""), $name)) . ":</strong>\n" .
'<table><tr><td align="left"><tt><span class="fixed">' .
Horde_Text_Filter::filter(
_("Archive Name") . ': ' . $name . "\n" .
_("Archive File Size") . ': ' . strlen($contents) .
- ' bytes' . "\n" .
+ " bytes\n" .
sprintf(ngettext("File Count: %d file", "File Count: %d files", $fileCount), $fileCount) .
"\n\n" .
Horde_String::pad(_("File Name"), $maxlen, ' ', STR_PAD_RIGHT) .
: 100 * ($val['csize'] / $val['size']);
$val['name'] = Horde_String::pad($val['name'], $maxlen, ' ', STR_PAD_RIGHT);
- $val['attr'] = Horde_String::pad($val['attr'], 10,' ', STR_PAD_LEFT);
+ $val['attr'] = Horde_String::pad($val['attr'], 10, ' ', STR_PAD_LEFT);
$val['size'] = Horde_String::pad($val['size'], 10, ' ', STR_PAD_LEFT);
$val['date'] = Horde_String::pad(strftime("%d-%b-%Y %H:%M", $val['date']), 19, ' ', STR_PAD_LEFT);
$val['method'] = Horde_String::pad($val['method'], 10, ' ', STR_PAD_LEFT);
return array(
$this->_mimepart->getMimeId() => array(
- 'data' => nl2br($text . str_repeat('-', 69 + $maxlen) . "\n" . '</span></tt></td></tr></table>'),
+ 'data' => nl2br($text . str_repeat('-', 69 + $maxlen) . "\n</span></tt></td></tr></table>"),
'status' => array(),
'type' => 'text/html; charset=' . Horde_Nls::getCharset()
)
);
/**
+ * Temp directory locations.
+ *
+ * @var array
+ */
+ static public $tmpLocations = array(
+ '/tmp', '/var/tmp', 'c:\WUTemp', 'c:\temp', 'c:\windows\temp',
+ 'c:\winnt\temp'
+ );
+
+ /**
* Random number for nocacheUrl().
*
* @var integer.
// If we still cannot determine a value, then cycle through a
// list of preset possibilities.
- $tmp_locations = array('/tmp', '/var/tmp', 'c:\WUTemp', 'c:\temp',
- 'c:\windows\temp', 'c:\winnt\temp');
- while (empty($tmp) && count($tmp_locations)) {
- $tmp_check = array_shift($tmp_locations);
- if (@is_dir($tmp_check)) {
- $tmp = $tmp_check;
+ if (empty($tmp)) {
+ foreach (self::$tmpLocations as $tmp_check) {
+ if (@is_dir($tmp_check)) {
+ $tmp = $tmp_check;
+ break;
+ }
}
}
- // If it is still empty, we have failed, so return false;
- // otherwise return the directory determined.
return empty($tmp) ? false : $tmp;
}
*/
static public function closeWindowJS($code = '')
{
- echo '<script type="text/javascript">//<![CDATA[' . "\n"
- . $code . 'window.close();' . "\n//]]></script>\n";
+ echo "<script type=\"text/javascript\">//<![CDATA[\n" .
+ $code .
+ "window.close();\n//]]></script>\n";
}
/**
*/
static public function date2strftime($format)
{
+ $f_len = strlen($format);
$result = '';
- for ($pos = 0; $pos < strlen($format);) {
+ for ($pos = 0; $pos < $f_len;) {
for ($symbol = 0, $symcount = count(self::$dateSymbols); $symbol < $symcount; ++$symbol) {
if (strpos($format, self::$dateSymbols[$symbol], $pos) === $pos) {
$result .= self::$strftimeSymbols[$symbol];
} else {
array_unshift($keys, $base);
$place = &$this->_vars;
+ $i = count($keys);
- while (count($keys)) {
+ while ($i--) {
$key = array_shift($keys);
if (!isset($place[$key])) {
$place[$key] = array();
: false;
} else {
$searchspace = &$array[$base];
- while (count($keys)) {
+ $i = count($keys);
+
+ while ($i--) {
$key = array_shift($keys);
if (!isset($searchspace[$key])) {
$value = null;