function language_controler_flags()
{
    global $user, $template, $conf, $page;
    $available_lang = get_languages();
    if (isset($conf['no_flag_languages'])) {
        $available_lang = array_diff_key($available_lang, array_flip($conf['no_flag_languages']));
    }
    $url_starting = get_query_string_diff(array('lang'));
    if (isset($page['section']) and $page['section'] == 'additional_page' and isset($page['additional_page'])) {
        $base_url = make_index_url(array('section' => 'page')) . '/' . (isset($page['additional_page']['permalink']) ? $page['additional_page']['permalink'] : $page['additional_page']['id']);
    } else {
        $base_url = duplicate_index_url();
    }
    foreach ($available_lang as $code => $displayname) {
        $qlc = array('url' => add_url_params($base_url, array('lang' => $code)), 'alt' => ucwords($displayname), 'title' => substr($displayname, 0, -4), 'code' => $code);
        $lsw['flags'][$code] = $qlc;
        if ($code == $user['language']) {
            $lsw['Active'] = $qlc;
        }
    }
    $safe_themes = array('clear', 'dark', 'elegant', 'Sylvia', 'simple-grey', 'simple-black', 'simple-white', 'kardon', 'luciano', 'montblancxl');
    // stripped (2.6)
    $template->assign(array('lang_switch' => $lsw, 'LANGUAGE_SWITCH_PATH' => LANGUAGE_SWITCH_PATH, 'LANGUAGE_SWITCH_LOAD_STYLE' => !in_array($user['theme'], $safe_themes)));
    $template->set_filename('language_flags', dirname(__FILE__) . '/flags.tpl');
    $template->concat('PLUGIN_INDEX_ACTIONS', $template->parse('language_flags', true));
    $template->clear_assign('lang_switch');
}
Example #2
0
 function admin_texte()
 {
     global $db, $countries;
     if (isset($_POST['submit'])) {
         foreach ($_POST as $key => $value) {
             if (strpos($key, '_h_')) {
                 $lang = substr($key, 0, strpos($key, '_'));
                 $name = substr($key, strpos($key, '_') + 3);
                 $sql = sprintf('UPDATE ' . DB_PRE . 'ecp_texte SET content = \'%s\', content2 = \'%s\' WHERE name= \'%s\' AND lang = \'%s\';', strsave($_POST[$lang . '_' . $name]), strsave($value), strsave($name), strsave($lang));
                 $db->query($sql);
             }
         }
         header('Location: ?section=admin&site=texte');
     } else {
         $tpl = new smarty();
         $lang = get_languages();
         $db->query('SELECT * FROM ' . DB_PRE . 'ecp_texte ORDER BY lang ASC');
         while ($row = $db->fetch_assoc()) {
             foreach ($lang as $key => $value) {
                 if ($value['lang'] == $row['lang']) {
                     $lang[$key]['data'][$row['name']] = htmlspecialchars($row['content']);
                     $lang[$key]['headline'][$row['name']] = htmlspecialchars($row['content2']);
                 }
             }
         }
         $tpl->assign('lang', $lang);
         ob_start();
         $tpl->display(DESIGN . '/tpl/admin/texte.html');
         $content = ob_get_contents();
         ob_end_clean();
         main_content(TEXTE, $content, '', 1);
     }
 }
Example #3
0
 public function site_settings_options()
 {
     // Process installed realms
     $query = "SELECT `id`, `name` FROM `pcms_realms`";
     $result = $this->DB->query($query)->fetchAll();
     // Create our realms options
     if ($result != FALSE && !empty($result)) {
         $default = config('default_realm_id');
         foreach ($result as $realm) {
             // Get our selected option
             $selected = '';
             if ($default == $realm['id']) {
                 $selected = 'selected="selected" ';
             }
             // Add the language folder to the array
             $realms[] = '<option value="' . $realm['id'] . '" ' . $selected . '>' . $realm['name'] . '</option>';
         }
     } else {
         // No realms installed
         $realms[] = '<option value="0">No realms Installed!</option>';
     }
     // Process installed templates
     $default = config('default_templates');
     $list = get_installed_templates();
     foreach ($list as $file) {
         // Get our selected option
         $selected = '';
         $name = $file['name'];
         if ($default == $name) {
             $selected = 'selected="selected" ';
         }
         // Add the language folder to the array
         $templates[] = '<option value="' . $name . '" ' . $selected . '>' . $name . '</option>';
     }
     // Process languages
     $default = config('default_language');
     $list = get_languages();
     foreach ($list as $file) {
         // Get our selected option
         $selected = '';
         if ($default == $file) {
             $selected = 'selected="selected" ';
         }
         // Add the language folder to the array
         $languages[] = '<option value="' . $file . '" ' . $selected . '>' . ucfirst($file) . '</option>';
     }
     // Process installed emulators
     $default = config('emulator');
     $list = get_emulators();
     foreach ($list as $name) {
         // Get our selected option
         $selected = '';
         if ($default == $name) {
             $selected = 'selected="selected" ';
         }
         // Add the language folder to the array
         $emu[] = '<option value="' . $name . '" ' . $selected . '>' . ucfirst($name) . '</option>';
     }
     return array('realms' => $realms, 'templates' => $templates, 'languages' => $languages, 'emulators' => $emu);
 }
Example #4
0
/**
 * @version $Id: header.php 187 2011-01-18 15:25:24Z soeren $
 * @package eXtplorer
 * @copyright soeren 2007-2009
 * @author The eXtplorer project (http://sourceforge.net/projects/extplorer)
 * @author The	The QuiX project (http://quixplorer.sourceforge.net)
 * 
 * @license
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.1 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 * 
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations
 * under the License.
 * 
 * Alternatively, the contents of this file may be used under the terms
 * of the GNU General Public License Version 2 or later (the "GPL"), in
 * which case the provisions of the GPL are applicable instead of
 * those above. If you wish to allow use of your version of this file only
 * under the terms of the GPL and not to allow others to use
 * your version of this file under the MPL, indicate your decision by
 * deleting  the provisions above and replace  them with the notice and
 * other provisions required by the GPL.  If you do not delete
 * the provisions above, a recipient may use your version of this file
 * under either the MPL or the GPL."
 * 
 * This is the file, which prints the header row with the Logo
 */
function show_header($dirlinks = '')
{
    $url = str_replace(array('&dir=', '&action=', '&file_mode='), array('&a=', '&b=', '&c='), $_SERVER['REQUEST_URI']);
    $url_appendix = strpos($url, '?') === false ? '?' : '&amp;';
    echo "<link rel=\"stylesheet\" href=\"" . _EXT_URL . "/style/style.css\" type=\"text/css\" />\n";
    echo "<div id=\"ext_header\">\n";
    echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"5\">\n";
    $mode = extGetParam($_SESSION, 'file_mode', $GLOBALS['ext_conf']['authentication_method_default']);
    $logoutlink = ' <a href="' . $GLOBALS['script_name'] . '?option=com_extplorer&amp;action=logout" title="' . $GLOBALS['messages']['logoutlink'] . '">[' . $GLOBALS['messages']['logoutlink'] . ']</a>';
    $alternate_modes = array();
    foreach ($GLOBALS['ext_conf']['authentication_methods_allowed'] as $method) {
        if ($method != $mode) {
            $onclick = '';
            if (empty($_SESSION['credentials_' . $method])) {
                $onclick = "onclick=\"openActionDialog('switch_file_mode', '" . $method . "_authentication');return false;\"";
            }
            $alternate_modes[] = "<a {$onclick} href=\"{$url}" . $url_appendix . "file_mode={$method}\">{$method}</a>";
        }
    }
    echo '<tr><td width="20%">';
    if (is_object($GLOBALS['_VERSION']) || class_exists('jversion')) {
        echo '<a href="' . basename($_SERVER['SCRIPT_NAME']) . '">Back to ' . (!empty($GLOBALS['_VERSION']->PRODUCT) ? @$GLOBALS['_VERSION']->PRODUCT : 'Joomla!') . '</a>';
    } else {
        echo ext_selectList('language_selector', $GLOBALS['language'], get_languages(), 1, '', 'onchange="document.location.href=\'' . $GLOBALS['script_name'] . '?lang=\' + this.options[this.selectedIndex].value;"');
    }
    // Logo
    echo "</td><td style=\"color:black;\" width=\"10%\">";
    //echo "<div style=\"margin-left:10px;float:right;\" width=\"305\" >";
    echo "<a href=\"" . $GLOBALS['ext_home'] . "\" target=\"_blank\" title=\"eXtplorer Project\">\r\n\t\t<img src=\"" . _EXT_URL . "/images/eXtplorer_logo.png\" alt=\"eXtplorer Logo\" border=\"0\" /></a>\r\n\t\t</td>";
    //echo "</div>";
    echo "<td style=\"padding-left: 15px; color:black;\" id=\"bookmark_container\" width=\"35%\"></td>\n";
    echo "<td width=\"25%\" style=\"padding-left: 15px; color:black;\">" . sprintf($GLOBALS['messages']['switch_file_mode'], $mode . $logoutlink, implode(', ', $alternate_modes)) . "\r\n\t</td>\n";
    echo '</tr></table>';
    echo '</div>';
}
/**
 * @version $Id: header.php 116 2009-01-15 20:39:58Z soeren $
 * @package eXtplorer
 * @copyright soeren 2007
 * @author The eXtplorer project (http://sourceforge.net/projects/extplorer)
 * @author The  The QuiX project (http://quixplorer.sourceforge.net)
 * 
 * @license
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.1 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 * 
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations
 * under the License.
 * 
 * Alternatively, the contents of this file may be used under the terms
 * of the GNU General Public License Version 2 or later (the "GPL"), in
 * which case the provisions of the GPL are applicable instead of
 * those above. If you wish to allow use of your version of this file only
 * under the terms of the GPL and not to allow others to use
 * your version of this file under the MPL, indicate your decision by
 * deleting  the provisions above and replace  them with the notice and
 * other provisions required by the GPL.  If you do not delete
 * the provisions above, a recipient may use your version of this file
 * under either the MPL or the GPL."
 * 
 * This is the file, which prints the header row with the Logo
 */
function show_header($dirlinks = '')
{
    $url = str_replace('&dir=', '&ignore=', $_SERVER['REQUEST_URI']);
    $url_appendix = strpos($url, '?') === false ? '?' : '&amp;';
    echo "<link rel=\"stylesheet\" href=\"" . _EXT_URL . "/style/style.css\" type=\"text/css\" />\n";
    echo "<div id=\"ext_header\">\n";
    echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"5\">\n";
    $mode = extGetParam($_SESSION, 'file_mode', 'file');
    $logoutlink = $mode == 'ftp' ? ' <a href="' . $GLOBALS['script_name'] . '?option=com_extplorer&amp;action=ftp_logout" title="' . $GLOBALS['messages']['logoutlink'] . '">[' . $GLOBALS['messages']['logoutlink'] . ']</a>' : '';
    $alternate_mode = $mode == 'file' ? 'ftp' : 'file';
    echo '<tr><td width="20%">';
    if (is_object($GLOBALS['_VERSION']) || class_exists('jversion')) {
        echo "<a href=\"index2.php\">Back to " . (!empty($GLOBALS['_VERSION']->PRODUCT) ? @$GLOBALS['_VERSION']->PRODUCT : 'Joomla!') . '</a>';
    } else {
        echo ext_selectList('language_selector', $GLOBALS['language'], get_languages(), 1, '', 'onchange="document.location.href=\'' . $GLOBALS['script_name'] . '?lang=\' + this.options[this.selectedIndex].value;"');
    }
    // Logo
    echo "</td><td style=\"color:black;\" width=\"10%\">";
    //echo "<div style=\"margin-left:10px;float:right;\" width=\"305\" >";
    echo "<a href=\"" . $GLOBALS['ext_home'] . "\" target=\"_blank\" title=\"eXtplorer Project\">\r\n\t\t<img src=\"" . _EXT_URL . "/images/eXtplorer.gif\" alt=\"eXtplorer Logo\" border=\"0\" /></a>\r\n\t\t</td>";
    //echo "</div>";
    echo "<td style=\"padding-left: 15px; color:black;\" id=\"bookmark_container\" width=\"35%\"></td>\n";
    echo "<td width=\"25%\" style=\"padding-left: 15px; color:black;\">" . sprintf($GLOBALS['messages']['switch_file_mode'], $mode . $logoutlink, "<a id=\"switch_file_mode\" href=\"{$url}" . $url_appendix . "file_mode={$alternate_mode}\">{$alternate_mode}</a>") . "\r\n\t</td>\n";
    echo '</tr></table>';
    echo '</div>';
}
Example #6
0
function lang_load($cfglang)
{
    $lang = array();
    if ($cfglang != "") {
        include_once LANG_FILE_LOCATION . $cfglang . '.php';
    } else {
        include_once LANG_FILE_LOCATION . get_languages('header') . '.php';
    }
    return $lang;
}
Example #7
0
 /**
  * @see SugarView::display()
  */
 public function display()
 {
     global $current_user, $mod_strings, $app_list_strings, $sugar_config, $locale, $sugar_version;
     if (!is_admin($current_user)) {
         sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
     }
     $themeObject = SugarThemeRegistry::current();
     $configurator = new Configurator();
     $sugarConfig = SugarConfig::getInstance();
     $focus = new Administration();
     $focus->retrieveSettings();
     $ut = $GLOBALS['current_user']->getPreference('ut');
     if (empty($ut)) {
         $this->ss->assign('SKIP_URL', 'index.php?module=Users&action=Wizard&skipwelcome=1');
     } else {
         $this->ss->assign('SKIP_URL', 'index.php?module=Home&action=index');
     }
     // Always mark that we have got past this point
     $focus->saveSetting('system', 'adminwizard', 1);
     $css = $themeObject->getCSS();
     $favicon = $themeObject->getImageURL('sugar_icon.ico', false);
     $this->ss->assign('FAVICON_URL', getJSPath($favicon));
     $this->ss->assign('SUGAR_CSS', $css);
     $this->ss->assign('MOD_USERS', return_module_language($GLOBALS['current_language'], 'Users'));
     $this->ss->assign('CSS', '<link rel="stylesheet" type="text/css" href="' . SugarThemeRegistry::current()->getCSSURL('wizard.css') . '" />');
     $this->ss->assign('LANGUAGES', get_languages());
     $this->ss->assign('config', $sugar_config);
     $this->ss->assign('SUGAR_VERSION', $sugar_version);
     $this->ss->assign('settings', $focus->settings);
     $this->ss->assign('exportCharsets', get_select_options_with_id($locale->getCharsetSelect(), $sugar_config['default_export_charset']));
     $this->ss->assign('getNameJs', $locale->getNameJs());
     $this->ss->assign('NAMEFORMATS', $locale->getUsableLocaleNameOptions($sugar_config['name_formats']));
     $this->ss->assign('JAVASCRIPT', get_set_focus_js() . get_configsettings_js());
     $this->ss->assign('company_logo', SugarThemeRegistry::current()->getImageURL('company_logo.png'));
     $this->ss->assign('mail_smtptype', $focus->settings['mail_smtptype']);
     $this->ss->assign('mail_smtpserver', $focus->settings['mail_smtpserver']);
     $this->ss->assign('mail_smtpport', $focus->settings['mail_smtpport']);
     $this->ss->assign('mail_smtpuser', $focus->settings['mail_smtpuser']);
     $this->ss->assign('mail_smtppass', $focus->settings['mail_smtppass']);
     $this->ss->assign('mail_smtpauth_req', $focus->settings['mail_smtpauth_req'] ? "checked='checked'" : '');
     $this->ss->assign('MAIL_SSL_OPTIONS', get_select_options_with_id($app_list_strings['email_settings_for_ssl'], $focus->settings['mail_smtpssl']));
     $this->ss->assign('notify_allow_default_outbound_on', !empty($focus->settings['notify_allow_default_outbound']) && $focus->settings['notify_allow_default_outbound'] == 2 ? 'CHECKED' : '');
     $this->ss->assign('THEME', SugarThemeRegistry::current()->__toString());
     // get javascript
     ob_start();
     $this->options['show_javascript'] = true;
     $this->renderJavascript();
     $this->options['show_javascript'] = false;
     $this->ss->assign("SUGAR_JS", ob_get_contents() . $themeObject->getJS());
     ob_end_clean();
     $this->ss->assign('langHeader', get_language_header());
     $this->ss->assign('START_PAGE', !empty($_REQUEST['page']) ? $_REQUEST['page'] : 'welcome');
     $this->ss->display('modules/Configurator/tpls/adminwizard.tpl');
 }
Example #8
0
function config_form()
{
    global $phpc_script, $phpc_user_tz, $phpc_user_lang, $phpc_token;
    $tz_input = create_multi_select('timezone', get_timezone_list(), $phpc_user_tz);
    $languages = array("" => __("Default"));
    foreach (get_languages() as $lang) {
        $languages[$lang] = $lang;
    }
    $lang_input = create_select('language', $languages, $phpc_user_lang);
    $form = tag('form', attributes("action=\"{$phpc_script}\"", 'method="post"'), tag('table', attributes("class=\"phpc-container\""), tag('caption', __('Settings')), tag('tfoot', tag('tr', tag('td', attributes('colspan="2"'), create_hidden('phpc_token', $phpc_token), create_hidden('action', 'settings'), create_hidden('phpc_submit', 'settings'), create_submit(__('Submit'))))), tag('tbody', tag('tr', tag('th', __('Timezone')), tag('td', $tz_input)), tag('tr', tag('th', __('Language')), tag('td', $lang_input)))));
    return tag('div', attrs('id="phpc-config"'), $form);
}
Example #9
0
function admin_calendar()
{
    global $db, $countries;
    $tpl = new smarty();
    $tpl->assign('events', get_events());
    $tpl->assign('lang', get_languages());
    $tpl->assign('rights', get_form_rights());
    ob_start();
    $tpl->display(DESIGN . '/tpl/admin/calendar.html');
    $content = ob_get_contents();
    ob_end_clean();
    main_content(CALENDAR, $content, '', 1);
}
Example #10
0
function admin_cms()
{
    global $db;
    $tpl = new Smarty();
    $tpl->assign('cms', get_cms());
    $tpl->assign('lang', get_languages());
    $tpl->assign('rights', get_form_rights(@$_POST['rights']));
    ob_start();
    $tpl->display(DESIGN . '/tpl/admin/cms.html');
    $content = ob_get_contents();
    ob_end_clean();
    main_content(OWN_SITES, $content, '', 1);
}
 public function template_edit($uID = NULL)
 {
     if (!isset($uID) || !is_numeric($uID)) {
         show_404();
     }
     if ($this->input->is_ajax_request()) {
         if ($this->input->post('ajax_submit')) {
             // Libreary
             $this->load->library('form_validation');
             // Validation Rules
             foreach (get_languages(TRUE) as $language) {
                 $this->form_validation->set_rules('templates[' . $language['uID'] . '][subject]', tr('_GLOBAL_subject_'), 'required|max_length[255]|trim');
             }
             // Return Data
             $json = array('csrf' => array($this->security->get_csrf_token_name() => $this->security->get_csrf_hash()));
             // Check Validation
             if (!$this->form_validation->run()) {
                 $json['status'] = FALSE;
                 $json['message'] = validation_errors();
                 // Validation Rules
                 foreach (get_languages(TRUE) as $language) {
                     $json['rules']['templates[' . $language['uID'] . '][subject]'] = form_error('templates[' . $language['uID'] . '][subject]') ? 'has-error' : 'has-success';
                 }
             } else {
                 // Load library
                 $this->load->model('backend/emails_model');
                 // Form Values
                 $form['uID'] = $uID;
                 $form['subject'] = $this->input->post('key', TRUE);
                 $form['templates'] = $this->input->post('templates', FALSE);
                 if ($this->emails_model->template_edit($form)) {
                     $json['status'] = TRUE;
                     $json['message'] = tr('_PAGE_BACKEND_LANGUAGES_SUCCESS_edit_template_');
                 } else {
                     $json['status'] = FALSE;
                     $json['message'] = tr('_PAGE_BACKEND_LANGUAGES_ERROR_edit_template_');
                 }
             }
             // Output
             $this->output->set_header('Content-Type: application/json; charset=utf-8')->set_content_type('application/json')->set_output(json_encode($json));
         } else {
             // Load Model
             $this->load->model('backend/emails_model');
             // Load Template
             $data['data'] = $this->emails_model->template_get($uID);
             // Load View
             $this->template->view('emails/modal/_template_edit', $data);
         }
     }
 }
Example #12
0
 function admin_settings()
 {
     global $db, $countries;
     if (isset($_POST['submit'])) {
         unset($_POST['submit']);
         $_POST['SITE_URL'] = strrpos($_POST['SITE_URL'], '/') !== strlen($_POST['SITE_URL']) - 1 ? check_url($_POST['SITE_URL'] . '/') : check_url($_POST['SITE_URL']);
         $sql = 'UPDATE ' . DB_PRE . 'ecp_settings SET ';
         foreach ($_POST as $key => $value) {
             $sql .= $key . ' = "' . strsave($value) . '", ';
         }
         $sql = substr($sql, 0, strlen($sql) - 2);
         if ($db->query($sql)) {
             header('Location: ?section=admin&site=settings');
         }
     } else {
         $dir = scan_dir('templates', true);
         $designs = '';
         foreach ($dir as $value) {
             if (is_dir('templates/' . $value)) {
                 $designs .= '<option ' . ($value == DESIGN ? 'selected="selected"' : '') . ' value="' . $value . '">' . $value . '</option>';
             }
         }
         $tpl = new smarty();
         $tpl->assign('designs', $designs);
         $tpl->assign('langs', get_languages());
         $dir = scan_dir('module', true);
         $start = '';
         foreach ($dir as $value) {
             if (is_dir('module/' . $value)) {
                 $start .= '<option ' . ('modul|' . $value == STARTSEITE ? 'selected="selected"' : '') . ' value="modul|' . $value . '">' . $value . '</option>';
             }
         }
         $start .= '<option value="">-----' . OWN_SITES . '----</option>';
         $db->query('SELECT headline, cmsID FROM ' . DB_PRE . 'ecp_cms ORDER BY headline ASC');
         while ($row = $db->fetch_assoc()) {
             $title = json_decode($row['headline'], true);
             isset($title[LANGUAGE]) ? $title = $title[LANGUAGE] : ($title = $title[DEFAULT_LANG]);
             $start .= '<option ' . ('cms|' . $row['cmsID'] == STARTSEITE ? 'selected="selected"' : '') . ' value="cms|' . $row['cmsID'] . '">' . $title . '</option>';
         }
         $tpl->assign('startseite', $start);
         ob_start();
         $tpl->display(DESIGN . '/tpl/admin/settings.html');
         $content = ob_get_contents();
         ob_end_clean();
         main_content(SETTINGS, $content, '', 1);
     }
 }
function get_language_select_options($default = "")
{
    $str = "";
    $json = json_decode(get_languages());
    $str .= '<option value="">wie Album</option>';
    $str .= "\n";
    foreach ($json as $language) {
        $str .= '<option value="' . $language->id . '" ';
        if (isset($default) && (string) $language->id == $default) {
            $str .= "selected";
        }
        $str .= ' >';
        $str .= $language->language . '</option>';
        $str .= "\n";
    }
    return $str;
}
Example #14
0
 public function run()
 {
     if (empty($this->upgrader->state['old_moduleList'])) {
         $this->log("Did not find old modules?");
         return;
     }
     include 'include/language/en_us.lang.php';
     $en_strings = $app_list_strings;
     $newModules = array_diff($en_strings['moduleList'], $this->upgrader->state['old_moduleList']);
     if (empty($newModules)) {
         return;
     }
     $this->log("New modules to add: " . var_export($newModules, true));
     $keyList = array('moduleList', 'moduleListSingular');
     foreach (get_languages() as $langKey => $langName) {
         if (!file_exists("custom/include/language/{$langKey}.lang.php")) {
             // no custom file, nothing to do
             continue;
         }
         $app_list_strings = array();
         if (file_exists("include/language/{$langKey}.lang.php")) {
             include "include/language/{$langKey}.lang.php";
         }
         $orig_lang_strings = $app_list_strings;
         $all_strings = return_app_list_strings_language($langKey);
         $addModStrings = array();
         foreach ($newModules as $modKey => $modName) {
             foreach ($keyList as $appKey) {
                 if (empty($all_strings[$appKey][$modKey])) {
                     if (!empty($orig_lang_strings[$appKey][$modKey])) {
                         $addModStrings[$appKey][$modKey] = $orig_lang_strings[$appKey][$modKey];
                     } elseif (!empty($en_strings[$appKey][$modKey])) {
                         $addModStrings[$appKey][$modKey] = $en_strings[$appKey][$modKey];
                     } else {
                         $this->log("Weird, did not find name in {$appKey} for {$modKey} in {$langKey}");
                         $addModStrings[$appKey][$modKey] = $modKey;
                     }
                 }
             }
         }
         if (!empty($addModStrings)) {
             $this->updateCustomFile($langKey, $addModStrings);
         }
     }
 }
 /**
  * Constructor
  */
 function __construct()
 {
     parent::__construct();
     // get settings
     $settings = $this->settings_model->get_settings();
     $this->settings = new stdClass();
     foreach ($settings as $setting) {
         $this->settings->{$setting['name']} = @unserialize($setting['value']) !== FALSE ? unserialize($setting['value']) : $setting['value'];
     }
     $this->settings->site_version = $this->config->item('site_version');
     $this->settings->root_folder = $this->config->item('root_folder');
     // get current uri
     $this->current_uri = "/" . uri_string();
     // set the time zone
     $timezones = $this->config->item('timezones');
     date_default_timezone_set($timezones[$this->settings->timezones]);
     // get current user
     $this->user = $this->session->userdata('logged_in');
     // get languages
     $this->languages = get_languages();
     // set language according to this priority:
     //   1) First, check session
     //   2) If session not set, use the users language
     //   3) Finally, if no user, use the configured languauge
     if ($this->session->language) {
         // language selected from nav
         $this->config->set_item('language', $this->session->language);
     } elseif ($this->user['language']) {
         // user's saved language
         $this->config->set_item('language', $this->user['language']);
     } else {
         // default language
         $this->config->set_item('language', $this->config->item('language'));
     }
     // save selected language to session
     $this->session->language = $this->config->item('language');
     // load the core language file
     $this->lang->load('core');
     // set global header data - can be merged with or overwritten in controllers
     $this->add_external_css(array("//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css", "//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css", "//maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css", "/themes/core/css/core.css"))->add_external_js(array("//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js", "//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"));
     $this->includes['js_files_i18n'] = array($this->jsi18n->translate("/themes/core/js/core_i18n.js"));
     // enable the profiler?
     $this->output->enable_profiler($this->config->item('profiler'));
 }
Example #16
0
/**
 * Retrieves the requested js language file, building it if it doesn't exist.
 */
function getJSLanguage()
{
    require_once 'include/language/jsLanguage.php';
    global $app_list_strings;
    if (empty($_REQUEST['lang'])) {
        echo "No language specified";
        return;
    }
    $lang = clean_path($_REQUEST['lang']);
    $languages = get_languages();
    if (!preg_match("/^\\w\\w_\\w\\w\$/", $lang) || !isset($languages[$lang])) {
        if (!preg_match("/^\\w\\w_\\w\\w\$/", $lang)) {
            echo "did not match regex<br/>";
        } else {
            echo "{$lang} was not in list . <pre>" . print_r($languages, true) . "</pre>";
        }
        echo "Invalid language specified";
        return;
    }
    if (empty($_REQUEST['module']) || $_REQUEST['module'] === 'app_strings') {
        $file = sugar_cached('jsLanguage/') . $lang . '.js';
        if (!sugar_is_file($file)) {
            $jsLanguage = new jsLanguage();
            $jsLanguage->createAppStringsCache($lang);
        }
    } else {
        $module = clean_path($_REQUEST['module']);
        $fullModuleList = array_merge($GLOBALS['moduleList'], $GLOBALS['modInvisList']);
        if (!isset($app_list_strings['moduleList'][$module]) && !in_array($module, $fullModuleList)) {
            echo "Invalid module specified";
            return;
        }
        $file = sugar_cached('jsLanguage/') . $module . "/" . $lang . '.js';
        if (!sugar_is_file($file)) {
            jsLanguage::createModuleStringsCache($module, $lang);
        }
    }
    //Setup cache headers
    header("Content-Type: application/javascript");
    header("Cache-Control: max-age=31556940, private");
    header("Pragma: ");
    header("Expires: " . gmdate('D, d M Y H:i:s \\G\\M\\T', time() + 31556940));
    readfile($file);
}
Example #17
0
function admin_awards()
{
    global $db;
    $awards = array();
    $db->query('SELECT `awardID`, `eventname`, `eventdatum`, `url`, `platz` FROM ' . DB_PRE . 'ecp_awards ORDER BY eventdatum DESC');
    while ($row = $db->fetch_assoc()) {
        $row['eventdatum'] = date('d.m.Y', $row['eventdatum']);
        $awards[] = $row;
    }
    $tpl = new Smarty();
    $tpl->assign('awards', $awards);
    $tpl->assign('teams', get_teams_form());
    $tpl->assign('games', get_games_form());
    $tpl->assign('lang', get_languages());
    ob_start();
    $tpl->display(DESIGN . '/tpl/admin/awards.html');
    $content = ob_get_contents();
    ob_end_clean();
    main_content(AWARDS, $content, '', 1);
}
Example #18
0
function admin_downloads()
{
    global $db;
    $tpl = new smarty();
    $tpl->assign('lang', get_languages());
    $tpl->assign('rights', get_form_rights(@$_POST['rights']));
    $tpl->assign('kate', download_get_cate(@$_POST['subID']));
    $db->query('SELECT name, dID FROM ' . DB_PRE . 'ecp_downloads ORDER BY name ASC');
    $dl = '<option value="0">' . CHOOSE . '</option>';
    while ($row = $db->fetch_assoc()) {
        $dl .= '<option value="' . $row['dID'] . '">' . $row['name'] . '</option>';
    }
    $tpl->assign('dls', $dl);
    //foreach($_POST AS $key=>$value) $tpl->assign($key, $value);
    ob_start();
    $tpl->display(DESIGN . '/tpl/admin/downloads.html');
    $content = ob_get_contents();
    ob_end_clean();
    main_content(DOWNLOADS, $content, '', 1);
}
 function __construct(&$config, $dn = NULL, $object = NULL)
 {
     #definition des variables
     $attributesInfo = self::getAttributesInfo();
     /* Languages */
     $languages = get_languages(TRUE);
     asort($languages);
     $languages = array_merge(array("" => _("Automatic")), $languages);
     $attributesInfo['look_n_feel']['attrs'][0]->setChoices(array_keys($languages), array_values($languages));
     /* Timezones */
     $attributesInfo['look_n_feel']['attrs'][2]->setChoices(timezone::_get_tz_zones());
     /* Password methods */
     $methods = passwordMethod::get_available_methods();
     $methods = $methods['name'];
     $attributesInfo['password']['attrs'][0]->setChoices($methods);
     parent::__construct($config, $dn, $object, $attributesInfo);
     $this->fusionConfigMd5 = md5_file(CACHE_DIR . "/" . CLASS_CACHE);
     $this->attributesAccess['fdEnableSnapshots']->setManagedAttributes(array('disable' => array(FALSE => array('fdSnapshotBase'))));
     $this->attributesAccess['fdForceSSL']->setManagedAttributes(array('disable' => array(TRUE => array('fdWarnSSL'))));
     $this->attributesAccess['fdIdAllocationMethod']->setManagedAttributes(array('erase' => array('traditional' => array('fdUidNumberPoolMin', 'fdUidNumberPoolMax', 'fdGidNumberPoolMin', 'fdGidNumberPoolMax'))));
 }
 public function display()
 {
     global $mod_strings, $locale;
     $bak_mod_strings = $mod_strings;
     $smarty = new Sugar_Smarty();
     $smarty->assign('mod_strings', $mod_strings);
     $package_name = $_REQUEST['view_package'];
     $module_name = $_REQUEST['view_module'];
     require_once 'modules/ModuleBuilder/MB/ModuleBuilder.php';
     $mb = new ModuleBuilder();
     $mb->getPackage($_REQUEST['view_package']);
     $package = $mb->packages[$_REQUEST['view_package']];
     $package->getModule($module_name);
     $mbModule = $package->modules[$module_name];
     if (!empty($_REQUEST['selected_lang'])) {
         $selected_lang = $_REQUEST['selected_lang'];
     } else {
         $selected_lang = $locale->getAuthenticatedUserLanguage();
     }
     //need to change the following to interface with MBlanguage.
     $smarty->assign('MOD', $mbModule->getModStrings($selected_lang));
     $smarty->assign('APP', $GLOBALS['app_strings']);
     $smarty->assign('selected_lang', $selected_lang);
     $smarty->assign('view_package', $package_name);
     $smarty->assign('view_module', $module_name);
     $smarty->assign('mb', '1');
     $smarty->assign('available_languages', get_languages());
     ///////////////////////////////////////////////////////////////////
     ////ASSISTANT
     $smarty->assign('assistant', array('group' => 'module', 'key' => 'labels'));
     /////////////////////////////////////////////////////////////////
     ////ASSISTANT
     $ajax = new AjaxCompose();
     $ajax->addCrumb($bak_mod_strings['LBL_MODULEBUILDER'], 'ModuleBuilder.main("mb")');
     $ajax->addCrumb($package_name, 'ModuleBuilder.getContent("module=ModuleBuilder&action=package&package=' . $package->name . '")');
     $ajax->addCrumb($module_name, 'ModuleBuilder.getContent("module=ModuleBuilder&action=module&view_package=' . $package->name . '&view_module=' . $module_name . '")');
     $ajax->addCrumb($bak_mod_strings['LBL_LABELS'], '');
     $ajax->addSection('center', $bak_mod_strings['LBL_LABELS'], $smarty->fetch('modules/ModuleBuilder/tpls/labels.tpl'));
     echo $ajax->getJavascript();
 }
Example #21
0
function admin_gallery()
{
    global $db;
    $tpl = new smarty();
    $tpl->assign('access', get_form_rights());
    $tpl->assign('folders', get_dirs());
    $tpl->assign('lang', get_languages());
    $db->query('SELECT kateID, katename, galleries FROM ' . DB_PRE . 'ecp_gallery_kate ORDER BY katename ASC');
    $kate = array();
    while ($row = $db->fetch_assoc()) {
        @($options .= '<option value="' . $row['kateID'] . '">' . $row['katename'] . '</option>');
        $kate[] = $row;
    }
    $tplc = new Smarty();
    $tplc->assign('kate', $kate);
    ob_start();
    $tplc->display(DESIGN . '/tpl/admin/gallery_kate_overview.html');
    $content = ob_get_contents();
    ob_end_clean();
    $tpl->assign('kate', $content);
    $tpl->assign('kategorien', @$options);
    $db->query('SELECT galleryID, folder, name, images, katename FROM ' . DB_PRE . 'ecp_gallery LEFT JOIN ' . DB_PRE . 'ecp_gallery_kate ON cID = kateID ORDER BY name ASC');
    $gallery = array();
    while ($row = $db->fetch_assoc()) {
        $gallery[] = $row;
    }
    $tplc = new Smarty();
    $tplc->assign('gallery', $gallery);
    ob_start();
    $tplc->display(DESIGN . '/tpl/admin/gallery_overview.html');
    $content = ob_get_contents();
    ob_end_clean();
    $tpl->assign('gallery', $content);
    ob_start();
    $tpl->display(DESIGN . '/tpl/admin/gallery.html');
    $content = ob_get_contents();
    ob_end_clean();
    main_content(GALLERY, $content, '', 1);
}
Example #22
0
function admin_teams()
{
    global $db;
    $tpl = new smarty();
    $tpl->assign('lang', get_languages());
    $tpl->assign('groups', get_groups(@(int) $_POST['grID']));
    $bilder = '<option value="">' . NONE . '</option>';
    $pics = scan_dir('images/teams/', true);
    $endungen = array('jpg', 'jpeg', 'JPG', 'JPEG', 'gif', 'GIF', 'PNG', 'png');
    foreach ($pics as $value) {
        if (in_array(substr($value, strrpos($value, '.') + 1), $endungen)) {
            $bilder .= '<option value="' . $value . '">' . $value . '</option>';
        }
    }
    $tpl->assign('pics', $bilder);
    ob_start();
    $tpl->display(DESIGN . '/tpl/admin/teams.html');
    $content = ob_get_contents();
    ob_end_clean();
    main_content(TEAMS, $content, '', 1);
    get_teams();
}
Example #23
0
 static function addLabels($currLanguage, $labels, $moduleName, $basepath = null)
 {
     $GLOBALS['log']->debug("ParserLabel->addLabels({$currLanguage}, \$labels, {$moduleName}, {$basepath} );");
     $GLOBALS['log']->debug("\$labels:" . print_r($labels, true));
     $languages = get_languages();
     foreach ($languages as $language => $langlabel) {
         $currentLabels = self::getCustomLabels($language, $moduleName, $basepath);
         if ($currentLabels === false) {
             return false;
         }
         //Unable to create a custom folder.
         $mod_strings = $currentLabels['labels'];
         $changed = false;
         foreach ($labels as $key => $value) {
             if (!isset($mod_strings[$key]) || strcmp($value, $mod_strings[$key]) != 0 && $language == $currLanguage) {
                 $mod_strings[$key] = html_entity_decode_utf8($value, ENT_QUOTES);
                 // must match encoding used in view.labels.php
                 $changed = true;
             }
         }
         if ($changed) {
             $GLOBALS['log']->debug("ParserLabel->addLabels: writing new mod_strings to {$currentLabels['file']}");
             $GLOBALS['log']->debug("ParserLabel->addLabels: mod_strings=" . print_r($mod_strings, true));
             if (!write_array_to_file("mod_strings", $mod_strings, $currentLabels["file"])) {
                 $GLOBALS['log']->fatal("Could not write {$currentLabels['file']}");
             } else {
                 // if we have a cache to worry about, then clear it now
                 if ($currentLabels['deployed']) {
                     $GLOBALS['log']->debug("PaserLabel->addLabels: clearing language cache");
                     $cache_key = "module_language." . $language . $moduleName;
                     sugar_cache_clear($cache_key);
                     LanguageManager::clearLanguageCache($moduleName, $language);
                 }
             }
         }
     }
     return true;
 }
Example #24
0
function config_form()
{
    global $phpc_script, $phpc_user_tz, $phpc_user_lang, $phpc_token, $phpcdb, $phpc_user;
    $tz_input = create_multi_select('timezone', get_timezone_list(), $phpc_user_tz);
    $languages = array("" => __("Default"));
    foreach (get_languages() as $lang) {
        $languages[$lang] = $lang;
    }
    $lang_input = create_select('language', $languages, $phpc_user_lang);
    $calendars = array("" => __("None"));
    foreach ($phpcdb->get_calendars() as $calendar) {
        $calendars[$calendar->get_cid()] = $calendar->get_title();
    }
    $default_input = create_select('default_cid', $calendars, $phpc_user->get_default_cid());
    $table = tag('table', attrs('class="phpc-form"'));
    if (is_user()) {
        $table->add(tag('tr', tag('th', __('Default Calendar')), tag('td', $default_input)));
    }
    $table->add(tag('tr', tag('th', __('Timezone')), tag('td', $tz_input)));
    $table->add(tag('tr', tag('th', __('Language')), tag('td', $lang_input)));
    $form = tag('form', attributes("action=\"{$phpc_script}\"", 'method="post"'), tag('div', attrs('class="phpc-sub-title"'), __('Settings')), $table, create_hidden('phpc_token', $phpc_token), create_hidden('action', 'user_settings_submit'), create_submit(__('Submit')));
    return tag('div', attrs('id="phpc-config"'), $form);
}
 /**
  * Editar imagen
  *
  * @access 	public
  * @param 	array 	$form	    Datos del formulario
  * @return 	bool                Devuelve TRUE si se ha podido editar o FALSE si no se ha podido.
  */
 public function image_edit($form = array())
 {
     $update = array('uID_galeria' => $form['category']);
     $where = array('uID' => $form['uID']);
     if ($this->db->update('galeria_images', $update, $where)) {
         foreach (get_languages(TRUE) as $language) {
             $insert_info[] = array('uID_idiomas' => $language['uID'], 'uID_galeria_images' => $form['uID'], 'title' => $form['images'][$language['uID']]['title'], 'text' => $form['images'][$language['uID']]['text']);
         }
         $this->db->insert_batch('galeria_images_info', $insert_info);
         foreach ($form['images'] as $language_id => $image) {
             $update = array('title' => $image['title'], 'text' => $image['text']);
             // Where
             $where = array('uID_galeria_images' => $form['uID'], 'uID_idiomas' => $language_id);
             if ($this->db->update('galeria_images_info', $update, $where)) {
                 continue;
             } else {
                 return FALSE;
             }
         }
         return TRUE;
     }
     return FALSE;
 }
Example #26
0
 public function display()
 {
     global $mod_strings, $locale;
     $ajax = new AjaxCompose();
     $smarty = new Sugar_Smarty();
     if (isset($_REQUEST['MB']) && $_REQUEST['MB'] == "1") {
         $smarty->assign("MB", $_REQUEST['MB']);
         $smarty->assign("view_package", $_REQUEST['view_package']);
     }
     if (!empty($_REQUEST['selected_lang'])) {
         $selected_lang = $_REQUEST['selected_lang'];
     } else {
         $selected_lang = $locale->getAuthenticatedUserLanguage();
     }
     if (empty($selected_lang)) {
         $selected_lang = $GLOBALS['sugar_config']['default_language'];
     }
     $smarty->assign('available_languages', get_languages());
     $smarty->assign('selected_lang', $selected_lang);
     ksort($this->properties);
     if (isset($this->properties['width'])) {
         $smarty->assign('defaultWidths', SidecarListLayoutMetaDataParser::getDefaultWidths());
     }
     // BWC modules width are in %, sidecar modules widths are in pixels.
     $smarty->assign('widthUnit', isModuleBWC($this->editModule) ? '%' : 'px');
     $smarty->assign("properties", $this->properties);
     $smarty->assign("mod_strings", $mod_strings);
     $smarty->assign('APP', $GLOBALS['app_strings']);
     $smarty->assign("view_module", $this->editModule);
     $smarty->assign("subpanel", $this->subpanel);
     if (isset($this->editPackage)) {
         $smarty->assign("view_package", $this->editPackage);
     }
     $ajax->addSection('east', translate('LBL_SECTION_PROPERTIES', 'ModuleBuilder'), $smarty->fetch('modules/ModuleBuilder/tpls/editProperty.tpl'));
     echo $ajax->getJavascript();
 }
Example #27
0
$cfg = new Configurator();
$sugar_smarty = new Sugar_Smarty();
$errors = array();
if (!array_key_exists('aod', $cfg->config)) {
    $cfg->config['aod'] = array('enable_aod' => '');
}
if (isset($_REQUEST['do']) && $_REQUEST['do'] == 'save') {
    $cfg->config['aod']['enable_aod'] = !empty($_REQUEST['enable_aod']);
    $cfg->saveConfig();
    header('Location: index.php?module=Administration&action=index');
    exit;
}
$sugar_smarty->assign('MOD', $mod_strings);
$sugar_smarty->assign('APP', $app_strings);
$sugar_smarty->assign('APP_LIST', $app_list_strings);
$sugar_smarty->assign('LANGUAGES', get_languages());
$sugar_smarty->assign("JAVASCRIPT", get_set_focus_js());
$sugar_smarty->assign('config', $cfg->config['aod']);
$sugar_smarty->assign('error', $errors);
$buttons = <<<EOQ
    <input title="{$app_strings['LBL_SAVE_BUTTON_TITLE']}"
                       accessKey="{$app_strings['LBL_SAVE_BUTTON_KEY']}"
                       class="button primary"
                       type="submit"
                       name="save"
                       onclick="return check_form('ConfigureSettings');"
                       value="  {$app_strings['LBL_SAVE_BUTTON_LABEL']}  " >
                &nbsp;<input title="{$mod_strings['LBL_CANCEL_BUTTON_TITLE']}"  onclick="document.location.href='index.php?module=Administration&action=index'" class="button"  type="button" name="cancel" value="  {$app_strings['LBL_CANCEL_BUTTON_LABEL']}  " >
EOQ;
$sugar_smarty->assign("BUTTONS", $buttons);
$sugar_smarty->display('custom/modules/Administration/AODAdmin.tpl');
Example #28
0
ob_start();
$title = "faq_long";
$menu__area = "options_main";
include "header.php";
if ($proceed) {
    $allow = check_allow('faq_edit', 'options_main.php');
}
if ($proceed) {
    echo '<center>';
    if (check_allow('faq_add')) {
        echo '
                <BR>
                ' . button_link('faq_edit.php?addit=true', lang('create_new'), 'plus-circle');
    }
    // load languages
    $languages = get_languages();
    echo '<BR><BR>
        <table class="or_listtable" style="width: 80%;"><thead>
        <TR style="background: ' . $color['list_header_background'] . '; color: ' . $color['list_header_textcolor'] . ';">';
    foreach ($languages as $language) {
        echo '<td class="small">' . $language . '</td>';
    }
    echo '<TD>' . lang('this_faq_answered_questions_of_xxx') . '</TD>
            <TD></TD>
            </TR></thead>
                <tbody>';
    $query = "SELECT *\n            FROM " . table('faqs') . ", " . table('lang') . "\n            WHERE content_type='faq_question'\n            AND " . table('faqs') . ".faq_id=" . table('lang') . ".content_name\n            ORDER BY " . lang('lang');
    $result = or_query($query);
    $shade = false;
    while ($line = pdo_fetch_assoc($result)) {
        echo '  <tr class="small"';
Example #29
0
    	<div class="row">
        	<div class="span4">
    			<a href="index.php"><img src="<?php 
echo base_url();
?>
assets/img/logo.png" border="0" title="TomatoCart, Open Source Shopping Cart Solutions" style="margin: 10px 10px 0px 10px;" /></a>
        	</div>
        	<div class="span8">
            	<div class="row clearfix">
                    <ul class="languages pull-right">
                        <li><b><?php 
echo lang('title_language');
?>
</b></li>
                        <?php 
foreach (get_languages() as $language) {
    ?>
                        <li><?php 
    echo '<a href="index.php?language=' . $language['code'] . '"><img src="' . get_language_flag($language['code']) . '" title="' . $language['title'] . '" alt="' . $language['title'] . '" /></a>';
    ?>
</li>
                        <?php 
}
?>
                    </ul>
            	</div>
        		<div class="links pull-right">
                	<a href="http://www.tomatocart.com" target="_blank"><?php 
echo lang('head_tomatocart_support_title');
?>
</a> &nbsp;|&nbsp;
 function addLabelsToAllLanguages($labels)
 {
     $langs = get_languages();
     foreach ($langs as $lang_key => $lang_display) {
         $this->addLabels($lang_key, $labels, $this->moduleName);
     }
 }