--- a/includes/clientside/static/ajax.js Sun Oct 28 23:50:10 2007 -0400
+++ b/includes/clientside/static/ajax.js Mon Oct 29 11:17:55 2007 -0400
@@ -559,7 +559,7 @@
if ( KILL_SWITCH )
return true;
var inner_html = '';
- inner_html += '<p><label>Theme: ';
+ inner_html += '<p><label>' + $lang.get('ajax_changestyle_lbl_theme') + ' ';
inner_html += ' <select id="chtheme_sel_theme" onchange="ajaxGetStyles(this.value);">';
inner_html += ' <option value="_blank" selected="selected">' + $lang.get('ajax_changestyle_select') + '</option>';
inner_html += ENANO_THEME_LIST;
@@ -610,7 +610,7 @@
var p_parent = document.createElement('p');
var label = document.createElement('label');
p_parent.id = 'chtheme_sel_style_parent';
- label.appendChild(document.createTextNode('Style: '));
+ label.appendChild(document.createTextNode($lang.get('ajax_changestyle_lbl_style') + ' '));
var select = document.createElement('select');
select.id = 'chtheme_sel_style';
for ( var i in options )
--- a/includes/clientside/static/faders.js Sun Oct 28 23:50:10 2007 -0400
+++ b/includes/clientside/static/faders.js Mon Oct 29 11:17:55 2007 -0400
@@ -184,7 +184,8 @@
{
btn = document.createElement('input');
btn.type = 'button';
- btn.value = 'OK';
+ btn.value = $lang.get('etc_ok');
+ btn._GenericName = 'OK';
btn.onclick = this.clickHandler;
btn.style.margin = '0 3px';
buttondiv.appendChild(btn);
@@ -194,14 +195,16 @@
{
btn = document.createElement('input');
btn.type = 'button';
- btn.value = 'OK';
+ btn.value = $lang.get('etc_ok');
+ btn._GenericName = 'OK';
btn.onclick = this.clickHandler;
btn.style.margin = '0 3px';
buttondiv.appendChild(btn);
btn = document.createElement('input');
btn.type = 'button';
- btn.value = 'Cancel';
+ btn.value = $lang.get('etc_cancel');
+ btn._GenericName = 'Cancel';
btn.onclick = this.clickHandler;
btn.style.margin = '0 3px';
buttondiv.appendChild(btn);
@@ -211,14 +214,16 @@
{
btn = document.createElement('input');
btn.type = 'button';
- btn.value = 'Yes';
+ btn.value = $lang.get('etc_yes');
+ btn._GenericName = 'Yes';
btn.onclick = this.clickHandler;
btn.style.margin = '0 3px';
buttondiv.appendChild(btn);
btn = document.createElement('input');
btn.type = 'button';
- btn.value = 'No';
+ btn.value = $lang.get('etc_no');
+ btn._GenericName = 'No';
btn.onclick = this.clickHandler;
btn.style.margin = '0 3px';
buttondiv.appendChild(btn);
@@ -228,21 +233,24 @@
{
btn = document.createElement('input');
btn.type = 'button';
- btn.value = 'Yes';
+ btn.value = $lang.get('etc_yes');
+ btn._GenericName = 'Yes';
btn.onclick = this.clickHandler;
btn.style.margin = '0 3px';
buttondiv.appendChild(btn);
btn = document.createElement('input');
btn.type = 'button';
- btn.value = 'No';
+ btn.value = $lang.get('etc_no');
+ btn._GenericName = 'No';
btn.onclick = this.clickHandler;
btn.style.margin = '0 3px';
buttondiv.appendChild(btn);
btn = document.createElement('input');
btn.type = 'button';
- btn.value = 'Cancel';
+ btn.value = $lang.get('etc_cancel');
+ btn._GenericName = 'Cancel';
btn.onclick = this.clickHandler;
btn.style.margin = '0 3px';
buttondiv.appendChild(btn);
@@ -295,7 +303,7 @@
function messagebox_click(obj, mb)
{
- val = obj.value;
+ val = ( typeof ( obj._GenericName ) == 'string' ) ? obj._GenericName : obj.value;
if(typeof mb.onbeforeclick[val] == 'function')
{
var o = mb.onbeforeclick[val];
--- a/includes/lang.php Sun Oct 28 23:50:10 2007 -0400
+++ b/includes/lang.php Mon Oct 29 11:17:55 2007 -0400
@@ -424,7 +424,7 @@
$subs[$key] = strval($value);
$string = str_replace("%{$key}%", "{$subs[$key]}", $string);
}
- return "[L] $string";
+ return "L $string";
}
} // class Language
--- a/includes/template.php Sun Oct 28 23:50:10 2007 -0400
+++ b/includes/template.php Mon Oct 29 11:17:55 2007 -0400
@@ -665,7 +665,7 @@
$parser->assign_vars(Array(
'HREF'=>makeUrlNS('Special', 'Logout'),
'FLAGS'=>'onclick="if ( !KILL_SWITCH ) { mb_logout(); return false; }"',
- 'TEXT'=>'Log out',
+ 'TEXT'=>$lang->get('sidebar_btn_logout'),
));
$logout_link = $parser->run();
@@ -673,7 +673,7 @@
$parser->assign_vars(Array(
'HREF'=>makeUrlNS('Special', 'Login/' . $paths->page),
'FLAGS'=>'onclick="if ( !KILL_SWITCH ) { ajaxStartLogin(); return false; }"',
- 'TEXT'=>'Log in',
+ 'TEXT'=>$lang->get('sidebar_btn_login'),
));
$login_link = $parser->run();
@@ -681,7 +681,7 @@
$parser->assign_vars(Array(
'HREF'=>makeUrlNS('Special', 'ChangeStyle/'.$paths->page),
'FLAGS'=>'onclick="if ( !KILL_SWITCH ) { ajaxChangeStyle(); return false; }"',
- 'TEXT'=>'Change theme',
+ 'TEXT'=>$lang->get('sidebar_btn_changestyle'),
));
$theme_link = $parser->run();
@@ -689,7 +689,7 @@
$parser->assign_vars(Array(
'HREF'=>makeUrlNS('Special', 'Administration'),
'FLAGS'=>'onclick="if ( !KILL_SWITCH ) { void(ajaxStartAdminLogin()); return false; }"',
- 'TEXT'=>'Administration',
+ 'TEXT'=>$lang->get('sidebar_btn_administration'),
));
$admin_link = $parser->run();
@@ -799,6 +799,8 @@
function header($simple = false)
{
global $db, $session, $paths, $template, $plugins; // Common objects
+ global $lang;
+
ob_start();
if(!$this->theme_loaded)
@@ -825,7 +827,7 @@
{
$login_link = makeUrlNS('Special', 'Login/' . $paths->fullpage, 'level=' . $session->user_level, true);
echo '<div class="usermessage">';
- echo '<b>Your administrative session has timed out.</b> <a href="' . $login_link . '">Log in again</a>';
+ echo $lang->get('user_msg_elev_timed_out', array( 'login_link' => $login_link ));
echo '</div>';
}
if ( $this->site_disabled && $session->user_level >= USER_LEVEL_ADMIN && ( $paths->page != $paths->nslist['Special'] . 'Administration' ) )
@@ -1283,6 +1285,8 @@
function tplWikiFormat($message, $filter_links = false, $filename = 'elements.tpl')
{
global $db, $session, $paths, $template, $plugins; // Common objects
+ global $lang;
+
$filter_links = false;
$tplvars = $this->extract_vars($filename);
if($session->sid_super) $as = htmlspecialchars(urlSeparator).'auth='.$session->sid_super;
@@ -1411,6 +1415,15 @@
}
}
+ preg_match_all('/\{lang:([a-z0-9]+_[a-z0-9_]+)\}/', $message, $matches);
+ foreach ( $matches[1] as $i => $string_id )
+ {
+ $string = $lang->get($string_id);
+ $string = str_replace('\\', '\\\\', $string);
+ $string = str_replace('\'', '\\\'', $string);
+ $message = str_replace_once($matches[0][$i], $string, $message);
+ }
+
/*
* HTML RENDERER
*/
--- a/language/english/enano.json Sun Oct 28 23:50:10 2007 -0400
+++ b/language/english/enano.json Mon Oct 29 11:17:55 2007 -0400
@@ -17,7 +17,7 @@
var enano_lang = {
categories: [
- 'adm', 'meta', 'user', 'page', 'comment', 'onpage', 'etc', 'editor', 'history', 'catedit', 'tags', 'delvote', 'ajax',
+ 'adm', 'meta', 'user', 'page', 'comment', 'onpage', 'etc', 'editor', 'history', 'catedit', 'tags', 'delvote', 'ajax', 'sidebar',
],
strings: {
meta: {
@@ -34,6 +34,7 @@
tags: 'Page tagging interface',
delvote: 'Page deletion vote interface',
ajax: 'On-page AJAX applets',
+ sidebar: 'Default sidebar blocks and buttons',
plural: 's'
},
user: {
@@ -87,6 +88,8 @@
type_member: 'Member',
type_mod: 'Moderator',
type_admin: 'Administrator',
+
+ msg_elev_timed_out: '<b>Your administrative session has timed out.</b> <a href="%login_link%">Log in again</a>',
},
onpage: {
lbl_pagetools: 'Page tools',
@@ -290,6 +293,8 @@
changestyle_select: '[Select]',
changestyle_title: 'Change your theme',
changestyle_pleaseselect_theme: 'Please select a theme from the list.',
+ changestyle_lbl_theme: 'Theme:',
+ changestyle_lbl_style: 'Style:',
changestyle_success: 'Your theme preference has been changed.\nWould you like to reload the page now to see the changes?',
killphp_confirm: 'Are you really sure you want to do this? Some pages might not function if this emergency-only feature is activated.',
killphp_success: 'Embedded PHP in pages has been disabled.',
@@ -307,18 +312,45 @@
password_disable_success: 'The password for this page has been disabled.',
},
+ sidebar: {
+ title_navigation: 'Navigation',
+ title_tools: 'Tools',
+ title_search: 'Search',
+ title_links: 'Links',
+
+ btn_home: 'Home',
+ btn_createpage: 'Create a page',
+ btn_uploadfile: 'Upload file',
+ btn_specialpages: 'Special pages',
+ btn_administration: 'Administration',
+ btn_editsidebar: 'Edit the sidebar',
+ btn_search_go: 'Go',
+
+ btn_userpage: 'User page',
+ btn_mycontribs: 'My contributions',
+ btn_preferences: 'Preferences',
+ btn_privatemessages: 'Private messages',
+ btn_groupcp: 'Group control panel',
+ btn_register: 'Create an account',
+ btn_login: 'Log in',
+ btn_logout: 'Log out',
+ btn_changestyle: 'Change theme',
+ },
etc: {
redirect_title: 'Redirecting...',
redirect_body: 'Please wait while you are redirected.',
redirect_timeout: 'If you are not redirected within %timeout% seconds, please <a href="%redirect_url%">click here</a>.',
// Generic "Save Changes" button
save_changes: 'Save changes',
- // Generic "Cancel" button
- cancel: 'Cancel',
// Generic "Notice:" label
lbl_notice: 'Notice:',
// Generic "Access denied"
access_denied: 'Access to the specified file, resource, or action is denied.',
+ // Message box buttons
+ ok: 'OK',
+ cancel: 'Cancel',
+ yes: 'Yes',
+ no: 'No'
},
}
};
--- a/plugins/SpecialAdmin.php Sun Oct 28 23:50:10 2007 -0400
+++ b/plugins/SpecialAdmin.php Mon Oct 29 11:17:55 2007 -0400
@@ -3026,7 +3026,7 @@
echo '<div class="warning-box" style="margin: 10px 0;">$_GET[\'side\'] contained an SQL injection attempt</div>';
break;
}
- $query = $db->sql_query('UPDATE '.table_prefix.'sidebar SET sidebar_id=' . intval($_GET['side']) . ' WHERE item_id=' . intval($_GET['id']) . ';');
+ $query = $db->sql_query('UPDATE '.table_prefix.'sidebar SET sidebar_id=' . $db->escape($_GET['side']) . ' WHERE item_id=' . intval($_GET['id']) . ';');
if(!$query)
{
echo $db->get_error();
@@ -3074,6 +3074,21 @@
die('GOOD');
}
break;
+ case 'rename';
+ $newname = $db->escape($_POST['newname']);
+ $q = $db->sql_query('UPDATE '.table_prefix.'sidebar SET block_name=\''.$newname.'\' WHERE item_id=' . intval($_GET['id']) . ';');
+ if(!$q)
+ {
+ echo $db->get_error();
+ $template->footer();
+ exit;
+ }
+ if(isset($_GET['ajax']))
+ {
+ ob_end_clean();
+ die('GOOD');
+ }
+ break;
case 'getsource':
$q = $db->sql_query('SELECT block_content,block_type FROM '.table_prefix.'sidebar WHERE item_id=' . intval($_GET['id']) . ';');
if(!$q)
@@ -3205,6 +3220,8 @@
$parser = $template->makeParserText($vars['sidebar_section']);
$c = $template->tplWikiFormat($row['block_content'], false, 'sidebar-editor.tpl');
$c = preg_replace('#<a (.*?)>(.*?)</a>#is', '<a href="#" onclick="return false;">\\2</a>', $c);
+ // fix for the "Administration" link that somehow didn't get rendered properly
+ $c = preg_replace("/(^|\n)([ ]*)<a([ ]+.*)?>(.+)<\/a>(<br(.*)\/>)([\r\n]+|$)/isU", '\\1\\2<li><a\\3>\\4</a></li>\\7', $c);
break;
case BLOCK_HTML:
$parser = $template->makeParserText($vars['sidebar_section_raw']);
@@ -3224,7 +3241,7 @@
$c = ($template->fetch_block($row['block_content'])) ? $template->fetch_block($row['block_content']) : 'Can\'t find plugin block';
break;
}
- $block_name = $template->tplWikiFormat($row['block_name']);
+ $block_name = $row['block_name']; // $template->tplWikiFormat($row['block_name']);
if ( empty($block_name) )
$block_name = '<Unnamed>';
$t = '<span title="Double-click to rename this block" id="sbrename_' . $row['item_id'] . '" ondblclick="ajaxRenameSidebarStage1(this, \''.$row['item_id'].'\'); return false;">' . $block_name . '</span>';