diff --git a/.gitignore b/.gitignore index 131f98b0d48..176c075ede6 100644 --- a/.gitignore +++ b/.gitignore @@ -47,4 +47,4 @@ addons/shared_addons/plugins/* !addons/shared_addons/field_types addons/shared_addons/field_types/* !addons/shared_addons/field_types/index.html -system/cms/config/config.php +system/cms/config/config.php \ No newline at end of file diff --git a/installer/language/italian/complete_lang.php b/installer/language/italian/complete_lang.php index b0377fa4451..1164d5f32f9 100644 --- a/installer/language/italian/complete_lang.php +++ b/installer/language/italian/complete_lang.php @@ -5,7 +5,7 @@ $lang['intro_text'] = 'PyroCMS è stato installato ed è pronot! Per favore entra nel pannello di controllo con i seguenti parametri.'; $lang['email'] = 'E-mail'; $lang['password'] = 'Password'; -$lang['show_password'] = 'Show Password?'; #translate +$lang['show_password'] = 'Mostrare password?'; $lang['outro_text'] = 'Ed infine, elimina la cartella installer dal tuo server perchè se lasciata al suo posto può permettere l\'hackeraggio del tuo sito.'; $lang['go_website'] = 'Vai al sito'; diff --git a/installer/language/italian/global_lang.php b/installer/language/italian/global_lang.php index 714edd2381d..e1e3d1b66c4 100644 --- a/installer/language/italian/global_lang.php +++ b/installer/language/italian/global_lang.php @@ -7,5 +7,5 @@ $lang['step4'] = 'Passo #4'; $lang['final'] = 'Passo Finale'; -$lang['installer.passwords_match'] = "Passwords Match."; #translate -$lang['installer.passwords_dont_match'] = "Passwords Don\'t Match."; #translate \ No newline at end of file +$lang['installer.passwords_match'] = "Le password coincidono."; +$lang['installer.passwords_dont_match'] = "Le password non coincidono."; \ No newline at end of file diff --git a/installer/language/italian/index_lang.php b/installer/language/italian/index_lang.php index 5972a851ffe..4d3d0868ae4 100644 --- a/installer/language/italian/index_lang.php +++ b/installer/language/italian/index_lang.php @@ -5,3 +5,4 @@ $lang['text'] = 'Installare PyroCMS è molto semplice, segui i passaggi ed i messaggi a schermo. In caso di problemi nell\'installazione del sistema non preoccuparti, ti verrà spiegato cosa fare.'; $lang['step1'] = 'Passo 1'; $lang['link'] = 'Vai al primo passo'; + \ No newline at end of file diff --git a/installer/language/italian/step_1_lang.php b/installer/language/italian/step_1_lang.php index 3c7fa3fb6cf..4370e930048 100644 --- a/installer/language/italian/step_1_lang.php +++ b/installer/language/italian/step_1_lang.php @@ -6,7 +6,7 @@ $lang['db_settings'] = 'Impostazioni del Database'; $lang['db_text'] = 'Per verificare la versione del tuo server MySQL devi inserire hostname, username e password nel modulo sottostante. Questi parametri saranno inoltre usati per installare il database.'; -$lang['db_missing'] = 'The mysql database driver for PHP were not found, installation cannot continue. Ask your host or server administrator to install it.'; #translate +$lang['db_missing'] = 'I driver PHP per il database MySQL non sono stati trovati, non è possibile continuare con l\'installazione. Chiedi all\'amminsitratore del tuo server o al tuo hosting di installarli.'; $lang['server'] = 'Server'; $lang['username'] = 'Username'; @@ -14,9 +14,9 @@ $lang['portnr'] = 'Porta'; $lang['server_settings']= 'Impostazioni Server'; $lang['httpserver'] = 'HTTP Server'; -$lang['httpserver_text']= 'PyroCMS requires a HTTP Server to display dynamic content when a user goes to your website. It looks like you already have one by the fact that you can see this page, but if know exactly which type then PyroCMS can configure itself even better. If you do not know what any of this means just ignore it and carry on with the installation.'; #translate -$lang['rewrite_fail'] = 'You have selected "(Apache with mod_rewrite)" but we are unable to tell if mod_rewrite is enabled on your server. Ask your host if mod_rewrite is enabled or simply install at your own risk.'; -$lang['mod_rewrite'] = 'You have selected "(Apache with mod_rewrite)" but your server does not have the rewrite module enabled. Ask your host to enable it or install PyroCMS using the "Apache (without mod_rewrite)" option.'; +$lang['httpserver_text']= 'PyroCMS richiede un Server HTTP per mostrare il contenuto dinamico quando un utente visita il tuo sito. Sembra che ne possiedi già uno, infatti puoi vedere questa pagina, ma se sai esattamente quale PyroCMS puà configurarsi automaticamente al meglio. Se non sai quale è o non sai cosa tutto questo vuol dire ignora semplicemente il messaggio e vai avanti con l\'installazione.'; +$lang['rewrite_fail'] = 'Hai selezionato "(Apache con mod_rewrite)" ma non siamo in grado di assicurarti che il mod_rewrite sia abilitato sul tuo server. Prova a chiedere al tuo hosting se il mod_rewrite è abilitato o prova ad installarlo a tuo rischio.'; +$lang['mod_rewrite'] = 'Hai selezionato "(Apache con mod_rewrite)" ma il tuo server non ha il modulo abilitato. Chiedi al tuo hosting di abilitarlo o installa PyroCMS utilizzando l\'opzione "(Apache senza mod_rewrite)".'; $lang['step2'] = 'Passo 2'; // messages diff --git a/installer/language/italian/step_4_lang.php b/installer/language/italian/step_4_lang.php index ded435b358a..6a480bc08b4 100644 --- a/installer/language/italian/step_4_lang.php +++ b/installer/language/italian/step_4_lang.php @@ -2,15 +2,15 @@ // labels $lang['header'] = 'Passo 4: Crea il Database'; -$lang['intro_text'] = 'Complete the form below and hit the button labelled "Install" to install PyroCMS. Be sure to install PyroCMS into the right database since all existing changes will be lost!'; +$lang['intro_text'] = 'Completa i campi seguenti e clicca sul pulsante "Installa" per installare PyroCMS. Assicurati di installare PyroCMS nel database corretto perchè tutte le modifiche esistenti saranno perse!'; $lang['db_settings'] = 'Impstazioni Database'; $lang['db_create'] = 'Crea il Database'; $lang['db_notice'] = 'Potrebbe essere necessario farlo da soli'; $lang['default_user'] = 'Utente di Default'; $lang['database'] = 'Database'; -$lang['site_settings'] = 'Site Settings'; #translate -$lang['site_ref'] = 'Site Ref'; #translate +$lang['site_settings'] = 'Impostazioni Sito'; +$lang['site_ref'] = 'Site Ref'; $lang['user_name'] = 'Username'; $lang['first_name'] = 'Nome'; $lang['last_name'] = 'Cognome'; @@ -19,7 +19,7 @@ $lang['conf_password'] = 'Conferma Password'; $lang['finish'] = 'Installa'; -$lang['invalid_db_name'] = 'The database name you entered is invalid. Please use only alphanumeric characters and underscores.'; #translate +$lang['invalid_db_name'] = 'Il nome del database che hai inserito non è valido. Per favore usa solo caratteri alfanumerici e underscores (trattini bassi).'; $lang['error_101'] = 'Il database non è stato trovato. Se hai chiesto all\' installer di crearlo, il problema potrebbero essere i permessi non corretti.'; $lang['error_102'] = 'L\' installer non può aggiungere nessuna tabella al database.'; $lang['error_103'] = 'L\' installer non può inserire dati nel database.'; diff --git a/system/cms/config/constants.php b/system/cms/config/constants.php index ef4a2b5b521..c7027842928 100644 --- a/system/cms/config/constants.php +++ b/system/cms/config/constants.php @@ -85,7 +85,7 @@ | */ -define('CMS_VERSION', '2.2.0-dev'); +define('CMS_VERSION', '2.1.3-dev'); /* |-------------------------------------------------------------------------- diff --git a/system/cms/controllers/admin.php b/system/cms/controllers/admin.php index 7d024201d81..92b29593b9b 100644 --- a/system/cms/controllers/admin.php +++ b/system/cms/controllers/admin.php @@ -92,6 +92,8 @@ public function _check_login($email) { if ($this->ion_auth->login($email, $this->input->post('password'), (bool)$this->input->post('remember'))) { + Events::trigger('post_admin_login'); + return true; } diff --git a/system/cms/core/MY_Exceptions.php b/system/cms/core/MY_Exceptions.php index 50fb0ad90cd..8bce1f53161 100644 --- a/system/cms/core/MY_Exceptions.php +++ b/system/cms/core/MY_Exceptions.php @@ -24,7 +24,7 @@ function show_404($page = '', $log_error = TRUE) // Set the HTTP Status header set_status_header(404); - echo Modules::run('pages/_remap', '404'); + Modules::run('pages/_remap', '404'); } } \ No newline at end of file diff --git a/system/cms/core/REST_Controller.php b/system/cms/core/REST_Controller.php index 1aea761c4bc..011c90d212d 100644 --- a/system/cms/core/REST_Controller.php +++ b/system/cms/core/REST_Controller.php @@ -1,20 +1,24 @@ 'application/xml', - 'rawxml' => 'application/xml', 'json' => 'application/json', 'jsonp' => 'application/javascript', 'serialized' => 'application/vnd.php.serialized', @@ -112,7 +129,7 @@ class REST_Controller extends MY_Controller */ protected function early_checks() { - + } /** @@ -123,16 +140,26 @@ public function __construct() { parent::__construct(); + $this->_zlib_oc = @ini_get('zlib.output_compression'); + // Lets grab the config and get ready to party $this->load->config('rest'); // How is this request being made? POST, DELETE, GET, PUT? + $this->request = new stdClass(); $this->request->method = $this->_detect_method(); + // Create argument container, if nonexistent + if ( ! isset($this->{'_'.$this->request->method.'_args'})) + { + $this->{'_'.$this->request->method.'_args'} = array(); + } + // Set up our GET variables $this->_get_args = array_merge($this->_get_args, $this->uri->ruri_to_assoc()); //$this->load->library('security'); + // This library is bundled with REST_Controller 2.5+, but will eventually be part of CodeIgniter itself $this->load->library('format'); @@ -142,53 +169,21 @@ public function __construct() // Some Methods cant have a body $this->request->body = NULL; - switch ($this->request->method) - { - case 'get': - // Grab proper GET variables - parse_str(parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY), $get); - - // Merge both the URI segements and GET params - $this->_get_args = array_merge($this->_get_args, $get); - break; - - case 'post': - $this->_post_args = $_POST; - - $this->request->format and $this->request->body = file_get_contents('php://input'); - break; - - case 'put': - // It might be a HTTP body - if ($this->request->format) - { - $this->request->body = file_get_contents('php://input'); - } - - // If no file type is provided, this is probably just arguments - else - { - parse_str(file_get_contents('php://input'), $this->_put_args); - } - - break; - - case 'delete': - // Set up out DELETE variables (which shouldn't really exist, but sssh!) - parse_str(file_get_contents('php://input'), $this->_delete_args); - break; - } + $this->{'_parse_' . $this->request->method}(); // Now we know all about our request, let's try and parse the body if it exists if ($this->request->format and $this->request->body) { $this->request->body = $this->format->factory($this->request->body, $this->request->format)->to_array(); + // Assign payload arguments to proper method container + $this->{'_'.$this->request->method.'_args'} = $this->request->body; } // Merge both for one mega-args variable - $this->_args = array_merge($this->_get_args, $this->_put_args, $this->_post_args, $this->_delete_args); + $this->_args = array_merge($this->_get_args, $this->_put_args, $this->_post_args, $this->_delete_args, $this->{'_'.$this->request->method.'_args'}); // Which format should the data be returned in? + $this->response = new stdClass(); $this->response->format = $this->_detect_output_format(); // Which format should the data be returned in? @@ -217,6 +212,7 @@ public function __construct() } } + $this->rest = new StdClass(); // Load DB if its enabled if (config_item('rest_database_group') AND (config_item('rest_enable_keys') OR config_item('rest_enable_logging'))) { @@ -236,7 +232,7 @@ public function __construct() } // only allow ajax requests - if (!$this->input->is_ajax_request() AND config_item('rest_ajax_only')) + if ( ! $this->input->is_ajax_request() AND config_item('rest_ajax_only')) { $this->response(array('status' => false, 'error' => 'Only AJAX requests are accepted.'), 505); } @@ -245,8 +241,8 @@ public function __construct() /** * Remap * - * Requests are not made to methods directly, the request will be for - * an "object". This simply maps the object and method to the correct + * Requests are not made to methods directly, the request will be for + * an "object". This simply maps the object and method to the correct * Controller method. * * @param string $object_called @@ -280,7 +276,7 @@ public function _remap($object_called, $arguments) } // Sure it exists, but can they do anything with it? - if (!method_exists($this, $controller_method)) + if ( ! method_exists($this, $controller_method)) { $this->response(array('status' => false, 'error' => 'Unknown method.'), 404); } @@ -317,7 +313,20 @@ public function _remap($object_called, $arguments) } // And...... GO! - call_user_func_array(array($this, $controller_method), $arguments); + $this->_fire_method(array($this, $controller_method), $arguments); + } + + /** + * Fire Method + * + * Fires the designated controller method with the given arguments. + * + * @param array $method The controller method to fire + * @param array $args The arguments to pass to the controller method + */ + protected function _fire_method($method, $args) + { + call_user_func_array($method, $args); } /** @@ -326,22 +335,36 @@ public function _remap($object_called, $arguments) * Takes pure data and optionally a status code, then creates the response. * * @param array $data - * @param null|int $http_code + * @param null|int $http_code */ public function response($data = array(), $http_code = null) { + global $CFG; + // If data is empty and not code provide, error and bail if (empty($data) && $http_code === null) { $http_code = 404; - //create the output variable here in the case of $this->response(array()); - $output = $data; + // create the output variable here in the case of $this->response(array()); + $output = NULL; } // Otherwise (if no data but 200 provided) or some data, carry on camping! else { + // Is compression requested? + if ($CFG->item('compress_output') === TRUE && $this->_zlib_oc == FALSE) + { + if (extension_loaded('zlib')) + { + if (isset($_SERVER['HTTP_ACCEPT_ENCODING']) AND strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== FALSE) + { + ob_start('ob_gzhandler'); + } + } + } + is_numeric($http_code) OR $http_code = 200; // If the format method exists, call and return the output in that format @@ -369,19 +392,25 @@ public function response($data = array(), $http_code = null) } } - header('HTTP/1.1: '.$http_code); - header('Status: '.$http_code); - header('Content-Length: '.strlen($output)); + header('HTTP/1.1: ' . $http_code); + header('Status: ' . $http_code); + + // If zlib.output_compression is enabled it will compress the output, + // but it will not modify the content-length header to compensate for + // the reduction, causing the browser to hang waiting for more data. + // We'll just skip content-length in those cases. + if ( ! $this->_zlib_oc && ! $CFG->item('compress_output')) + { + header('Content-Length: ' . strlen($output)); + } exit($output); } - /** + /* * Detect input format * * Detect which format the HTTP Body is provided in - * - * @return null|string */ protected function _detect_input_format() { @@ -409,8 +438,8 @@ protected function _detect_input_format() * Detect format * * Detect which format should be used to output the data. - * - * @return string The output format. + * + * @return string The output format. */ protected function _detect_output_format() { @@ -460,13 +489,13 @@ protected function _detect_output_format() // HTML or XML have shown up as a match else { - // If it is truely HTML, it wont want any XML + // If it is truly HTML, it wont want any XML if ($format == 'html' AND strpos($this->input->server('HTTP_ACCEPT'), 'xml') === FALSE) { return $format; } - // If it is truely XML, it wont want any HTML + // If it is truly XML, it wont want any HTML elseif ($format == 'xml' AND strpos($this->input->server('HTTP_ACCEPT'), 'html') === FALSE) { return $format; @@ -475,8 +504,9 @@ protected function _detect_output_format() } } } // End HTTP_ACCEPT checking + // Well, none of that has worked! Let's see if the controller has a default - if (!empty($this->rest_format)) + if ( ! empty($this->rest_format)) { return $this->rest_format; } @@ -488,20 +518,27 @@ protected function _detect_output_format() /** * Detect method * - * Detect which method (POST, PUT, GET, DELETE) is being used - * - * @return string + * Detect which HTTP method is being used + * + * @return string */ protected function _detect_method() { $method = strtolower($this->input->server('REQUEST_METHOD')); - if ($this->config->item('enable_emulate_request') && $this->input->post('_method')) + if ($this->config->item('enable_emulate_request')) { - $method = $this->input->post('_method'); + if ($this->input->post('_method')) + { + $method = strtolower($this->input->post('_method')); + } + elseif ($this->input->server('HTTP_X_HTTP_METHOD_OVERRIDE')) + { + $method = strtolower($this->input->server('HTTP_X_HTTP_METHOD_OVERRIDE')); + } } - if (in_array($method, array('get', 'delete', 'post', 'put'))) + if (in_array($method, $this->allowed_http_methods) && method_exists($this, '_parse_' . $method)) { return $method; } @@ -513,12 +550,11 @@ protected function _detect_method() * Detect API Key * * See if the user has provided an API key - * - * @return boolean + * + * @return boolean */ protected function _detect_api_key() { - // Get the api key name variable set in the rest config file $api_key_variable = config_item('rest_key_name'); @@ -527,12 +563,13 @@ protected function _detect_api_key() $this->rest->key = NULL; $this->rest->level = NULL; + $this->rest->user_id = NULL; $this->rest->ignore_limits = FALSE; // Find the key from server or arguments if (($key = isset($this->_args[$api_key_variable]) ? $this->_args[$api_key_variable] : $this->input->server($key_name))) { - if (!($row = $this->rest->db->where('key', $key)->get(config_item('rest_keys_table'))->row())) + if ( ! ($row = $this->rest->db->where('key', $key)->get(config_item('rest_keys_table'))->row())) { return FALSE; } @@ -554,12 +591,12 @@ protected function _detect_api_key() * Detect language(s) * * What language do they want it in? - * + * * @return null|string The language code. */ protected function _detect_lang() { - if (!$lang = $this->input->server('HTTP_ACCEPT_LANGUAGE')) + if ( ! $lang = $this->input->server('HTTP_ACCEPT_LANGUAGE')) { return NULL; } @@ -589,9 +626,9 @@ protected function _detect_lang() * Log request * * Record the entry for awesomeness purposes - * + * * @param boolean $authorized - * @return object + * @return object */ protected function _log_request($authorized = FALSE) { @@ -611,13 +648,13 @@ protected function _log_request($authorized = FALSE) * * Check if the requests are coming in a tad too fast. * - * @param string $controller_method The method deing called. - * @return boolean + * @param string $controller_method The method being called. + * @return boolean */ protected function _check_limit($controller_method) { // They are special, or it might not even have a limit - if (!empty($this->rest->ignore_limits) OR !isset($this->methods[$controller_method]['limit'])) + if ( ! empty($this->rest->ignore_limits) OR !isset($this->methods[$controller_method]['limit'])) { // On your way sonny-jim. return TRUE; @@ -634,7 +671,7 @@ protected function _check_limit($controller_method) ->row(); // No calls yet, or been an hour since they called - if (!$result OR $result->hour_started < time() - (60 * 60)) + if ( ! $result OR $result->hour_started < time() - (60 * 60)) { // Right, set one up from scratch $this->rest->db->insert(config_item('rest_limits_table'), array( @@ -667,10 +704,10 @@ protected function _check_limit($controller_method) /** * Auth override check * - * Check if there is a specific auth type set for the current class/method + * Check if there is a specific auth type set for the current class/method * being called. * - * @return boolean + * @return boolean */ protected function _auth_override_check() { @@ -717,11 +754,60 @@ protected function _auth_override_check() return true; } - // Return false when there is an override value set but it does not match + // Return false when there is an override value set but it does not match // 'basic', 'digest', or 'none'. (the value was misspelled) return false; } + /** + * Parse GET + */ + protected function _parse_get() + { + // Grab proper GET variables + parse_str(parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY), $get); + + // Merge both the URI segments and GET params + $this->_get_args = array_merge($this->_get_args, $get); + } + + /** + * Parse POST + */ + protected function _parse_post() + { + $this->_post_args = $_POST; + + $this->request->format and $this->request->body = file_get_contents('php://input'); + } + + /** + * Parse PUT + */ + protected function _parse_put() + { + // It might be a HTTP body + if ($this->request->format) + { + $this->request->body = file_get_contents('php://input'); + } + + // If no file type is provided, this is probably just arguments + else + { + parse_str(file_get_contents('php://input'), $this->_put_args); + } + } + + /** + * Parse DELETE + */ + protected function _parse_delete() + { + // Set up out DELETE variables (which shouldn't really exist, but sssh!) + parse_str(file_get_contents('php://input'), $this->_delete_args); + } + // INPUT FUNCTION -------------------------------------------------------------- /** @@ -755,7 +841,7 @@ public function post($key = NULL, $xss_clean = TRUE) return $this->_post_args; } - return $this->input->post($key, $xss_clean); + return array_key_exists($key, $this->_post_args) ? $this->_xss_clean($this->_post_args[$key], $xss_clean) : FALSE; } /** @@ -812,7 +898,7 @@ protected function _xss_clean($val, $process) /** * Retrieve the validation errors. * - * @return array + * @return array */ public function validation_errors() { @@ -828,7 +914,7 @@ public function validation_errors() * * @param string $username The user's name * @param string $password The user's password - * @return boolean + * @return boolean */ protected function _check_login($username = '', $password = NULL) { @@ -839,7 +925,7 @@ protected function _check_login($username = '', $password = NULL) $valid_logins = & $this->config->item('rest_valid_logins'); - if (!array_key_exists($username, $valid_logins)) + if ( ! array_key_exists($username, $valid_logins)) { return FALSE; } @@ -854,7 +940,7 @@ protected function _check_login($username = '', $password = NULL) } /** - * @todo document this. + * @todo document this. */ protected function _prepare_basic_auth() { @@ -883,14 +969,14 @@ protected function _prepare_basic_auth() } } - if (!$this->_check_login($username, $password)) + if ( ! $this->_check_login($username, $password)) { $this->_force_login(); } } /** - * @todo Document this. + * @todo Document this. */ protected function _prepare_digest_auth() { @@ -916,7 +1002,7 @@ protected function _prepare_digest_auth() $digest_string = ""; } - // The $_SESSION['error_prompted'] variable is used to ask the password + // The $_SESSION['error_prompted'] variable is used to ask the password // again if none given or if the user enters wrong auth information. if (empty($digest_string)) { @@ -927,7 +1013,7 @@ protected function _prepare_digest_auth() preg_match_all('@(username|nonce|uri|nc|cnonce|qop|response)=[\'"]?([^\'",]+)@', $digest_string, $matches); $digest = array_combine($matches[1], $matches[2]); - if (!array_key_exists('username', $digest) OR !$this->_check_login($digest['username'])) + if ( ! array_key_exists('username', $digest) OR !$this->_check_login($digest['username'])) { $this->_force_login($uniqid); } @@ -962,7 +1048,7 @@ protected function _check_whitelist_auth() $ip = trim($ip); } - if (!in_array($this->input->ip_address(), $whitelist)) + if ( ! in_array($this->input->ip_address(), $whitelist)) { $this->response(array('status' => false, 'error' => 'Not authorized'), 401); } @@ -971,7 +1057,7 @@ protected function _check_whitelist_auth() /** * @todo Document this. * - * @param string $nonce + * @param string $nonce */ protected function _force_login($nonce = '') { @@ -991,12 +1077,12 @@ protected function _force_login($nonce = '') * Force it into an array * * @param object|array $data - * @return array + * @return array */ protected function _force_loopable($data) { // Force it to be something useful - if (!is_array($data) AND !is_object($data)) + if ( ! is_array($data) AND !is_object($data)) { $data = (array) $data; } @@ -1009,9 +1095,9 @@ protected function _force_loopable($data) /** * Encode as JSONP - * + * * @param array $data The input data. - * @return string The JSONP data string (loadable from Javascript). + * @return string The JSONP data string (loadable from Javascript). */ protected function _format_jsonp($data = array()) { diff --git a/system/cms/helpers/MY_array_helper.php b/system/cms/helpers/MY_array_helper.php index 6ace213e12e..ead439eec8d 100644 --- a/system/cms/helpers/MY_array_helper.php +++ b/system/cms/helpers/MY_array_helper.php @@ -111,7 +111,7 @@ function html_to_assoc($html_array) } -if (!function_exists('html_to_assoc')) +if (!function_exists('assoc_array_prop')) { /** * Associative array property diff --git a/system/cms/language/english/global_lang.php b/system/cms/language/english/global_lang.php index 33fd445f6ac..10703c9da6d 100644 --- a/system/cms/language/english/global_lang.php +++ b/system/cms/language/english/global_lang.php @@ -92,4 +92,8 @@ $lang['global:keywords'] = 'Keywords'; +$lang['global:or'] = 'or'; +$lang['global:and'] = 'and'; +$lang['global:at'] = 'at'; + /* End of file main_lang.php */ \ No newline at end of file diff --git a/system/cms/language/italian/global_lang.php b/system/cms/language/italian/global_lang.php index 51dac7718c3..4dfbc2e509a 100644 --- a/system/cms/language/italian/global_lang.php +++ b/system/cms/language/italian/global_lang.php @@ -9,6 +9,9 @@ $lang['version_label'] = 'Versione'; $lang['global:author'] = 'Autore'; $lang['global:action'] = 'Azione'; +$lang['global:slug'] = 'Slug'; +$lang['global:user'] = 'User'; + $lang['dialog.delete_message'] = 'Sei sicuro di volerlo eliminare? L\'azione non può essere annullata.'; $lang['dialog.confirm'] = 'Conferma'; diff --git a/system/cms/libraries/Akismet.php b/system/cms/libraries/Akismet.php index d794faff597..58e8f2d4101 100644 --- a/system/cms/libraries/Akismet.php +++ b/system/cms/libraries/Akismet.php @@ -1,270 +1,261 @@ $value) { - foreach ($config as $key => $value) - { - $this->$key = $value; - } - - $this->set_comment($this->comment); - - $this->_connect(); - - if($this->errors_exist()) - { - $this->errors = array_merge($this->errors, $this->get_errors()); - } - - // Check if the API key is valid - if(!$this->_is_valid_api_key($this->api_key)) - { - $this->set_error('AKISMET_INVALID_KEY', "Your Akismet API key is not valid."); - } + $this->$key = $value; } - // Connect to the Akismet server and store that connection in the instance variable $con - function _connect() - { - if(!($this->con = @fsockopen($this->akismet_server, $this->api_port))) - { - $this->set_error('AKISMET_SERVER_NOT_FOUND', "Could not connect to akismet server."); - } - } + $this->set_comment($this->comment); + + $this->_connect(); - // Close the connection to the Akismet server - function _disconnect() + if ($this->errors_exist()) { - @fclose($this->con); + $this->errors = array_merge($this->errors, $this->get_errors()); } - function get_response($request, $path, $type = "post", $response_length = 1160) + // Check if the API key is valid + if ($this->_is_valid_api_key($this->api_key) === false) { - $this->_connect(); - - if($this->con && !$this->is_error('AKISMET_SERVER_NOT_FOUND')) - { - $request = - strToUpper($type)." /{$this->akismet_version}/$path HTTP/1.0\r\n" . - "Host: ".((!empty($this->api_key)) ? $this->api_key."." : null)."{$this->akismet_server}\r\n" . - "Content-Type: application/x-www-form-urlencoded; charset=utf-8\r\n" . - "Content-Length: ".strlen($request)."\r\n" . - "User-Agent: Akismet CodeIgniter Library\r\n" . - "\r\n" . - $request - ; - $response = ""; - - @fwrite($this->con, $request); - - while(!feof($this->con)) - { - $response .= @fgets($this->con, $response_length); - } - - $response = explode("\r\n\r\n", $response, 2); - return $response[1]; - } - else - { - $this->set_error('AKISMET_RESPONSE_FAILED', "The response could not be retrieved."); - } - - $this->_disconnect(); + $this->set_error('AKISMET_INVALID_KEY', "The Akismet API key is not valid."); } - - function set_error($name, $message) + } + + // Connect to the Akismet server and store that connection in the instance variable $con + private function _connect() + { + if ( ! ($this->con = @fsockopen($this->akismet_server, $this->api_port))) { - $this->errors[$name] = $message; + $this->set_error('AKISMET_SERVER_NOT_FOUND', "Could not connect to akismet server."); } + } + + // Close the connection to the Akismet server + private function _disconnect() + { + @fclose($this->con); + } + + public function get_response($request, $path, $type = "POST", $response_length = 1160) + { + $this->_connect(); - function get_error($name) + if ($this->con && ! $this->is_error('AKISMET_SERVER_NOT_FOUND')) { - if($this->is_error($name)) + $request = + strtoupper($type)." /{$this->akismet_version}/$path HTTP/1.1\r\n" . + "Host: ".$this->api_key.".{$this->akismet_server}\r\n" . + "Content-Type: application/x-www-form-urlencoded; charset=utf-8\r\n" . + "Content-Length: ".strlen($request)."\r\n" . + "User-Agent: PyroCMS/".CMS_VERSION."\r\n" . + "\r\n" . + $request + ; + $response = ""; + + @fwrite($this->con, $request); + + while ( ! feof($this->con)) { - return $this->errors[$name]; - } - else - { - return false; + $response .= @fgets($this->con, $response_length); } + + $response = explode("\r\n\r\n", $response, 2); + return $response[1]; } - - function get_errors() - { - return (array)$this->errors; - } - - function is_error($name) + else { - return isset($this->errors[$name]); + $this->set_error('AKISMET_RESPONSE_FAILED', "The response could not be retrieved."); } - function errors_exist() + $this->_disconnect(); + } + + public function set_error($name, $message) + { + $this->errors[$name] = $message; + } + + public function get_error($name) + { + if ($this->is_error($name)) { - return (count($this->errors) > 0); + return $this->errors[$name]; } - function is_spam() - { - $response = $this->get_response($this->_get_query_string(), 'comment-check'); - - return ($response == "true"); - } + return false; + } + + public function get_errors() + { + return (array) $this->errors; + } + + public function is_error($name) + { + return isset($this->errors[$name]); + } + + public function errors_exist() + { + return (count($this->errors) > 0); + } + + public function is_spam() + { + $response = $this->get_response($this->_get_query_string(), 'comment-check'); + return ($response == "true"); + } + + + public function submit_spam() + { + $this->get_response($this->_get_querystring(), 'submit-spam'); + } + + + public function submit_ham() + { + $this->get_response($this->_get_query_string(), 'submit-ham'); + } + + public function set_comment($comment) + { + $this->comment = $comment; - function submit_spam() + if(!empty($comment)) { - $this->get_response($this->_get_querystring(), 'submit-spam'); + $this->_format_comment_array(); + $this->_fill_comment_values(); } + } + + public function get_comment() + { + return $this->comment; + } + + private function _is_valid_api_key($key) + { + $key_check = $this->get_response("key=".$this->api_key."&blog=".$this->blog_url, 'verify-key'); + return ($key_check === "valid"); + } + + private function _format_comment_array() { + $format = array( + 'type' => 'comment_type', + 'author' => 'comment_author', + 'email' => 'comment_author_email', + 'website' => 'comment_author_url', + 'body' => 'comment_content' + ); - function submit_ham() - { - $this->get_response($this->_get_query_string(), 'submit-ham'); - } - - function set_comment($comment) + foreach ($format as $short => $long) { - $this->comment = $comment; - - if(!empty($comment)) + if (isset($this->comment[$short])) { - $this->_format_comment_array(); - $this->_fill_comment_values(); + $this->comment[$long] = $this->comment[$short]; + unset($this->comment[$short]); } } - - function get_comment() + } + + + /** + * Fill any values not provided by the developer with available values. + * + * @return void + */ + + private function _fill_comment_values() + { + if(!isset($this->comment['user_ip'])) { - return $this->comment; + $this->comment['user_ip'] = ($_SERVER['REMOTE_ADDR'] != getenv('SERVER_ADDR')) ? $_SERVER['REMOTE_ADDR'] : getenv('HTTP_X_FORWARDED_FOR'); } - function _is_valid_api_key($key) + if(!isset($this->comment['user_agent'])) { - $key_check = $this->get_response("key=".$this->api_key."&blog=".$this->blog_url, 'verify-key'); - - return ($key_check == "valid"); + $this->comment['user_agent'] = $_SERVER['HTTP_USER_AGENT']; } - function _format_comment_array() { - - $format = array( - 'type' => 'comment_type', - 'author' => 'comment_author', - 'email' => 'comment_author_email', - 'website' => 'comment_author_url', - 'body' => 'comment_content' - ); - - foreach($format as $short => $long) - { - if(isset($this->comment[$short])) - { - $this->comment[$long] = $this->comment[$short]; - unset($this->comment[$short]); - } - } + if(!isset($this->comment['referrer']) && !empty($_SERVER['HTTP_REFERER'])) + { + $this->comment['referrer'] = $_SERVER['HTTP_REFERER']; } - - /** - * Fill any values not provided by the developer with available values. - * - * @return void - */ - - function _fill_comment_values() + if(!isset($this->comment['blog'])) { - if(!isset($this->comment['user_ip'])) - { - $this->comment['user_ip'] = ($_SERVER['REMOTE_ADDR'] != getenv('SERVER_ADDR')) ? $_SERVER['REMOTE_ADDR'] : getenv('HTTP_X_FORWARDED_FOR'); - } - - if(!isset($this->comment['user_agent'])) - { - $this->comment['user_agent'] = $_SERVER['HTTP_USER_AGENT']; - } - - if(!isset($this->comment['referrer']) && !empty($_SERVER['HTTP_REFERER'])) - { - $this->comment['referrer'] = $_SERVER['HTTP_REFERER']; - } - - if(!isset($this->comment['blog'])) - { - $this->comment['blog'] = $this->blog_url; - } + $this->comment['blog'] = $this->blog_url; } - - - function _get_query_string() + } + + + private function _get_query_string() + { + foreach($_SERVER as $key => $value) { - foreach($_SERVER as $key => $value) + if(!in_array($key, $this->ignore)) { - if(!in_array($key, $this->ignore)) + if($key == 'REMOTE_ADDR') { - if($key == 'REMOTE_ADDR') - { - $this->comment[$key] = $this->comment['user_ip']; - } - else - { - $this->comment[$key] = $value; - } + $this->comment[$key] = $this->comment['user_ip']; + } + else + { + $this->comment[$key] = $value; } } - - $query_string = ''; - - foreach($this->comment as $key => $data) - { - $query_string .= $key . '=' . urlencode(stripslashes($data)) . '&'; - } - - return $query_string; } + + $query_string = ''; + + foreach($this->comment as $key => $data) + { + $query_string .= $key . '=' . urlencode(stripslashes($data)) . '&'; + } + + return $query_string; } - -?> +} \ No newline at end of file diff --git a/system/cms/libraries/Lex/Parser.php b/system/cms/libraries/Lex/Parser.php index d17494e9781..b33c52ab128 100644 --- a/system/cms/libraries/Lex/Parser.php +++ b/system/cms/libraries/Lex/Parser.php @@ -774,12 +774,12 @@ protected function parse_parameters($parameters, $data, $callback) $parameters = $this->inject_extractions($parameters, '__param_str'); $this->in_condition = false; - if (preg_match_all('/(.*?)\s*=\s*(\'|"|?\w+;)(.*?)\2/s', trim($parameters), $matches)) + if (preg_match_all('/(.*?)\s*=\s*(\'|"|?\w+;)(.*?)(? $attr) { - $return[trim($matches[1][$i])] = $matches[3][$i]; + $return[trim($matches[1][$i])] = stripslashes($matches[3][$i]); } return $return; diff --git a/system/cms/libraries/MY_Form_validation.php b/system/cms/libraries/MY_Form_validation.php index cfcec32ed25..c48e28a65e0 100644 --- a/system/cms/libraries/MY_Form_validation.php +++ b/system/cms/libraries/MY_Form_validation.php @@ -31,7 +31,7 @@ function alpha_dot_dash($str) /** * Sneaky function to get field data from - * the form validation libraru + * the form validation library * * @access public * @param string diff --git a/system/cms/libraries/Streams/drivers/Streams_entries.php b/system/cms/libraries/Streams/drivers/Streams_entries.php index f10764485e8..64d451d22f3 100755 --- a/system/cms/libraries/Streams/drivers/Streams_entries.php +++ b/system/cms/libraries/Streams/drivers/Streams_entries.php @@ -57,25 +57,26 @@ class Streams_entries extends CI_Driver { * @var array */ public $pagination_config = array( - 'num_links' => 3, + 'num_links' => 3, 'full_tag_open' => '
', 'full_tag_close' => '
', 'first_link' => 'First', 'first_tag_open' => '- website, $item->name, 'rel="external nofollow"') : $item->name; ?> + website ? anchor($item->website, $item->name, 'rel="external nofollow"') : $item->name; ?>
The files module is an excellent way for the site admin to manage the files in use on the site. +All images or files that are inserted into pages, galleries, or blog posts are stored here. +For page content images you may upload them directly from the WYSIWYG editor or you can upload them here and just insert them via WYSIWYG.
+The files interface works much like a local file system: it uses the right click to show a context menu. Everything in the middle pane is clickable.
+ +After you create the top level folder or folders you may create as many subfolders as you need such as blog/images/screenshots/ or pages/audio/. +The folder names are for your use only, the name is not displayed in the download link on the front end. +To manage a folder either right click on it and select an action from the resulting menu or double click on the folder to open it. +You can also click on folders in the left column to open them.
+If cloud providers are enabled you will be able to set the location of the folder by right clicking on the folder and then selecting Details. +You can then select a location (for example \"Amazon S3\") and put in the name of your remote bucket or container. If the bucket or container does +not exist it will be created when you click Save. Note that you can only change the location of an empty folder.
+ +To manage files navigate to the folder using the folder tree in the left column or by clicking on the folder in the center pane. +Once you are viewing the files you may edit them by right clicking on them. You can also order them by dragging them into position. Note +that if you have folders and files in the same parent folder the folders will always be displayed first followed by the files.
+ +After right clicking the desired folder an upload window will appear. +You may add files by either dropping them in the Upload Files box or by clicking in the box and choosing the files from your standard file dialog. +You can select multiple files by holding your Control/Command or Shift key while clicking them. The selected files will display in a list at the bottom of the screen. +You may then either delete unnecessary files from the list or if satisfied click Upload to start the upload process.
+If you get a warning about the files size being too large be advised that many hosts do not allow file uploads over 2MB. +Many modern cameras produce images in exess of 5MB so it is very common to run into this issue. +To remedy this limitation you may either ask your host to change the upload limit or you may wish to resize your images before uploading. +Resizing has the added advantage of faster upload times. You may change the upload limit in +CP > Files > Settings also but it is secondary to the host's limitation. For example if the host allows a 50MB upload you can still limit the size +of the upload by setting a maximum of \"20\" (for example) in CP > Files > Settings.
+ +If you are storing files with a cloud provider you may want to use the Synchronize function. This allows you to \"refresh\" +your database of files to keep it up to date with the remote storage location. For example if you have another service +that dumps files into a folder on Amazon that you want to display in your weekly blog post you can simply go to your folder +that is linked to that bucket and click Synchronize. This will pull down all the available information from Amazon and +store it in the database as if the file was uploaded via the Files interface. The files are now available to be inserted into page content, +your blog post, or etc. If files have been deleted from the remote bucket since your last Synchronize they will now be removed from +the database also.
+ +You may search all of your files and folders by typing a search term in the right column and then hitting Enter. The first +5 folder matches and the first 5 file matches will be returned. When you click on an item its containing folder will be displayed +and the items that match your search will be highlighted. Items are searched using the folder name, file name, extension, +location, and remote container name.
"; \ No newline at end of file diff --git a/system/cms/modules/files/language/italian/permission_lang.php b/system/cms/modules/files/language/italian/permission_lang.php new file mode 100644 index 00000000000..9f095e70764 --- /dev/null +++ b/system/cms/modules/files/language/italian/permission_lang.php @@ -0,0 +1,14 @@ +file_m->update($id, array('name' => $name)); - return self::result(TRUE, lang('files:item_updated'), $name, array('name' => $name)); + return self::result(TRUE, lang('files:item_updated'), $name, array('id' => $id, 'name' => $name)); } // ------------------------------------------------------------------------ diff --git a/system/cms/modules/files/views/admin/index.php b/system/cms/modules/files/views/admin/index.php index ff48c20cf4b..b3e392eea47 100644 --- a/system/cms/modules/files/views/admin/index.php +++ b/system/cms/modules/files/views/admin/index.php @@ -70,6 +70,9 @@The sitemap module automatically generates an index page and an XML file suitable for search crawlers. -See sitemaps.org for more information. -
'; #translate \ No newline at end of file +$lang['help_body'] = 'Le module Sitemap, génère automatiquement une page d\'index et un fichier XML optimisé pour les moteurs de recherche. +Vous référer à sitemaps.org pour plus d\'informations. +
'; \ No newline at end of file diff --git a/system/cms/modules/streams_core/field_types/datetime/field.datetime.php b/system/cms/modules/streams_core/field_types/datetime/field.datetime.php index c0d691f481d..603cc90409a 100644 --- a/system/cms/modules/streams_core/field_types/datetime/field.datetime.php +++ b/system/cms/modules/streams_core/field_types/datetime/field.datetime.php @@ -448,7 +448,7 @@ public function form_output($data, $entry_id, $field) $hour_count++; } - $date_input .= form_dropdown($data['form_slug'].'_hour', $hours, $date['hour']); + $date_input .= lang('global:at').' '.form_dropdown($data['form_slug'].'_hour', $hours, $date['hour'], 'style="min-width: 100px; width:100px;"'); // Minute $minute_count = 0; @@ -469,7 +469,7 @@ public function form_output($data, $entry_id, $field) $minute_count++; } - $date_input .= form_dropdown($data['form_slug'].'_minute', $minutes, $date['minute']); + $date_input .= form_dropdown($data['form_slug'].'_minute', $minutes, $date['minute'], 'style="min-width: 100px; width:100px;"'); // AM/PM $am_pm = array('am' => 'am', 'pm' => 'pm'); @@ -492,7 +492,7 @@ public function form_output($data, $entry_id, $field) } } - $date_input .= form_dropdown($data['form_slug'].'_am_pm', $am_pm, $am_pm_current, 'style="small_select"'); + $date_input .= form_dropdown($data['form_slug'].'_am_pm', $am_pm, $am_pm_current, 'style="min-width: 100px; width:100px;"'); } diff --git a/system/cms/modules/streams_core/field_types/wysiwyg/field.wysiwyg.php b/system/cms/modules/streams_core/field_types/wysiwyg/field.wysiwyg.php index 80d801b2d28..715171b56db 100644 --- a/system/cms/modules/streams_core/field_types/wysiwyg/field.wysiwyg.php +++ b/system/cms/modules/streams_core/field_types/wysiwyg/field.wysiwyg.php @@ -45,6 +45,22 @@ public function event() // -------------------------------------------------------------------------- + /** + * Pre-Ouput WYSUWYG content + * + * @access public + * @param string + * @return string + */ + public function pre_output($input) + { + // No matter what, we are going to replace {{ url:site }} with it's + // rightful value. + return str_replace('{{ url:site }}', site_url().'/', $input); + } + + // -------------------------------------------------------------------------- + /** * Output form input * diff --git a/system/cms/modules/streams_core/language/french/pyrostreams_lang.php b/system/cms/modules/streams_core/language/french/pyrostreams_lang.php index ca19d066cb4..95a10bafd5b 100644 --- a/system/cms/modules/streams_core/language/french/pyrostreams_lang.php +++ b/system/cms/modules/streams_core/language/french/pyrostreams_lang.php @@ -55,7 +55,7 @@ $lang['streams.stream_slug_not_unique'] = "Ce slug de Flux est déjà utilisé."; $lang['streams.field_unique'] = "Le Champ %s doit être unique."; $lang['streams.field_is_required'] = "Le Champ %s est requis."; -$lang['streams.date_out_or_range'] = "The date you have chosen is out of the acceptable range."; #translate +$lang['streams.date_out_or_range'] = "La date que vous avez sélectionnée est en dehors de l\intervalle de temps acceptable."; /* Field Labels */ @@ -97,7 +97,7 @@ $lang['streams.stream_admin'] = "Administration des Flux"; $lang['streams.list_streams'] = "Lister les Flux"; $lang['streams.sure'] = "Êtes vous sur ?"; -$lang['streams.field_assignments'] = "Stream Field Assignments"; // #translate +$lang['streams.field_assignments'] = "Assignement des Champs de Flux"; $lang['streams.stream_name'] = "Nom du Flux"; $lang['streams.stream_slug'] = "Slug du Flux"; $lang['streams.about'] = "A propos"; diff --git a/system/cms/modules/streams_core/libraries/Recaptcha.php b/system/cms/modules/streams_core/libraries/Recaptcha.php index d6f2dd54de3..36c23275228 100644 --- a/system/cms/modules/streams_core/libraries/Recaptcha.php +++ b/system/cms/modules/streams_core/libraries/Recaptcha.php @@ -155,7 +155,7 @@ function get_html ($lang = 'en',$use_ssl = false) ); //load a view - more configurable than embedding HTML in the library - return $this->_CI->load->view('streams/recaptcha',$html_data,TRUE); + return $this->_CI->load->view('streams_core/recaptcha', $html_data, true); } /** diff --git a/system/cms/modules/streams_core/models/row_m.php b/system/cms/modules/streams_core/models/row_m.php index ba4a152629f..37fac0107f6 100644 --- a/system/cms/modules/streams_core/models/row_m.php +++ b/system/cms/modules/streams_core/models/row_m.php @@ -330,9 +330,6 @@ public function get_rows($params, $fields, $stream) // ------------------------------------- // Show Upcoming // ------------------------------------- - // @todo - check to see if this is a - // mysql date or a UNIX one. - // ------------------------------------- if (isset($show_upcoming) and $show_upcoming == 'no') { diff --git a/system/cms/modules/templates/details.php b/system/cms/modules/templates/details.php index 038365b03af..c9d8a822b75 100755 --- a/system/cms/modules/templates/details.php +++ b/system/cms/modules/templates/details.php @@ -101,12 +101,14 @@ public function install() 'name' => 'Comment Notification', 'description' => 'Email that is sent to admin when someone creates a comment', 'subject' => 'You have just received a comment from {{ name }}', - 'body' => '
+ IP Address: {{ sender_ip }}
+ Operating System: {{ sender_os }}
+ User Agent: {{ sender_agent }}
+
{{ comment }}
+View Comment: {{ redirect_url }}
", 'lang' => 'en', 'is_default' => 1, 'module' => 'comments' diff --git a/system/cms/modules/templates/language/italian/templates_lang.php b/system/cms/modules/templates/language/italian/templates_lang.php index ebb10ddc888..4bcd2358a5e 100644 --- a/system/cms/modules/templates/language/italian/templates_lang.php +++ b/system/cms/modules/templates/language/italian/templates_lang.php @@ -16,17 +16,17 @@ $lang['templates.user_defined_title'] = 'Template definiti dall\'utente'; // Messages -$lang['templates.tmpl_create_success'] = 'Il template email "%s" &eacuta; stato salvato.'; -$lang['templates.tmpl_create_error'] = 'Il template email "%s" non &eacuta; stato salvato.'; +$lang['templates.tmpl_create_success'] = 'Il template email "%s" é stato salvato.'; +$lang['templates.tmpl_create_error'] = 'Il template email "%s" non é stato salvato.'; $lang['templates.tmpl_edit_success'] = 'Le modifiche effettuate al template email "%s" sono state salvate.'; $lang['templates.tmpl_edit_error'] = 'Le modifiche effettuate al template email "%s" non sono state salvate.'; -$lang['templates.tmpl_clone_success'] = '"%s" &eacuta; stato clonato. Ora puoi modificarlo come preferisci.'; +$lang['templates.tmpl_clone_success'] = '"%s" é stato clonato. Ora puoi modificarlo come preferisci.'; $lang['templates.tmpl_clone_error'] = '"%s" non &acuta; stato possibile clonarlo. Per favore riprova.'; -$lang['templates.single_delete_success'] = 'Il template email &eacuta; stato cancellato.'; +$lang['templates.single_delete_success'] = 'Il template email é stato cancellato.'; $lang['templates.mass_delete_success'] = 'Cancellati con successo %s template email su %s.'; -$lang['templates.mass_delete_error'] = 'Si &eacuta; verificato un errore nel tentativo di cancellare il template "%s".'; -$lang['templates.default_delete_error'] = 'Si &eacuta; verificato un errore. Il template di default non può essere eliminato.'; +$lang['templates.mass_delete_error'] = 'Si é verificato un errore nel tentativo di cancellare il template "%s".'; +$lang['templates.default_delete_error'] = 'Si é verificato un errore. Il template di default non può essere eliminato.'; $lang['templates.no_select_error'] = 'Devi prima selezionare un template.'; -$lang['templates.already_exist_error'] = 'Un email template dal nome "%s" esiste di già.'; +$lang['templates.already_exist_error'] = 'Un email template dal nome "%s" esiste di già.'; /* End of file templates_lang.php */ \ No newline at end of file diff --git a/system/cms/modules/users/controllers/users.php b/system/cms/modules/users/controllers/users.php index f8d02bb6bea..f1ff8d58c7b 100644 --- a/system/cms/modules/users/controllers/users.php +++ b/system/cms/modules/users/controllers/users.php @@ -74,7 +74,7 @@ public function login() } // Get the user data - $user = (object)array( + $user = (object) array( 'email' => $this->input->post('email'), 'password' => $this->input->post('password') ); @@ -88,7 +88,8 @@ public function login() array( 'field' => 'password', 'label' => lang('global:password'), - 'rules' => 'required|min_length[6]|max_length[20]' + 'label' => lang('user_password_label'), + 'rules' => 'required|min_length['.$this->config->item('min_password_length', 'ion_auth').']|max_length['.$this->config->item('max_password_length', 'ion_auth').']' ), ); @@ -191,7 +192,7 @@ public function register() array( 'field' => 'password', 'label' => lang('user_password'), - 'rules' => 'required|min_length[6]|max_length[20]' + 'rules' => 'required|min_length['.$this->config->item('min_password_length', 'ion_auth').']|max_length['.$this->config->item('max_password_length', 'ion_auth').']' ), array( 'field' => 'email', @@ -586,6 +587,9 @@ public function edit($id = 0) if ($this->current_user AND $this->current_user->group === 'admin' AND $id > 0) { $user = $this->user_m->get(array('id' => $id)); + + // invalide user? Show them their own profile + $user or redirect('edit-profile'); } else { @@ -596,7 +600,7 @@ public function edit($id = 0) // Get the profile data $profile_row = $this->db->limit(1) - ->where('user_id', $this->current_user->id)->get('profiles')->row(); + ->where('user_id', $user->id)->get('profiles')->row(); // If we have API's enabled, load stuff if (Settings::get('api_enabled') and Settings::get('api_user_keys')) diff --git a/system/cms/modules/users/language/french/user_lang.php b/system/cms/modules/users/language/french/user_lang.php index 28634623995..3b314d7a822 100644 --- a/system/cms/modules/users/language/french/user_lang.php +++ b/system/cms/modules/users/language/french/user_lang.php @@ -1,38 +1,40 @@ Etape 1 : Enregistrez-vous'; -$lang['user_register_step2'] = 'Etape 2 : Activation'; +$lang['user_register_header'] = 'Enregistrement'; +$lang['user_register_step1'] = 'Etape 1 : Enregistrez-vous'; +$lang['user_register_step2'] = 'Etape 2 : Activation'; -$lang['user_login_header'] = 'Login'; +$lang['user_login_header'] = 'Login'; // titles -$lang['user_add_title'] = 'Créer un utilisateur'; -$lang['user_list_title'] = 'Lister les utilisateurs'; -$lang['user_inactive_title'] = 'Utilisateurs inactifs'; -$lang['user_active_title'] = 'Utilisateurs actifs'; +$lang['user_add_title'] = 'Créer un utilisateur'; +$lang['user_list_title'] = 'Lister les utilisateurs'; +$lang['user_inactive_title'] = 'Utilisateurs inactifs'; +$lang['user_active_title'] = 'Utilisateurs actifs'; $lang['user_registred_title'] = 'Utilisateurs enregistrés'; // labels -$lang['user_edit_title'] = 'Modifier l\'utilisateur "%s"'; -$lang['user_details_label'] = 'Détails'; -$lang['user_first_name_label'] = 'Prénom'; -$lang['user_last_name_label'] = 'Nom'; -$lang['user_group_label'] = 'Rôle'; -$lang['user_activate_label'] = 'Activé'; +$lang['user_edit_title'] = 'Modifier l\'utilisateur "%s"'; +$lang['user_details_label'] = 'Détails'; +$lang['user_first_name_label'] = 'Prénom'; +$lang['user_last_name_label'] = 'Nom'; +$lang['user_email_label'] = 'E-mail'; +$lang['user_group_label'] = 'Rôle'; +$lang['user_activate_label'] = 'Activé'; +$lang['user_password_label'] = 'Mot de passe'; $lang['user_password_confirm_label'] = 'Confirmez mot de passe'; -$lang['user_name_label'] = 'Surnom'; -$lang['user_joined_label'] = 'Inscrit'; -$lang['user_last_visit_label'] = 'Dernière visite'; -$lang['user_never_label'] = 'Jamais'; +$lang['user_name_label'] = 'Surnom'; +$lang['user_joined_label'] = 'Inscrit'; +$lang['user_last_visit_label'] = 'Dernière visite'; +$lang['user_never_label'] = 'Jamais'; $lang['user_no_inactives'] = 'Il n\'y a aucun utilisateurs actifs.'; $lang['user_no_registred'] = 'Il n\'y a aucun utilisateurs enregistrés.'; @@ -43,129 +45,130 @@ // -- Registration / Activation / Reset Password ---------------------------------------------------------- -$lang['user_register_title'] = 'Enregistrez-vous'; -$lang['user_activate_account_title'] = 'Activez le compte'; -$lang['user_activate_label'] = 'Activez'; +$lang['user_register_title'] = 'Enregistrez-vous'; +$lang['user_activate_account_title'] = 'Activez le compte'; +$lang['user_activate_label'] = 'Activez'; $lang['user_activated_account_title'] = 'Compte activé'; -$lang['user_reset_password_title'] = 'Réinitialisez le mot de passe'; -$lang['user_password_reset_title'] = 'Mot de passe réinitialisé'; +$lang['user_reset_password_title'] = 'Réinitialisez le mot de passe'; +$lang['user_password_reset_title'] = 'Mot de passe réinitialisé'; -$lang['user_error_username'] = 'Le nom d\'utilisateur que vous avez entré est déjà utilisé'; -$lang['user_error_email'] = 'L\'adresse email que vous avez entré est déjà utilisée'; +$lang['user_error_username'] = 'Le nom d\'utilisateur que vous avez entré est déjà utilisé'; +$lang['user_error_email'] = 'L\'adresse email que vous avez entré est déjà utilisée'; -$lang['user_full_name'] = 'Nom Complet'; -$lang['user_first_name'] = 'Prénom'; -$lang['user_last_name'] = 'Nom'; -$lang['user_username'] = 'Nom Utilisateur'; -$lang['user_display_name'] = 'Pseudonyme'; -$lang['user_email_use'] = 'utilisé pour se connecter'; -$lang['user_password'] = 'Mot de passe'; -$lang['user_remember'] = 'Rester connecté'; -$lang['user_group_id_label'] = 'ID Groupe'; +$lang['user_full_name'] = 'Nom Complet'; +$lang['user_first_name'] = 'Prénom'; +$lang['user_last_name'] = 'Nom'; +$lang['user_username'] = 'Nom Utilisateur'; +$lang['user_display_name'] = 'Pseudonyme'; +$lang['user_email_use'] = 'utilisé pour se connecter'; +$lang['user_email'] = 'E-mail'; +$lang['user_confirm_email'] = 'Confirmez E-mail'; +$lang['user_password'] = 'Mot de passe'; +$lang['user_remember'] = 'Rester connecté'; +$lang['user_group_id_label'] = 'ID Groupe'; -$lang['user_level'] = 'Rôle utilisateur'; -$lang['user_active'] = 'Activez'; -$lang['user_lang'] = 'Langue'; +$lang['user_level'] = 'Rôle utilisateur'; +$lang['user_active'] = 'Activez'; +$lang['user_lang'] = 'Langue'; $lang['user_activation_code'] = 'Code d\'activation'; -$lang['user_reset_instructions'] = 'Entre votre email ou votre Nom Utilisateur'; +$lang['user_reset_instructions'] = 'Entre votre email ou votre Nom Utilisateur'; $lang['user_reset_password_link'] = 'Mot de passe oublié ?'; $lang['user_activation_code_sent_notice'] = 'Un e-mail vous a été envoyé avec votre code d\'activation.'; -$lang['user_activation_by_admin_notice'] = 'Votre enregistrement est en attente d\'approbation par l\'administrateur.'; -$lang['user_registration_disabled'] = 'Désolé, l\'inscription de nouveaux utilisateurs est désactivée.'; +$lang['user_activation_by_admin_notice'] = 'Votre enregistrement est en attente d\'approbation par l\'administrateur.'; +$lang['user_registration_disabled'] = 'Désolé, l\'inscription de nouveaux utilisateurs est désactivée.'; // -- Settings --------------------------------------------------------------------------------------------- -$lang['user_details_section'] = 'Nom'; -$lang['user_password_section'] = 'Changer de mot de passe'; +$lang['user_details_section'] = 'Nom'; +$lang['user_password_section'] = 'Changer de mot de passe'; $lang['user_other_settings_section'] = 'Autres paramètres'; -$lang['user_settings_saved_success'] = 'Les paramètres de votre compte utilisateur ont été enregistrées.'; -$lang['user_settings_saved_error'] = 'Une erreur est survenue.'; +$lang['user_settings_saved_success'] = 'Les paramètres de votre compte utilisateur ont été enregistrées.'; +$lang['user_settings_saved_error'] = 'Une erreur est survenue.'; // -- Buttons ---------------------------------------------------------------------------------------------- -$lang['user_register_btn'] = 'Enregistrement'; -$lang['user_activate_btn'] = 'Activation'; -$lang['user_reset_pass_btn'] = 'Réinit Mot de passe'; -$lang['user_login_btn'] = 'Connexion'; -$lang['user_settings_btn'] = 'Sauvegarder les paramètres'; +$lang['user_register_btn'] = 'Enregistrement'; +$lang['user_activate_btn'] = 'Activation'; +$lang['user_reset_pass_btn'] = 'Réinit Mot de passe'; +$lang['user_login_btn'] = 'Connexion'; +$lang['user_settings_btn'] = 'Sauvegarder les paramètres'; // -- Errors & Messages ------------------------------------------------------------------------------------ - // Create -$lang['user_added_and_activated_success'] = 'Un nouvel utilisateur a été créé et activé.'; -$lang['user_added_not_activated_success'] = 'Un nouvel utilisateur a été créé, le compte a besoin d\'être activé.'; +$lang['user_added_and_activated_success'] = 'Un nouvel utilisateur a été créé et activé.'; +$lang['user_added_not_activated_success'] = 'Un nouvel utilisateur a été créé, le compte a besoin d\'être activé.'; // Edit -$lang['user_edit_user_not_found_error'] = 'Utilisateur non trouvé.'; -$lang['user_edit_success'] = 'Utilisateur mis à jour avec succès.'; -$lang['user_edit_error'] = 'Une erreur est survenue en cours de mise à jour de l\'utilisateur.'; +$lang['user_edit_user_not_found_error'] = 'Utilisateur non trouvé.'; +$lang['user_edit_success'] = 'Utilisateur mis à jour avec succès.'; +$lang['user_edit_error'] = 'Une erreur est survenue en cours de mise à jour de l\'utilisateur.'; // Activate -$lang['user_activate_success'] = '%s utilisateurs sur %s activés avec succès.'; -$lang['user_activate_error'] = 'Vous devez d\'abord seclectionner un utilisateur.'; +$lang['user_activate_success'] = '%s utilisateurs sur %s activés avec succès.'; +$lang['user_activate_error'] = 'Vous devez d\'abord seclectionner un utilisateur.'; // Delete -$lang['user_delete_self_error'] = 'Vous ne pouvez pas vous supprimer !'; -$lang['user_mass_delete_success'] = '%s utilisateurs sur %s supprimés avec succès.'; -$lang['user_mass_delete_error'] = 'Vous devez d\'abord seclectionner des utilisateurs.'; +$lang['user_delete_self_error'] = 'Vous ne pouvez pas vous supprimer !'; +$lang['user_mass_delete_success'] = '%s utilisateurs sur %s supprimés avec succès.'; +$lang['user_mass_delete_error'] = 'Vous devez d\'abord seclectionner des utilisateurs.'; // Register $lang['user_email_pass_missing'] = 'l\'e-mail ou le mot de passe ne sont pas renseignés.'; -$lang['user_email_exists'] = 'L\'adresse e-mail choisie est déjà affectée à un autre utilisateur.'; -$lang['user_register_error'] = 'Nous pensons que vous êtes un robot. Si nous faisons erreur, merci d\'daccepter nos excuses.'; -$lang['user_register_reasons'] = 'Abonnez-vous pour accéder aux espaces réservés. Vos paramètres seront enregistrés, plus de contenu et moins de publicité.'; +$lang['user_email_exists'] = 'L\'adresse e-mail choisie est déjà affectée à un autre utilisateur.'; +$lang['user_register_error'] = 'Nous pensons que vous êtes un robot. Si nous faisons erreur, merci d\'daccepter nos excuses.'; +$lang['user_register_reasons'] = 'Abonnez-vous pour accéder aux espaces réservés. Vos paramètres seront enregistrés, plus de contenu et moins de publicité.'; // Activation -$lang['user_activation_incorrect'] = 'L\'activation s\'est mal déroulée. S\'il vous plaît revoyer vos détails et assurez vous que les MAJUSCULES (CAPS LOCK) ne sont pas actives.'; -$lang['user_activated_message'] = 'Votre compte a été activé, vous pouvez maintenant vous y connecter.'; +$lang['user_activation_incorrect'] = 'L\'activation s\'est mal déroulée. S\'il vous plaît revoyer vos détails et assurez vous que les MAJUSCULES (CAPS LOCK) ne sont pas actives.'; +$lang['user_activated_message'] = 'Votre compte a été activé, vous pouvez maintenant vous y connecter.'; // Login -$lang['user_logged_in'] = 'Vous êtes connecté.'; +$lang['user_logged_in'] = 'Vous êtes connecté.'; $lang['user_already_logged_in'] = 'Vous êtes déjà connecté. S\'il vous plaît déconnectez-vous avant de ré-essayer.'; -$lang['user_login_incorrect'] = 'L\'email ou le mot de passe sont erronés. S\'il vous plaît vérifiez votre login et assurez vous que les MAJUSCULES (CAPS LOCK) ne sont pas actives.'; -$lang['user_inactive'] = 'Le compte que vous tentez d\'accéder est inactif.