function get_prefs() { global $txp_user, $dbversion, $thisversion, $txp_using_svn; $out = array(); // get current user's private prefs if ($txp_user and (version_compare($dbversion, '4.0.9', '>=') or $txp_using_svn)) { $r = safe_rows_start('name, val', 'txp_prefs', 'prefs_id=1 AND user_name=\'' . doSlash($txp_user) . '\''); if ($r) { while ($a = nextRow($r)) { $out[$a['name']] = $a['val']; } } } // get global prefs, eventually override equally named user prefs. if (version_compare($dbversion, '4.0.9', '>=') or $txp_using_svn) { $r = safe_rows_start('name, val', 'txp_prefs', 'prefs_id=1 AND user_name=\'\''); } else { $r = safe_rows_start('name, val', 'txp_prefs', 'prefs_id=1'); } if ($r) { while ($a = nextRow($r)) { $out[$a['name']] = $a['val']; } } if (@txpinterface === 'admin') { if (!$dbversion or $dbversion != $thisversion or $txp_using_svn) { $name = L10N_DIRTY_FLAG_VARNAME; if (!array_key_exists(L10N_DIRTY_FLAG_VARNAME, $out)) { safe_insert('txp_prefs', "name = '{$name}', val = 'DIRTY', event = 'l10n', html = 'text_input', type = '2', prefs_id = 1"); } else { safe_update('txp_prefs', "val = 'DIRTY'", "name like '{$name}'"); } } } $exception = false; $exception_events = array('prefs'); # These txp pages do their own language loading from the $prefs['language'] setting. if (isset($event)) { $exception = in_array($event, $exception_events); } if (defined('LANG') && !$exception) { return $out; } if (@txpinterface === 'admin' or @txpinterface === 'public') { if (l10n_installed(true)) { # First call and the plugin is installed and active so guess # which language the user is browsing in based on the long session variable. # This will not be set for the first visit to a page but it does reduce the need # for reloading the strings. # # If this guess later proves to be wrong -- for example, on the first call or when # the user switches browse language -- then $textarray will be reloaded. # @session_start(); $language = ''; if (@txpinterface === 'admin') { $language = @$_SESSION['l10n_admin_long_lang']; } else { $language = @$_SESSION['l10n_long_lang']; } if (!empty($language)) { $out['language'] = $language; } } } return $out; }
function aro_pagetop($message) { global $siteurl, $sitename, $txp_user, $event; $mlp = is_callable('l10n_installed') && is_callable('_l10n_inject_switcher_form'); $mlp = $mlp ? l10n_installed() : false; $area = gps('event'); $event = !$event ? 'article' : $event; $bm = gps('bm'); $privs = safe_field("privs", "txp_users", "name = '" . doSlash($txp_user) . "'"); $GLOBALS['privs'] = $privs; $areas = areas(); foreach ($areas as $k => $v) { if (in_array($event, $v)) { $area = $k; break; } } $out[] = '<div id="header">'; $out[] = '<h1 class="branding"><a href="' . hu . '" title="' . gTxt('tab_view_site') . '"><img src="txp_img/sitelink.gif" alt="' . $sitename . '" /></a></h1>'; if ($txp_user) { $ev = has_privs('prefs') ? 'prefs' : 'admin'; $lang_sel = $mlp ? _l10n_inject_switcher_form() . ' | ' : ''; $out[] = '<div class="user">' . $txp_user . ' - ' . $lang_sel . '<a href="index.php?event=' . $ev . '">' . gTxt('prefs') . '</a> | <a href="index.php?logout=1">' . gTxt('logout') . '</a></div>'; } if (!$bm && $txp_user) { // primary navigation $out[] = '<ul id="nav-primary">'; $out[] = has_privs('tab.content') ? aro_areatab(aro_myadmin_gTxt('tab_dashboard'), 'dashboard', 'dashboard', $area) : ''; $out[] = has_privs('tab.content') ? aro_areatab(gTxt('tab_content'), 'content', 'article', $area) : ''; $out[] = has_privs('tab.presentation') ? aro_areatab(gTxt('tab_presentation'), 'presentation', 'page', $area) : ''; $out[] = '</ul>'; // secondary navigation $out[] = '<ul id="nav-secondary">'; $out[] = has_privs('tab.admin') ? aro_areatab(gTxt('tab_admin'), 'admin', 'admin', $area) : ''; $out[] = has_privs('tab.extensions') && !empty($areas['extensions']) ? aro_areatab(gTxt('tab_extensions'), 'extensions', array_shift($areas['extensions']), $area) : ''; $out[] = '</ul>'; $out[] = '</div><!-- end header -->'; $out[] = '<div id="myadmin_body">'; // terciary navigation $out[] = '<ul id="nav-terciary">'; $out[] = aro_tabsort($area, $event); $out[] = '</ul>'; } else { $out[] = '</div><!-- end header -->'; $out[] = '<div id="myadmin_body">'; } $out[] = '<div id="content">'; if ($message) { $out[] = '<div class="message">' . $message . '</div>'; } $page = join(n, $out); if ($mlp && is_callable('_l10n_rename_articles_tab')) { # Change the text of the "articles" tab... $page = _l10n_rename_articles_tab($page); } return $page; }
function installed() { return l10n_installed(); }
} } # include_once txpath . '/lib/l10n_admin_classes.php'; $l10n_view = new MLPPlugin('l10n-localisation', L10N_NAME, 'content'); # include_once txpath . '/lib/l10n_admin.php'; if (gps('l10nfile') === 'mlp.js') { ob_start(); print _l10n_inject_js(); exit; } } # -- Public code section follows... if (@txpinterface === 'public') { $installed = l10n_installed(true); if (!$installed) { return ''; } include_once txpath . '/lib/l10n_base.php'; global $prefs; $prefs['db_remap_tables_func'] = '_l10n_redirect_textpattern'; $prefs['db_remap_fields_func'] = '_l10n_remap_fields'; $prefs['db_process_result_func'] = '_l10n_process_pageform_access'; # Ensure that the l10n pretext call is the first one made! global $plugin_callback; if (is_array($plugin_callback)) { $cback = array('function' => '_l10n_pretext', 'event' => 'pretext', 'step' => '', 'pre' => 0); array_unshift($plugin_callback, $cback); } else { register_callback('_l10n_pretext', 'pretext');