From 0b59f270a432f8c7b6128981f0a39b4a2e2fbd34 Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Tue, 13 May 2008 04:22:33 +0000 Subject: Some sweeping syntax changes for consistency: (! foo) changed to ( ! foo) || changed to OR changed newline standardization code in various places from preg_replace to str_replace --- system/libraries/Benchmark.php | 6 +-- system/libraries/Calendar.php | 10 ++--- system/libraries/Config.php | 14 +++---- system/libraries/Controller.php | 8 ++-- system/libraries/Email.php | 84 +++++++++++++++++++++++++---------------- system/libraries/Encrypt.php | 12 +++--- system/libraries/Exceptions.php | 12 +++--- system/libraries/Ftp.php | 40 ++++++++++---------- system/libraries/Hooks.php | 20 +++++----- system/libraries/Image_lib.php | 60 ++++++++++++++--------------- system/libraries/Input.php | 36 ++++++++++-------- system/libraries/Language.php | 8 ++-- system/libraries/Loader.php | 40 ++++++++++---------- system/libraries/Log.php | 16 ++++---- system/libraries/Model.php | 8 ++-- system/libraries/Output.php | 24 ++++++------ system/libraries/Pagination.php | 8 ++-- system/libraries/Parser.php | 10 ++--- system/libraries/Profiler.php | 12 +++--- system/libraries/Router.php | 14 +++---- system/libraries/Session.php | 14 +++---- system/libraries/Sha1.php | 6 +-- system/libraries/Table.php | 24 ++++++------ system/libraries/Trackback.php | 36 +++++++++--------- system/libraries/URI.php | 18 ++++----- system/libraries/Unit_test.php | 10 ++--- system/libraries/Upload.php | 50 ++++++++++++------------ system/libraries/User_agent.php | 14 +++---- system/libraries/Validation.php | 50 ++++++++++++------------ system/libraries/Xmlrpc.php | 40 ++++++++++---------- system/libraries/Xmlrpcs.php | 26 ++++++------- system/libraries/Zip.php | 14 +++---- 32 files changed, 384 insertions(+), 360 deletions(-) (limited to 'system/libraries') diff --git a/system/libraries/Benchmark.php b/system/libraries/Benchmark.php index 899350bf7..4c9993a0f 100644 --- a/system/libraries/Benchmark.php +++ b/system/libraries/Benchmark.php @@ -1,4 +1,4 @@ -marker[$point1])) + if ( ! isset($this->marker[$point1])) { return ''; } - if (! isset($this->marker[$point2])) + if ( ! isset($this->marker[$point2])) { $this->marker[$point2] = microtime(); } diff --git a/system/libraries/Calendar.php b/system/libraries/Calendar.php index fbb275c5f..f6b028463 100644 --- a/system/libraries/Calendar.php +++ b/system/libraries/Calendar.php @@ -1,4 +1,4 @@ -CI =& get_instance(); - if (! in_array('calendar_lang'.EXT, $this->CI->lang->is_loaded, TRUE)) + if ( ! in_array('calendar_lang'.EXT, $this->CI->lang->is_loaded, TRUE)) { $this->CI->lang->load('calendar'); } @@ -125,7 +125,7 @@ class CI_Calendar { // Set the starting day of the week $start_days = array('sunday' => 0, 'monday' => 1, 'tuesday' => 2, 'wednesday' => 3, 'thursday' => 4, 'friday' => 5, 'saturday' => 6); - $start_day = (! isset($start_days[$this->start_day])) ? 0 : $start_days[$this->start_day]; + $start_day = ( ! isset($start_days[$this->start_day])) ? 0 : $start_days[$this->start_day]; // Set the starting day number $local_date = mktime(12, 0, 0, $month, 1, $year); @@ -472,6 +472,6 @@ class CI_Calendar { } // END CI_Calendar class - -/* End of file Calendar.php */ + +/* End of file Calendar.php */ /* Location: ./system/libraries/Calendar.php */ \ No newline at end of file diff --git a/system/libraries/Config.php b/system/libraries/Config.php index 06e1cbe80..a5d268912 100644 --- a/system/libraries/Config.php +++ b/system/libraries/Config.php @@ -1,4 +1,4 @@ -config[$item])) + if ( ! isset($this->config[$item])) { return FALSE; } @@ -134,12 +134,12 @@ class CI_Config { } else { - if (! isset($this->config[$index])) + if ( ! isset($this->config[$index])) { return FALSE; } - if (! isset($this->config[$index][$item])) + if ( ! isset($this->config[$index][$item])) { return FALSE; } @@ -165,7 +165,7 @@ class CI_Config { */ function slash_item($item) { - if (! isset($this->config[$item])) + if ( ! isset($this->config[$item])) { return FALSE; } diff --git a/system/libraries/Controller.php b/system/libraries/Controller.php index 1a1e3df53..5c96c577a 100644 --- a/system/libraries/Controller.php +++ b/system/libraries/Controller.php @@ -1,4 +1,4 @@ -uri->segment(3), array('add', 'insert', 'edit', 'update', 'view', 'delete', 'do_delete'), TRUE)) ? 'view' : $this->uri->segment(3); + $method = ( ! in_array($this->uri->segment(3), array('add', 'insert', 'edit', 'update', 'view', 'delete', 'do_delete'), TRUE)) ? 'view' : $this->uri->segment(3); require_once(BASEPATH.'scaffolding/Scaffolding'.EXT); $scaff = new Scaffolding($this->_ci_scaff_table); @@ -121,6 +121,6 @@ class Controller extends CI_Base { } // END _Controller class - -/* End of file Controller.php */ + +/* End of file Controller.php */ /* Location: ./system/libraries/Controller.php */ \ No newline at end of file diff --git a/system/libraries/Email.php b/system/libraries/Email.php index ebb969288..ab3a24893 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -1,4 +1,4 @@ -_set_header('Subject', trim($subject)); } @@ -391,7 +398,7 @@ class CI_Email { */ function _str_to_array($email) { - if (! is_array($email)) + if ( ! is_array($email)) { if (strpos($email, ',') !== FALSE) { @@ -459,7 +466,7 @@ class CI_Email { */ function set_protocol($protocol = 'mail') { - $this->protocol = (! in_array($protocol, $this->_protocols, TRUE)) ? 'mail' : strtolower($protocol); + $this->protocol = ( ! in_array($protocol, $this->_protocols, TRUE)) ? 'mail' : strtolower($protocol); } // -------------------------------------------------------------------- @@ -473,7 +480,7 @@ class CI_Email { */ function set_priority($n = 3) { - if (! is_numeric($n)) + if ( ! is_numeric($n)) { $this->priority = 3; return; @@ -571,7 +578,7 @@ class CI_Email { function _get_protocol($return = TRUE) { $this->protocol = strtolower($this->protocol); - $this->protocol = (! in_array($this->protocol, $this->_protocols, TRUE)) ? 'mail' : $this->protocol; + $this->protocol = ( ! in_array($this->protocol, $this->_protocols, TRUE)) ? 'mail' : $this->protocol; if ($return == TRUE) { @@ -590,7 +597,7 @@ class CI_Email { */ function _get_encoding($return = TRUE) { - $this->_encoding = (! in_array($this->_encoding, $this->_bit_depths)) ? '8bit' : $this->_encoding; + $this->_encoding = ( ! in_array($this->_encoding, $this->_bit_depths)) ? '8bit' : $this->_encoding; foreach ($this->_base_charsets as $charset) { @@ -676,7 +683,7 @@ class CI_Email { */ function validate_email($email) { - if (! is_array($email)) + if ( ! is_array($email)) { $this->_set_error_message('email_must_be_array'); return FALSE; @@ -684,7 +691,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; @@ -703,7 +710,7 @@ class CI_Email { */ function valid_email($address) { - return (! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $address)) ? FALSE : TRUE; + return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $address)) ? FALSE : TRUE; } // -------------------------------------------------------------------- @@ -717,7 +724,7 @@ class CI_Email { */ function clean_email($email) { - if (! is_array($email)) + if ( ! is_array($email)) { if (preg_match('/\<(.*)\>/', $email, $match)) { @@ -816,7 +823,10 @@ class CI_Email { $str = preg_replace("| +|", " ", $str); // Standardize newlines - $str = preg_replace("/\r\n|\r/", "\n", $str); + if (strpos($str, "\r") !== FALSE) + { + $str = str_replace(array("\r\n", "\r"), "\n", $str); + } // If the current word is surrounded by {unwrap} tags we'll // strip the entire chunk and replace it with a marker. @@ -857,7 +867,7 @@ class CI_Email { } // Trim the word down - $temp .= ($line, 0, $charlim-1); + $temp .= substr($line, 0, $charlim-1); $line = substr($line, $charlim-1); } @@ -1089,7 +1099,7 @@ class CI_Email { $basename = basename($filename); $ctype = $this->_attach_type[$i]; - if (! file_exists($filename)) + if ( ! file_exists($filename)) { $this->_set_error_message('email_attachment_missing', $filename); return FALSE; @@ -1104,7 +1114,7 @@ class CI_Email { $attachment[$z++] = $h; $file = filesize($filename) +1; - if (! $fp = fopen($filename, FOPEN_READ)) + if ( ! $fp = fopen($filename, FOPEN_READ)) { $this->_set_error_message('email_attachment_unreadable', $filename); return FALSE; @@ -1153,7 +1163,10 @@ class CI_Email { $str = preg_replace("| +|", " ", $str); // Standardize newlines - $str = preg_replace("/\r\n|\r/", "\n", $str); + if (strpos($str, "\r") !== FALSE) + { + $str = str_replace(array("\r\n", "\r"), "\n", $str); + } // We are intentionally wrapping so mail servers will encode characters // properly and MUAs will behave, so {unwrap} must go! @@ -1228,9 +1241,9 @@ class CI_Email { $this->reply_to($this->_headers['From']); } - if ((! isset($this->_recipients) AND ! isset($this->_headers['To'])) AND - (! isset($this->_bcc_array) AND ! isset($this->_headers['Bcc'])) AND - (! isset($this->_headers['Cc']))) + if (( ! isset($this->_recipients) AND ! isset($this->_headers['To'])) AND + ( ! isset($this->_bcc_array) AND ! isset($this->_headers['Bcc'])) AND + ( ! isset($this->_headers['Cc']))) { $this->_set_error_message('email_no_recipients'); return FALSE; @@ -1246,7 +1259,7 @@ class CI_Email { $this->_build_message(); - if (! $this->_spool_email()) + if ( ! $this->_spool_email()) { return FALSE; } @@ -1338,7 +1351,12 @@ class CI_Email { */ function _remove_nl_callback($matches) { - return preg_replace("/(\r\n)|(\r)|(\n)/", "", $matches['1']); + if (strpos($matches[1], "\r") !== FALSE OR strpos($matches[1], "\n") !== FALSE) + { + $matches[1] = str_replace(array("\r\n", "\r", "\n"), '', $matches[1]); + } + + return $matches[1]; } // -------------------------------------------------------------------- @@ -1357,7 +1375,7 @@ class CI_Email { { case 'mail' : - if (! $this->_send_with_mail()) + if ( ! $this->_send_with_mail()) { $this->_set_error_message('email_send_failure_phpmail'); return FALSE; @@ -1365,7 +1383,7 @@ class CI_Email { break; case 'sendmail' : - if (! $this->_send_with_sendmail()) + if ( ! $this->_send_with_sendmail()) { $this->_set_error_message('email_send_failure_sendmail'); return FALSE; @@ -1373,7 +1391,7 @@ class CI_Email { break; case 'smtp' : - if (! $this->_send_with_smtp()) + if ( ! $this->_send_with_smtp()) { $this->_set_error_message('email_send_failure_smtp'); return FALSE; @@ -1398,7 +1416,7 @@ class CI_Email { { if ($this->_safe_mode == TRUE) { - if (! mail($this->_recipients, $this->_subject, $this->_finalbody, $this->_header_str)) + if ( ! mail($this->_recipients, $this->_subject, $this->_finalbody, $this->_header_str)) return FALSE; else return TRUE; @@ -1407,7 +1425,7 @@ class CI_Email { { // most documentation of sendmail using the "-f" flag lacks a space after it, however // we've encountered servers that seem to require it to be in place. - if (! mail($this->_recipients, $this->_subject, $this->_finalbody, $this->_header_str, "-f ".$this->clean_email($this->_headers['From']))) + if ( ! mail($this->_recipients, $this->_subject, $this->_finalbody, $this->_header_str, "-f ".$this->clean_email($this->_headers['From']))) return FALSE; else return TRUE; @@ -1426,7 +1444,7 @@ class CI_Email { { $fp = @popen($this->mailpath . " -oi -f ".$this->clean_email($this->_headers['From'])." -t", 'w'); - if (! is_resource($fp)) + if ( ! is_resource($fp)) { $this->_set_error_message('email_no_socket'); return FALSE; @@ -1519,7 +1537,7 @@ class CI_Email { $errstr, $this->smtp_timeout); - if(! is_resource($this->_smtp_connect)) + if( ! is_resource($this->_smtp_connect)) { $this->_set_error_message('email_smtp_error', $errno." ".$errstr); return FALSE; @@ -1606,7 +1624,7 @@ class CI_Email { */ function _smtp_authenticate() { - if (! $this->_smtp_auth) + if ( ! $this->_smtp_auth) { return TRUE; } @@ -1660,7 +1678,7 @@ class CI_Email { */ function _send_data($data) { - if (! fwrite($this->_smtp_connect, $data . $this->newline)) + if ( ! fwrite($this->_smtp_connect, $data . $this->newline)) { $this->_set_error_message('email_smtp_data_failure', $data); return FALSE; @@ -1739,7 +1757,7 @@ class CI_Email { $this->_IP = end($x); } - if (! preg_match( "/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/", $this->_IP)) + if ( ! preg_match( "/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/", $this->_IP)) { $this->_IP = '0.0.0.0'; } @@ -1899,7 +1917,7 @@ class CI_Email { 'eml' => 'message/rfc822' ); - return (! isset($mimes[strtolower($ext)])) ? "application/x-unknown-content-type" : $mimes[strtolower($ext)]; + return ( ! isset($mimes[strtolower($ext)])) ? "application/x-unknown-content-type" : $mimes[strtolower($ext)]; } } diff --git a/system/libraries/Encrypt.php b/system/libraries/Encrypt.php index 4b13efda3..7ad577251 100644 --- a/system/libraries/Encrypt.php +++ b/system/libraries/Encrypt.php @@ -1,4 +1,4 @@ -CI =& get_instance(); - $this->_mcrypt_exists = (! function_exists('mcrypt_encrypt')) ? FALSE : TRUE; + $this->_mcrypt_exists = ( ! function_exists('mcrypt_encrypt')) ? FALSE : TRUE; log_message('debug', "Encrypt Class Initialized"); } @@ -459,9 +459,9 @@ class CI_Encrypt { */ function sha1($str) { - if (! function_exists('sha1')) + if ( ! function_exists('sha1')) { - if (! function_exists('mhash')) + if ( ! function_exists('mhash')) { require_once(BASEPATH.'libraries/Sha1'.EXT); $SH = new CI_SHA; @@ -481,6 +481,6 @@ class CI_Encrypt { } // END CI_Encrypt class - -/* End of file Encrypt.php */ + +/* End of file Encrypt.php */ /* Location: ./system/libraries/Encrypt.php */ \ No newline at end of file diff --git a/system/libraries/Exceptions.php b/system/libraries/Exceptions.php index 428759042..5ce243a5e 100644 --- a/system/libraries/Exceptions.php +++ b/system/libraries/Exceptions.php @@ -1,4 +1,4 @@ -levels[$severity])) ? $severity : $this->levels[$severity]; + $severity = ( ! isset($this->levels[$severity])) ? $severity : $this->levels[$severity]; log_message('error', 'Severity: '.$severity.' --> '.$message. ' '.$filepath.' '.$line, TRUE); } @@ -115,7 +115,7 @@ class CI_Exceptions { */ function show_error($heading, $message, $template = 'error_general') { - $message = '

'.implode('

', (! is_array($message)) ? array($message) : $message).'

'; + $message = '

'.implode('

', ( ! is_array($message)) ? array($message) : $message).'

'; if (ob_get_level() > $this->ob_level + 1) { @@ -142,7 +142,7 @@ class CI_Exceptions { */ function show_php_error($severity, $message, $filepath, $line) { - $severity = (! isset($this->levels[$severity])) ? $severity : $this->levels[$severity]; + $severity = ( ! isset($this->levels[$severity])) ? $severity : $this->levels[$severity]; $filepath = str_replace("\\", "/", $filepath); @@ -167,6 +167,6 @@ class CI_Exceptions { } // END Exceptions Class - -/* End of file Exceptions.php */ + +/* End of file Exceptions.php */ /* Location: ./system/libraries/Exceptions.php */ \ No newline at end of file diff --git a/system/libraries/Ftp.php b/system/libraries/Ftp.php index 01354cf05..170ebe1c4 100644 --- a/system/libraries/Ftp.php +++ b/system/libraries/Ftp.php @@ -1,4 +1,4 @@ -_login()) + if ( ! $this->_login()) { if ($this->debug == TRUE) { @@ -139,7 +139,7 @@ class CI_FTP { */ function _is_conn() { - if (! is_resource($this->conn_id)) + if ( ! is_resource($this->conn_id)) { if ($this->debug == TRUE) { @@ -216,7 +216,7 @@ class CI_FTP { } // Set file permissions if needed - if (! is_null($permissions)) + if ( ! is_null($permissions)) { $this->chmod($path, (int)$permissions); } @@ -237,12 +237,12 @@ class CI_FTP { */ function upload($locpath, $rempath, $mode = 'auto', $permissions = NULL) { - if (! $this->_is_conn()) + if ( ! $this->_is_conn()) { return FALSE; } - if (! file_exists($locpath)) + if ( ! file_exists($locpath)) { $this->_error('ftp_no_source_file'); return FALSE; @@ -270,7 +270,7 @@ class CI_FTP { } // Set file permissions if needed - if (! is_null($permissions)) + if ( ! is_null($permissions)) { $this->chmod($rempath, (int)$permissions); } @@ -291,7 +291,7 @@ class CI_FTP { */ function rename($old_file, $new_file, $move = FALSE) { - if (! $this->_is_conn()) + if ( ! $this->_is_conn()) { return FALSE; } @@ -338,7 +338,7 @@ class CI_FTP { */ function delete_file($filepath) { - if (! $this->_is_conn()) + if ( ! $this->_is_conn()) { return FALSE; } @@ -369,7 +369,7 @@ class CI_FTP { */ function delete_dir($filepath) { - if (! $this->_is_conn()) + if ( ! $this->_is_conn()) { return FALSE; } @@ -385,7 +385,7 @@ class CI_FTP { { // If we can't delete the item it's probaly a folder so // we'll recursively call delete_dir() - if (! @ftp_delete($this->conn_id, $item)) + if ( ! @ftp_delete($this->conn_id, $item)) { $this->delete_dir($item); } @@ -418,13 +418,13 @@ class CI_FTP { */ function chmod($path, $perm) { - if (! $this->_is_conn()) + if ( ! $this->_is_conn()) { return FALSE; } // Permissions can only be set when running PHP 5 - if (! function_exists('ftp_chmod')) + if ( ! function_exists('ftp_chmod')) { if ($this->debug == TRUE) { @@ -457,7 +457,7 @@ class CI_FTP { */ function list_files($path = '.') { - if (! $this->_is_conn()) + if ( ! $this->_is_conn()) { return FALSE; } @@ -481,7 +481,7 @@ class CI_FTP { */ function mirror($locpath, $rempath) { - if (! $this->_is_conn()) + if ( ! $this->_is_conn()) { return FALSE; } @@ -490,10 +490,10 @@ class CI_FTP { if ($fp = @opendir($locpath)) { // Attempt to open the remote file path. - if (! $this->changedir($rempath, TRUE)) + if ( ! $this->changedir($rempath, TRUE)) { // If it doesn't exist we'll attempt to create the direcotory - if (! $this->mkdir($rempath) OR ! $this->changedir($rempath)) + if ( ! $this->mkdir($rempath) OR ! $this->changedir($rempath)) { return FALSE; } @@ -586,7 +586,7 @@ class CI_FTP { */ function close() { - if (! $this->_is_conn()) + if ( ! $this->_is_conn()) { return FALSE; } @@ -613,6 +613,6 @@ class CI_FTP { } // END FTP Class - -/* End of file Ftp.php */ + +/* End of file Ftp.php */ /* Location: ./system/libraries/Ftp.php */ \ No newline at end of file diff --git a/system/libraries/Hooks.php b/system/libraries/Hooks.php index d7637c39e..8c99bdd10 100644 --- a/system/libraries/Hooks.php +++ b/system/libraries/Hooks.php @@ -1,4 +1,4 @@ -enabled OR ! isset($this->hooks[$which])) + if ( ! $this->enabled OR ! isset($this->hooks[$which])) { return FALSE; } @@ -123,7 +123,7 @@ class CI_Hooks { */ function _run_hook($data) { - if (! is_array($data)) + if ( ! is_array($data)) { return FALSE; } @@ -144,14 +144,14 @@ class CI_Hooks { // Set file path // ----------------------------------- - if (! isset($data['filepath']) OR ! isset($data['filename'])) + if ( ! isset($data['filepath']) OR ! isset($data['filename'])) { return FALSE; } $filepath = APPPATH.$data['filepath'].'/'.$data['filename']; - if (! file_exists($filepath)) + if ( ! file_exists($filepath)) { return FALSE; } @@ -196,7 +196,7 @@ class CI_Hooks { if ($class !== FALSE) { - if (! class_exists($class)) + if ( ! class_exists($class)) { require($filepath); } @@ -206,7 +206,7 @@ class CI_Hooks { } else { - if (! function_exists($function)) + if ( ! function_exists($function)) { require($filepath); } @@ -221,6 +221,6 @@ class CI_Hooks { } // END CI_Hooks class - -/* End of file Hooks.php */ + +/* End of file Hooks.php */ /* Location: ./system/libraries/Hooks.php */ \ No newline at end of file diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index 4017afb13..a602b4645 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -1,4 +1,4 @@ -set_error('imglib_gd_required_for_props'); return FALSE; @@ -188,7 +188,7 @@ class CI_Image_lib { $this->source_folder = str_replace($this->source_image, '', $full_source_path); // Set the Image Properties - if (! $this->get_image_properties($this->source_folder.$this->source_image)) + if ( ! $this->get_image_properties($this->source_folder.$this->source_image)) { return FALSE; } @@ -226,7 +226,7 @@ class CI_Image_lib { } // Is there a file name? - if (! preg_match("#[\.jpg|\.jpeg|\.gif|\.png]$#i", $full_dest_path)) + if ( ! preg_match("#[\.jpg|\.jpeg|\.gif|\.png]$#i", $full_dest_path)) { $this->dest_folder = $full_dest_path.'/'; $this->dest_image = $this->source_image; @@ -478,7 +478,7 @@ class CI_Image_lib { // we'll simply make a copy of the original with the new name if (($this->orig_width == $this->width AND $this->orig_height == $this->height) AND ($this->source_image != $this->new_image)) { - if (! @copy($this->full_src_path, $this->full_dst_path)) + if ( ! @copy($this->full_src_path, $this->full_dst_path)) { $this->set_error('imglib_copy_failed'); return FALSE; @@ -494,7 +494,7 @@ class CI_Image_lib { } // Create the image handle - if (! ($src_img = $this->image_create_gd())) + if ( ! ($src_img = $this->image_create_gd())) { return FALSE; } @@ -528,7 +528,7 @@ class CI_Image_lib { else { // Or save it - if (! $this->image_save_gd($dst_img)) + if ( ! $this->image_save_gd($dst_img)) { return FALSE; } @@ -564,9 +564,9 @@ 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 .= "/"; + if ( ! eregi("/$", $this->library_path)) $this->library_path .= "/"; $this->library_path .= 'convert'; } @@ -712,14 +712,14 @@ class CI_Image_lib { { // Is Image Rotation Supported? // this function is only supported as of PHP 4.3 - if (! function_exists('imagerotate')) + if ( ! function_exists('imagerotate')) { $this->set_error('imglib_rotate_unsupported'); return FALSE; } // Create the image handle - if (! ($src_img = $this->image_create_gd())) + if ( ! ($src_img = $this->image_create_gd())) { return FALSE; } @@ -742,7 +742,7 @@ class CI_Image_lib { else { // Or save it - if (! $this->image_save_gd($dst_img)) + if ( ! $this->image_save_gd($dst_img)) { return FALSE; } @@ -771,7 +771,7 @@ class CI_Image_lib { */ function image_mirror_gd() { - if (! $src_img = $this->image_create_gd()) + if ( ! $src_img = $this->image_create_gd()) { return FALSE; } @@ -828,7 +828,7 @@ class CI_Image_lib { else { // Or save it - if (! $this->image_save_gd($src_img)) + if ( ! $this->image_save_gd($src_img)) { return FALSE; } @@ -877,7 +877,7 @@ class CI_Image_lib { */ function overlay_watermark() { - if (! function_exists('imagecolortransparent')) + if ( ! function_exists('imagecolortransparent')) { $this->set_error('imglib_gd_required'); return FALSE; @@ -968,7 +968,7 @@ class CI_Image_lib { } else { - if (! $this->image_save_gd($src_img)) + if ( ! $this->image_save_gd($src_img)) { return FALSE; } @@ -990,7 +990,7 @@ class CI_Image_lib { */ function text_watermark() { - if (! ($src_img = $this->image_create_gd())) + if ( ! ($src_img = $this->image_create_gd())) { return FALSE; } @@ -1144,7 +1144,7 @@ class CI_Image_lib { switch ($image_type) { case 1 : - if (! function_exists('imagecreatefromgif')) + if ( ! function_exists('imagecreatefromgif')) { $this->set_error(array('imglib_unsupported_imagecreate', 'imglib_gif_not_supported')); return FALSE; @@ -1153,7 +1153,7 @@ class CI_Image_lib { return imagecreatefromgif($path); break; case 2 : - if (! function_exists('imagecreatefromjpeg')) + if ( ! function_exists('imagecreatefromjpeg')) { $this->set_error(array('imglib_unsupported_imagecreate', 'imglib_jpg_not_supported')); return FALSE; @@ -1162,7 +1162,7 @@ class CI_Image_lib { return imagecreatefromjpeg($path); break; case 3 : - if (! function_exists('imagecreatefrompng')) + if ( ! function_exists('imagecreatefrompng')) { $this->set_error(array('imglib_unsupported_imagecreate', 'imglib_png_not_supported')); return FALSE; @@ -1194,7 +1194,7 @@ class CI_Image_lib { switch ($this->image_type) { case 1 : - if (! function_exists('imagegif')) + if ( ! function_exists('imagegif')) { $this->set_error(array('imglib_unsupported_imagecreate', 'imglib_gif_not_supported')); return FALSE; @@ -1203,7 +1203,7 @@ class CI_Image_lib { @imagegif($resource, $this->full_dst_path); break; case 2 : - if (! function_exists('imagejpeg')) + if ( ! function_exists('imagejpeg')) { $this->set_error(array('imglib_unsupported_imagecreate', 'imglib_jpg_not_supported')); return FALSE; @@ -1217,7 +1217,7 @@ class CI_Image_lib { @imagejpeg($resource, $this->full_dst_path, $this->quality); break; case 3 : - if (! function_exists('imagepng')) + if ( ! function_exists('imagepng')) { $this->set_error(array('imglib_unsupported_imagecreate', 'imglib_png_not_supported')); return FALSE; @@ -1280,10 +1280,10 @@ class CI_Image_lib { */ function image_reproportion() { - if (! is_numeric($this->width) OR ! is_numeric($this->height) OR $this->width == 0 OR $this->height == 0) + if ( ! is_numeric($this->width) OR ! is_numeric($this->height) OR $this->width == 0 OR $this->height == 0) return; - if (! is_numeric($this->orig_width) OR ! is_numeric($this->orig_height) OR $this->orig_width == 0 OR $this->orig_height == 0) + if ( ! is_numeric($this->orig_width) OR ! is_numeric($this->orig_height) OR $this->orig_width == 0 OR $this->orig_height == 0) return; $new_width = ceil($this->orig_width*$this->height/$this->orig_height); @@ -1328,7 +1328,7 @@ class CI_Image_lib { if ($path == '') $path = $this->full_src_path; - if (! file_exists($path)) + if ( ! file_exists($path)) { $this->set_error('imglib_invalid_path'); return FALSE; @@ -1382,14 +1382,14 @@ class CI_Image_lib { */ function size_calculator($vals) { - if (! is_array($vals)) + if ( ! is_array($vals)) return; $allowed = array('new_width', 'new_height', 'width', 'height'); foreach ($allowed as $item) { - if (! isset($vals[$item]) OR $vals[$item] == '') + if ( ! isset($vals[$item]) OR $vals[$item] == '') $vals[$item] = 0; } @@ -1460,9 +1460,9 @@ class CI_Image_lib { */ function gd_loaded() { - if (! extension_loaded('gd')) + if ( ! extension_loaded('gd')) { - if (! dl('gd.so')) + if ( ! dl('gd.so')) { return FALSE; } diff --git a/system/libraries/Input.php b/system/libraries/Input.php index f98757947..978d1ff34 100644 --- a/system/libraries/Input.php +++ b/system/libraries/Input.php @@ -1,4 +1,4 @@ - $val) { - if (! in_array($key, $protected)) + if ( ! in_array($key, $protected)) { unset($GLOBALS[$key]); } @@ -97,7 +97,7 @@ class CI_Input { { foreach($val as $k => $v) { - if (! in_array($k, $protected)) + if ( ! in_array($k, $protected)) { unset($GLOBALS[$k]); } @@ -181,7 +181,12 @@ class CI_Input { } // Standardize newlines - return preg_replace("/\015\012|\015|\012/", "\n", $str); + if (strpos($str, "\r") !== FALSE) + { + $str = str_replace(array("\r\n", "\r"), "\n", $str); + } + + return $str; } // -------------------------------------------------------------------- @@ -199,7 +204,7 @@ class CI_Input { */ function _clean_input_keys($str) { - if (! preg_match("/^[a-z0-9:_\/-]+$/i", $str)) + if ( ! preg_match("/^[a-z0-9:_\/-]+$/i", $str)) { exit('Disallowed Key Characters.'); } @@ -219,7 +224,7 @@ class CI_Input { */ function get($index = '', $xss_clean = FALSE) { - if (! isset($_GET[$index])) + if ( ! isset($_GET[$index])) { return FALSE; } @@ -254,7 +259,7 @@ class CI_Input { */ function post($index = '', $xss_clean = FALSE) { - if (! isset($_POST[$index])) + if ( ! isset($_POST[$index])) { return FALSE; } @@ -289,7 +294,7 @@ class CI_Input { */ function cookie($index = '', $xss_clean = FALSE) { - if (! isset($_COOKIE[$index])) + if ( ! isset($_COOKIE[$index])) { return FALSE; } @@ -329,7 +334,7 @@ class CI_Input { */ function server($index = '', $xss_clean = FALSE) { - if (! isset($_SERVER[$index])) + if ( ! isset($_SERVER[$index])) { return FALSE; } @@ -386,7 +391,7 @@ class CI_Input { $this->ip_address = end($x); } - if (! $this->valid_ip($this->ip_address)) + if ( ! $this->valid_ip($this->ip_address)) { $this->ip_address = '0.0.0.0'; } @@ -448,7 +453,7 @@ class CI_Input { return $this->user_agent; } - $this->user_agent = (! isset($_SERVER['HTTP_USER_AGENT'])) ? FALSE : $_SERVER['HTTP_USER_AGENT']; + $this->user_agent = ( ! isset($_SERVER['HTTP_USER_AGENT'])) ? FALSE : $_SERVER['HTTP_USER_AGENT']; return $this->user_agent; } @@ -650,8 +655,9 @@ class CI_Input { * */ - if (strpos($str, "\t") !== FALSE) { - $str = str_replace("\t", " ", $str); + if (strpos($str, "\t") !== FALSE) + { + $str = str_replace("\t", ' ', $str); } /* diff --git a/system/libraries/Language.php b/system/libraries/Language.php index aacc6c1f9..f97db3506 100644 --- a/system/libraries/Language.php +++ b/system/libraries/Language.php @@ -1,4 +1,4 @@ -load->database($db_conn, FALSE, TRUE); } - if (! class_exists('Model')) + if ( ! class_exists('Model')) { load_class('Model', FALSE); } @@ -230,7 +230,7 @@ class CI_Loader { */ function dbutil() { - if (! class_exists('CI_DB')) + if ( ! class_exists('CI_DB')) { $this->database(); } @@ -260,7 +260,7 @@ class CI_Loader { */ function dbforge() { - if (! class_exists('CI_DB')) + if ( ! class_exists('CI_DB')) { $this->database(); } @@ -355,7 +355,7 @@ class CI_Loader { */ function helper($helpers = array()) { - if (! is_array($helpers)) + if ( ! is_array($helpers)) { $helpers = array($helpers); } @@ -376,7 +376,7 @@ class CI_Loader { { $base_helper = BASEPATH.'helpers/'.$helper.EXT; - if (! file_exists($base_helper)) + if ( ! file_exists($base_helper)) { show_error('Unable to load the requested file: helpers/'.$helper.EXT); } @@ -437,7 +437,7 @@ class CI_Loader { */ function plugin($plugins = array()) { - if (! is_array($plugins)) + if ( ! is_array($plugins)) { $plugins = array($plugins); } @@ -507,7 +507,7 @@ class CI_Loader { */ function script($scripts = array()) { - if (! is_array($scripts)) + if ( ! is_array($scripts)) { $scripts = array($scripts); } @@ -521,7 +521,7 @@ class CI_Loader { continue; } - if (! file_exists(APPPATH.'scripts/'.$script.EXT)) + if ( ! file_exists(APPPATH.'scripts/'.$script.EXT)) { show_error('Unable to load the requested script: scripts/'.$script.EXT); } @@ -546,7 +546,7 @@ class CI_Loader { { $CI =& get_instance(); - if (! is_array($file)) + if ( ! is_array($file)) { $file = array($file); } @@ -632,7 +632,7 @@ class CI_Loader { // Set the default data variables foreach (array('_ci_view', '_ci_vars', '_ci_path', '_ci_return') as $_ci_val) { - $$_ci_val = (! isset($_ci_data[$_ci_val])) ? FALSE : $_ci_data[$_ci_val]; + $$_ci_val = ( ! isset($_ci_data[$_ci_val])) ? FALSE : $_ci_data[$_ci_val]; } // Set the path to the requested file @@ -648,7 +648,7 @@ class CI_Loader { $_ci_file = end($_ci_x); } - if (! file_exists($_ci_path)) + if ( ! file_exists($_ci_path)) { show_error('Unable to load the requested file: '.$_ci_file); } @@ -662,7 +662,7 @@ class CI_Loader { $_ci_CI =& get_instance(); foreach (get_object_vars($_ci_CI) as $_ci_key => $_ci_var) { - if (! isset($this->$_ci_key)) + if ( ! isset($this->$_ci_key)) { $this->$_ci_key =& $_ci_CI->$_ci_key; } @@ -703,7 +703,7 @@ class CI_Loader { if ((bool) @ini_get('short_open_tag') === FALSE AND config_item('rewrite_short_tags') == TRUE) { - echo eval('?>'.preg_replace("/;*\s*\?>/", "; ?>", str_replace('/", "; ?>", str_replace('_ci_varmap[$class])) ? $class : $this->_ci_varmap[$class]; + $classvar = ( ! isset($this->_ci_varmap[$class])) ? $class : $this->_ci_varmap[$class]; // Instantiate the class $CI =& get_instance(); @@ -890,7 +890,7 @@ class CI_Loader { { include_once(APPPATH.'config/autoload'.EXT); - if (! isset($autoload)) + if ( ! isset($autoload)) { return FALSE; } @@ -918,7 +918,7 @@ class CI_Loader { // A little tweak to remain backward compatible // The $autoload['core'] item was deprecated - if (! isset($autoload['libraries'])) + if ( ! isset($autoload['libraries'])) { $autoload['libraries'] = $autoload['core']; } diff --git a/system/libraries/Log.php b/system/libraries/Log.php index 22b505906..4d64cd328 100644 --- a/system/libraries/Log.php +++ b/system/libraries/Log.php @@ -1,4 +1,4 @@ -log_path = ($config['log_path'] != '') ? $config['log_path'] : BASEPATH.'logs/'; - if (! is_dir($this->log_path) OR ! is_really_writable($this->log_path)) + if ( ! is_dir($this->log_path) OR ! is_really_writable($this->log_path)) { $this->_enabled = FALSE; } @@ -84,7 +84,7 @@ class CI_Log { $level = strtoupper($level); - if (! isset($this->_levels[$level]) OR ($this->_levels[$level] > $this->_threshold)) + if ( ! isset($this->_levels[$level]) OR ($this->_levels[$level] > $this->_threshold)) { return FALSE; } @@ -92,12 +92,12 @@ class CI_Log { $filepath = $this->log_path.'log-'.date('Y-m-d').EXT; $message = ''; - if (! file_exists($filepath)) + if ( ! file_exists($filepath)) { - $message .= "<"."?php if (!defined('BASEPATH')) exit('No direct script access allowed'); ?".">\n\n"; + $message .= "<"."?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?".">\n\n"; } - if (! $fp = @fopen($filepath, FOPEN_WRITE_CREATE)) + if ( ! $fp = @fopen($filepath, FOPEN_WRITE_CREATE)) { return FALSE; } @@ -115,6 +115,6 @@ class CI_Log { } // END Log Class - -/* End of file Log.php */ + +/* End of file Log.php */ /* Location: ./system/libraries/Log.php */ \ No newline at end of file diff --git a/system/libraries/Model.php b/system/libraries/Model.php index 1e7b9a184..5c8d43363 100644 --- a/system/libraries/Model.php +++ b/system/libraries/Model.php @@ -1,4 +1,4 @@ -$key) AND $key != $this->_parent_name) + if ( ! isset($this->$key) AND $key != $this->_parent_name) { // In some cases using references can cause // problems so we'll conditionally use them @@ -79,6 +79,6 @@ class Model { } // END Model Class - -/* End of file Model.php */ + +/* End of file Model.php */ /* Location: ./system/libraries/Model.php */ \ No newline at end of file diff --git a/system/libraries/Output.php b/system/libraries/Output.php index f76550e2b..49cfc0a28 100644 --- a/system/libraries/Output.php +++ b/system/libraries/Output.php @@ -1,4 +1,4 @@ -cache_expiration = (! is_numeric($time)) ? 0 : $time; + $this->cache_expiration = ( ! is_numeric($time)) ? 0 : $time; } // -------------------------------------------------------------------- @@ -187,7 +187,7 @@ class CI_Output { $elapsed = $BM->elapsed_time('total_execution_time_start', 'total_execution_time_end'); $output = str_replace('{elapsed_time}', $elapsed, $output); - $memory = (! function_exists('memory_get_usage')) ? '0' : round(memory_get_usage()/1024/1024, 2).'MB'; + $memory = ( ! function_exists('memory_get_usage')) ? '0' : round(memory_get_usage()/1024/1024, 2).'MB'; $output = str_replace('{memory_usage}', $memory, $output); // -------------------------------------------------------------------- @@ -220,7 +220,7 @@ class CI_Output { // Does the get_instance() function exist? // If not we know we are dealing with a cache file so we'll // simply echo out the data and exit. - if (! function_exists('get_instance')) + if ( ! function_exists('get_instance')) { echo $output; log_message('debug', "Final output sent to browser"); @@ -285,7 +285,7 @@ class CI_Output { $cache_path = ($path == '') ? BASEPATH.'cache/' : $path; - if (! is_dir($cache_path) OR ! is_really_writable($cache_path)) + if ( ! is_dir($cache_path) OR ! is_really_writable($cache_path)) { return; } @@ -296,7 +296,7 @@ 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 cache file: ".$cache_path); return; @@ -327,7 +327,7 @@ class CI_Output { $cache_path = ($CFG->item('cache_path') == '') ? BASEPATH.'cache/' : $CFG->item('cache_path'); - if (! is_dir($cache_path) OR ! is_really_writable($cache_path)) + if ( ! is_dir($cache_path) OR ! is_really_writable($cache_path)) { return FALSE; } @@ -339,12 +339,12 @@ class CI_Output { $filepath = $cache_path.md5($uri); - if (! @file_exists($filepath)) + if ( ! @file_exists($filepath)) { return FALSE; } - if (! $fp = @fopen($filepath, 'rb')) + if ( ! $fp = @fopen($filepath, 'rb')) { return FALSE; } @@ -361,7 +361,7 @@ class CI_Output { fclose($fp); // Strip out the embedded timestamp - if (! preg_match("/(\d+TS--->)/", $cache, $match)) + if ( ! preg_match("/(\d+TS--->)/", $cache, $match)) { return FALSE; } @@ -383,6 +383,6 @@ class CI_Output { } // END Output Class - -/* End of file Output.php */ + +/* End of file Output.php */ /* Location: ./system/libraries/Output.php */ \ No newline at end of file diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php index c3f6bd89c..10af3fd11 100644 --- a/system/libraries/Pagination.php +++ b/system/libraries/Pagination.php @@ -1,4 +1,4 @@ -cur_page)) + if ( ! is_numeric($this->cur_page)) { $this->cur_page = 0; } @@ -215,6 +215,6 @@ class CI_Pagination { } } // END Pagination Class - -/* End of file Pagination.php */ + +/* End of file Pagination.php */ /* Location: ./system/libraries/Pagination.php */ \ No newline at end of file diff --git a/system/libraries/Parser.php b/system/libraries/Parser.php index f260b2e19..d349e26d3 100644 --- a/system/libraries/Parser.php +++ b/system/libraries/Parser.php @@ -1,4 +1,4 @@ - $val) { - if (! is_array($val)) + if ( ! is_array($val)) { $temp = $this->_parse_single($key, $val, $temp); } @@ -158,7 +158,7 @@ class CI_Parser { */ function _match_pair($string, $variable) { - if (! preg_match("|".$this->l_delim . $variable . $this->r_delim."(.+)".$this->l_delim . '/' . $variable . $this->r_delim."|s", $string, $match)) + if ( ! preg_match("|".$this->l_delim . $variable . $this->r_delim."(.+)".$this->l_delim . '/' . $variable . $this->r_delim."|s", $string, $match)) { return FALSE; } @@ -168,6 +168,6 @@ class CI_Parser { } // END Parser Class - -/* End of file Parser.php */ + +/* End of file Parser.php */ /* Location: ./system/libraries/Parser.php */ \ No newline at end of file diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php index fe4fb6d62..da1fff19b 100644 --- a/system/libraries/Profiler.php +++ b/system/libraries/Profiler.php @@ -1,4 +1,4 @@ -'; $output .= "\n"; - if (! class_exists('CI_DB_driver')) + if ( ! class_exists('CI_DB_driver')) { $output .= '  '.$this->CI->lang->line('profiler_queries').'  '; $output .= "\n"; @@ -175,7 +175,7 @@ class CI_Profiler { foreach ($_GET as $key => $val) { - if (! is_numeric($key)) + if ( ! is_numeric($key)) { $key = "'".$key."'"; } @@ -225,7 +225,7 @@ class CI_Profiler { foreach ($_POST as $key => $val) { - if (! is_numeric($key)) + if ( ! is_numeric($key)) { $key = "'".$key."'"; } @@ -340,6 +340,6 @@ class CI_Profiler { } // END CI_Profiler class - -/* End of file Profiler.php */ + +/* End of file Profiler.php */ /* Location: ./system/libraries/Profiler.php */ \ No newline at end of file diff --git a/system/libraries/Router.php b/system/libraries/Router.php index 3b2520dce..6e705f842 100644 --- a/system/libraries/Router.php +++ b/system/libraries/Router.php @@ -1,4 +1,4 @@ -routes = (! isset($route) OR ! is_array($route)) ? array() : $route; + $this->routes = ( ! isset($route) OR ! is_array($route)) ? array() : $route; unset($route); // Set the default controller so we can display it in the event // the URI doesn't correlated to a valid controller. - $this->default_controller = (! isset($this->routes['default_controller']) OR $this->routes['default_controller'] == '') ? FALSE : strtolower($this->routes['default_controller']); + $this->default_controller = ( ! isset($this->routes['default_controller']) OR $this->routes['default_controller'] == '') ? FALSE : strtolower($this->routes['default_controller']); // Fetch the complete URI string $this->uri->_fetch_uri_string(); @@ -202,7 +202,7 @@ class CI_Router { if (count($segments) > 0) { // Does the requested controller exist in the sub-folder? - if (! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$segments[0].EXT)) + if ( ! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$segments[0].EXT)) { show_404($this->fetch_directory().$segments[0]); } @@ -213,7 +213,7 @@ class CI_Router { $this->set_method('index'); // Does the default controller exist in the sub-folder? - if (! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$this->default_controller.EXT)) + if ( ! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$this->default_controller.EXT)) { $this->directory = ''; return array(); @@ -374,6 +374,6 @@ class CI_Router { } // END Router Class - -/* End of file Router.php */ + +/* End of file Router.php */ /* Location: ./system/libraries/Router.php */ \ No newline at end of file diff --git a/system/libraries/Session.php b/system/libraries/Session.php index ce1b75e66..31a162e81 100644 --- a/system/libraries/Session.php +++ b/system/libraries/Session.php @@ -1,4 +1,4 @@ -sess_read()) + if ( ! $this->sess_read()) { $this->sess_create(); } @@ -214,7 +214,7 @@ class CI_Session { $session = @unserialize($this->strip_slashes($session)); - if (! is_array($session) OR ! isset($session['last_activity'])) + if ( ! is_array($session) OR ! isset($session['last_activity'])) { log_message('error', 'The session cookie data did not contain a valid array. This could be a possible hacking attempt.'); return FALSE; @@ -439,7 +439,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]; } // -------------------------------------------------------------------- @@ -452,7 +452,7 @@ class CI_Session { */ function all_userdata() { - return (! isset($this->userdata)) ? FALSE : $this->userdata; + return ( ! isset($this->userdata)) ? FALSE : $this->userdata; } // -------------------------------------------------------------------- @@ -649,6 +649,6 @@ class CI_Session { } // END Session Class - -/* End of file Session.php */ + +/* End of file Session.php */ /* Location: ./system/libraries/Session.php */ \ No newline at end of file diff --git a/system/libraries/Sha1.php b/system/libraries/Sha1.php index a7b9b98d3..71b4ccd0d 100644 --- a/system/libraries/Sha1.php +++ b/system/libraries/Sha1.php @@ -1,4 +1,4 @@ -rows as $row) { - if (! is_array($row)) + if ( ! is_array($row)) { break; } @@ -308,7 +308,7 @@ class CI_Table { */ function _set_from_object($query) { - if (! is_object($query)) + if ( ! is_object($query)) { return FALSE; } @@ -316,7 +316,7 @@ class CI_Table { // First generate the headings from the table column names if (count($this->heading) == 0) { - if (! method_exists($query, 'list_fields')) + if ( ! method_exists($query, 'list_fields')) { return FALSE; } @@ -346,7 +346,7 @@ class CI_Table { */ function _set_from_array($data, $set_heading = TRUE) { - if (! is_array($data) OR count($data) == 0) + if ( ! is_array($data) OR count($data) == 0) { return FALSE; } @@ -354,7 +354,7 @@ class CI_Table { $i = 0; foreach ($data as $row) { - if (! is_array($row)) + if ( ! is_array($row)) { $this->rows[] = $data; break; @@ -393,7 +393,7 @@ class CI_Table { $this->temp = $this->_default_template(); foreach (array('table_open','heading_row_start', 'heading_row_end', 'heading_cell_start', 'heading_cell_end', 'row_start', 'row_end', 'cell_start', 'cell_end', 'row_alt_start', 'row_alt_end', 'cell_alt_start', 'cell_alt_end', 'table_close') as $val) { - if (! isset($this->template[$val])) + if ( ! isset($this->template[$val])) { $this->template[$val] = $this->temp[$val]; } @@ -435,6 +435,6 @@ class CI_Table { } - -/* End of file Table.php */ + +/* End of file Table.php */ /* Location: ./system/libraries/Table.php */ \ No newline at end of file diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index 41ac5fca8..6696fd2da 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -1,4 +1,4 @@ -set_error('The send() method must be passed an array'); return FALSE; @@ -65,7 +65,7 @@ class CI_Trackback { // Pre-process the Trackback Data foreach (array('url', 'title', 'excerpt', 'blog_name', 'ping_url') as $item) { - if (! isset($tb_data[$item])) + if ( ! isset($tb_data[$item])) { $this->set_error('Required item missing: '.$item); return FALSE; @@ -102,7 +102,7 @@ class CI_Trackback { } // Build the Trackback data string - $charset = (! isset($tb_data['charset'])) ? $this->charset : $tb_data['charset']; + $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); @@ -139,13 +139,13 @@ class CI_Trackback { { foreach (array('url', 'title', 'blog_name', 'excerpt') as $val) { - if (! isset($_POST[$val]) OR $_POST[$val] == '') + if ( ! isset($_POST[$val]) OR $_POST[$val] == '') { $this->set_error('The following required POST variable is missing: '.$val); return FALSE; } - $this->data['charset'] = (! isset($_POST['charset'])) ? 'auto' : strtoupper(trim($_POST['charset'])); + $this->data['charset'] = ( ! isset($_POST['charset'])) ? 'auto' : strtoupper(trim($_POST['charset'])); if ($val != 'url' && function_exists('mb_convert_encoding')) { @@ -212,7 +212,7 @@ class CI_Trackback { */ function data($item) { - return (! isset($this->data[$item])) ? '' : $this->data[$item]; + return ( ! isset($this->data[$item])) ? '' : $this->data[$item]; } // -------------------------------------------------------------------- @@ -233,14 +233,14 @@ class CI_Trackback { $target = parse_url($url); // Open the socket - if (! $fp = @fsockopen($target['host'], 80)) + if ( ! $fp = @fsockopen($target['host'], 80)) { $this->set_error('Invalid Connection: '.$url); return FALSE; } // Build the path - $ppath = (! isset($target['path'])) ? $url : $target['path']; + $ppath = ( ! isset($target['path'])) ? $url : $target['path']; $path = (isset($target['query']) && $target['query'] != "") ? $ppath.'?'.$target['query'] : $ppath; @@ -261,13 +261,13 @@ class CI_Trackback { // Was it successful? $this->response = ""; - while(!feof($fp)) + while( ! feof($fp)) { $this->response .= fgets($fp, 128); } @fclose($fp); - if (! eregi("0", $this->response)) + if ( ! eregi("0", $this->response)) { $message = 'An unknown error was encountered'; @@ -360,7 +360,7 @@ class CI_Trackback { $tb_array = explode('/', $url); $tb_end = $tb_array[count($tb_array)-1]; - if (! is_numeric($tb_end)) + if ( ! is_numeric($tb_end)) { $tb_end = $tb_array[count($tb_array)-2]; } @@ -378,13 +378,13 @@ class CI_Trackback { $tb_array = explode('/', $url); $tb_id = $tb_array[count($tb_array)-1]; - if (! is_numeric($tb_id)) + if ( ! is_numeric($tb_id)) { $tb_id = $tb_array[count($tb_array)-2]; } } - if (! preg_match ("/^([0-9]+)$/", $tb_id)) + if ( ! preg_match ("/^([0-9]+)$/", $tb_id)) { return false; } @@ -439,8 +439,8 @@ class CI_Trackback { { return $str; } - - $str = preg_replace("/\s+/", ' ', preg_replace("/(\r\n|\r|\n)/", " ", $str)); + + $str = preg_replace("/\s+/", ' ', str_replace(array("\r\n", "\r", "\n"), ' ', $str)); if (strlen($str) <= $n) { @@ -545,6 +545,6 @@ class CI_Trackback { } // END Trackback Class - -/* End of file Trackback.php */ + +/* End of file Trackback.php */ /* Location: ./system/libraries/Trackback.php */ \ No newline at end of file diff --git a/system/libraries/URI.php b/system/libraries/URI.php index 26a7b4a33..4d0cd9c17 100644 --- a/system/libraries/URI.php +++ b/system/libraries/URI.php @@ -1,4 +1,4 @@ -config->item('permitted_uri_chars') != '') { - if (! preg_match("|^[".preg_quote($this->config->item('permitted_uri_chars'))."]+$|i", $str)) + if ( ! preg_match("|^[".preg_quote($this->config->item('permitted_uri_chars'))."]+$|i", $str)) { exit('The URI you submitted has disallowed characters.'); } @@ -279,7 +279,7 @@ class CI_URI { */ function segment($n, $no_result = FALSE) { - return (! isset($this->segments[$n])) ? $no_result : $this->segments[$n]; + return ( ! isset($this->segments[$n])) ? $no_result : $this->segments[$n]; } // -------------------------------------------------------------------- @@ -298,7 +298,7 @@ class CI_URI { */ function rsegment($n, $no_result = FALSE) { - return (! isset($this->rsegments[$n])) ? $no_result : $this->rsegments[$n]; + return ( ! isset($this->rsegments[$n])) ? $no_result : $this->rsegments[$n]; } // -------------------------------------------------------------------- @@ -361,7 +361,7 @@ class CI_URI { $segment_array = 'rsegment_array'; } - if (! is_numeric($n)) + if ( ! is_numeric($n)) { return $default; } @@ -410,7 +410,7 @@ class CI_URI { { foreach ($default as $val) { - if (! array_key_exists($val, $retval)) + if ( ! array_key_exists($val, $retval)) { $retval[$val] = FALSE; } @@ -586,6 +586,6 @@ class CI_URI { } // END URI Class - -/* End of file URI.php */ + +/* End of file URI.php */ /* Location: ./system/libraries/URI.php */ \ No newline at end of file diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index bfa6d5dc5..e53e04c15 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -1,4 +1,4 @@ - $file, 'line' => $line); } @@ -302,7 +302,7 @@ class CI_Unit_test { */ function _parse_template() { - if (! is_null($this->_template_rows)) + if ( ! is_null($this->_template_rows)) { return; } @@ -313,7 +313,7 @@ class CI_Unit_test { return; } - if (! preg_match("/\{rows\}(.*?)\{\/rows\}/si", $this->_template, $match)) + if ( ! preg_match("/\{rows\}(.*?)\{\/rows\}/si", $this->_template, $match)) { $this->_default_template(); return; diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index 07cbd924b..1225ee36b 100644 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -1,4 +1,4 @@ -set_error('upload_no_file_selected'); return FALSE; } // Is the upload path valid? - if (! $this->validate_upload_path()) + if ( ! $this->validate_upload_path()) { // errors will already be set by validate_upload_path() so just return FALSE return FALSE; } // Was the file able to be uploaded? If not, determine the reason why. - if (! is_uploaded_file($_FILES[$field]['tmp_name'])) + if ( ! is_uploaded_file($_FILES[$field]['tmp_name'])) { - $error = (! isset($_FILES[$field]['error'])) ? 4 : $_FILES[$field]['error']; + $error = ( ! isset($_FILES[$field]['error'])) ? 4 : $_FILES[$field]['error']; switch($error) { @@ -198,14 +198,14 @@ 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; @@ -213,7 +213,7 @@ class CI_Upload { // 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; @@ -253,9 +253,9 @@ class CI_Upload { * we'll use move_uploaded_file(). One of the two should * reliably work in most environments */ - if (! @copy($this->file_temp, $this->upload_path.$this->file_name)) + if ( ! @copy($this->file_temp, $this->upload_path.$this->file_name)) { - if (! @move_uploaded_file($this->file_temp, $this->upload_path.$this->file_name)) + if ( ! @move_uploaded_file($this->file_temp, $this->upload_path.$this->file_name)) { $this->set_error('upload_destination_error'); return FALSE; @@ -350,7 +350,7 @@ class CI_Upload { $filename = md5(uniqid(mt_rand())).$this->file_ext; } - if (! file_exists($path.$filename)) + if ( ! file_exists($path.$filename)) { return $filename; } @@ -360,7 +360,7 @@ class CI_Upload { $new_filename = ''; for ($i = 1; $i < 100; $i++) { - if (! file_exists($path.$filename.$i.$this->file_ext)) + if ( ! file_exists($path.$filename.$i.$this->file_ext)) { $new_filename = $filename.$i.$this->file_ext; break; @@ -389,7 +389,7 @@ class CI_Upload { */ function set_max_filesize($n) { - $this->max_size = (! eregi("^[[:digit:]]+$", $n)) ? 0 : $n; + $this->max_size = ( ! eregi("^[[:digit:]]+$", $n)) ? 0 : $n; } // -------------------------------------------------------------------- @@ -403,7 +403,7 @@ class CI_Upload { */ function set_max_width($n) { - $this->max_width = (! eregi("^[[:digit:]]+$", $n)) ? 0 : $n; + $this->max_width = ( ! eregi("^[[:digit:]]+$", $n)) ? 0 : $n; } // -------------------------------------------------------------------- @@ -417,7 +417,7 @@ class CI_Upload { */ function set_max_height($n) { - $this->max_height = (! eregi("^[[:digit:]]+$", $n)) ? 0 : $n; + $this->max_height = ( ! eregi("^[[:digit:]]+$", $n)) ? 0 : $n; } // -------------------------------------------------------------------- @@ -447,7 +447,7 @@ class CI_Upload { */ function set_image_properties($path = '') { - if (! $this->is_image()) + if ( ! $this->is_image()) { return; } @@ -460,7 +460,7 @@ class CI_Upload { $this->image_width = $D['0']; $this->image_height = $D['1']; - $this->image_type = (! isset($types[$D['2']])) ? 'unknown' : $types[$D['2']]; + $this->image_type = ( ! isset($types[$D['2']])) ? 'unknown' : $types[$D['2']]; $this->image_size_str = $D['3']; // string containing height and width } } @@ -528,7 +528,7 @@ class CI_Upload { */ function is_allowed_filetype() { - if (count($this->allowed_types) == 0 || ! is_array($this->allowed_types)) + if (count($this->allowed_types) == 0 OR ! is_array($this->allowed_types)) { $this->set_error('upload_no_file_types'); return FALSE; @@ -587,7 +587,7 @@ class CI_Upload { */ function is_allowed_dimensions() { - if (! $this->is_image()) + if ( ! $this->is_image()) { return TRUE; } @@ -636,13 +636,13 @@ class CI_Upload { $this->upload_path = str_replace("\\", "/", realpath($this->upload_path)); } - if (! @is_dir($this->upload_path)) + if ( ! @is_dir($this->upload_path)) { $this->set_error('upload_no_filepath'); return FALSE; } - if (! is_really_writable($this->upload_path)) + if ( ! is_really_writable($this->upload_path)) { $this->set_error('upload_not_writable'); return FALSE; @@ -741,7 +741,7 @@ class CI_Upload { return FALSE; } - if (! $fp = @fopen($file, FOPEN_READ_WRITE)) + if ( ! $fp = @fopen($file, FOPEN_READ_WRITE)) { return FALSE; } @@ -830,7 +830,7 @@ class CI_Upload { } } - return (! isset($this->mimes[$mime])) ? FALSE : $this->mimes[$mime]; + return ( ! isset($this->mimes[$mime])) ? FALSE : $this->mimes[$mime]; } /** @@ -875,6 +875,6 @@ class CI_Upload { } // END Upload Class - -/* End of file Upload.php */ + +/* End of file Upload.php */ /* Location: ./system/libraries/Upload.php */ \ No newline at end of file diff --git a/system/libraries/User_agent.php b/system/libraries/User_agent.php index ee1839277..86b249ccd 100644 --- a/system/libraries/User_agent.php +++ b/system/libraries/User_agent.php @@ -1,4 +1,4 @@ -agent = trim($_SERVER['HTTP_USER_AGENT']); } - if (! is_null($this->agent)) + if ( ! is_null($this->agent)) { if ($this->_load_agent_file()) { @@ -84,7 +84,7 @@ class CI_User_agent { */ function _load_agent_file() { - if (! @include(APPPATH.'config/user_agents'.EXT)) + if ( ! @include(APPPATH.'config/user_agents'.EXT)) { return FALSE; } @@ -339,7 +339,7 @@ class CI_User_agent { */ function is_referral() { - return (! isset($_SERVER['HTTP_REFERER']) OR $_SERVER['HTTP_REFERER'] == '') ? FALSE : TRUE; + return ( ! isset($_SERVER['HTTP_REFERER']) OR $_SERVER['HTTP_REFERER'] == '') ? FALSE : TRUE; } // -------------------------------------------------------------------- @@ -429,7 +429,7 @@ class CI_User_agent { */ function referrer() { - return (! isset($_SERVER['HTTP_REFERER']) OR $_SERVER['HTTP_REFERER'] == '') ? '' : trim($_SERVER['HTTP_REFERER']); + return ( ! isset($_SERVER['HTTP_REFERER']) OR $_SERVER['HTTP_REFERER'] == '') ? '' : trim($_SERVER['HTTP_REFERER']); } // -------------------------------------------------------------------- @@ -497,6 +497,6 @@ class CI_User_agent { } - -/* End of file User_agent.php */ + +/* End of file User_agent.php */ /* Location: ./system/libraries/User_agent.php */ \ No newline at end of file diff --git a/system/libraries/Validation.php b/system/libraries/Validation.php index a0f038c02..9654b4f4e 100644 --- a/system/libraries/Validation.php +++ b/system/libraries/Validation.php @@ -1,4 +1,4 @@ - $field); } @@ -87,10 +87,10 @@ class CI_Validation { foreach($this->_fields as $key => $val) { - $this->$key = (! isset($_POST[$key])) ? '' : $this->prep_for_form($_POST[$key]); + $this->$key = ( ! isset($_POST[$key])) ? '' : $this->prep_for_form($_POST[$key]); $error = $key.'_error'; - if (! isset($this->$error)) + if ( ! isset($this->$error)) { $this->$error = ''; } @@ -112,7 +112,7 @@ class CI_Validation { */ function set_rules($data, $rules = '') { - if (! is_array($data)) + if ( ! is_array($data)) { if ($rules == '') return; @@ -141,7 +141,7 @@ class CI_Validation { */ function set_message($lang, $val = '') { - if (! is_array($lang)) + if ( ! is_array($lang)) { $lang = array($lang => $val); } @@ -195,9 +195,9 @@ class CI_Validation { $ex = explode('|', $rules); // Is the field required? If not, if the field is blank we'll move on to the next test - if (! in_array('required', $ex, TRUE)) + if ( ! in_array('required', $ex, TRUE)) { - if (! isset($_POST[$field]) OR $_POST[$field] == '') + if ( ! isset($_POST[$field]) OR $_POST[$field] == '') { continue; } @@ -212,11 +212,11 @@ class CI_Validation { * test for it here since there's not reason to go * further */ - if (! isset($_POST[$field])) + if ( ! isset($_POST[$field])) { 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'))) { @@ -229,7 +229,7 @@ class CI_Validation { } // Build the error message - $mfield = (! isset($this->_fields[$field])) ? $field : $this->_fields[$field]; + $mfield = ( ! isset($this->_fields[$field])) ? $field : $this->_fields[$field]; $message = sprintf($line, $mfield); // Set the error variable. Example: $this->username_error @@ -274,7 +274,7 @@ class CI_Validation { // Call the function that corresponds to the rule if ($callback === TRUE) { - if (! method_exists($this->CI, $rule)) + if ( ! method_exists($this->CI, $rule)) { continue; } @@ -282,7 +282,7 @@ class CI_Validation { $result = $this->CI->$rule($_POST[$field], $param); // If the field isn't required and we just processed a callback we'll move on... - if (! in_array('required', $ex, TRUE) AND $result !== FALSE) + if ( ! in_array('required', $ex, TRUE) AND $result !== FALSE) { continue 2; } @@ -290,7 +290,7 @@ class CI_Validation { } else { - if (! method_exists($this, $rule)) + if ( ! method_exists($this, $rule)) { /* * Run the native PHP function if called for @@ -314,7 +314,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))) { @@ -327,8 +327,8 @@ class CI_Validation { } // Build the error message - $mfield = (! isset($this->_fields[$field])) ? $field : $this->_fields[$field]; - $mparam = (! isset($this->_fields[$param])) ? $param : $this->_fields[$param]; + $mfield = ( ! isset($this->_fields[$field])) ? $field : $this->_fields[$field]; + $mparam = ( ! isset($this->_fields[$param])) ? $param : $this->_fields[$param]; $message = sprintf($line, $mfield, $mparam); // Set the error variable. Example: $this->username_error @@ -385,13 +385,13 @@ class CI_Validation { */ function required($str) { - if (! is_array($str)) + if ( ! is_array($str)) { return (trim($str) == '') ? FALSE : TRUE; } else { - return (! empty($str)); + return ( ! empty($str)); } } @@ -406,7 +406,7 @@ class CI_Validation { */ function matches($str, $field) { - if (! isset($_POST[$field])) + if ( ! isset($_POST[$field])) { return FALSE; } @@ -482,7 +482,7 @@ class CI_Validation { */ function valid_email($str) { - return (! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $str)) ? FALSE : TRUE; + return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $str)) ? FALSE : TRUE; } // -------------------------------------------------------------------- @@ -537,7 +537,7 @@ class CI_Validation { */ function alpha($str) { - return (! preg_match("/^([a-z])+$/i", $str)) ? FALSE : TRUE; + return ( ! preg_match("/^([a-z])+$/i", $str)) ? FALSE : TRUE; } // -------------------------------------------------------------------- @@ -551,7 +551,7 @@ class CI_Validation { */ function alpha_numeric($str) { - return (! preg_match("/^([a-z0-9])+$/i", $str)) ? FALSE : TRUE; + return ( ! preg_match("/^([a-z0-9])+$/i", $str)) ? FALSE : TRUE; } // -------------------------------------------------------------------- @@ -565,7 +565,7 @@ class CI_Validation { */ function alpha_dash($str) { - return (! preg_match("/^([-a-z0-9_-])+$/i", $str)) ? FALSE : TRUE; + return ( ! preg_match("/^([-a-z0-9_-])+$/i", $str)) ? FALSE : TRUE; } // -------------------------------------------------------------------- @@ -594,7 +594,7 @@ class CI_Validation { */ function is_numeric($str) { - return (! is_numeric($str)) ? FALSE : TRUE; + return ( ! is_numeric($str)) ? FALSE : TRUE; } // -------------------------------------------------------------------- diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php index 32d739689..1748ab833 100644 --- a/system/libraries/Xmlrpc.php +++ b/system/libraries/Xmlrpc.php @@ -1,4 +1,4 @@ -client) && is_int($seconds)) + if ( ! is_null($this->client) && is_int($seconds)) { $this->client->timeout = $seconds; } @@ -199,7 +199,7 @@ class CI_Xmlrpc { function request($incoming) { - if (! is_array($incoming)) + if ( ! is_array($incoming)) { // Send Error } @@ -231,7 +231,7 @@ class CI_Xmlrpc { { if (is_array($value) && isset($value['0'])) { - if (! isset($value['1']) OR ! isset($this->xmlrpcTypes[strtolower($value['1'])])) + if ( ! isset($value['1']) OR ! isset($this->xmlrpcTypes[strtolower($value['1'])])) { if (is_array($value[0])) { @@ -275,12 +275,12 @@ class CI_Xmlrpc { $this->message = new XML_RPC_Message($this->method,$this->data); $this->message->debug = $this->debug; - if (! $this->result = $this->client->send($this->message)) + if ( ! $this->result = $this->client->send($this->message)) { $this->error = $this->result->errstr; return FALSE; } - elseif(! is_object($this->result->val)) + elseif( ! is_object($this->result->val)) { $this->error = $this->result->errstr; return FALSE; @@ -384,7 +384,7 @@ class XML_RPC_Client extends CI_Xmlrpc { $fp = @fsockopen($this->server, $this->port,$this->errno, $this->errstr, $this->timeout); - if (! is_resource($fp)) + if ( ! is_resource($fp)) { error_log($this->xmlrpcstr['http_error']); $r = new XML_RPC_Response(0, $this->xmlrpcerr['http_error'],$this->xmlrpcstr['http_error']); @@ -406,7 +406,7 @@ class XML_RPC_Client extends CI_Xmlrpc $op .= $msg->payload; - if (!fputs($fp, $op, strlen($op))) + if ( ! fputs($fp, $op, strlen($op))) { error_log($this->xmlrpcstr['http_error']); $r = new XML_RPC_Response(0, $this->xmlrpcerr['http_error'], $this->xmlrpcstr['http_error']); @@ -442,7 +442,7 @@ class XML_RPC_Response $this->errno = $code; $this->errstr = htmlentities($fstr); } - else if (!is_object($val)) + else if ( ! is_object($val)) { // programmer error, not an object error_log("Invalid type '" . gettype($val) . "' (value: $val) passed to XML_RPC_Response. Defaulting to empty value."); @@ -737,7 +737,7 @@ class XML_RPC_Message extends CI_Xmlrpc // PARSE XML DATA //------------------------------------- - if (!xml_parse($parser, $data, sizeof($data))) + if ( ! xml_parse($parser, $data, sizeof($data))) { $errstr = sprintf('XML error: %s at line %d', xml_error_string(xml_get_error_code($parser)), @@ -765,7 +765,7 @@ class XML_RPC_Message extends CI_Xmlrpc $r = new XML_RPC_Response(0, $this->xmlrpcerr['invalid_return'],$this->xmlrpcstr['invalid_return'].' '.$this->xh[$parser]['isf_reason']); return $r; } - elseif (! is_object($this->xh[$parser]['value'])) + elseif ( ! is_object($this->xh[$parser]['value'])) { $r = new XML_RPC_Response(0, $this->xmlrpcerr['invalid_return'],$this->xmlrpcstr['invalid_return'].' '.$this->xh[$parser]['isf_reason']); return $r; @@ -862,7 +862,7 @@ class XML_RPC_Message extends CI_Xmlrpc else { // not top level element: see if parent is OK - if (!in_array($this->xh[$the_parser]['stack'][0], $this->valid_parents[$name], TRUE)) + if ( ! in_array($this->xh[$the_parser]['stack'][0], $this->valid_parents[$name], TRUE)) { $this->xh[$the_parser]['isf'] = 2; $this->xh[$the_parser]['isf_reason'] = "XML-RPC element $name cannot be child of ".$this->xh[$the_parser]['stack'][0]; @@ -961,7 +961,7 @@ class XML_RPC_Message extends CI_Xmlrpc case 'STRUCT': case 'ARRAY': $cur_val = array_shift($this->xh[$the_parser]['valuestack']); - $this->xh[$the_parser]['value'] = (! isset($cur_val['values'])) ? array() : $cur_val['values']; + $this->xh[$the_parser]['value'] = ( ! isset($cur_val['values'])) ? array() : $cur_val['values']; $this->xh[$the_parser]['vt'] = strtolower($name); break; case 'NAME': @@ -1005,7 +1005,7 @@ class XML_RPC_Message extends CI_Xmlrpc { // we have a DOUBLE // we must check that only 0123456789-. are characters here - if (! preg_match('/^[+-]?[eE0-9\t \.]+$/', $this->xh[$the_parser]['ac'])) + if ( ! preg_match('/^[+-]?[eE0-9\t \.]+$/', $this->xh[$the_parser]['ac'])) { $this->xh[$the_parser]['value'] = 'ERROR_NON_NUMERIC_FOUND'; } @@ -1018,7 +1018,7 @@ class XML_RPC_Message extends CI_Xmlrpc { // we have an I4/INT // we must check that only 0123456789- are characters here - if (! preg_match('/^[+-]?[0-9\t ]+$/', $this->xh[$the_parser]['ac'])) + if ( ! preg_match('/^[+-]?[0-9\t ]+$/', $this->xh[$the_parser]['ac'])) { $this->xh[$the_parser]['value'] = 'ERROR_NON_NUMERIC_FOUND'; } @@ -1101,7 +1101,7 @@ class XML_RPC_Message extends CI_Xmlrpc $this->xh[$the_parser]['lv'] = 2; // Found a value } - if(! @isset($this->xh[$the_parser]['ac'])) + if( ! @isset($this->xh[$the_parser]['ac'])) { $this->xh[$the_parser]['ac'] = ''; } @@ -1213,7 +1213,7 @@ class XML_RPC_Values extends CI_Xmlrpc { parent::CI_Xmlrpc(); - if ($val != -1 || $type != '') + if ($val != -1 OR $type != '') { $type = $type == '' ? 'string' : $type; @@ -1250,7 +1250,7 @@ class XML_RPC_Values extends CI_Xmlrpc if ($type == $this->xmlrpcBoolean) { - if (strcasecmp($val,'true')==0 || $val==1 || ($val==true && strcasecmp($val,'false'))) + if (strcasecmp($val,'true')==0 OR $val==1 OR ($val==true && strcasecmp($val,'false'))) { $val = 1; } diff --git a/system/libraries/Xmlrpcs.php b/system/libraries/Xmlrpcs.php index 754b8ae26..a9cf19d2c 100644 --- a/system/libraries/Xmlrpcs.php +++ b/system/libraries/Xmlrpcs.php @@ -1,4 +1,4 @@ -methods[$methName]['function'])) + if ( ! isset($this->methods[$methName]['function'])) { return new XML_RPC_Response(0, $this->xmlrpcerr['unknown_method'], $this->xmlrpcstr['unknown_method']); } @@ -265,18 +265,18 @@ class CI_Xmlrpcs extends CI_Xmlrpc if ($system_call === TRUE) { - if (! is_callable(array($this,$method_parts['1']))) + if ( ! is_callable(array($this,$method_parts['1']))) { return new XML_RPC_Response(0, $this->xmlrpcerr['unknown_method'], $this->xmlrpcstr['unknown_method']); } } else { - if ($objectCall && !is_callable(array($method_parts['0'],$method_parts['1']))) + if ($objectCall && ! is_callable(array($method_parts['0'],$method_parts['1']))) { return new XML_RPC_Response(0, $this->xmlrpcerr['unknown_method'], $this->xmlrpcstr['unknown_method']); } - elseif (!$objectCall && !is_callable($this->methods[$methName]['function'])) + elseif ( ! $objectCall && ! is_callable($this->methods[$methName]['function'])) { return new XML_RPC_Response(0, $this->xmlrpcerr['unknown_method'], $this->xmlrpcstr['unknown_method']); } @@ -494,17 +494,17 @@ class CI_Xmlrpcs extends CI_Xmlrpc { if ($call->kindOf() != 'struct') return $this->multicall_error('notstruct'); - elseif (!$methName = $call->me['struct']['methodName']) + elseif ( ! $methName = $call->me['struct']['methodName']) return $this->multicall_error('nomethod'); 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' OR $scalar_type != 'string') return $this->multicall_error('notstring'); elseif ($scalar_value == 'system.multicall') return $this->multicall_error('recursion'); - elseif (!$params = $call->me['struct']['params']) + elseif ( ! $params = $call->me['struct']['params']) return $this->multicall_error('noparams'); elseif ($params->kindOf() != 'array') return $this->multicall_error('notarray'); @@ -531,6 +531,6 @@ class CI_Xmlrpcs extends CI_Xmlrpc } // END XML_RPC_Server class - -/* End of file Xmlrpcs.php */ + +/* End of file Xmlrpcs.php */ /* Location: ./system/libraries/Xmlrpcs.php */ \ No newline at end of file diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php index 5a24e4057..97695a07f 100644 --- a/system/libraries/Zip.php +++ b/system/libraries/Zip.php @@ -1,4 +1,4 @@ -