コード例 #1
0
 function main()
 {
     lang_load('admin.widgets');
     # $this->smarty->assign('warnings', admin_widgets_checkall());
     global $fp_widgets;
     $registered_w = get_registered_widgets();
     $registered_ws = get_registered_widgetsets(null);
     $this->smarty->assign('fp_registered_widgets', $registered_w);
     $wlist = $fp_widgets->getList();
     $widget_list = array();
     foreach ($registered_ws as $wpos) {
         $widget_list[$wpos] = array();
         $this->get_widget_lists($wlist, $wpos, $widget_list, $registered_w, true);
         unset($wlist[$wpos]);
     }
     $oldwidget_list = array();
     foreach ($wlist as $wpos => $c) {
         $this->get_widget_lists($wlist, $wpos, $oldwidget_list, $registered_w, false);
     }
     $this->smarty->assign('widgetlist', $widget_list);
     $this->smarty->assign('oldwidgetlist', $oldwidget_list);
     $conf = io_load_file(CONFIG_DIR . 'widgets.conf.php');
     $this->smarty->assign('pluginconf', $conf);
     return 0;
 }
コード例 #2
0
ファイル: plugin.qspam.php プロジェクト: mroussel/flatpress
/**
 * This plugin denies comments when they're containing "bad words",
 * e.g. "href" (which indexes links)., etc.
 *
 * @global $smarty
 * @param boolean $bool
 * @param string $contents The comment
 * @return unknown
 */
function plugin_qspam_validate($bool, $contents)
{
    if (!$bool) {
        return false;
    }
    $qscfg = plugin_getoptions('qspam');
    // We're looking for these words:
    $BAN_WORDS = '';
    if (isset($qscfg['wordlist'])) {
        $BAN_WORDS = $qscfg['wordlist'];
    } else {
        // rudimentary ban of links
        $BAN_WORDS = array('href', '[url');
    }
    $qscfg['number'] = isset($qscfg['number']) ? $qscfg['number'] : 1;
    $txt = strtolower(trim($contents['content']));
    $count = 0;
    while ($w = array_pop($BAN_WORDS)) {
        $count += substr_count($txt, strtolower($w));
    }
    if ($count >= $qscfg['number']) {
        global $smarty;
        $lang = lang_load('plugin:qspam');
        $smarty->assign('error', array($lang['plugin']['qspam']['error']));
        return false;
    }
    return true;
}
コード例 #3
0
ファイル: lang_api.php プロジェクト: window98lsq/autoweb
function lang_ensure_loaded($p_lang)
{
    global $g_lang_strings;
    if (!isset($g_lang_strings[$p_lang])) {
        lang_load($p_lang);
    }
}
コード例 #4
0
 function main()
 {
     lang_load('admin.widgets');
     $this->smarty->assign('warnings', admin_widgets_checkall());
     $conf = io_load_file(CONFIG_DIR . 'widgets.conf.php');
     $this->smarty->assign('pluginconf', $conf);
     return 0;
 }
コード例 #5
0
ファイル: contact.php プロジェクト: mroussel/flatpress
function contact_main()
{
    global $smarty;
    $lang = lang_load('contact');
    $smarty->assign('subject', $lang['contact']['head']);
    $smarty->assign('content', 'shared:contact.tpl');
    contact_form();
}
コード例 #6
0
ファイル: global.class.php プロジェクト: bwssytems/domuslink
 function &getLanguageFile($reload = false)
 {
     if (!isset($this->lang) || $reload) {
         $_SESSION['load_count'] += 1;
         $langinstance = lang_load($this->config['lang']);
         $this->lang =& $langinstance;
     }
     return $this->lang;
 }
コード例 #7
0
function plugin_categories_widget()
{
    global $smarty;
    // set this to true if you want show the number
    // of categories for each category; please notice:
    // not cheap on the server, it should be cached
    // somewhere else
    // default: disabled
    $smarty->assign('categories_showcount', false);
    // load plugin strings
    // they're located under plugin.PLUGINNAME/lang/LANGID/
    $lang = lang_load('plugin:categories');
    $entry['subject'] = $lang['plugin']['categories']['subject'];
    $entry['content'] = $smarty->fetch('plugin:categories/widget');
    return $entry;
}
コード例 #8
0
function plugin_lastcomments_widget()
{
    if (false === ($f = io_load_file(LASTCOMMENTS_CACHE_FILE))) {
        // no comments in cache
        $list = array();
    } else {
        // if file exists and its correctly read, we get the stored list
        // (it is stored in encoded form)
        $list = unserialize($f);
    }
    $content = '<ul class="last-comments">';
    // cimangi Aggiunta traduzione stringhe
    // load plugin strings
    // they're located under plugin.PLUGINNAME/lang/LANGID/
    $lang = lang_load('plugin:lastcomments');
    if ($count = count($list)) {
        while ($arr = array_pop($list)) {
            theme_comments_filters($arr, $id);
            $q = new FPDB_Query(array('id' => $arr['entry']), null);
            // first element of the array is dropped, as it is the ID, which
            // we already know
            @(list(, $entry) = $q->getEntry($query));
            if (!$entry) {
                $count--;
                $update = true;
                continue;
            }
            $content .= "<li>\n\t\t\t<blockquote class=\"comment-quote\" cite=\"comments.php?entry={$arr['entry']}#{$arr['id']}\">\n\t\t\t{$arr['content']}\n\t\t\t<p><a href=\"" . get_comments_link($arr['entry']) . "#{$arr['id']}\">{$arr['name']} - {$entry['subject']}</a></p>\n\t\t\t</blockquote></li>\n";
        }
        $subject = $lang['plugin']['lastcomments']['last'] . ' ' . $count . ' ' . $lang['plugin']['lastcomments']['comments'];
    }
    if (!$count) {
        if ($update) {
            fs_delete(LASTCOMMENTS_CACHE_FILE);
        }
        $content .= '<li>' . $lang['plugin']['lastcomments']['no_comments'] . '</li>';
        $subject = $lang['plugin']['lastcomments']['no_new_comments'];
    }
    $content .= '</ul>';
    $entry['subject'] = $subject;
    $entry['content'] = $content;
    return $entry;
}
コード例 #9
0
function plugin_lastentries_widget()
{
    global $fpdb;
    // load plugin strings
    // they're located under plugin.PLUGINNAME/lang/LANGID/
    $lang = lang_load('plugin:lastentries');
    $num = 10;
    ####################
    /*
    $queryId = $fpdb->query("fullparse:false,start:0,count:$num");
    $fpdb->doquery($queryId);
    
    $fpdb->getQuery
    */
    $q = new FPDB_Query(array('fullparse' => false, 'start' => 0, 'count' => $num), null);
    $string = '<ul>';
    $count = 0;
    while ($q->hasmore()) {
        list($id, $entry) = $q->getEntry();
        $link = get_permalink($id);
        $string .= '<li>';
        $admin = BLOG_BASEURL . "admin.php?p=entry&amp;entry=";
        if (user_loggedin()) {
            // if loggedin prints a "edit" link
            $string .= "<a href=\"{$admin}{$id}\">[" . $lang['plugin']['lastentries']['edit'] . "]</a>";
        }
        $string .= "<a href=\"{$link}\">{$entry['subject']}</a></li>\n";
        $count++;
    }
    if ($string == '<ul>') {
        $string .= '<li><a href="admin.php?p=entry&amp;action=write">' . $lang['plugin']['lastentries']['add_entry'] . '</a></li>';
        $subject = $lang['plugin']['lastentries']['no_entries'];
    } else {
        $subject = $lang['plugin']['lastentries']['subject_before_count'] . $count . $lang['plugin']['lastentries']['subject_after_count'];
    }
    $string .= '</ul>';
    $widget = array();
    $widget['subject'] = $subject;
    $widget['content'] = $string;
    return $widget;
}
コード例 #10
0
ファイル: core.layout.php プロジェクト: mroussel/flatpress
 function LayoutDefault($content = array())
 {
     $this->pagecontent = $content;
     $this->fpdb =& new FPDB();
     $GLOBALS['fpdb'] =& $this->fpdb;
     $this->fp_widgets =& new widget_indexer();
     $GLOBALS['fp_widgets'] =& $this->fp_widgets;
     $this->smarty =& $GLOBALS['_FP_SMARTY'];
     $GLOBALS['fp_config'] =& $this->config;
     $this->config = $GLOBALS['fp_config']['general'];
     $this->theme = theme_loadsettings();
     $GLOBALS['theme'] =& $this->theme;
     $this->lang = lang_load();
     $GLOBALS['lang'] =& $this->lang;
     //	user_loggedin() or sess_setup();
     plugin_loadall();
     // init smarty
     $this->smarty->compile_dir = CACHE_DIR;
     $this->smarty->cache_dir = SMARTY_DIR . 'cache/';
     $this->smarty->caching = 0;
     do_action('init');
 }
コード例 #11
0
function plugin_adminarea_widget()
{
    // load plugin strings
    // they're located under plugin.PLUGINNAME/lang/LANGID/
    $lang = lang_load('plugin:adminarea');
    $baseurl = BLOG_BASEURL;
    if ($user = user_loggedin()) {
        $userid = $user['userid'];
        $string = <<<END
\t\t<p>{$lang['plugin']['adminarea']['welcome']} <strong>{$userid}</strong> !</p>
\t\t<ul>
\t\t<li><a href="{$baseurl}admin.php">{$lang['plugin']['adminarea']['admin_panel']}</a></li>
\t\t<li><a href="{$baseurl}admin.php?p=entry&amp;action=write">{$lang['plugin']['adminarea']['add_entry']}</a></li>
\t\t<li><a href="{$baseurl}login.php?do=logout">{$lang['plugin']['adminarea']['logout']}</a></li>
\t\t</ul>
END;
    } else {
        $string = '<ul><li><a href="' . $baseurl . 'login.php">Login</a></li></ul>';
    }
    $entry['subject'] = $lang['plugin']['adminarea']['subject'];
    $entry['content'] = $string;
    return $entry;
}
コード例 #12
0
ファイル: core.plugins.php プロジェクト: mroussel/flatpress
function plugin_load($plugin, $checkonly = true, $langload = true)
{
    global $lang;
    $errno = 0;
    $errors = false;
    if (file_exists($f = PLUGINS_DIR . "{$plugin}/plugin.{$plugin}.php")) {
        $errno = 1;
        // 1 means exists
    } elseif (file_exists($f = PLUGINS_DIR . "{$plugin}/{$plugin}.php")) {
        $errno = 2;
        // 2 means exists but filename is oldstyle
    }
    if ($errno > 0) {
        ob_start();
        include_once $f;
        ob_end_clean();
    }
    if ($langload) {
        @lang_load("plugin:{$plugin}");
    }
    if ($checkonly) {
        $func = "plugin_{$plugin}_setup";
        if (is_callable($func)) {
            $errno = $func();
        }
        if ($errno <= 0) {
            if (isset($lang['plugin'][$plugin]['errors'][$errno])) {
                $errors = "[<strong>{$plugin}</strong>] {$lang['plugin'][$plugin]['errors'][$errno]}";
            } elseif ($errno < 0) {
                $errors = "[<strong>{$plugin}</strong>] " . sprintf($lang['admin']['plugin']['errors']['generic'], $errno);
            } else {
                $errors = "[<strong>{$plugin}</strong>] " . $lang['admin']['plugin']['errors']['notfound'];
            }
        }
    }
    return $errors;
}
コード例 #13
0
<?php

//include('constant_inc.php');
function lang_load($p_lang)
{
    global $g_lang_strings, $g_lang_current;
    //     if ( $g_lang_current == $p_lang ) {
    // 	return;
    //     }
    // define current language here so that when custom_strings_inc is
    // included it knows the current language
    $g_lang_current = $p_lang;
    //$t_lang_dir = dirname ( dirname ( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR;
    $t_lang_dir = './';
    require_once $t_lang_dir . 'strings_' . $p_lang . '.inc';
    $t_vars = get_defined_vars();
    //    print(sizeof($t_vars) . "\n");
    //    print_r(array_keys($t_vars));
    foreach (array_keys($t_vars) as $t_var) {
        $t_lang_var = ereg_replace('^s_', '', $t_var);
        if ($t_lang_var != $t_var || 'MANTIS_ERROR' == $t_var) {
            $g_lang_strings[$t_lang_var] = ${$t_var};
        }
    }
}
lang_load('english');
print_r($g_lang_strings);
//print_r(array_keys(get_defined_vars()));
コード例 #14
0
ファイル: main.php プロジェクト: mroussel/flatpress
function admin_panelstrings($panelprefix)
{
    global $lang, $smarty;
    lang_load('admin');
    lang_load($panelprefix);
    $smarty->assign('subject', $lang['admin']['head']);
    $smarty->assign('menubar', admin_getpanels());
    add_filter('wp_title', 'admin_panel_title', 10, 2);
}
コード例 #15
0
ファイル: admin.plugin.php プロジェクト: mroussel/flatpress
 function main()
 {
     //$conf = io_load_file(CONFIG_DIR . 'plugins.conf.php');
     $this->smarty->assign('warnings', $this->errors);
     $this->smarty->assign('enabledlist', $this->fp_plugins);
     lang_load('admin.plugin');
     return 0;
 }
コード例 #16
0
ファイル: lang.php プロジェクト: plepe/OpenStreetBrowser
function lang_init() {
  global $lang_str;
  global $ui_lang;
  global $ui_langs;
  global $data_lang;
  global $language_list;
  global $design_hidden;
  global $lang_genders;
  global $version_string;

  lang_load($ui_lang);

  // Define a language string for every language
  foreach($language_list as $abbr=>$lang) {
    $lang_str["lang_native:".$abbr]=$lang;
  }

  html_export_var(array("ui_lang"=>$ui_lang, "data_lang"=>$data_lang, "ui_langs"=>$ui_langs, "lang_str"=>$lang_str, "language_list"=>$language_list, "lang_genders"=>$lang_genders));
  add_html_header("<meta http-equiv=\"content-language\" content=\"{$ui_lang}\">");
}
コード例 #17
0
ファイル: lang_api.php プロジェクト: nextgens/mantisbt
/**
 * Retrieves an internationalized string
 * This function will return one of (in order of preference):
 *  1. The string in the current user's preferred language (if defined)
 *  2. The string in English
 * @param string $p_string
 * @param string $p_lang
 * @param bool $p_error default: true - error if string not found
 * @return string
 */
function lang_get($p_string, $p_lang = null, $p_error = true)
{
    global $g_lang_strings;
    # If no specific language is requested, we'll
    #  try to determine the language from the users
    #  preferences
    $t_lang = $p_lang;
    if (null === $t_lang) {
        $t_lang = lang_get_current();
    }
    // Now we'll make sure that the requested language is loaded
    lang_ensure_loaded($t_lang);
    // Step 1 - see if language string exists in requested language
    if (lang_exists($p_string, $t_lang)) {
        return $g_lang_strings[$t_lang][$p_string];
    } else {
        // Language string doesn't exist in requested language
        // Step 2 - See if language string exists in current plugin
        $t_plugin_current = plugin_get_current();
        if (!is_null($t_plugin_current)) {
            // Step 3 - Plugin exists: load language file
            lang_load($t_lang, config_get('plugin_path') . $t_plugin_current . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR);
            if (lang_exists($p_string, $t_lang)) {
                return $g_lang_strings[$t_lang][$p_string];
            }
            // Step 4 - Localised language entry didn't exist - fallback to english for plugin
            lang_load('english', config_get('plugin_path') . $t_plugin_current . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR);
            if (lang_exists($p_string, $t_lang)) {
                return $g_lang_strings[$t_lang][$p_string];
            }
        }
        // Step 5 - string didn't exist, try fall back to english:
        if ($t_lang == 'english') {
            if ($p_error) {
                error_parameters($p_string);
                trigger_error(ERROR_LANG_STRING_NOT_FOUND, WARNING);
            }
            return '';
        } else {
            // if string is not found in a language other than english, then retry using the english language.
            return lang_get($p_string, 'english');
        }
    }
}
コード例 #18
0
function plugin_aaspam_comment_form()
{
    // we get a random arithmetic operation
    // between sum, subtraction and multiplication;
    // we intentionally left out division because
    // it can lead to situations like division by zero
    // or floating point numbers
    $myop = array_rand($ops = array('+', '-', '*'));
    $op = $ops[$myop];
    // we get two random integers between 1 and 10
    $v1 = mt_rand(1, 10);
    // we rand $v2 until it differs from $v1
    // (otherwise result for subtractions is zero)
    while (($v2 = mt_rand(1, 10)) == $v1) {
    }
    // if operation is subtraction
    // the higher number must always come first
    // or you'll get a negative integer
    if ($v2 > $v1 && $op == '-') {
        $tmp = $v1;
        $v1 = $v2;
        $v2 = $tmp;
    }
    // execute the operation
    switch ($op) {
        case '+':
            $v = $v1 + $v2;
            break;
        case '-':
            $v = $v1 - $v2;
            break;
        case '*':
            $v = $v1 * $v2;
            break;
    }
    sess_add('aaspam', $v);
    // load plugin strings
    // they're located under plugin.PLUGINNAME/lang/LANGID/
    $lang = lang_load('plugin:accessibleantispam');
    $langstrings =& $lang['plugin']['accessibleantispam'];
    // get the correct question depending on the operation
    switch ($op) {
        case '+':
            $question = $langstrings['sum'];
            break;
        case '-':
            $question = $langstrings['sub'];
            break;
        case '*':
            $question = $langstrings['prod'];
            break;
    }
    // format the question with numbers at the proper positions
    $question = sprintf($question, $v1, $v2);
    if (AASPAM_DEBUG && ($f = @fopen(AASPAM_LOG, 'a'))) {
        $arr['aaspam-q'] = $v;
        @fwrite($f, date('r') . '|' . session_id() . '|' . utils_kimplode($arr) . "\r\n");
        @fclose($f);
    }
    // echoes the question and the form part
    echo <<<STR
\t<p><label class="textlabel" for="aaspam">{$lang['plugin']['accessibleantispam']['prefix']} <strong>{$question} (*)</strong></label><br />
\t\t<input type="text" name="aaspam" id="aaspam" /></p>
STR;
}
コード例 #19
0
function lang_load_default()
{
    // $t_active_language = "english";
    $t_active_language = "french";
    lang_load($t_active_language);
}
コード例 #20
0
ファイル: core.system.php プロジェクト: mroussel/flatpress
function system_init()
{
    system_sanitizequery();
    system_unregister_globals();
    system_prepare_iis();
    $GLOBALS['fpdb'] = new FPDB();
    $GLOBALS['fp_widgets'] = new widget_indexer();
    $GLOBALS['smarty'] =& $GLOBALS['_FP_SMARTY'];
    $smarty =& $GLOBALS['smarty'];
    $GLOBALS['fp_config'] = config_load();
    cookie_setup();
    sess_setup();
    user_loggedin();
    ob_start();
    $GLOBALS['theme'] = theme_loadsettings();
    $GLOBALS['lang'] = lang_load();
    plugin_loadall();
    // init smarty
    $smarty->compile_dir = CACHE_DIR;
    $smarty->cache_dir = SMARTY_DIR . 'cache/';
    $smarty->caching = 0;
    do_action('init');
    ob_end_clean();
}
コード例 #21
0
function plugin_calendar_widget()
{
    global $fp_params;
    $y = isset($fp_params['y']) ? $fp_params['y'] : date('y');
    $m = isset($fp_params['m']) ? $fp_params['m'] : date('m');
    global $fpdb;
    $q =& new FPDB_Query(array('fullparse' => false, 'y' => $y, 'm' => $m, 'count' => -1), null);
    $days = array();
    while ($q->hasmore($queryId)) {
        list($id, $entry) = $q->getEntry($queryId);
        $date = date_from_id($id);
        $d = (int) $date['d'];
        $days[$d] = array(get_day_link($y, $m, str_pad($d, 2, '0', STR_PAD_LEFT)), 'linked-day');
        $count++;
    }
    // load plugin strings
    // they're located under plugin.PLUGINNAME/lang/LANGID/
    $lang = lang_load('plugin:calendar');
    $widget = array();
    $widget['subject'] = $lang['plugin']['calendar']['subject'];
    $widget['content'] = '<ul id="widget_calendar"><li>' . generate_calendar($y, $m, $days) . '</li></ul>';
    return $widget;
}
コード例 #22
0
ファイル: lang_api.php プロジェクト: Tarendai/spring-website
/**
 * Retrieves an internationalized string
 * This function will return one of (in order of preference):
 *  1. The string in the current user's preferred language (if defined)
 *  2. The string in English
 * @param string $p_string
 * @param string $p_lang
 * @return string
 */
function lang_get($p_string, $p_lang = null)
{
    global $g_lang_strings;
    # If no specific language is requested, we'll
    #  try to determine the language from the users
    #  preferences
    $t_lang = $p_lang;
    if (null === $t_lang) {
        $t_lang = lang_get_current();
    }
    // Now we'll make sure that the requested language is loaded
    lang_ensure_loaded($t_lang);
    if (lang_exists($p_string, $t_lang)) {
        return $g_lang_strings[$t_lang][$p_string];
    } else {
        $t_plugin_current = plugin_get_current();
        if (!is_null($t_plugin_current)) {
            lang_load($t_lang, config_get('plugin_path') . $t_plugin_current . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR);
            if (lang_exists($p_string, $t_lang)) {
                return $g_lang_strings[$t_lang][$p_string];
            }
        }
        if ($t_lang == 'english') {
            error_parameters($p_string);
            trigger_error(ERROR_LANG_STRING_NOT_FOUND, WARNING);
            return '';
        } else {
            # if string is not found in a language other than english, then retry using the english language.
            return lang_get($p_string, 'english');
        }
    }
}
コード例 #23
0
function plugin_archives_widget()
{
    lang_load('plugin:archives');
    global $lang, $PLUGIN_ARCHIVES_MONTHLIST;
    return array('subject' => $lang['plugin']['archives']['subject'], 'content' => ($list = $PLUGIN_ARCHIVES_MONTHLIST->getHtmlList()) ? '<ul>' . $list . '</ul>' : "<p>{$lang['plugin']['archives']['no_posts']}</p>");
}
コード例 #24
0
ファイル: comments.php プロジェクト: mroussel/flatpress
function commentform()
{
    global $smarty, $lang, $fpdb, $fp_params;
    $comment_formid = 'fp-comments';
    $smarty->assign('comment_formid', $comment_formid);
    if (!empty($_POST)) {
        # utils_nocache_headers();
        // add http to url
        if (!empty($_POST['url']) && strpos($_POST['url'], 'http://') === false) {
            $_POST['url'] = 'http://' . $_POST['url'];
        }
        // custom hook here!!
        if ($arr = comment_validate()) {
            global $fp_config;
            $id = comment_save($fp_params['entry'], $arr);
            do_action('comment_post', $fp_params['entry'], array($id, $arr));
            $q = new FPDB_Query(array('id' => $fp_params['entry'], 'fullparse' => false), null);
            list($entryid, $e) = $q->getEntry();
            if ($fp_config['general']['notify'] && !user_loggedin()) {
                global $post;
                $comm_mail = isset($arr['email']) ? "<{$arr['email']}>" : '';
                $from_mail = $fp_config['general']['email'];
                $post = $e;
                // plugin such as prettyurls might need this...
                $lang = lang_load('comments');
                $mail = str_replace(array('%toname%', '%fromname%', '%frommail%', '%entrytitle%', '%commentlink%', '%content%', '%blogtitle%'), array($fp_config['general']['author'], $arr['name'], $comm_mail, $e['subject'], get_comments_link($entryid) . '#' . $id, $arr['content'], $fp_config['general']['title']), $lang['comments']['mail']);
                @utils_mail($from_mail, "New comment on {$fp_config['general']['title']}", $mail);
            }
            // if comment is valid, this redirect will clean the postdata
            $location = str_replace('&amp;', '&', get_comments_link($entryid)) . '#' . $id;
            utils_redirect($location, true);
            exit;
        } else {
            $smarty->assign('values', $_POST);
        }
    }
    // Cookies
    $smarty->assign('cookie', array('name' => @$_COOKIE['comment_author_' . COOKIEHASH], 'email' => @$_COOKIE['comment_author_email_' . COOKIEHASH], 'url' => @$_COOKIE['comment_author_url_' . COOKIEHASH]));
}
コード例 #25
0
 function onsubmit($data = null)
 {
     global $lang, $panel, $action;
     $result = 0;
     $dummyarr = array();
     $errors = array();
     $content = array();
     $lang_loaded = false;
     $l = null;
     foreach ($this->validators as $valid_arr) {
         # array('subject', 'subject', 'notEmpty', false, false, 'func1,func2');
         list($vid, $field, $validatorname, $empty, $halt, $funcs) = $valid_arr;
         $includepath = SMARTY_DIR . 'plugins/';
         $string = @$_POST[$field];
         // execute functions on string
         if ($string) {
             $func_arr = explode(',', $funcs);
             foreach ($func_arr as $f) {
                 $string = @$f($string);
             }
         }
         include_once $includepath . 'validate_criteria.' . $validatorname . '.php';
         # smarty_validate_criteria_notEmpty
         $valid_f = 'smarty_validate_criteria_' . $validatorname;
         if (!$valid_f($string, $empty, $dummyarr, $dummyarr)) {
             if (!$lang_loaded) {
                 $lang = lang_load('admin.' . ADMIN_PANEL);
                 $l = $lang['admin'][ADMIN_PANEL][ADMIN_PANEL_ACTION];
             }
             $errors[$field] = isset($l['error'][$field]) ? $l['error'][$field] : htmlspecialchars($field);
             if ($halt) {
                 break;
             }
         } else {
             $content[$field] = $string;
         }
     }
     if (!$errors) {
         $result = parent::onsubmit($content);
     } else {
         $this->smarty->assign('error', $errors);
         $result = apply_filters("admin_{$panel}_{$action}_onerror", $this->onerror());
     }
     return $result;
 }
コード例 #26
0
ファイル: lang_api.php プロジェクト: kaos/mantisbt
/**
 * Retrieves an internationalized string
 * This function will return one of (in order of preference):
 *  1. The string in the current user's preferred language (if defined)
 *  2. The string in English
 * @param string $p_string
 * @param string $p_lang
 * @return string
 */
function lang_get($p_string, $p_lang = null)
{
    global $g_lang_strings;
    # If no specific language is requested, we'll
    #  try to determine the language from the users
    #  preferences
    $t_lang = $p_lang;
    if (null === $t_lang) {
        $t_lang = lang_get_current();
    }
    // Now we'll make sure that the requested language is loaded
    lang_ensure_loaded($t_lang);
    # note in the current implementation we always return the same value
    #  because we don't have a concept of falling back on a language.  The
    #  language files actually *contain* English strings if none has been
    #  defined in the correct language
    # @todo thraxisp - not sure if this is still true. Strings from last language loaded
    #      may still be in memeory if a new language is loaded.
    if (lang_exists($p_string, $t_lang)) {
        return $g_lang_strings[$t_lang][$p_string];
    } else {
        $t_plugin_current = plugin_get_current();
        if (!is_null($t_plugin_current)) {
            lang_load($t_lang, config_get('plugin_path') . $t_plugin_current . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR);
            if (lang_exists($p_string, $t_lang)) {
                return $g_lang_strings[$t_lang][$p_string];
            }
        }
        if ($t_lang == 'english') {
            error_parameters($p_string);
            trigger_error(ERROR_LANG_STRING_NOT_FOUND, WARNING);
            return '';
        } else {
            # if string is not found in a language other than english, then retry using the english language.
            return lang_get($p_string, 'english');
        }
    }
}
コード例 #27
0
$_COOKIE[$g_cookie_prefix . '_STRING_COOKIE'] = $_POST['cookie_string'];
// Zugriff auf die Mantis Funktionen
//require_once ($mantisPath . 'core.php');
// Lade die Konfigurationsdatei und stelle die Datenbankverbindung her
// Zugriff auf die agileMantis Funktionen
if ($_POST['timezone']) {
    date_default_timezone_set($_POST['timezone']);
}
ob_end_clean();
if ($_POST['user']) {
    $sitekey = $agilemantis_tasks->getConfigValue('plugin_agileMantis_gadiv_sitekey');
    $heute = mktime(0, 0, 0, date('m'), date('d'), date('y'));
    $generatedKey = md5($sitekey . $heute);
    $user_id = $_POST['user'];
    $language = user_pref_get_language($user_id);
    lang_load($language, $mantisBtPath . 'plugins' . DIRECTORY_SEPARATOR . 'agileMantis' . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR);
    lang_push($language);
    // Load language stuff
    if ($language == 'german') {
        require_once $mantisBtPath . 'lang' . DIRECTORY_SEPARATOR . 'strings_german.txt';
        require_once $mantisBtPath . 'plugins' . DIRECTORY_SEPARATOR . 'agileMantis' . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR . 'strings_german.txt';
    } else {
        require_once $mantisBtPath . 'lang' . DIRECTORY_SEPARATOR . 'strings_english.txt';
        require_once $mantisBtPath . 'plugins' . DIRECTORY_SEPARATOR . 'agileMantis' . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR . 'strings_english.txt';
    }
    if ($_POST['event'] == 'checkIdentity') {
        if ($generatedKey == $_POST['appletkey']) {
            echo true;
        } else {
            echo false;
        }