Example #1
0
 function getMoFileName($domain)
 {
     if ($domain) {
         if (isset($GLOBALS['MO_FILE_NAMES'][$domain])) {
             return $GLOBALS['MO_FILE_NAMES'][$domain];
         }
         if (!defined('CUR_LOCALE')) {
             $CI =& get_instance();
             if (strstr($_SERVER['REQUEST_URI'], 'install')) {
                 $lang = $CI->config->item('language');
                 $locale = $lang ? $lang : 'ru_RU';
             } else {
                 if (strstr(uri_string(), 'admin')) {
                     $locale = $CI->config->item('language');
                 } else {
                     $currentLocale = MY_Controller::getCurrentLocale();
                     $language = $CI->db->where('identif', $currentLocale)->get('languages')->row_array();
                     $locale = $language['locale'];
                 }
             }
             define('CUR_LOCALE', $locale);
         } else {
             $locale = CUR_LOCALE;
         }
         $name = NULL;
         switch ($domain) {
             case 'main':
                 $searched = glob(correctUrl('./application/language/main/' . $locale) . '/' . $locale . '/LC_MESSAGES/main*.mo');
                 if (!empty($searched)) {
                     $name = str_replace('.mo', '', basename(array_pop($searched)));
                 }
                 break;
             default:
                 if (strstr($domain, 'admin') && MAINSITE) {
                     $begin = MAINSITE;
                 } else {
                     $begin = '.';
                 }
                 //$locale = 'de_DE';
                 $module_path = correctUrl('./application/modules/' . $domain . '/language/' . $locale);
                 if (is_dir($module_path)) {
                     $searched = glob($module_path . '/' . $locale . '/LC_MESSAGES/' . $domain . '*.mo');
                     if (!empty($searched)) {
                         $name = str_replace('.mo', '', basename(array_pop($searched)));
                     }
                 } elseif (file_exists(TEMPLATES_PATH . $domain)) {
                     $searched = glob(TEMPLATES_PATH . $domain . '/language/' . $domain . '/' . $locale . '/LC_MESSAGES/' . $domain . '*.mo');
                     if (!empty($searched)) {
                         $name = str_replace('.mo', '', basename(array_pop($searched)));
                     }
                 }
                 break;
         }
         $GLOBALS['MO_FILE_NAMES'] = $GLOBALS['MO_FILE_NAMES'] ? $GLOBALS['MO_FILE_NAMES'] : array();
         $GLOBALS['MO_FILE_NAMES'][$domain] = $name;
         return $name;
     }
     return FALSE;
 }
Example #2
0
 /**
  * Load a language file
  *
  * @access	public
  * @param	mixed	the name of the language file to be loaded. Can be an array
  * @param	string	the language (english, etc.)
  * @return	mixed
  */
 public function load($module = 'main')
 {
     $this->_init();
     if (strstr(uri_string(), 'admin')) {
         $lang = $this->getAdminLocale();
         if (!$module) {
             $module = 'admin';
         }
     } else {
         if (strstr($_SERVER['REQUEST_URI'], 'install')) {
             $lang = $this->ci->session->userdata('language');
         } else {
             $languageFront = $this->getFrontLangCode(MY_Controller::getCurrentLocale());
             $lang = $languageFront[1];
         }
     }
     //        var_dumps_exit($lang);
     //        $lang = 'de_DE';
     //        $module = 'translator';
     if ($module == 'main') {
         $this->addDomain(correctUrl('./application/language/main/' . $lang), getMoFileName('main'), $lang);
         $template_name = \CI_Controller::get_instance()->config->item('template');
         $this->addDomain('templates/' . $template_name . '/language/' . $template_name . '/', getMoFileName($template_name), $lang);
     } else {
         if ($module == 'admin') {
             $this->addDomain(correctUrl('./application/language/main/' . $lang), getMoFileName('main'), $lang);
         }
         //            if (MAINSITE && $module == 'admin') {
         //                $this->addDomain(MAINSITE . '/application/modules/' . $module . '/language', getMoFileName($module), $lang);
         //            } else {
         //            var_dumps_exit(getMoFileName($module));
         //            var_dumps_exit(correctUrl('./application/modules/' . $module . '/language/' . $lang));
         $this->addDomain(correctUrl('./application/modules/' . $module . '/language/' . $lang), getMoFileName($module), $lang);
         //            }
     }
 }
Example #3
0
if (!WINNIE_INSTALLED) {
    // Winnie is not yet installed
    // Redirect to the read me
    header('location: readme.html');
    exit;
    //End of script
}
##########################################
## Preliminary processing of input data ##
##########################################
// Flush unnecessary whitespace
foreach ($_GET as $key => $value) {
    $_GET[$key] = trim($value);
}
// Correct a possibly mistyped URL
$_GET['url'] = correctUrl($_GET['url']);
if (isset($_GET['ok']) && $_GET['url'] != '') {
    // The URL was not empty
    // The user has validated his message ($_GET['ok'] had a value).
    if ($_GET['pass'] == PASSWORD && in_array($_GET['from'], $ML_memberList)) {
        // Password was correct.
        // User provided a valid e-mail adress from the members list.
        ######################
        ## Sending the mail ##
        ######################
        // To
        $to = isset($_GET['test']) ? $_GET['from'] : ML_ADRESS;
        // Test mode allows mails to be sent only to the user itself (for testing purposes)
        // Subject
        $subject = stripslashes($_GET['title']);
        // Message body