changed the language loading behavior of codeigniter 2.2.6. it loads english if the requested language is not available
This commit is contained in:
parent
a39ea1339a
commit
6f9638a4f0
@ -193,7 +193,8 @@ sub toggle_user
|
||||
$dbh->begin_work ();
|
||||
|
||||
my $query = $dbh->prepare("UPDATE ${QC}${prefix}user_account${QC} SET ${QC}enabled${QC}=? WHERE ${QC}userid${QC}=?");
|
||||
if (!$query || !(my $execok = $query->execute($enabled, $userid)) || $query->rows() <= 0)
|
||||
my $execok = undef;
|
||||
if (!$query || !($execok = $query->execute($enabled, $userid)) || $query->rows() <= 0)
|
||||
{
|
||||
my $errstr = $execok? "user not found": $dbh->errstr();
|
||||
$dbh->rollback ();
|
||||
|
@ -65,6 +65,10 @@ class CI_Lang {
|
||||
*/
|
||||
function load($langfile = '', $idiom = '', $return = FALSE, $add_suffix = TRUE, $alt_path = '')
|
||||
{
|
||||
$first = true;
|
||||
$orglangfile = $langfile;
|
||||
|
||||
RETRY:
|
||||
$langfile = str_replace('.php', '', $langfile);
|
||||
|
||||
if ($add_suffix == TRUE)
|
||||
@ -108,6 +112,14 @@ class CI_Lang {
|
||||
|
||||
if ($found !== TRUE)
|
||||
{
|
||||
if ($first && $idiom != 'english')
|
||||
{
|
||||
// HYUNG-HWAN: load the english file if the given language is not available
|
||||
$first = false;
|
||||
$idiom = 'english';
|
||||
$langfile = $orglangfile;
|
||||
goto RETRY;
|
||||
}
|
||||
show_error('Unable to load the requested language file: language/'.$idiom.'/'.$langfile);
|
||||
}
|
||||
}
|
||||
|
@ -154,6 +154,13 @@ class CI_DB_driver {
|
||||
}
|
||||
}
|
||||
|
||||
// HYUNG-HWAN - hack to enable foreign keys support in sqlite
|
||||
if (preg_match("/^sqlite/", $this->dbdriver) ||
|
||||
($this->dbdriver == 'pdo' && preg_match("/^sqlite/", $this->hostname)))
|
||||
{
|
||||
$this->_execute('PRAGMA foreign_keys=ON');
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1408,4 +1415,4 @@ class CI_DB_driver {
|
||||
}
|
||||
|
||||
/* End of file DB_driver.php */
|
||||
/* Location: ./system/database/DB_driver.php */
|
||||
/* Location: ./system/database/DB_driver.php */
|
||||
|
@ -318,12 +318,7 @@ class CI_Form_validation {
|
||||
}
|
||||
|
||||
// Load the language file containing error messages
|
||||
|
||||
// HYUNG-HWAN: codepot doesn't ship the other language files for form validation
|
||||
// let's hard-code it to english
|
||||
//$this->CI->lang->load('form_validation');
|
||||
$this->CI->lang->load('form_validation', 'english');
|
||||
|
||||
$this->CI->lang->load('form_validation');
|
||||
|
||||
// Cycle through the rules for each field, match the
|
||||
// corresponding $_POST item and test for errors
|
||||
|
Loading…
Reference in New Issue
Block a user