Exemplo n.º 1
0
 /**
  *
  * @param type $corename
  */
 public static function init($corename = DEFAULT_TEST_CORENAME)
 {
     $CB_PATH = \CB_DOC_ROOT;
     $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
     $_SERVER['SERVER_NAME'] = static::getHost();
     $_GET['core'] = $corename;
     $_SESSION['user'] = array('id' => 1, 'groups' => []);
     require_once $CB_PATH . '/config.php';
     require_once $CB_PATH . '/lib/language.php';
     L\initTranslations();
     Config::setEnvVar('user_language_index', 1);
 }
Exemplo n.º 2
0
if (!isset($languageSettings[$coreLanguage])) {
    $languageSettings[$coreLanguage] = array('name' => $coreLanguage, 'locale' => 'en_US', 'long_date_format' => '%F %j, %Y', 'short_date_format' => '%m/%d/%Y', 'time_format' => '%H:%i');
    \CB\Config::setEnvVar('language_settings', $languageSettings);
}
// index for default core language
\CB\Config::setEnvVar('language_index', getIndex(\CB\Config::get('language')));
/* define user_language constant /**/
$user_language = $coreLanguage;
if (!empty($_COOKIE['L']) && strlen($_COOKIE['L']) == 2) {
    $user_language = strtolower($_COOKIE['L']);
}
if (!empty($_GET['l']) && strlen($_GET['l']) == 2) {
    $user_language = strtolower($_GET['l']);
}
/*  If we do not have a tanslation file for users language, we use main core language.
    If there is no translation file for main language set then we use english by default */
if (isset($_SESSION['user']['language']) && isset($languageSettings[$_SESSION['user']['language']])) {
    $user_language = $_SESSION['user']['language'];
} elseif (empty($_SESSION['user']['language']) || !isset($languageSettings[$_SESSION['user']['language']])) {
    $user_language = $coreLanguage;
}
$lidx = getIndex($user_language);
if ($lidx < 1) {
    $user_language = $coreLanguage;
    $lidx = getIndex($user_language);
}
\CB\Config::setEnvVar('user_language', $user_language);
// index for default user language
\CB\Config::setEnvVar('user_language_index', $lidx);
\CB\Config::setEnvVar('rtl', !empty($languageSettings[$user_language]['rtl']));
/* end of define user_language constant /**/
Exemplo n.º 3
0
 /**
  * storing max file versions count (mfvc)
  *     *:1;doc,docx,xls,xlsx,pdf:5;
  *     default is no versions if nothing specified in config
  */
 public static function setMFVC($configurationString)
 {
     $rez = array('*' => 0);
     if (!empty($configurationString)) {
         $v = explode(';', $configurationString);
         foreach ($v as $vc) {
             $vc = explode(':', $vc);
             if (sizeof($vc) == 2) {
                 $ext = trim($vc[0]);
                 $count = trim($vc[1]);
                 if (is_numeric($count)) {
                     $ext = explode(',', $ext);
                     foreach ($ext as $e) {
                         $e = trim($e);
                         $e = mb_strtolower($e);
                         $rez[$e] = $count;
                     }
                 }
             }
         }
     }
     Config::setEnvVar('mfvc', $rez);
     return $rez;
 }