Subversion-Projekte lars-tiefland.ci

Revision

Revision 68 | Revision 2049 | Zur aktuellen Revision | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 68 Revision 1257
Zeile 121... Zeile 121...
121
	 * @var	bool
121
	 * @var	bool
122
	 */
122
	 */
123
	public $parse_exec_vars = TRUE;
123
	public $parse_exec_vars = TRUE;
Zeile 124... Zeile 124...
124
 
124
 
-
 
125
	/**
-
 
126
	 * mbstring.func_override flag
-
 
127
	 *
-
 
128
	 * @var	bool
-
 
129
	 */
-
 
130
	protected static $func_override;
-
 
131
 
125
	/**
132
	/**
126
	 * Class constructor
133
	 * Class constructor
127
	 *
134
	 *
128
	 * Determines whether zLib output compression will be used.
135
	 * Determines whether zLib output compression will be used.
129
	 *
136
	 *
Zeile 136... Zeile 143...
136
			$this->_zlib_oc === FALSE
143
			$this->_zlib_oc === FALSE
137
			&& config_item('compress_output') === TRUE
144
			&& config_item('compress_output') === TRUE
138
			&& extension_loaded('zlib')
145
			&& extension_loaded('zlib')
139
		);
146
		);
Zeile -... Zeile 147...
-
 
147
 
-
 
148
		isset(self::$func_override) OR self::$func_override = (extension_loaded('mbstring') && ini_get('mbstring.func_override'));
140
 
149
 
141
		// Get mime types for later
150
		// Get mime types for later
Zeile 142... Zeile 151...
142
		$this->mimes =& get_mimes();
151
		$this->mimes =& get_mimes();
143
 
152
 
Zeile 302... Zeile 311...
302
			return NULL;
311
			return NULL;
303
		}
312
		}
Zeile 304... Zeile 313...
304
 
313
 
305
		for ($i = 0, $c = count($headers); $i < $c; $i++)
314
		for ($i = 0, $c = count($headers); $i < $c; $i++)
306
		{
315
		{
307
			if (strncasecmp($header, $headers[$i], $l = strlen($header)) === 0)
316
			if (strncasecmp($header, $headers[$i], $l = self::strlen($header)) === 0)
308
			{
317
			{
309
				return trim(substr($headers[$i], $l+1));
318
				return trim(self::substr($headers[$i], $l+1));
310
			}
319
			}
Zeile 311... Zeile 320...
311
		}
320
		}
312
 
321
 
Zeile 478... Zeile 487...
478
			if ($this->_compress_output === TRUE)
487
			if ($this->_compress_output === TRUE)
479
			{
488
			{
480
				if (isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== FALSE)
489
				if (isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== FALSE)
481
				{
490
				{
482
					header('Content-Encoding: gzip');
491
					header('Content-Encoding: gzip');
483
					header('Content-Length: '.strlen($output));
492
					header('Content-Length: '.self::strlen($output));
484
				}
493
				}
485
				else
494
				else
486
				{
495
				{
487
					// User agent doesn't support gzip compression,
496
					// User agent doesn't support gzip compression,
488
					// so we'll have to decompress our cache
497
					// so we'll have to decompress our cache
489
					$output = gzinflate(substr($output, 10, -8));
498
					$output = gzinflate(self::substr($output, 10, -8));
490
				}
499
				}
491
			}
500
			}
Zeile 492... Zeile 501...
492
 
501
 
493
			echo $output;
502
			echo $output;
Zeile 599... Zeile 608...
599
				'headers'	=> $this->headers
608
				'headers'	=> $this->headers
600
			));
609
			));
Zeile 601... Zeile 610...
601
 
610
 
Zeile 602... Zeile 611...
602
			$output = $cache_info.'ENDCI--->'.$output;
611
			$output = $cache_info.'ENDCI--->'.$output;
603
 
612
 
604
			for ($written = 0, $length = strlen($output); $written < $length; $written += $result)
613
			for ($written = 0, $length = self::strlen($output); $written < $length; $written += $result)
605
			{
614
			{
606
				if (($result = fwrite($fp, substr($output, $written))) === FALSE)
615
				if (($result = fwrite($fp, self::substr($output, $written))) === FALSE)
607
				{
616
				{
608
					break;
617
					break;
Zeile 709... Zeile 718...
709
		{
718
		{
710
			$this->set_header($header[0], $header[1]);
719
			$this->set_header($header[0], $header[1]);
711
		}
720
		}
Zeile 712... Zeile 721...
712
 
721
 
713
		// Display the cache
722
		// Display the cache
714
		$this->_display(substr($cache, strlen($match[0])));
723
		$this->_display(self::substr($cache, self::strlen($match[0])));
715
		log_message('debug', 'Cache file is current. Sending it to browser.');
724
		log_message('debug', 'Cache file is current. Sending it to browser.');
716
		return TRUE;
725
		return TRUE;
Zeile 717... Zeile 726...
717
	}
726
	}
Zeile 795... Zeile 804...
795
			header('Expires: '.gmdate('D, d M Y H:i:s', $expiration).' GMT');
804
			header('Expires: '.gmdate('D, d M Y H:i:s', $expiration).' GMT');
796
			header('Last-modified: '.gmdate('D, d M Y H:i:s', $last_modified).' GMT');
805
			header('Last-modified: '.gmdate('D, d M Y H:i:s', $last_modified).' GMT');
797
		}
806
		}
798
	}
807
	}
Zeile -... Zeile 808...
-
 
808
 
-
 
809
	// --------------------------------------------------------------------
-
 
810
 
-
 
811
	/**
-
 
812
	 * Byte-safe strlen()
-
 
813
	 *
-
 
814
	 * @param	string	$str
-
 
815
	 * @return	int
-
 
816
	 */
-
 
817
	protected static function strlen($str)
-
 
818
	{
-
 
819
		return (self::$func_override)
-
 
820
			? mb_strlen($str, '8bit')
-
 
821
			: strlen($str);
-
 
822
	}
-
 
823
 
-
 
824
	// --------------------------------------------------------------------
-
 
825
 
-
 
826
	/**
-
 
827
	 * Byte-safe substr()
-
 
828
	 *
-
 
829
	 * @param	string	$str
-
 
830
	 * @param	int	$start
-
 
831
	 * @param	int	$length
-
 
832
	 * @return	string
-
 
833
	 */
-
 
834
	protected static function substr($str, $start, $length = NULL)
-
 
835
	{
-
 
836
		if (self::$func_override)
-
 
837
		{
-
 
838
			// mb_substr($str, $start, null, '8bit') returns an empty
-
 
839
			// string on PHP 5.3
-
 
840
			isset($length) OR $length = ($start >= 0 ? self::strlen($str) - $start : -$start);
-
 
841
			return mb_substr($str, $start, $length, '8bit');
-
 
842
		}
-
 
843
 
-
 
844
		return isset($length)
-
 
845
			? substr($str, $start, $length)
-
 
846
			: substr($str, $start);
799
 
847
	}