Files
opensourcepos/application/hooks/load_config.php
jekkos-t520 40eef74aa0 Adapt load_config hook to fallback to english if no valid language is
present
Move CI system language files back to their correct location
(form_validation_lang)
Add upload_lang.php and email_lang.php to system files (default english
version for the time being)
Add account_number check when importing customer data from excel
Avoid unnecessary calls to check_item_number when importing items from
excel
2015-02-17 11:06:28 +01:00

45 lines
1.3 KiB
PHP

<?php
//Loads configuration from database into global CI config
function load_config()
{
$CI =& get_instance();
foreach( $CI->Appconfig->get_all()->result() as $app_config )
{
$CI->config->set_item( $app_config->key, $app_config->value );
}
//Set language from config database
//Loads all the language files from the language directory
if ( $CI->config->item( 'language' ) )
{
$CI->config->set_item( 'language', $CI->config->item( 'language' ) );
// fallback to english if language folder does not exist
$language = $CI->config->item( 'language' );
if (!file_exists('./application/language/' . $language))
{
$language = 'en';
}
$map = directory_map('./application/language/' . $language);
foreach($map as $file)
{
if ( substr(strrchr($file,'.'),1) == "php")
{
$CI->lang->load( str_replace( '_lang.php', '', $file ), $language);
}
}
}
//Set timezone from config database
if ( $CI->config->item( 'timezone' ) )
{
date_default_timezone_set( $CI->config->item( 'timezone' ) );
}
else
{
date_default_timezone_set( 'America/New_York' );
}
}
?>