コード例 #1
0
ファイル: locale.php プロジェクト: aburakovskiy/mibew
/**
 * Return localized string by its key and locale.
 *
 * Do not use this function manually because it is for internal use only and may
 * be removed soon. Use {@link getlocal()} function instead.
 *
 * @access private
 * @param string $string Localization string key.
 * @param string $locale Target locale code.
 * @return string Localized string.
 */
function get_localized_string($string, $locale)
{
    $localized = load_messages($locale);
    if (isset($localized[$string])) {
        return $localized[$string];
    }
    // The string is not localized, save it to the database to provide an
    // ability to translate it from the UI later. At the same time we cannot
    // rely on the database during maintenance, thus we should check the
    // current system state.
    if (get_maintenance_mode() === false) {
        save_message($locale, $string, $string);
    }
    // One can change english strings from the UI. Try to use these strings.
    if ($locale != 'en') {
        return get_localized_string($string, 'en');
    }
    // The string is not localized at all. Use it "as is".
    return $string;
}
コード例 #2
0
ファイル: init.php プロジェクト: abhijitroy07/mibew
@ini_set('session.name', 'MibewSessionID');
// Remove temporary request to keep global scope clean.
unset($tmp_request);
// Initialize user session
session_start();
if (function_exists("date_default_timezone_set")) {
    $timezone = !empty($configs['timezone']) ? $configs['timezone'] : (function_exists("date_default_timezone_get") ? @date_default_timezone_get() : "GMT");
    @date_default_timezone_set($timezone);
}
if (get_maintenance_mode() === false) {
    // Initialize the database
    \Mibew\Database::initialize($configs['database']['host'], $configs['database']['port'], $configs['database']['login'], $configs['database']['pass'], $configs['database']['use_persistent_connection'], $configs['database']['db'], $configs['database']['tables_prefix']);
}
// Load all other libraries
// TODO: Rewrite libs using Object-Oriented approach
require_once MIBEW_FS_ROOT . '/libs/canned.php';
require_once MIBEW_FS_ROOT . '/libs/captcha.php';
require_once MIBEW_FS_ROOT . '/libs/chat.php';
require_once MIBEW_FS_ROOT . '/libs/groups.php';
require_once MIBEW_FS_ROOT . '/libs/invitation.php';
require_once MIBEW_FS_ROOT . '/libs/operator.php';
require_once MIBEW_FS_ROOT . '/libs/pagination.php';
require_once MIBEW_FS_ROOT . '/libs/statistics.php';
require_once MIBEW_FS_ROOT . '/libs/track.php';
require_once MIBEW_FS_ROOT . '/libs/userinfo.php';
// Run plugins only after all libs are loaded.
if (get_maintenance_mode() === false && !empty($configs['plugins'])) {
    // A list of plugins is defined in $plugins_list variable in
    // configs/config.yml
    \Mibew\Plugin\PluginManager::getInstance()->loadPlugins($configs['plugins']);
}