Ejemplo n.º 1
0
 protected function setUp()
 {
     $this->tikiroot = dirname(__FILE__) . '/../../../';
     $this->lang = 'test_language';
     $this->langDir = $this->tikiroot . 'lang/' . $this->lang;
     chdir($this->tikiroot);
     mkdir($this->langDir);
     $this->obj = new LanguageTranslations($this->lang);
     TikiDb::get()->query('INSERT INTO `tiki_language` (`source`, `lang`, `tran`, `changed`) VALUES (?, ?, ?, ?)', array('Contributions by author', $this->lang, 'Contribuições por autor', 1));
     TikiDb::get()->query('INSERT INTO `tiki_language` (`source`, `lang`, `tran`, `changed`) VALUES (?, ?, ?, ?)', array('Remove', $this->lang, 'Novo remover', 1));
     TikiDb::get()->query('INSERT INTO `tiki_language` (`source`, `lang`, `tran`, `changed`) VALUES (?, ?, ?, ?)', array('Approved Status', $this->lang, 'Aprovado', 1));
     TikiDb::get()->query('INSERT INTO `tiki_language` (`source`, `lang`, `tran`, `changed`) VALUES (?, ?, ?, ?)', array('Something', $this->lang, 'Algo', 1));
     TikiDb::get()->query('INSERT INTO `tiki_language` (`source`, `lang`, `tran`, `changed`) VALUES (?, ?, ?, ?)', array('Trying to insert malicious PHP code back to the language.php file', $this->lang, 'asff"); echo \'teste\'; $dois = array(\'\',"', 1));
     TikiDb::get()->query('INSERT INTO `tiki_language` (`source`, `lang`, `tran`, `changed`) VALUES (?, ?, ?, ?)', array('Should escape "double quotes" in the source string', $this->lang, 'Deve escapar "aspas duplas" na string original', 1));
     TikiDb::get()->query('INSERT INTO `tiki_language` (`source`, `lang`, `tran`) VALUES (?, ?, ?)', array('Not changed', $this->lang, 'Translation not changed'));
     TikiDb::get()->query('INSERT INTO `tiki_untranslated` (`source`, `lang`) VALUES (?, ?)', array('Untranslated string 1', $this->lang));
     TikiDb::get()->query('INSERT INTO `tiki_untranslated` (`source`, `lang`) VALUES (?, ?)', array('Untranslated string 2', $this->lang));
     TikiDb::get()->query('INSERT INTO `tiki_untranslated` (`source`, `lang`) VALUES (?, ?)', array('Untranslated string 3', $this->lang));
     global ${"lang_{$this->lang}"};
     copy(dirname(__FILE__) . '/fixtures/language_orig.php', $this->langDir . '/language.php');
     if (!isset(${"lang_{$this->lang}"})) {
         require_once 'lib/init/tra.php';
         init_language($this->lang);
     }
 }
Ejemplo n.º 2
0
function lpanel_main()
{
    global $gbl, $login, $ghtml;
    initProgram();
    init_language();
    print_meta_lan();
    $gbl->__navigmenu = null;
    $gbl->__navig = null;
    $skincolor = $login->getSkinColor();
    // This should be called only in display.php, and not anywhere else. It doesn't matter anyway, since both lpanel.php, AND header.php never allows any modification to be carried out. Also, the display.php automatically deletes the login info, so if you click on any link on the header or the lpanel, you will automatically logged out.
    //check_if_disabled_and_exit();
    $imgbordermain = "{$login->getSkinDir()}/top_line_medium.gif";
    if ($gbl->isOn('show_help')) {
        $background = "{$login->getSkinDir()}/top_line_dark.gif";
        $border = null;
    } else {
        $background = null;
    }
    $ghtml->print_include_jscript('left_panel');
    print "<body topmargin=0 leftmargin=0 style='background-color:#fafafa'>";
    //$ghtml->lpanel_beginning();
    try {
        //$ghtml->xp_panel($login);
        //print_ext_tree($login);
        $ghtml->tab_vheight();
    } catch (exception $e) {
        print "The Resource List could not gathered....{$e->getMessage()}<br> \n";
    }
}
Ejemplo n.º 3
0
 /**
  * Update a translation
  * If $originalStr is not found, a new entry is added. Otherwise,
  * if $translatedStr is empty the entry is deleted, if $translatedStr
  * is not empty but is equal to the actual translation nothing is done or if
  * $translatedStr is not empty and different from the actual translation
  * the entry is updated with the new translation.
  *
  * @param string $originalStr the original string
  * @param string $translatedStr the translated string
  * @return null
  */
 public function updateTrans($originalStr, $translatedStr)
 {
     global ${"lang_{$this->lang}"}, $user, $tikilib;
     // only the user name is globally available? not the user_id?
     $userId = $tikilib->get_user_id($user);
     // initialize language (used when this function is called by tiki-interactive_translation.php)
     if (!isset(${"lang_{$this->lang}"})) {
         init_language($this->lang);
     }
     // don't change anything if $originalStr and $translatedStr are equal
     if ($originalStr == $translatedStr) {
         return;
     }
     // don't change anything in the database if the translation hasn't been changed
     if (isset(${"lang_{$this->lang}"}[$originalStr]) && ${"lang_{$this->lang}"}[$originalStr] == $translatedStr) {
         return;
     }
     $query = 'select * from `tiki_language` where `lang`=? and binary `source` = ?';
     $result = $this->query($query, array($this->lang, $originalStr));
     if (!$result->numRows()) {
         $query = 'insert into `tiki_language` (`source`, `lang`, `tran`, `changed`, `userId`, `lastModif`) values (?,?,?,?,?,?)';
         $result = $this->query($query, array($originalStr, $this->lang, $translatedStr, 1, $userId, $tikilib->now));
     } else {
         if (strlen($translatedStr) == 0) {
             $query = 'delete from `tiki_language` where binary `source`=? and `lang`=?';
             $result = $this->query($query, array($originalStr, $this->lang));
         } else {
             $query = 'update `tiki_language` set `tran`=?, `changed`=?, `userId`=?, `lastModif`=? where binary `source`=? and `lang`=?';
             $result = $this->query($query, array($translatedStr, 1, $userId, $tikilib->now, $originalStr, $this->lang));
         }
     }
     // remove from untranslated table if present
     $query = 'delete from `tiki_untranslated` where binary `source`=? and `lang`=?';
     $this->query($query, array($originalStr, $this->lang));
 }
Ejemplo n.º 4
0
function header_main()
{
    global $gbl, $sgbl, $login, $ghtml;
    initProgram();
    init_language();
    print_meta_lan();
    if ($login->isDefaultSkin()) {
        print_header_old_default();
    } else {
        print_header();
    }
}
Ejemplo n.º 5
0
function header_main()
{
    global $gbl, $sgbl, $login, $ghtml;
    initProgram();
    init_language();
    print_open_head_tag();
    print_meta_tags();
    print_meta_css();
    if ($login->isDefaultSkin()) {
        print "<!-- Default Theme -->\n";
        print_header_default();
    } else {
        print_close_head_tag();
        print "<!-- Feather Theme -->\n";
        print_header_feather();
    }
    print "</body>\n</html>\n";
}
Ejemplo n.º 6
0
/**
 * translate an English string
 * @param        $content English string
 * @param string $lg      language - if not specify = global current language
 * @param bool   $unused
 * @param array  $args
 *
 * @return mixed|string
 */
function tra($content, $lg = '', $unused = false, $args = array())
{
    global $prefs;
    static $languages = array();
    if ($lg == '') {
        if ($prefs['language']) {
            $lang = $prefs['language'];
        } else {
            $lang = $prefs['site_language'];
        }
    } else {
        $lang = $lg;
    }
    if (!isset($languages[$lang])) {
        $languages[$lang] = true;
        init_language($lang);
    }
    $out = tra_impl($content, $lang, $args);
    record_string($content, $out);
    return $out;
}
Ejemplo n.º 7
0
function lpanel_main()
{
    global $gbl, $login, $ghtml;
    initProgram();
    init_language();
    print_open_head_tag();
    print_meta_tags();
    print_meta_css();
    print_meta_css_lpanel();
    $gbl->__navigmenu = null;
    $gbl->__navig = null;
    $catched = false;
    $ghtml->print_include_jscript('left_panel');
    $ghtml->print_jscript_source("/htmllib/js/lpanel-tabs.js");
    try {
        $ghtml->tab_vheight();
    } catch (exception $e) {
        print_close_head_tag();
        print "<body>\n";
        print "The Resource List could not gathered....{$e->getMessage()}<br> \n";
        $catched = true;
    }
    if (!$catched) {
        print_close_head_tag();
        print "<body>\n";
    }
    // The div id's tabs1 script markup tree-div tab-content are generated from lpanel-tabs.js
    print "<div class=\"lpanelmain\" id=\"tabs1\">\n";
    print "<div id=\"script\" class=\"lpanelnormal tab-content\">\n";
    print "<br>\n";
    $ghtml->xp_panel($login);
    print "</div>\n";
    print "<div id=\"markup\" class=\"tab-content\">\n";
    print "<div id=\"tree-div\" class=\"lpaneltree\">\n";
    print "</div>\n";
    print "</div>\n";
    print "</div>\n";
    print "</body>\n";
    print "</html>\n";
}
Ejemplo n.º 8
0
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.<br />
 * <br />
 * Flunker is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.<br />
 * <br />
 * You should have received a copy of the GNU Affero General Public License
 * along with Flunker.  If not, see <http://www.gnu.org/licenses/>.<br /><br />
 */
session_start();
require_once dirname(__FILE__) . '/core/functions_language.php';
require_once dirname(__FILE__) . '/core/functions_render.php';
init_language($_GET['language'], $_SESSION['lang']);
init_css($_GET['skin'], $_SESSION['skin']);
if (file_exists(dirname(__FILE__) . '/conf.php')) {
    require dirname(__FILE__) . '/conf.php';
} else {
    $GLOBALS['__error'] = __('Unable to find conf.php. Ensure you have created it (look at ') . dirname(__FILE__) . '/conf.php.in' . __(" for example).");
}
require_once dirname(__FILE__) . '/ryzom_api/ryzom_api/ryzom_api.php';
require_once dirname(__FILE__) . '/core/constants.php';
require_once dirname(__FILE__) . '/core/class_chest.php';
require_once dirname(__FILE__) . '/core/class_item.php';
require_once dirname(__FILE__) . '/core/class_filter.php';
require_once dirname(__FILE__) . '/core/class_sorter.php';
require_once dirname(__FILE__) . '/core/functions_guild_icon.php';
require_once dirname(__FILE__) . '/core/functions_common.php';
require_once dirname(__FILE__) . '/core/functions_parse.php';
Ejemplo n.º 9
0
// ###################### Start headers #######################
exec_nocache_headers();

if ($vbulletin->userinfo['cssprefs'] != '')
{
	$vbulletin->options['cpstylefolder'] = $vbulletin->userinfo['cssprefs'];
}

// ###################### Get date / time info #######################
// override date/time settings if specified
fetch_options_overrides($vbulletin->userinfo);
fetch_time_data();

// ############################################ LANGUAGE STUFF ####################################
// initialize $vbphrase and set language constants
$vbphrase = init_language();
$_tmp = NULL;
fetch_stylevars($_tmp, $vbulletin->userinfo);

$permissions = cache_permissions($vbulletin->userinfo, true);
$vbulletin->userinfo['permissions'] =& $permissions;
$cpsession = array();

$vbulletin->input->clean_array_gpc('c', array(
	COOKIE_PREFIX . 'cpsession' => TYPE_STR,
));

if (!empty($vbulletin->GPC[COOKIE_PREFIX . 'cpsession']))
{
	$cpsession = $db->query_first("
		SELECT * FROM " . TABLE_PREFIX . "cpsession
Ejemplo n.º 10
0
<?php

ob_start();
initProgram();
init_language();
check_if_disabled_and_exit();
$gbl->__inside_ajax = true;
// We need to convert the tree format to frm_o_o.
if ($ghtml->frm_action === 'tree') {
    convert_tree_to_frm_o();
}
createPrincipleObject();
$cgi_action = "__ajax_desc_{$ghtml->frm_action}";
//sleep(6);
$ret = $cgi_action();
while (@ob_end_clean()) {
}
print json_encode($ret);
flush();
function convert_tree_to_frm_o()
{
    global $gbl, $sgbl, $login, $ghtml;
    $cid = $ghtml->node;
    if (!csa($cid, "&")) {
        return null;
    }
    $cid = trim($cid, "/&");
    $dlist = explode("&", $cid);
    $i = 0;
    $ghtml->__title_function = false;
    $ghtml->__resource_class = false;
Ejemplo n.º 11
0
 /**
  * Loads the language information for the logged-in user.
  */
 public function load_language()
 {
     global $vbulletin;
     fetch_options_overrides($vbulletin->userinfo);
     fetch_time_data();
     global $vbphrase;
     // Load language if we're not in the API or the API asks for it
     if (!VB_API or defined('VB_API_LOADLANG') and VB_API_LOADLANG === true) {
         $vbphrase = init_language();
         // If in API, disable "Directional Markup Fix" from language options. API doesn't need it.
         if (VB_API and !empty($vbulletin->userinfo['lang_options'])) {
             if (is_numeric($vbulletin->userinfo['lang_options'])) {
                 $vbulletin->userinfo['lang_options'] -= $vbulletin->bf_misc_languageoptions['dirmark'];
             } else {
                 if (is_array($vbulletin->userinfo['lang_options']) and isset($vbulletin->userinfo['lang_options']['dirmark'])) {
                     unset($vbulletin->userinfo['lang_options']['dirmark']);
                 }
             }
         }
     } else {
         $vbphrase = array();
     }
     // set a default username
     if ($vbulletin->userinfo['username'] == '') {
         $vbulletin->userinfo['username'] = $vbphrase['unregistered'];
     }
 }
Ejemplo n.º 12
0
function index_main()
{
    init_language();
    print_index();
}
Ejemplo n.º 13
0
	/**
	* Loads the language information for the logged-in user.
	*/
	public function load_language()
	{
		global $vbulletin;

		fetch_options_overrides($vbulletin->userinfo);
		fetch_time_data();

		global $vbphrase;
		$vbphrase = init_language();

		// set a default username
		if ($vbulletin->userinfo['username'] == '')
		{
			$vbulletin->userinfo['username'] = $vbphrase['unregistered'];
		}
	}
Ejemplo n.º 14
0
function display_init()
{
    global $gbl, $sgbl, $login, $ghtml;
    initProgram();
    init_language();
    if ($sgbl->is_this_slave()) {
        print "Slave Server\n";
        exit;
    }
    // The only thing that gets modified when the dbaction is not a modify action, is the ssession table. Other tables should get modified only inside non-form actions.
    if (isModifyAction() && isUpdating()) {
        $ghtml->print_redirect_back('system_is_updating_itself', '');
        exit;
    }
    try {
        do_display_init();
        main_system_lock();
        print_navigation($gbl->__navig);
        print_warning();
        password_contact_check();
    } catch (Exception $e) {
        log_log("redirect_error", "exception");
        $gbl->setSessionV('__tmp_redirect_var', $ghtml->__http_vars);
        $gbl->c_session->write();
        if (is_array($e->variable)) {
            $evlist = implode(",", $e->variable);
        } else {
            $evlist = $e->variable;
        }
        $ghtml->print_redirect_back($e->getMessage(), $evlist, $e->value);
        exit;
    }
    if ($ghtml->frm_filter) {
        $filtername = $gbl->__c_object->getFilterVariableForThis($ghtml->frm_o_cname);
        $list[$filtername] = $ghtml->frm_filter;
        $login->setupHpFilter($list);
        $login->setUpdateSubaction();
    }
    if ($ghtml->frm_hpfilter) {
        $login->setupHpFilter($ghtml->frm_hpfilter);
        $login->setUpdateSubaction();
    }
}
Ejemplo n.º 15
0
 /**
  * Loads the language information for the logged-in user.
  */
 public function load_language()
 {
     global $vbulletin;
     fetch_options_overrides($vbulletin->userinfo);
     fetch_time_data();
     global $vbphrase, $vbphrasegroup;
     if (!VB_API or defined('VB_API_LOADLANG') and VB_API_LOADLANG === true) {
         $vbphrase = init_language();
         // Disable "Directional Markup Fix" from language options. API doesn't need it.
         if (defined(VB_API) and VB_API === true) {
             $vbulletin->userinfo['lang_options'] -= $vbulletin->bf_misc_languageoptions['dirmark'];
         }
     } else {
         $vbphrase = array();
     }
     // set a default username
     if ($vbulletin->userinfo['username'] == '') {
         $vbulletin->userinfo['username'] = $vbphrase['unregistered'];
     }
 }
Ejemplo n.º 16
0
function display_init()
{
    global $gbl, $sgbl, $login, $ghtml;
    initProgram();
    init_language();
    if ($sgbl->is_this_slave()) {
        print _("This is a Slave Server. Operate it at the Master.") . "\n";
        exit;
    }
    if (isModifyAction() && isUpdating()) {
        $ghtml->print_redirect_back('system_is_updating_itself', '');
        exit;
    }
    try {
        do_display_init();
        print "<!-- Load Navigation -->\n";
        print_navigation($gbl->__navig);
        print "<!-- Load Warning -->\n";
        print_warning();
        print "<!-- Load Password Contact Check -->\n";
        password_contact_check();
    } catch (Exception $e) {
        log_log("redirect_error", "exception");
        $gbl->setSessionV('__tmp_redirect_var', $ghtml->__http_vars);
        $gbl->c_session->write();
        if (is_array($e->variable)) {
            $evlist = implode(",", $e->variable);
        } else {
            $evlist = $e->variable;
        }
        $ghtml->print_redirect_back($e->getMessage(), $evlist, $e->value);
        exit;
    }
    if ($ghtml->frm_filter) {
        $filtername = $gbl->__c_object->getFilterVariableForThis($ghtml->frm_o_cname);
        $list[$filtername] = $ghtml->frm_filter;
        $login->setupHpFilter($list);
        $login->setUpdateSubaction();
    }
    if ($ghtml->frm_hpfilter) {
        $login->setupHpFilter($ghtml->frm_hpfilter);
        $login->setUpdateSubaction();
    }
}