diff --git a/application/config/mimes.php b/application/config/mimes.php index f00e5b6ed..ad9d7aeae 100644 --- a/application/config/mimes.php +++ b/application/config/mimes.php @@ -93,8 +93,8 @@ $mimes = array( 'hqx' => 'application/mac-binhex40', 'avi' => 'video/x-msvideo', 'movie' => 'video/x-sgi-movie', 'doc' => 'application/msword', - 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip'), + 'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip'), 'word' => array('application/msword', 'application/octet-stream'), 'xl' => 'application/excel', 'eml' => 'message/rfc822', @@ -103,4 +103,4 @@ $mimes = array( 'hqx' => 'application/mac-binhex40', /* End of file mimes.php */ -/* Location: ./application/config/mimes.php */ +/* Location: ./application/config/mimes.php */ \ No newline at end of file diff --git a/application/language/fr/common_lang.php b/application/language/fr/common_lang.php new file mode 100644 index 000000000..97fd1614f --- /dev/null +++ b/application/language/fr/common_lang.php @@ -0,0 +1,42 @@ + diff --git a/application/language/fr/config_lang.php b/application/language/fr/config_lang.php new file mode 100644 index 000000000..7e6c327a1 --- /dev/null +++ b/application/language/fr/config_lang.php @@ -0,0 +1,35 @@ + diff --git a/application/language/fr/customers_lang.php b/application/language/fr/customers_lang.php new file mode 100644 index 000000000..009fe7134 --- /dev/null +++ b/application/language/fr/customers_lang.php @@ -0,0 +1,16 @@ + diff --git a/application/language/fr/employees_lang.php b/application/language/fr/employees_lang.php new file mode 100644 index 000000000..7c248afd2 --- /dev/null +++ b/application/language/fr/employees_lang.php @@ -0,0 +1,27 @@ + diff --git a/application/language/fr/error_lang.php b/application/language/fr/error_lang.php new file mode 100644 index 000000000..3056cb294 --- /dev/null +++ b/application/language/fr/error_lang.php @@ -0,0 +1,4 @@ + diff --git a/application/language/fr/form_validation_lang.php b/application/language/fr/form_validation_lang.php new file mode 100644 index 000000000..ea62540bd --- /dev/null +++ b/application/language/fr/form_validation_lang.php @@ -0,0 +1,29 @@ + diff --git a/application/language/fr/index.html b/application/language/fr/index.html new file mode 100644 index 000000000..9b639debe --- /dev/null +++ b/application/language/fr/index.html @@ -0,0 +1,10 @@ + +
+Acces interdit à ce répertoire.
+ + + diff --git a/application/language/fr/item_kits_lang.php b/application/language/fr/item_kits_lang.php new file mode 100644 index 000000000..a7f8662ec --- /dev/null +++ b/application/language/fr/item_kits_lang.php @@ -0,0 +1,20 @@ + diff --git a/application/language/fr/items_lang.php b/application/language/fr/items_lang.php new file mode 100644 index 000000000..fd31107a3 --- /dev/null +++ b/application/language/fr/items_lang.php @@ -0,0 +1,81 @@ + diff --git a/application/language/fr/login_lang.php b/application/language/fr/login_lang.php new file mode 100644 index 000000000..22b2a65ac --- /dev/null +++ b/application/language/fr/login_lang.php @@ -0,0 +1,8 @@ + diff --git a/application/language/fr/module_lang.php b/application/language/fr/module_lang.php new file mode 100644 index 000000000..5d5869335 --- /dev/null +++ b/application/language/fr/module_lang.php @@ -0,0 +1,34 @@ + diff --git a/application/language/fr/receivings_lang.php b/application/language/fr/receivings_lang.php new file mode 100644 index 000000000..06bda8a04 --- /dev/null +++ b/application/language/fr/receivings_lang.php @@ -0,0 +1,26 @@ + diff --git a/application/language/fr/reports_lang.php b/application/language/fr/reports_lang.php new file mode 100644 index 000000000..1a1cdac35 --- /dev/null +++ b/application/language/fr/reports_lang.php @@ -0,0 +1,90 @@ + diff --git a/application/language/fr/sales_lang.php b/application/language/fr/sales_lang.php new file mode 100644 index 000000000..122e9908c --- /dev/null +++ b/application/language/fr/sales_lang.php @@ -0,0 +1,87 @@ + diff --git a/application/language/fr/suppliers_lang.php b/application/language/fr/suppliers_lang.php new file mode 100644 index 000000000..fb09a1abd --- /dev/null +++ b/application/language/fr/suppliers_lang.php @@ -0,0 +1,17 @@ + diff --git a/application/language/nl-BE/.site_lang.php.swp b/application/language/nl-BE/.site_lang.php.swp deleted file mode 100644 index 20cb117b0..000000000 Binary files a/application/language/nl-BE/.site_lang.php.swp and /dev/null differ diff --git a/application/views/config.php b/application/views/config.php index 4460c03d6..b85afcba9 100644 --- a/application/views/config.php +++ b/application/views/config.php @@ -148,8 +148,9 @@ echo form_open('config/save/',array('id'=>'config_form')); 'ru' => 'Russian', 'nl-BE' => 'Dutch', 'zh' => 'Chinese', - 'id' => 'Indonesia', - 'th' => 'Thailand' + 'id' => 'Indonesian', + 'fr' => 'French', + 'th' => 'Thai' ), $this->config->item('language')); ?> diff --git a/database/database.sql b/database/database.sql index e358702fc..3888292de 100644 --- a/database/database.sql +++ b/database/database.sql @@ -599,7 +599,7 @@ CREATE TABLE `ospos_sales_suspended_payments` ( CREATE TABLE `ospos_sessions` ( `session_id` varchar(40) NOT NULL DEFAULT '0', - `ip_address` varchar(16) NOT NULL DEFAULT '0', + `ip_address` varchar(45) NOT NULL DEFAULT '0', `user_agent` varchar(120) NOT NULL, `last_activity` int(10) unsigned NOT NULL DEFAULT '0', `user_data` text, diff --git a/index.php b/index.php index 54e5e605d..f4ac11a72 100644 --- a/index.php +++ b/index.php @@ -18,7 +18,7 @@ * NOTE: If you change these, also change the error_reporting() code below * */ - define('ENVIRONMENT', 'production'); + define('ENVIRONMENT', 'development'); /* *--------------------------------------------------------------- * ERROR REPORTING diff --git a/system/core/Benchmark.php b/system/core/Benchmark.php index a200727ab..a5c3e999b 100644 --- a/system/core/Benchmark.php +++ b/system/core/Benchmark.php @@ -6,7 +6,7 @@ * * @package CodeIgniter * @author ExpressionEngine Dev Team - * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. * @license http://codeigniter.com/user_guide/license.html * @link http://codeigniter.com * @since Version 1.0 diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php index 7e5ac2a98..34078174a 100644 --- a/system/core/CodeIgniter.php +++ b/system/core/CodeIgniter.php @@ -6,7 +6,7 @@ * * @package CodeIgniter * @author ExpressionEngine Dev Team - * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. * @license http://codeigniter.com/user_guide/license.html * @link http://codeigniter.com * @since Version 1.0 @@ -33,7 +33,7 @@ * @var string * */ - define('CI_VERSION', '2.1.0'); + define('CI_VERSION', '2.2.0'); /** * CodeIgniter Branch (Core = TRUE, Reactor = FALSE) @@ -353,6 +353,7 @@ show_404("{$class}/{$method}"); } } + // Call the requested method. // Any URI segments present (besides the class/function) will be passed to the method for convenience call_user_func_array(array(&$CI, $method), array_slice($URI->rsegments, 2)); diff --git a/system/core/Common.php b/system/core/Common.php index d79375475..713b21d85 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -6,7 +6,7 @@ * * @package CodeIgniter * @author ExpressionEngine Dev Team - * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. * @license http://codeigniter.com/user_guide/license.html * @link http://codeigniter.com * @since Version 1.0 @@ -187,7 +187,7 @@ if ( ! function_exists('load_class')) */ if ( ! function_exists('is_loaded')) { - function is_loaded($class = '') + function &is_loaded($class = '') { static $_is_loaded = array(); diff --git a/system/core/Config.php b/system/core/Config.php index 714c4667b..46ed9365c 100644 --- a/system/core/Config.php +++ b/system/core/Config.php @@ -6,7 +6,7 @@ * * @package CodeIgniter * @author ExpressionEngine Dev Team - * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. * @license http://codeigniter.com/user_guide/license.html * @link http://codeigniter.com * @since Version 1.0 @@ -99,12 +99,12 @@ class CI_Config { $found = FALSE; $loaded = FALSE; + $check_locations = defined('ENVIRONMENT') + ? array(ENVIRONMENT.'/'.$file, $file) + : array($file); + foreach ($this->_config_paths as $path) { - $check_locations = defined('ENVIRONMENT') - ? array(ENVIRONMENT.'/'.$file, $file) - : array($file); - foreach ($check_locations as $location) { $file_path = $path.'config/'.$location.'.php'; @@ -168,7 +168,7 @@ class CI_Config { { return FALSE; } - show_error('The configuration file '.$file.'.php'.' does not exist.'); + show_error('The configuration file '.$file.'.php does not exist.'); } return TRUE; @@ -279,7 +279,7 @@ class CI_Config { */ function base_url($uri = '') { - return $this->slash_item('base_url').ltrim($this->_uri_string($uri),'/'); + return $this->slash_item('base_url').ltrim($this->_uri_string($uri), '/'); } // ------------------------------------------------------------- diff --git a/system/core/Controller.php b/system/core/Controller.php index fddb81e19..6ccaf9755 100644 --- a/system/core/Controller.php +++ b/system/core/Controller.php @@ -6,7 +6,7 @@ * * @package CodeIgniter * @author ExpressionEngine Dev Team - * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. * @license http://codeigniter.com/user_guide/license.html * @link http://codeigniter.com * @since Version 1.0 @@ -37,7 +37,7 @@ class CI_Controller { public function __construct() { self::$instance =& $this; - + // Assign all the class objects that were instantiated by the // bootstrap file (CodeIgniter.php) to local class variables // so that CI can run as one big super object. diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index 869739a5a..451209689 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -6,7 +6,7 @@ * * @package CodeIgniter * @author ExpressionEngine Dev Team - * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. * @license http://codeigniter.com/user_guide/license.html * @link http://codeigniter.com * @since Version 1.0 diff --git a/system/core/Hooks.php b/system/core/Hooks.php index 33f1c034c..ee5c23076 100644 --- a/system/core/Hooks.php +++ b/system/core/Hooks.php @@ -6,7 +6,7 @@ * * @package CodeIgniter * @author ExpressionEngine Dev Team - * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. * @license http://codeigniter.com/user_guide/license.html * @link http://codeigniter.com * @since Version 1.0 diff --git a/system/core/Input.php b/system/core/Input.php index 9bfb5f1fb..88afa8c7e 100644 --- a/system/core/Input.php +++ b/system/core/Input.php @@ -6,7 +6,7 @@ * * @package CodeIgniter * @author ExpressionEngine Dev Team - * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. * @license http://codeigniter.com/user_guide/license.html * @link http://codeigniter.com * @since Version 1.0 @@ -73,13 +73,13 @@ class CI_Input { */ protected $headers = array(); - /** * Constructor * * Sets whether to globally enable the XSS processing * and whether to allow the $_GET array * + * @return void */ public function __construct() { @@ -306,51 +306,50 @@ class CI_Input { /** * Fetch the IP Address * - * @access public * @return string */ - function ip_address() + public function ip_address() { if ($this->ip_address !== FALSE) { return $this->ip_address; } - if (config_item('proxy_ips') != '' && $this->server('HTTP_X_FORWARDED_FOR') && $this->server('REMOTE_ADDR')) + $proxy_ips = config_item('proxy_ips'); + if ( ! empty($proxy_ips)) { - $proxies = preg_split('/[\s,]/', config_item('proxy_ips'), -1, PREG_SPLIT_NO_EMPTY); - $proxies = is_array($proxies) ? $proxies : array($proxies); + $proxy_ips = explode(',', str_replace(' ', '', $proxy_ips)); + foreach (array('HTTP_X_FORWARDED_FOR', 'HTTP_CLIENT_IP', 'HTTP_X_CLIENT_IP', 'HTTP_X_CLUSTER_CLIENT_IP') as $header) + { + if (($spoof = $this->server($header)) !== FALSE) + { + // Some proxies typically list the whole chain of IP + // addresses through which the client has reached us. + // e.g. client_ip, proxy_ip1, proxy_ip2, etc. + if (strpos($spoof, ',') !== FALSE) + { + $spoof = explode(',', $spoof, 2); + $spoof = $spoof[0]; + } - $this->ip_address = in_array($_SERVER['REMOTE_ADDR'], $proxies) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; + if ( ! $this->valid_ip($spoof)) + { + $spoof = FALSE; + } + else + { + break; + } + } + } + + $this->ip_address = ($spoof !== FALSE && in_array($_SERVER['REMOTE_ADDR'], $proxy_ips, TRUE)) + ? $spoof : $_SERVER['REMOTE_ADDR']; } - elseif ($this->server('REMOTE_ADDR') AND $this->server('HTTP_CLIENT_IP')) - { - $this->ip_address = $_SERVER['HTTP_CLIENT_IP']; - } - elseif ($this->server('REMOTE_ADDR')) + else { $this->ip_address = $_SERVER['REMOTE_ADDR']; } - elseif ($this->server('HTTP_CLIENT_IP')) - { - $this->ip_address = $_SERVER['HTTP_CLIENT_IP']; - } - elseif ($this->server('HTTP_X_FORWARDED_FOR')) - { - $this->ip_address = $_SERVER['HTTP_X_FORWARDED_FOR']; - } - - if ($this->ip_address === FALSE) - { - $this->ip_address = '0.0.0.0'; - return $this->ip_address; - } - - if (strpos($this->ip_address, ',') !== FALSE) - { - $x = explode(',', $this->ip_address); - $this->ip_address = trim(end($x)); - } if ( ! $this->valid_ip($this->ip_address)) { @@ -365,18 +364,70 @@ class CI_Input { /** * Validate IP Address * - * Updated version suggested by Geert De Deckere - * * @access public * @param string - * @return string + * @param string ipv4 or ipv6 + * @return bool */ - function valid_ip($ip) + public function valid_ip($ip, $which = '') + { + $which = strtolower($which); + + // First check if filter_var is available + if (is_callable('filter_var')) + { + switch ($which) { + case 'ipv4': + $flag = FILTER_FLAG_IPV4; + break; + case 'ipv6': + $flag = FILTER_FLAG_IPV6; + break; + default: + $flag = ''; + break; + } + + return (bool) filter_var($ip, FILTER_VALIDATE_IP, $flag); + } + + if ($which !== 'ipv6' && $which !== 'ipv4') + { + if (strpos($ip, ':') !== FALSE) + { + $which = 'ipv6'; + } + elseif (strpos($ip, '.') !== FALSE) + { + $which = 'ipv4'; + } + else + { + return FALSE; + } + } + + $func = '_valid_'.$which; + return $this->$func($ip); + } + + // -------------------------------------------------------------------- + + /** + * Validate IPv4 Address + * + * Updated version suggested by Geert De Deckere + * + * @access protected + * @param string + * @return bool + */ + protected function _valid_ipv4($ip) { $ip_segments = explode('.', $ip); // Always 4 segments needed - if (count($ip_segments) != 4) + if (count($ip_segments) !== 4) { return FALSE; } @@ -385,6 +436,7 @@ class CI_Input { { return FALSE; } + // Check each segment foreach ($ip_segments as $segment) { @@ -401,6 +453,80 @@ class CI_Input { // -------------------------------------------------------------------- + /** + * Validate IPv6 Address + * + * @access protected + * @param string + * @return bool + */ + protected function _valid_ipv6($str) + { + // 8 groups, separated by : + // 0-ffff per group + // one set of consecutive 0 groups can be collapsed to :: + + $groups = 8; + $collapsed = FALSE; + + $chunks = array_filter( + preg_split('/(:{1,2})/', $str, NULL, PREG_SPLIT_DELIM_CAPTURE) + ); + + // Rule out easy nonsense + if (current($chunks) == ':' OR end($chunks) == ':') + { + return FALSE; + } + + // PHP supports IPv4-mapped IPv6 addresses, so we'll expect those as well + if (strpos(end($chunks), '.') !== FALSE) + { + $ipv4 = array_pop($chunks); + + if ( ! $this->_valid_ipv4($ipv4)) + { + return FALSE; + } + + $groups--; + } + + while ($seg = array_pop($chunks)) + { + if ($seg[0] == ':') + { + if (--$groups == 0) + { + return FALSE; // too many groups + } + + if (strlen($seg) > 2) + { + return FALSE; // long separator + } + + if ($seg == '::') + { + if ($collapsed) + { + return FALSE; // multiple collapsed + } + + $collapsed = TRUE; + } + } + elseif (preg_match("/[^0-9a-f]/i", $seg) OR strlen($seg) > 4) + { + return FALSE; // invalid segment + } + } + + return $collapsed OR $groups == 1; + } + + // -------------------------------------------------------------------- + /** * User Agent * @@ -515,8 +641,8 @@ class CI_Input { $_SERVER['PHP_SELF'] = strip_tags($_SERVER['PHP_SELF']); - // CSRF Protection check - if ($this->_enable_csrf == TRUE) + // CSRF Protection check on HTTP requests + if ($this->_enable_csrf == TRUE && ! $this->is_cli_request()) { $this->security->csrf_verify(); } @@ -710,11 +836,11 @@ class CI_Input { * * Test to see if a request was made from the command line * - * @return boolean + * @return bool */ public function is_cli_request() { - return (php_sapi_name() == 'cli') or defined('STDIN'); + return (php_sapi_name() === 'cli' OR defined('STDIN')); } } diff --git a/system/core/Lang.php b/system/core/Lang.php index 5ac671838..ef5d1080c 100644 --- a/system/core/Lang.php +++ b/system/core/Lang.php @@ -6,7 +6,7 @@ * * @package CodeIgniter * @author ExpressionEngine Dev Team - * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. * @license http://codeigniter.com/user_guide/license.html * @link http://codeigniter.com * @since Version 1.0 diff --git a/system/core/Loader.php b/system/core/Loader.php index 6b7ee0c28..b5b0634e6 100644 --- a/system/core/Loader.php +++ b/system/core/Loader.php @@ -6,7 +6,7 @@ * * @package CodeIgniter * @author ExpressionEngine Dev Team - * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. * @license http://codeigniter.com/user_guide/license.html * @link http://codeigniter.com * @since Version 1.0 diff --git a/system/core/Model.php b/system/core/Model.php index e15ffbebc..1f142509e 100644 --- a/system/core/Model.php +++ b/system/core/Model.php @@ -6,7 +6,7 @@ * * @package CodeIgniter * @author ExpressionEngine Dev Team - * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. * @license http://codeigniter.com/user_guide/license.html * @link http://codeigniter.com * @since Version 1.0 diff --git a/system/core/Output.php b/system/core/Output.php index ccecafd2b..7959befb7 100644 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -6,7 +6,7 @@ * * @package CodeIgniter * @author ExpressionEngine Dev Team - * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. * @license http://codeigniter.com/user_guide/license.html * @link http://codeigniter.com * @since Version 1.0 diff --git a/system/core/Router.php b/system/core/Router.php index 6da667472..b48a34562 100644 --- a/system/core/Router.php +++ b/system/core/Router.php @@ -6,7 +6,7 @@ * * @package CodeIgniter * @author ExpressionEngine Dev Team - * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. * @license http://codeigniter.com/user_guide/license.html * @link http://codeigniter.com * @since Version 1.0 diff --git a/system/core/Security.php b/system/core/Security.php index a3e227437..efa2df922 100644 --- a/system/core/Security.php +++ b/system/core/Security.php @@ -1,4 +1,4 @@ - '[removed]', - 'document.write' => '[removed]', - '.parentNode' => '[removed]', - '.innerHTML' => '[removed]', - 'window.location' => '[removed]', - '-moz-binding' => '[removed]', - '' => '-->', - ' '<![CDATA[', - '