summaryrefslogtreecommitdiffstats
path: root/system/libraries
diff options
context:
space:
mode:
authorJonathon Hill <jhill@brandmovers.com>2012-11-12 14:51:41 +0100
committerJonathon Hill <jhill@brandmovers.com>2012-11-12 14:51:41 +0100
commit3978fc33d82dd7f778d1adbf30744f4dfac41c25 (patch)
treef32be1ae610f0cfeff65c35abecd14e8ea5cadc6 /system/libraries
parent275cf274860c6ed181d50b398efd3a21d7ba9135 (diff)
parenta9ab46d7a031bda304eb9b6658ffaf693b8d9bcb (diff)
Merge remote-tracking branch 'upstream/develop' into develop
Conflicts: user_guide_src/source/changelog.rst Signed-off-by: Jonathon Hill <jhill@brandmovers.com>
Diffstat (limited to 'system/libraries')
-rw-r--r--system/libraries/Cache/Cache.php5
-rw-r--r--system/libraries/Cache/drivers/Cache_apc.php5
-rw-r--r--system/libraries/Cache/drivers/Cache_dummy.php5
-rw-r--r--system/libraries/Cache/drivers/Cache_file.php5
-rw-r--r--system/libraries/Cache/drivers/Cache_memcached.php5
-rw-r--r--system/libraries/Cache/drivers/Cache_redis.php5
-rw-r--r--system/libraries/Cache/drivers/Cache_wincache.php5
-rw-r--r--system/libraries/Calendar.php3
-rw-r--r--system/libraries/Cart.php20
-rw-r--r--system/libraries/Driver.php3
-rw-r--r--system/libraries/Email.php343
-rw-r--r--system/libraries/Encrypt.php3
-rw-r--r--system/libraries/Form_validation.php24
-rw-r--r--system/libraries/Ftp.php106
-rw-r--r--system/libraries/Image_lib.php17
-rw-r--r--system/libraries/Javascript.php20
-rw-r--r--system/libraries/Log.php180
-rw-r--r--system/libraries/Migration.php3
-rw-r--r--system/libraries/Pagination.php298
-rw-r--r--system/libraries/Parser.php3
-rw-r--r--system/libraries/Profiler.php34
-rwxr-xr-xsystem/libraries/Session/Session.php36
-rwxr-xr-xsystem/libraries/Session/drivers/Session_cookie.php41
-rwxr-xr-xsystem/libraries/Session/drivers/Session_native.php5
-rw-r--r--system/libraries/Table.php3
-rw-r--r--system/libraries/Trackback.php44
-rw-r--r--system/libraries/Typography.php3
-rw-r--r--system/libraries/Unit_test.php85
-rw-r--r--system/libraries/Upload.php243
-rw-r--r--system/libraries/User_agent.php3
-rwxr-xr-xsystem/libraries/Xmlrpc.php372
-rw-r--r--system/libraries/Xmlrpcs.php3
-rw-r--r--system/libraries/Zip.php3
-rw-r--r--system/libraries/javascript/Jquery.php97
34 files changed, 1535 insertions, 495 deletions
diff --git a/system/libraries/Cache/Cache.php b/system/libraries/Cache/Cache.php
index 7ec2380a5..e76fdc557 100644
--- a/system/libraries/Cache/Cache.php
+++ b/system/libraries/Cache/Cache.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -18,12 +18,13 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2006 - 2012 EllisLab, Inc.
+ * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 2.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter Caching Class
diff --git a/system/libraries/Cache/drivers/Cache_apc.php b/system/libraries/Cache/drivers/Cache_apc.php
index c85034f95..46e633463 100644
--- a/system/libraries/Cache/drivers/Cache_apc.php
+++ b/system/libraries/Cache/drivers/Cache_apc.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -18,12 +18,13 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2006 - 2012 EllisLab, Inc.
+ * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 2.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter APC Caching Class
diff --git a/system/libraries/Cache/drivers/Cache_dummy.php b/system/libraries/Cache/drivers/Cache_dummy.php
index 3f2b4b956..a3bdc3c80 100644
--- a/system/libraries/Cache/drivers/Cache_dummy.php
+++ b/system/libraries/Cache/drivers/Cache_dummy.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -18,12 +18,13 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2006 - 2012 EllisLab, Inc.
+ * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 2.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter Dummy Caching Class
diff --git a/system/libraries/Cache/drivers/Cache_file.php b/system/libraries/Cache/drivers/Cache_file.php
index 37d77c268..5d370380e 100644
--- a/system/libraries/Cache/drivers/Cache_file.php
+++ b/system/libraries/Cache/drivers/Cache_file.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -18,12 +18,13 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2006 - 2012 EllisLab, Inc.
+ * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 2.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter File Caching Class
diff --git a/system/libraries/Cache/drivers/Cache_memcached.php b/system/libraries/Cache/drivers/Cache_memcached.php
index bf90f6197..fae002347 100644
--- a/system/libraries/Cache/drivers/Cache_memcached.php
+++ b/system/libraries/Cache/drivers/Cache_memcached.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -18,12 +18,13 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2006 - 2012 EllisLab, Inc.
+ * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 2.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter Memcached Caching Class
diff --git a/system/libraries/Cache/drivers/Cache_redis.php b/system/libraries/Cache/drivers/Cache_redis.php
index e4a26b5f0..60033344b 100644
--- a/system/libraries/Cache/drivers/Cache_redis.php
+++ b/system/libraries/Cache/drivers/Cache_redis.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -18,12 +18,13 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2006 - 2012 EllisLab, Inc.
+ * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 3.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter Redis Caching Class
diff --git a/system/libraries/Cache/drivers/Cache_wincache.php b/system/libraries/Cache/drivers/Cache_wincache.php
index 89e9f77c8..383b3afdd 100644
--- a/system/libraries/Cache/drivers/Cache_wincache.php
+++ b/system/libraries/Cache/drivers/Cache_wincache.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -18,12 +18,13 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2006 - 2012 EllisLab, Inc.
+ * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 3.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter Wincache Caching Class
diff --git a/system/libraries/Calendar.php b/system/libraries/Calendar.php
index 95f537e42..caa496a5e 100644
--- a/system/libraries/Calendar.php
+++ b/system/libraries/Calendar.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter Calendar Class
diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php
index d4b17fa36..035a6a42b 100644
--- a/system/libraries/Cart.php
+++ b/system/libraries/Cart.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Shopping Cart Class
@@ -193,7 +194,7 @@ class CI_Cart {
$items['qty'] = (float) $items['qty'];
// If the quantity is zero or blank there's nothing for us to do
- if ( ! is_numeric($items['qty']) OR $items['qty'] == 0)
+ if ($items['qty'] == 0)
{
return FALSE;
}
@@ -224,15 +225,6 @@ class CI_Cart {
// Prep the price. Remove leading zeros and anything that isn't a number or decimal point.
$items['price'] = (float) $items['price'];
- // Is the price a valid number?
- if ( ! is_numeric($items['price']))
- {
- log_message('error', 'An invalid price was submitted for product ID: '.$items['id']);
- return FALSE;
- }
-
- // --------------------------------------------------------------------
-
// We now need to create a unique identifier for the item being inserted into the cart.
// Every time something is added to the cart it is stored in the master cart array.
// Each row in the cart array, however, must have a unique index that identifies not only
@@ -350,12 +342,6 @@ class CI_Cart {
// Prep the quantity
$items['qty'] = (float) $items['qty'];
- // Is the quantity a number?
- if ( ! is_numeric($items['qty']))
- {
- return FALSE;
- }
-
// Is the quantity zero? If so we will remove the item from the cart.
// If the quantity is greater than zero we are updating
if ($items['qty'] == 0)
diff --git a/system/libraries/Driver.php b/system/libraries/Driver.php
index 5d642b982..621d22631 100644
--- a/system/libraries/Driver.php
+++ b/system/libraries/Driver.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter Driver Library Class
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index 7280466a5..d23be1af1 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter Email Class
@@ -38,55 +39,340 @@
*/
class CI_Email {
+ /**
+ * Used as the User-Agent and X-Mailer headers' value.
+ *
+ * @var string
+ */
public $useragent = 'CodeIgniter';
+
+ /**
+ * Path to the Sendmail binary.
+ *
+ * @var string
+ */
public $mailpath = '/usr/sbin/sendmail'; // Sendmail path
+
+ /**
+ * Which method to use for sending e-mails.
+ *
+ * @var string 'mail', 'sendmail' or 'smtp'
+ */
public $protocol = 'mail'; // mail/sendmail/smtp
- public $smtp_host = ''; // SMTP Server. Example: mail.earthlink.net
- public $smtp_user = ''; // SMTP Username
- public $smtp_pass = ''; // SMTP Password
- public $smtp_port = 25; // SMTP Port
- public $smtp_timeout = 5; // SMTP Timeout in seconds
- public $smtp_crypto = ''; // SMTP Encryption. Can be null, tls or ssl.
- public $wordwrap = TRUE; // TRUE/FALSE - Turns word-wrap on/off
- public $wrapchars = 76; // Number of characters to wrap at.
- public $mailtype = 'text'; // text/html - Defines email formatting
- public $charset = 'utf-8'; // Default char set: iso-8859-1 or us-ascii
+
+ /**
+ * STMP Server host
+ *
+ * @var string
+ */
+ public $smtp_host = '';
+
+ /**
+ * SMTP Username
+ *
+ * @var string
+ */
+ public $smtp_user = '';
+
+ /**
+ * SMTP Password
+ *
+ * @var string
+ */
+ public $smtp_pass = '';
+
+ /**
+ * SMTP Server port
+ *
+ * @var int
+ */
+ public $smtp_port = 25;
+
+ /**
+ * SMTP connection timeout in seconds
+ *
+ * @var int
+ */
+ public $smtp_timeout = 5;
+
+ /**
+ * SMTP Encryption
+ *
+ * @var string NULL, 'tls' or 'ssl'
+ */
+ public $smtp_crypto = NULL;
+
+ /**
+ * Whether to apply word-wrapping to the message body.
+ *
+ * @var bool
+ */
+ public $wordwrap = TRUE;
+
+ /**
+ * Number of characters to wrap at.
+ *
+ * @see CI_Email::$wordwrap
+ * @var int
+ */
+ public $wrapchars = 76;
+
+ /**
+ * Message format.
+ *
+ * @var string 'text' or 'html'
+ */
+ public $mailtype = 'text';
+
+ /**
+ * Character set (default: utf-8)
+ *
+ * @var string
+ */
+ public $charset = 'utf-8';
+
+ /**
+ * Multipart message
+ *
+ * @var string 'mixed' (in the body) or 'related' (separate)
+ */
public $multipart = 'mixed'; // "mixed" (in the body) or "related" (separate)
- public $alt_message = ''; // Alternative message for HTML emails
- public $validate = FALSE; // TRUE/FALSE - Enables email validation
+
+ /**
+ * Alternative message (for HTML messages only)
+ *
+ * @var string
+ */
+ public $alt_message = '';
+
+ /**
+ * Whether to validate e-mail addresses.
+ *
+ * @var bool
+ */
+ public $validate = FALSE;
+
+ /**
+ * X-Priority header value.
+ *
+ * @var int 1-5
+ */
public $priority = 3; // Default priority (1 - 5)
+
+ /**
+ * Newline character sequence.
+ * Use "\r\n" to comply with RFC 822.
+ *
+ * @link http://www.ietf.org/rfc/rfc822.txt
+ * @var string "\r\n" or "\n"
+ */
public $newline = "\n"; // Default newline. "\r\n" or "\n" (Use "\r\n" to comply with RFC 822)
- public $crlf = "\n"; // The RFC 2045 compliant CRLF for quoted-printable is "\r\n". Apparently some servers,
- // even on the receiving end think they need to muck with CRLFs, so using "\n", while
- // distasteful, is the only thing that seems to work for all environments.
- public $dsn = FALSE; // Delivery Status Notification
- public $send_multipart = TRUE; // TRUE/FALSE - Yahoo does not like multipart alternative, so this is an override. Set to FALSE for Yahoo.
- public $bcc_batch_mode = FALSE; // TRUE/FALSE - Turns on/off Bcc batch feature
- public $bcc_batch_size = 200; // If bcc_batch_mode = TRUE, sets max number of Bccs in each batch
+ /**
+ * CRLF character sequence
+ *
+ * RFC 2045 specifies that for 'quoted-printable' encoding,
+ * "\r\n" must be used. However, it appears that some servers
+ * (even on the receiving end) don't handle it properly and
+ * switching to "\n", while improper, is the only solution
+ * that seems to work for all environments.
+ *
+ * @link http://www.ietf.org/rfc/rfc822.txt
+ * @var string
+ */
+ public $crlf = "\n";
+
+ /**
+ * Whether to use Delivery Status Notification.
+ *
+ * @var bool
+ */
+ public $dsn = FALSE;
+
+ /**
+ * Whether to send multipart alternatives.
+ * Yahoo! doesn't seem to like these.
+ *
+ * @var bool
+ */
+ public $send_multipart = TRUE;
+
+ /**
+ * Whether to send messages to BCC recipients in batches.
+ *
+ * @var bool
+ */
+ public $bcc_batch_mode = FALSE;
+
+ /**
+ * BCC Batch max number size.
+ *
+ * @see CI_Email::$bcc_batch_mode
+ * @var int
+ */
+ public $bcc_batch_size = 200;
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Whether PHP is running in safe mode. Initialized by the class constructor.
+ *
+ * @var bool
+ */
protected $_safe_mode = FALSE;
+
+ /**
+ * Subject header
+ *
+ * @var string
+ */
protected $_subject = '';
+
+ /**
+ * Message body
+ *
+ * @var string
+ */
protected $_body = '';
+
+ /**
+ * Final message body to be sent.
+ *
+ * @var string
+ */
protected $_finalbody = '';
+
+ /**
+ * multipart/alternative boundary
+ *
+ * @var string
+ */
protected $_alt_boundary = '';
+
+ /**
+ * Attachment boundary
+ *
+ * @var string
+ */
protected $_atc_boundary = '';
+
+ /**
+ * Final headers to send
+ *
+ * @var string
+ */
protected $_header_str = '';
+
+ /**
+ * SMTP Connection socket placeholder
+ *
+ * @var resource
+ */
protected $_smtp_connect = '';
+
+ /**
+ * Mail encoding
+ *
+ * @var string '8bit' or '7bit'
+ */
protected $_encoding = '8bit';
- protected $_IP = FALSE;
+
+ /**
+ * Whether to perform SMTP authentication
+ *
+ * @var bool
+ */
protected $_smtp_auth = FALSE;
+
+ /**
+ * Whether to send a Reply-To header
+ *
+ * @var bool
+ */
protected $_replyto_flag = FALSE;
+
+ /**
+ * Debug messages
+ *
+ * @see CI_Email::print_debugger()
+ * @var string
+ */
protected $_debug_msg = array();
+
+ /**
+ * Recipients
+ *
+ * @var string[]
+ */
protected $_recipients = array();
+
+ /**
+ * CC Recipients
+ *
+ * @var string[]
+ */
protected $_cc_array = array();
+
+ /**
+ * BCC Recipients
+ *
+ * @var string[]
+ */
protected $_bcc_array = array();
+
+ /**
+ * Message headers
+ *
+ * @var string[]
+ */
protected $_headers = array();
+
+ /**
+ * Attachment data
+ *
+ * @var array
+ */
protected $_attachments = array();
+
+ /**
+ * Valid $protocol values
+ *
+ * @see CI_Email::$protocol
+ * @var string[]
+ */
protected $_protocols = array('mail', 'sendmail', 'smtp');
- protected $_base_charsets = array('us-ascii', 'iso-2022-'); // 7-bit charsets (excluding language suffix)
+
+ /**
+ * Base charsets
+ *
+ * Character sets valid for 7-bit encoding,
+ * excluding language suffix.
+ *
+ * @var string[]
+ */
+ protected $_base_charsets = array('us-ascii', 'iso-2022-');
+
+ /**
+ * Bit depths
+ *
+ * Valid mail encodings
+ *
+ * @see CI_Email::$_encoding
+ * @var string[]
+ */
protected $_bit_depths = array('7bit', '8bit');
+
+ /**
+ * $priority translations
+ *
+ * Actual values to send with the X-Priority header
+ *
+ * @var string[]
+ */
protected $_priorities = array('1 (Highest)', '2 (High)', '3 (Normal)', '4 (Low)', '5 (Lowest)');
+ // --------------------------------------------------------------------
+
/**
* Constructor - Sets Email Preferences
*
@@ -771,7 +1057,7 @@ class CI_Email {
}
// Reduce multiple spaces
- $str = preg_replace('| +|', ' ', $str);
+ $body = preg_replace('| +|', ' ', $body);
return ($this->wordwrap)
? $this->word_wrap($body, 76)
@@ -1446,11 +1732,14 @@ class CI_Email {
*/
protected function _send_with_sendmail()
{
- $fp = @popen($this->mailpath.' -oi -f '.$this->clean_email($this->_headers['From']).' -t'.' -r '.$this->clean_email($this->_headers['Return-Path']), 'w');
-
- if ($fp === FALSE OR $fp === NULL)
+ // is popen() enabled?
+ if ( ! function_usable('popen')
+ OR FALSE === ($fp = @popen(
+ $this->mailpath.' -oi -f '.$this->clean_email($this->_headers['From'])
+ .' -t -r '.$this->clean_email($this->_headers['Return-Path'])
+ , 'w'))
+ ) // server probably has popen disabled, so nothing we can do to get a verbose error.
{
- // server probably has popen disabled, so nothing we can do to get a verbose error.
return FALSE;
}
diff --git a/system/libraries/Encrypt.php b/system/libraries/Encrypt.php
index 73ab8ca7d..cdb0a6452 100644
--- a/system/libraries/Encrypt.php
+++ b/system/libraries/Encrypt.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter Encryption Class
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index c1bf51935..e50eee4f2 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Form Validation Class
@@ -439,11 +440,10 @@ class CI_Form_validation {
// Load the language file containing error messages
$this->CI->lang->load('form_validation');
- // Cycle through the rules for each field, match the
- // corresponding $_POST item and test for errors
+ // Cycle through the rules for each field and match the corresponding $validation_data item
foreach ($this->_field_data as $field => $row)
{
- // Fetch the data from the corresponding $_POST or validation array and cache it in the _field_data array.
+ // Fetch the data from the validation_data array item and cache it in the _field_data array.
// Depending on whether the field name is an array or a string will determine where we get it from.
if ($row['is_array'] === TRUE)
{
@@ -453,7 +453,13 @@ class CI_Form_validation {
{
$this->_field_data[$field]['postdata'] = $validation_array[$field];
}
+ }
+ // Execute validation rules
+ // Note: A second foreach (for now) is required in order to avoid false-positives
+ // for rules like 'matches', which correlate to other validation fields.
+ foreach ($this->_field_data as $field => $row)
+ {
// Don't try to validate if we have no rules set
if (empty($row['rules']))
{
@@ -1323,6 +1329,11 @@ class CI_Form_validation {
*/
public function prep_for_form($data = '')
{
+ if ($this->_safe_form_data === FALSE OR empty($data))
+ {
+ return $data;
+ }
+
if (is_array($data))
{
foreach ($data as $key => $val)
@@ -1333,11 +1344,6 @@ class CI_Form_validation {
return $data;
}
- if ($this->_safe_form_data === FALSE OR $data === '')
- {
- return $data;
- }
-
return str_replace(array("'", '"', '<', '>'), array('&#39;', '&quot;', '&lt;', '&gt;'), stripslashes($data));
}
diff --git a/system/libraries/Ftp.php b/system/libraries/Ftp.php
index ae85fdf37..60c03b5ad 100644
--- a/system/libraries/Ftp.php
+++ b/system/libraries/Ftp.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* FTP Class
@@ -36,18 +37,63 @@
*/
class CI_FTP {
+ /**
+ * FTP Server hostname
+ *
+ * @var string
+ */
public $hostname = '';
+
+ /**
+ * FTP Username
+ *
+ * @var string
+ */
public $username = '';
+
+ /**
+ * FTP Password
+ *
+ * @var string
+ */
public $password = '';
+
+ /**
+ * FTP Server port
+ *
+ * @var int
+ */
public $port = 21;
+
+ /**
+ * Passive mode flag
+ *
+ * @var bool
+ */
public $passive = TRUE;
+
+ /**
+ * Debug flag
+ *
+ * Specifies whether to display error messages.
+ *
+ * @var bool
+ */
public $debug = FALSE;
+
+ /**
+ * Connection
+ *
+ * @var resource
+ */
public $conn_id = FALSE;
+ // --------------------------------------------------------------------
+
/**
* Constructor
*
- * @param array $config = array()
+ * @param array $config
* @return void
*/
public function __construct($config = array())
@@ -65,7 +111,7 @@ class CI_FTP {
/**
* Initialize preferences
*
- * @param array
+ * @param array $config
* @return void
*/
public function initialize($config = array())
@@ -87,7 +133,7 @@ class CI_FTP {
/**
* FTP Connect
*
- * @param array the connection values
+ * @param array $config Connection values
* @return bool
*/
public function connect($config = array())
@@ -167,8 +213,8 @@ class CI_FTP {
* so we do it by trying to change to a particular directory.
* Internally, this parameter is only used by the "mirror" function below.
*
- * @param string
- * @param bool
+ * @param string $path
+ * @param bool $supress_debug
* @return bool
*/
public function changedir($path = '', $supress_debug = FALSE)
@@ -197,8 +243,8 @@ class CI_FTP {
/**
* Create a directory
*
- * @param string
- * @param int
+ * @param string $path
+ * @param int $permissions
* @return bool
*/
public function mkdir($path = '', $permissions = NULL)
@@ -233,10 +279,10 @@ class CI_FTP {
/**
* Upload a file to the server
*
- * @param string
- * @param string
- * @param string
- * @param int
+ * @param string $locpath
+ * @param string $rempath
+ * @param string $mode
+ * @param int $permissions
* @return bool
*/
public function upload($locpath, $rempath, $mode = 'auto', $permissions = NULL)
@@ -287,9 +333,9 @@ class CI_FTP {
/**
* Download a file from a remote server to the local server
*
- * @param string
- * @param string
- * @param string
+ * @param string $rempath
+ * @param string $locpath
+ * @param string $mode
* @return bool
*/
public function download($rempath, $locpath, $mode = 'auto')
@@ -328,9 +374,9 @@ class CI_FTP {
/**
* Rename (or move) a file
*
- * @param string
- * @param string
- * @param bool
+ * @param string $old_file
+ * @param string $new_file
+ * @param bool $move
* @return bool
*/
public function rename($old_file, $new_file, $move = FALSE)
@@ -359,8 +405,8 @@ class CI_FTP {
/**
* Move a file
*
- * @param string
- * @param string
+ * @param string $old_file
+ * @param string $new_file
* @return bool
*/
public function move($old_file, $new_file)
@@ -373,7 +419,7 @@ class CI_FTP {
/**
* Rename (or move) a file
*
- * @param string
+ * @param string $filepath
* @return bool
*/
public function delete_file($filepath)
@@ -403,7 +449,7 @@ class CI_FTP {
* Delete a folder and recursively delete everything (including sub-folders)
* containted within it.
*
- * @param string
+ * @param string $filepath
* @return bool
*/
public function delete_dir($filepath)
@@ -450,8 +496,8 @@ class CI_FTP {
/**
* Set file permissions
*
- * @param string the file path
- * @param int the permissions
+ * @param string $path File path
+ * @param int $perm Permissions
* @return bool
*/
public function chmod($path, $perm)
@@ -480,7 +526,7 @@ class CI_FTP {
/**
* FTP List files in the specified directory
*
- * @param string $path = '.'
+ * @param string $path
* @return array
*/
public function list_files($path = '.')
@@ -503,8 +549,8 @@ class CI_FTP {
* Whatever the directory structure of the original file path will be
* recreated on the server.
*
- * @param string path to source with trailing slash
- * @param string path to destination - include the base folder with trailing slash
+ * @param string $locpath Path to source with trailing slash
+ * @param string $rempath Path to destination - include the base folder with trailing slash
* @return bool
*/
public function mirror($locpath, $rempath)
@@ -550,7 +596,7 @@ class CI_FTP {
/**
* Extract the file extension
*
- * @param string
+ * @param string $filename
* @return string
*/
protected function _getext($filename)
@@ -569,7 +615,7 @@ class CI_FTP {
/**
* Set the upload type
*
- * @param string
+ * @param string $ext Filename extension
* @return string
*/
protected function _settype($ext)
@@ -616,7 +662,7 @@ class CI_FTP {
/**
* Display error message
*
- * @param string
+ * @param string $line
* @return void
*/
protected function _error($line)
diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php
index ef4187847..9379e3ec8 100644
--- a/system/libraries/Image_lib.php
+++ b/system/libraries/Image_lib.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Image Manipulation class
@@ -866,7 +867,11 @@ class CI_Image_lib {
}
$retval = 1;
- @exec($cmd, $output, $retval);
+ // exec() might be disabled
+ if (function_usable('exec'))
+ {
+ @exec($cmd, $output, $retval);
+ }
// Did it work?
if ($retval > 0)
@@ -946,7 +951,11 @@ class CI_Image_lib {
$cmd = $this->library_path.$cmd_in.' '.$this->full_src_path.' | '.$cmd_inner.' | '.$cmd_out.' > '.$this->dest_folder.'netpbm.tmp';
$retval = 1;
- @exec($cmd, $output, $retval);
+ // exec() might be disabled
+ if (function_usable('exec'))
+ {
+ @exec($cmd, $output, $retval);
+ }
// Did it work?
if ($retval > 0)
@@ -958,7 +967,7 @@ class CI_Image_lib {
// With NetPBM we have to create a temporary image.
// If you try manipulating the original it fails so
// we have to rename the temp file.
- copy ($this->dest_folder.'netpbm.tmp', $this->full_dst_path);
+ copy($this->dest_folder.'netpbm.tmp', $this->full_dst_path);
unlink($this->dest_folder.'netpbm.tmp');
@chmod($this->full_dst_path, FILE_WRITE_MODE);
diff --git a/system/libraries/Javascript.php b/system/libraries/Javascript.php
index 60309cd83..9a15cddaa 100644
--- a/system/libraries/Javascript.php
+++ b/system/libraries/Javascript.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Javascript Class
@@ -36,12 +37,19 @@
*/
class CI_Javascript {
+ /**
+ * JavaScript location
+ *
+ * @var string
+ */
protected $_javascript_location = 'js';
+ // --------------------------------------------------------------------
+
/**
* Constructor
*
- * @param array $params = array()
+ * @param array $params
* @return void
*/
public function __construct($params = array())
@@ -586,8 +594,8 @@ class CI_Javascript {
*
* gather together all script needing to be output
*
- * @param string $view_var = 'script_foot'
- * @param bool $script_tags = TRUE
+ * @param string $view_var
+ * @param bool $script_tags
* @return string
*/
public function compile($view_var = 'script_foot', $script_tags = TRUE)
@@ -616,8 +624,8 @@ class CI_Javascript {
*
* Outputs a <script> tag with the source as an external js file
*
- * @param string $external_file = ''
- * @param bool $relative = FALSE
+ * @param string $external_file
+ * @param bool $relative
* @return string
*/
public function external($external_file = '', $relative = FALSE)
diff --git a/system/libraries/Log.php b/system/libraries/Log.php
deleted file mode 100644
index baac80121..000000000
--- a/system/libraries/Log.php
+++ /dev/null
@@ -1,180 +0,0 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
-/**
- * CodeIgniter
- *
- * An open source application development framework for PHP 5.2.4 or newer
- *
- * NOTICE OF LICENSE
- *
- * Licensed under the Open Software License version 3.0
- *
- * This source file is subject to the Open Software License (OSL 3.0) that is
- * bundled with this package in the files license.txt / license.rst. It is
- * also available through the world wide web at this URL:
- * http://opensource.org/licenses/OSL-3.0
- * If you did not receive a copy of the license and are unable to obtain it
- * through the world wide web, please send an email to
- * licensing@ellislab.com so we can send you a copy immediately.
- *
- * @package CodeIgniter
- * @author EllisLab Dev Team
- * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
- * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
- * @link http://codeigniter.com
- * @since Version 1.0
- * @filesource
- */
-
-/**
- * Logging Class
- *
- * @package CodeIgniter
- * @subpackage Libraries
- * @category Logging
- * @author EllisLab Dev Team
- * @link http://codeigniter.com/user_guide/general/errors.html
- */
-class CI_Log {
-
- /**
- * Path to save log files
- *
- * @var string
- */
- protected $_log_path;
-
- /**
- * Level of logging
- *
- * @var int
- */
- protected $_threshold = 1;
-
- /**
- * Highest level of logging
- *
- * @var int
- */
- protected $_threshold_max = 0;
-
- /**
- * Array of threshold levels to log
- *
- * @var array
- */
- protected $_threshold_array = array();
-
- /**
- * Format of timestamp for log files
- *
- * @var string
- */
- protected $_date_fmt = 'Y-m-d H:i:s';
-
- /**
- * Whether or not the logger can write to the log files
- *
- * @var bool
- */
- protected $_enabled = TRUE;
-
- /**
- * Predefined logging levels
- *
- * @var array
- */
- protected $_levels = array('ERROR' => 1, 'DEBUG' => 2, 'INFO' => 3, 'ALL' => 4);
-
- /**
- * Initialize Logging class
- *
- * @return void
- */
- public function __construct()
- {
- $config =& get_config();
-
- $this->_log_path = ($config['log_path'] !== '') ? $config['log_path'] : APPPATH.'logs/';
-
- if ( ! is_dir($this->_log_path) OR ! is_really_writable($this->_log_path))
- {
- $this->_enabled = FALSE;
- }
-
- if (is_numeric($config['log_threshold']))
- {
- $this->_threshold = (int) $config['log_threshold'];
- }
- elseif (is_array($config['log_threshold']))
- {
- $this->_threshold = $this->_threshold_max;
- $this->_threshold_array = array_flip($config['log_threshold']);
- }
-
- if ($config['log_date_format'] !== '')
- {
- $this->_date_fmt = $config['log_date_format'];
- }
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Write Log File
- *
- * Generally this function will be called using the global log_message() function
- *
- * @param string the error level
- * @param string the error message
- * @param bool whether the error is a native PHP error
- * @return bool
- */
- public function write_log($level = 'error', $msg, $php_error = FALSE)
- {
- if ($this->_enabled === FALSE)
- {
- return FALSE;
- }
-
- $level = strtoupper($level);
-
- if (( ! isset($this->_levels[$level]) OR ($this->_levels[$level] > $this->_threshold))
- && ! isset($this->_threshold_array[$this->_levels[$level]]))
- {
- return FALSE;
- }
-
-
- $filepath = $this->_log_path.'log-'.date('Y-m-d').'.php';
- $message = '';
-
- if ( ! file_exists($filepath))
- {
- $newfile = TRUE;
- $message .= '<'."?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?".">\n\n";
- }
-
- if ( ! $fp = @fopen($filepath, FOPEN_WRITE_CREATE))
- {
- return FALSE;
- }
-
- $message .= $level.' '.($level === 'INFO' ? ' -' : '-').' '.date($this->_date_fmt).' --> '.$msg."\n";
-
- flock($fp, LOCK_EX);
- fwrite($fp, $message);
- flock($fp, LOCK_UN);
- fclose($fp);
-
- if (isset($newfile) && $newfile === TRUE)
- {
- @chmod($filepath, FILE_WRITE_MODE);
- }
-
- return TRUE;
- }
-
-}
-
-/* End of file Log.php */
-/* Location: ./system/libraries/Log.php */ \ No newline at end of file
diff --git a/system/libraries/Migration.php b/system/libraries/Migration.php
index f67725c18..275aeb048 100644
--- a/system/libraries/Migration.php
+++ b/system/libraries/Migration.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 3.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Migration Class
diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php
index 36b57b332..ae8dba072 100644
--- a/system/libraries/Pagination.php
+++ b/system/libraries/Pagination.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Pagination Class
@@ -36,46 +37,269 @@
*/
class CI_Pagination {
- protected $base_url = ''; // The page we are linking to
- protected $prefix = ''; // A custom prefix added to the path.
- protected $suffix = ''; // A custom suffix added to the path.
- protected $total_rows = 0; // Total number of items (database results)
- protected $per_page = 10; // Max number of items you want shown per page
- protected $num_links = 2; // Number of "digit" links to show before/after the currently viewed page
- protected $cur_page = 0; // The current page being viewed
- protected $use_page_numbers = FALSE; // Use page number for segment instead of offset
- protected $first_link = '&lsaquo; First';
- protected $next_link = '&gt;';
- protected $prev_link = '&lt;';
- protected $last_link = 'Last &rsaquo;';
- protected $uri_segment = 3;
- protected $full_tag_open = '';
- protected $full_tag_close = '';
- protected $first_tag_open = '';
- protected $first_tag_close = '';
- protected $last_tag_open = '';
- protected $last_tag_close = '';
- protected $first_url = ''; // Alternative URL for the First Page.
- protected $cur_tag_open = '<strong>';
- protected $cur_tag_close = '</strong>';
- protected $next_tag_open = '';
- protected $next_tag_close = '';
- protected $prev_tag_open = '';
- protected $prev_tag_close = '';
- protected $num_tag_open = '';
- protected $num_tag_close = '';
+ /**
+ * Base URL
+ *
+ * The page that we're linking to
+ *
+ * @var string
+ */
+ protected $base_url = '';
+
+ /**
+ * Prefix
+ *
+ * @var string
+ */
+ protected $prefix = '';
+
+ /**
+ * Suffix
+ *
+ * @var string
+ */
+ protected $suffix = '';
+
+ /**
+ * Total number of items
+ *
+ * @var int
+ */
+ protected $total_rows = 0;
+
+ /**
+ * Items per page
+ *
+ * @var int
+ */
+ protected $per_page = 10;
+
+ /**
+ * Number of links to show
+ *
+ * Relates to "digit" type links shown before/after
+ * the currently viewed page.
+ *
+ * @var int
+ */
+ protected $num_links = 2;
+
+ /**
+ * Current page
+ *
+ * @var int
+ */
+ protected $cur_page = 0;
+
+ /**
+ * Use page numbers flag
+ *
+ * Whether to use actual page numbers instead of an offset
+ *
+ * @var bool
+ */
+ protected $use_page_numbers = FALSE;
+
+ /**
+ * First link
+ *
+ * @var string
+ */
+ protected $first_link = '&lsaquo; First';
+
+ /**
+ * Next link
+ *
+ * @var string
+ */
+ protected $next_link = '&gt;';
+
+ /**
+ * Previous link
+ *
+ * @var string
+ */
+ protected $prev_link = '&lt;';
+
+ /**
+ * Last link
+ *
+ * @var string
+ */
+ protected $last_link = 'Last &rsaquo;';
+
+ /**
+ * URI Segment
+ *
+ * @var int
+ */
+ protected $uri_segment = 3;
+
+ /**
+ * Full tag open
+ *
+ * @var string
+ */
+ protected $full_tag_open = '';
+
+ /**
+ * Full tag close
+ *
+ * @var string
+ */
+ protected $full_tag_close = '';
+
+ /**
+ * First tag open
+ *
+ * @var string
+ */
+ protected $first_tag_open = '';
+
+ /**
+ * First tag close
+ *
+ * @var string
+ */
+ protected $first_tag_close = '';
+
+ /**
+ * Last tag open
+ *
+ * @var string
+ */
+ protected $last_tag_open = '';
+
+ /**
+ * Last tag close
+ *
+ * @var string
+ */
+ protected $last_tag_close = '';
+
+ /**
+ * First URL
+ *
+ * An alternative URL for the first page
+ *
+ * @var string
+ */
+ protected $first_url = '';
+
+ /**
+ * Current tag open
+ *
+ * @var string
+ */
+ protected $cur_tag_open = '<strong>';
+
+ /**
+ * Current tag close
+ *
+ * @var string
+ */
+ protected $cur_tag_close = '</strong>';
+
+ /**
+ * Next tag open
+ *
+ * @var string
+ */
+ protected $next_tag_open = '';
+
+ /**
+ * Next tag close
+ *
+ * @var string
+ */
+ protected $next_tag_close = '';
+
+ /**
+ * Previous tag open
+ *
+ * @var string
+ */
+ protected $prev_tag_open = '';
+
+ /**
+ * Previous tag close
+ *
+ * @var string
+ */
+ protected $prev_tag_close = '';
+
+ /**
+ * Number tag open
+ *
+ * @var string
+ */
+ protected $num_tag_open = '';
+
+ /**
+ * Number tag close
+ *
+ * @var string
+ */
+ protected $num_tag_close = '';
+
+ /**
+ * Page query string flag
+ *
+ * @var bool
+ */
protected $page_query_string = FALSE;
+
+ /**
+ * Query string segment
+ *
+ * @var string
+ */
protected $query_string_segment = 'per_page';
- protected $display_pages = TRUE;
- protected $_attributes = '';
- protected $_link_types = array();
+
+ /**
+ * Display pages flag
+ *
+ * @var bool
+ */
+ protected $display_pages = TRUE;
+
+ /**
+ * Attributes
+ *
+ * @var string
+ */
+ protected $_attributes = '';
+
+ /**
+ * Link types
+ *
+ * "rel" attribute
+ *
+ * @see CI_Pagination::_attr_rel()
+ * @var array
+ */
+ protected $_link_types = array();
+
+ /**
+ * Reuse query string flag
+ *
+ * @var bool
+ */
protected $reuse_query_string = FALSE;
- protected $data_page_attr = 'data-ci-pagination-page';
+
+ /**
+ * Data page attribute
+ *
+ * @var string
+ */
+ protected $data_page_attr = 'data-ci-pagination-page';
+
+ // --------------------------------------------------------------------
/**
* Constructor
*
- * @param array initialization parameters
+ * @param array $params Initialization parameters
* @return void
*/
public function __construct($params = array())
@@ -89,7 +313,7 @@ class CI_Pagination {
/**
* Initialize Preferences
*
- * @param array initialization parameters
+ * @param array $params Initialization parameters
* @return void
*/
public function initialize($params = array())
@@ -352,7 +576,7 @@ class CI_Pagination {
/**
* Parse attributes
*
- * @param array
+ * @param array $attributes
* @return void
*/
protected function _parse_attributes($attributes)
@@ -376,7 +600,7 @@ class CI_Pagination {
* Add "rel" attribute
*
* @link http://www.w3.org/TR/html5/links.html#linkTypes
- * @param string
+ * @param string $type
* @return string
*/
protected function _attr_rel($type)
diff --git a/system/libraries/Parser.php b/system/libraries/Parser.php
index b64c78254..d29eede02 100644
--- a/system/libraries/Parser.php
+++ b/system/libraries/Parser.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Parser Class
diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php
index 1e961f6df..1c97e3481 100644
--- a/system/libraries/Profiler.php
+++ b/system/libraries/Profiler.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter Profiler Class
@@ -74,12 +75,14 @@ class CI_Profiler {
*/
protected $CI;
+ // --------------------------------------------------------------------
+
/**
- * Constructor
+ * Class constructor
*
* Initialize Profiler
*
- * @param array $config
+ * @param array $config Parameters
*/
public function __construct($config = array())
{
@@ -111,7 +114,7 @@ class CI_Profiler {
*
* Sets the private _compile_* properties to enable/disable Profiler sections
*
- * @param mixed
+ * @param mixed $config
* @return void
*/
public function set_sections($config)
@@ -190,11 +193,24 @@ class CI_Profiler {
$dbs = array();
// Let's determine which databases are currently connected to
- foreach (get_object_vars($this->CI) as $CI_object)
+ foreach (get_object_vars($this->CI) as $name => $cobject)
{
- if (is_object($CI_object) && is_subclass_of(get_class($CI_object), 'CI_DB'))
+ if (is_object($cobject))
{
- $dbs[] = $CI_object;
+ if ($cobject instanceof CI_DB)
+ {
+ $dbs[get_class($this->CI).':$'.$name] = $cobject;
+ }
+ elseif ($cobject instanceof CI_Model)
+ {
+ foreach (get_object_vars($cobject) as $mname => $mobject)
+ {
+ if ($mobject instanceof CI_DB)
+ {
+ $dbs[get_class($cobject).':$'.$mname] = $mobject;
+ }
+ }
+ }
}
}
@@ -219,7 +235,7 @@ class CI_Profiler {
$output = "\n\n";
$count = 0;
- foreach ($dbs as $db)
+ foreach ($dbs as $name => $db)
{
$hide_queries = (count($db->queries) > $this->_query_toggle_count) ? ' display:none' : '';
@@ -233,7 +249,7 @@ class CI_Profiler {
$output .= '<fieldset style="border:1px solid #0000FF;padding:6px 10px 10px 10px;margin:20px 0 20px 0;background-color:#eee;">'
."\n"
.'<legend style="color:#0000FF;">&nbsp;&nbsp;'.$this->CI->lang->line('profiler_database')
- .':&nbsp; '.$db->database.'&nbsp;&nbsp;&nbsp;'.$this->CI->lang->line('profiler_queries')
+ .':&nbsp; '.$db->database.' ('.$name.')&nbsp;&nbsp;&nbsp;'.$this->CI->lang->line('profiler_queries')
.': '.count($db->queries).'&nbsp;&nbsp;'.$show_hide_js."</legend>\n\n\n"
.'<table style="width:100%;'.$hide_queries.'" id="ci_profiler_queries_db_'.$count."\">\n";
diff --git a/system/libraries/Session/Session.php b/system/libraries/Session/Session.php
index fec9b5b31..96e65f154 100755
--- a/system/libraries/Session/Session.php
+++ b/system/libraries/Session/Session.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -18,12 +18,13 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2006 - 2012 EllisLab, Inc.
+ * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 2.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter Session Class
@@ -51,10 +52,29 @@
*/
class CI_Session extends CI_Driver_Library {
+ /**
+ * Initialization parameters
+ *
+ * @var array
+ */
public $params = array();
+
+ /**
+ * Current driver in use
+ *
+ * @var string
+ */
protected $current = NULL;
+
+ /**
+ * User data
+ *
+ * @var array
+ */
protected $userdata = array();
+ // ------------------------------------------------------------------------
+
const FLASHDATA_KEY = 'flash';
const FLASHDATA_NEW = ':new:';
const FLASHDATA_OLD = ':old:';
@@ -62,6 +82,8 @@ class CI_Session extends CI_Driver_Library {
const EXPIRATION_KEY = '__expirations';
const TEMP_EXP_DEF = 300;
+ // ------------------------------------------------------------------------
+
/**
* CI_Session constructor
*
@@ -506,7 +528,7 @@ class CI_Session extends CI_Driver_Library {
foreach ($this->all_userdata() as $name => $value)
{
$parts = explode(self::FLASHDATA_NEW, $name);
- if (is_array($parts) && count($parts) === 2)
+ if (count($parts) === 2)
{
$new_name = self::FLASHDATA_KEY.self::FLASHDATA_OLD.$parts[1];
$this->set_userdata($new_name, $value);
@@ -595,8 +617,16 @@ class CI_Session extends CI_Driver_Library {
*/
abstract class CI_Session_driver extends CI_Driver {
+ /**
+ * CI Singleton
+ *
+ * @see get_instance()
+ * @var object
+ */
protected $CI;
+ // ------------------------------------------------------------------------
+
/**
* Constructor
*
diff --git a/system/libraries/Session/drivers/Session_cookie.php b/system/libraries/Session/drivers/Session_cookie.php
index 2f1bf3531..3c4848265 100755
--- a/system/libraries/Session/drivers/Session_cookie.php
+++ b/system/libraries/Session/drivers/Session_cookie.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -9,7 +9,7 @@
* Licensed under the Open Software License version 3.0
*
* This source file is subject to the Open Software License (OSL 3.0) that is
- * bundled with this package in the files license.txt / license.rst. It is
+ * bundled with this package in the files license.txt / license.rst. It is
* also available through the world wide web at this URL:
* http://opensource.org/licenses/OSL-3.0
* If you did not receive a copy of the license and are unable to obtain it
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Cookie-based session management driver
@@ -540,11 +541,25 @@ class CI_Session_cookie extends CI_Session_driver {
// Check for database
if ($this->sess_use_database === TRUE)
{
+ $this->CI->db->where('session_id', $old_sessid);
+
+ if ($this->sess_match_ip === TRUE)
+ {
+ $this->CI->db->where('ip_address', $this->CI->input->ip_address());
+ }
+
+ if ($this->sess_match_useragent === TRUE)
+ {
+ $this->CI->db->where('user_agent', trim(substr($this->CI->input->user_agent(), 0, 120)));
+ }
+
// Update the session ID and last_activity field in the DB
- $this->CI->db->update($this->sess_table_name, array(
- 'last_activity' => $this->now,
- 'session_id' => $this->userdata['session_id']
- ), array('session_id' => $old_sessid));
+ $this->CI->db->update($this->sess_table_name,
+ array(
+ 'last_activity' => $this->now,
+ 'session_id' => $this->userdata['session_id']
+ )
+ );
}
// Write the cookie
@@ -590,7 +605,19 @@ class CI_Session_cookie extends CI_Session_driver {
// Run the update query
// Any time we change the session id, it gets updated immediately,
// so our where clause below is always safe
- $this->CI->db->update($this->sess_table_name, $set, array('session_id' => $this->userdata['session_id']));
+ $this->CI->db->where('session_id', $this->userdata['session_id']);
+
+ if ($this->sess_match_ip === TRUE)
+ {
+ $this->CI->db->where('ip_address', $this->CI->input->ip_address());
+ }
+
+ if ($this->sess_match_useragent === TRUE)
+ {
+ $this->CI->db->where('user_agent', trim(substr($this->CI->input->user_agent(), 0, 120)));
+ }
+
+ $this->CI->db->update($this->sess_table_name, $set);
// Clear dirty flag to prevent double updates
$this->data_dirty = FALSE;
diff --git a/system/libraries/Session/drivers/Session_native.php b/system/libraries/Session/drivers/Session_native.php
index a837b89f6..3e700ad5d 100755
--- a/system/libraries/Session/drivers/Session_native.php
+++ b/system/libraries/Session/drivers/Session_native.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -9,7 +9,7 @@
* Licensed under the Open Software License version 3.0
*
* This source file is subject to the Open Software License (OSL 3.0) that is
- * bundled with this package in the files license.txt / license.rst. It is
+ * bundled with this package in the files license.txt / license.rst. It is
* also available through the world wide web at this URL:
* http://opensource.org/licenses/OSL-3.0
* If you did not receive a copy of the license and are unable to obtain it
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Native PHP session management driver
diff --git a/system/libraries/Table.php b/system/libraries/Table.php
index 0f8404d85..886fb6581 100644
--- a/system/libraries/Table.php
+++ b/system/libraries/Table.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.3.1
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* HTML Table Generating Class
diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php
index 7bd7cba04..c923a6220 100644
--- a/system/libraries/Trackback.php
+++ b/system/libraries/Trackback.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Trackback Class
@@ -38,12 +39,45 @@
*/
class CI_Trackback {
- public $time_format = 'local';
+ /**
+ * Character set
+ *
+ * @var string
+ */
public $charset = 'UTF-8';
- public $data = array('url' => '', 'title' => '', 'excerpt' => '', 'blog_name' => '', 'charset' => '');
+
+ /**
+ * Trackback data
+ *
+ * @var array
+ */
+ public $data = array('url' => '', 'title' => '', 'excerpt' => '', 'blog_name' => '', 'charset' => '');
+
+ /**
+ * Convert ASCII flag
+ *
+ * Whether to convert high-ASCII and MS Word
+ * characters to HTML entities.
+ *
+ * @var bool
+ */
public $convert_ascii = TRUE;
- public $response = '';
- public $error_msg = array();
+
+ /**
+ * Response
+ *
+ * @var string
+ */
+ public $response = '';
+
+ /**
+ * Error messages list
+ *
+ * @var string[]
+ */
+ public $error_msg = array();
+
+ // --------------------------------------------------------------------
/**
* Constructor
diff --git a/system/libraries/Typography.php b/system/libraries/Typography.php
index a50934f2c..d83bf519b 100644
--- a/system/libraries/Typography.php
+++ b/system/libraries/Typography.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Typography Class
diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php
index 7b99dee0d..842b4aebd 100644
--- a/system/libraries/Unit_test.php
+++ b/system/libraries/Unit_test.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.3.1
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Unit Testing Class
@@ -38,13 +39,52 @@
*/
class CI_Unit_test {
+ /**
+ * Active flag
+ *
+ * @var bool
+ */
public $active = TRUE;
+
+ /**
+ * Test results
+ *
+ * @var array
+ */
public $results = array();
+
+ /**
+ * Strict comparison flag
+ *
+ * Whether to use === or == when comparing
+ *
+ * @var bool
+ */
public $strict = FALSE;
+
+ /**
+ * Template
+ *
+ * @var string
+ */
protected $_template = NULL;
+
+ /**
+ * Template rows
+ *
+ * @var string
+ */
protected $_template_rows = NULL;
+
+ /**
+ * List of visible test items
+ *
+ * @var array
+ */
protected $_test_items_visible = array();
+ // --------------------------------------------------------------------
+
/**
* Constructor
*
@@ -92,9 +132,9 @@ class CI_Unit_test {
* Runs the supplied tests
*
* @param mixed $test
- * @param mixed $expected = TRUE
- * @param string $test_name = 'undefined'
- * @param string $notes = ''
+ * @param mixed $expected
+ * @param string $test_name
+ * @param string $notes
* @return string
*/
public function run($test, $expected = TRUE, $test_name = 'undefined', $notes = '')
@@ -112,13 +152,13 @@ class CI_Unit_test {
}
else
{
- $result = ($this->strict === TRUE) ? ($test === $expected) : ($test === $expected);
+ $result = ($this->strict === TRUE) ? ($test === $expected) : ($test == $expected);
$extype = gettype($expected);
}
$back = $this->_backtrace();
- $report[] = array (
+ $report = array (
'test_name' => $test_name,
'test_datatype' => gettype($test),
'res_datatype' => $extype,
@@ -130,7 +170,7 @@ class CI_Unit_test {
$this->results[] = $report;
- return $this->report($this->result($report));
+ return $this->report($this->result(array($report)));
}
// --------------------------------------------------------------------
@@ -140,7 +180,7 @@ class CI_Unit_test {
*
* Displays a table with the test data
*
- * @param array $result = array()
+ * @param array $result
* @return string
*/
public function report($result = array())
@@ -220,7 +260,7 @@ class CI_Unit_test {
*
* Returns the raw result data
*
- * @param array $results = array()
+ * @param array $results
* @return array
*/
public function result($results = array())
@@ -244,30 +284,11 @@ class CI_Unit_test {
continue;
}
- if (is_array($val))
- {
- foreach ($val as $k => $v)
- {
- if ( ! in_array($k, $this->_test_items_visible))
- {
- continue;
- }
-
- if (FALSE !== ($line = $CI->lang->line(strtolower('ut_'.$v))))
- {
- $v = $line;
- }
- $temp[$CI->lang->line('ut_'.$k)] = $v;
- }
- }
- else
+ if (FALSE !== ($line = $CI->lang->line(strtolower('ut_'.$val))))
{
- if (FALSE !== ($line = $CI->lang->line(strtolower('ut_'.$val))))
- {
- $val = $line;
- }
- $temp[$CI->lang->line('ut_'.$key)] = $val;
+ $val = $line;
}
+ $temp[$CI->lang->line('ut_'.$key)] = $val;
}
$retval[] = $temp;
@@ -375,4 +396,4 @@ function is_false($test)
}
/* End of file Unit_test.php */
-/* Location: ./system/libraries/Unit_test.php */ \ No newline at end of file
+/* Location: ./system/libraries/Unit_test.php */
diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php
index 76bbc244e..b3e9f7515 100644
--- a/system/libraries/Upload.php
+++ b/system/libraries/Upload.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* File Uploading Class
@@ -36,40 +37,210 @@
*/
class CI_Upload {
+ /**
+ * Maximum file size
+ *
+ * @var int
+ */
public $max_size = 0;
+
+ /**
+ * Maximum image width
+ *
+ * @var int
+ */
public $max_width = 0;
+
+ /**
+ * Maximum image height
+ *
+ * @var int
+ */
public $max_height = 0;
+
+ /**
+ * Maximum filename length
+ *
+ * @var int
+ */
public $max_filename = 0;
+
+ /**
+ * Maximum duplicate filename increment ID
+ *
+ * @var int
+ */
public $max_filename_increment = 100;
+
+ /**
+ * Allowed file types
+ *
+ * @var string
+ */
public $allowed_types = '';
+
+ /**
+ * Temporary filename
+ *
+ * @var string
+ */
public $file_temp = '';
+
+ /**
+ * Filename
+ *
+ * @var string
+ */
public $file_name = '';
+
+ /**
+ * Original filename
+ *
+ * @var string
+ */
public $orig_name = '';
+
+ /**
+ * File type
+ *
+ * @var string
+ */
public $file_type = '';
- public $file_size = '';
+
+ /**
+ * File size
+ *
+ * @var int
+ */
+ public $file_size = NULL;
+
+ /**
+ * Filename extension
+ *
+ * @var string
+ */
public $file_ext = '';
+
+ /**
+ * Upload path
+ *
+ * @var string
+ */
public $upload_path = '';
+
+ /**
+ * Overwrite flag
+ *
+ * @var bool
+ */
public $overwrite = FALSE;
+
+ /**
+ * Obfuscate filename flag
+ *
+ * @var bool
+ */
public $encrypt_name = FALSE;
+
+ /**
+ * Is image flag
+ *
+ * @var bool
+ */
public $is_image = FALSE;
- public $image_width = '';
- public $image_height = '';
+
+ /**
+ * Image width
+ *
+ * @var int
+ */
+ public $image_width = NULL;
+
+ /**
+ * Image height
+ *
+ * @var int
+ */
+ public $image_height = NULL;
+
+ /**
+ * Image type
+ *
+ * @var string
+ */
public $image_type = '';
+
+ /**
+ * Image size string
+ *
+ * @var string
+ */
public $image_size_str = '';
+
+ /**
+ * Error messages list
+ *
+ * @var array
+ */
public $error_msg = array();
+
+ /**
+ * MIME types list
+ *
+ * @var array
+ */
public $mimes = array();
+
+ /**
+ * Remove spaces flag
+ *
+ * @var bool
+ */
public $remove_spaces = TRUE;
+
+ /**
+ * MIME detection flag
+ *
+ * @var bool
+ */
public $detect_mime = TRUE;
+
+ /**
+ * XSS filter flag
+ *
+ * @var bool
+ */
public $xss_clean = FALSE;
+
+ /**
+ * Temporary filename prefix
+ *
+ * @var string
+ */
public $temp_prefix = 'temp_file_';
+
+ /**
+ * Filename sent by the client
+ *
+ * @var bool
+ */
public $client_name = '';
+ // --------------------------------------------------------------------
+
+ /**
+ * Filename override
+ *
+ * @var string
+ */
protected $_file_name_override = '';
+ // --------------------------------------------------------------------
+
/**
* Constructor
*
- * @param array
+ * @param array $props
* @return void
*/
public function __construct($props = array())
@@ -89,7 +260,7 @@ class CI_Upload {
/**
* Initialize preferences
*
- * @param array
+ * @param array $config
* @return void
*/
public function initialize($config = array())
@@ -105,14 +276,14 @@ class CI_Upload {
'file_name' => '',
'orig_name' => '',
'file_type' => '',
- 'file_size' => '',
+ 'file_size' => NULL,
'file_ext' => '',
'upload_path' => '',
'overwrite' => FALSE,
'encrypt_name' => FALSE,
'is_image' => FALSE,
- 'image_width' => '',
- 'image_height' => '',
+ 'image_width' => NULL,
+ 'image_height' => NULL,
'image_type' => '',
'image_size_str' => '',
'error_msg' => array(),
@@ -154,7 +325,7 @@ class CI_Upload {
/**
* Perform the file upload
*
- * @param string $field = 'userfile'
+ * @param string $field
* @return bool
*/
public function do_upload($field = 'userfile')
@@ -356,7 +527,7 @@ class CI_Upload {
* Returns an associative array containing all of the information
* related to the upload, allowing the developer easy access in one array.
*
- * @param string
+ * @param string $index
* @return mixed
*/
public function data($index = NULL)
@@ -391,7 +562,7 @@ class CI_Upload {
/**
* Set Upload Path
*
- * @param string
+ * @param string $path
* @return void
*/
public function set_upload_path($path)
@@ -409,8 +580,8 @@ class CI_Upload {
* 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.
*
- * @param string
- * @param string
+ * @param string $path
+ * @param string $filename
* @return string
*/
public function set_filename($path, $filename)
@@ -454,7 +625,7 @@ class CI_Upload {
/**
* Set Maximum File Size
*
- * @param int
+ * @param int $n
* @return void
*/
public function set_max_filesize($n)
@@ -467,7 +638,7 @@ class CI_Upload {
/**
* Set Maximum File Name Length
*
- * @param int
+ * @param int $n
* @return void
*/
public function set_max_filename($n)
@@ -480,7 +651,7 @@ class CI_Upload {
/**
* Set Maximum Image Width
*
- * @param int
+ * @param int $n
* @return void
*/
public function set_max_width($n)
@@ -493,7 +664,7 @@ class CI_Upload {
/**
* Set Maximum Image Height
*
- * @param int
+ * @param int $n
* @return void
*/
public function set_max_height($n)
@@ -506,7 +677,7 @@ class CI_Upload {
/**
* Set Allowed File Types
*
- * @param string
+ * @param string $types
* @return void
*/
public function set_allowed_types($types)
@@ -526,7 +697,7 @@ class CI_Upload {
*
* Uses GD to determine the width/height/type of image
*
- * @param string
+ * @param string $path
* @return void
*/
public function set_image_properties($path = '')
@@ -558,7 +729,7 @@ class CI_Upload {
* Enables the XSS flag so that the file that was uploaded
* will be run through the XSS filter.
*
- * @param bool
+ * @param bool $flag
* @return void
*/
public function set_xss_clean($flag = FALSE)
@@ -600,7 +771,7 @@ class CI_Upload {
/**
* Verify that the filetype is allowed
*
- * @param bool
+ * @param bool $ignore_mime
* @return bool
*/
public function is_allowed_filetype($ignore_mime = FALSE)
@@ -737,7 +908,7 @@ class CI_Upload {
/**
* Extract the file extension
*
- * @param string
+ * @param string $filename
* @return string
*/
public function get_extension($filename)
@@ -751,7 +922,7 @@ class CI_Upload {
/**
* Clean the file name for security
*
- * @param string
+ * @param string $filename
* @return string
*/
public function clean_file_name($filename)
@@ -885,7 +1056,7 @@ class CI_Upload {
/**
* Set an error message
*
- * @param string
+ * @param string $msg
* @return void
*/
public function set_error($msg)
@@ -915,8 +1086,8 @@ class CI_Upload {
/**
* Display the error message
*
- * @param string
- * @param string
+ * @param string $open
+ * @param string $close
* @return string
*/
public function display_errors($open = '<p>', $close = '</p>')
@@ -932,7 +1103,7 @@ class CI_Upload {
* This is a list of mime types. We use it to validate
* the "allowed types" set by the developer
*
- * @param string
+ * @param string $mime
* @return string
*/
public function mimes_types($mime)
@@ -945,10 +1116,12 @@ class CI_Upload {
/**
* Prep Filename
*
- * Prevents possible script execution from Apache's handling of files multiple extensions
- * http://httpd.apache.org/docs/1.3/mod/mod_mime.html#multipleext
+ * Prevents possible script execution from Apache's handling
+ * of files' multiple extensions.
+ *
+ * @link http://httpd.apache.org/docs/1.3/mod/mod_mime.html#multipleext
*
- * @param string
+ * @param string $filename
* @return string
*/
protected function _prep_filename($filename)
@@ -985,7 +1158,7 @@ class CI_Upload {
* Detects the (actual) MIME type of the uploaded file, if possible.
* The input array is expected to be $_FILES[$field]
*
- * @param array
+ * @param array $file
* @return void
*/
protected function _file_mime_type($file)
@@ -1035,7 +1208,7 @@ class CI_Upload {
? 'file --brief --mime '.escapeshellarg($file['tmp_name']).' 2>&1'
: 'file --brief --mime '.$file['tmp_name'].' 2>&1';
- if (function_exists('exec'))
+ if (function_usable('exec'))
{
/* This might look confusing, as $mime is being populated with all of the output when set in the second parameter.
* However, we only neeed the last line, which is the actual return value of exec(), and as such - it overwrites
@@ -1050,7 +1223,7 @@ class CI_Upload {
}
}
- if ( (bool) @ini_get('safe_mode') === FALSE && function_exists('shell_exec'))
+ if ( (bool) @ini_get('safe_mode') === FALSE && function_usable('shell_exec'))
{
$mime = @shell_exec($cmd);
if (strlen($mime) > 0)
@@ -1064,7 +1237,7 @@ class CI_Upload {
}
}
- if (function_exists('popen'))
+ if (function_usable('popen'))
{
$proc = @popen($cmd, 'r');
if (is_resource($proc))
diff --git a/system/libraries/User_agent.php b/system/libraries/User_agent.php
index 3387d4aa6..e920578d9 100644
--- a/system/libraries/User_agent.php
+++ b/system/libraries/User_agent.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* User Agent Class
diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php
index 3ed050a2e..3ef823e29 100755
--- a/system/libraries/Xmlrpc.php
+++ b/system/libraries/Xmlrpc.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,14 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
+
+if ( ! function_exists('xml_parser_create'))
+{
+ show_error('Your PHP installation does not support XML');
+}
+
+// ------------------------------------------------------------------------
/**
* XML-RPC request handler class
@@ -34,56 +42,212 @@
* @author EllisLab Dev Team
* @link http://codeigniter.com/user_guide/libraries/xmlrpc.html
*/
-
-if ( ! function_exists('xml_parser_create'))
-{
- show_error('Your PHP installation does not support XML');
-}
-
-// ------------------------------------------------------------------------
-
class CI_Xmlrpc {
- public $debug = FALSE; // Debugging on or off
+ /**
+ * Debug flag
+ *
+ * @var bool
+ */
+ public $debug = FALSE;
+
+ /**
+ * I4 data type
+ *
+ * @var string
+ */
public $xmlrpcI4 = 'i4';
+
+ /**
+ * Integer data type
+ *
+ * @var string
+ */
public $xmlrpcInt = 'int';
+
+ /**
+ * Boolean data type
+ *
+ * @var string
+ */
public $xmlrpcBoolean = 'boolean';
+
+ /**
+ * Double data type
+ *
+ * @var string
+ */
public $xmlrpcDouble = 'double';
+
+ /**
+ * String data type
+ *
+ * @var string
+ */
public $xmlrpcString = 'string';
+
+ /**
+ * DateTime format
+ *
+ * @var string
+ */
public $xmlrpcDateTime = 'dateTime.iso8601';
+
+ /**
+ * Base64 data type
+ *
+ * @var string
+ */
public $xmlrpcBase64 = 'base64';
+
+ /**
+ * Array data type
+ *
+ * @var string
+ */
public $xmlrpcArray = 'array';
+
+ /**
+ * Struct data type
+ *
+ * @var string
+ */
public $xmlrpcStruct = 'struct';
+ /**
+ * Data types list
+ *
+ * @var array
+ */
public $xmlrpcTypes = array();
+
+ /**
+ * Valid parents list
+ *
+ * @var array
+ */
public $valid_parents = array();
- public $xmlrpcerr = array(); // Response numbers
- public $xmlrpcstr = array(); // Response strings
+ /**
+ * Response error numbers list
+ *
+ * @var array
+ */
+ public $xmlrpcerr = array();
+
+ /**
+ * Response error messages list
+ *
+ * @var string[]
+ */
+ public $xmlrpcstr = array();
+
+ /**
+ * Encoding charset
+ *
+ * @var string
+ */
public $xmlrpc_defencoding = 'UTF-8';
+
+ /**
+ * XML-RPC client name
+ *
+ * @var string
+ */
public $xmlrpcName = 'XML-RPC for CodeIgniter';
+
+ /**
+ * XML-RPC version
+ *
+ * @var string
+ */
public $xmlrpcVersion = '1.1';
- public $xmlrpcerruser = 800; // Start of user errors
- public $xmlrpcerrxml = 100; // Start of XML Parse errors
- public $xmlrpc_backslash = ''; // formulate backslashes for escaping regexp
+ /**
+ * Start of user errors
+ *
+ * @var int
+ */
+ public $xmlrpcerruser = 800;
+
+ /**
+ * Start of XML parse errors
+ *
+ * @var int
+ */
+ public $xmlrpcerrxml = 100;
+
+ /**
+ * Backslash replacement value
+ *
+ * @var string
+ */
+ public $xmlrpc_backslash = '';
+
+ /**
+ * XML-RPC Client object
+ *
+ * @var object
+ */
public $client;
+
+ /**
+ * XML-RPC Method name
+ *
+ * @var string
+ */
public $method;
+
+ /**
+ * XML-RPC Data
+ *
+ * @var array
+ */
public $data;
+
+ /**
+ * XML-RPC Message
+ *
+ * @var string
+ */
public $message = '';
- public $error = ''; // Error string for request
+
+ /**
+ * Request error message
+ *
+ * @var string
+ */
+ public $error = '';
+
+ /**
+ * XML-RPC result object
+ *
+ * @var object
+ */
public $result;
+
+ /**
+ * XML-RPC Reponse
+ *
+ * @var array
+ */
public $response = array(); // Response from remote server
+ /**
+ * XSS Filter flag
+ *
+ * @var bool
+ */
public $xss_clean = TRUE;
+ // --------------------------------------------------------------------
/**
* Constructor
*
* Initializes property default values
*
- * @param array
+ * @param array $config
* @return void
*/
public function __construct($config = array())
@@ -148,7 +312,7 @@ class CI_Xmlrpc {
/**
* Initialize
*
- * @param array
+ * @param array $config
* @return void
*/
public function initialize($config = array())
@@ -171,9 +335,9 @@ class CI_Xmlrpc {
* Parse server URL
*
* @param string $url
- * @param int $port = 80
- * @param string $proxy = FALSE
- * @param int $proxy_port = 8080
+ * @param int $port
+ * @param string $proxy
+ * @param int $proxy_port
* @return void
*/
public function server($url, $port = 80, $proxy = FALSE, $proxy_port = 8080)
@@ -200,7 +364,7 @@ class CI_Xmlrpc {
/**
* Set Timeout
*
- * @param int seconds
+ * @param int $seconds
* @return void
*/
public function timeout($seconds = 5)
@@ -216,7 +380,7 @@ class CI_Xmlrpc {
/**
* Set Methods
*
- * @param string method name
+ * @param string $function Method name
* @return void
*/
public function method($function)
@@ -229,7 +393,7 @@ class CI_Xmlrpc {
/**
* Take Array of Data and Create Objects
*
- * @param array
+ * @param array $incoming
* @return void
*/
public function request($incoming)
@@ -253,7 +417,7 @@ class CI_Xmlrpc {
/**
* Set Debug
*
- * @param bool
+ * @param bool $flag
* @return void
*/
public function set_debug($flag = TRUE)
@@ -266,7 +430,7 @@ class CI_Xmlrpc {
/**
* Values Parsing
*
- * @param mixed
+ * @param mixed $value
* @return object
*/
public function values_parsing($value)
@@ -349,8 +513,8 @@ class CI_Xmlrpc {
/**
* Sends an Error Message for Server Request
*
- * @param int
- * @param string
+ * @param int $number
+ * @param string $message
* @return object
*/
public function send_error_message($number, $message)
@@ -363,7 +527,7 @@ class CI_Xmlrpc {
/**
* Send Response for Server Request
*
- * @param array
+ * @param array $response
* @return object
*/
public function send_response($response)
@@ -384,24 +548,79 @@ class CI_Xmlrpc {
*/
class XML_RPC_Client extends CI_Xmlrpc
{
+ /**
+ * Path
+ *
+ * @var string
+ */
public $path = '';
+
+ /**
+ * Server hostname
+ *
+ * @var string
+ */
public $server = '';
+
+ /**
+ * Server port
+ *
+ * @var int
+ */
public $port = 80;
+
+ /**
+ * Proxy hostname
+ *
+ * @var string
+ */
public $proxy = FALSE;
+
+ /**
+ * Proxy port
+ *
+ * @var int
+ */
public $proxy_port = 8080;
+
+ /**
+ * Error number
+ *
+ * @var string
+ */
public $errno = '';
+
+ /**
+ * Error message
+ *
+ * @var string
+ */
public $errstring = '';
+
+ /**
+ * Timeout in seconds
+ *
+ * @var int
+ */
public $timeout = 5;
+
+ /**
+ * No Multicall flag
+ *
+ * @var bool
+ */
public $no_multicall = FALSE;
+ // --------------------------------------------------------------------
+
/**
* Constructor
*
* @param string $path
* @param object $server
- * @param int $port = 80
- * @param string $proxy = FALSE
- * @param int $proxy_port = 8080
+ * @param int $port
+ * @param string $proxy
+ * @param int $proxy_port
* @return void
*/
public function __construct($path, $server, $port = 80, $proxy = FALSE, $proxy_port = 8080)
@@ -420,7 +639,7 @@ class XML_RPC_Client extends CI_Xmlrpc
/**
* Send message
*
- * @param mixed
+ * @param mixed $msg
* @return object
*/
public function send($msg)
@@ -439,7 +658,7 @@ class XML_RPC_Client extends CI_Xmlrpc
/**
* Send payload
*
- * @param object
+ * @param object $msg
* @return object
*/
public function sendPayload($msg)
@@ -499,18 +718,50 @@ class XML_RPC_Client extends CI_Xmlrpc
*/
class XML_RPC_Response
{
+
+ /**
+ * Value
+ *
+ * @var mixed
+ */
public $val = 0;
+
+ /**
+ * Error number
+ *
+ * @var int
+ */
public $errno = 0;
+
+ /**
+ * Error message
+ *
+ * @var string
+ */
public $errstr = '';
+
+ /**
+ * Headers list
+ *
+ * @var array
+ */
public $headers = array();
+
+ /**
+ * XSS Filter flag
+ *
+ * @var bool
+ */
public $xss_clean = TRUE;
+ // --------------------------------------------------------------------
+
/**
* Constructor
*
- * @param mixed
- * @param int
- * @param string
+ * @param mixed $val
+ * @param int $code
+ * @param string $fstr
* @return void
*/
public function __construct($val, $code = 0, $fstr = '')
@@ -716,16 +967,42 @@ class XML_RPC_Response
*/
class XML_RPC_Message extends CI_Xmlrpc
{
+
+ /**
+ * Payload
+ *
+ * @var string
+ */
public $payload;
+
+ /**
+ * Method name
+ *
+ * @var string
+ */
public $method_name;
+
+ /**
+ * Parameter list
+ *
+ * @var array
+ */
public $params = array();
+
+ /**
+ * XH?
+ *
+ * @var array
+ */
public $xh = array();
+ // --------------------------------------------------------------------
+
/**
* Constructor
*
- * @param string method name
- * @param array
+ * @param string $method
+ * @param array $pars
* @return void
*/
public function __construct($method, $pars = FALSE)
@@ -1303,14 +1580,27 @@ class XML_RPC_Message extends CI_Xmlrpc
*/
class XML_RPC_Values extends CI_Xmlrpc
{
+ /**
+ * Value data
+ *
+ * @var array
+ */
public $me = array();
+
+ /**
+ * Value type
+ *
+ * @var int
+ */
public $mytype = 0;
+ // --------------------------------------------------------------------
+
/**
* Constructor
*
- * @param mixed
- * @param string
+ * @param mixed $val
+ * @param string $type
* @return void
*/
public function __construct($val = -1, $type = '')
diff --git a/system/libraries/Xmlrpcs.php b/system/libraries/Xmlrpcs.php
index 5d01d374d..3c3337bf2 100644
--- a/system/libraries/Xmlrpcs.php
+++ b/system/libraries/Xmlrpcs.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
if ( ! function_exists('xml_parser_create'))
{
diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php
index 5c4c257f8..9ecd0de9f 100644
--- a/system/libraries/Zip.php
+++ b/system/libraries/Zip.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Zip Compression Class
diff --git a/system/libraries/javascript/Jquery.php b/system/libraries/javascript/Jquery.php
index ed02fadb7..2bf47957f 100644
--- a/system/libraries/javascript/Jquery.php
+++ b/system/libraries/javascript/Jquery.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -24,6 +24,7 @@
* @since Version 1.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Jquery Class
@@ -36,14 +37,57 @@
*/
class CI_Jquery extends CI_Javascript {
+ /**
+ * JavaScript directory location
+ *
+ * @var string
+ */
protected $_javascript_folder = 'js';
+
+ /**
+ * JQuery code for load
+ *
+ * @var array
+ */
public $jquery_code_for_load = array();
+
+ /**
+ * JQuery code for compile
+ *
+ * @var array
+ */
public $jquery_code_for_compile = array();
+
+ /**
+ * JQuery corner active flag
+ *
+ * @var bool
+ */
public $jquery_corner_active = FALSE;
+
+ /**
+ * JQuery table sorter active flag
+ *
+ * @var bool
+ */
public $jquery_table_sorter_active = FALSE;
+
+ /**
+ * JQuery table sorder pager active
+ *
+ * @var bool
+ */
public $jquery_table_sorter_pager_active = FALSE;
+
+ /**
+ * JQuery AJAX image
+ *
+ * @var string
+ */
public $jquery_ajax_img = '';
+ // --------------------------------------------------------------------
+
/**
* Constructor
*
@@ -382,8 +426,8 @@ class CI_Jquery extends CI_Javascript {
*
* Outputs a jQuery addClass event
*
- * @param string $element = 'this'
- * @param string $class = ''
+ * @param string $element
+ * @param string $class
* @return string
*/
protected function _addClass($element = 'this', $class = '')
@@ -399,10 +443,10 @@ class CI_Jquery extends CI_Javascript {
*
* Outputs a jQuery animate event
*
- * @param string $element = 'this'
- * @param array $params = array()
- * @param string $speed = '' 'slow', 'normal', 'fast', or time in milliseconds
- * @param string $extra = ''
+ * @param string $element
+ * @param array $params
+ * @param string $speed 'slow', 'normal', 'fast', or time in milliseconds
+ * @param string $extra
* @return string
*/
protected function _animate($element = 'this', $params = array(), $speed = '', $extra = '')
@@ -514,8 +558,8 @@ class CI_Jquery extends CI_Javascript {
*
* Outputs a jQuery remove class event
*
- * @param string $element = 'this'
- * @param string $class = ''
+ * @param string $element
+ * @param string $class
* @return string
*/
protected function _removeClass($element = 'this', $class = '')
@@ -622,8 +666,8 @@ class CI_Jquery extends CI_Javascript {
*
* Outputs a jQuery toggle class event
*
- * @param string $element = 'this'
- * @param string $class = ''
+ * @param string $element
+ * @param string $class
* @return string
*/
protected function _toggleClass($element = 'this', $class = '')
@@ -707,9 +751,9 @@ class CI_Jquery extends CI_Javascript {
/**
* Zebra tables
*
- * @param string $class = ''
- * @param string $odd = 'odd'
- * @param string $hover = ''
+ * @param string $class
+ * @param string $odd
+ * @param string $hover
* @return string
*/
protected function _zebraTables($class = '', $odd = 'odd', $hover = '')
@@ -734,10 +778,9 @@ class CI_Jquery extends CI_Javascript {
/**
* Corner Plugin
*
- * http://www.malsup.com/jquery/corner/
- *
- * @param string $element = ''
- * @param string $corner_style = ''
+ * @link http://www.malsup.com/jquery/corner/
+ * @param string $element
+ * @param string $corner_style
* @return string
*/
public function corner($element = '', $corner_style = '')
@@ -761,7 +804,7 @@ class CI_Jquery extends CI_Javascript {
* Load a thickbox modal window
*
* @param string $src
- * @param bool $relative = FALSE
+ * @param bool $relative
* @return void
*/
public function modal($src, $relative = FALSE)
@@ -777,7 +820,7 @@ class CI_Jquery extends CI_Javascript {
* Load an Effect library
*
* @param string $src
- * @param bool $relative = FALSE
+ * @param bool $relative
* @return void
*/
public function effect($src, $relative = FALSE)
@@ -793,7 +836,7 @@ class CI_Jquery extends CI_Javascript {
* Load a plugin library
*
* @param string $src
- * @param bool $relative = FALSE
+ * @param bool $relative
* @return void
*/
public function plugin($src, $relative = FALSE)
@@ -809,7 +852,7 @@ class CI_Jquery extends CI_Javascript {
* Load a user interface library
*
* @param string $src
- * @param bool $relative = FALSE
+ * @param bool $relative
* @return void
*/
public function ui($src, $relative = FALSE)
@@ -825,7 +868,7 @@ class CI_Jquery extends CI_Javascript {
* Creates a jQuery sortable
*
* @param string $element
- * @param array $options = array()
+ * @param array $options
* @return string
*/
public function sortable($element, $options = array())
@@ -896,8 +939,8 @@ class CI_Jquery extends CI_Javascript {
* As events are specified, they are stored in an array
* This funciton compiles them all for output on a page
*
- * @param string $view_var = 'script_foot'
- * @param bool $script_tags = TRUE
+ * @param string $view_var
+ * @param bool $script_tags
* @return void
*/
protected function _compile($view_var = 'script_foot', $script_tags = TRUE)
@@ -963,8 +1006,8 @@ class CI_Jquery extends CI_Javascript {
*
* Outputs the script tag that loads the jquery.js file into an HTML document
*
- * @param string $library_src = ''
- * @param bool $relative = FALSE
+ * @param string $library_src
+ * @param bool $relative
* @return string
*/
public function script($library_src = '', $relative = FALSE)