From e762316645c2ed5d8cf9c117e8546e7b170f2541 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 2 Jan 2005 01:39:52 +0000 Subject: [PATCH] r40: Initial phrasing of Admin CP. Many of the phrases could be simplified and the number reduced, however it is now completely language independent. Phrases and language systems have also been moved into the database. --- admin/global.php | 10 ++-- admin/options.php | 4 +- admin/priority.php | 26 ++++----- admin/product.php | 64 +++++++++++----------- admin/resolution.php | 26 ++++----- admin/severity.php | 22 ++++---- admin/status.php | 22 ++++---- admin/usergroup.php | 105 ++++++++++++++++++------------------ docs/phrasetools.php | 37 +++++++------ includes/adminfunctions.php | 22 ++++---- includes/functions.php | 2 +- includes/init.php | 41 ++++++++++---- 12 files changed, 204 insertions(+), 177 deletions(-) diff --git a/admin/global.php b/admin/global.php index 941075e..16dd179 100755 --- a/admin/global.php +++ b/admin/global.php @@ -28,10 +28,10 @@ function admin_login() $admin->form_start('../login.php', 'cplogin', false, 'cplogin'); $admin->table_start(true, '425'); - $admin->table_head('Renapsus Login'); - $admin->row_input('Email', 'email', $bugsys->userinfo['email'], 2, 35, false, false, 'middle'); - $admin->row_input('Password', 'password', '', 2, 35, false, true, 'middle'); - $admin->row_submit('', 'Login'); + $admin->table_head(phrase('renapsus_login')); + $admin->row_input(phrase('email'), 'email', $bugsys->userinfo['email'], 2, 35, false, false, 'middle'); + $admin->row_input(phrase('password'), 'password', '', 2, 35, false, true, 'middle'); + $admin->row_submit('', phrase('login')); $admin->table_end(); $admin->form_end(); @@ -47,7 +47,7 @@ if ($_COOKIE[COOKIE_PREFIX . 'adminsession']) if (md5(md5($bugsys->userinfo['authkey']) . md5($bugsys->userinfo['email']) . md5($bugsys->userinfo['userid'])) != $_COOKIE[COOKIE_PREFIX . 'adminsession']) { mysetcookie(COOKIE_PREFIX . 'adminsession', ''); - $admin->error('Invalid admin session has been terminated.'); + $admin->error(phrase('invalid_admin_session_terminated')); } } else diff --git a/admin/options.php b/admin/options.php index 2bc7cd5..3d5227d 100755 --- a/admin/options.php +++ b/admin/options.php @@ -92,8 +92,8 @@ if ($_REQUEST['do'] == 'modify') $options["$opt[1]"] = $opt[3]; } - $admin->list_item('Yes', '1', iff($options["$opt[1]"], true, false)); - $admin->list_item('No', '0', iff($options["$opt[1]"], false, true)); + $admin->list_item(phrase('yes'), '1', iff($options["$opt[1]"], true, false)); + $admin->list_item(phrase('no'), '0', iff($options["$opt[1]"], false, true)); $admin->row_list(phrase('setting_' . $opt[1] . '_desc'), 'setting[' . $opt[1] . ']', false); break; diff --git a/admin/priority.php b/admin/priority.php index b2f6c59..b7d80c0 100755 --- a/admin/priority.php +++ b/admin/priority.php @@ -40,7 +40,7 @@ if ($_REQUEST['do'] == 'kill') if ($_REQUEST['do'] == 'delete') { sanitize(array('priorityid' => INT)); - $admin->page_confirm('Are you sure you want to delete this priority? Doing so will revert all bugs to the default priority (which is set in the options panel)?', 'priority.php?do=kill&priorityid=' . $vars['priorityid']); + $admin->page_confirm(phrase('confirm_delete_priority'), 'priority.php?do=kill&priorityid=' . $vars['priorityid']); } // ################################################################### @@ -57,13 +57,13 @@ if ($_POST['do'] == 'insert') if ($_REQUEST['do'] == 'add') { - $admin->page_start('Add New Priority'); + $admin->page_start(phrase('add_new_priority')); $admin->form_start('priority.php', 'insert'); $admin->table_start(); - $admin->table_head('New Priority'); - $admin->row_input('Priority Title
The title of this priority flag (eg: `Slated for Development` or `Address Now`)
', 'priority'); - $admin->row_input('Display Order
The order in which the priorities are displayed. The higher the number, the lower down in the list it is.
', 'displayorder'); + $admin->table_head(phrase('new_priority')); + $admin->row_input(phrase('priority_title'), 'priority'); + $admin->row_input(phrase('priority_display_order'), 'displayorder'); $admin->row_submit(); $admin->table_end(); $admin->form_end(); @@ -93,14 +93,14 @@ if ($_REQUEST['do'] == 'edit') $admin->error('-1'); } - $admin->page_start('Edit Priority'); + $admin->page_start(phrase('edit_priority')); $admin->form_start('priority.php', 'update'); $admin->form_hidden_field('priorityid', $priority['priorityid']); $admin->table_start(); - $admin->table_head("Edit Priority - $priority[priority] (priorityid: $priority[priorityid])"); - $admin->row_input('Priority Title
The title of this priority flag (eg: `Slated for Development` or `Address Now`)
', 'priority', $priority['priority']); - $admin->row_input('Display Order
The order in which the priorities are displayed. The higher the number, the lower down in the list it is.
', 'displayorder', $priority['displayorder']); + $admin->table_head(phrase('edit_priority_title', $priority['priority'], $priority['priorityid'])); + $admin->row_input(phrase('priority_title'), 'priority', $priority['priority']); + $admin->row_input(phrase('priority_display_order'), 'displayorder', $priority['displayorder']); $admin->row_submit(); $admin->table_end(); $admin->form_end(); @@ -112,21 +112,21 @@ if ($_REQUEST['do'] == 'edit') if ($_REQUEST['do'] == 'modify') { - $admin->page_start('Priority Manager'); + $admin->page_start(phrase('priority_manager')); $priorities = $DB_sql->query("SELECT * FROM " . TABLE_PREFIX . "priority ORDER BY displayorder"); $admin->form_start('priority.php', 'null'); $admin->table_start(); - $admin->table_head('Priority Manager'); + $admin->table_head(phrase('priority_manager')); while ($priority = $DB_sql->fetch_array($priorities)) { - $admin->row_text("$priority[displayorder]: $priority[priority]", "(priorityid: $priority[priorityid]) [Edit] [Delete]"); + $admin->row_text("$priority[displayorder]: $priority[priority]", "(priorityid: $priority[priorityid]) " . phrase('edit_wraplink') . " " . phrase('delete_wraplink') . ""); } $DB_sql->free_result($priorityes); - $admin->row_span('', 'tfoot', 'center', 3); + $admin->row_span('', 'tfoot', 'center', 3); $admin->table_end(); $admin->form_end(); diff --git a/admin/product.php b/admin/product.php index 85140cd..28887d3 100755 --- a/admin/product.php +++ b/admin/product.php @@ -36,12 +36,12 @@ function construct_option_list($type, $id, $edit, $addcomponent, $addversion, $d if ($addcomponent) { - $opt .= ''; + $opt .= ''; } if ($addversion) { - $opt .= ''; + $opt .= ''; } $type = strtolower($type); @@ -50,7 +50,7 @@ function construct_option_list($type, $id, $edit, $addcomponent, $addversion, $d $displayorder = iff($displayorder != -1, ' ', ''); - return $displayorder . ' '; + return $displayorder . ' '; } // ################################################################### @@ -79,7 +79,7 @@ if ($_REQUEST['do'] == 'killversion') if ($_REQUEST['do'] == 'deleteversion') { sanitize(array('versionid' => INT)); - $admin->page_confirm('Are you sure you want to delete this version? Doing so will do x to the bugs with this version.', 'product.php?do=killversion&versionid=' . $vars['versionid']); + $admin->page_confirm(phrase('confirm_delete_version'), 'product.php?do=killversion&versionid=' . $vars['versionid']); } // ################################################################### @@ -98,7 +98,7 @@ if ($_REQUEST['do'] == 'addversion') { sanitize(array('productid' => INT)); - $admin->page_start('Add Version'); + $admin->page_start(phrase('add_version')); if ($vars['productid'] != -1) { @@ -116,9 +116,9 @@ if ($_REQUEST['do'] == 'addversion') $admin->form_start('product.php', 'insertversion'); $admin->form_hidden_field('productid', $vars['productid']); $admin->table_start(); - $admin->table_head('Add New Version'); - $admin->row_input('Version Number
This is the version string for this product.
', 'version'); - $admin->row_input('Display Order
The order in which the versions are displayed.
', 'displayorder'); + $admin->table_head(phrase('add_new_version')); + $admin->row_input(phrase('version_title'), 'version'); + $admin->row_input(phrase('version_display_order'), 'displayorder'); $admin->row_submit(); $admin->table_end(); $admin->form_end(); @@ -134,7 +134,7 @@ if ($_REQUEST['do'] == 'updateversion') if (empty($vars['version'])) { - $admin->error('Please fill in a version number.'); + $admin->error(phrase('fill_in_version_number')); } $DB_sql->query("UPDATE " . TABLE_PREFIX . "version SET version = '" . addslasheslike($vars['version']) . "', displayorder = $vars[displayorder] WHERE versionid = $vars[versionid]"); @@ -149,7 +149,7 @@ if ($_REQUEST['do'] == 'editversion') { sanitize(array('versionid' => INT)); - $admin->page_start('Edit Version'); + $admin->page_start(phrase('edit_version')); $version = $DB_sql->query_first("SELECT * FROM " . TABLE_PREFIX . "version WHERE versionid = $vars[versionid]"); if (!is_array($version)) @@ -160,9 +160,9 @@ if ($_REQUEST['do'] == 'editversion') $admin->form_start('product.php', 'updateversion'); $admin->form_hidden_field('versionid', $version['versionid']); $admin->table_start(); - $admin->table_head('Edit Version - ' . $version['version']); - $admin->row_input('Version Number
This is the version string for this product.
', 'version', $version['version']); - $admin->row_input('Display Order
The order in which the versions are displayed.
', 'displayorder', $version['displayorder']); + $admin->table_head(phrase('edit_version_title', $version['version'])); + $admin->row_input(phrase('version_title'), 'version', $version['version']); + $admin->row_input(phrase('version_display_order'), 'displayorder', $version['displayorder']); $admin->row_submit(); $admin->table_end(); $admin->form_end(); @@ -196,7 +196,7 @@ if ($_REQUEST['do'] == 'killproduct') if ($_REQUEST['do'] == 'deleteproduct') { sanitize(array('productid' => INT)); - $admin->page_confirm('Are you sure you want to delete this product and all of it\'s sub-versions and components (as well as any bugs contained within those groups)?', 'product.php?do=killproduct&productid=' . $vars['productid']); + $admin->page_confirm(phrase('confirm_delete_product'), 'product.php?do=killproduct&productid=' . $vars['productid']); } // ################################################################### @@ -207,7 +207,7 @@ if ($_REQUEST['do'] == 'insertproduct') if (empty($vars['shortname']) OR empty($vars['title'])) { - $admin->error('please go back and enter both fields'); + $admin->error(phrase('go_back_and_fill_both_fields')); } $DB_sql->query(" @@ -228,16 +228,16 @@ if ($_REQUEST['do'] == 'addproduct') { sanitize(array('productid' => INT)); - $admin->page_start('Add New Product'); + $admin->page_start(phrase('add_new_product')); $admin->form_start('product.php', 'insertproduct'); $admin->form_hidden_field('componentmother', $vars['productid']); $admin->table_start(); - $admin->table_head('Add Product'); - $admin->row_input('Short Name
The name that can be used to submit email reports. This should be unique.
', 'shortname'); - $admin->row_input('Product Title', 'title'); - $admin->row_textarea('Description
A short description of this product.
', 'description'); - $admin->row_input('Display Order
The order in which the products are displayed.
', 'displayorder'); + $admin->table_head(phrase('add_product')); + $admin->row_input(phrase('product_shortname'), 'shortname'); + $admin->row_input(phrase('product_title'), 'title'); + $admin->row_textarea(phrase('product_description'), 'description'); + $admin->row_input(phrase('product_display_order'), 'displayorder'); $admin->row_submit(); $admin->table_end(); $admin->form_end(); @@ -253,7 +253,7 @@ if ($_REQUEST['do'] == 'updateproduct') if (empty($vars['shortname']) OR empty($vars['title'])) { - $admin->error('please go back and fill in both fields'); + $admin->error(phrase('go_back_and_fill_both_fields')); } if (empty($vars['productid'])) @@ -273,7 +273,7 @@ if ($_REQUEST['do'] == 'editproduct') { sanitize(array('productid' => INT)); - $admin->page_start('Edit Product'); + $admin->page_start(phrase('edit_product')); $product = $DB_sql->query_first("SELECT * FROM " . TABLE_PREFIX . "product WHERE productid = $vars[productid]"); @@ -285,11 +285,11 @@ if ($_REQUEST['do'] == 'editproduct') $admin->form_start('product.php', 'updateproduct'); $admin->form_hidden_field('productid', $product['productid']); $admin->table_start(); - $admin->table_head('Edit Product - ' . $product['title']); - $admin->row_input('Product Title', 'title', $product['title']); - $admin->row_input('Short Name
The name that can be used to submit email reports. This should be unique.
', 'shortname', $product['shortname']); - $admin->row_textarea('Description
A short description of this product.
', 'description', $product['description']); - $admin->row_input('Display Order
The order in which the products are displayed.
', 'displayorder', $product['displayorder']); + $admin->table_head(phrase('edit_product_title', $product['title'])); + $admin->row_input(phrase('product_title'), 'title', $product['title']); + $admin->row_input(phrase('product_shortname'), 'shortname', $product['shortname']); + $admin->row_textarea(phrase('product_description'), 'description', $product['description']); + $admin->row_input(phrase('product_display_order'), 'displayorder', $product['displayorder']); $admin->row_submit(); $admin->table_end(); $admin->form_end(); @@ -320,7 +320,7 @@ if ($_POST['do'] == 'displayorder') if ($_REQUEST['do'] == 'modify') { - $admin->page_start('Products and Versions'); + $admin->page_start(phrase('products_and_versions')); $javascript = << @@ -360,12 +360,12 @@ EOF; $versions = (array)$version; $admin->table_start(); - $admin->table_head('Products / Versions'); + $admin->table_head(phrase('products_versions')); // Handle our global versions if (is_array($versions['0'])) { - $admin->row_text('Global Versions', construct_option_list('product', -1, 0, 0, 1, 0, -1), 'middle', 2, 'alt3'); + $admin->row_text(phrase('global_versions'), construct_option_list('product', -1, 0, 0, 1, 0, -1), 'middle', 2, 'alt3'); foreach ($versions['0'] AS $version) { $admin->row_text('-- ' . $version['version'], construct_option_list('version', $version['versionid'], 1, 0, 0, 1, $version['displayorder']), 'middle', 2, 'alt2'); @@ -397,7 +397,7 @@ EOF; } } - $admin->row_span(' ', 'tfoot', 'center'); + $admin->row_span(' ', 'tfoot', 'center'); $admin->table_end(); diff --git a/admin/resolution.php b/admin/resolution.php index 3669196..6f14d84 100755 --- a/admin/resolution.php +++ b/admin/resolution.php @@ -40,7 +40,7 @@ if ($_REQUEST['do'] == 'kill') if ($_REQUEST['do'] == 'delete') { sanitize(array('resolutionid' => INT)); - $admin->page_confirm('Are you sure you want to delete this resolution? Doing so will revert all bugs to the default resolution (which is set in the options panel)?', 'resolution.php?do=kill&resolutionid=' . $vars['resolutionid']); + $admin->page_confirm(phrase('confirm_delete_resolution'), 'resolution.php?do=kill&resolutionid=' . $vars['resolutionid']); } // ################################################################### @@ -57,13 +57,13 @@ if ($_POST['do'] == 'insert') if ($_REQUEST['do'] == 'add') { - $admin->page_start('Add New Resolution'); + $admin->page_start(phrase('add_new_resolution')); $admin->form_start('resolution.php', 'insert'); $admin->table_start(); - $admin->table_head('New Resolution'); - $admin->row_input('Resolution Title
The title of this resolution flag (eg: `Fixed` or `Bogus`)
', 'resolution'); - $admin->row_input('Display Order
The order in which the resolutions are displayed. The higher the number, the lower down in the list it is.
', 'displayorder'); + $admin->table_head(phrase('new_resolution')); + $admin->row_input(phrase('resolution_title'), 'resolution'); + $admin->row_input(phrase('resolution_display_order'), 'displayorder'); $admin->row_submit(); $admin->table_end(); $admin->form_end(); @@ -93,14 +93,14 @@ if ($_REQUEST['do'] == 'edit') $admin->error('-1'); } - $admin->page_start('Edit Resolution'); + $admin->page_start(phrase('edit_resolution')); $admin->form_start('resolution.php', 'update'); $admin->form_hidden_field('resolutionid', $resolution['resolutionid']); $admin->table_start(); - $admin->table_head("Edit Resolution - $resolution[resolution] (resolutionid: $resolution[resolutionid])"); - $admin->row_input('Resolution Title
The title of this resolution flag (eg: `Fixed` or `Bogus`)
', 'resolution', $resolution['resolution']); - $admin->row_input('Display Order
The order in which the resolutions are displayed. The higher the number, the lower down in the list it is.
', 'displayorder', $resolution['displayorder']); + $admin->table_head(phrase('edit_resolution_title', $resolution['resolution'], $resolution['resolutionid'])); + $admin->row_input(phrase('resolution_title'), 'resolution', $resolution['resolution']); + $admin->row_input(phrase('resolution_display_order'), 'displayorder', $resolution['displayorder']); $admin->row_submit(); $admin->table_end(); $admin->form_end(); @@ -112,21 +112,21 @@ if ($_REQUEST['do'] == 'edit') if ($_REQUEST['do'] == 'modify') { - $admin->page_start('Resolution Manager'); + $admin->page_start(phrase('resolution_manager')); $resolutions = $DB_sql->query("SELECT * FROM " . TABLE_PREFIX . "resolution ORDER BY displayorder"); $admin->form_start('resolution.php', 'null'); $admin->table_start(); - $admin->table_head('Resolution Manager'); + $admin->table_head(phrase('resolution_manager')); while ($resolution = $DB_sql->fetch_array($resolutions)) { - $admin->row_text("$resolution[displayorder]: $resolution[resolution]", "(resolutionid: $resolution[resolutionid]) [Edit] [Delete]"); + $admin->row_text("$resolution[displayorder]: $resolution[resolution]", "(resolutionid: $resolution[resolutionid]) " . phrase('edit_wraplink') . " " . phrase('delete_wraplink') . ""); } $DB_sql->free_result($resolutiones); - $admin->row_span('', 'tfoot', 'center', 3); + $admin->row_span('', 'tfoot', 'center', 3); $admin->table_end(); $admin->form_end(); diff --git a/admin/severity.php b/admin/severity.php index 92cf988..57e1c2d 100755 --- a/admin/severity.php +++ b/admin/severity.php @@ -40,7 +40,7 @@ if ($_REQUEST['do'] == 'kill') if ($_REQUEST['do'] == 'delete') { sanitize(array('severityid' => INT)); - $admin->page_confirm('Are you sure you want to delete this severity? Doing so will revert all bugs to the default severity (which is set in the options panel)?', 'severity.php?do=kill&severityid=' . $vars['severityid']); + $admin->page_confirm(phrase('confirm_delete_severity'), 'severity.php?do=kill&severityid=' . $vars['severityid']); } // ################################################################### @@ -57,13 +57,13 @@ if ($_POST['do'] == 'insert') if ($_REQUEST['do'] == 'add') { - $admin->page_start('Add New Severity'); + $admin->page_start(phrase('add_new_severity')); $admin->form_start('severity.php', 'insert'); $admin->table_start(); - $admin->table_head('New Severity'); - $admin->row_input('Severity Title
The title of this severity flag (eg: `Major` or `Critical`)
', 'severity'); - $admin->row_input('Display Order
The order in which the severities are displayed. The higher the number, the lower down in the list it is.
', 'displayorder'); + $admin->table_head(phrase('new_severity')); + $admin->row_input(phrase('severity_title'), 'severity'); + $admin->row_input(phrase('severity_display_order'), 'displayorder'); $admin->row_submit(); $admin->table_end(); $admin->form_end(); @@ -93,14 +93,14 @@ if ($_REQUEST['do'] == 'edit') $admin->error('-1'); } - $admin->page_start('Edit Severity'); + $admin->page_start(phrase('edit_severity')); $admin->form_start('severity.php', 'update'); $admin->form_hidden_field('severityid', $severity['severityid']); $admin->table_start(); - $admin->table_head("Edit Severity - $severity[severity] (severityid: $severity[severityid])"); - $admin->row_input('Severity Title
The title of this severity flag (eg: `Major` or `Critical`)
', 'severity', $severity['severity']); - $admin->row_input('Display Order
The order in which the severities are displayed. The higher the number, the lower down in the list it is.
', 'displayorder', $severity['displayorder']); + $admin->table_head(phrase('edit_severity_title', $severity['severity'], $severity['severityid'])); + $admin->row_input(phrase('severity_title'), 'severity', $severity['severity']); + $admin->row_input(phrase('severity_display_order'), 'displayorder', $severity['displayorder']); $admin->row_submit(); $admin->table_end(); $admin->form_end(); @@ -122,11 +122,11 @@ if ($_REQUEST['do'] == 'modify') while ($severity = $DB_sql->fetch_array($severities)) { - $admin->row_text("$severity[displayorder]: $severity[severity]", "(severityid: $severity[severityid]) [Edit] [Delete]"); + $admin->row_text("$severity[displayorder]: $severity[severity]", "(severityid: $severity[severityid]) " . phrase('edit_wraplink') . " " . phrase('delete_wraplink') . ""); } $DB_sql->free_result($severityes); - $admin->row_span('', 'tfoot', 'center', 3); + $admin->row_span('', 'tfoot', 'center', 3); $admin->table_end(); $admin->form_end(); diff --git a/admin/status.php b/admin/status.php index b49e2ad..58ce00a 100755 --- a/admin/status.php +++ b/admin/status.php @@ -40,7 +40,7 @@ if ($_REQUEST['do'] == 'kill') if ($_REQUEST['do'] == 'delete') { sanitize(array('statusid' => INT)); - $admin->page_confirm('Are you sure you want to delete this status? Doing so will revert all bugs to the default status (which is set in the options panel)?', 'status.php?do=kill&statusid=' . $vars['statusid']); + $admin->page_confirm(phrase('confirm_delete_status'), 'status.php?do=kill&statusid=' . $vars['statusid']); } // ################################################################### @@ -57,13 +57,13 @@ if ($_POST['do'] == 'insert') if ($_REQUEST['do'] == 'add') { - $admin->page_start('Add New Status'); + $admin->page_start(phrase('add_new_status')); $admin->form_start('status.php', 'insert'); $admin->table_start(); - $admin->table_head('New Status'); - $admin->row_input('Status Title
The title of this status flag (eg: `Confirmed` or `Closed (Fixed)`)
', 'status'); - $admin->row_input('Display Order
The order in which the statuses ar displayed.
', 'displayorder'); + $admin->table_head(phrase('new_status')); + $admin->row_input(phrase('status_title'), 'status'); + $admin->row_input(phrase('status_display_order'), 'displayorder'); $admin->row_submit(); $admin->table_end(); $admin->form_end(); @@ -93,14 +93,14 @@ if ($_REQUEST['do'] == 'edit') $admin->error('-1'); } - $admin->page_start('Edit Status'); + $admin->page_start(phrase('edit_status')); $admin->form_start('status.php', 'update'); $admin->form_hidden_field('statusid', $status['statusid']); $admin->table_start(); - $admin->table_head("Edit Status - $status[status] (statusid: $status[statusid])"); - $admin->row_input('Status Title
The title of this status flag (eg: `Confirmed` or `Closed (Fixed)`)
', 'status', $status['status']); - $admin->row_input('Display Order
The order in which the statuses ar displayed.
', 'displayorder', $status['displayorder']); + $admin->table_head(phrase('edit_status_title', $status['status'], $status['statusid'])); + $admin->row_input(phrase('status_title'), 'status', $status['status']); + $admin->row_input(phrase('status_display_order'), 'displayorder', $status['displayorder']); $admin->row_submit(); $admin->table_end(); $admin->form_end(); @@ -122,11 +122,11 @@ if ($_REQUEST['do'] == 'modify') while ($status = $DB_sql->fetch_array($statuses)) { - $admin->row_text("$status[displayorder]: $status[status]", "(statusid: $status[statusid]) [Edit] [Delete]"); + $admin->row_text("$status[displayorder]: $status[status]", "(statusid: $status[statusid]) " . phrase('edit_wraplink') . " " . phrase('delete_wraplink') . ""); } $DB_sql->free_result($statuses); - $admin->row_span('', 'tfoot', 'center', 3); + $admin->row_span('', 'tfoot', 'center', 3); $admin->table_end(); $admin->form_end(); diff --git a/admin/usergroup.php b/admin/usergroup.php index 6c4f15d..315021f 100755 --- a/admin/usergroup.php +++ b/admin/usergroup.php @@ -33,7 +33,7 @@ if ($_REQUEST['do'] == 'kill') if ($vars['usergroupid'] < 7) { - $admin->error('You can\'t delete a default usergroup.'); + $admin->error(phrase('cant_delete_default_usergroup')); } $DB_sql->query("DELETE FROM " . TABLE_PREFIX . "usergroup WHERE usergroupid = $vars[usergroupid]"); @@ -53,10 +53,10 @@ if ($_REQUEST['do'] == 'delete') if ($vars['usergroupid'] < 7) { - $admin->error('You can\'t delete a default usergroup.'); + $admin->error(phrase('cant_delete_default_usergroup')); } - $admin->page_confirm('Are you sure you want to delete this usergroup? All users in this group will be set back to the default registered usergroup (id: 2).', 'usergroup.php?do=kill&usergroupid=' . $vars['usergroupid']); + $admin->page_confirm(phrase('confirm_delete_usergroup'), 'usergroup.php?do=kill&usergroupid=' . $vars['usergroupid']); } // ################################################################### @@ -68,7 +68,7 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit') sanitize(array('usergroupid' => INT)); - $admin->page_start(iff($add, 'New Usergroup', 'Edit Usergroup')); + $admin->page_start(iff($add, phrase('new_usergroup'), phrase('edit_usergroup'))); $admin->form_start('usergroup.php', iff($add, 'insert', 'update')); @@ -89,41 +89,55 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit') // Details $admin->table_start(); - $admin->table_head('Usergroup Details'); - $admin->row_input('Usergroup Title', 'title', htmlspecialcharslike($usergroup['title'])); - $admin->row_input('Display Title
This is the title that others will be able to see when comments are posted.
', 'displaytitle', htmlspecialcharslike($usergroup['displaytitle'])); - $admin->row_input('Opening Tag Markup
Place all open HTML tags here that will be wrapped around the username.
', 'opentag', htmlspecialcharslike($usergroup['opentag'])); - $admin->row_input('Closing Tag Markup
Place all closed HTML tags that will close any open HTML tags entered above.
', 'closetag', htmlspecialcharslike($usergroup['closetag'])); + $admin->table_head(phrase('usergroup_details')); + $admin->row_input(phrase('usergroup_title'), 'title', htmlspecialcharslike($usergroup['title'])); + $admin->row_input(phrase('usergroup_display_title'), 'displaytitle', htmlspecialcharslike($usergroup['displaytitle'])); + $admin->row_input(phrase('usergroup_open_markup'), 'opentag', htmlspecialcharslike($usergroup['opentag'])); + $admin->row_input(phrase('usergroup_close_markup'), 'closetag', htmlspecialcharslike($usergroup['closetag'])); $admin->table_end(); // Permission $admin->table_start(); - $admin->table_head('Permission Settings'); - $admin->row_span('General Permissions', 'thead', 'center'); - $admin->row_yesno('Can View the Tracker', 'perm[canviewbugs]', $usergroup['permissions'] & $_PERMISSION['canviewbugs']); - $admin->row_yesno('Can Search Bugs', 'perm[cansearch]', $usergroup['permissions'] & $_PERMISSION['cansearch']); - $admin->row_yesno('Can Subscribe to Bugs', 'perm[cansubscribe]', $usergroup['permissions'] & $_PERMISSION['cansubscribe']); - $admin->row_yesno('Can Be Assigned Bugs', 'perm[canbeassignedto]', $usergroup['permissions'] & $_PERMISSION['canbeassignedto']); - $admin->row_span('Posting/Submitting Permissions', 'thead', 'center'); - $admin->row_yesno('Can Vote on Polls', 'perm[canvote]', $usergroup['permissions'] & $_PERMISSION['canvote']); - $admin->row_yesno('Can Submit Bugs', 'perm[cansubmitbugs]', $usergroup['permissions'] & $_PERMISSION['cansubmitbugs']); - $admin->row_yesno('Can Post Comments', 'perm[canpostcomments]', $usergroup['permissions'] & $_PERMISSION['canpostcomments']); - $admin->row_yesno('Can View Attachments', 'perm[cangetattach]', $usergroup['permissions'] & $_PERMISSION['cangetattach']); - $admin->row_yesno('Can Put Attachments', 'perm[canputattach]', $usergroup['permissions'] & $_PERMISSION['canputattach']); - $admin->row_span('Moderation/Managment Permissions', 'thead', 'center'); - $admin->row_yesno('Can Edit Own Bugs', 'perm[caneditown]', $usergroup['permissions'] & $_PERMISSION['caneditown']); - $admin->row_yesno('Can Edit Others\' Bugs', 'perm[caneditothers]', $usergroup['permissions'] & $_PERMISSION['caneditothers']); - $admin->row_yesno('Can Edit Bug Information', 'perm[caneditinfo]', $usergroup['permissions'] & $_PERMISSION['caneditinfo']); - $admin->row_yesno('Can Assign Bugs', 'perm[canassign]', $usergroup['permissions'] & $_PERMISSION['canassign']); - $admin->row_yesno('Can Change Status', 'perm[canchangestatus]', $usergroup['permissions'] & $_PERMISSION['canchangestatus']); - $admin->row_span('Administrator Permissions', 'thead', 'center'); - $admin->row_yesno('Can Access Control Panel', 'perm[canadminpanel]', $usergroup['permissions'] & $_PERMISSION['canadminpanel']); - $admin->row_yesno('Can Administer Bug Reports', 'perm[canadminbugs]', $usergroup['permissions'] & $_PERMISSION['canadminbugs']); - $admin->row_yesno('Can Administer Products / Components / Versions', 'perm[canadminversions]', $usergroup['permissions'] & $_PERMISSION['canadminversions']); - $admin->row_yesno('Can Administer Additional Bug Fields', 'perm[canadminfields]', $usergroup['permissions'] & $_PERMISSION['canadminfields']); - $admin->row_yesno('Can Administer Users', 'perm[canadminusers]', $usergroup['permissions'] & $_PERMISSION['canadminusers']); - $admin->row_yesno('Can Administer Usergroups', 'perm[canadmingroups]', $usergroup['permissions'] & $_PERMISSION['canadmingroups']); - $admin->row_yesno('Can Administer Settings / Maintenance Tools', 'perm[canadmintools]', $usergroup['permissions'] & $_PERMISSION['canadmintools']); + + // define permissions as groups + $permissions = array( + 'general' => array( + 'canviewbugs', + 'cansearch', + 'cansubscribe', + 'canbeassignedto'), + 'posting' => array( + 'canvote', + 'cansubmitbugs', + 'canpostcomments', + 'cangetattach', + 'canputattach'), + 'moderation' => array( + 'caneditown', + 'caneditothers', + 'caneditinfo', + 'canassign', + 'canchangestatus'), + 'admin' => array( + 'canadminpanel', + 'canadminbugs', + 'canadminfields', + 'canadminusers', + 'canadmingroups', + 'canadmintools') + ); + + $admin->table_head(phrase('usergroup_permission_settings')); + + foreach ($permissions AS $group => $settings) + { + $admin->row_span(phrase("permissions_group_$group"), 'thead', 'center'); + foreach ($settings AS $setting) + { + $admin->row_yesno(phrase("permissions_$setting"), "perm[$setting]", ($usergroup['permissions'] & $_PERMISSION["$setting"])); + } + } + $admin->table_end(); // Submit @@ -162,17 +176,6 @@ if ($_POST['do'] == 'insert') build_usergroups(); $admin->redirect('usergroup.php?do=modify'); - - /*echo '$permvalue = ' . $permissionvalue; - - echo '
'; - - foreach ($_PERMISSION AS $permtitle => $bitmask) - { - echo $permtitle . ' & $permvalue = ' . ($bitmask & $permissionvalue) . '
'; - } - - //print_r($_POST);*/ } // ################################################################### @@ -206,11 +209,11 @@ if ($_POST['do'] == 'update') if ($_REQUEST['do'] == 'modify') { - $admin->page_start('Usergroup Manager'); + $admin->page_start(phrase('usergroup_manager')); $admin->form_start('usergroup.php', 'null'); $admin->table_start(); - $admin->table_head('Usergroup Manager', 3); + $admin->table_head(phrase('usergroup_manager'), 3); $groups = $DB_sql->query("SELECT * FROM " . TABLE_PREFIX . "usergroup ORDER BY usergroupid ASC"); while ($group = $DB_sql->fetch_array($groups)) @@ -231,13 +234,13 @@ if ($_REQUEST['do'] == 'modify') $usergroups["$group[usergroupid]"]['total'] = $group['total']; } - $admin->table_column_head(array('Usergroup', 'Number of Users', 'Action')); + $admin->table_column_head(array(phrase('usergroup'), phrase('number_of_users'), phrase('action'))); foreach ($usergroups AS $group) { - $admin->row_multi_item(array("$group[title]" => 'l', iff(!$group['total'], '-', $group['total']) => 'c', "[Edit]" . iff($group['usergroupid'] > 6, "[Delete]") => 'c')); + $admin->row_multi_item(array("$group[title]" => 'l', iff(!$group['total'], '-', $group['total']) => 'c', "" . phrase('edit_wraplink') . "" . iff($group['usergroupid'] > 6, "" . phrase('delete_wraplink') . "") => 'c')); } - $admin->row_span('', 'tfoot', 'center', 3); + $admin->row_span('', 'tfoot', 'center', 3); $admin->table_end(); $admin->form_end(); diff --git a/docs/phrasetools.php b/docs/phrasetools.php index a92df2b..b174ab9 100644 --- a/docs/phrasetools.php +++ b/docs/phrasetools.php @@ -9,6 +9,8 @@ STR, 'phrasetext' => STR, 'matchmethod' => STR, 'do' => STR)); +sanitize(array('varname' => STR, 'phrasetext' => STR, 'matchmethod' => STR, 'do' => STR, 'doneinsert' => INT, 'oldvarname' => STR)); $use['varname'] = (bool)$_REQUEST['use']['varname']; $use['phrasetext'] = (bool)$_REQUEST['use']['phrasetext']; $use['and'] = iff($vars['matchmethod'] == 'and', true, false); @@ -28,14 +30,16 @@ $use['matcher'] = iff($use['and'], 'AND', 'OR'); $select['or'] = iff($use['or'], SELECTED); $select['and'] = iff($use['and'] , SELECTED); $select['search'] = iff($vars['do'] == 'search', SELECTED); -$select['insert'] = iff($vars['do'] == 'insert', SELECTED); +$select['insert'] = iff($vars['do'] == 'insert' OR $vars['doneinsert'], SELECTED); $select['delete'] = iff($vars['do'] == 'delete', SELECTED); -error_reporting(E_ALL & ~E_NOTICE); - -echo "

Input

\n
\n";
-var_dump($vars);
-echo "\n
\n\n
\n\n"; +function sanitize_name($name) +{ + $name = preg_replace('#[^a-zA-Z0-9_]#', '_', $name); + $name = preg_replace('#_{1,}#', '_', $name); + $name = preg_replace('#(^_|_$)#', '', $name); + return $name; +} // ################################################################### @@ -43,9 +47,9 @@ echo <<Search
-
Varname:
-
Phrase text:
-
+
Varname:
+
Phrase text:
+
Action: @@ -53,7 +57,7 @@ echo << Match Method: - +
@@ -95,10 +99,10 @@ if ($_POST['do'] == 'insert') INSERT INTO " . TABLE_PREFIX . "phrase (varname, phrasetext) VALUES - ('" . addslasheslike($vars['varname']) . "', '" . addslasheslike($vars['phrasetext']) . "' + ('" . addslasheslike(sanitize_name($vars['varname'])) . "', '" . addslasheslike($vars['phrasetext']) . "' )" ); - header("Location: phrasetools.php?do=edit&varname=$vars[varname]"); + header("Location: phrasetools.php?do=edit&doneinsert=1&varname=$vars[varname]"); } // ################################################################### @@ -107,9 +111,9 @@ if ($_POST['do'] == 'update') { $DB_sql->query(" UPDATE " . TABLE_PREFIX . "phrase - SET varname = '" . addslasheslike($vars['varname']) . "', + SET varname = '" . addslasheslike(sanitize_name($vars['varname'])) . "', phrasetext = '" . addslasheslike($vars['phrasetext']) . "' - WHERE varname = '" . addslasheslike($vars['varname']) . "'" + WHERE varname = '" . addslasheslike($vars['oldvarname']) . "'" ); header("Location: phrasetools.php?do=edit&varname=$vars[varname]"); } @@ -130,11 +134,12 @@ if ($_REQUEST['do'] == 'edit')
+
Varname:
Phrase text:
- +
diff --git a/includes/adminfunctions.php b/includes/adminfunctions.php index 8bc439d..3bdc1ae 100755 --- a/includes/adminfunctions.php +++ b/includes/adminfunctions.php @@ -39,17 +39,17 @@ class Admin_Print_Class EOD; - $this->page_start('Redirect', ':default:', 15, $js); + $this->page_start(phrase('redirect'), ':default:', 15, $js); - $this->page_message('Redirect', 'Please wait to be redirected. If you are not redirected in a few seconds, click here.'); + $this->page_message(phrase('redirect'), phrase('wait_to_be_redirected', $location)); $this->page_end(); } function error($message) { - $this->page_start('Error'); - $this->page_message('Error', $message); + $this->page_start(phrase('error')); + $this->page_message(phrase('Error'), $message); $this->page_end(); exit; @@ -60,7 +60,7 @@ EOD; // ################################################################### function page_start($actiontitle, $pageclass = ':default:', $pagemargin = 15, $extra = '', $onload = false, $margin = 0, $dotpath = '.') { - $title = 'Renapsus - Administration - ' . $actiontitle; + $title = 'Renapsus - ' . phrase('administration_x', $actiontitle); echo "\r"; echo "\r"; @@ -91,9 +91,9 @@ EOD; function page_confirm($message, $location) { - $this->page_start('Confirm'); + $this->page_start(phrase('confirm')); - $this->page_message('Confirm', $message . '

'); + $this->page_message(phrase('confirm'), $message . '

'); $this->page_end(); } @@ -293,7 +293,7 @@ EOD; { if ($submit === ':save:') { - $submit = " Save "; + $submit = " " . phrase('submit') . " "; } else { @@ -302,7 +302,7 @@ EOD; if ($reset === ':reset:') { - $reset = " Reset "; + $reset = " " . phrase('reset') . " "; } else { @@ -337,12 +337,12 @@ EOD; $listitem = ''; - $this->row_text($label, "\r" . iff($is_jump, "\r") . "\r", $colspan); + $this->row_text($label, "\r" . iff($is_jump, "\r") . "\r", $colspan); } function row_yesno($label, $name, $value, $colspan = 2) { - $this->row_text($label, " Yes No", $colspan); + $this->row_text($label, " " . phrase('yes') . " " . phrase('no'), $colspan); } } diff --git a/includes/functions.php b/includes/functions.php index 0aa6d32..e215732 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -36,7 +36,7 @@ function phrase() { for ($i = 1; $i < $numargs; $i++) { - $phrase = str_replace("%{$i}\$s", $args["$i"], $phrase); + $phrase = str_replace("%{$i}\$s", $args["$i"], $args[0]); } } } diff --git a/includes/init.php b/includes/init.php index ab316cb..2f72fb7 100755 --- a/includes/init.php +++ b/includes/init.php @@ -89,21 +89,40 @@ class BugTracker } } - // Load language system - if (file_exists("./locale/$language[filename]")) + $this->options['lang_id'] = $language['languageid']; + $this->options['lang_charset'] = $language['charset']; + $this->options['lang_dir'] = $language['direction']; + $this->options['lang_code'] = $language['languagecode']; + + /* + // can't use this because not everyone has MySQL >= 4.0.17 ... one day, one day + $phrases = $DB_sql->query(" + (SELECT varname, phrasetext FROM " . TABLE_PREFIX . "phrase) + UNION DISTINCT + (SELECT varname AS lvarname, phrasetext AS lphrasetext FROM " . TABLE_PREFIX . "locale AS locale WHERE languageid = " . $this->options['lang_id'] . ")" + ); + while ($phrase = $DB_sql->fetch_array($phrases)) { - require_once("./locale/$language[filename]"); - $this->language = $language; - $this->options['lang_charset'] = $cfg['charset']; - $this->options['lang_dir'] = $cfg['direction']; - $this->options['lang_code'] = $cfg['languagecode']; - unset($language); + $this->language["$phrase[varname]"] = $phrase['phrasetext']; } - else + $DB_sql->free_result($phrases); + */ + + // load master language + $phrases = $DB_sql->query("SELECT * FROM " . TABLE_PREFIX . "phrase"); + while ($phrase = $DB_sql->fetch_array($phrases)) { - echo "language file (locale/$language[filename]) could not be loaded!"; - exit; + $this->language["$phrase[varname]"] = $phrase['phrasetext']; + } + $DB_sql->free_result($phrases); + + // load locale data + $locale = $DB_sql->query("SELECT * FROM " . TABLE_PREFIX . "locale WHERE languageid = " . $this->options['lang_id']); + while ($phrase = $DB_sql->fetch_array($locale)) + { + $this->language["$phrase[varname]"] = $phrase['phrasetext']; } + $DB_sql->free_result($phrases); // get the templateset if ($this->userinfo['userid']) -- 2.43.5