diff options
Diffstat (limited to 'system/libraries')
31 files changed, 1051 insertions, 1052 deletions
diff --git a/system/libraries/Benchmark.php b/system/libraries/Benchmark.php index 44c32a874..66e8a24cf 100644 --- a/system/libraries/Benchmark.php +++ b/system/libraries/Benchmark.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -43,18 +43,18 @@ class CI_Benchmark { * @param string $name name of the marker * @return void */ - function mark($name) - { - $this->marker[$name] = microtime(); - } + function mark($name) + { + $this->marker[$name] = microtime(); + } // -------------------------------------------------------------------- /** * Calculates the time difference between two marked points. * - * If the first parameter is empty this function instead returns the - * {elapsed_time} pseudo-variable. This permits the full system + * If the first parameter is empty this function instead returns the + * {elapsed_time} pseudo-variable. This permits the full system * execution time to be shown in a template. The output class will * swap the real value for this variable. * @@ -64,28 +64,28 @@ class CI_Benchmark { * @param integer the number of decimal places * @return mixed */ - function elapsed_time($point1 = '', $point2 = '', $decimals = 4) - { - if ($point1 == '') - { + function elapsed_time($point1 = '', $point2 = '', $decimals = 4) + { + if ($point1 == '') + { return '{elapsed_time}'; - } - - if ( ! isset($this->marker[$point1])) - { - return ''; - } - - if ( ! isset($this->marker[$point2])) - { - $this->marker[$point2] = microtime(); - } - - list($sm, $ss) = explode(' ', $this->marker[$point1]); - list($em, $es) = explode(' ', $this->marker[$point2]); - - return number_format(($em + $es) - ($sm + $ss), $decimals); - } + } + + if ( ! isset($this->marker[$point1])) + { + return ''; + } + + if ( ! isset($this->marker[$point2])) + { + $this->marker[$point2] = microtime(); + } + + list($sm, $ss) = explode(' ', $this->marker[$point1]); + list($em, $es) = explode(' ', $this->marker[$point2]); + + return number_format(($em + $es) - ($sm + $ss), $decimals); + } // -------------------------------------------------------------------- @@ -93,8 +93,8 @@ class CI_Benchmark { * Memory Usage * * This function returns the {memory_usage} pseudo-variable. - * This permits it to be put it anywhere in a template - * without the memory being calculated until the end. + * This permits it to be put it anywhere in a template + * without the memory being calculated until the end. * The output class will swap the real value for this variable. * * @access public diff --git a/system/libraries/Calendar.php b/system/libraries/Calendar.php index ec355d24f..84b096c8b 100644 --- a/system/libraries/Calendar.php +++ b/system/libraries/Calendar.php @@ -7,25 +7,25 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** * Code Igniter Calendar Class * - * This class enables the creation of calendars + * This class enables the creation of calendars * * @package CodeIgniter * @subpackage Libraries * @category Libraries * @author Rick Ellis * @link http://www.codeigniter.com/user_guide/libraries/calendar.html - */ + */ class CI_Calendar { var $CI; @@ -78,7 +78,7 @@ class CI_Calendar { $this->$key = $val; } } - } + } // -------------------------------------------------------------------- @@ -91,13 +91,13 @@ class CI_Calendar { * @param array the data to be shown in the calendar cells * @return string */ - function generate($year = '', $month = '', $data = array()) - { + function generate($year = '', $month = '', $data = array()) + { // Set and validate the supplied month/year - if ($year == '') - $year = date("Y", $this->local_time); - - if ($month == '') + if ($year == '') + $year = date("Y", $this->local_time); + + if ($month == '') $month = date("m", $this->local_time); if (strlen($year) == 1) @@ -112,10 +112,10 @@ class CI_Calendar { $adjusted_date = $this->adjust_date($month, $year); $month = $adjusted_date['month']; - $year = $adjusted_date['year']; + $year = $adjusted_date['year']; // Determine the total days in the month - $total_days = $this->get_total_days($month, $year); + $total_days = $this->get_total_days($month, $year); // Set the starting day of the week $start_days = array('sunday' => 0, 'monday' => 1, 'tuesday' => 2, 'wednesday' => 3, 'thursday' => 4, 'friday' => 5, 'saturday' => 6); @@ -194,7 +194,7 @@ class CI_Calendar { $out .= $this->temp['week_row_end']; $out .= "\n"; - // Build the main body of the calendar + // Build the main body of the calendar while ($day <= $total_days) { $out .= "\n"; @@ -202,7 +202,7 @@ class CI_Calendar { $out .= "\n"; for ($i = 0; $i < 7; $i++) - { + { $out .= ($is_current_month == TRUE AND $day == $cur_day) ? $this->temp['cal_cell_start_today'] : $this->temp['cal_cell_start']; if ($day > 0 AND $day <= $total_days) @@ -226,27 +226,27 @@ class CI_Calendar { $out .= $this->temp['cal_cell_blank']; } - $out .= ($is_current_month == TRUE AND $day == $cur_day) ? $this->temp['cal_cell_end_today'] : $this->temp['cal_cell_end']; - $day++; + $out .= ($is_current_month == TRUE AND $day == $cur_day) ? $this->temp['cal_cell_end_today'] : $this->temp['cal_cell_end']; + $day++; } - $out .= "\n"; + $out .= "\n"; $out .= $this->temp['cal_row_end']; - $out .= "\n"; + $out .= "\n"; } - $out .= "\n"; + $out .= "\n"; $out .= $this->temp['table_close']; return $out; - } + } // -------------------------------------------------------------------- /** * Get Month Name * - * Generates a textual month name based on the numeric + * Generates a textual month name based on the numeric * month provided. * * @access public @@ -275,12 +275,12 @@ class CI_Calendar { } // -------------------------------------------------------------------- - + /** * Get Day Names * * Returns an array of day names (Sunday, Monday, etc.) based - * on the type. Options: long, short, abrev + * on the type. Options: long, short, abrev * * @access public * @param string @@ -327,32 +327,32 @@ class CI_Calendar { * @param integer the year * @return array */ - function adjust_date($month, $year) - { - $date = array(); - - $date['month'] = $month; - $date['year'] = $year; - - while ($date['month'] > 12) - { - $date['month'] -= 12; - $date['year']++; - } - - while ($date['month'] <= 0) - { - $date['month'] += 12; - $date['year']--; - } - - if (strlen($date['month']) == 1) - { - $date['month'] = '0'.$date['month']; - } - - return $date; - } + function adjust_date($month, $year) + { + $date = array(); + + $date['month'] = $month; + $date['year'] = $year; + + while ($date['month'] > 12) + { + $date['month'] -= 12; + $date['year']++; + } + + while ($date['month'] <= 0) + { + $date['month'] += 12; + $date['year']--; + } + + if (strlen($date['month']) == 1) + { + $date['month'] = '0'.$date['month']; + } + + return $date; + } // -------------------------------------------------------------------- @@ -364,26 +364,26 @@ class CI_Calendar { * @param integer the year * @return integer */ - function get_total_days($month, $year) - { - $days_in_month = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); - - if ($month < 1 OR $month > 12) - { - return 0; - } - - // Is the year a leap year? - if ($month == 2) - { + function get_total_days($month, $year) + { + $days_in_month = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); + + if ($month < 1 OR $month > 12) + { + return 0; + } + + // Is the year a leap year? + if ($month == 2) + { if ($year % 400 == 0 OR ($year % 4 == 0 AND $year % 100 != 0)) { return 29; } - } - - return $days_in_month[$month - 1]; - } + } + + return $days_in_month[$month - 1]; + } // -------------------------------------------------------------------- diff --git a/system/libraries/Config.php b/system/libraries/Config.php index ef6d46a25..aa26c9203 100644 --- a/system/libraries/Config.php +++ b/system/libraries/Config.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -36,12 +36,12 @@ class CI_Config { * * Sets the $config data from the primary config.php file as a class variable * - * @access public - * @param string the config file name - * @param boolean if configuration values should be loaded into their own section - * @param boolean true if errors should just return false, false if an error message should be displayed - * @return boolean if the file was successfully loaded or not - */ + * @access public + * @param string the config file name + * @param boolean if configuration values should be loaded into their own section + * @param boolean true if errors should just return false, false if an error message should be displayed + * @return boolean if the file was successfully loaded or not + */ function CI_Config() { $this->config = get_config(); @@ -62,7 +62,7 @@ class CI_Config { $file = ($file == '') ? 'config' : str_replace(EXT, '', $file); if (in_array($file, $this->is_loaded, TRUE)) - { + { return TRUE; } @@ -125,7 +125,7 @@ class CI_Config { { if ($index == '') { - if ( ! isset($this->config[$item])) + if ( ! isset($this->config[$item])) { return FALSE; } @@ -134,7 +134,7 @@ class CI_Config { } else { - if ( ! isset($this->config[$index])) + if ( ! isset($this->config[$index])) { return FALSE; } @@ -147,7 +147,7 @@ class CI_Config { $pref = $this->config[$index][$item]; } - return $pref; + return $pref; } // -------------------------------------------------------------------- @@ -165,7 +165,7 @@ class CI_Config { */ function slash_item($item) { - if ( ! isset($this->config[$item])) + if ( ! isset($this->config[$item])) { return FALSE; } @@ -179,8 +179,8 @@ class CI_Config { $pref .= '/'; } } - - return $pref; + + return $pref; } // -------------------------------------------------------------------- @@ -195,7 +195,7 @@ class CI_Config { function site_url($uri = '') { if (is_array($uri)) - { + { $uri = implode('/', $uri); } diff --git a/system/libraries/Controller.php b/system/libraries/Controller.php index 3db408bec..b1feee86c 100644 --- a/system/libraries/Controller.php +++ b/system/libraries/Controller.php @@ -7,18 +7,18 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** * Code Igniter Application Controller Class * - * This class object is the super class the every library in + * This class object is the super class the every library in * Code Igniter will be assigned to. * * @package CodeIgniter @@ -45,7 +45,7 @@ class Controller extends CI_Base { $this->_ci_initialize(); log_message('debug', "Controller Class Initialized"); } - + // -------------------------------------------------------------------- /** @@ -56,17 +56,17 @@ class Controller extends CI_Base { * * @access private * @return void - */ + */ function _ci_initialize() { // Assign all the class objects that were instantiated by the - // front controller to local class variables so that CI can be + // front controller to local class variables so that CI can be // run as one big super object. $classes = array( - 'config' => 'Config', - 'input' => 'Input', - 'benchmark' => 'Benchmark', - 'uri' => 'URI', + 'config' => 'Config', + 'input' => 'Input', + 'benchmark' => 'Benchmark', + 'uri' => 'URI', 'output' => 'Output', 'lang' => 'Language' ); @@ -76,7 +76,7 @@ class Controller extends CI_Base { $this->$var =& load_class($class); } - // In PHP 5 the Controller class is run as a discreet + // In PHP 5 the Controller class is run as a discreet // class. In PHP 4 it extends the Controller if (floor(phpversion()) >= 5) { @@ -97,8 +97,8 @@ class Controller extends CI_Base { * @access private * @return void */ - function _ci_scaffolding() - { + function _ci_scaffolding() + { if ($this->_ci_scaffolding === FALSE OR $this->_ci_scaff_table === FALSE) { show_404('Scaffolding unavailable'); @@ -109,8 +109,8 @@ class Controller extends CI_Base { require_once(BASEPATH.'scaffolding/Scaffolding'.EXT); $scaff = new Scaffolding($this->_ci_scaff_table); $scaff->$method(); - } - + } + } // END _Controller class diff --git a/system/libraries/Email.php b/system/libraries/Email.php index eb04ae9dc..92f2e73fa 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -87,7 +87,7 @@ class CI_Email { log_message('debug', "Email Class Initialized"); } - + // -------------------------------------------------------------------- /** @@ -116,7 +116,7 @@ class CI_Email { } } } - $this->_smtp_auth = ($this->smtp_user == '' AND $this->smtp_pass == '') ? FALSE : TRUE; + $this->_smtp_auth = ($this->smtp_user == '' AND $this->smtp_pass == '') ? FALSE : TRUE; $this->_safe_mode = (@ini_get("safe_mode") == 0) ? FALSE : TRUE; } @@ -142,12 +142,12 @@ class CI_Email { $this->_set_header('User-Agent', $this->useragent); $this->_set_header('Date', $this->_set_date()); - if ($clear_attachments !== FALSE) - { - $this->_attach_name = array(); - $this->_attach_type = array(); - $this->_attach_disp = array(); - } + if ($clear_attachments !== FALSE) + { + $this->_attach_name = array(); + $this->_attach_type = array(); + $this->_attach_disp = array(); + } } // -------------------------------------------------------------------- @@ -344,9 +344,9 @@ class CI_Email { { $this->_attach_name[] = $filename; $this->_attach_type[] = $this->_mime_types(next(explode('.', basename($filename)))); - $this->_attach_disp[] = $disposition; // Can also be 'inline' Not sure if it matters + $this->_attach_disp[] = $disposition; // Can also be 'inline' Not sure if it matters } - + // -------------------------------------------------------------------- /** @@ -450,7 +450,7 @@ class CI_Email { * @return void */ function set_protocol($protocol = 'mail') - { + { $this->protocol = ( ! in_array($protocol, $this->_protocols, TRUE)) ? 'mail' : strtolower($protocol); } @@ -528,7 +528,7 @@ class CI_Email { $from = str_replace(">", "", $from); $from = str_replace("<", "", $from); - return "<".uniqid('').strstr($from, '@').">"; + return "<".uniqid('').strstr($from, '@').">"; } // -------------------------------------------------------------------- @@ -545,7 +545,7 @@ class CI_Email { $this->protocol = strtolower($this->protocol); $this->protocol = ( ! in_array($this->protocol, $this->_protocols, TRUE)) ? 'mail' : $this->protocol; - if ($return == true) + if ($return == true) return $this->protocol; } @@ -562,13 +562,13 @@ class CI_Email { { $this->_encoding = ( ! in_array($this->_encoding, $this->_bit_depths)) ? '7bit' : $this->_encoding; - if ( ! in_array($this->charset, $this->_base_charsets, TRUE)) + if ( ! in_array($this->charset, $this->_base_charsets, TRUE)) $this->_encoding = "8bit"; - if ($return == true) + if ($return == true) return $this->_encoding; } - + // -------------------------------------------------------------------- /** @@ -641,7 +641,7 @@ class CI_Email { foreach ($email as $val) { - if ( ! $this->valid_email($val)) + if ( ! $this->valid_email($val)) { $this->_set_error_message('email_invalid_address', $val); return FALSE; @@ -662,7 +662,7 @@ class CI_Email { { if ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $address)) return FALSE; - else + else return TRUE; } @@ -680,19 +680,19 @@ class CI_Email { if ( ! is_array($email)) { if (preg_match('/\<(.*)\>/', $email, $match)) - return $match['1']; - else - return $email; + return $match['1']; + else + return $email; } $clean_email = array(); - for ($i=0; $i < count($email); $i++) + for ($i=0; $i < count($email); $i++) { if (preg_match( '/\<(.*)\>/', $email[$i], $match)) - $clean_email[] = $match['1']; - else - $clean_email[] = $email[$i]; + $clean_email[] = $match['1']; + else + $clean_email[] = $email[$i]; } return $clean_email; @@ -705,7 +705,7 @@ class CI_Email { * * This function provides the raw message for use * in plain-text headers of HTML-formatted emails. - * If the user hasn't specified his own alternative message + * If the user hasn't specified his own alternative message * it creates one by stripping the HTML * * @access private @@ -764,7 +764,7 @@ class CI_Email { $output = ""; - while (list(, $thisline) = each($lines)) + while (list(, $thisline) = each($lines)) { if (strlen($thisline) > $chars) { @@ -772,9 +772,9 @@ class CI_Email { $words = split(" ", $thisline); - while(list(, $thisword) = each($words)) + while(list(, $thisword) = each($words)) { - while((strlen($thisword)) > $chars) + while((strlen($thisword)) > $chars) { if (stristr($thisword, '{unwrap}') !== FALSE OR stristr($thisword, '{/unwrap}') !== FALSE) { @@ -794,21 +794,21 @@ class CI_Email { $thisword = substr($thisword, $cur_pos, (strlen($thisword) - $cur_pos)); } - if ((strlen($line) + strlen($thisword)) > $chars) + if ((strlen($line) + strlen($thisword)) > $chars) { $output .= $line."\n"; $line = $thisword." "; - } - else + } + else { $line .= $thisword." "; } } $output .= $line."\n"; - } - else + } + else { $output .= $thisline."\n"; } @@ -854,7 +854,7 @@ class CI_Email { reset($this->_headers); $this->_header_str = ""; - foreach($this->_headers as $key => $val) + foreach($this->_headers as $key => $val) { $val = trim($val); @@ -972,7 +972,7 @@ class CI_Email { { $this->_header_str .= $hdr; - $body = $this->_body . $this->newline . $this->newline; + $body = $this->_body . $this->newline . $this->newline; $body .= "--" . $this->_alt_boundary . "--" . $this->newline . $this->newline; } @@ -995,7 +995,7 @@ class CI_Email { if ( ! file_exists($filename)) { - $this->_set_error_message('email_attachment_missing', $filename); + $this->_set_error_message('email_attachment_missing', $filename); return FALSE; } @@ -1010,7 +1010,7 @@ class CI_Email { if ( ! $fp = fopen($filename, 'r')) { - $this->_set_error_message('email_attachment_unredable', $filename); + $this->_set_error_message('email_attachment_unredable', $filename); return FALSE; } @@ -1128,10 +1128,10 @@ class CI_Email { * @access private * @return void */ - function _unwrap_specials() - { - $this->_finalbody = preg_replace_callback("/\{unwrap\}(.*?)\{\/unwrap\}/si", array($this, '_remove_nl_callback'), $this->_finalbody); - } + function _unwrap_specials() + { + $this->_finalbody = preg_replace_callback("/\{unwrap\}(.*?)\{\/unwrap\}/si", array($this, '_remove_nl_callback'), $this->_finalbody); + } // -------------------------------------------------------------------- @@ -1141,10 +1141,10 @@ class CI_Email { * @access private * @return string */ - function _remove_nl_callback($matches) - { - return preg_replace("/(\r\n)|(\r)|(\n)/", "", $matches['1']); - } + function _remove_nl_callback($matches) + { + return preg_replace("/(\r\n)|(\r)|(\n)/", "", $matches['1']); + } // -------------------------------------------------------------------- @@ -1156,7 +1156,7 @@ class CI_Email { */ function _spool_email() { - $this->_unwrap_specials(); + $this->_unwrap_specials(); switch ($this->_get_protocol()) { @@ -1168,7 +1168,7 @@ class CI_Email { return FALSE; } break; - case 'sendmail' : + case 'sendmail' : if ( ! $this->_send_with_sendmail()) { @@ -1176,7 +1176,7 @@ class CI_Email { return FALSE; } break; - case 'smtp' : + case 'smtp' : if ( ! $this->_send_with_smtp()) { @@ -1252,8 +1252,8 @@ class CI_Email { */ function _send_with_smtp() { - if ($this->smtp_host == '') - { + if ($this->smtp_host == '') + { $this->_set_error_message('email_no_hostname'); return FALSE; } @@ -1316,10 +1316,10 @@ class CI_Email { function _smtp_connect() { - $this->_smtp_connect = fsockopen($this->smtp_host, + $this->_smtp_connect = fsockopen($this->smtp_host, $this->smtp_port, - $errno, - $errstr, + $errno, + $errstr, $this->smtp_timeout); if( ! is_resource($this->_smtp_connect)) @@ -1478,17 +1478,17 @@ class CI_Email { */ function _get_smtp_data() { - $data = ""; - - while ($str = fgets($this->_smtp_connect, 512)) - { + $data = ""; + + while ($str = fgets($this->_smtp_connect, 512)) + { $data .= $str; if (substr($str, 3, 1) == " ") break; - } - - return $data; + } + + return $data; } // -------------------------------------------------------------------- @@ -1567,7 +1567,6 @@ class CI_Email { $msg .= "<pre>".$this->_header_str."\n".$this->_subject."\n".$this->_finalbody.'</pre>'; return $msg; } - // print_debugger() // -------------------------------------------------------------------- diff --git a/system/libraries/Encrypt.php b/system/libraries/Encrypt.php index b7dba2523..0f860a967 100644 --- a/system/libraries/Encrypt.php +++ b/system/libraries/Encrypt.php @@ -7,7 +7,7 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource @@ -98,12 +98,12 @@ class CI_Encrypt { /** * Encode * - * Encodes the message string using bitwise XOR encoding. - * The key is combined with a random hash, and then it - * too gets converted using XOR. The whole thing is then run - * through mcrypt (if supported) using the randomized key. - * The end result is a double-encrypted message string - * that is randomized with each call to this function, + * Encodes the message string using bitwise XOR encoding. + * The key is combined with a random hash, and then it + * too gets converted using XOR. The whole thing is then run + * through mcrypt (if supported) using the randomized key. + * The end result is a double-encrypted message string + * that is randomized with each call to this function, * even if the supplied message and key are the same. * * @access public @@ -169,8 +169,8 @@ class CI_Encrypt { function _xor_encode($string, $key) { $rand = ''; - while (strlen($rand) < 32) - { + while (strlen($rand) < 32) + { $rand .= mt_rand(0, mt_getrandmax()); } @@ -190,7 +190,7 @@ class CI_Encrypt { /** * XOR Decode * - * Takes an encoded string and key as input and generates the + * Takes an encoded string and key as input and generates the * plain-text original message * * @access private @@ -245,7 +245,7 @@ class CI_Encrypt { * @param string * @return string */ - function mcrypt_encode($data, $key) + function mcrypt_encode($data, $key) { $init_size = mcrypt_get_iv_size($this->_get_cipher(), $this->_get_mode()); $init_vect = mcrypt_create_iv($init_size, MCRYPT_RAND); @@ -262,7 +262,7 @@ class CI_Encrypt { * @param string * @return string */ - function mcrypt_decode($data, $key) + function mcrypt_decode($data, $key) { $init_size = mcrypt_get_iv_size($this->_get_cipher(), $this->_get_mode()); $init_vect = mcrypt_create_iv($init_size, MCRYPT_RAND); @@ -307,7 +307,7 @@ class CI_Encrypt { */ function _get_cipher() { - if ($this->_mcrypt_cipher == '') + if ($this->_mcrypt_cipher == '') { $this->_mcrypt_cipher = MCRYPT_RIJNDAEL_256; } @@ -325,7 +325,7 @@ class CI_Encrypt { */ function _get_mode() { - if ($this->_mcrypt_mode == '') + if ($this->_mcrypt_mode == '') { $this->_mcrypt_mode = MCRYPT_MODE_ECB; } @@ -378,7 +378,7 @@ class CI_Encrypt { { require_once(BASEPATH.'libraries/Sha1'.EXT); $SH = new CI_SHA; - return $SH->generate($str); + return $SH->generate($str); } else { @@ -389,7 +389,7 @@ class CI_Encrypt { { return sha1($str); } - } + } } diff --git a/system/libraries/Exceptions.php b/system/libraries/Exceptions.php index a0591e4e5..6d58ee6b9 100644 --- a/system/libraries/Exceptions.php +++ b/system/libraries/Exceptions.php @@ -7,17 +7,17 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** * Exceptions Class - * + * * @package CodeIgniter * @subpackage Libraries * @category Exceptions @@ -48,7 +48,7 @@ class CI_Exceptions { /** - * Constructor + * Constructor * */ function CI_Exceptions() @@ -76,7 +76,7 @@ class CI_Exceptions { log_message('error', 'Severity: '.$severity.' '.$severity.' --> '.$message. ' '.$filepath.' '.$line, TRUE); } - + // -------------------------------------------------------------------- /** @@ -89,7 +89,7 @@ class CI_Exceptions { function show_404($page = '') { $heading = "404 Page Not Found"; - $message = "The page you requested was not found."; + $message = "The page you requested was not found."; log_message('error', '404 Page Not Found --> '.$page); echo $this->show_error($heading, $message, 'error_404'); @@ -125,7 +125,7 @@ class CI_Exceptions { ob_end_clean(); return $buffer; } - + // -------------------------------------------------------------------- /** diff --git a/system/libraries/Hooks.php b/system/libraries/Hooks.php index 6f48723f6..99d2e3e30 100644 --- a/system/libraries/Hooks.php +++ b/system/libraries/Hooks.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -132,7 +132,7 @@ class CI_Hooks { // Safety - Prevents run-away loops // ----------------------------------- - // If the script being called happens to have the same + // If the script being called happens to have the same // hook call within it a loop can happen if ($this->in_progress == TRUE) @@ -164,17 +164,17 @@ class CI_Hooks { $function = FALSE; $params = ''; - if (isset($data['class']) AND $data['class'] != '') + if (isset($data['class']) AND $data['class'] != '') { $class = $data['class']; } - if (isset($data['function'])) + if (isset($data['function'])) { $function = $data['function']; } - if (isset($data['params'])) + if (isset($data['params'])) { $params = $data['params']; } diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index f8c05f834..561c5c03a 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -7,17 +7,17 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** * Image Manipulation class - * + * * @package CodeIgniter * @subpackage Libraries * @category Image_lib @@ -77,7 +77,7 @@ class CI_Image_lib { var $wm_use_truetype = FALSE; /** - * Constructor + * Constructor * * @access public * @param string @@ -123,7 +123,7 @@ class CI_Image_lib { * @return void */ function initialize($props = array()) - { + { /* * Convert array elements into class variables */ @@ -144,7 +144,7 @@ class CI_Image_lib { if ($this->source_image == '') { $this->set_error('imglib_source_image_required'); - return FALSE; + return FALSE; } /* @@ -155,7 +155,7 @@ class CI_Image_lib { * properties using ImageMagick and NetPBM * */ - if ( ! function_exists('getimagesize')) + if ( ! function_exists('getimagesize')) { $this->set_error('imglib_gd_required_for_props'); return FALSE; @@ -173,7 +173,7 @@ class CI_Image_lib { */ if (function_exists('realpath') AND @realpath($this->source_image) !== FALSE) { - $full_source_path = str_replace("\\", "/", realpath($this->source_image)); + $full_source_path = str_replace("\\", "/", realpath($this->source_image)); } else { @@ -187,7 +187,7 @@ class CI_Image_lib { // Set the Image Properties if ( ! $this->get_image_properties($this->source_folder.$this->source_image)) { - return FALSE; + return FALSE; } /* @@ -215,11 +215,11 @@ class CI_Image_lib { { if (function_exists('realpath') AND @realpath($this->new_image) !== FALSE) { - $full_dest_path = str_replace("\\", "/", realpath($this->new_image)); + $full_dest_path = str_replace("\\", "/", realpath($this->new_image)); } else { - $full_dest_path = $this->new_image; + $full_dest_path = $this->new_image; } // Is there a file name? @@ -257,7 +257,7 @@ class CI_Image_lib { $filename = $xp['name']; $file_ext = $xp['ext']; - $this->full_src_path = $this->source_folder.$this->source_image; + $this->full_src_path = $this->source_folder.$this->source_image; $this->full_dst_path = $this->dest_folder.$filename.$this->thumb_marker.$file_ext; /* @@ -316,7 +316,7 @@ class CI_Image_lib { if ($this->wm_overlay_path != '') { - $this->wm_overlay_path = str_replace("\\", "/", realpath($this->wm_overlay_path)); + $this->wm_overlay_path = str_replace("\\", "/", realpath($this->wm_overlay_path)); } if ($this->wm_shadow_color != '') @@ -330,7 +330,7 @@ class CI_Image_lib { } return TRUE; - } + } // -------------------------------------------------------------------- @@ -397,7 +397,7 @@ class CI_Image_lib { if ($this->rotation_angle == '' OR ! in_array($this->rotation_angle, $degs, TRUE)) { $this->set_error('imglib_rotation_angle_required'); - return FALSE; + return FALSE; } // Reassign the width and height @@ -454,7 +454,7 @@ class CI_Image_lib { // We'll return true so the user thinks the process succeeded. // It'll be our little secret... - return TRUE; + return TRUE; } // Reassign the source width/height if cropping @@ -478,7 +478,7 @@ class CI_Image_lib { if ( ! @copy($this->full_src_path, $this->full_dst_path)) { $this->set_error('imglib_copy_failed'); - return FALSE; + return FALSE; } @chmod($this->full_dst_path, 0777); @@ -508,12 +508,12 @@ class CI_Image_lib { $copy = 'imagecopyresized'; } - $dst_img = $create($this->width, $this->height); - $copy($dst_img, $src_img, 0, 0, $this->x_axis, $this->y_axis, $this->width, $this->height, $this->orig_width, $this->orig_height); + $dst_img = $create($this->width, $this->height); + $copy($dst_img, $src_img, 0, 0, $this->x_axis, $this->y_axis, $this->width, $this->height, $this->orig_width, $this->orig_height); // Show the image if ($this->dynamic_output == TRUE) - { + { $this->image_display_gd($dst_img); } else @@ -526,11 +526,11 @@ class CI_Image_lib { } // Kill the file handles - imagedestroy($dst_img); + imagedestroy($dst_img); imagedestroy($src_img); // Set the file to 777 - @chmod($this->full_dst_path, 0777); + @chmod($this->full_dst_path, 0777); return TRUE; } @@ -555,7 +555,7 @@ class CI_Image_lib { return FALSE; } - if ( ! eregi("convert$", $this->library_path)) + if ( ! eregi("convert$", $this->library_path)) { if ( ! eregi("/$", $this->library_path)) $this->library_path .= "/"; @@ -593,14 +593,14 @@ class CI_Image_lib { @exec($cmd, $output, $retval); // Did it work? - if ($retval > 0) + if ($retval > 0) { $this->set_error('imglib_image_process_failed'); return FALSE; } // Set the file to 777 - @chmod($this->full_dst_path, 0777); + @chmod($this->full_dst_path, 0777); return TRUE; } @@ -675,7 +675,7 @@ class CI_Image_lib { @exec($cmd, $output, $retval); // Did it work? - if ($retval > 0) + if ($retval > 0) { $this->set_error('imglib_image_process_failed'); return FALSE; @@ -686,7 +686,7 @@ class CI_Image_lib { // we have to rename the temp file. copy ($this->dest_folder.'netpbm.tmp', $this->full_dst_path); unlink ($this->dest_folder.'netpbm.tmp'); - @chmod($dst_image, 0777); + @chmod($dst_image, 0777); return TRUE; } @@ -704,7 +704,7 @@ class CI_Image_lib { // Is Image Rotation Supported? // this function is only supported as of PHP 4.3 if ( ! function_exists('imagerotate')) - { + { $this->set_error('imglib_rotate_unsupported'); return FALSE; } @@ -727,7 +727,7 @@ class CI_Image_lib { // Save the Image if ($this->dynamic_output == TRUE) - { + { $this->image_display_gd($dst_img); } else @@ -740,12 +740,12 @@ class CI_Image_lib { } // Kill the file handles - imagedestroy($dst_img); + imagedestroy($dst_img); imagedestroy($src_img); // Set the file to 777 - @chmod($this->full_dst_path, 0777); + @chmod($this->full_dst_path, 0777); return true; } @@ -773,47 +773,47 @@ class CI_Image_lib { if ($this->rotation_angle == 'hor') { for ($i = 0; $i < $height; $i++) - { - $left = 0; - $right = $width-1; + { + $left = 0; + $right = $width-1; while ($left < $right) - { - $cl = imagecolorat($src_img, $left, $i); + { + $cl = imagecolorat($src_img, $left, $i); $cr = imagecolorat($src_img, $right, $i); - imagesetpixel($src_img, $left, $i, $cr); - imagesetpixel($src_img, $right, $i, $cl); + imagesetpixel($src_img, $left, $i, $cr); + imagesetpixel($src_img, $right, $i, $cl); - $left++; - $right--; - } + $left++; + $right--; + } } } else { for ($i = 0; $i < $width; $i++) - { - $top = 0; - $bot = $height-1; + { + $top = 0; + $bot = $height-1; while ($top < $bot) - { + { $ct = imagecolorat($src_img, $i, $top); $cb = imagecolorat($src_img, $i, $bot); - imagesetpixel($src_img, $i, $top, $cb); - imagesetpixel($src_img, $i, $bot, $ct); + imagesetpixel($src_img, $i, $top, $cb); + imagesetpixel($src_img, $i, $bot, $ct); - $top++; - $bot--; - } + $top++; + $bot--; + } } } // Show the image if ($this->dynamic_output == TRUE) - { + { $this->image_display_gd($src_img); } else @@ -829,7 +829,7 @@ class CI_Image_lib { imagedestroy($src_img); // Set the file to 777 - @chmod($this->full_dst_path, 0777); + @chmod($this->full_dst_path, 0777); return TRUE; } @@ -930,8 +930,8 @@ class CI_Image_lib { } // Build the finalized image - if ($wm_img_type == 3 AND function_exists('imagealphablending')) - { + if ($wm_img_type == 3 AND function_exists('imagealphablending')) + { @imagealphablending($src_img, TRUE); } @@ -941,7 +941,7 @@ class CI_Image_lib { // Output the image if ($this->dynamic_output == TRUE) - { + { $this->image_display_gd($src_img); } else @@ -966,7 +966,7 @@ class CI_Image_lib { * @access public * @return bool */ - function text_watermark() + function text_watermark() { if ( ! ($src_img = $this->image_create_gd())) { @@ -1039,7 +1039,7 @@ class CI_Image_lib { $this->wm_vrt_alignment = strtoupper(substr($this->wm_vrt_alignment, 0, 1)); $this->wm_hor_alignment = strtoupper(substr($this->wm_hor_alignment, 0, 1)); - switch ($this->wm_vrt_alignment) + switch ($this->wm_vrt_alignment) { case "T" : break; @@ -1053,7 +1053,7 @@ class CI_Image_lib { $y_shad = $y_axis + $this->wm_shadow_distance; // Set horizontal alignment - switch ($this->wm_hor_alignment) + switch ($this->wm_hor_alignment) { case "L": break; @@ -1085,7 +1085,7 @@ class CI_Image_lib { // Output the final image if ($this->dynamic_output == TRUE) - { + { $this->image_display_gd($src_img); } else @@ -1160,7 +1160,7 @@ class CI_Image_lib { /** * Write image file to disk - GD * - * Takes an image resource as input and writes the file + * Takes an image resource as input and writes the file * to the specified destination * * @access public @@ -1226,7 +1226,7 @@ class CI_Image_lib { header("Content-Disposition: filename={$this->source_image};"); header("Content-Type: {$this->mime_type}"); header('Content-Transfer-Encoding: binary'); - header('Last-Modified: '.gmdate('D, d M Y H:i:s', time()).' GMT'); + header('Last-Modified: '.gmdate('D, d M Y H:i:s', time()).' GMT'); switch ($this->image_type) { @@ -1247,9 +1247,9 @@ class CI_Image_lib { * Re-proportion Image Width/Height * * When creating thumbs, the desired width/height - * can end up warping the image due to an incorrect - * ratio between the full-sized image and the thumb. - * + * can end up warping the image due to an incorrect + * ratio between the full-sized image and the thumb. + * * This function lets us re-proportion the width/height * if users choose to maintain the aspect ratio when resizing. * @@ -1323,7 +1323,7 @@ class CI_Image_lib { $v['width'] = $vals['0']; $v['height'] = $vals['1']; $v['image_type'] = $vals['2']; - $v['size_str'] = $vals['3']; + $v['size_str'] = $vals['3']; $v['mime_type'] = $mime; return $v; @@ -1332,8 +1332,8 @@ class CI_Image_lib { $this->orig_width = $vals['0']; $this->orig_height = $vals['1']; $this->image_type = $vals['2']; - $this->size_str = $vals['3']; - $this->mime_type = $mime; + $this->size_str = $vals['3']; + $this->mime_type = $mime; return TRUE; } @@ -1352,7 +1352,7 @@ class CI_Image_lib { * 'height' => $height, * 'new_width' => 40, * 'new_height' => '' - * ); + * ); * * @access public * @param array diff --git a/system/libraries/Input.php b/system/libraries/Input.php index 57696c8a2..8408b16fc 100644 --- a/system/libraries/Input.php +++ b/system/libraries/Input.php @@ -7,17 +7,17 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** * Input Class - * + * * Pre-processes global input data for security * * @package CodeIgniter @@ -103,7 +103,7 @@ class CI_Input { if (is_array($_COOKIE) AND count($_COOKIE) > 0) { foreach($_COOKIE as $key => $val) - { + { $_COOKIE[$this->_clean_input_keys($key)] = $this->_clean_input_data($val); } } @@ -116,7 +116,7 @@ class CI_Input { /** * Clean Input Data * - * This is a helper function. It escapes data and + * This is a helper function. It escapes data and * standardizes newline characters to \n * * @access private @@ -149,8 +149,8 @@ class CI_Input { /** * Clean Keys * - * This is a helper function. To prevent malicious users - * from trying to exploit keys we make sure that keys are + * This is a helper function. To prevent malicious users + * from trying to exploit keys we make sure that keys are * only named with alpha-numeric text and a few other items. * * @access private @@ -160,7 +160,7 @@ class CI_Input { function _clean_input_keys($str) { if ( ! preg_match("/^[a-z0-9:_\/-]+$/i", $str)) - { + { exit('Disallowed Key Characters: '.$str); } @@ -378,7 +378,7 @@ class CI_Input { * got from Bitflux: http://blog.bitflux.ch/wiki/XSS_Prevention * * To help develop this script I used this great list of - * vulnerabilities along with a few other hacks I've + * vulnerabilities along with a few other hacks I've * harvested from examining vulnerabilities in other programs: * http://ha.ckers.org/xss.html * @@ -408,7 +408,7 @@ class CI_Input { $str = preg_replace('#(&\#*\w+)[\x00-\x20]+;#u',"\\1;",$str); /* - * Validate UTF16 two byte encoding (x00) + * Validate UTF16 two byte encoding (x00) * * Just as above, adds a semicolon if missing. * @@ -429,20 +429,20 @@ class CI_Input { $str = preg_replace("/%([a-z0-9]{2})/i", "&#x\\1;", $str); /* - * Convert character entities to ASCII + * Convert character entities to ASCII * * This permits our tests below to work reliably. * We only convert entities that are within tags since * these are the ones that will pose security problems. * */ - + if (preg_match_all("/<(.+?)>/si", $str, $matches)) { for ($i = 0; $i < count($matches['0']); $i++) { - $str = str_replace($matches['1'][$i], - $this->_html_entity_decode($matches['1'][$i], $charset), + $str = str_replace($matches['1'][$i], + $this->_html_entity_decode($matches['1'][$i], $charset), $str); } } @@ -500,7 +500,7 @@ class CI_Input { * Remove JavaScript Event Handlers * * Note: This code is a little blunt. It removes - * the event handler and anything up to the closing >, + * the event handler and anything up to the closing >, * but it's unlikely to be a problem. * */ @@ -509,7 +509,7 @@ class CI_Input { /* * Sanitize naughty HTML elements * - * If a tag containing any of the words in the list + * If a tag containing any of the words in the list * below is found, the tag gets converted to entities. * * So this: <blink> @@ -552,7 +552,7 @@ class CI_Input { foreach ($bad as $key => $val) { - $str = preg_replace("#".$key."#i", $val, $str); + $str = preg_replace("#".$key."#i", $val, $str); } @@ -582,11 +582,11 @@ class CI_Input { /* -------------------------------------------------*/ /* - NOTE: html_entity_decode() has a bug in some PHP versions when UTF-8 is the + NOTE: html_entity_decode() has a bug in some PHP versions when UTF-8 is the character set, and the PHP developers said they were not back porting the fix to versions other than PHP 5.x. */ - function _html_entity_decode($str, $charset='ISO-8859-1') + function _html_entity_decode($str, $charset='ISO-8859-1') { if (stristr($str, '&') === FALSE) return $str; diff --git a/system/libraries/Language.php b/system/libraries/Language.php index 825080745..37a5c7e99 100644 --- a/system/libraries/Language.php +++ b/system/libraries/Language.php @@ -7,17 +7,17 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** * Language Class - * + * * @package CodeIgniter * @subpackage Libraries * @category Language @@ -30,7 +30,7 @@ class CI_Language { var $is_loaded = array(); /** - * Constructor + * Constructor * * @access public */ @@ -83,7 +83,7 @@ class CI_Language { } } - + if ( ! isset($lang)) { log_message('error', 'Language file contains no data: language/'.$idiom.'/'.$langfile); diff --git a/system/libraries/Loader.php b/system/libraries/Loader.php index 849ee731a..7a1fd6802 100644 --- a/system/libraries/Loader.php +++ b/system/libraries/Loader.php @@ -7,17 +7,17 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** * Loader Class - * + * * Loads views and files * * @package CodeIgniter @@ -192,7 +192,7 @@ class CI_Loader { * Load the Utilities Class * * @access public - * @return string + * @return string */ function dbutil() { @@ -550,9 +550,9 @@ class CI_Loader { /* * Extract and cache variables * - * You can either set variables using the dedicated $this->load_vars() - * function or via the second parameter of this function. We'll merge - * the two types and cache them so that views that are embedded within + * You can either set variables using the dedicated $this->load_vars() + * function or via the second parameter of this function. We'll merge + * the two types and cache them so that views that are embedded within * other views can have access to these variables. */ if (is_array($vars)) @@ -579,9 +579,9 @@ class CI_Loader { * * We buffer the output for two reasons: * 1. Speed. You get a significant speed boost. - * 2. So that the final rendered template can be + * 2. So that the final rendered template can be * post-processed by the output class. Why do we - * need post processing? For one thing, in order to + * need post processing? For one thing, in order to * show the elapsed page load time. Unless we * can intercept the content right before it's sent to * the browser and then stop the timer it won't be accurate. @@ -612,7 +612,7 @@ class CI_Loader { if ($return === TRUE) { $buffer = ob_get_contents(); - ob_end_clean(); + ob_end_clean(); return $buffer; } @@ -621,9 +621,9 @@ class CI_Loader { * Flush the buffer... or buff the flusher? * * In order to permit views to be nested within - * other views, we need to flush the content back out whenever - * we are beyond the first level of output buffering so that - * it can be seen and included properly by the first included + * other views, we need to flush the content back out whenever + * we are beyond the first level of output buffering so that + * it can be seen and included properly by the first included * template and any subsequent ones. Oy! * */ @@ -702,7 +702,7 @@ class CI_Loader { { // Is there an associated config file for this class? if ($config !== NULL) - { + { $cong = NULL; if (file_exists(APPPATH.'config/'.$class.EXT)) { @@ -740,7 +740,7 @@ class CI_Loader { /** * Autoloader * - * The config/autoload.php file contains an array that permits sub-systems, + * The config/autoload.php file contains an array that permits sub-systems, * libraries, plugins, and helpers to be loaded automatically. * * @access private @@ -785,14 +785,14 @@ class CI_Loader { // Load libraries if (isset($autoload['libraries']) AND count($autoload['libraries']) > 0) { - // Load the database driver. + // Load the database driver. if (in_array('database', $autoload['libraries'])) { $this->database(); $autoload['libraries'] = array_diff($autoload['libraries'], array('database')); } - // Load the model class. + // Load the model class. if (in_array('model', $autoload['libraries'])) { $this->model(); diff --git a/system/libraries/Log.php b/system/libraries/Log.php index 09538fa0b..03dc64005 100644 --- a/system/libraries/Log.php +++ b/system/libraries/Log.php @@ -7,17 +7,17 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** * Logging Class - * + * * @package CodeIgniter * @subpackage Libraries * @category Logging @@ -78,7 +78,7 @@ class CI_Log { function write_log($level = 'error', $msg, $php_error = FALSE) { if ($this->_enabled === FALSE) - { + { return FALSE; } diff --git a/system/libraries/Model.php b/system/libraries/Model.php index 017a9c6d8..240db4397 100644 --- a/system/libraries/Model.php +++ b/system/libraries/Model.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -41,7 +41,7 @@ class Model { * Assign Libraries * * Creates local references to all currently instantiated objects - * so that any syntax that can be legally used in a controller + * so that any syntax that can be legally used in a controller * can be used within models. * * @access private diff --git a/system/libraries/Output.php b/system/libraries/Output.php index 9c48bbb84..0c2620df7 100644 --- a/system/libraries/Output.php +++ b/system/libraries/Output.php @@ -7,19 +7,19 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** * Output Class * * Responsible for sending final output to browser - * + * * @package CodeIgniter * @subpackage Libraries * @category Output @@ -42,7 +42,7 @@ class CI_Output { // -------------------------------------------------------------------- /** - * Get Output + * Get Output * * Returns the current output string * @@ -57,7 +57,7 @@ class CI_Output { // -------------------------------------------------------------------- /** - * Set Output + * Set Output * * Sets the output string * @@ -73,7 +73,7 @@ class CI_Output { // -------------------------------------------------------------------- /** - * Set Header + * Set Header * * Lets you set a server header which will be outputted with the final display. * @@ -92,7 +92,7 @@ class CI_Output { // -------------------------------------------------------------------- /** - * Enable/disable Profiler + * Enable/disable Profiler * * @access public * @param bool @@ -106,7 +106,7 @@ class CI_Output { // -------------------------------------------------------------------- /** - * Set Cache + * Set Cache * * @access public * @param integer @@ -135,8 +135,8 @@ class CI_Output { */ function _display($output = '') { - // Note: We use globals because we can't use $CI =& get_instance() - // since this function is sometimes called by the caching mechanism, + // Note: We use globals because we can't use $CI =& get_instance() + // since this function is sometimes called by the caching mechanism, // which happens before the CI super object is available. global $BM, $CFG; @@ -158,7 +158,7 @@ class CI_Output { // -------------------------------------------------------------------- - // Parse out the elapsed time and memory usage, + // Parse out the elapsed time and memory usage, // then swap the pseudo-variables with the data $elapsed = $BM->elapsed_time('total_execution_time_start', 'total_execution_time_end'); @@ -249,7 +249,7 @@ class CI_Output { // -------------------------------------------------------------------- /** - * Write a Cache File + * Write a Cache File * * @access public * @return void @@ -272,19 +272,19 @@ class CI_Output { $cache_path .= md5($uri); - if ( ! $fp = @fopen($cache_path, 'wb')) - { + if ( ! $fp = @fopen($cache_path, 'wb')) + { log_message('error', "Unable to write ache file: ".$cache_path); - return; + return; } $expire = time() + ($this->cache_expiration * 60); - flock($fp, LOCK_EX); - fwrite($fp, $expire.'TS--->'.$output); - flock($fp, LOCK_UN); - fclose($fp); - @chmod($cache_path, 0777); + flock($fp, LOCK_EX); + fwrite($fp, $expire.'TS--->'.$output); + flock($fp, LOCK_UN); + fclose($fp); + @chmod($cache_path, 0777); log_message('debug', "Cache file written: ".$cache_path); } @@ -292,7 +292,7 @@ class CI_Output { // -------------------------------------------------------------------- /** - * Update/serve a cached file + * Update/serve a cached file * * @access public * @return void @@ -329,13 +329,13 @@ class CI_Output { flock($fp, LOCK_SH); $cache = ''; - if (filesize($filepath) > 0) + if (filesize($filepath) > 0) { - $cache = fread($fp, filesize($filepath)); + $cache = fread($fp, filesize($filepath)); } flock($fp, LOCK_UN); - fclose($fp); + fclose($fp); // Strip out the embedded timestamp if ( ! preg_match("/(\d+TS--->)/", $cache, $match)) diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php index 26fb93ee4..a004419d6 100644 --- a/system/libraries/Pagination.php +++ b/system/libraries/Pagination.php @@ -7,7 +7,7 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource @@ -28,13 +28,13 @@ class CI_Pagination { var $base_url = ''; // The page we are linking to var $total_rows = ''; // Total number of items (database results) - var $per_page = 10; // Max number of items you want shown per page - var $num_links = 2; // Number of "digit" links to show before/after the currently viewed page - var $cur_page = 0; // The current page being viewed + var $per_page = 10; // Max number of items you want shown per page + var $num_links = 2; // Number of "digit" links to show before/after the currently viewed page + var $cur_page = 0; // The current page being viewed var $first_link = '‹ First'; var $next_link = '>'; var $prev_link = '<'; - var $last_link = 'Last ›'; + var $last_link = 'Last ›'; var $uri_segment = 3; var $full_tag_open = ''; var $full_tag_close = ''; @@ -57,15 +57,15 @@ class CI_Pagination { * @access public * @param array initialization parameters */ - function CI_Pagination($params = array()) - { + function CI_Pagination($params = array()) + { if (count($params) > 0) { $this->initialize($params); } log_message('debug', "Pagination Class Initialized"); - } + } // -------------------------------------------------------------------- @@ -76,8 +76,8 @@ class CI_Pagination { * @param array initialization parameters * @return void */ - function initialize($params = array()) - { + function initialize($params = array()) + { if (count($params) > 0) { foreach ($params as $key => $val) @@ -88,7 +88,7 @@ class CI_Pagination { } } } - } + } // -------------------------------------------------------------------- @@ -98,34 +98,34 @@ class CI_Pagination { * @access public * @return string */ - function create_links() - { + function create_links() + { // If our item count or per-page total is zero there is no need to continue. - if ($this->total_rows == 0 OR $this->per_page == 0) - { - return ''; - } + if ($this->total_rows == 0 OR $this->per_page == 0) + { + return ''; + } // Calculate the total number of pages - $num_pages = ceil($this->total_rows / $this->per_page); + $num_pages = ceil($this->total_rows / $this->per_page); - /* + /* // Calculate the total number of pages $num_pages = intval($this->total_rows / $this->per_page); // Use modulus to see if our division has a remainder. If so, add one to our page number. - if ($this->total_rows % $this->per_page) + if ($this->total_rows % $this->per_page) { $num_pages++; } */ - - // Is there only one page? Hm... nothing more to do here then. - if ($num_pages == 1) - { - return ''; - } - + + // Is there only one page? Hm... nothing more to do here then. + if ($num_pages == 1) + { + return ''; + } + // Determine the current page number. $CI =& get_instance(); if ($CI->uri->segment($this->uri_segment) != 0) @@ -140,35 +140,35 @@ class CI_Pagination { $uri_page_number = $this->cur_page; $this->cur_page = floor(($this->cur_page/$this->per_page) + 1); - + // Calculate the start and end numbers. These determine // which number to start and end the digit links with - $start = (($this->cur_page - $this->num_links) > 0) ? $this->cur_page - ($this->num_links - 1) : 1; - $end = (($this->cur_page + $this->num_links) < $num_pages) ? $this->cur_page + $this->num_links : $num_pages; - + $start = (($this->cur_page - $this->num_links) > 0) ? $this->cur_page - ($this->num_links - 1) : 1; + $end = (($this->cur_page + $this->num_links) < $num_pages) ? $this->cur_page + $this->num_links : $num_pages; + // Add a trailing slash to the base URL if needed $this->base_url = preg_replace("/(.+?)\/*$/", "\\1/", $this->base_url); // And here we go... - $output = ''; - + $output = ''; + // Render the "First" link - if ($this->cur_page > $this->num_links) - { - $output .= $this->first_tag_open.'<a href="'.$this->base_url.'">'.$this->first_link.'</a>'.$this->first_tag_close; - } - + if ($this->cur_page > $this->num_links) + { + $output .= $this->first_tag_open.'<a href="'.$this->base_url.'">'.$this->first_link.'</a>'.$this->first_tag_close; + } + // Render the "previous" link - if (($this->cur_page - $this->num_links) >= 0) - { - $i = $uri_page_number - $this->per_page; - if ($i == 0) $i = ''; - $output .= $this->prev_tag_open.'<a href="'.$this->base_url.$i.'">'.$this->prev_link.'</a>'.$this->prev_tag_close; - } - + if (($this->cur_page - $this->num_links) >= 0) + { + $i = $uri_page_number - $this->per_page; + if ($i == 0) $i = ''; + $output .= $this->prev_tag_open.'<a href="'.$this->base_url.$i.'">'.$this->prev_link.'</a>'.$this->prev_tag_close; + } + // Write the digit links - for ($loop = $start -1; $loop <= $end; $loop++) - { + for ($loop = $start -1; $loop <= $end; $loop++) + { $i = ($loop * $this->per_page) - $this->per_page; if ($i >= 0) @@ -183,30 +183,30 @@ class CI_Pagination { $output .= $this->num_tag_open.'<a href="'.$this->base_url.$n.'">'.$loop.'</a>'.$this->num_tag_close; } } - } + } // Render the "next" link - if ($this->cur_page < $num_pages) - { - $output .= $this->next_tag_open.'<a href="'.$this->base_url.($this->cur_page * $this->per_page).'">'.$this->next_link.'</a>'.$this->next_tag_close; - } + if ($this->cur_page < $num_pages) + { + $output .= $this->next_tag_open.'<a href="'.$this->base_url.($this->cur_page * $this->per_page).'">'.$this->next_link.'</a>'.$this->next_tag_close; + } // Render the "Last" link - if (($this->cur_page + $this->num_links) < $num_pages) - { - $i = (($num_pages * $this->per_page) - $this->per_page); - $output .= $this->last_tag_open.'<a href="'.$this->base_url.$i.'">'.$this->last_link.'</a>'.$this->last_tag_close; - } - - // Kill double slashes. Note: Sometimes we can end up with a double slash + if (($this->cur_page + $this->num_links) < $num_pages) + { + $i = (($num_pages * $this->per_page) - $this->per_page); + $output .= $this->last_tag_open.'<a href="'.$this->base_url.$i.'">'.$this->last_link.'</a>'.$this->last_tag_close; + } + + // Kill double slashes. Note: Sometimes we can end up with a double slash // in the penultimate link so we'll kill all double slashes. - $output = preg_replace("#([^:])//+#", "\\1/", $output); + $output = preg_replace("#([^:])//+#", "\\1/", $output); // Add the wrapper HTML if exists $output = $this->full_tag_open.$output.$this->full_tag_close; return $output; - } + } } // END Pagination Class ?>
\ No newline at end of file diff --git a/system/libraries/Parser.php b/system/libraries/Parser.php index ebf7644ac..760d5d4d3 100644 --- a/system/libraries/Parser.php +++ b/system/libraries/Parser.php @@ -7,7 +7,7 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource @@ -17,7 +17,7 @@ /** * Parser Class - * + * * @package CodeIgniter * @subpackage Libraries * @category Parser @@ -33,7 +33,7 @@ class CI_Parser { /** * Parse a template * - * Parses pseudo-variables contained in the specified template, + * Parses pseudo-variables contained in the specified template, * replacing them with the data in the second param * * @access public diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php index 6e6fb675f..e03097ab6 100644 --- a/system/libraries/Profiler.php +++ b/system/libraries/Profiler.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** diff --git a/system/libraries/Router.php b/system/libraries/Router.php index 6002027d6..17a441c77 100644 --- a/system/libraries/Router.php +++ b/system/libraries/Router.php @@ -7,17 +7,17 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** * Router Class - * + * * Parses URIs and determines routing * * @package CodeIgniter @@ -44,7 +44,7 @@ class CI_Router { /** * Constructor * - * Runs the route mapping function. + * Runs the route mapping function. */ function CI_Router() { @@ -94,7 +94,7 @@ class CI_Router { // If the URI contains only a slash we'll kill it if ($this->uri_string == '/') - { + { $this->uri_string = ''; } @@ -243,7 +243,7 @@ class CI_Router { * Re-index Segments * * This function re-indexes the $this->segment array so that it - * starts at 1 rather then 0. Doing so makes it simpler to + * starts at 1 rather then 0. Doing so makes it simpler to * use functions like $this->uri->segment(n) since there is * a 1:1 relationship between the segment array and the actual segments. * @@ -320,9 +320,9 @@ class CI_Router { return $path; } - // OK, how about REQUEST_URI? + // OK, how about REQUEST_URI? // Note: REQUEST_URI is not supplied in a consistent manner with all platforms so it's - // a difficult variable to use. We'll try to parse it out correctly. Hopefully one + // a difficult variable to use. We'll try to parse it out correctly. Hopefully one // of the other variables above was available. $path = $this->_parse_request_uri(); if ($path != "") @@ -352,7 +352,7 @@ class CI_Router { * Parse the REQUEST_URI * * Due to the way REQUEST_URI works it usually contains path info - * that makes it unusable as URI data. We'll trim off the unnecessary + * that makes it unusable as URI data. We'll trim off the unnecessary * data, hopefully arriving at a valid URI that we can use. * * @access private @@ -413,7 +413,7 @@ class CI_Router { if ($this->config->item('permitted_uri_chars') != '') { if ( ! preg_match("|^[".preg_quote($this->config->item('permitted_uri_chars'))."]+$|i", $str)) - { + { exit('The URI you submitted has disallowed characters: '.$str); } } @@ -426,7 +426,7 @@ class CI_Router { * Parse Routes * * This function matches any routes that may exist in - * the config/routes.php file against the URI to + * the config/routes.php file against the URI to * determine if the class/method need to be remapped. * * @access private @@ -472,7 +472,7 @@ class CI_Router { } } - // If we got this far it means we didn't encounter a + // If we got this far it means we didn't encounter a // matching route so we'll set the site default route $this->_compile_segments($this->segments); } diff --git a/system/libraries/Session.php b/system/libraries/Session.php index a47599d12..96a0c43b2 100644 --- a/system/libraries/Session.php +++ b/system/libraries/Session.php @@ -7,7 +7,7 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource @@ -17,7 +17,7 @@ /** * Session Class - * + * * @package CodeIgniter * @subpackage Libraries * @category Sessions @@ -26,16 +26,16 @@ */ class CI_Session { - var $CI; + var $CI; var $now; var $encryption = TRUE; var $use_database = FALSE; var $session_table = FALSE; - var $sess_length = 7200; - var $sess_cookie = 'ci_session'; + var $sess_length = 7200; + var $sess_cookie = 'ci_session'; var $userdata = array(); - var $gc_probability = 5; - + var $gc_probability = 5; + /** * Session Constructor @@ -66,7 +66,7 @@ class CI_Session { * * It can either set to GMT or time(). The pref * is set in the config file. If the developer - * is doing any sort of time localization they + * is doing any sort of time localization they * might want to set the session time to GMT so * they can offset the "last_activity" and * "last_visit" times based on each user's locale. @@ -75,7 +75,7 @@ class CI_Session { if (strtolower($this->CI->config->item('time_reference')) == 'gmt') { $now = time(); - $this->now = mktime(gmdate("H", $now), gmdate("i", $now), gmdate("s", $now), gmdate("m", $now), gmdate("d", $now), gmdate("Y", $now)); + $this->now = mktime(gmdate("H", $now), gmdate("i", $now), gmdate("s", $now), gmdate("m", $now), gmdate("d", $now), gmdate("Y", $now)); if (strlen($this->now) < 10) { @@ -92,7 +92,7 @@ class CI_Session { * Set the session length * * If the session expiration is set to zero in - * the config file we'll set the expiration + * the config file we'll set the expiration * two years from now. * */ @@ -191,7 +191,7 @@ class CI_Session { } // Is the session current? - if (($session['last_activity'] + $this->sess_length) < $this->now) + if (($session['last_activity'] + $this->sess_length) < $this->now) { $this->sess_destroy(); return FALSE; @@ -236,7 +236,7 @@ class CI_Session { else { $row = $query->row(); - if (($row->last_activity + $this->sess_length) < $this->now) + if (($row->last_activity + $this->sess_length) < $this->now) { $this->CI->db->where('session_id', $session['session_id']); $this->CI->db->delete($this->session_table); @@ -271,11 +271,11 @@ class CI_Session { } setcookie( - $this->sess_cookie, - $cookie_data, - $this->sess_length + $this->now, - $this->CI->config->item('cookie_path'), - $this->CI->config->item('cookie_domain'), + $this->sess_cookie, + $cookie_data, + $this->sess_length + $this->now, + $this->CI->config->item('cookie_path'), + $this->CI->config->item('cookie_domain'), 0 ); } @@ -291,8 +291,8 @@ class CI_Session { function sess_create() { $sessid = ''; - while (strlen($sessid) < 32) - { + while (strlen($sessid) < 32) + { $sessid .= mt_rand(0, mt_getrandmax()); } @@ -325,10 +325,10 @@ class CI_Session { */ function sess_update() { - if (($this->userdata['last_activity'] + $this->sess_length) < $this->now) - { + if (($this->userdata['last_activity'] + $this->sess_length) < $this->now) + { $this->userdata['last_visit'] = $this->userdata['last_activity']; - } + } $this->userdata['last_activity'] = $this->now; @@ -353,11 +353,11 @@ class CI_Session { function sess_destroy() { setcookie( - $this->sess_cookie, - addslashes(serialize(array())), - ($this->now - 31500000), - $this->CI->config->item('cookie_path'), - $this->CI->config->item('cookie_domain'), + $this->sess_cookie, + addslashes(serialize(array())), + ($this->now - 31500000), + $this->CI->config->item('cookie_path'), + $this->CI->config->item('cookie_domain'), 0 ); } @@ -373,19 +373,19 @@ class CI_Session { * @access public * @return void */ - function sess_gc() - { + function sess_gc() + { srand(time()); - if ((rand() % 100) < $this->gc_probability) - { + if ((rand() % 100) < $this->gc_probability) + { $expire = $this->now - $this->sess_length; $this->CI->db->where("last_activity < {$expire}"); $this->CI->db->delete($this->session_table); log_message('debug', 'Session garbage collection performed.'); - } - } + } + } // -------------------------------------------------------------------- @@ -398,7 +398,7 @@ class CI_Session { */ function userdata($item) { - return ( ! isset($this->userdata[$item])) ? FALSE : $this->userdata[$item]; + return ( ! isset($this->userdata[$item])) ? FALSE : $this->userdata[$item]; } // -------------------------------------------------------------------- @@ -426,7 +426,7 @@ class CI_Session { } } - $this->sess_write(); + $this->sess_write(); } // -------------------------------------------------------------------- @@ -452,7 +452,7 @@ class CI_Session { } } - $this->sess_write(); + $this->sess_write(); } // -------------------------------------------------------------------- @@ -464,21 +464,21 @@ class CI_Session { * @param mixed * @return mixed */ - function strip_slashes($vals) - { - if (is_array($vals)) - { - foreach ($vals as $key=>$val) - { - $vals[$key] = $this->strip_slashes($val); - } - } - else - { - $vals = stripslashes($vals); - } - - return $vals; + function strip_slashes($vals) + { + if (is_array($vals)) + { + foreach ($vals as $key=>$val) + { + $vals[$key] = $this->strip_slashes($val); + } + } + else + { + $vals = stripslashes($vals); + } + + return $vals; } } diff --git a/system/libraries/Sha1.php b/system/libraries/Sha1.php index 971c091ad..4dde04038 100644 --- a/system/libraries/Sha1.php +++ b/system/libraries/Sha1.php @@ -7,35 +7,35 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** * SHA1 Encoding Class * - * Purpose: Provides 160 bit hashing using The Secure Hash Algorithm - * developed at the National Institute of Standards and Technology. The 40 + * Purpose: Provides 160 bit hashing using The Secure Hash Algorithm + * developed at the National Institute of Standards and Technology. The 40 * character SHA1 message hash is computationally infeasible to crack. - * - * This class is a fallback for servers that are not running PHP greater than + * + * This class is a fallback for servers that are not running PHP greater than * 4.3, or do not have the MHASH library. * * This class is based on two scripts: - * - * Marcus Campbell's PHP implementation (GNU license) + * + * Marcus Campbell's PHP implementation (GNU license) * http://www.tecknik.net/sha-1/ * - * ...which is based on Paul Johnston's JavaScript version + * ...which is based on Paul Johnston's JavaScript version * (BSD license). http://pajhome.org.uk/ - * + * * I encapsulated the functions and wrote one additional method to fix * a hex conversion bug. - Rick Ellis - * + * * @package CodeIgniter * @subpackage Libraries * @category Encryption @@ -56,67 +56,67 @@ class CI_SHA { * @param string * @return string */ - function generate($str) - { - $n = ((strlen($str) + 8) >> 6) + 1; - - for ($i = 0; $i < $n * 16; $i++) - { - $x[$i] = 0; - } - - for ($i = 0; $i < strlen($str); $i++) - { - $x[$i >> 2] |= ord(substr($str, $i, 1)) << (24 - ($i % 4) * 8); - } - - $x[$i >> 2] |= 0x80 << (24 - ($i % 4) * 8); - - $x[$n * 16 - 1] = strlen($str) * 8; - - $a = 1732584193; - $b = -271733879; - $c = -1732584194; - $d = 271733878; - $e = -1009589776; - - for ($i = 0; $i < sizeof($x); $i += 16) - { - $olda = $a; - $oldb = $b; - $oldc = $c; - $oldd = $d; - $olde = $e; - - for($j = 0; $j < 80; $j++) - { - if ($j < 16) - { - $w[$j] = $x[$i + $j]; - } - else - { - $w[$j] = $this->_rol($w[$j - 3] ^ $w[$j - 8] ^ $w[$j - 14] ^ $w[$j - 16], 1); - } - - $t = $this->_safe_add($this->_safe_add($this->_rol($a, 5), $this->_ft($j, $b, $c, $d)), $this->_safe_add($this->_safe_add($e, $w[$j]), $this->_kt($j))); - - $e = $d; - $d = $c; - $c = $this->_rol($b, 30); - $b = $a; - $a = $t; - } - - $a = $this->_safe_add($a, $olda); - $b = $this->_safe_add($b, $oldb); - $c = $this->_safe_add($c, $oldc); - $d = $this->_safe_add($d, $oldd); - $e = $this->_safe_add($e, $olde); - } - - return $this->_hex($a).$this->_hex($b).$this->_hex($c).$this->_hex($d).$this->_hex($e); - } + function generate($str) + { + $n = ((strlen($str) + 8) >> 6) + 1; + + for ($i = 0; $i < $n * 16; $i++) + { + $x[$i] = 0; + } + + for ($i = 0; $i < strlen($str); $i++) + { + $x[$i >> 2] |= ord(substr($str, $i, 1)) << (24 - ($i % 4) * 8); + } + + $x[$i >> 2] |= 0x80 << (24 - ($i % 4) * 8); + + $x[$n * 16 - 1] = strlen($str) * 8; + + $a = 1732584193; + $b = -271733879; + $c = -1732584194; + $d = 271733878; + $e = -1009589776; + + for ($i = 0; $i < sizeof($x); $i += 16) + { + $olda = $a; + $oldb = $b; + $oldc = $c; + $oldd = $d; + $olde = $e; + + for($j = 0; $j < 80; $j++) + { + if ($j < 16) + { + $w[$j] = $x[$i + $j]; + } + else + { + $w[$j] = $this->_rol($w[$j - 3] ^ $w[$j - 8] ^ $w[$j - 14] ^ $w[$j - 16], 1); + } + + $t = $this->_safe_add($this->_safe_add($this->_rol($a, 5), $this->_ft($j, $b, $c, $d)), $this->_safe_add($this->_safe_add($e, $w[$j]), $this->_kt($j))); + + $e = $d; + $d = $c; + $c = $this->_rol($b, 30); + $b = $a; + $a = $t; + } + + $a = $this->_safe_add($a, $olda); + $b = $this->_safe_add($b, $oldb); + $c = $this->_safe_add($c, $oldc); + $d = $this->_safe_add($d, $oldd); + $e = $this->_safe_add($e, $olde); + } + + return $this->_hex($a).$this->_hex($b).$this->_hex($c).$this->_hex($d).$this->_hex($e); + } // -------------------------------------------------------------------- @@ -127,17 +127,17 @@ class CI_SHA { * @param string * @return string */ - function _hex($str) - { - $str = dechex($str); - - if (strlen($str) == 7) - { - $str = '0'.$str; - } - - return $str; - } + function _hex($str) + { + $str = dechex($str); + + if (strlen($str) == 7) + { + $str = '0'.$str; + } + + return $str; + } // -------------------------------------------------------------------- @@ -147,18 +147,18 @@ class CI_SHA { * @access private * @return string */ - function _ft($t, $b, $c, $d) - { - if ($t < 20) - return ($b & $c) | ((~$b) & $d); - if ($t < 40) - return $b ^ $c ^ $d; - if ($t < 60) - return ($b & $c) | ($b & $d) | ($c & $d); - - return $b ^ $c ^ $d; - } - + function _ft($t, $b, $c, $d) + { + if ($t < 20) + return ($b & $c) | ((~$b) & $d); + if ($t < 40) + return $b ^ $c ^ $d; + if ($t < 60) + return ($b & $c) | ($b & $d) | ($c & $d); + + return $b ^ $c ^ $d; + } + // -------------------------------------------------------------------- /** @@ -167,25 +167,25 @@ class CI_SHA { * @access private * @return string */ - function _kt($t) - { - if ($t < 20) - { - return 1518500249; - } - else if ($t < 40) - { - return 1859775393; - } - else if ($t < 60) - { - return -1894007588; - } - else - { - return -899497514; - } - } + function _kt($t) + { + if ($t < 20) + { + return 1518500249; + } + else if ($t < 40) + { + return 1859775393; + } + else if ($t < 60) + { + return -1894007588; + } + else + { + return -899497514; + } + } // -------------------------------------------------------------------- @@ -195,13 +195,13 @@ class CI_SHA { * @access private * @return string */ - function _safe_add($x, $y) - { - $lsw = ($x & 0xFFFF) + ($y & 0xFFFF); - $msw = ($x >> 16) + ($y >> 16) + ($lsw >> 16); - - return ($msw << 16) | ($lsw & 0xFFFF); - } + function _safe_add($x, $y) + { + $lsw = ($x & 0xFFFF) + ($y & 0xFFFF); + $msw = ($x >> 16) + ($y >> 16) + ($lsw >> 16); + + return ($msw << 16) | ($lsw & 0xFFFF); + } // -------------------------------------------------------------------- @@ -211,11 +211,11 @@ class CI_SHA { * @access private * @return integer */ - function _rol($num, $cnt) - { - return ($num << $cnt) | $this->_zero_fill($num, 32 - $cnt); - } - + function _rol($num, $cnt) + { + return ($num << $cnt) | $this->_zero_fill($num, 32 - $cnt); + } + // -------------------------------------------------------------------- /** @@ -224,26 +224,26 @@ class CI_SHA { * @access private * @return string */ - function _zero_fill($a, $b) - { - $bin = decbin($a); - - if (strlen($bin) < $b) - { - $bin = 0; - } - else - { - $bin = substr($bin, 0, strlen($bin) - $b); - } - - for ($i=0; $i < $b; $i++) - { - $bin = "0".$bin; - } - - return bindec($bin); - } + function _zero_fill($a, $b) + { + $bin = decbin($a); + + if (strlen($bin) < $b) + { + $bin = 0; + } + else + { + $bin = substr($bin, 0, strlen($bin) - $b); + } + + for ($i=0; $i < $b; $i++) + { + $bin = "0".$bin; + } + + return bindec($bin); + } } // END CI_SHA ?>
\ No newline at end of file diff --git a/system/libraries/Table.php b/system/libraries/Table.php index c40c85e17..f3f9b32f6 100644 --- a/system/libraries/Table.php +++ b/system/libraries/Table.php @@ -7,17 +7,17 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.3.1 * @filesource */ - + // ------------------------------------------------------------------------ /** * HTML Table Generating Class - * + * * Lets you create tables manually or from database result objects, or arrays. * * @package CodeIgniter diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index 74649151d..6d5e206ff 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -7,7 +7,7 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource @@ -19,7 +19,7 @@ * Trackback Class * * Trackback Sending/Receiving Class - * + * * @package CodeIgniter * @subpackage Libraries * @category Trackbacks @@ -57,7 +57,7 @@ class CI_Trackback { function send($tb_data) { if ( ! is_array($tb_data)) - { + { $this->set_error('The send() method must be passed an array'); return FALSE; } @@ -66,7 +66,7 @@ class CI_Trackback { foreach (array('url', 'title', 'excerpt', 'blog_name', 'ping_url') as $item) { if ( ! isset($tb_data[$item])) - { + { $this->set_error('Required item missing: '.$item); return FALSE; } @@ -104,7 +104,7 @@ class CI_Trackback { // Build the Trackback data string $charset = ( ! isset($tb_data['charset'])) ? $this->charset : $tb_data['charset']; - $data = "url=".rawurlencode($url)."&title=".rawurlencode($title)."&blog_name=".rawurlencode($blog_name)."&excerpt=".rawurlencode($excerpt)."&charset=".rawurlencode($charset); + $data = "url=".rawurlencode($url)."&title=".rawurlencode($title)."&blog_name=".rawurlencode($blog_name)."&excerpt=".rawurlencode($excerpt)."&charset=".rawurlencode($charset); // Send Trackback(s) $return = TRUE; @@ -170,7 +170,7 @@ class CI_Trackback { /** * Send Trackback Error Message * - * Allows custom errors to be set. By default it + * Allows custom errors to be set. By default it * sends the "incomplete information" error, as that's * the most common one. * @@ -220,7 +220,7 @@ class CI_Trackback { /** * Process Trackback * - * Opens a socket connection and passes the data to + * Opens a socket connection and passes the data to * the server. Returns true on success, false on failure * * @access public @@ -249,22 +249,22 @@ class CI_Trackback { { $data = "tb_id=".$id."&".$data; } - + // Transfer the data - fputs ($fp, "POST " . $path . " HTTP/1.0\r\n" ); - fputs ($fp, "Host: " . $target['host'] . "\r\n" ); - fputs ($fp, "Content-type: application/x-www-form-urlencoded\r\n" ); - fputs ($fp, "Content-length: " . strlen($data) . "\r\n" ); - fputs ($fp, "Connection: close\r\n\r\n" ); + fputs ($fp, "POST " . $path . " HTTP/1.0\r\n" ); + fputs ($fp, "Host: " . $target['host'] . "\r\n" ); + fputs ($fp, "Content-type: application/x-www-form-urlencoded\r\n" ); + fputs ($fp, "Content-length: " . strlen($data) . "\r\n" ); + fputs ($fp, "Connection: close\r\n\r\n" ); fputs ($fp, $data); - + // Was it successful? $this->response = ""; while(!feof($fp)) { $this->response .= fgets($fp, 128); - } + } @fclose($fp); if ( ! eregi("<error>0</error>", $this->response)) @@ -297,7 +297,7 @@ class CI_Trackback { * @return string */ function extract_urls($urls) - { + { // Remove the pesky white space and replace with a comma. $urls = preg_replace("/\s*(\S+)\s*/", "\\1,", $urls); @@ -316,7 +316,7 @@ class CI_Trackback { // Removes duplicates $urls = array_unique($urls); - array_walk($urls, array($this, 'validate_url')); + array_walk($urls, array($this, 'validate_url')); return $urls; } @@ -384,7 +384,7 @@ class CI_Trackback { } } - if ( ! preg_match ("/^([0-9]+)$/", $tb_id)) + if ( ! preg_match ("/^([0-9]+)$/", $tb_id)) { return false; } @@ -435,7 +435,7 @@ class CI_Trackback { */ function limit_characters($str, $n = 500, $end_char = '…') { - if (strlen($str) < $n) + if (strlen($str) < $n) { return $str; } @@ -453,7 +453,7 @@ class CI_Trackback { $out .= $val.' '; if (strlen($out) >= $n) { - return trim($out).$end_char; + return trim($out).$end_char; } } } @@ -475,11 +475,11 @@ class CI_Trackback { $count = 1; $out = ''; $temp = array(); - + for ($i = 0, $s = strlen($str); $i < $s; $i++) { $ordinal = ord($str[$i]); - + if ($ordinal < 128) { $out .= $str[$i]; @@ -490,9 +490,9 @@ class CI_Trackback { { $count = ($ordinal < 224) ? 2 : 3; } - + $temp[] = $ordinal; - + if (count($temp) == $count) { $number = ($count == 3) ? (($temp['0'] % 16) * 4096) + (($temp['1'] % 64) * 64) + ($temp['2'] % 64) : (($temp['0'] % 32) * 64) + ($temp['1'] % 64); @@ -500,10 +500,10 @@ class CI_Trackback { $out .= '&#'.$number.';'; $count = 1; $temp = array(); - } - } + } + } } - + return $out; } diff --git a/system/libraries/URI.php b/system/libraries/URI.php index fcf6afe4b..10654a69c 100644 --- a/system/libraries/URI.php +++ b/system/libraries/URI.php @@ -7,17 +7,17 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** * URI Class - * + * * Parses URIs and determines routing * * @package CodeIgniter @@ -36,7 +36,7 @@ class CI_URI { * * Simply globalizes the $RTR object. The front * loads the Router class early on so it's not available - * normally as other classes are. + * normally as other classes are. * * @access public */ @@ -51,7 +51,7 @@ class CI_URI { /** * Fetch a URI Segment * - * This function returns the URI segment based on the number provided. + * This function returns the URI segment based on the number provided. * * @access public * @param integer @@ -87,7 +87,7 @@ class CI_URI { /** * Generate a key value pair from the URI string * - * This function generates and associative array of URI data starting + * This function generates and associative array of URI data starting * at the supplied segment. For example, if this is your URI: * * www.your-site.com/user/search/name/joe/location/UK/gender/male @@ -99,7 +99,7 @@ class CI_URI { * location => UK * gender => male * ) - * + * * @access public * @param integer the starting segment number * @param array an array of default values @@ -122,7 +122,7 @@ class CI_URI { /** * Generate a key value pair from the URI string or Re-routed URI string - * + * * @access private * @param integer the starting segment number * @param array an array of default values @@ -206,7 +206,7 @@ class CI_URI { /** * Generate a URI string from an associative array * - * + * * @access public * @param array an associative array of key/values * @return array diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index 6bfc59dc3..f68f69e71 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -7,17 +7,17 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.3.1 * @filesource */ - + // ------------------------------------------------------------------------ /** * Unit Testing Class - * + * * Simple testing class * * @package CodeIgniter @@ -148,7 +148,7 @@ class CI_Unit_test { /** * Make Unit testing active * - * Enables/disables unit testing + * Enables/disables unit testing * * @access public * @param bool @@ -233,14 +233,14 @@ class CI_Unit_test { /** * Generate a backtrace * - * This lets us show file names and line numbers + * This lets us show file names and line numbers * * @access private * @return array */ - function _backtrace() + function _backtrace() { - if (function_exists('debug_backtrace')) + if (function_exists('debug_backtrace')) { $back = debug_backtrace(); @@ -314,7 +314,7 @@ class CI_Unit_test { /** * Helper functions to test boolean true/false - * + * * * @access private * @return bool diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index 09a479431..1a0b0fc8f 100644 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -7,7 +7,7 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource @@ -17,7 +17,7 @@ /** * File Uploading Class - * + * * @package CodeIgniter * @subpackage Libraries * @category Uploads @@ -43,7 +43,7 @@ class CI_Upload { var $image_width = ''; var $image_height = ''; var $image_type = ''; - var $image_size_str = ''; + var $image_size_str = ''; var $error_msg = array(); var $mimes = array(); var $remove_spaces = TRUE; @@ -75,7 +75,7 @@ class CI_Upload { * @return void */ function initialize($config = array()) - { + { foreach ($config as $key => $val) { $method = 'set_'.$key; @@ -98,41 +98,41 @@ class CI_Upload { * @access public * @return bool */ - function do_upload($field = 'userfile') - { + function do_upload($field = 'userfile') + { // Is $_FILES[$field] set? If not, no reason to continue. - if ( ! isset($_FILES[$field])) - { + if ( ! isset($_FILES[$field])) + { $this->set_error('upload_userfile_not_set'); return FALSE; - } - + } + // Is the upload path valid? if ( ! $this->validate_upload_path()) { return FALSE; } - + // Was the file able to be uploaded? If not, determine the reason why. - if ( ! is_uploaded_file($_FILES[$field]['tmp_name'])) - { - $error = ( ! isset($_FILES[$field]['error'])) ? 4 : $_FILES[$field]['error']; - - switch($error) - { - case 1 : $this->set_error('upload_file_exceeds_limit'); - break; - case 3 : $this->set_error('upload_file_partial'); - break; - case 4 : $this->set_error('upload_no_file_selected'); - break; - default : $this->set_error('upload_no_file_selected'); - break; - } - - return FALSE; - } - + if ( ! is_uploaded_file($_FILES[$field]['tmp_name'])) + { + $error = ( ! isset($_FILES[$field]['error'])) ? 4 : $_FILES[$field]['error']; + + switch($error) + { + case 1 : $this->set_error('upload_file_exceeds_limit'); + break; + case 3 : $this->set_error('upload_file_partial'); + break; + case 4 : $this->set_error('upload_no_file_selected'); + break; + default : $this->set_error('upload_no_file_selected'); + break; + } + + return FALSE; + } + // Set the uploaded data as class variables $this->file_temp = $_FILES[$field]['tmp_name']; $this->file_name = $_FILES[$field]['name']; @@ -148,36 +148,36 @@ class CI_Upload { } // Is the file type allowed to be uploaded? - if ( ! $this->is_allowed_filetype()) - { + if ( ! $this->is_allowed_filetype()) + { $this->set_error('upload_invalid_filetype'); return FALSE; - } + } // Is the file size within the allowed maximum? - if ( ! $this->is_allowed_filesize()) - { + if ( ! $this->is_allowed_filesize()) + { $this->set_error('upload_invalid_filesize'); - return FALSE; - } - + return FALSE; + } + // Are the image dimensions within the allowed size? // Note: This can fail if the server has an open_basdir restriction. - if ( ! $this->is_allowed_dimensions()) - { + if ( ! $this->is_allowed_dimensions()) + { $this->set_error('upload_invalid_dimensions'); - return FALSE; - } - + return FALSE; + } + // Sanitize the file name for security - $this->file_name = $this->clean_file_name($this->file_name); - + $this->file_name = $this->clean_file_name($this->file_name); + // Remove white spaces in the name - if ($this->remove_spaces == TRUE) - { - $this->file_name = preg_replace("/\s+/", "_", $this->file_name); - } - + if ($this->remove_spaces == TRUE) + { + $this->file_name = preg_replace("/\s+/", "_", $this->file_name); + } + /* * Validate the file name * This function appends an number onto the end of @@ -195,7 +195,7 @@ class CI_Upload { return FALSE; } } - + /* * Move the file to the final destination * To deal with different server configurations @@ -204,42 +204,42 @@ class CI_Upload { * reliably work in most environments */ if ( ! @copy($this->file_temp, $this->file_path.$this->file_name)) - { + { if ( ! @move_uploaded_file($this->file_temp, $this->file_path.$this->file_name)) { $this->set_error('upload_destination_error'); return FALSE; } - } + } /* * Run the file through the XSS hacking filter * This helps prevent malicious code from being - * embedded within a file. Scripts can easily + * embedded within a file. Scripts can easily * be disguised as images or other file types. */ if ($this->xss_clean == TRUE) { $this->do_xss_clean(); } - + /* * Set the finalized image dimensions * This sets the image width/height (assuming the * file was an image). We use this information * in the "data" function. */ - $this->set_image_properties($this->file_path.$this->file_name); - + $this->set_image_properties($this->file_path.$this->file_name); + return TRUE; - } + } // -------------------------------------------------------------------- /** - * Finalized Data Array + * Finalized Data Array * - * Returns an associative array containing all of the information + * Returns an associative array containing all of the information * related to the upload, allowing the developer easy access in one array. * * @access public @@ -267,24 +267,24 @@ class CI_Upload { // -------------------------------------------------------------------- /** - * Set Upload Path + * Set Upload Path * * @access public * @param string * @return void */ - function set_upload_path($path) - { + function set_upload_path($path) + { $this->file_path = $path; } // -------------------------------------------------------------------- /** - * Set the file name + * Set the file name * - * This function takes a filename/path as input and looks for the - * existence of a file with the same name. If found, it will append a + * This function takes a filename/path as input and looks for the + * existence of a file with the same name. If found, it will append a * number to the end of the filename to avoid overwriting a pre-existing file. * * @access public @@ -331,58 +331,58 @@ class CI_Upload { // -------------------------------------------------------------------- /** - * Set Maximum File Size + * Set Maximum File Size * * @access public * @param integer * @return void */ - function set_max_filesize($n) - { - $this->max_size = ( ! eregi("^[[:digit:]]+$", $n)) ? 0 : $n; - } + function set_max_filesize($n) + { + $this->max_size = ( ! eregi("^[[:digit:]]+$", $n)) ? 0 : $n; + } // -------------------------------------------------------------------- /** - * Set Maximum Image Width + * Set Maximum Image Width * * @access public * @param integer * @return void */ - function set_max_width($n) - { - $this->max_width = ( ! eregi("^[[:digit:]]+$", $n)) ? 0 : $n; - } + function set_max_width($n) + { + $this->max_width = ( ! eregi("^[[:digit:]]+$", $n)) ? 0 : $n; + } // -------------------------------------------------------------------- /** - * Set Maximum Image Height + * Set Maximum Image Height * * @access public * @param integer * @return void */ - function set_max_height($n) - { - $this->max_height = ( ! eregi("^[[:digit:]]+$", $n)) ? 0 : $n; - } + function set_max_height($n) + { + $this->max_height = ( ! eregi("^[[:digit:]]+$", $n)) ? 0 : $n; + } // -------------------------------------------------------------------- /** - * Set Allowed File Types + * Set Allowed File Types * * @access public * @param string * @return void */ - function set_allowed_types($types) - { - $this->allowed_types = explode('|', $types); - } + function set_allowed_types($types) + { + $this->allowed_types = explode('|', $types); + } // -------------------------------------------------------------------- @@ -395,26 +395,26 @@ class CI_Upload { * @param string * @return void */ - function set_image_properties($path = '') - { - if ( ! $this->is_image()) - { - return; - } - - if (function_exists('getimagesize')) - { - if (FALSE !== ($D = @getimagesize($path))) - { + function set_image_properties($path = '') + { + if ( ! $this->is_image()) + { + return; + } + + if (function_exists('getimagesize')) + { + if (FALSE !== ($D = @getimagesize($path))) + { $types = array(1 => 'gif', 2 => 'jpeg', 3 => 'png'); - + $this->image_width = $D['0']; $this->image_height = $D['1']; $this->image_type = ( ! isset($types[$D['2']])) ? 'unknown' : $types[$D['2']]; $this->image_size_str = $D['3']; // string containing height and width } - } - } + } + } // -------------------------------------------------------------------- @@ -441,21 +441,21 @@ class CI_Upload { * @access public * @return bool */ - function is_image() - { - $img_mimes = array( - 'image/gif', - 'image/jpg', - 'image/jpe', - 'image/jpeg', - 'image/pjpeg', - 'image/png', - 'image/x-png' - ); - + function is_image() + { + $img_mimes = array( + 'image/gif', + 'image/jpg', + 'image/jpe', + 'image/jpeg', + 'image/pjpeg', + 'image/png', + 'image/x-png' + ); + return (in_array($this->file_type, $img_mimes, TRUE)) ? TRUE : FALSE; - } + } // -------------------------------------------------------------------- @@ -465,36 +465,36 @@ class CI_Upload { * @access public * @return bool */ - function is_allowed_filetype() - { - if (count($this->allowed_types) == 0) - { + function is_allowed_filetype() + { + if (count($this->allowed_types) == 0) + { $this->set_error('upload_no_file_types'); return FALSE; - } - - foreach ($this->allowed_types as $val) - { - $mime = $this->mimes_types(strtolower($val)); - - if (is_array($mime)) - { - if (in_array($this->file_type, $mime, TRUE)) - { - return TRUE; - } - } - else - { + } + + foreach ($this->allowed_types as $val) + { + $mime = $this->mimes_types(strtolower($val)); + + if (is_array($mime)) + { + if (in_array($this->file_type, $mime, TRUE)) + { + return TRUE; + } + } + else + { if ($mime == $this->file_type) { return TRUE; } - } - } - - return FALSE; - } + } + } + + return FALSE; + } // -------------------------------------------------------------------- @@ -504,17 +504,17 @@ class CI_Upload { * @access public * @return bool */ - function is_allowed_filesize() - { - if ($this->max_size != 0 AND $this->file_size > $this->max_size) - { - return FALSE; - } - else - { - return TRUE; - } - } + function is_allowed_filesize() + { + if ($this->max_size != 0 AND $this->file_size > $this->max_size) + { + return FALSE; + } + else + { + return TRUE; + } + } // -------------------------------------------------------------------- @@ -524,37 +524,37 @@ class CI_Upload { * @access public * @return bool */ - function is_allowed_dimensions() - { - if ( ! $this->is_image()) - { - return TRUE; - } - - if (function_exists('getimagesize')) - { - $D = @getimagesize($this->file_temp); - - if ($this->max_width > 0 AND $D['0'] > $this->max_width) - { - return FALSE; - } - - if ($this->max_height > 0 AND $D['1'] > $this->max_height) - { - return FALSE; - } - - return TRUE; - } - - return TRUE; - } + function is_allowed_dimensions() + { + if ( ! $this->is_image()) + { + return TRUE; + } + + if (function_exists('getimagesize')) + { + $D = @getimagesize($this->file_temp); + + if ($this->max_width > 0 AND $D['0'] > $this->max_width) + { + return FALSE; + } + + if ($this->max_height > 0 AND $D['1'] > $this->max_height) + { + return FALSE; + } + + return TRUE; + } + + return TRUE; + } // -------------------------------------------------------------------- /** - * Validate Upload Path + * Validate Upload Path * * Verifies that it is a valid upload path with proper permissions. * @@ -562,34 +562,34 @@ class CI_Upload { * @access public * @return bool */ - function validate_upload_path() - { - if ($this->file_path == '') - { + function validate_upload_path() + { + if ($this->file_path == '') + { $this->set_error('upload_no_filepath'); return FALSE; - } - + } + if (function_exists('realpath') AND @realpath($this->file_path) !== FALSE) { - $this->file_path = str_replace("\\", "/", realpath($this->file_path)); + $this->file_path = str_replace("\\", "/", realpath($this->file_path)); } - - if ( ! @is_dir($this->file_path)) - { + + if ( ! @is_dir($this->file_path)) + { $this->set_error('upload_no_filepath'); return FALSE; - } - - if ( ! is_writable($this->file_path)) - { + } + + if ( ! is_writable($this->file_path)) + { $this->set_error('upload_not_writable'); return FALSE; - } - + } + $this->file_path = preg_replace("/(.+?)\/*$/", "\\1/", $this->file_path); return TRUE; - } + } // -------------------------------------------------------------------- @@ -617,7 +617,7 @@ class CI_Upload { */ function clean_file_name($filename) { - $bad = array( + $bad = array( "<!--", "-->", "'", @@ -636,21 +636,21 @@ class CI_Upload { "%253c", // < "%3e", // > "%0e", // > - "%28", // ( - "%29", // ) + "%28", // ( + "%29", // ) "%2528", // ( "%26", // & "%24", // $ "%3f", // ? "%3b", // ; "%3d" // = - ); - - foreach ($bad as $val) - { - $filename = str_replace($val, '', $filename); - } - + ); + + foreach ($bad as $val) + { + $filename = str_replace($val, '', $filename); + } + return $filename; } @@ -659,7 +659,7 @@ class CI_Upload { /** * Runs the file through the XSS clean function * - * This prevents people from embedding malicious code in their files. + * This prevents people from embedding malicious code in their files. * I'm not sure that it won't negatively affect certain files in unexpected ways, * but so far I haven't found that it causes trouble. * @@ -670,7 +670,7 @@ class CI_Upload { { $file = $this->file_path.$this->file_name; - if (filesize($file) == 0) + if (filesize($file) == 0) { return FALSE; } @@ -680,16 +680,16 @@ class CI_Upload { return FALSE; } - flock($fp, LOCK_EX); + flock($fp, LOCK_EX); - $data = fread($fp, filesize($file)); + $data = fread($fp, filesize($file)); $CI =& get_instance(); $data = $CI->input->xss_clean($data); - fwrite($fp, $data); - flock($fp, LOCK_UN); - fclose($fp); + fwrite($fp, $data); + flock($fp, LOCK_UN); + fclose($fp); } // -------------------------------------------------------------------- diff --git a/system/libraries/User_agent.php b/system/libraries/User_agent.php index 11c2baa68..b217367fe 100644 --- a/system/libraries/User_agent.php +++ b/system/libraries/User_agent.php @@ -7,17 +7,17 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** * User Agent Class - * + * * Identifies the platform, browser, robot, or mobile devise of the browsing agent * * @package CodeIgniter @@ -155,9 +155,9 @@ class CI_User_agent { { if (is_array($this->platforms) AND count($this->platforms) > 0) { - foreach ($this->platforms as $key => $val) + foreach ($this->platforms as $key => $val) { - if (preg_match("|".preg_quote($key)."|i", $this->agent)) + if (preg_match("|".preg_quote($key)."|i", $this->agent)) { $this->platform = $val; return TRUE; @@ -179,9 +179,9 @@ class CI_User_agent { { if (is_array($this->browsers) AND count($this->browsers) > 0) { - foreach ($this->browsers as $key => $val) + foreach ($this->browsers as $key => $val) { - if (preg_match("|".preg_quote($key).".*?([0-9\.]+)|i", $this->agent, $match)) + if (preg_match("|".preg_quote($key).".*?([0-9\.]+)|i", $this->agent, $match)) { $this->is_browser = TRUE; $this->version = $match[1]; @@ -205,9 +205,9 @@ class CI_User_agent { { if (is_array($this->robots) AND count($this->robots) > 0) { - foreach ($this->robots as $key => $val) + foreach ($this->robots as $key => $val) { - if (preg_match("|".preg_quote($key)."|i", $this->agent)) + if (preg_match("|".preg_quote($key)."|i", $this->agent)) { $this->is_robot = TRUE; $this->robot = $val; @@ -230,7 +230,7 @@ class CI_User_agent { { if (is_array($this->mobiles) AND count($this->mobiles) > 0) { - foreach ($this->mobiles as $key => $val) + foreach ($this->mobiles as $key => $val) { if (FALSE !== (strpos(strtolower($this->agent), $key))) { diff --git a/system/libraries/Validation.php b/system/libraries/Validation.php index 07ca35a33..ec7e412c6 100644 --- a/system/libraries/Validation.php +++ b/system/libraries/Validation.php @@ -7,7 +7,7 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource @@ -17,7 +17,7 @@ /** * Validation Class - * + * * @package CodeIgniter * @subpackage Libraries * @category Validation @@ -40,7 +40,7 @@ class CI_Validation { /** - * Constructor + * Constructor * */ function CI_Validation() @@ -102,7 +102,7 @@ class CI_Validation { /** * Set Rules * - * This function takes an array of field names and validation + * This function takes an array of field names and validation * rules as input ad simply stores is for use later. * * @access public @@ -131,7 +131,7 @@ class CI_Validation { /** * Set Error Message * - * Lets users set their own error messages on the fly. Note: The key + * Lets users set their own error messages on the fly. Note: The key * name has to match the function name that it corresponds to. * * @access public @@ -216,7 +216,7 @@ class CI_Validation { { if (in_array('isset', $ex, TRUE) OR in_array('required', $ex)) { - if ( ! isset($this->_error_messages['isset'])) + if ( ! isset($this->_error_messages['isset'])) { if (FALSE === ($line = $this->CI->lang->line('isset'))) { @@ -308,7 +308,7 @@ class CI_Validation { // Did the rule test negatively? If so, grab the error. if ($result === FALSE) { - if ( ! isset($this->_error_messages[$rule])) + if ( ! isset($this->_error_messages[$rule])) { if (FALSE === ($line = $this->CI->lang->line($rule))) { @@ -352,7 +352,7 @@ class CI_Validation { } $this->set_fields(); - + // Did we end up with any errors? if ($total_errors == 0) { @@ -653,15 +653,15 @@ class CI_Validation { * @param string * @return string */ - function prep_for_form($str = '') - { - if ($this->_safe_form_data == FALSE OR $str == '') - { - return $str; - } - + function prep_for_form($str = '') + { + if ($this->_safe_form_data == FALSE OR $str == '') + { + return $str; + } + return str_replace(array("'", '"', '<', '>'), array("'", """, '<', '>'), stripslashes($str)); - } + } // -------------------------------------------------------------------- @@ -672,8 +672,8 @@ class CI_Validation { * @param string * @return string */ - function prep_url($str = '') - { + function prep_url($str = '') + { if ($str == 'http://' OR $str == '') { $_POST[$this->_current_field] = ''; @@ -686,7 +686,7 @@ class CI_Validation { } $_POST[$this->_current_field] = $str; - } + } // -------------------------------------------------------------------- @@ -697,10 +697,10 @@ class CI_Validation { * @param string * @return string */ - function strip_image_tags($str) - { - $_POST[$this->_current_field] = $this->input->strip_image_tags($str); - } + function strip_image_tags($str) + { + $_POST[$this->_current_field] = $this->input->strip_image_tags($str); + } // -------------------------------------------------------------------- @@ -725,9 +725,9 @@ class CI_Validation { * @param string * @return string */ - function encode_php_tags($str) - { - $_POST[$this->_current_field] = str_replace(array('<?php', '<?PHP', '<?', '?>'), array('<?php', '<?PHP', '<?', '?>'), $str); + function encode_php_tags($str) + { + $_POST[$this->_current_field] = str_replace(array('<?php', '<?PHP', '<?', '?>'), array('<?php', '<?PHP', '<?', '?>'), $str); } } diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php index 0a3dedae1..2d9a4c11b 100644 --- a/system/libraries/Xmlrpc.php +++ b/system/libraries/Xmlrpc.php @@ -7,15 +7,15 @@ * @package CodeIgniter * @author Rick Ellis, Paul Burdick * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + if ( ! function_exists('xml_parser_create')) { - show_error('Your PHP installation does not support XML'); + show_error('Your PHP installation does not support XML'); } @@ -23,7 +23,7 @@ if ( ! function_exists('xml_parser_create')) /** * XML-RPC request handler class - * + * * @package CodeIgniter * @subpackage Libraries * @category XML-RPC @@ -33,7 +33,7 @@ if ( ! function_exists('xml_parser_create')) class CI_Xmlrpc { var $debug = FALSE; // Debugging on or off - var $xmlrpcI4 = 'i4'; + var $xmlrpcI4 = 'i4'; var $xmlrpcInt = 'int'; var $xmlrpcBoolean = 'boolean'; var $xmlrpcDouble = 'double'; @@ -65,10 +65,10 @@ class CI_Xmlrpc { //------------------------------------- - // VALUES THAT MULTIPLE CLASSES NEED - //------------------------------------- + // VALUES THAT MULTIPLE CLASSES NEED + //------------------------------------- - function CI_Xmlrpc ($config = array()) + function CI_Xmlrpc ($config = array()) { $this->xmlrpcName = $this->xmlrpcName; @@ -76,14 +76,14 @@ class CI_Xmlrpc { // Types for info sent back and forth $this->xmlrpcTypes = array( - $this->xmlrpcI4 => '1', - $this->xmlrpcInt => '1', + $this->xmlrpcI4 => '1', + $this->xmlrpcInt => '1', $this->xmlrpcBoolean => '1', $this->xmlrpcString => '1', $this->xmlrpcDouble => '1', $this->xmlrpcDateTime => '1', $this->xmlrpcBase64 => '1', - $this->xmlrpcArray => '2', + $this->xmlrpcArray => '2', $this->xmlrpcStruct => '3' ); @@ -129,10 +129,10 @@ class CI_Xmlrpc { //------------------------------------- - // Initialize Prefs - //------------------------------------- + // Initialize Prefs + //------------------------------------- - function initialize($config = array()) + function initialize($config = array()) { if (sizeof($config) > 0) { @@ -148,10 +148,10 @@ class CI_Xmlrpc { // END //------------------------------------- - // Take URL and parse it - //------------------------------------- + // Take URL and parse it + //------------------------------------- - function server($url, $port=80) + function server($url, $port=80) { if (substr($url, 0, 4) != "http") { @@ -173,9 +173,9 @@ class CI_Xmlrpc { //------------------------------------- // Set Timeout - //------------------------------------- + //------------------------------------- - function timeout($seconds=5) + function timeout($seconds=5) { if ( ! is_null($this->client) && is_int($seconds)) { @@ -186,9 +186,9 @@ class CI_Xmlrpc { //------------------------------------- // Set Methods - //------------------------------------- + //------------------------------------- - function method($function) + function method($function) { $this->method = $function; } @@ -196,9 +196,9 @@ class CI_Xmlrpc { //------------------------------------- // Take Array of Data and Create Objects - //------------------------------------- + //------------------------------------- - function request($incoming) + function request($incoming) { if ( ! is_array($incoming)) { @@ -215,7 +215,7 @@ class CI_Xmlrpc { //------------------------------------- // Set Debug - //------------------------------------- + //------------------------------------- function set_debug($flag = TRUE) { @@ -224,7 +224,7 @@ class CI_Xmlrpc { //------------------------------------- // Values Parsing - //------------------------------------- + //------------------------------------- function values_parsing($value, $return = FALSE) { @@ -260,9 +260,9 @@ class CI_Xmlrpc { //------------------------------------- // Sends XML-RPC Request - //------------------------------------- + //------------------------------------- - function send_request() + function send_request() { $this->message = new XML_RPC_Message($this->method,$this->data); $this->message->debug = $this->debug; @@ -286,9 +286,9 @@ class CI_Xmlrpc { //------------------------------------- // Returns Error - //------------------------------------- + //------------------------------------- - function display_error() + function display_error() { return $this->error; } @@ -296,9 +296,9 @@ class CI_Xmlrpc { //------------------------------------- // Returns Remote Server Response - //------------------------------------- + //------------------------------------- - function display_response() + function display_response() { return $this->response; } @@ -306,7 +306,7 @@ class CI_Xmlrpc { //------------------------------------- // Sends an Error Message for Server Request - //------------------------------------- + //------------------------------------- function send_error_message($number, $message) { @@ -317,7 +317,7 @@ class CI_Xmlrpc { //------------------------------------- // Send Response for Server Request - //------------------------------------- + //------------------------------------- function send_response($response) { @@ -336,7 +336,7 @@ class CI_Xmlrpc { /** * XML-RPC Client class - * + * * @category XML-RPC * @author Paul Burdick * @link http://www.codeigniter.com/user_guide/libraries/xmlrpc.html @@ -355,8 +355,8 @@ class XML_RPC_Client extends CI_Xmlrpc { parent::CI_Xmlrpc(); - $this->port = $port; - $this->server = $server; + $this->port = $port; + $this->server = $server; $this->path = $path; } @@ -414,7 +414,7 @@ class XML_RPC_Client extends CI_Xmlrpc /** * XML-RPC Response class - * + * * @category XML-RPC * @author Paul Burdick * @link http://www.codeigniter.com/user_guide/libraries/xmlrpc.html @@ -432,7 +432,7 @@ class XML_RPC_Response { // error $this->errno = $code; - $this->errstr = htmlentities($fstr); + $this->errstr = htmlentities($fstr); } else if (!is_object($val)) { @@ -484,7 +484,7 @@ class XML_RPC_Response else { $result .= "<params>\n<param>\n" . - $this->val->serialize_class() . + $this->val->serialize_class() . "</param>\n</params>"; } $result .= "\n</methodResponse>"; @@ -532,7 +532,7 @@ class XML_RPC_Response //------------------------------------- // XML-RPC Object to PHP Types - //------------------------------------- + //------------------------------------- function xmlrpc_decoder($xmlrpc_val) { @@ -554,7 +554,7 @@ class XML_RPC_Response { $arr[] = $this->xmlrpc_decoder($xmlrpc_val->me['array'][$i]); } - return $arr; + return $arr; } elseif($kind == 'struct') { @@ -572,7 +572,7 @@ class XML_RPC_Response //------------------------------------- // ISO-8601 time to server or UTC time - //------------------------------------- + //------------------------------------- function iso8601_decode($time, $utc=0) { @@ -584,7 +584,7 @@ class XML_RPC_Response $t = gmmktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]); else $t = mktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]); - } + } return $t; } @@ -594,7 +594,7 @@ class XML_RPC_Response /** * XML-RPC Message class - * + * * @category XML-RPC * @author Paul Burdick * @link http://www.codeigniter.com/user_guide/libraries/xmlrpc.html @@ -623,7 +623,7 @@ class XML_RPC_Message extends CI_Xmlrpc //------------------------------------- // Create Payload to Send - //------------------------------------- + //------------------------------------- function createPayload() { @@ -643,7 +643,7 @@ class XML_RPC_Message extends CI_Xmlrpc //------------------------------------- // Parse External XML-RPC Server's Response - //------------------------------------- + //------------------------------------- function parseResponse($fp) { @@ -667,7 +667,7 @@ class XML_RPC_Message extends CI_Xmlrpc //------------------------------------- // Check for data - //------------------------------------- + //------------------------------------- if($data == "") { @@ -679,7 +679,7 @@ class XML_RPC_Message extends CI_Xmlrpc //------------------------------------- // Check for HTTP 200 Response - //------------------------------------- + //------------------------------------- if(ereg("^HTTP",$data) && !ereg("^HTTP/[0-9\.]+ 200 ", $data)) { @@ -690,7 +690,7 @@ class XML_RPC_Message extends CI_Xmlrpc //------------------------------------- // Create and Set Up XML Parser - //------------------------------------- + //------------------------------------- $parser = xml_parser_create($this->xmlrpc_defencoding); @@ -711,7 +711,7 @@ class XML_RPC_Message extends CI_Xmlrpc //------------------------------------- // GET HEADERS - //------------------------------------- + //------------------------------------- $lines = explode("\r\n", $data); while (($line = array_shift($lines))) @@ -790,7 +790,7 @@ class XML_RPC_Message extends CI_Xmlrpc //------------------------------------- // SEND RESPONSE - //------------------------------------- + //------------------------------------- $v = $this->xh[$parser]['value']; @@ -825,7 +825,7 @@ class XML_RPC_Message extends CI_Xmlrpc // ac - used to accumulate values // isf - used to indicate a fault // lv - used to indicate "looking for a value": implements - // the logic to allow values with no types to be strings + // the logic to allow values with no types to be strings // params - used to store parameters in method calls // method - used to store method name // stack - array with parent tree of the xml element, @@ -833,7 +833,7 @@ class XML_RPC_Message extends CI_Xmlrpc //------------------------------------- // Start Element Handler - //------------------------------------- + //------------------------------------- function open_tag($the_parser, $name, $attrs) { @@ -870,7 +870,7 @@ class XML_RPC_Message extends CI_Xmlrpc $cur_val = array('value' => array(), 'type' => $name); - + array_unshift($this->xh[$the_parser]['valuestack'], $cur_val); break; case 'METHODNAME': @@ -935,7 +935,7 @@ class XML_RPC_Message extends CI_Xmlrpc //------------------------------------- // End Element Handler - //------------------------------------- + //------------------------------------- function closing_tag($the_parser, $name) { @@ -974,7 +974,7 @@ class XML_RPC_Message extends CI_Xmlrpc } elseif ($name=='DATETIME.ISO8601') { - $this->xh[$the_parser]['vt'] = $this->xmlrpcDateTime; + $this->xh[$the_parser]['vt'] = $this->xmlrpcDateTime; $this->xh[$the_parser]['value'] = $this->xh[$the_parser]['ac']; } elseif ($name=='BASE64') @@ -1041,7 +1041,7 @@ class XML_RPC_Message extends CI_Xmlrpc else { // Struct - $this->xh[$the_parser]['value'] = $temp; + $this->xh[$the_parser]['value'] = $temp; } break; case 'MEMBER': @@ -1079,7 +1079,7 @@ class XML_RPC_Message extends CI_Xmlrpc //------------------------------------- // Parses Character Data - //------------------------------------- + //------------------------------------- function character_data($the_parser, $data) { @@ -1130,21 +1130,21 @@ class XML_RPC_Message extends CI_Xmlrpc $parameters = array(); for ($i = 0; $i < sizeof($this->params); $i++) - { - $a_param = $this->decode_message($this->params[$i]); - - if (is_array($a_param)) - { - $parameters[] = $this->output_parameters($a_param); - } - else - { - $parameters[] = $CI->input->xss_clean($a_param); - } - } - } - - return $parameters; + { + $a_param = $this->decode_message($this->params[$i]); + + if (is_array($a_param)) + { + $parameters[] = $this->output_parameters($a_param); + } + else + { + $parameters[] = $CI->input->xss_clean($a_param); + } + } + } + + return $parameters; } @@ -1168,7 +1168,7 @@ class XML_RPC_Message extends CI_Xmlrpc $arr[] = $this->decode_message($param->me['array'][$i]); } - return $arr; + return $arr; } elseif($kind == 'struct') { @@ -1191,7 +1191,7 @@ class XML_RPC_Message extends CI_Xmlrpc /** * XML-RPC Values class - * + * * @category XML-RPC * @author Paul Burdick * @link http://www.codeigniter.com/user_guide/libraries/xmlrpc.html @@ -1387,7 +1387,7 @@ class XML_RPC_Values extends CI_Xmlrpc //------------------------------------- // Encode time in ISO-8601 form. - //------------------------------------- + //------------------------------------- // Useful for sending time in XML-RPC diff --git a/system/libraries/Xmlrpcs.php b/system/libraries/Xmlrpcs.php index e4d3cffde..bdb058e82 100644 --- a/system/libraries/Xmlrpcs.php +++ b/system/libraries/Xmlrpcs.php @@ -7,7 +7,7 @@ * @package CodeIgniter * @author Rick Ellis, Paul Burdick * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource @@ -15,19 +15,19 @@ if ( ! function_exists('xml_parser_create')) { - show_error('Your PHP installation does not support XML'); + show_error('Your PHP installation does not support XML'); } if ( ! class_exists('CI_Xmlrpc')) { - show_error('You must load the Xmlrpc class before loading the Xmlrpcs class in order to create a server.'); + show_error('You must load the Xmlrpc class before loading the Xmlrpcs class in order to create a server.'); } // ------------------------------------------------------------------------ /** * XML-RPC server class - * + * * @package CodeIgniter * @subpackage Libraries * @category XML-RPC @@ -44,7 +44,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- // Constructor, more or less - //------------------------------------- + //------------------------------------- function CI_Xmlrpcs($config=array()) { @@ -61,7 +61,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- // Initialize Prefs and Serve - //------------------------------------- + //------------------------------------- function initialize($config=array()) { @@ -78,7 +78,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- // Setting of System Methods - //------------------------------------- + //------------------------------------- function set_system_methods () { @@ -105,7 +105,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- // Main Server Function - //------------------------------------- + //------------------------------------- function serve() { @@ -121,7 +121,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- // Add Method to Class - //------------------------------------- + //------------------------------------- function add_to_map($methodname,$function,$sig,$doc) { @@ -135,7 +135,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- // Parse Server Request - //------------------------------------- + //------------------------------------- function parseRequest($data='') { @@ -143,7 +143,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- // Get Data - //------------------------------------- + //------------------------------------- if ($data == '') { @@ -153,7 +153,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- // Set up XML Parser - //------------------------------------- + //------------------------------------- $parser = xml_parser_create($this->xmlrpc_defencoding); $parser_object = new XML_RPC_Message("filler"); @@ -221,7 +221,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc // SET DEBUGGING MESSAGE //------------------------------------- - if ($this->debug === TRUE) + if ($this->debug === TRUE) { $this->debug_msg = "<!-- DEBUG INFO:\n\n".$plist."\n END DEBUG-->\n"; } @@ -231,7 +231,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- // Executes the Method - //------------------------------------- + //------------------------------------- function _execute($m) { @@ -244,7 +244,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- // Check for Function - //------------------------------------- + //------------------------------------- if (!isset($methods[$methName]['function'])) { @@ -275,7 +275,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- // Checking Methods Signature - //------------------------------------- + //------------------------------------- if (isset($methods[$methName]['signature'])) { @@ -298,7 +298,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc return new XML_RPC_Response(0, $this->xmlrpcerr['incorrect_params'], - $this->xmlrpcstr['incorrect_params'] . + $this->xmlrpcstr['incorrect_params'] . ": Wanted {$wanted}, got {$pt} at param {$pno})"); } } @@ -308,7 +308,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- // Calls the Function - //------------------------------------- + //------------------------------------- if ($objectCall) { @@ -334,7 +334,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- // Server Function: List Methods - //------------------------------------- + //------------------------------------- function listMethods($m) { @@ -356,7 +356,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- // Server Function: Return Signature for Method - //------------------------------------- + //------------------------------------- function methodSignature($m) { @@ -398,7 +398,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- // Server Function: Doc String for Method - //------------------------------------- + //------------------------------------- function methodHelp($m) { @@ -421,7 +421,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- // Server Function: Multi-call - //------------------------------------- + //------------------------------------- function multicall($m) { @@ -441,7 +441,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- // Multi-call Function: Error Handling - //------------------------------------- + //------------------------------------- function multicall_error($err) { @@ -457,7 +457,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc //------------------------------------- // Multi-call Function: Processes method - //------------------------------------- + //------------------------------------- function do_multicall($call) { @@ -469,7 +469,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc list($scalar_type,$scalar_value)=each($methName->me); $scalar_type = $scalar_type == $this->xmlrpcI4 ? $this->xmlrpcInt : $scalar_type; - if ($methName->kindOf() != 'scalar' || $scalar_type != 'string') + if ($methName->kindOf() != 'scalar' || $scalar_type != 'string') return $this->multicall_error('notstring'); elseif ($scalar_value == 'system.multicall') return $this->multicall_error('recursion'); diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php index 6af1ca979..092f9f378 100644 --- a/system/libraries/Zip.php +++ b/system/libraries/Zip.php @@ -7,12 +7,12 @@ * @package CodeIgniter * @author Rick Ellis * @copyright Copyright (c) 2006, pMachine, Inc. - * @license http://www.codeignitor.com/user_guide/license.html + * @license http://www.codeignitor.com/user_guide/license.html * @link http://www.codeigniter.com * @since Version 1.0 * @filesource */ - + // ------------------------------------------------------------------------ /** @@ -21,16 +21,16 @@ * This class is based on a library I found at Zend: * http://www.zend.com/codex.php?id=696&single=1 * - * The original library is a little rough around the edges so I + * The original library is a little rough around the edges so I * refactored it and added several additional methods -- Rick Ellis - * + * * @package CodeIgniter * @subpackage Libraries * @category Encryption * @author Rick Ellis * @link http://www.codeigniter.com/user_guide/general/encryption.html */ -class CI_Zip { +class CI_Zip { var $zipfile = ''; var $zipdata = array(); @@ -53,7 +53,7 @@ class CI_Zip { * @param mixed the directory name. Can be string or array * @return void */ - function add_dir($directory) + function add_dir($directory) { foreach ((array)$directory as $dir) { @@ -75,9 +75,9 @@ class CI_Zip { * @param string the directory name * @return void */ - function _add_dir($dir) + function _add_dir($dir) { - $dir = str_replace("\\", "/", $dir); + $dir = str_replace("\\", "/", $dir); $this->zipdata[] = "\x50\x4b\x03\x04\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00" .pack('V', 0) @@ -88,7 +88,7 @@ class CI_Zip { .$dir .pack('V', 0) .pack('V', 0) - .pack('V', 0); + .pack('V', 0); $newoffset = strlen(implode('', $this->zipdata)); @@ -106,7 +106,7 @@ class CI_Zip { .$dir; $this->offset = $newoffset; - $this->directory[] = $record; + $this->directory[] = $record; } // -------------------------------------------------------------------- @@ -150,14 +150,14 @@ class CI_Zip { */ function _add_data($filepath, $data) { - $filepath = str_replace("\\", "/", $filepath); + $filepath = str_replace("\\", "/", $filepath); - $oldlen = strlen($data); - $crc32 = crc32($data); + $oldlen = strlen($data); + $crc32 = crc32($data); $gzdata = gzcompress($data); $gzdata = substr(substr($gzdata, 0, strlen($gzdata) - 4), 2); - $newlen = strlen($gzdata); + $newlen = strlen($gzdata); $this->zipdata[] = "\x50\x4b\x03\x04\x14\x00\x00\x00\x08\x00\x00\x00\x00\x00" .pack('V', $crc32) @@ -169,7 +169,7 @@ class CI_Zip { .$gzdata .pack('V', $crc32) .pack('V', $newlen) - .pack('V', $oldlen); + .pack('V', $oldlen); $newoffset = strlen(implode("", $this->zipdata)); @@ -183,10 +183,10 @@ class CI_Zip { .pack('v', 0) .pack('v', 0) .pack('V', 32) - .pack('V', $this->offset); + .pack('V', $this->offset); $this->offset = $newoffset; - $this->directory[] = $record.$filepath; + $this->directory[] = $record.$filepath; } // -------------------------------------------------------------------- @@ -198,7 +198,7 @@ class CI_Zip { * @return binary string */ function get_zip() - { + { // We cache the zip data so multiple calls // do not require recompiling if ($this->zipfile != '') @@ -212,8 +212,8 @@ class CI_Zip { return FALSE; } - $data = implode('', $this->zipdata); - $dir = implode('', $this->directory); + $data = implode('', $this->zipdata); + $dir = implode('', $this->directory); $this->zipfile = $data.$dir."\x50\x4b\x05\x06\x00\x00\x00\x00" .pack('v', sizeof($this->directory)) @@ -278,8 +278,8 @@ class CI_Zip { header("Content-Transfer-Encoding: binary"); header('Pragma: public'); header("Content-Length: ".strlen($this->get_zip())); - } - else + } + else { header('Content-Type: application/x-zip'); header('Content-Disposition: attachment; filename="'.$filename.'"'); @@ -297,7 +297,7 @@ class CI_Zip { /** * Initialize Data * - * Lets you clear current zip data. Useful if you need to create + * Lets you clear current zip data. Useful if you need to create * multiple zips with different data. * * @access public |