From 8788f2c32dd251888e28f8727360c6cb0c8996be Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Wed, 17 Sep 2008 10:44:16 -0400 Subject: [PATCH] Squash-merging the ISSO3 branch back onto master --- admin/automation.php | 73 +-- admin/field.php | 95 ++- admin/global.php | 22 +- admin/index.php | 24 +- admin/language.php | 53 +- admin/permission.php | 48 +- admin/priority.php | 45 +- admin/product.php | 74 +-- admin/resolution.php | 45 +- admin/setting.php | 72 +-- admin/severity.php | 45 +- admin/status.php | 51 +- admin/user.php | 151 +++-- admin/usergroup.php | 103 ++- admin/userhelp.php | 29 +- attachment.php | 119 ++-- docs/cache_templates.php | 4 +- docs/datatools.php | 6 +- docs/dev_phases_2-0.txt | 50 ++ docs/mailtest.php | 33 +- docs/migrate_custom_fields.php | 4 +- docs/populate.php | 30 +- docs/post-commit.php | 10 +- docs/systemglob.php | 2 +- docs/update_bug_names.php | 4 +- docs/update_bug_table_cache.php | 2 +- docs/update_field_order_in_bugs.php | 6 +- docs/update_history.php | 2 +- editcomment.php | 81 ++- editreport.php | 102 ++- explain.php | 113 ++-- favorite.php | 42 +- global.php | 67 +- help.php | 17 +- includes/api_attachment.php | 87 +-- includes/api_automation.php | 117 ++-- includes/api_bug.php | 247 +++---- includes/api_comment.php | 126 ++-- includes/api_field.php | 158 +++-- includes/api_language.php | 131 ++-- includes/api_priority.php | 104 ++- includes/api_resolution.php | 104 ++- includes/api_severity.php | 103 ++- includes/api_status.php | 101 ++- includes/api_user.php | 291 ++++----- includes/api_usergroup.php | 120 ++-- includes/api_userhelp.php | 155 ++--- includes/auth/auth.php | 27 +- includes/auth/auth_default.php | 28 +- includes/auth/auth_drupal.php | 28 +- includes/auth/auth_phpbb2.php | 32 +- includes/auth/auth_vbulletin.php | 28 +- includes/class_admin_navigation.php | 10 +- includes/class_api_error.php | 96 --- includes/class_logging.php | 213 +++---- includes/class_message_reporter.php | 52 +- includes/class_mo.php | 15 +- includes/class_notification.php | 603 ++++++++---------- includes/class_sort.php | 384 +++++------ includes/config.php.new | 8 +- includes/emails.php | 223 +++++++ includes/framework | 2 +- includes/functions.php | 363 +++++------ includes/functions_datastore.php | 176 +++-- includes/functions_product.php | 125 ++-- includes/init.php | 102 ++- includes/language.php | 31 +- includes/pagination.php | 84 +++ includes/permissions.php | 12 +- includes/version.php | 8 +- index.php | 41 +- install/convert_database_charset.php | 21 +- install/default_data.php | 8 +- install/global.php | 18 +- install/install.css | 2 +- install/install.php | 34 +- install/schema.php | 8 +- install/settings.php | 8 +- install/upgrade.php | 16 +- install/upgrade1.php | 12 +- install/upgrade10.php | 12 +- install/upgrade11.php | 24 +- install/upgrade12.php | 14 +- install/upgrade13.php | 14 +- install/upgrade14.php | 12 +- install/upgrade15.php | 12 +- install/upgrade16.php | 12 +- install/upgrade17.php | 12 +- install/upgrade2.php | 32 +- install/upgrade3.php | 18 +- install/upgrade4.php | 12 +- install/upgrade5.php | 16 +- install/upgrade6.php | 12 +- install/upgrade7.php | 12 +- install/upgrade8.php | 12 +- install/upgrade9.php | 14 +- locale/en_US/emails/accountapproved.xml.tpl | 4 +- locale/en_US/emails/activateaccount.xml.tpl | 8 +- locale/en_US/emails/bugnotification.xml.tpl | 8 +- .../en_US/emails/notice_attachment.part.tpl | 2 +- locale/en_US/emails/notice_priority.part.tpl | 2 +- .../en_US/emails/notice_resolution.part.tpl | 2 +- locale/en_US/emails/notice_severity.part.tpl | 2 +- locale/en_US/emails/notice_status.part.tpl | 2 +- locale/en_US/emails/passwordreset.xml.tpl | 8 +- locale/en_US/emails/welcome.xml.tpl | 4 +- login.php | 80 ++- newreport.php | 111 ++-- register.php | 115 ++-- search.php | 322 +++++----- showhistory.php | 52 +- showreport.php | 162 +++-- syndicate.php | 24 +- templates/box.css | 2 +- templates/bugfield_input_checkbox.tpl | 8 +- templates/bugfield_input_text.tpl | 8 +- templates/bugfield_select_single.tpl | 8 +- templates/bugfield_static_text.tpl | 8 +- templates/editattach.tpl | 36 +- templates/editcomment.tpl | 44 +- templates/explain_automation.tpl | 16 +- templates/explain_product.tpl | 28 +- templates/explain_row.tpl | 6 +- templates/favorites.tpl | 22 +- templates/fields.css | 2 +- templates/footer.tpl | 2 +- templates/global.css | 2 +- templates/global.js | 2 +- templates/header.tpl | 54 +- templates/headinclude.tpl | 4 +- templates/help_link.tpl | 2 +- templates/help_window.tpl | 12 +- templates/history.tpl | 26 +- templates/history_bit.tpl | 12 +- templates/list_head.tpl | 2 +- templates/login.tpl | 26 +- templates/lostpassword.tpl | 24 +- templates/newattach.tpl | 58 +- templates/newreport.tpl | 92 +-- templates/pagenav.tpl | 10 +- templates/pagenav_bit.tpl | 2 +- templates/passwordreset.tpl | 36 +- templates/quicksearch.tpl | 24 +- templates/register.tpl | 42 +- templates/report.css | 2 +- templates/search.tpl | 108 ++-- templates/search_results.tpl | 38 +- templates/search_save.tpl | 34 +- templates/search_update.tpl | 60 +- templates/selectoptgroup.tpl | 4 +- templates/selectoption.tpl | 2 +- templates/showreport.tpl | 204 +++--- templates/showreport_attachment.tpl | 6 +- templates/showreport_comment.tpl | 28 +- templates/std_error.tpl | 18 +- templates/std_message.tpl | 40 +- templates/std_redirect.tpl | 22 +- templates/trackerhome.tpl | 24 +- templates/trackerhome_bits.tpl | 8 +- templates/userctrl.tpl | 184 +++--- templates/userctrl_column.tpl | 4 +- templates/userctrl_search.tpl | 8 +- templates/username_display.tpl | 2 +- userctrl.php | 182 +++--- viewattachment.php | 15 +- vote.php | 21 +- 166 files changed, 4310 insertions(+), 4758 deletions(-) create mode 100644 docs/dev_phases_2-0.txt delete mode 100644 includes/class_api_error.php create mode 100644 includes/emails.php create mode 100644 includes/pagination.php diff --git a/admin/automation.php b/admin/automation.php index 5d1ea04..16e8739 100644 --- a/admin/automation.php +++ b/admin/automation.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -22,7 +22,6 @@ require_once('./global.php'); require_once('./includes/api_automation.php'); -require_once('./includes/class_api_error.php'); APIError(array(new API_Error_Handler($admin), 'admin_error')); NavLinks::fieldsPages(); @@ -44,8 +43,8 @@ if (empty($_REQUEST['do'])) if ($_REQUEST['do'] == 'kill') { - $action = new AutomationAPI($bugsys); - $action->set('actionid', $bugsys->in['actionid']); + $action = new AutomationAPI(); + $action->set('actionid', $input->in['actionid']); $action->set_condition(); $action->delete(); @@ -56,7 +55,7 @@ if ($_REQUEST['do'] == 'kill') if ($_REQUEST['do'] == 'delete') { - $admin->page_confirm(T('Are you sure you want to delete this automation?'), 'automation.php', 'kill', array('actionid' => $bugsys->in['actionid'])); + $admin->page_confirm(T('Are you sure you want to delete this automation?'), 'automation.php', 'kill', array('actionid' => $input->in['actionid'])); } // ################################################################### @@ -65,9 +64,9 @@ if ($_POST['do'] == 'insert' OR $_POST['do'] == 'update') { $deltas = array('builtin' => array(), 'custom' => array()); - if (is_array($bugsys->in['fields'])) + if (is_array($input->in['fields'])) { - foreach ($bugsys->in['fields'] AS $key => $value) + foreach ($input->in['fields'] AS $key => $value) { if (!empty($value) AND $value != -1 AND !is_array($value)) { @@ -76,9 +75,9 @@ if ($_POST['do'] == 'insert' OR $_POST['do'] == 'update') } } - if (is_array($bugsys->in['fields']['custom'])) + if (is_array($input->in['fields']['custom'])) { - foreach ($bugsys->in['fields']['custom'] AS $key => $value) + foreach ($input->in['fields']['custom'] AS $key => $value) { if ($value != '' AND $value != -1) { @@ -87,11 +86,11 @@ if ($_POST['do'] == 'insert' OR $_POST['do'] == 'update') } } - $action = new AutomationAPI($bugsys); - $action->set('name', $bugsys->in['name']); - $action->set('description', $bugsys->in['description']); + $action = new AutomationAPI(); + $action->set('name', $input->in['name']); + $action->set('description', $input->in['description']); $action->set('fieldchanges', $deltas); - $action->set('comment', $bugsys->in['comment']); + $action->set('comment', $input->in['comment']); if ($_POST['do'] == 'insert') { @@ -101,7 +100,7 @@ if ($_POST['do'] == 'insert' OR $_POST['do'] == 'update') } else { - $action->set('actionid', $bugsys->in['actionid']); + $action->set('actionid', $input->in['actionid']); $action->set_condition(); $action->update(); @@ -118,14 +117,14 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit') if ($edit) { - NavLinks::automationsEdit($bugsys->in['actionid']); + NavLinks::automationsEdit($input->in['actionid']); $navigator->set_focus('link', 'fields-pages-automations', 'fields-pages'); - $action = new AutomationAPI($bugsys); - $action->set('actionid', $bugsys->in['actionid']); + $action = new AutomationAPI(); + $action->set('actionid', $input->in['actionid']); $action->set_condition(); $action->fetch(); - $action->objdata['fields'] = unserialize($action->objdata['fieldchanges']); + $action->record['fields'] = unserialize($action->record['fieldchanges']); } else { @@ -139,30 +138,30 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit') if ($edit) { - $admin->form_hidden_field('actionid', $action->objdata['actionid']); + $admin->form_hidden_field('actionid', $action->record['actionid']); } $admin->table_start(); $admin->table_head(($add ? T('New Automation') : T('Edit Automation'))); - $admin->row_input(T('Name'), 'name', $action->objdata['name']); - $admin->row_textarea(T('Description'), 'description', $action->objdata['description']); - $admin->row_textarea(T('Add Comment'), 'comment', $action->objdata['comment']); + $admin->row_input(T('Name'), 'name', $action->record['name']); + $admin->row_textarea(T('Description'), 'description', $action->record['description']); + $admin->row_textarea(T('Add Comment'), 'comment', $action->record['comment']); $admin->row_span(T('Field Changes'), 'thead', 'center'); // ------------------------------------------------------------------- // built-in fields - construct_datastore_select('severity', 'severity', 'severityid', $action->objdata['fields']['builtin']['severity'], true, true); + construct_datastore_select('severity', 'severity', 'severityid', $action->record['fields']['builtin']['severity'], true, true); $admin->row_list(T('Severity'), 'fields[severity]'); - construct_datastore_select('priority', 'priority', 'priorityid', $action->objdata['fields']['builtin']['priority'], true, true); + construct_datastore_select('priority', 'priority', 'priorityid', $action->record['fields']['builtin']['priority'], true, true); $admin->row_list(T('Priority'), 'fields[priority]'); - construct_datastore_select('status', 'status', 'statusid', $action->objdata['fields']['builtin']['status'], true, true); + construct_datastore_select('status', 'status', 'statusid', $action->record['fields']['builtin']['status'], true, true); $admin->row_list(T('Status'), 'fields[status]'); - construct_datastore_select('resolution', 'resolution', 'resolutionid', $action->objdata['fields']['builtin']['resolution'], true, true); + construct_datastore_select('resolution', 'resolution', 'resolutionid', $action->record['fields']['builtin']['resolution'], true, true); $admin->row_list(T('Resolution'), 'fields[resolution]'); $admin->row_span('', 'tcat', 'center'); @@ -170,29 +169,29 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit') // ------------------------------------------------------------------- // custom fields $fields_fetch = $db->query("SELECT * FROM " . TABLE_PREFIX . "bugfield ORDER BY fieldid ASC"); - while ($field = $db->fetch_array($fields_fetch)) + foreach ($fields_fetch as $field) { switch ($field['type']) { case 'input_text': - $admin->row_input($field['name'], "fields[custom][$field[fieldid]]", $action->objdata['fields']['custom']["$field[fieldid]"]); + $admin->row_input($field['name'], "fields[custom][$field[fieldid]]", $action->record['fields']['custom']["$field[fieldid]"]); break; case 'input_checkbox': - $admin->list_item('', -1, (!$action->objdata['fields']['custom']["$field[fieldid]"] OR $action->objdata['fields']['custom']["$field[fieldid]"] == -1)); - $admin->list_item(T('Checked'), 1, ($action->objdata['fields']['custom']["$field[fieldid]"] == 1)); - $admin->list_item(T('Un-Checked'), 0, (isset($action->objdata['fields']['custom']["$field[fieldid]"]) AND $action->objdata['fields']['custom']["$field[fieldid]"] == 0)); + $admin->list_item('', -1, (!$action->record['fields']['custom']["$field[fieldid]"] OR $action->record['fields']['custom']["$field[fieldid]"] == -1)); + $admin->list_item(T('Checked'), 1, ($action->record['fields']['custom']["$field[fieldid]"] == 1)); + $admin->list_item(T('Un-Checked'), 0, (isset($action->record['fields']['custom']["$field[fieldid]"]) AND $action->record['fields']['custom']["$field[fieldid]"] == 0)); $admin->row_list($field['name'], "fields[custom][$field[fieldid]]"); break; case 'select_single': $selectopts = unserialize($field['selects']); - $admin->list_item('', -1, (!isset($action->objdata['fields']['custom']["$field[fieldid]"]) OR $action->objdata['fields']['custom']["$field[fieldid]"] == -1)); + $admin->list_item('', -1, (!isset($action->record['fields']['custom']["$field[fieldid]"]) OR $action->record['fields']['custom']["$field[fieldid]"] == -1)); foreach ($selectopts AS $id => $select) { - $admin->list_item(stripslashes($select), $id, (isset($action->objdata['fields']['custom']["$field[fieldid]"]) AND $action->objdata['fields']['custom']["$field[fieldid]"] == $id)); + $admin->list_item(stripslashes($select), $id, (isset($action->record['fields']['custom']["$field[fieldid]"]) AND $action->record['fields']['custom']["$field[fieldid]"] == $id)); } $admin->row_list($field['name'], "fields[custom][$field[fieldid]]"); break; @@ -220,7 +219,7 @@ if ($_REQUEST['do'] == 'modify') $admin->table_head(T('Automations')); $actions = $db->query("SELECT * FROM " . TABLE_PREFIX . "automation ORDER BY name ASC"); - while ($action = $db->fetch_array($actions)) + foreach ($actions as $action) { $admin->row_text($action['name'] . "\n
$action[description]
", "[" . T('Edit') . "] [" . T('Delete') . "]"); } @@ -230,10 +229,4 @@ if ($_REQUEST['do'] == 'modify') $admin->page_end(); } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/admin/field.php b/admin/field.php index c27f40c..04e1fd8 100644 --- a/admin/field.php +++ b/admin/field.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -22,7 +22,6 @@ require_once('./global.php'); require_once('./includes/api_field.php'); -require_once('./includes/class_api_error.php'); APIError(array(new API_Error_Handler($admin), 'admin_error')); NavLinks::fieldsPages(); @@ -44,8 +43,8 @@ if (empty($_REQUEST['do'])) if ($_REQUEST['do'] == 'kill') { - $field = new FieldAPI($bugsys); - $field->set('fieldid', $bugsys->in['fieldid']); + $field = new FieldAPI(); + $field->set('fieldid', $input->in['fieldid']); $field->set_condition(); $field->delete(); @@ -56,7 +55,7 @@ if ($_REQUEST['do'] == 'kill') if ($_REQUEST['do'] == 'delete') { - $admin->page_confirm(T('Are you sure you want to delete this bug field? Doing so will remove everything for this field and it cannot be undone!'), 'field.php', 'kill', array('fieldid' => $bugsys->in['fieldid'])); + $admin->page_confirm(T('Are you sure you want to delete this bug field? Doing so will remove everything for this field and it cannot be undone!'), 'field.php', 'kill', array('fieldid' => $input->in['fieldid'])); } // ################################################################### @@ -66,19 +65,19 @@ if ($_REQUEST['do'] == 'update') $edit = false; $add = true; - $type = $bugsys->in['type']; + $type = $input->in['type']; - $field = new FieldAPI($bugsys); + $field = new FieldAPI(); - if ($bugsys->in['fieldid']) + if ($input->in['fieldid']) { - $field->set('fieldid', $bugsys->in['fieldid']); + $field->set('fieldid', $input->in['fieldid']); $field->set_condition(); $field->fetch(); $edit = true; $add = false; - $type = $field->objdata['type']; + $type = $field->record['type']; } else { @@ -88,25 +87,25 @@ if ($_REQUEST['do'] == 'update') switch ($type) { case 'input_text': - $field->set('defaultvalue', $bugsys->in['defaultvalue']); - $field->set('regexmatch', $bugsys->in['regexmatch']); - $field->set('maxlength', $bugsys->in['maxlength']); + $field->set('defaultvalue', $input->in['defaultvalue']); + $field->set('regexmatch', $input->in['regexmatch']); + $field->set('maxlength', $input->in['maxlength']); break; case 'input_checkbox': - $field->set('defaultvalue', $bugsys->in['defaultvalue']); + $field->set('defaultvalue', $input->in['defaultvalue']); break; case 'select_single': - $field->set('selects', $bugsys->in['selects']); - $field->set('usedefault', $bugsys->in['usedefault']); + $field->set('selects', $input->in['selects']); + $field->set('usedefault', $input->in['usedefault']); break; } - $field->set('name', $bugsys->in['name']); - $field->set('description', $bugsys->in['description']); - $field->set('required', $bugsys->in['required']); - $field->set('cansearch', $bugsys->in['cansearch']); + $field->set('name', $input->in['name']); + $field->set('description', $input->in['description']); + $field->set('required', $input->in['required']); + $field->set('cansearch', $input->in['cansearch']); if ($add) { @@ -122,8 +121,8 @@ if ($_REQUEST['do'] == 'update') $fieldid = $field->values['fieldid']; } - $bugsys->input_clean('custom', TYPE_UINT); - foreach ($bugsys->in['custom'] AS $usergroupid => $mask) + $input->inputClean('custom', TYPE_UINT); + foreach ($input->in['custom'] AS $usergroupid => $mask) { $values[] = $bugsys->clean($usergroupid, TYPE_UINT) . ", $fieldid, " . $mask; } @@ -142,10 +141,10 @@ if ($_REQUEST['do'] == 'update') if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit') { - $field = new FieldAPI($bugsys); + $field = new FieldAPI(); $add = (($_REQUEST['do'] == 'add') ? true : false); - $typeselect = (($add AND empty($bugsys->in['step'])) ? true : false); + $typeselect = (($add AND empty($input->in['step'])) ? true : false); $edit = (($add) ? false : true); if ($add) @@ -155,7 +154,7 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit') } else { - NavLinks::fieldsEdit($bugsys->in['fieldid']); + NavLinks::fieldsEdit($input->in['fieldid']); $navigator->set_focus('link', 'fields-pages-fields', 'fields-pages'); } @@ -163,7 +162,7 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit') $admin->form_start('field.php', ($typeselect ? 'add' : 'update')); if ($add AND !$typeselect) { - $admin->form_hidden_field('type', $bugsys->in['type']); + $admin->form_hidden_field('type', $input->in['type']); } if ($typeselect) { @@ -174,25 +173,25 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit') else { $admin->table_start(); - $admin->table_head(($add ? T('Add New Bug Field') . ' - ' . FieldAPI::field_types($bugsys->in['type']) : T('Edit Field'))); + $admin->table_head(($add ? T('Add New Bug Field') . ' - ' . FieldAPI::field_types($input->in['type']) : T('Edit Field'))); } if ($edit) { - $field->set('fieldid', $bugsys->in['fieldid']); + $field->set('fieldid', $input->in['fieldid']); $field->set_condition(); $field->fetch(); - $admin->form_hidden_field('fieldid', $field->objdata['fieldid']); + $admin->form_hidden_field('fieldid', $field->record['fieldid']); } if (!$typeselect) { - $type = (($add) ? $bugsys->in['type'] : $field->objdata['type']); + $type = (($add) ? $input->in['type'] : $field->record['type']); } // show type selector - if (empty($bugsys->in['step']) AND $add) + if (empty($input->in['step']) AND $add) { foreach (FieldAPI::field_types() AS $name => $description) { @@ -211,10 +210,10 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit') // global fields $admin->row_span(T('Global Fields'), 'thead', 'center'); $admin->row_text(T('Field Type'), FieldAPI::field_types($type)); - $admin->row_input(T('Display Name'), 'name', $field->objdata['name']); - $admin->row_textarea(T('Description'), 'description', $field->objdata['description']); - $admin->row_yesno(T('Required'), 'required', $field->objdata['required']); - $admin->row_yesno(T('Can Be Searched'), 'cansearch', ((isset($field->objdata['cansearch'])) ? $field->objdata['cansearch'] : true)); + $admin->row_input(T('Display Name'), 'name', $field->record['name']); + $admin->row_textarea(T('Description'), 'description', $field->record['description']); + $admin->row_yesno(T('Required'), 'required', $field->record['required']); + $admin->row_yesno(T('Can Be Searched'), 'cansearch', ((isset($field->record['cansearch'])) ? $field->record['cansearch'] : true)); // type-specific fields $admin->row_span(T('Type-Specific Fields'), 'thead', 'center'); @@ -222,18 +221,18 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit') switch ($type) { case 'input_text': - $admin->row_input(T('Default Value'), 'defaultvalue', $field->objdata['defaultvalue']); - $admin->row_input(T('Regular Expression Match'), 'regexmatch', $field->objdata['regexmatch']); - $admin->row_input(T('Maximum Length'), 'maxlength', $field->objdata['maxlength'], 2, 10); + $admin->row_input(T('Default Value'), 'defaultvalue', $field->record['defaultvalue']); + $admin->row_input(T('Regular Expression Match'), 'regexmatch', $field->record['regexmatch']); + $admin->row_input(T('Maximum Length'), 'maxlength', $field->record['maxlength'], 2, 10); break; case 'input_checkbox': - $admin->row_yesno(T('Checked By Default'), 'defaultvalue', $field->objdata['defaultvalue']); + $admin->row_yesno(T('Checked By Default'), 'defaultvalue', $field->record['defaultvalue']); break; case 'select_single': - $admin->row_textarea(T('Selection Values'), 'selects', stripslashes(implode("\n", (array)unserialize($field->objdata['selects'])))); - $admin->row_yesno(T('Make the First Option Default'), 'usedefault', $field->objdata['usedefault']); + $admin->row_textarea(T('Selection Values'), 'selects', stripslashes(implode("\n", (array)unserialize($field->record['selects'])))); + $admin->row_yesno(T('Make the First Option Default'), 'usedefault', $field->record['usedefault']); break; } @@ -245,15 +244,15 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit') if ($edit) { - $perms = $db->query("SELECT usergroupid, mask FROM " . TABLE_PREFIX . "bugfieldpermission WHERE fieldid = " . $field->objdata['fieldid']); - while ($perm = $db->fetch_array($perms)) + $perms = $db->query("SELECT usergroupid, mask FROM " . TABLE_PREFIX . "bugfieldpermission WHERE fieldid = " . $field->record['fieldid']); + foreach ($perms as $perm) { $permissions["$perm[usergroupid]"] = $perm['mask']; } } $usergroups = $db->query("SELECT * FROM " . TABLE_PREFIX . "usergroup ORDER BY usergroupid"); - while ($usergroup = $db->fetch_array($usergroups)) + foreach ($usergroups as $usergroup) { unset($listitem); $admin->list_item(T('No Permission'), 0, $permissions["$usergroup[usergroupid]"] == 0); @@ -288,7 +287,7 @@ if ($_REQUEST['do'] == 'modify') $admin->table_column_head(array(T('Display Name/Description'), T('Field ID'), T('Actions'))); $fields = $db->query("SELECT * FROM " . TABLE_PREFIX . "bugfield ORDER BY fieldid ASC"); - while ($field = $db->fetch_array($fields)) + foreach ($fields as $field) { $admin->row_multi_item( array( @@ -304,10 +303,4 @@ if ($_REQUEST['do'] == 'modify') $admin->page_end(); } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/admin/global.php b/admin/global.php index 89eacdf..9ba3117 100755 --- a/admin/global.php +++ b/admin/global.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -54,12 +54,12 @@ function admin_login() define('ISSO_PRINTER_NO_NAVIGATION', 1); - $admin->page_start(T('Login'), null, '', 'document.cplogin.' . ($bugsys->userinfo['email'] ? 'password' : 'email') . '.focus();'); + $admin->page_start(T('Login'), null, '', 'document.cplogin.' . (bugdar::$userinfo['email'] ? 'password' : 'email') . '.focus();'); $admin->form_start('../login.php', 'cplogin', false, 'cplogin'); $admin->table_start(true, '425'); $admin->table_head(T('Login to Bugdar')); - $admin->row_input(T('Email'), 'email', $bugsys->userinfo['email'], 2, 35, false, false, 'middle'); + $admin->row_input(T('Email'), 'email', bugdar::$userinfo['email'], 2, 35, false, false, 'middle'); $admin->row_input(T('Password'), 'password', '', 2, 35, false, true, 'middle'); $admin->row_submit('', T('Login')); $admin->table_end(); @@ -72,15 +72,15 @@ function admin_login() if (can_perform('canadminpanel')) { - $session = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "adminsession WHERE sessionid = '" . $bugsys->input_escape(COOKIE_PREFIX . 'adminsession') . "'"); - if ($session AND $session['userid'] == $bugsys->userinfo['userid'] AND $session['dateline'] >= (TIMENOW - 3600)) + $session = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "adminsession WHERE sessionid = '" . $bugsys->input_escape(COOKIE_PREFIX . 'adminsession') . "'"); + if ($session AND $session['userid'] == bugdar::$userinfo['userid'] AND $session['dateline'] >= (TIMENOW - 3600)) { // renew the cookie - $funct->cookie(COOKIE_PREFIX . 'adminsession', $session['sessionid'], false); + BSFunctions::cookie(COOKIE_PREFIX . 'adminsession', $session['sessionid'], false); } else { - $funct->cookie(COOKIE_PREFIX . 'adminsession', null); + BSFunctions::cookie(COOKIE_PREFIX . 'adminsession', false); admin_login(); // do we need this message? $admin->error(T('Invalid admin session has been terminated.')); @@ -88,7 +88,7 @@ if (can_perform('canadminpanel')) } else { - $funct->cookie(COOKIE_PREFIX . 'adminsession', null); + BSFunctions::cookie(COOKIE_PREFIX . 'adminsession', false); admin_login(); } @@ -158,10 +158,4 @@ function AdminPageNavigatorCallback($baselink, $nextpage, $prevpage, $show, $pag return '
' . $return . '
'; } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/admin/index.php b/admin/index.php index 4375764..10d1d24 100755 --- a/admin/index.php +++ b/admin/index.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -31,17 +31,17 @@ $admin->page_start(T('Home')); if (!(defined('NO_VERSION_CHECK') AND constant('NO_VERSION_CHECK') == true)) { - $check = @file_get_contents('http://www.bluestatic.org/versioncheck.php?prod=bugdar&ver=' . str_replace(' ', '-', $bugsys->options['trackerversion'])); + $check = @file_get_contents('http://www.bluestatic.org/versioncheck.php?prod=bugdar&ver=' . str_replace(' ', '-', bugdar::$options['trackerversion'])); if (strpos($check, '') !== false) { $check = $bugsys->xml->parse($check); if (isset($check['version-check']['update'])) { - $admin->page_code('
' . T('Update Avaliable') . ':
' . sprintf(T('Your installation of Bugdar is out-of-date. You are running version %1$s and the latest version is %2$s. You can download the update at Blue Static\'s website. You are strongly encouraged to apply all updates to fix bugs and any security issues (if present).'), $bugsys->options['trackerversion'], $check['version-check']['update']['value']) . '
'); + $admin->page_code('
' . T('Update Avaliable') . ':
' . sprintf(T('Your installation of Bugdar is out-of-date. You are running version %1$s and the latest version is %2$s. You can download the update at Blue Static\'s website. You are strongly encouraged to apply all updates to fix bugs and any security issues (if present).'), bugdar::$options['trackerversion'], $check['version-check']['update']['value']) . '
'); } else if (isset($check['version-check']['up-to-date'])) { - $admin->page_code('
' . T('Up-to-Date') . ':
' . sprintf(T('Your installation of Bugdar is up-to-date. You are running version %1$s.'), $bugsys->options['trackerversion']) . '
'); + $admin->page_code('
' . T('Up-to-Date') . ':
' . sprintf(T('Your installation of Bugdar is up-to-date. You are running version %1$s.'), bugdar::$options['trackerversion']) . '
'); } } } @@ -53,10 +53,10 @@ $admin->table_head(T('Welcome to the Bugdar Admin Panel')); // ------------------------------------------------------------------- $admin->row_span(T('Version Information'), 'thead'); -$admin->row_text(T('Bugdar Version'), $bugsys->options['trackerversion']); +$admin->row_text(T('Bugdar Version'), bugdar::$options['trackerversion']); $admin->row_text(T('PHP Version'), phpversion()); -$mysql = $db->query_first("SELECT VERSION() AS version"); +$mysql = $db->queryFirst("SELECT VERSION() AS version"); $admin->row_text(T('MySQL Version'), $mysql['version']); $admin->row_text(T('Web Server'), ($_SERVER['SERVER_SOFTWARE'] ? $_SERVER['SERVER_SOFTWARE'] : $SERVER['SERVER_SOFTWARE'])); @@ -64,12 +64,12 @@ $admin->row_text(T('Web Server'), ($_SERVER['SERVER_SOFTWARE'] ? $_SERVER['SERVE // ------------------------------------------------------------------- $admin->row_span(T('Server Options'), 'thead'); -$mysql = $db->query_first("SHOW VARIABLES LIKE 'max_allowed_packet'"); +$mysql = $db->queryFirst("SHOW VARIABLES LIKE 'max_allowed_packet'"); $admin->row_text(T('MySQL: Maximum Packet Size'), $mysql['Value']); -$admin->row_text(T('MySQL: Maximum Upload Size'), $funct->fetch_max_attachment_size()); +$admin->row_text(T('MySQL: Maximum Upload Size'), BSFunctions::fetch_max_php_file_size()); -$mysql = $db->query_first("SHOW VARIABLES LIKE 'ft_min_word_len'"); +$mysql = $db->queryFirst("SHOW VARIABLES LIKE 'ft_min_word_len'"); $admin->row_text(T('MySQL: Full-Text Search Minimum Word Length'), $mysql['Value']); $admin->row_text(T('PHP: Safe Mode'), ((ini_get('safe_mode') == 1 OR strtolower(ini_get('safe_mode')) == 'on') ? T('Yes') : T('No'))); @@ -84,10 +84,4 @@ $admin->table_end(); $admin->page_end(); -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/admin/language.php b/admin/language.php index fdad158..595e78a 100644 --- a/admin/language.php +++ b/admin/language.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -22,7 +22,6 @@ require_once('./global.php'); require_once('./includes/api_language.php'); -require_once('./includes/class_api_error.php'); APIError(array(new API_Error_Handler($admin), 'admin_error')); NavLinks::optionsPages(); @@ -44,8 +43,8 @@ if (empty($_REQUEST['do'])) if ($_REQUEST['do'] == 'kill') { - $language = new LanguageAPI($bugsys); - $language->set('languageid', $bugsys->in['languageid']); + $language = new LanguageAPI(); + $language->set('languageid', $input->in['languageid']); $language->set_condition(); $language->delete(); @@ -56,19 +55,19 @@ if ($_REQUEST['do'] == 'kill') if ($_REQUEST['do'] == 'delete') { - $admin->page_confirm(T('Are you sure you want to delete this language?'), 'language.php', 'kill', array('languageid' => $bugsys->input_clean('languageid', TYPE_UINT))); + $admin->page_confirm(T('Are you sure you want to delete this language?'), 'language.php', 'kill', array('languageid' => $input->inputClean('languageid', TYPE_UINT))); } // ################################################################### if ($_POST['do'] == 'insert') { - $language = new LanguageAPI($bugsys); - $language->set('title', $bugsys->in['title']); - $language->set('charset', $bugsys->in['charset']); - $language->set('direction', $bugsys->in['direction']); - $language->set('userselect', $bugsys->in['userselect']); - $language->set('langcode', $bugsys->in['langcode']); + $language = new LanguageAPI(); + $language->set('title', $input->in['title']); + $language->set('charset', $input->in['charset']); + $language->set('direction', $input->in['direction']); + $language->set('userselect', $input->in['userselect']); + $language->set('langcode', $input->in['langcode']); $language->insert(); $admin->redirect('language.php?do=modify'); @@ -106,14 +105,14 @@ if ($_REQUEST['do'] == 'add') if ($_POST['do'] == 'update') { - $language = new LanguageAPI($bugsys); - $language->set('languageid', $bugsys->in['languageid']); + $language = new LanguageAPI(); + $language->set('languageid', $input->in['languageid']); $language->set_condition(); - $language->set('title', $bugsys->in['title']); - $language->set('charset', $bugsys->in['charset']); - $language->set('direction', $bugsys->in['direction']); - $language->set('userselect', $bugsys->in['userselect']); - $language->set('langcode', $bugsys->in['langcode']); + $language->set('title', $input->in['title']); + $language->set('charset', $input->in['charset']); + $language->set('direction', $input->in['direction']); + $language->set('userselect', $input->in['userselect']); + $language->set('langcode', $input->in['langcode']); $language->update(); $admin->redirect('language.php?do=modify'); @@ -123,15 +122,15 @@ if ($_POST['do'] == 'update') if ($_REQUEST['do'] == 'edit') { - NavLinks::languagesEdit($bugsys->in['languageid']); + NavLinks::languagesEdit($input->in['languageid']); $navigator->set_focus('link', 'options-languages-edit', 'options-languages'); - $languageapi = new LanguageAPI($bugsys); - $languageapi->set('languageid', $bugsys->in['languageid']); + $languageapi = new LanguageAPI(); + $languageapi->set('languageid', $input->in['languageid']); $languageapi->set_condition(); $languageapi->fetch(); - $language =& $languageapi->objdata; + $language =& $languageapi->record; $admin->page_start(T('Edit Language')); @@ -171,12 +170,12 @@ if ($_REQUEST['do'] == 'modify') $admin->table_column_head(array(T('Title'), T('Language Code / Charset'), T('Options'))); $languages = $db->query("SELECT * FROM " . TABLE_PREFIX . "language ORDER BY languageid ASC"); - while ($language = $db->fetch_array($languages)) + foreach ($languages as $language) { $admin->row_multi_item(array( "$language[title]" => 'l', $language['langcode'] . ' / ' . $language['charset'] => 'c', - (($bugsys->options['defaultlanguage'] == $language['languageid']) ? '' . T('DEFAULT LANGUAGE') . ' / ' : '') . ($language['userselect'] ? T('User Selectable') : T('Private')) => 'c' + ((bugdar::$options['defaultlanguage'] == $language['languageid']) ? '' . T('DEFAULT LANGUAGE') . ' / ' : '') . ($language['userselect'] ? T('User Selectable') : T('Private')) => 'c' )); } @@ -185,10 +184,4 @@ if ($_REQUEST['do'] == 'modify') $admin->page_end(); } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/admin/permission.php b/admin/permission.php index 43ffea9..591b675 100755 --- a/admin/permission.php +++ b/admin/permission.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -75,32 +75,32 @@ if (empty($_REQUEST['do'])) if ($_REQUEST['do'] == 'kill') { - $bugsys->input_clean('usergroupid', TYPE_UINT); - $db->query("DELETE FROM " . TABLE_PREFIX . "permission WHERE usergroupid = " . $bugsys->in['usergroupid'] . " AND productid = " . $bugsys->input_clean('productid', TYPE_UINT)); + $input->inputClean('usergroupid', TYPE_UINT); + $db->query("DELETE FROM " . TABLE_PREFIX . "permission WHERE usergroupid = " . $input->in['usergroupid'] . " AND productid = " . $input->inputClean('productid', TYPE_UINT)); build_permissions(); - $admin->redirect('permission.php?do=modify&usergroupid=' . $bugsys->in['usergroupid']); + $admin->redirect('permission.php?do=modify&usergroupid=' . $input->in['usergroupid']); } // ################################################################### if ($_REQUEST['do'] == 'delete') { - $admin->page_confirm(T('Are you sure you want to revert this permission mask?'), 'permission.php', 'kill', array('usergroupid' => $bugsys->input_clean('usergroupid', TYPE_UINT), 'productid' => $bugsys->input_clean('productid', TYPE_UINT))); + $admin->page_confirm(T('Are you sure you want to revert this permission mask?'), 'permission.php', 'kill', array('usergroupid' => $input->inputClean('usergroupid', TYPE_UINT), 'productid' => $input->inputClean('productid', TYPE_UINT))); } // ################################################################### if ($_REQUEST['do'] == 'edit') { - $bugsys->input_clean_array(array( + $input->inputClean_array(array( 'usergroupid' => TYPE_UINT, 'productid' => TYPE_UINT )); - $perm = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "permission WHERE usergroupid = " . $bugsys->in['usergroupid'] . " AND productid = " . $bugsys->in['productid']); - $usergroup = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "usergroup WHERE usergroupid = " . $bugsys->in['usergroupid']); - $product = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "product WHERE productid = " . $bugsys->in['productid']); + $perm = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "permission WHERE usergroupid = " . $input->in['usergroupid'] . " AND productid = " . $input->in['productid']); + $usergroup = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "usergroup WHERE usergroupid = " . $input->in['usergroupid']); + $product = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "product WHERE productid = " . $input->in['productid']); if (!$usergroup OR !$product) { @@ -132,7 +132,7 @@ if ($_REQUEST['do'] == 'edit') $admin->row_span($group, 'thead', 'center'); foreach ($settings AS $setting => $name) { - $admin->row_yesno($name, "perm[$setting]", ($mask & $bugsys->permissions["$setting"])); + $admin->row_yesno($name, "perm[$setting]", ($mask & bugdar::$permissions["$setting"])); } } @@ -146,29 +146,29 @@ if ($_REQUEST['do'] == 'edit') if ($_POST['do'] == 'update') { - $bugsys->input_clean_array(array( + $input->inputClean_array(array( 'perm' => TYPE_UINT, 'usergroupid' => TYPE_UINT, 'productid' => TYPE_UINT )); - foreach ($bugsys->in['perm'] AS $permtitle => $binaryswitch) + foreach ($input->in['perm'] AS $permtitle => $binaryswitch) { - $permissionvalue += $bugsys->permissions["$permtitle"] * $binaryswitch; + $permissionvalue += bugdar::$permissions["$permtitle"] * $binaryswitch; } $db->query(" REPLACE INTO " . TABLE_PREFIX . "permission (usergroupid, productid, mask) VALUES - (" . $bugsys->in['usergroupid'] . ", - " . $bugsys->in['productid'] . ", + (" . $input->in['usergroupid'] . ", + " . $input->in['productid'] . ", $permissionvalue )" ); build_permissions(); - $admin->redirect('permission.php?do=modify&usergroupid=' . $bugsys->in['usergroupid']); + $admin->redirect('permission.php?do=modify&usergroupid=' . $input->in['usergroupid']); } // ################################################################### @@ -181,7 +181,7 @@ if ($_REQUEST['do'] == 'modify') $admin->table_head(T('Permission Manager')); $groups = $db->query("SELECT * FROM " . TABLE_PREFIX . "usergroup ORDER BY usergroupid ASC"); - while ($group = $db->fetch_array($groups)) + foreach ($groups as $group) { $usergroups["$group[usergroupid]"] = $group; } @@ -189,18 +189,18 @@ if ($_REQUEST['do'] == 'modify') foreach ($usergroups AS $group) { - $admin->row_text($group['title'], ($bugsys->in['usergroupid'] != $group['usergroupid'] ? "[" . T('Expand') . "]" : ''), 'top', 2, 'alt3'); + $admin->row_text($group['title'], ($input->in['usergroupid'] != $group['usergroupid'] ? "[" . T('Expand') . "]" : ''), 'top', 2, 'alt3'); - if ($bugsys->in['usergroupid'] == $group['usergroupid']) + if ($input->in['usergroupid'] == $group['usergroupid']) { $permissions_fetch = $db->query("SELECT * FROM " . TABLE_PREFIX . "permission WHERE usergroupid = $group[usergroupid]"); - while ($permission = $db->fetch_array($permissions_fetch)) + foreach ($permissions_fetch as $permission) { $permissions["$permission[productid]"] = $permission['mask']; } $products_fetch = $db->query("SELECT * FROM " . TABLE_PREFIX . "product WHERE !parentid OR parentid IS NULL ORDER BY displayorder ASC"); - while ($product = $db->fetch_array($products_fetch)) + foreach ($products_fetch as $product) { $groupid = $group['usergroupid']; $prodid = $product['productid']; @@ -227,10 +227,4 @@ if ($_REQUEST['do'] == 'modify') $admin->page_end(); } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/admin/priority.php b/admin/priority.php index 93bc424..0078ac7 100755 --- a/admin/priority.php +++ b/admin/priority.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -22,7 +22,6 @@ require_once('./global.php'); require_once('./includes/api_priority.php'); -require_once('./includes/class_api_error.php'); APIError(array(new API_Error_Handler($admin), 'admin_error')); NavLinks::fieldsPages(); @@ -44,8 +43,8 @@ if (empty($_REQUEST['do'])) if ($_REQUEST['do'] == 'kill') { - $priority = new PriorityAPI($bugsys); - $priority->set('priorityid', $bugsys->in['priorityid']); + $priority = new PriorityAPI(); + $priority->set('priorityid', $input->in['priorityid']); $priority->set_condition(); $priority->delete(); @@ -56,16 +55,16 @@ if ($_REQUEST['do'] == 'kill') if ($_REQUEST['do'] == 'delete') { - $admin->page_confirm(T('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', 'kill', array('priorityid' => $bugsys->input_clean('priorityid', TYPE_UINT))); + $admin->page_confirm(T('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', 'kill', array('priorityid' => $input->inputClean('priorityid', TYPE_UINT))); } // ################################################################### if ($_POST['do'] == 'insert') { - $priority = new PriorityAPI($bugsys); - $priority->set('priority', $bugsys->in['priority']); - $priority->set('displayorder', $bugsys->in['displayorder']); + $priority = new PriorityAPI(); + $priority->set('priority', $input->in['priority']); + $priority->set('displayorder', $input->in['displayorder']); $priority->insert(); $admin->redirect('priority.php?do=modify'); @@ -96,11 +95,11 @@ if ($_REQUEST['do'] == 'add') if ($_POST['do'] == 'update') { - $priority = new PriorityAPI($bugsys); - $priority->set('priorityid', $bugsys->in['priorityid']); + $priority = new PriorityAPI(); + $priority->set('priorityid', $input->in['priorityid']); $priority->set_condition(); - $priority->set('priority', $bugsys->in['priority']); - $priority->set('displayorder', $bugsys->in['displayorder']); + $priority->set('priority', $input->in['priority']); + $priority->set('displayorder', $input->in['displayorder']); $priority->update(); $admin->redirect('priority.php?do=modify'); @@ -110,22 +109,22 @@ if ($_POST['do'] == 'update') if ($_REQUEST['do'] == 'edit') { - NavLinks::prioritiesEdit($bugsys->in['priorityid']); + NavLinks::prioritiesEdit($input->in['priorityid']); $navigator->set_focus('link', 'fields-pages-priorities', 'fields-pages'); - $priority = new PriorityAPI($bugsys); - $priority->set('priorityid', $bugsys->in['priorityid']); + $priority = new PriorityAPI(); + $priority->set('priorityid', $input->in['priorityid']); $priority->set_condition(); $priority->fetch(); $admin->page_start(T('Edit Priority')); $admin->form_start('priority.php', 'update'); - $admin->form_hidden_field('priorityid', $priority->objdata['priorityid']); + $admin->form_hidden_field('priorityid', $priority->record['priorityid']); $admin->table_start(); - $admin->table_head(sprintf(T('Edit Priority `%1$s` (id: %2$s)'), $priority->objdata['priority'], $priority->objdata['priorityid'])); - $admin->row_input(T('Priority Title
The title of this priority flag (eg: `Slated for Development` or `Address Now`)
'), 'priority', $priority->objdata['priority']); - $admin->row_input(T('Display Order
The order in which the priorities are displayed. The higher the number, the lower down in the list it is.
'), 'displayorder', $priority->objdata['displayorder']); + $admin->table_head(sprintf(T('Edit Priority `%1$s` (id: %2$s)'), $priority->record['priority'], $priority->record['priorityid'])); + $admin->row_input(T('Priority Title
The title of this priority flag (eg: `Slated for Development` or `Address Now`)
'), 'priority', $priority->record['priority']); + $admin->row_input(T('Display Order
The order in which the priorities are displayed. The higher the number, the lower down in the list it is.
'), 'displayorder', $priority->record['displayorder']); $admin->row_submit(); $admin->table_end(); $admin->form_end(); @@ -148,7 +147,7 @@ if ($_REQUEST['do'] == 'modify') $admin->table_start(); $admin->table_head(T('Priority Manager')); - while ($priority = $db->fetch_array($priorities)) + foreach ($priorities as $priority) { $admin->row_text("$priority[displayorder]: $priority[priority]", "(priorityid: $priority[priorityid]) [" . T('Edit') . "] [" . T('Delete') . "]"); } @@ -160,10 +159,4 @@ if ($_REQUEST['do'] == 'modify') $admin->page_end(); } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/admin/product.php b/admin/product.php index 82705fd..16d344d 100755 --- a/admin/product.php +++ b/admin/product.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -79,9 +79,9 @@ if (empty($_REQUEST['do'])) if ($_REQUEST['do'] == 'killversion') { - $bugsys->input_clean('versionid', TYPE_UINT); - $db->query("DELETE FROM " . TABLE_PREFIX . "version WHERE versionid = " . $bugsys->in['versionid']); - $db->query("DELETE FROM " . TABLE_PREFIX . "bug WHERE version = " . $bugsys->in['versionid']); + $input->inputClean('versionid', TYPE_UINT); + $db->query("DELETE FROM " . TABLE_PREFIX . "version WHERE versionid = " . $input->in['versionid']); + $db->query("DELETE FROM " . TABLE_PREFIX . "bug WHERE version = " . $input->in['versionid']); build_versions(); @@ -92,14 +92,14 @@ if ($_REQUEST['do'] == 'killversion') if ($_REQUEST['do'] == 'deleteversion') { - $admin->page_confirm(T('Are you sure you want to delete this version? Doing so will do delete all the bugs with this version.'), 'product.php', 'killversion', array('versionid' => $bugsys->input_clean('versionid', TYPE_UINT))); + $admin->page_confirm(T('Are you sure you want to delete this version? Doing so will do delete all the bugs with this version.'), 'product.php', 'killversion', array('versionid' => $input->inputClean('versionid', TYPE_UINT))); } // ################################################################### if ($_REQUEST['do'] == 'insertversion') { - $db->query("INSERT INTO " . TABLE_PREFIX . "version (productid, version, displayorder, obsolete) VALUES (" . $bugsys->input_clean('productid', TYPE_UINT) . ", '" . $bugsys->input_escape('version') . "', " . $bugsys->input_clean('displayorder', TYPE_UINT) . ", " . $bugsys->input_clean('obsolete', TYPE_UINT) . ")"); + $db->query("INSERT INTO " . TABLE_PREFIX . "version (productid, version, displayorder, obsolete) VALUES (" . $input->inputClean('productid', TYPE_UINT) . ", '" . $bugsys->input_escape('version') . "', " . $input->inputClean('displayorder', TYPE_UINT) . ", " . $input->inputClean('obsolete', TYPE_UINT) . ")"); build_versions(); $admin->redirect('product.php?do=modify'); } @@ -108,12 +108,12 @@ if ($_REQUEST['do'] == 'insertversion') if ($_REQUEST['do'] == 'addversion') { - NavLinks::productsEdit($bugsys->input_clean('productid', TYPE_UINT)); + NavLinks::productsEdit($input->inputClean('productid', TYPE_UINT)); $navigator->set_focus('link', 'products-edit-version', 'products-edit'); - if ($bugsys->in['productid'] != -1) + if ($input->in['productid'] != -1) { - $product = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "product WHERE productid = " . $bugsys->in['productid']); + $product = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "product WHERE productid = " . $input->in['productid']); if (!is_array($product)) { $admin->error(L_INVALID_ID); @@ -121,13 +121,13 @@ if ($_REQUEST['do'] == 'addversion') } else { - $bugsys->in['productid'] = 0; + $input->in['productid'] = 0; } $admin->page_start(T('Add Version')); $admin->form_start('product.php', 'insertversion'); - $admin->form_hidden_field('productid', $bugsys->in['productid']); + $admin->form_hidden_field('productid', $input->in['productid']); $admin->table_start(); $admin->table_head(T('Add New Version')); $admin->row_input(T('Version Number
This is the version string for this product.
'), 'version'); @@ -144,12 +144,12 @@ if ($_REQUEST['do'] == 'addversion') if ($_REQUEST['do'] == 'updateversion') { - if (empty($bugsys->in['version'])) + if (empty($input->in['version'])) { $admin->error(T('Please fill in a version number.')); } - $db->query("UPDATE " . TABLE_PREFIX . "version SET version = '" . $bugsys->input_escape('version') . "', displayorder = " . $bugsys->input_clean('displayorder', TYPE_UINT) . ", obsolete = " . $bugsys->input_clean('obsolete', TYPE_UINT) . " WHERE versionid = " . $bugsys->input_clean('versionid', TYPE_UINT)); + $db->query("UPDATE " . TABLE_PREFIX . "version SET version = '" . $bugsys->input_escape('version') . "', displayorder = " . $input->inputClean('displayorder', TYPE_UINT) . ", obsolete = " . $input->inputClean('obsolete', TYPE_UINT) . " WHERE versionid = " . $input->inputClean('versionid', TYPE_UINT)); build_versions(); $admin->redirect('product.php?do=modify'); @@ -161,7 +161,7 @@ if ($_REQUEST['do'] == 'editversion') { $admin->page_start(T('Edit Version')); - $version = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "version WHERE versionid = " . $bugsys->input_clean('versionid', TYPE_UINT)); + $version = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "version WHERE versionid = " . $input->inputClean('versionid', TYPE_UINT)); if (!is_array($version)) { $admin->error(L_INVALID_ID); @@ -185,9 +185,9 @@ if ($_REQUEST['do'] == 'editversion') if ($_REQUEST['do'] == 'killproduct') { - $bugsys->input_clean('productid', TYPE_UINT); - $allprods = $db->query("SELECT * FROM " . TABLE_PREFIX . "product WHERE productid = " . $bugsys->in['productid'] . " OR parentid = " . $bugsys->in['productid']); - while ($prod = $db->fetch_array($allprods)) + $input->inputClean('productid', TYPE_UINT); + $allprods = $db->query("SELECT * FROM " . TABLE_PREFIX . "product WHERE productid = " . $input->in['productid'] . " OR parentid = " . $input->in['productid']); + foreach ($allprods as $prod) { $list[] = $prod['productid']; } @@ -205,14 +205,14 @@ if ($_REQUEST['do'] == 'killproduct') if ($_REQUEST['do'] == 'deleteproduct') { - $admin->page_confirm(T('Are you sure you want to delete this product and all of it\'s versions and components and any bugs that have been assigned those products or components?'), 'product.php', 'killproduct', array('productid' => $bugsys->input_clean('productid', TYPE_UINT))); + $admin->page_confirm(T('Are you sure you want to delete this product and all of it\'s versions and components and any bugs that have been assigned those products or components?'), 'product.php', 'killproduct', array('productid' => $input->inputClean('productid', TYPE_UINT))); } // ################################################################### if ($_REQUEST['do'] == 'insertproduct') { - if (empty($bugsys->in['title'])) + if (empty($input->in['title'])) { $admin->error(T('Please go back and fill in the title field.')); } @@ -221,8 +221,8 @@ if ($_REQUEST['do'] == 'insertproduct') INSERT INTO " . TABLE_PREFIX . "product (title, parentid, description, displayorder) VALUES - ('" . $bugsys->input_escape('title') . "', " . $bugsys->input_clean('parentid', TYPE_UINT) . ", - '" . $bugsys->input_escape('description') . "', " . $bugsys->input_clean('displayorder', TYPE_UINT) . " + ('" . $bugsys->input_escape('title') . "', " . $input->inputClean('parentid', TYPE_UINT) . ", + '" . $bugsys->input_escape('description') . "', " . $input->inputClean('displayorder', TYPE_UINT) . " )" ); build_products(); @@ -234,9 +234,9 @@ if ($_REQUEST['do'] == 'insertproduct') if ($_REQUEST['do'] == 'addproduct') { - if ($bugsys->input_clean('productid', TYPE_UINT)) + if ($input->inputClean('productid', TYPE_UINT)) { - NavLinks::productsEdit($bugsys->in['productid']); + NavLinks::productsEdit($input->in['productid']); } else { @@ -247,7 +247,7 @@ if ($_REQUEST['do'] == 'addproduct') $admin->page_start(T('Add New Product')); $admin->form_start('product.php', 'insertproduct'); - $admin->form_hidden_field('parentid', $bugsys->in['productid']); + $admin->form_hidden_field('parentid', $input->in['productid']); $admin->table_start(); $admin->table_head(T('Add Product')); $admin->row_input(T('Title'), 'title'); @@ -264,17 +264,17 @@ if ($_REQUEST['do'] == 'addproduct') if ($_REQUEST['do'] == 'updateproduct') { - if (empty($bugsys->in['title'])) + if (empty($input->in['title'])) { $admin->error(T('Please go back and fill in the title field.')); } - if (empty($bugsys->in['productid'])) + if (empty($input->in['productid'])) { $admin->error(L_INVALID_ID); } - $db->query("UPDATE " . TABLE_PREFIX . "product SET title = '" . $bugsys->input_escape('title') . "', description = '" . $bugsys->input_escape('description') . "', displayorder = " . $bugsys->input_clean('displayorder', TYPE_UINT) . " WHERE productid = " . $bugsys->input_clean('productid', TYPE_UINT)); + $db->query("UPDATE " . TABLE_PREFIX . "product SET title = '" . $bugsys->input_escape('title') . "', description = '" . $bugsys->input_escape('description') . "', displayorder = " . $input->inputClean('displayorder', TYPE_UINT) . " WHERE productid = " . $input->inputClean('productid', TYPE_UINT)); build_products(); $admin->redirect('product.php?do=modify'); @@ -284,12 +284,12 @@ if ($_REQUEST['do'] == 'updateproduct') if ($_REQUEST['do'] == 'editproduct') { - NavLinks::productsEdit($bugsys->input_clean('productid', TYPE_UINT)); + NavLinks::productsEdit($input->inputClean('productid', TYPE_UINT)); $navigator->set_focus('link', 'products-edit', 'products-edit'); $admin->page_start(T('Edit Product')); - $product = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "product WHERE productid = " . $bugsys->in['productid']); + $product = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "product WHERE productid = " . $input->in['productid']); if (!is_array($product)) { $admin->error(L_INVALID_ID); @@ -313,10 +313,10 @@ if ($_REQUEST['do'] == 'editproduct') if ($_POST['do'] == 'displayorder') { - $bugsys->input_clean('displayorder', TYPE_UINT); - if (is_array($bugsys->in['displayorder'])) + $input->inputClean('displayorder', TYPE_UINT); + if (is_array($input->in['displayorder'])) { - foreach ($bugsys->in['displayorder'] AS $namebit => $displayorder) + foreach ($input->in['displayorder'] AS $namebit => $displayorder) { $name = explode('_', $namebit); if ($name[0] == 'product' OR $name[0] == 'version') @@ -357,7 +357,7 @@ EOF; $products_get = $db->query("SELECT * FROM " . TABLE_PREFIX . "product ORDER BY displayorder ASC"); $products = array(); - while ($prod = $db->fetch_array($products_get)) + foreach ($products_get as $prod) { if (!$prod['parentid']) { @@ -372,7 +372,7 @@ EOF; $versions_get = $db->query("SELECT * FROM " . TABLE_PREFIX . "version ORDER BY displayorder ASC"); $versions = array(); - while ($vers = $db->fetch_array($versions_get)) + foreach ($versions_get as $vers) { $versions["$vers[productid]"]["$vers[versionid]"] = $vers; } @@ -433,10 +433,4 @@ EOF; $admin->page_end(); } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/admin/resolution.php b/admin/resolution.php index 1f8d389..bdf08db 100755 --- a/admin/resolution.php +++ b/admin/resolution.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -22,7 +22,6 @@ require_once('./global.php'); require_once('./includes/api_resolution.php'); -require_once('./includes/class_api_error.php'); APIError(array(new API_Error_Handler($admin), 'admin_error')); NavLinks::fieldsPages(); @@ -44,8 +43,8 @@ if (empty($_REQUEST['do'])) if ($_REQUEST['do'] == 'kill') { - $resolution = new ResolutionAPI($bugsys); - $resolution->set('resolutionid', $bugsys->in['resolutionid']); + $resolution = new ResolutionAPI(); + $resolution->set('resolutionid', $input->in['resolutionid']); $resolution->set_condition(); $resolution->delete(); @@ -56,16 +55,16 @@ if ($_REQUEST['do'] == 'kill') if ($_REQUEST['do'] == 'delete') { - $admin->page_confirm(T('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', 'kill', array('resolutionid' => $bugsys->input_clean('resolutionid', TYPE_UINT))); + $admin->page_confirm(T('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', 'kill', array('resolutionid' => $input->inputClean('resolutionid', TYPE_UINT))); } // ################################################################### if ($_POST['do'] == 'insert') { - $resolution = new ResolutionAPI($bugsys); - $resolution->set('resolution', $bugsys->in['resolution']); - $resolution->set('displayorder', $bugsys->in['displayorder']); + $resolution = new ResolutionAPI(); + $resolution->set('resolution', $input->in['resolution']); + $resolution->set('displayorder', $input->in['displayorder']); $resolution->insert(); $admin->redirect('resolution.php?do=modify'); @@ -96,11 +95,11 @@ if ($_REQUEST['do'] == 'add') if ($_POST['do'] == 'update') { - $resolution = new ResolutionAPI($bugsys); - $resolution->set('resolutionid', $bugsys->in['resolutionid']); + $resolution = new ResolutionAPI(); + $resolution->set('resolutionid', $input->in['resolutionid']); $resolution->set_condition(); - $resolution->set('resolution', $bugsys->in['resolution']); - $resolution->set('displayorder', $bugsys->in['displayorder']); + $resolution->set('resolution', $input->in['resolution']); + $resolution->set('displayorder', $input->in['displayorder']); $resolution->update(); $admin->redirect('resolution.php?do=modify'); @@ -110,22 +109,22 @@ if ($_POST['do'] == 'update') if ($_REQUEST['do'] == 'edit') { - NavLinks::resolutionsEdit($bugsys->in['resolutionid']); + NavLinks::resolutionsEdit($input->in['resolutionid']); $navigator->set_focus('link', 'fields-pages-resolutions', 'fields-pages'); - $resolution = new ResolutionAPI($bugsys); - $resolution->set('resolutionid', $bugsys->in['resolutionid']); + $resolution = new ResolutionAPI(); + $resolution->set('resolutionid', $input->in['resolutionid']); $resolution->set_condition(); $resolution->fetch(); $admin->page_start(T('Edit Resolution')); $admin->form_start('resolution.php', 'update'); - $admin->form_hidden_field('resolutionid', $resolution->objdata['resolutionid']); + $admin->form_hidden_field('resolutionid', $resolution->record['resolutionid']); $admin->table_start(); - $admin->table_head(sprintf(T('Edit Resolution - %1$s (id: %2$s)'), $resolution->objdata['resolution'], $resolution->objdata['resolutionid'])); - $admin->row_input(T('Resolution Title
The title of this resolution flag (eg: `Fixed` or `Bogus`)
'), 'resolution', $resolution->objdata['resolution']); - $admin->row_input(T('Display Order
The order in which the resolutions are displayed. The higher the number, the lower down in the list it is.
'), 'displayorder', $resolution->objdata['displayorder']); + $admin->table_head(sprintf(T('Edit Resolution - %1$s (id: %2$s)'), $resolution->record['resolution'], $resolution->record['resolutionid'])); + $admin->row_input(T('Resolution Title
The title of this resolution flag (eg: `Fixed` or `Bogus`)
'), 'resolution', $resolution->record['resolution']); + $admin->row_input(T('Display Order
The order in which the resolutions are displayed. The higher the number, the lower down in the list it is.
'), 'displayorder', $resolution->record['displayorder']); $admin->row_submit(); $admin->table_end(); $admin->form_end(); @@ -148,7 +147,7 @@ if ($_REQUEST['do'] == 'modify') $admin->table_start(); $admin->table_head(T('Resolution Manager')); - while ($resolution = $db->fetch_array($resolutions)) + foreach ($resolutions as $resolution) { $admin->row_text("$resolution[displayorder]: $resolution[resolution]", "(resolutionid: $resolution[resolutionid]) [" . T('Edit') . "] [" . T('Delete') . "]"); } @@ -160,10 +159,4 @@ if ($_REQUEST['do'] == 'modify') $admin->page_end(); } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/admin/setting.php b/admin/setting.php index 359e278..f3d3b1e 100755 --- a/admin/setting.php +++ b/admin/setting.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -44,7 +44,7 @@ if (empty($_REQUEST['do'])) if ($_POST['do'] == 'update') { $updates = array(); - foreach ($bugsys->in['setting'] AS $varname => $value) + foreach ($input->in['setting'] AS $varname => $value) { if (is_array($value)) { @@ -84,63 +84,63 @@ if ($_REQUEST['do'] == 'modify') // authmethod $admin->row_span(T('Authentication Method'), 'thead'); - $methods = $funct->scandir('./includes/auth/'); + $methods = BSFunctions::scan_directory('./includes/auth/'); foreach ($methods[''] AS $path) { if (preg_match('#auth_(.*)\.php#', $path, $matches)) { - $admin->list_item(ucwords(str_replace('_', ' ', $matches[1])), $matches[1], ($matches[1] == $bugsys->options['authmethod'])); + $admin->list_item(ucwords(str_replace('_', ' ', $matches[1])), $matches[1], ($matches[1] == bugdar::$options['authmethod'])); } } $admin->row_list(T('The authentication class to use to validate cookie data and longins. You may need to edit the actual file for certain authentication systems.'), 'setting[authmethod]'); // allownewreg $admin->row_span(T('Allow New Registrations'), 'thead'); - $admin->row_yesno(T('If this is set to yes, then new users will be allowed to register.'), 'setting[allownewreg]', $bugsys->options['allownewreg']); + $admin->row_yesno(T('If this is set to yes, then new users will be allowed to register.'), 'setting[allownewreg]', bugdar::$options['allownewreg']); // verifyemail $admin->row_span(T('Require Activation Email'), 'thead'); - $admin->row_yesno(T('Setting this to yes will force all new users to verify their account with an email activation link.'), 'setting[verifyemail]', $bugsys->options['verifyemail']); + $admin->row_yesno(T('Setting this to yes will force all new users to verify their account with an email activation link.'), 'setting[verifyemail]', bugdar::$options['verifyemail']); // moderatenewusers $admin->row_span(T('Moderate New Users'), 'thead'); - $admin->row_yesno(T('All new users will have to be approved by the administration before being able to have normal user rights.'), 'setting[moderatenewusers]', $bugsys->options['moderatenewusers']); + $admin->row_yesno(T('All new users will have to be approved by the administration before being able to have normal user rights.'), 'setting[moderatenewusers]', bugdar::$options['moderatenewusers']); // sendwelcomemail $admin->row_span(T('Send New Use Welcome Email'), 'thead'); - $admin->row_yesno(T('Setting this option to yes will send each new verified user a welcome email.'), 'setting[sendwelcomemail]', $bugsys->options['sendwelcomemail']); + $admin->row_yesno(T('Setting this option to yes will send each new verified user a welcome email.'), 'setting[sendwelcomemail]', bugdar::$options['sendwelcomemail']); // webmasteremail $admin->row_span(T('Webmaster Email Address'), 'thead'); - $admin->row_input(T('The email address from which emails will be sent out.'), 'setting[webmasteremail]', $bugsys->options['webmasteremail']); + $admin->row_input(T('The email address from which emails will be sent out.'), 'setting[webmasteremail]', bugdar::$options['webmasteremail']); // trackertitle $admin->row_span(T('Tracker Title'), 'thead'); - $admin->row_input(T('The global name of the bug tracker. Example: Blue Static Bug Tracker'), 'setting[trackertitle]', $bugsys->options['trackertitle']); + $admin->row_input(T('The global name of the bug tracker. Example: Blue Static Bug Tracker'), 'setting[trackertitle]', bugdar::$options['trackertitle']); // trackerurl $admin->row_span(T('Tracker Base URL'), 'thead'); - $admin->row_input(T('The base URL of the tracker. This is used when creating external links to the tracker. Be sure that this does not end in a trailing slash ("/").
Example: http://www.bluestatic.org/bugs'), 'setting[trackerurl]', $bugsys->options['trackerurl']); + $admin->row_input(T('The base URL of the tracker. This is used when creating external links to the tracker. Be sure that this does not end in a trailing slash ("/").
Example: http://www.bluestatic.org/bugs'), 'setting[trackerurl]', bugdar::$options['trackerurl']); // dateformat $admin->row_span(T('Date Format'), 'thead'); - $admin->row_input(T('Set the date format used for bug report and comment information. This is based on PHP\'s date() function.'), 'setting[dateformat]', $bugsys->options['dateformat']); + $admin->row_input(T('Set the date format used for bug report and comment information. This is based on PHP\'s date() function.'), 'setting[dateformat]', bugdar::$options['dateformat']); // defaulttimezone $admin->row_span(T('Default Time Zone'), 'thead'); - $admin->row_text(T('This controls the time zone that all unregistered users view the tracker with.'), construct_option_select('setting[defaulttimezone]', $bugsys->datef->fetch_timezone_list(), $bugsys->options['defaulttimezone']), $bugsys->options['defaulttimezone']); + $admin->row_text(T('This controls the time zone that all unregistered users view the tracker with.'), construct_option_select('setting[defaulttimezone]', $bugsys->datef->fetch_timezone_list(), bugdar::$options['defaulttimezone']), bugdar::$options['defaulttimezone']); // defaultlanguage $admin->row_span(T('Default Language'), 'thead'); - $admin->row_text(T('You can set the default language that all new users (and guests) will use.'), construct_option_select('setting[defaultlanguage]', $bugsys->datastore['language'], $bugsys->options['defaultlanguage'], 'languageid', 'title'), $bugsys->options['defaultlanguage']); + $admin->row_text(T('You can set the default language that all new users (and guests) will use.'), construct_option_select('setting[defaultlanguage]', bugdar::$datastore['language'], bugdar::$options['defaultlanguage'], 'languageid', 'title'), bugdar::$options['defaultlanguage']); // syndicateditems $admin->row_span(T('Number of Syndicated Items'), 'thead'); - $admin->row_input(T('The number of bugs to be syndicated at any one time by the Atom XML feed.'), 'setting[syndicateditems]', $bugsys->options['syndicateditems']); + $admin->row_input(T('The number of bugs to be syndicated at any one time by the Atom XML feed.'), 'setting[syndicateditems]', bugdar::$options['syndicateditems']); // redirectheaders $admin->row_span(T('Use Header Redirects'), 'thead'); - $admin->row_yesno(T('Instead of displaying an intermediate page informing the user that their action was a success and a redirect is occurring, just send the user to the next screen using HTTP headers. This can save bandwidth.'), 'setting[redirectheaders]', $bugsys->options['redirectheaders']); + $admin->row_yesno(T('Instead of displaying an intermediate page informing the user that their action was a success and a redirect is occurring, just send the user to the next screen using HTTP headers. This can save bandwidth.'), 'setting[redirectheaders]', bugdar::$options['redirectheaders']); $admin->table_end(); @@ -150,31 +150,31 @@ if ($_REQUEST['do'] == 'modify') // allowhtml $admin->row_span(T('Allow HTML in Bug Reports'), 'thead'); - $admin->row_yesno(T('Set this to yes if you want to allow users to post raw HTML in their bug reports. This is very dangerous and it is not recommended.'), 'setting[allowhtml]', $bugsys->options['allowhtml']); + $admin->row_yesno(T('Set this to yes if you want to allow users to post raw HTML in their bug reports. This is very dangerous and it is not recommended.'), 'setting[allowhtml]', bugdar::$options['allowhtml']); // defaultseverity $admin->row_span(T('Default Severity'), 'thead'); - $admin->row_text(T('The default severity that is selected when creating a new bug report.'), construct_option_select('setting[defaultseverity]', $bugsys->datastore['severity'], $bugsys->options['defaultseverity'], 'severityid', 'severity')); + $admin->row_text(T('The default severity that is selected when creating a new bug report.'), construct_option_select('setting[defaultseverity]', bugdar::$datastore['severity'], bugdar::$options['defaultseverity'], 'severityid', 'severity')); // defaultpriority $admin->row_span(T('Default Priority'), 'thead'); - $admin->row_text(T('The default priority that will be selected when creating a new bug report. Depending on your permission setup, the user may not be able to set this in a new report so this will act as the value.'), construct_option_select('setting[defaultpriority]', $bugsys->datastore['priority'], $bugsys->options['defaultpriority'], 'priorityid', 'priority')); + $admin->row_text(T('The default priority that will be selected when creating a new bug report. Depending on your permission setup, the user may not be able to set this in a new report so this will act as the value.'), construct_option_select('setting[defaultpriority]', bugdar::$datastore['priority'], bugdar::$options['defaultpriority'], 'priorityid', 'priority')); // defaultstatus $admin->row_span(T('Default Status'), 'thead'); - $admin->row_text(T('The default default that is selected when creating a new bug report. If a user can not assign a status, this will be the one inserted into the database.'), construct_option_select('setting[defaultstatus]', $bugsys->datastore['status'], $bugsys->options['defaultstatus'], 'statusid', 'status')); + $admin->row_text(T('The default default that is selected when creating a new bug report. If a user can not assign a status, this will be the one inserted into the database.'), construct_option_select('setting[defaultstatus]', bugdar::$datastore['status'], bugdar::$options['defaultstatus'], 'statusid', 'status')); // defaultresolve $admin->row_span(T('Default Resolution'), 'thead'); - $admin->row_text(T('This is the default bug resolution. If a user is not able to change this field, setting this will act as the default value.'), construct_option_select('setting[defaultresolve]', $bugsys->datastore['resolution'], $bugsys->options['defaultresolve'], 'resolutionid', 'resolution')); + $admin->row_text(T('This is the default bug resolution. If a user is not able to change this field, setting this will act as the default value.'), construct_option_select('setting[defaultresolve]', bugdar::$datastore['resolution'], bugdar::$options['defaultresolve'], 'resolutionid', 'resolution')); // defaultassign $admin->row_span(T('Default Bug Assignment'), 'thead'); - $admin->row_text(T('This is the default developer new bugs will be assigned to. If a user does not have permisssion to assign bugs, this will be the default. If you don\'t want any default assignment, leave this as Not Selected.'), construct_option_select('setting[defaultassign]', $bugsys->datastore['assignto'], $bugsys->options['defaultassign'], 'userid', 'displayname', 0)); + $admin->row_text(T('This is the default developer new bugs will be assigned to. If a user does not have permisssion to assign bugs, this will be the default. If you don\'t want any default assignment, leave this as Not Selected.'), construct_option_select('setting[defaultassign]', bugdar::$datastore['assignto'], bugdar::$options['defaultassign'], 'userid', 'displayname', 0)); // defaultcomment $admin->row_span(T('Default Comment Text'), 'thead'); - $admin->row_textarea(T('If you wish to set a template for entering the initial comment of a bug report, then you may specify this here. However, the template will only take effect on the initial report/comment. Note: the template cannot be forced on the user as there is no way to validate it.'), 'setting[defaultcomment]', $bugsys->options['defaultcomment']); + $admin->row_textarea(T('If you wish to set a template for entering the initial comment of a bug report, then you may specify this here. However, the template will only take effect on the initial report/comment. Note: the template cannot be forced on the user as there is no way to validate it.'), 'setting[defaultcomment]', bugdar::$options['defaultcomment']); $admin->table_end(); @@ -184,15 +184,15 @@ if ($_REQUEST['do'] == 'modify') // hidestatuses $admin->row_span(T('Hide Statuses on Bug Listings'), 'thead'); - $admin->row_text(T('Here you can specify which statuses to hide on the bug list displays. Users have options in their controls to change this from these values, and this does not affect searches or the favorites list.'), construct_option_select('setting[hidestatuses]', $bugsys->datastore['status'], $bugsys->options['hidestatuses'], 'statusid', 'status', 0, true)); + $admin->row_text(T('Here you can specify which statuses to hide on the bug list displays. Users have options in their controls to change this from these values, and this does not affect searches or the favorites list.'), construct_option_select('setting[hidestatuses]', bugdar::$datastore['status'], bugdar::$options['hidestatuses'], 'statusid', 'status', 0, true)); // defaultsortkey $admin->row_span(T('Default Sort Column'), 'thead'); - $admin->row_text(T('Select the column to sort bugs by on listings. This is only a default setting which users can override in their preferences.'), construct_option_select('setting[defaultsortkey]', ListSorter::fetch_by_text(false, false), $bugsys->options['defaultsortkey'])); + $admin->row_text(T('Select the column to sort bugs by on listings. This is only a default setting which users can override in their preferences.'), construct_option_select('setting[defaultsortkey]', ListSorter::fetch_by_text(false, false), bugdar::$options['defaultsortkey'])); // defaultsortas $admin->row_span(T('Default Sort Direction'), 'thead'); - $admin->row_text(T('Specify the default direction to sort bugs in the selected column. This works with and follows the same rules as the Sort Column.'), construct_option_select('setting[defaultsortas]', ListSorter::fetch_as_text(false), $bugsys->options['defaultsortas'])); + $admin->row_text(T('Specify the default direction to sort bugs in the selected column. This works with and follows the same rules as the Sort Column.'), construct_option_select('setting[defaultsortas]', ListSorter::fetch_as_text(false), bugdar::$options['defaultsortas'])); // columnoptions $admin->row_span(T('Default Column Ordering Options'), 'thead'); @@ -206,15 +206,15 @@ if ($_REQUEST['do'] == 'modify') // defaultpp $admin->row_span(T('Default Per-Page Amount'), 'thead'); - $admin->row_input(T('The number of items (e.g. bugs) to be displayed on a page by default. The user will have the option of over-riding these values.'), 'setting[defaultpp]', $bugsys->options['defaultpp']); + $admin->row_input(T('The number of items (e.g. bugs) to be displayed on a page by default. The user will have the option of over-riding these values.'), 'setting[defaultpp]', bugdar::$options['defaultpp']); // maxpp $admin->row_span(T('Maximum Per-Page Value'), 'thead'); - $admin->row_input(T('To prevent your server from experiencing load problems, set the maximum per page limit. Specifying a value here will make sure any user-entered value will not be higher than this, preventing server load problems.'), 'setting[maxpp]', $bugsys->options['maxpp']); + $admin->row_input(T('To prevent your server from experiencing load problems, set the maximum per page limit. Specifying a value here will make sure any user-entered value will not be higher than this, preventing server load problems.'), 'setting[maxpp]', bugdar::$options['maxpp']); // pagelinks $admin->row_span(T('Number of Page Links'), 'thead'); - $admin->row_input(T('The number of pages that will appear in the page navigation system on either side of the current page. Set this to 0 to display all pages.'), 'setting[pagelinks]', $bugsys->options['pagelinks']); + $admin->row_input(T('The number of pages that will appear in the page navigation system on either side of the current page. Set this to 0 to display all pages.'), 'setting[pagelinks]', bugdar::$options['pagelinks']); $admin->table_end(); @@ -226,10 +226,10 @@ if ($_REQUEST['do'] == 'modify') // trackerversion $admin->row_span('Version Number', 'thead'); - $admin->row_input('Version Number', 'setting[trackerversion]', $bugsys->options['trackerversion']); + $admin->row_input('Version Number', 'setting[trackerversion]', bugdar::$options['trackerversion']); $admin->row_span('Custom Gettext Localizer', 'thead'); - $admin->row_yesno('Use the custom MOReader implementation rather than the built-in Gettext extension.', 'setting[devgettext]', $bugsys->options['devgettext']); + $admin->row_yesno('Use the custom MOReader implementation rather than the built-in Gettext extension.', 'setting[devgettext]', bugdar::$options['devgettext']); } // ################################################################### @@ -243,7 +243,7 @@ if ($_REQUEST['do'] == 'modify') // ################################################################### /** -* Helper function for the $bugsys->options['columnoptions'] setting +* Helper function for the bugdar::$options['columnoptions'] setting * * @return string Setting HTML code */ @@ -253,7 +253,7 @@ function ConstructColumnOptionsSetting() require_once('./includes/class_sort.php'); - $array = ($bugsys->options['columnoptions'] == null ? array('bugid' => 1, 'summary' => 2, 'userid' => 2, 'product' => 3, 'version' => 3, 'component' => 0, 'status' => 4, 'resolution' => 4, 'priority' => 5, 'severity' => 5, 'lastpost' => 6, 'votes' => 0) : $bugsys->options['columnoptions']); + $array = (bugdar::$options['columnoptions'] == null ? array('bugid' => 1, 'summary' => 2, 'userid' => 2, 'product' => 3, 'version' => 3, 'component' => 0, 'status' => 4, 'resolution' => 4, 'priority' => 5, 'severity' => 5, 'lastpost' => 6, 'votes' => 0) : bugdar::$options['columnoptions']); $return = ''; foreach (ListSorter::fetch_by_text(false, false) AS $column => $name) @@ -264,10 +264,4 @@ function ConstructColumnOptionsSetting() return $return; } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/admin/severity.php b/admin/severity.php index 6b7aa7e..9eb080f 100755 --- a/admin/severity.php +++ b/admin/severity.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -22,7 +22,6 @@ require_once('./global.php'); require_once('./includes/api_severity.php'); -require_once('./includes/class_api_error.php'); APIError(array(new API_Error_Handler($admin), 'admin_error')); NavLinks::fieldsPages(); @@ -44,8 +43,8 @@ if (empty($_REQUEST['do'])) if ($_REQUEST['do'] == 'kill') { - $severity = new SeverityAPI($bugsys); - $severity->set('severityid', $bugsys->in['severityid']); + $severity = new SeverityAPI(); + $severity->set('severityid', $input->in['severityid']); $severity->set_condition(); $severity->delete(); @@ -56,16 +55,16 @@ if ($_REQUEST['do'] == 'kill') if ($_REQUEST['do'] == 'delete') { - $admin->page_confirm(T('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', 'kill', array('severityid' => $bugsys->input_clean('severityid', TYPE_UINT))); + $admin->page_confirm(T('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', 'kill', array('severityid' => $input->inputClean('severityid', TYPE_UINT))); } // ################################################################### if ($_POST['do'] == 'insert') { - $severity = new SeverityAPI($bugsys); - $severity->set('severity', $bugsys->in['severity']); - $severity->set('displayorder', $bugsys->in['displayorder']); + $severity = new SeverityAPI(); + $severity->set('severity', $input->in['severity']); + $severity->set('displayorder', $input->in['displayorder']); $severity->insert(); $admin->redirect('severity.php?do=modify'); @@ -96,11 +95,11 @@ if ($_REQUEST['do'] == 'add') if ($_POST['do'] == 'update') { - $severity = new SeverityAPI($bugsys); - $severity->set('severityid', $bugsys->in['severityid']); + $severity = new SeverityAPI(); + $severity->set('severityid', $input->in['severityid']); $severity->set_condition(); - $severity->set('severity', $bugsys->in['severity']); - $severity->set('displayorder', $bugsys->in['displayorder']); + $severity->set('severity', $input->in['severity']); + $severity->set('displayorder', $input->in['displayorder']); $severity->update(); $admin->redirect('severity.php?do=modify'); @@ -110,22 +109,22 @@ if ($_POST['do'] == 'update') if ($_REQUEST['do'] == 'edit') { - NavLinks::severitiesEdit($bugsys->in['severityid']); + NavLinks::severitiesEdit($input->in['severityid']); $navigator->set_focus('link', 'fields-pages-severities', 'fields-pages'); - $severity = new SeverityAPI($bugsys); - $severity->set('severityid', $bugsys->in['severityid']); + $severity = new SeverityAPI(); + $severity->set('severityid', $input->in['severityid']); $severity->set_condition(); $severity->fetch(); $admin->page_start(T('Edit Severity')); $admin->form_start('severity.php', 'update'); - $admin->form_hidden_field('severityid', $severity->objdata['severityid']); + $admin->form_hidden_field('severityid', $severity->record['severityid']); $admin->table_start(); - $admin->table_head(sprintf(T('Edit Severity - %1$s (id: %2$s)'), $severity->objdata['severity'], $severity->objdata['severityid'])); - $admin->row_input(T('Severity Title
The title of this severity flag (eg: `Major` or `Critical`)
'), 'severity', $severity->objdata['severity']); - $admin->row_input(T('Display Order
The order in which the severities are displayed. The higher the number, the lower down in the list it is.
'), 'displayorder', $severity->objdata['displayorder']); + $admin->table_head(sprintf(T('Edit Severity - %1$s (id: %2$s)'), $severity->record['severity'], $severity->record['severityid'])); + $admin->row_input(T('Severity Title
The title of this severity flag (eg: `Major` or `Critical`)
'), 'severity', $severity->record['severity']); + $admin->row_input(T('Display Order
The order in which the severities are displayed. The higher the number, the lower down in the list it is.
'), 'displayorder', $severity->record['displayorder']); $admin->row_submit(); $admin->table_end(); $admin->form_end(); @@ -148,7 +147,7 @@ if ($_REQUEST['do'] == 'modify') $admin->table_start(); $admin->table_head(T('Severity Manager')); - while ($severity = $db->fetch_array($severities)) + foreach ($severities as $severity) { $admin->row_text("$severity[displayorder]: $severity[severity]", "(severityid: $severity[severityid]) [" . T('Edit') . "][" . T('Delete') . "]"); } @@ -160,10 +159,4 @@ if ($_REQUEST['do'] == 'modify') $admin->page_end(); } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/admin/status.php b/admin/status.php index 88ea3cd..37989aa 100755 --- a/admin/status.php +++ b/admin/status.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -22,7 +22,6 @@ require_once('./global.php'); require_once('./includes/api_status.php'); -require_once('./includes/class_api_error.php'); APIError(array(new API_Error_Handler($admin), 'admin_error')); NavLinks::fieldsPages(); @@ -44,8 +43,8 @@ if (empty($_REQUEST['do'])) if ($_REQUEST['do'] == 'kill') { - $status = new StatusAPI($bugsys); - $status->set('statusid', $bugsys->in['statusid']); + $status = new StatusAPI(); + $status->set('statusid', $input->in['statusid']); $status->set_condition(); $status->delete(); @@ -56,17 +55,17 @@ if ($_REQUEST['do'] == 'kill') if ($_REQUEST['do'] == 'delete') { - $admin->page_confirm(T('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', 'kill', array('statusid' => $bugsys->input_clean('statusid', TYPE_UINT))); + $admin->page_confirm(T('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', 'kill', array('statusid' => $input->inputClean('statusid', TYPE_UINT))); } // ################################################################### if ($_POST['do'] == 'insert') { - $status = new StatusAPI($bugsys); - $status->set('status', $bugsys->in['status']); - $status->set('color', $bugsys->in['color']); - $status->set('displayorder', $bugsys->in['displayorder']); + $status = new StatusAPI(); + $status->set('status', $input->in['status']); + $status->set('color', $input->in['color']); + $status->set('displayorder', $input->in['displayorder']); $status->insert(); $admin->redirect('status.php?do=modify'); @@ -98,12 +97,12 @@ if ($_REQUEST['do'] == 'add') if ($_POST['do'] == 'update') { - $status = new StatusAPI($bugsys); - $status->set('statusid', $bugsys->in['statusid']); + $status = new StatusAPI(); + $status->set('statusid', $input->in['statusid']); $status->set_condition(); - $status->set('status', $bugsys->in['status']); - $status->set('color', $bugsys->in['color']); - $status->set('displayorder', $bugsys->in['displayorder']); + $status->set('status', $input->in['status']); + $status->set('color', $input->in['color']); + $status->set('displayorder', $input->in['displayorder']); $status->update(); $admin->redirect('status.php?do=modify'); @@ -113,23 +112,23 @@ if ($_POST['do'] == 'update') if ($_REQUEST['do'] == 'edit') { - NavLinks::statusesEdit($bugsys->in['statusid']); + NavLinks::statusesEdit($input->in['statusid']); $navigator->set_focus('link', 'fields-pages-statuses', 'fields-pages'); - $status = new StatusAPI($bugsys); - $status->set('statusid', $bugsys->in['statusid']); + $status = new StatusAPI(); + $status->set('statusid', $input->in['statusid']); $status->set_condition(); $status->fetch(); $admin->page_start(T('Edit Status')); $admin->form_start('status.php', 'update'); - $admin->form_hidden_field('statusid', $status->objdata['statusid']); + $admin->form_hidden_field('statusid', $status->record['statusid']); $admin->table_start(); - $admin->table_head(sprintf(T('Edit Status - %1$s (id: %2$s)'), $status->objdata['status'], $status->objdata['statusid'])); - $admin->row_input(T('Status Title
The title of this status flag (eg: `Confirmed` or `Closed (Fixed)`)
'), 'status', $status->objdata['status']); - $admin->row_input(T('Display Order
The order in which the statuses ar displayed.
'), 'displayorder', $status->objdata['displayorder']); - $admin->row_input(T('Status Color
The color of the status. This will be displayed on bug listings page to make viewing easier. Note: you must enter the # sign if you are using HEX values.
'), 'color', $status->objdata['color']); + $admin->table_head(sprintf(T('Edit Status - %1$s (id: %2$s)'), $status->record['status'], $status->record['statusid'])); + $admin->row_input(T('Status Title
The title of this status flag (eg: `Confirmed` or `Closed (Fixed)`)
'), 'status', $status->record['status']); + $admin->row_input(T('Display Order
The order in which the statuses ar displayed.
'), 'displayorder', $status->record['displayorder']); + $admin->row_input(T('Status Color
The color of the status. This will be displayed on bug listings page to make viewing easier. Note: you must enter the # sign if you are using HEX values.
'), 'color', $status->record['color']); $admin->row_submit(); $admin->table_end(); $admin->form_end(); @@ -151,7 +150,7 @@ if ($_REQUEST['do'] == 'modify') $admin->table_start(); $admin->table_head(T('Status Manager')); - while ($status = $db->fetch_array($statuses)) + foreach ($statuses as $status) { $colorblock = '
'; $admin->row_text("$colorblock$status[displayorder]: $status[status]", "(statusid: $status[statusid]) [" . T('Edit') . "][" . T('Delete') . "]"); @@ -163,10 +162,4 @@ if ($_REQUEST['do'] == 'modify') $admin->page_end(); } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/admin/user.php b/admin/user.php index a2d9a0e..9d88f0e 100644 --- a/admin/user.php +++ b/admin/user.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -23,7 +23,6 @@ require_once('./global.php'); require_once('./includes/api_user.php'); require_once('./includes/class_sort.php'); -require_once('./includes/class_api_error.php'); APIError(array(new API_Error_Handler($admin), 'admin_error')); NavLinks::usersPages(); @@ -61,8 +60,8 @@ if (empty($_REQUEST['do'])) if ($_REQUEST['do'] == 'kill') { - $user = new UserAPI($bugsys); - $user->set('userid', $bugsys->in['userid']); + $user = new UserAPI(); + $user->set('userid', $input->in['userid']); $user->set_condition(); $user->delete(); @@ -73,36 +72,36 @@ if ($_REQUEST['do'] == 'kill') if ($_REQUEST['do'] == 'delete') { - $admin->page_confirm(T('Are you sure you want to delete this user?'), 'user.php', 'kill', array('userid' => $bugsys->input_clean('userid', TYPE_UINT))); + $admin->page_confirm(T('Are you sure you want to delete this user?'), 'user.php', 'kill', array('userid' => $input->inputClean('userid', TYPE_UINT))); } // ################################################################### if ($_POST['do'] == 'insert') { - $user = new UserAPI($bugsys); - $user->set('displayname', $bugsys->in['displayname']); - $user->set('email', $bugsys->in['email']); - $user->set('showemail', $bugsys->in['showemail']); - $user->set('showcolors', $bugsys->in['showcolors']); - $user->set('usergroupid', $bugsys->in['usergroupid']); - $user->set('groupids', $bugsys->in['groupids']); - $user->set('languageid', $bugsys->in['languageid']); - $user->set('timezone', $bugsys->in['timezone']); - $user->set('usedst', $bugsys->in['usedst']); - $user->set('password', $bugsys->in['password']); - $user->set('hidestatuses', $bugsys->in['hidestatuses']); - $user->set('defaultsortkey', $bugsys->in['defaultsortkey']); - $user->set('defaultsortas', $bugsys->in['defaultsortas']); + $user = new UserAPI(); + $user->set('displayname', $input->in['displayname']); + $user->set('email', $input->in['email']); + $user->set('showemail', $input->in['showemail']); + $user->set('showcolors', $input->in['showcolors']); + $user->set('usergroupid', $input->in['usergroupid']); + $user->set('groupids', $input->in['groupids']); + $user->set('languageid', $input->in['languageid']); + $user->set('timezone', $input->in['timezone']); + $user->set('usedst', $input->in['usedst']); + $user->set('password', $input->in['password']); + $user->set('hidestatuses', $input->in['hidestatuses']); + $user->set('defaultsortkey', $input->in['defaultsortkey']); + $user->set('defaultsortas', $input->in['defaultsortas']); $user->insert(); // post_insert will set the email options... so we now have to dump them $db->query("DELETE FROM " . TABLE_PREFIX . "useremail WHERE userid = " . $user->insertid); - $bugsys->input_clean('emailopts', TYPE_INT); - if (is_array($bugsys->in['emailopts'])) + $input->inputClean('emailopts', TYPE_INT); + if (is_array($input->in['emailopts'])) { - foreach ($bugsys->in['emailopts'] AS $relation => $bitarr) + foreach ($input->in['emailopts'] AS $relation => $bitarr) { $bitmask = 0; foreach ($bitarr AS $option => $yes) @@ -120,29 +119,29 @@ if ($_POST['do'] == 'insert') if ($_POST['do'] == 'update') { - $user = new UserAPI($bugsys); - $user->set('userid', $bugsys->in['userid']); + $user = new UserAPI(); + $user->set('userid', $input->in['userid']); $user->set_condition(); - $user->set('displayname', $bugsys->in['displayname']); - $user->set('email', $bugsys->in['email']); - $user->set('showemail', $bugsys->in['showemail']); - $user->set('showcolors', $bugsys->in['showcolors']); - $user->set('usergroupid', $bugsys->in['usergroupid']); - $user->set('groupids', $bugsys->in['groupids']); - $user->set('languageid', $bugsys->in['languageid']); - $user->set('timezone', $bugsys->in['timezone']); - $user->set('usedst', $bugsys->in['usedst']); - $user->set('password', $bugsys->in['password']); - $user->set('hidestatuses', $bugsys->in['hidestatuses']); - $user->set('defaultsortkey', $bugsys->in['defaultsortkey']); - $user->set('defaultsortas', $bugsys->in['defaultsortas']); + $user->set('displayname', $input->in['displayname']); + $user->set('email', $input->in['email']); + $user->set('showemail', $input->in['showemail']); + $user->set('showcolors', $input->in['showcolors']); + $user->set('usergroupid', $input->in['usergroupid']); + $user->set('groupids', $input->in['groupids']); + $user->set('languageid', $input->in['languageid']); + $user->set('timezone', $input->in['timezone']); + $user->set('usedst', $input->in['usedst']); + $user->set('password', $input->in['password']); + $user->set('hidestatuses', $input->in['hidestatuses']); + $user->set('defaultsortkey', $input->in['defaultsortkey']); + $user->set('defaultsortas', $input->in['defaultsortas']); $user->update(); $db->query("DELETE FROM " . TABLE_PREFIX . "useremail WHERE userid = " . $user->values['userid']); - $bugsys->input_clean('emailopts', TYPE_INT); - if (is_array($bugsys->in['emailopts'])) + $input->inputClean('emailopts', TYPE_INT); + if (is_array($input->in['emailopts'])) { - foreach ($bugsys->in['emailopts'] AS $relation => $bitarr) + foreach ($input->in['emailopts'] AS $relation => $bitarr) { $bitmask = 0; foreach ($bitarr AS $option => $yes) @@ -153,7 +152,7 @@ if ($_POST['do'] == 'update') } } - $admin->redirect('user.php?do=edit&userid=' . $user->objdata['userid']); + $admin->redirect('user.php?do=edit&userid=' . $user->record['userid']); } // ################################################################### @@ -165,11 +164,11 @@ if ($_REQUEST['do'] == 'edit' OR $_REQUEST['do'] == 'add') if ($edit) { - NavLinks::usersEdit($bugsys->in['userid']); + NavLinks::usersEdit($input->in['userid']); $navigator->set_focus('link', 'users-pages-users', 'users-pages'); - $user = new UserAPI($bugsys); - $user->set('userid', $bugsys->in['userid']); + $user = new UserAPI(); + $user->set('userid', $input->in['userid']); $user->set_condition(); $user->fetch(); } @@ -185,27 +184,27 @@ if ($_REQUEST['do'] == 'edit' OR $_REQUEST['do'] == 'add') if ($edit) { - $admin->form_hidden_field('userid', $user->objdata['userid']); + $admin->form_hidden_field('userid', $user->record['userid']); } $admin->table_start(); - $admin->table_head(($add ? T('Add User') : sprintf(T('Edit User (userid: %1$s)'), $user->objdata['userid']))); + $admin->table_head(($add ? T('Add User') : sprintf(T('Edit User (userid: %1$s)'), $user->record['userid']))); - $admin->row_input(T('Display Name'), 'displayname', $user->objdata['displayname']); - $admin->row_input(T('Email'), 'email', $user->objdata['email']); + $admin->row_input(T('Display Name'), 'displayname', $user->record['displayname']); + $admin->row_input(T('Email'), 'email', $user->record['email']); $admin->row_input(($add ? T('Password') : T('Password (Leave blank for no change)')), 'password'); - foreach ($bugsys->datastore['usergroup'] AS $group) + foreach (bugdar::$datastore['usergroup'] AS $group) { - $admin->list_item($group['title'], $group['usergroupid'], ($user->objdata['usergroupid'] == $group['usergroupid'])); + $admin->list_item($group['title'], $group['usergroupid'], ($user->record['usergroupid'] == $group['usergroupid'])); } $admin->row_list(T('Primary Usergroup'), 'usergroupid'); - $ids = explode(',', $user->objdata['groupids']); - foreach ($bugsys->datastore['usergroup'] AS $id => $group) + $ids = explode(',', $user->record['groupids']); + foreach (bugdar::$datastore['usergroup'] AS $id => $group) { - if ($id == $user->objdata['usergroupid']) + if ($id == $user->record['usergroupid']) { continue; } @@ -213,25 +212,25 @@ if ($_REQUEST['do'] == 'edit' OR $_REQUEST['do'] == 'add') } $admin->row_checkbox(T('Secondary Usergroups'), 'groupids'); - $admin->row_yesno(T('Show Email Publicly'), 'showemail', $user->objdata['showemail']); - $admin->row_yesno(T('Show Status Colors on Bug Listings'), 'showcolors', $user->objdata['showcolors']); + $admin->row_yesno(T('Show Email Publicly'), 'showemail', $user->record['showemail']); + $admin->row_yesno(T('Show Status Colors on Bug Listings'), 'showcolors', $user->record['showcolors']); - foreach ($bugsys->datastore['language'] AS $language) + foreach (bugdar::$datastore['language'] AS $language) { - $admin->list_item($language['title'], $language['languageid'], ($user->objdata['languageid'] == $language['languageid'])); + $admin->list_item($language['title'], $language['languageid'], ($user->record['languageid'] == $language['languageid'])); } $admin->row_list(T('Language'), 'languageid'); foreach ($datef->fetch_timezone_list() AS $value => $string) { - $admin->list_item($string, $value, ($user->objdata['timezone'] == $value)); + $admin->list_item($string, $value, ($user->record['timezone'] == $value)); } $admin->row_list(T('Timezone'), 'timezone'); - $admin->row_yesno(T('Observe Daylight Savings Time (DST)'), 'usedst', $user->objdata['usedst']); - $admin->row_text(T('Hidden Statuses on Bug Listing'), construct_option_select('hidestatuses', $bugsys->datastore['status'], $user->objdata['hidestatuses'], 'statusid', 'status', 0, true)); - $admin->row_text(T('Default Sort Order Column'), construct_option_select('defaultsortkey', ListSorter::fetch_by_text(false), $user->objdata['defaultsortkey'])); - $admin->row_text(T('Default Sort Order Direction'), construct_option_select('defaultsortas', ListSorter::fetch_as_text(false), $user->objdata['defaultsortas'])); + $admin->row_yesno(T('Observe Daylight Savings Time (DST)'), 'usedst', $user->record['usedst']); + $admin->row_text(T('Hidden Statuses on Bug Listing'), construct_option_select('hidestatuses', bugdar::$datastore['status'], $user->record['hidestatuses'], 'statusid', 'status', 0, true)); + $admin->row_text(T('Default Sort Order Column'), construct_option_select('defaultsortkey', ListSorter::fetch_by_text(false), $user->record['defaultsortkey'])); + $admin->row_text(T('Default Sort Order Direction'), construct_option_select('defaultsortas', ListSorter::fetch_as_text(false), $user->record['defaultsortas'])); $admin->table_end(); @@ -239,10 +238,10 @@ if ($_REQUEST['do'] == 'edit' OR $_REQUEST['do'] == 'add') $admin->table_start(false); $admin->table_head(T('Email Options'), 6); - if ($user->objdata['userid']) + if ($user->record['userid']) { - $options = $db->query("SELECT * FROM " . TABLE_PREFIX . "useremail WHERE userid = " . $user->objdata['userid']); - while ($opt = $db->fetch_array($options)) + $options = $db->query("SELECT * FROM " . TABLE_PREFIX . "useremail WHERE userid = " . $user->record['userid']); + foreach ($options as $opt) { foreach ($bugsys->emailoptions['notifications'] AS $name => $notif) { @@ -328,12 +327,12 @@ if ($_REQUEST['do'] == 'search') NavLinks::usersAdd(); $navigator->set_focus('link', 'users-pages-users', 'users-pages'); - if (is_numeric($bugsys->in['userdata'])) + if (is_numeric($input->in['userdata'])) { - $bugsys->input_clean('userdata', TYPE_UINT); - if ($db->query_first("SELECT * FROM " . TABLE_PREFIX . "user WHERE userid = " . $bugsys->in['userdata'])) + $input->inputClean('userdata', TYPE_UINT); + if ($db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "user WHERE userid = " . $input->in['userdata'])) { - header('Location: user.php?do=edit&userid=' . $bugsys->in['userdata']); + header('Location: user.php?do=edit&userid=' . $input->in['userdata']); } else { @@ -342,7 +341,7 @@ if ($_REQUEST['do'] == 'search') } else { - $bugsys->in['userdata'] = str_replace('%', '\%', $bugsys->in['userdata']); + $input->in['userdata'] = str_replace('%', '\%', $input->in['userdata']); $results = $db->query("SELECT * FROM " . TABLE_PREFIX . "user WHERE email LIKE '%" . $bugsys->input_escape('userdata') . "%' OR displayname LIKE '%" . $bugsys->input_escape('userdata') . "%'"); if ($db->num_rows($results) < 1) @@ -357,7 +356,7 @@ if ($_REQUEST['do'] == 'search') $admin->table_head(T('Search Results'), 4); $admin->table_column_head(array(T('Display Name'), T('Email'), T('User ID'), T('Actions'))); - while ($row = $db->fetch_array($results)) + foreach ($results as $row) { $admin->row_multi_item(array( $row['displayname'] => 'l', @@ -395,12 +394,12 @@ if ($_REQUEST['do'] == 'showall') $admin->table_head(T('Show All Users'), 4); $admin->table_column_head(array(T('Display Name'), T('Email'), T('User ID'), T('Actions'))); - $count = $db->query_first("SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "user"); + $count = $db->queryFirst("SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "user"); $pagination->setTotal($count['count']); $pagination->splitPages(); $users = $db->query("SELECT * FROM " . TABLE_PREFIX . "user ORDER BY userid ASC LIMIT " . $pagination->fetchLimit($pagination->getPage() - 1) . ", " . $pagination->getPerPage()); - while ($user = $db->fetch_array($users)) + foreach ($users as $user) { $admin->row_multi_item(array( $user['displayname'] => 'l', @@ -440,10 +439,4 @@ if ($_REQUEST['do'] == 'modify') $admin->page_end(); } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/admin/usergroup.php b/admin/usergroup.php index 7cefd89..b69ca14 100755 --- a/admin/usergroup.php +++ b/admin/usergroup.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -22,7 +22,6 @@ require_once('./global.php'); require_once('./includes/api_usergroup.php'); -require_once('./includes/class_api_error.php'); APIError(array(new API_Error_Handler($admin), 'admin_error')); NavLinks::usersPages(); @@ -87,8 +86,8 @@ if (empty($_REQUEST['do'])) if ($_REQUEST['do'] == 'kill') { - $usergroup = new UsergroupAPI($bugsys); - $usergroup->set('usergroupid', $bugsys->in['usergroupid']); + $usergroup = new UsergroupAPI(); + $usergroup->set('usergroupid', $input->in['usergroupid']); $usergroup->set_condition(); $usergroup->delete(); @@ -99,12 +98,12 @@ if ($_REQUEST['do'] == 'kill') if ($_REQUEST['do'] == 'delete') { - if ($bugsys->in['usergroupid'] < 7) + if ($input->in['usergroupid'] < 7) { $admin->error(T('You can\'t delete a default usergroup.')); } - $admin->page_confirm(T('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', 'kill', array('usergroupid' => $bugsys->in['usergroupid'])); + $admin->page_confirm(T('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', 'kill', array('usergroupid' => $input->in['usergroupid'])); } // ################################################################### @@ -117,7 +116,7 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit' OR $_REQUEST['do'] == if ($edit) { - NavLinks::usergroupsEdit($bugsys->in['usergroupid']); + NavLinks::usergroupsEdit($input->in['usergroupid']); $navigator->set_focus('link', 'users-pages-usergroups', 'users-pages'); } else @@ -132,18 +131,18 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit' OR $_REQUEST['do'] == if ($edit OR $clone) { - $usergroup = new UsergroupAPI($bugsys); - $usergroup->set('usergroupid', $bugsys->in['usergroupid']); + $usergroup = new UsergroupAPI(); + $usergroup->set('usergroupid', $input->in['usergroupid']); $usergroup->set_condition(); $usergroup->fetch(); if ($clone) { - $admin->form_hidden_field('cloneid', $usergroup->objdata['usergroupid']); + $admin->form_hidden_field('cloneid', $usergroup->record['usergroupid']); } else { - $admin->form_hidden_field('usergroupid', $usergroup->objdata['usergroupid']); + $admin->form_hidden_field('usergroupid', $usergroup->record['usergroupid']); } } else @@ -154,8 +153,8 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit' OR $_REQUEST['do'] == // Details $admin->table_start(); $admin->table_head(T('Usergroup Details')); - $admin->row_input(T('Usergroup Title'), 'title', (($add AND $clone) ? '' : $bugsys->sanitize($usergroup->objdata['title']))); - $admin->row_input(T('Display Title
This is the title that others will be able to see when comments are posted.
'), 'displaytitle', (($add AND $clone) ? '' : $bugsys->sanitize($usergroup->objdata['displaytitle']))); + $admin->row_input(T('Usergroup Title'), 'title', (($add AND $clone) ? '' : $bugsys->sanitize($usergroup->record['title']))); + $admin->row_input(T('Display Title
This is the title that others will be able to see when comments are posted.
'), 'displaytitle', (($add AND $clone) ? '' : $bugsys->sanitize($usergroup->record['displaytitle']))); $admin->table_end(); // Permission @@ -168,7 +167,7 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit' OR $_REQUEST['do'] == $admin->row_span($group, 'thead', 'center'); foreach ($settings AS $setting => $name) { - $admin->row_yesno($name, "perm[$setting]", ($usergroup->objdata['permissions'] & $bugsys->permissions["$setting"])); + $admin->row_yesno($name, "perm[$setting]", ($usergroup->record['permissions'] & bugdar::$permissions["$setting"])); } } @@ -180,15 +179,15 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit' OR $_REQUEST['do'] == if ($edit OR $clone) { - $perms = $db->query("SELECT fieldid, mask FROM " . TABLE_PREFIX . "bugfieldpermission WHERE usergroupid = " . $usergroup->objdata['usergroupid']); - while ($perm = $db->fetch_array($perms)) + $perms = $db->query("SELECT fieldid, mask FROM " . TABLE_PREFIX . "bugfieldpermission WHERE usergroupid = " . $usergroup->record['usergroupid']); + foreach ($perms as $perm) { $permissions["$perm[fieldid]"] = $perm['mask']; } } $fields = $db->query("SELECT fieldid, name FROM " . TABLE_PREFIX . "bugfield ORDER BY fieldid"); - while ($field = $db->fetch_array($fields)) + foreach ($fields as $field) { unset($listitem); $admin->list_item(T('No Permission'), 0, $permissions["$field[fieldid]"] == 0); @@ -213,22 +212,22 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit' OR $_REQUEST['do'] == if ($_POST['do'] == 'insert') { - $bugsys->input_clean('perm', TYPE_UINT); - foreach ($bugsys->in['perm'] AS $permtitle => $binaryswitch) + $input->inputClean('perm', TYPE_UINT); + foreach ($input->in['perm'] AS $permtitle => $binaryswitch) { - $permissionvalue += $bugsys->permissions["$permtitle"] * $binaryswitch; + $permissionvalue += bugdar::$permissions["$permtitle"] * $binaryswitch; } - $usergroup = new UsergroupAPI($bugsys); - $usergroup->set('title', $bugsys->in['title']); - $usergroup->set('displaytitle', $bugsys->in['displaytitle']); + $usergroup = new UsergroupAPI(); + $usergroup->set('title', $input->in['title']); + $usergroup->set('displaytitle', $input->in['displaytitle']); $usergroup->set('permissions', $permissionvalue); $usergroup->insert(); - $bugsys->input_clean('custom', TYPE_UINT); - if (is_array($bugsys->in['custom'])) + $input->inputClean('custom', TYPE_UINT); + if (is_array($input->in['custom'])) { - foreach ($bugsys->in['custom'] AS $fieldid => $mask) + foreach ($input->in['custom'] AS $fieldid => $mask) { $values[] = $usergroup->insertid . ", " . $bugsys->clean($fieldid, TYPE_UINT) . ", " . $mask; } @@ -246,10 +245,10 @@ if ($_POST['do'] == 'insert') } // copy product permissions from cloning - if ($bugsys->input_clean('cloneid', TYPE_UINT)) + if ($input->inputClean('cloneid', TYPE_UINT)) { - $prodperms = $db->query("SELECT * FROM " . TABLE_PREFIX . "permission WHERE usergroupid = " . $bugsys->in['cloneid']); - while ($prod = $db->fetch_array($prodperms)) + $prodperms = $db->query("SELECT * FROM " . TABLE_PREFIX . "permission WHERE usergroupid = " . $input->in['cloneid']); + foreach ($prodperms as $prod) { $db->query("INSERT INTO " . TABLE_PREFIX . "permission (usergroupid, productid, mask) VALUES (" . $usergroup->insertid . ", $prod[productid], $prod[mask])"); } @@ -263,29 +262,29 @@ if ($_POST['do'] == 'insert') if ($_POST['do'] == 'update') { - $bugsys->input_clean_array(array( + $input->inputClean_array(array( 'perm' => TYPE_UINT, 'usergroupid' => TYPE_UINT, 'custom' => TYPE_UINT )); - $bugsys->input_clean('perm', TYPE_UINT); - foreach ($bugsys->in['perm'] AS $permtitle => $binaryswitch) + $input->inputClean('perm', TYPE_UINT); + foreach ($input->in['perm'] AS $permtitle => $binaryswitch) { - $permissionvalue += $bugsys->permissions["$permtitle"] * $binaryswitch; + $permissionvalue += bugdar::$permissions["$permtitle"] * $binaryswitch; } - $usergroup = new UsergroupAPI($bugsys); - $usergroup->set('usergroupid', $bugsys->in['usergroupid']); + $usergroup = new UsergroupAPI(); + $usergroup->set('usergroupid', $input->in['usergroupid']); $usergroup->set_condition(); - $usergroup->set('title', $bugsys->in['title']); - $usergroup->set('displaytitle', $bugsys->in['displaytitle']); + $usergroup->set('title', $input->in['title']); + $usergroup->set('displaytitle', $input->in['displaytitle']); $usergroup->set('permissions', $permissionvalue); $usergroup->update(); - $bugsys->input_clean('custom', TYPE_UINT); - if (is_array($bugsys->in['custom'])) + $input->inputClean('custom', TYPE_UINT); + if (is_array($input->in['custom'])) { - foreach ($bugsys->in['custom'] AS $fieldid => $mask) + foreach ($input->in['custom'] AS $fieldid => $mask) { $values[] = $usergroup->values['usergroupid'] . ", " . $bugsys->clean($fieldid, TYPE_UINT) . ", " . $mask; } @@ -309,12 +308,12 @@ if ($_POST['do'] == 'update') if ($_POST['do'] == 'doapprove') { - $bugsys->input_clean('approve', TYPE_UINT); + $input->inputClean('approve', TYPE_UINT); $idlist = array(); - if (is_array($bugsys->in['approve'])) + if (is_array($input->in['approve'])) { - foreach ($bugsys->in['approve'] AS $id => $yesno) + foreach ($input->in['approve'] AS $id => $yesno) { if ($yesno > 0) { @@ -332,9 +331,9 @@ if ($_POST['do'] == 'doapprove') if (sizeof($idlist) > 0) { $users = $db->query("SELECT * FROM " . TABLE_PREFIX . "user WHERE userid IN (" . implode(',', $idlist) . ")"); - while ($user = $db->fetch_array($users)) + foreach ($users as $user) { - $tpl = $template->fetch(FetchEmailPath('accountapproved.xml', $bugsys->datastore['language'][$bugsys->options['defaultlanguage']]['langcode'])); + $tpl = $template->fetch(FetchEmailPath('accountapproved.xml', bugdar::$datastore['language'][bugdar::$options['defaultlanguage']]['langcode'])); eval('$email = "' . $tpl . '";'); $email = $bugsys->xml->parse($email); $mail->setSubject($email['email']['subject']['value']); @@ -364,11 +363,11 @@ if ($_REQUEST['do'] == 'approve') $admin->table_column_head(array(T('Display Name'), T('Usergroup'), T('Approve'))); $users = $db->query("SELECT * FROM " . TABLE_PREFIX . "user WHERE usergroupid IN (3, 4)"); - while ($user = $db->fetch_array($users)) + foreach ($users as $user) { $admin->row_multi_item(array( '' . $user['email'] . '' => 'l', - $bugsys->datastore['usergroup']["$user[usergroupid]"]['title'] => 'c', + bugdar::$datastore['usergroup']["$user[usergroupid]"]['title'] => 'c', '' => 'c' )); } @@ -394,7 +393,7 @@ if ($_REQUEST['do'] == 'modify') $admin->table_head(T('Usergroup Manager'), 3, 'usergroups'); $groups = $db->query("SELECT * FROM " . TABLE_PREFIX . "usergroup ORDER BY usergroupid ASC"); - while ($group = $db->fetch_array($groups)) + foreach ($groups as $group) { $usergroups["$group[usergroupid]"] = $group; } @@ -407,7 +406,7 @@ if ($_REQUEST['do'] == 'modify') GROUP BY usergroup.usergroupid ORDER BY usergroup.usergroupid" ); - while ($group = $db->fetch_array($groups)) + foreach ($groups as $group) { $usergroups["$group[usergroupid]"]['total'] = $group['total']; } @@ -431,10 +430,4 @@ if ($_REQUEST['do'] == 'modify') $admin->page_end(); } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/admin/userhelp.php b/admin/userhelp.php index 5500055..2cca973 100755 --- a/admin/userhelp.php +++ b/admin/userhelp.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -23,7 +23,6 @@ require_once('./global.php'); require_once('./includes/api_userhelp.php'); require_once('./includes/functions_datastore.php'); -require_once('./includes/class_api_error.php'); APIError(array(new API_Error_Handler($admin), 'admin_error')); NavLinks::optionsPages(); @@ -46,8 +45,8 @@ if (empty($_REQUEST['do'])) if ($_REQUEST['do'] == 'kill') { - $help = new UserHelpAPI($bugsys); - $help->set('keystring', $bugsys->in['keystring']); + $help = new UserHelpAPI(); + $help->set('keystring', $input->in['keystring']); $help->delete(); build_user_help(); @@ -59,17 +58,17 @@ if ($_REQUEST['do'] == 'kill') if ($_REQUEST['do'] == 'delete') { - $admin->page_confirm(T('Are you sure you want to delete help text?'), 'userhelp.php', 'kill', array('keystring' => $bugsys->in['keystring'])); + $admin->page_confirm(T('Are you sure you want to delete help text?'), 'userhelp.php', 'kill', array('keystring' => $input->in['keystring'])); } // ################################################################### if ($_POST['do'] == 'insert') { - $help = new UserHelpAPI($bugsys); - $help->set('keystring', $bugsys->in['keystring']); - $help->set('title', $bugsys->in['title']); - $help->set('body', $bugsys->in['body']); + $help = new UserHelpAPI(); + $help->set('keystring', $input->in['keystring']); + $help->set('title', $input->in['title']); + $help->set('body', $input->in['body']); $help->insert(); $admin->redirect('userhelp.php?do=modify'); @@ -105,9 +104,9 @@ if ($_REQUEST['do'] == 'add') if ($_POST['do'] == 'update') { - foreach ($bugsys->in['help'] AS $keystring => $fields) + foreach ($input->in['help'] AS $keystring => $fields) { - $help = new UserHelpAPI($bugsys); + $help = new UserHelpAPI(); $help->norunners = array('post_update'); $help->set('keystring', $keystring); $help->set_condition(); @@ -135,7 +134,7 @@ if ($_REQUEST['do'] == 'modify') $admin->table_head(T('Edit User Help')); $topics = $db->query("SELECT * FROM " . TABLE_PREFIX . "fieldhelp ORDER BY keystring ASC"); - while ($topic = $db->fetch_array($topics)) + foreach ($topics as $topic) { $inputfield = ''; $delete = (!in_array($topic['keystring'], UserHelpAPI::not_able_to_delete()) ? '

[' . T('Delete') . ']' : ''); @@ -149,10 +148,4 @@ if ($_REQUEST['do'] == 'modify') $admin->page_end(); } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/attachment.php b/attachment.php index 3406c8d..9725139 100755 --- a/attachment.php +++ b/attachment.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -24,28 +24,24 @@ $fetchtemplates = array( 'editattach' ); -define('SVN', '$Id$'); $focus['showreport'] = 'focus'; require_once('./global.php'); -require_once('./includes/class_api_error.php'); require_once('./includes/class_notification.php'); require_once('./includes/api_attachment.php'); require_once('./includes/api_comment.php'); -APIError(array(new API_Error_Handler($message), 'user_cumulative')); - -if (isset($bugsys->in['attachmentid'])) +if (isset($input->in['attachmentid'])) { - $attachment = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "attachment WHERE attachmentid = " . $bugsys->input_clean('attachmentid', TYPE_UINT)); + $attachment = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "attachment WHERE attachmentid = " . $input->inputClean('attachmentid', TYPE_UINT)); if (!$attachment) { $message->error(L_INVALID_ID); } } -$bug = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = " . (($attachment['attachmentid']) ? $attachment['bugid'] : $bugsys->input_clean('bugid', TYPE_UINT))); +$bug = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = " . (($attachment['attachmentid']) ? $attachment['bugid'] : $input->inputClean('bugid', TYPE_UINT))); if (!$bug) { $message->error(L_INVALID_ID); @@ -58,15 +54,15 @@ if (!check_bug_permissions($bug)) require_once('./includes/class_logging.php'); -$notif = new NotificationCenter; -$notif->set_bug_data($bug); +$notif = new NotificationCenter(); +$notif->setBugData($bug); // ################################################################### if ($_POST['do'] == 'insert') { - $attachapi = new AttachmentAPI($bugsys); - $attachapi->set('bugid', $bugsys->in['bugid']); + $attachapi = new AttachmentAPI(); + $attachapi->set('bugid', $input->in['bugid']); if (!can_perform('canputattach', $bug['product'])) { @@ -74,11 +70,11 @@ if ($_POST['do'] == 'insert') } // max packet size - $var = $db->query_first("SHOW VARIABLES LIKE 'max_allowed_packet'"); - $bugsys->debug("max_allowed_packet = $var[Value]"); + $var = $db->queryFirst("SHOW VARIABLES LIKE 'max_allowed_packet'"); + BSApp::debug("max_allowed_packet = $var[Value]"); // create alias - $FILE =& $_FILES['attachment']; + $FILE = &$_FILES['attachment']; // PHP errors switch ($FILE['error']) @@ -108,49 +104,49 @@ if ($_POST['do'] == 'insert') $attachapi->set('filename', $FILE['name']); $attachapi->set('mimetype', $FILE['type']); $attachapi->set('filesize', $FILE['size']); - $attachapi->set('description', $bugsys->in['description']); - $attachapi->set('userid', $bugsys->userinfo['userid']); + $attachapi->set('description', $input->in['description']); + $attachapi->set('userid', bugdar::$userinfo['userid']); // insert an attachment if (!$message->hasErrors()) { $attachapi->insert(); - $obsoletes = $bugsys->input_clean('obsoletes', TYPE_UINT); + $obsoletes = $input->inputClean('obsoletes', TYPE_UINT); - $notif->send_new_attachment_notice($attachapi->values, $obsoletes, $attachapi->insertid); + $notif->sendNewAttachmentNotice($attachapi->values, $obsoletes, $attachapi->insertid); // mark obsoletes if (is_array($obsoletes) AND sizeof($obsoletes) > 0) { $db->query("UPDATE " . TABLE_PREFIX . "attachment SET obsolete = 1 WHERE attachmentid IN (" . implode(',', $obsoletes) . ") AND !obsolete AND bugid = $bug[bugid]"); - foreach ($obsoletes AS $attachmentid) + foreach ($obsoletes as $attachmentid) { $log = new Logging; - $log->set_bugid($bug['bugid']); - $log->set_attachmentid($attachmentid); - $log->add_data(true, array('obsolete' => 0), array('obsolete'), false, 'attachment'); - $log->add_data(false, array('obsolete' => 1), array('obsolete'), false, 'attachment'); - $log->update_history(); + $log->setBugId($bug['bugid']); + $log->setAttachmentId($attachmentid); + $log->addData(true, array('obsolete' => 0), array('obsolete'), false, 'attachment'); + $log->addData(false, array('obsolete' => 1), array('obsolete'), false, 'attachment'); + $log->updateHistory(); } } // handle comment stuff - if (can_perform('canpostcomments', $bug['product']) AND trim($bugsys->in['comment'])) + if (can_perform('canpostcomments', $bug['product']) AND trim($input->in['comment'])) { - $comment = new CommentAPI($bugsys); - $comment->set('bugid', $bugsys->in['bugid']); - $comment->set('userid', $bugsys->userinfo['userid']); - $comment->set('comment', $bugsys->in['comment']); + $comment = new CommentAPI(); + $comment->set('bugid', $input->in['bugid']); + $comment->set('userid', bugdar::$userinfo['userid']); + $comment->set('comment', $input->in['comment']); $comment->set('dateline', $attachapi->values['dateline']); $comment->insert(); - $notif->send_new_comment_notice($comment->values); + $notif->sendNewCommentNotice($comment->values); } // update the last post data - $db->query("UPDATE " . TABLE_PREFIX . "bug SET lastposttime = " . $attachapi->values['dateline'] . ", hiddenlastposttime = " . $attachapi->values['dateline'] . ", lastpostby = " . $bugsys->userinfo['userid'] . ", hiddenlastpostby = " . $bugsys->userinfo['userid'] . " WHERE bugid = $bug[bugid]"); + $db->query("UPDATE " . TABLE_PREFIX . "bug SET lastposttime = " . $attachapi->values['dateline'] . ", hiddenlastposttime = " . $attachapi->values['dateline'] . ", lastpostby = " . bugdar::$userinfo['userid'] . ", hiddenlastpostby = " . bugdar::$userinfo['userid'] . " WHERE bugid = $bug[bugid]"); $notif->finalize(); @@ -172,64 +168,70 @@ if ($_REQUEST['do'] == 'add') $message->errorPermission(); } - $MAXFILESIZE = $funct->fetch_max_attachment_size(); + $MAXFILESIZE = BSFunctions::fetch_max_php_file_size(); $show['addcomment'] = ((can_perform('canpostcomments', $bug['product'])) ? true : false); $show['obsoletes'] = false; $obsoletes_fetch = $db->query("SELECT * FROM " . TABLE_PREFIX . "attachment WHERE bugid = $bug[bugid] AND !obsolete"); $obsoletes = ''; - while ($obsolete = $db->fetch_array($obsoletes_fetch)) + foreach ($obsoletes_fetch as $obsolete) { $show['obsoletes'] = true; - $obsoletes .= "
in['obsoletes']) AND in_array($obsolete['attachmentid'], $bugsys->in['obsoletes']) ? ' checked="checked"' : '') . " /> $obsolete[filename]" . ($obsolete['description'] ? " [$obsolete[description]]" : '') . "
\n"; + $obsoletes .= "
in['obsoletes']) AND in_array($obsolete['attachmentid'], $input->in['obsoletes']) ? ' checked="checked"' : '') . " /> $obsolete[filename]" . ($obsolete['description'] ? " [$obsolete[description]]" : '') . "
\n"; } - eval('$template->flush("' . $template->fetch('newattach') . '");'); + $tpl = new BSTemplate('newattach'); + $tpl->vars = array( + 'bug' => $bug, + 'message' => $message, + 'MAXFILESIZE' => $MAXFILESIZE, + 'obsoletes' => $obsoletes, + 'input' => $input + ); + $tpl->evaluate()->flush(); } // ################################################################### if ($_POST['do'] == 'update') { - if (!(can_perform('caneditattach', $bug['product']) OR ($attachment['userid'] == $bugsys->userinfo['userid'] AND can_perform('canputattach', $bug['product'])))) + if (!(can_perform('caneditattach', $bug['product']) OR ($attachment['userid'] == bugdar::$userinfo['userid'] AND can_perform('canputattach', $bug['product'])))) { $message->errorPermission(); } - $attachapi = new AttachmentAPI($bugsys); - $attachapi->set('attachmentid', $bugsys->in['attachmentid']); - $attachapi->dorelations = array(); - $attachapi->set_condition(); + $attachapi = new AttachmentAPI(); + $attachapi->set('attachmentid', $input->in['attachmentid']); - if ($bugsys->in['__delete__'] != '') + if ($input->in['__delete__'] != '') { if (!(can_perform('caneditattach', $bug['product']) AND can_perform('candeletedata', $bug['productid']))) { $message->errorPermission(); } - $attachapi->delete(); + $attachapi->remove(); $message->redirect(T('The attachment was successfully deleted.'), "showreport.php?bugid=$bug[bugid]"); } else { - $log = new Logging; - $log->set_bugid($bug['bugid']); - $log->set_attachmentid($bugsys->in['attachmentid']); + $log = new Logging(); + $log->setBugId($bug['bugid']); + $log->setAttachmentId($input->in['attachmentid']); $attachapi->fetch(); - $log->add_data(true, $attachapi->objdata, array('attachment'), true, 'attachment'); + $log->addData(true, $attachapi->record, array('attachment'), true, 'attachment'); - $attachapi->set('description', $bugsys->in['description']); - $attachapi->set('obsolete', $bugsys->in['obsolete']); + $attachapi->set('description', $input->in['description']); + $attachapi->set('obsolete', $input->in['obsolete']); $attachapi->update(); - $log->add_data(false, $attachapi->values, array('attachment'), true, 'attachment'); + $log->addData(false, $attachapi->values, array('attachment'), true, 'attachment'); - $log->update_history(); + $log->updateHistory(); $message->redirect(T('The attachment was successfully modified.'), "showreport.php?bugid=$bug[bugid]"); } @@ -239,20 +241,19 @@ if ($_POST['do'] == 'update') if ($_REQUEST['do'] == 'edit') { - if (!(can_perform('caneditattach', $bug['product']) OR ($attachment['userid'] == $bugsys->userinfo['userid'] AND can_perform('canputattach', $bug['product'])))) + if (!(can_perform('caneditattach', $bug['product']) OR ($attachment['userid'] == bugdar::$userinfo['userid'] AND can_perform('canputattach', $bug['product'])))) { $message->errorPermission(); } $show['delete'] = (can_perform('caneditattach', $bug['product']) AND can_perform('candeletedata', $bug['productid'])); - eval('$template->flush("' . $template->fetch('editattach') . '");'); + $tpl = new BSTemplate('editattach'); + $tpl->vars = array( + 'attachment' => $attachment, + 'bug' => $bug + ); + $tpl->evaluate()->flush(); } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/docs/cache_templates.php b/docs/cache_templates.php index 3310f60..cf47230 100644 --- a/docs/cache_templates.php +++ b/docs/cache_templates.php @@ -6,7 +6,7 @@ chdir('..'); require_once('./global.php'); -$files = $funct->scandir('templates'); +$files = BSFunctions::scan_directory('templates'); $db->query("TRUNCATE TABLE " . TABLE_PREFIX . "template"); @@ -14,7 +14,7 @@ foreach ($files AS $path => $bits) { foreach ($bits AS $file) { - if ($funct->fetch_extension($file) == 'tpl') + if (BSFunctions::fetch_extension($file) == 'tpl') { $db->query("INSERT INTO " . TABLE_PREFIX . "template (filename, template, timestamp) VALUES ('$path" . substr($file, 0, strlen($file) - 4) . "', '" . $db->escape_string($template->_parse(file_get_contents("templates/$path$file"))) . "', " . time() . ")"); } diff --git a/docs/datatools.php b/docs/datatools.php index ab3be6e..a039366 100644 --- a/docs/datatools.php +++ b/docs/datatools.php @@ -63,7 +63,7 @@ if ($_REQUEST['do'] == 'export') foreach ($THELIST AS $display => $data) { $fetch = $db->query("SELECT * FROM " . TABLE_PREFIX . "$data[table]" . (!$data['orderfree'] ? " ORDER BY {$data[table]}id ASC" : "")); - while ($fitem = $db->fetch_array($fetch)) + foreach ($fetch as $fitem) { $exportlist["$display"][] = $fitem; } @@ -175,7 +175,7 @@ if ($_REQUEST['do'] == 'settings') /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -198,7 +198,7 @@ if ($_REQUEST['do'] == 'settings') FILE; $settings = $db->query("SELECT * FROM " . TABLE_PREFIX . "setting"); - while ($setting = $db->fetch_array($settings)) + foreach ($settings as $setting) { $fout .= "\n\t'$setting[varname]' => '" . str_replace("'", "\'", $setting['value']) . "',"; } diff --git a/docs/dev_phases_2-0.txt b/docs/dev_phases_2-0.txt new file mode 100644 index 0000000..1ea39ed --- /dev/null +++ b/docs/dev_phases_2-0.txt @@ -0,0 +1,50 @@ +Bugdar PHASES OF DEVELOPMENT +================================================================================ + +Because Bugdar 2.0 is a substantial development effort, its progress will be +broken into unique, defined stages. No time will be allotted to these stages +because this is only to group different phases of development. + +PHASE 1: ISSO CONVERSION +########################################### +- Upgrade the infrastructure of Bugdar to use ISSO3 +- Straight swap-out of ISSO2 components to v3 +- The 1.2.x series running under ISSO3 +- Exception of the Admin CP, because the BSPrinter modules are being removed + + +PHASE 2: PRINTER MODULE SPRINT DEVELOPMENT +########################################### +- Remove the ISSO3 Printer modules +- Replace with CSS stylesheets that use extremely-semenatic markup +- Rewrite the Admin CP to use templates with new stylesheets + + +PHASE 3: REWRITE LANGUAGE SYSTEM +########################################### +- Switch from using Gettext MO files to a database-phrase system +- Database system will enable translation of dynamic data (help system, field +names, statuses, etc.) +- Use phrase groups to prevent loading of all phrases into memory +- XML export system + + +PHASE 4: CORE REFACTORING +########################################### +- Refactor core code components to use more API functions to reduce controller +code +- Make projects more independent, allowing for product-specific custom fields, +etc. +- Re-envision Bugdar + + +PHASE 5: NEW FEATURES +########################################### +- Add new features from the bug database and planning_2_0.txt + + +PHASE 6: INTERFACE REDESIGN +########################################### +- Redesign interface +- AJAX where possible + diff --git a/docs/mailtest.php b/docs/mailtest.php index a80b5d5..a228757 100644 --- a/docs/mailtest.php +++ b/docs/mailtest.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -26,7 +26,7 @@ if (!file_exists('./global.php')) { chdir('../'); } -require_once('./global.php'); +require_once './global.php'; ?> in['__submit__'])) +if (empty($input->in['__submit__'])) { ?> @@ -70,10 +70,12 @@ Mail Test: " . '$Revision$' . " Sendmail (From): \"" . ini_get('sendmail_from') . "\" Sendmail (Path): \"" . ini_get('sendmail_path') . "\""; + require_once ISSO . '/Mail.php'; + $mail = new BSMail(); $mail->setFromName('Bugdar Mailing Test'); $mail->setSubject('Email Tests'); - if (empty($bugsys->in['receive']) OR empty($bugsys->in['sender']) OR !$funct->is_valid_email($bugsys->in['receive']) OR !$funct->is_valid_email($bugsys->in['sender'])) + if (empty($input->in['receive']) OR empty($input->in['sender']) OR !BSFunctions::is_valid_email($input->in['receive']) OR !BSFunctions::is_valid_email($input->in['sender'])) { echo '

You did not fill in all the fields or the email addresses are not valid. Please go back.

'; } @@ -81,27 +83,28 @@ Sendmail (Path): \"" . ini_get('sendmail_path') . "\""; { // normal Bugdar mailing $mail->setBodyText(sprintf($text, 1, 'sending with the Bugdar-configured address')); - $mail->send($bugsys->in['receive']); + $mail->setFromAddress(bugdar::$options['webmasteremail']); + $mail->send($input->in['receive']); // mail from the alternate address $mail->setBodyText(sprintf($text, 2, 'sending from the address you specified that exists on the mail server')); - $mail->setFromAddress($bugsys->in['sender']); - $mail->send($bugsys->in['receive']); + $mail->setFromAddress($input->in['sender']); + $mail->send($input->in['receive']); // mail from self $mail->setBodyText(sprintf($text, 3, 'sending from the receiving address')); - $mail->setFromAddress($bugsys->in['receive']); - $mail->send($bugsys->in['receive']); + $mail->setFromAddress($input->in['receive']); + $mail->send($input->in['receive']); // mail from non-existent $mail->setBodyText(sprintf($text, 4, 'sending from a non-existent address')); - $mail->setFromAddress(preg_replace('#(.*)@(.*)#', 'bugdar-mail-test@\2', $bugsys->in['receive'])); - $mail->send($bugsys->in['receive']); + $mail->setFromAddress(preg_replace('#(.*)@(.*)#', 'bugdar-mail-test@\2', $input->in['receive'])); + $mail->send($input->in['receive']); ?>

Complete

-

All the test emails were sent to in['receive'] ?>. Please check that you received all 4 tests.

+

All the test emails were sent to in['receive'] ?>. Please check that you received all 4 tests.

\ No newline at end of file diff --git a/docs/migrate_custom_fields.php b/docs/migrate_custom_fields.php index 3385441..9738c10 100644 --- a/docs/migrate_custom_fields.php +++ b/docs/migrate_custom_fields.php @@ -8,14 +8,14 @@ require_once('global.php'); // gets all the fields $fields = $db->query("SELECT * FROM " . TABLE_PREFIX . "bugfield"); -while ($field = $db->fetch_array($fields)) +foreach ($fields as $field) { // create the database field $db->query("ALTER TABLE " . TABLE_PREFIX . "bug ADD custom$field[fieldid] MEDIUMTEXT NULL"); // update all the data $data = $db->query("SELECT * FROM " . TABLE_PREFIX . "bugvaluefill"); - while ($custom = $db->fetch_array($data)) + foreach ($data as $custom) { $db->query("UPDATE " . TABLE_PREFIX . "bug SET custom$field[fieldid] = '" . $db->escape_string($custom["field$field[fieldid]"]) . "' WHERE bugid = $custom[bugid]"); } diff --git a/docs/populate.php b/docs/populate.php index df0c02b..00b5f50 100644 --- a/docs/populate.php +++ b/docs/populate.php @@ -6,21 +6,21 @@ include 'includes/api_comment.php'; for ($i = 11; $i < 111; $i++) { - $bug = new BugAPI($bugsys); - $comment = new CommentAPI($bugsys); + $bug = new BugAPI(); + $comment = new CommentAPI(); - $bug->set('userid', $bugsys->userinfo['userid']); - $bug->set('username', $bugsys->userinfo['displayname']); + $bug->set('userid', bugdar::$userinfo['userid']); + $bug->set('username', bugdar::$userinfo['displayname']); $bug->set('summary', 'AUTO POPULATE: ' . $i); $bug->set('severity', 1); - $comment->set('userid', $bugsys->userinfo['userid']); - $comment->set('comment', $funct->rand(100)); + $comment->set('userid', bugdar::$userinfo['userid']); + $comment->set('comment', BSFunctions::random(100)); - $bug->set('priority', $bugsys->options['defaultpriority']); - $bug->set('status', $bugsys->options['defaultstatus']); - $bug->set('resolution', $bugsys->options['defaultresolve']); - $bug->set('assignedto', $bugsys->options['defaultassign']); + $bug->set('priority', bugdar::$options['defaultpriority']); + $bug->set('status', bugdar::$options['defaultstatus']); + $bug->set('resolution', bugdar::$options['defaultresolve']); + $bug->set('assignedto', bugdar::$options['defaultassign']); $bug->set('product', 6); $bug->set('component', 0); @@ -31,7 +31,7 @@ for ($i = 11; $i < 111; $i++) $comment->set('bugid', $bug->insertid); $comment->insert(); - $bug = new BugAPI($bugsys); // need to destroy because update will think the insert fields need to be changed, too + $bug = new BugAPI(); // need to destroy because update will think the insert fields need to be changed, too $bug->dorelations = array(); $bug->set('bugid', $comment->values['bugid']); $bug->set_condition(); @@ -39,11 +39,11 @@ for ($i = 11; $i < 111; $i++) $bug->set('dateline', $comment->values['dateline']); $bug->set('initialreport', $comment->insertid); $bug->set('lastposttime', $comment->values['dateline']); - $bug->set('lastpostby', $bugsys->userinfo['userid']); - $bug->set('lastpostbyname', $bugsys->userinfo['displayname']); + $bug->set('lastpostby', bugdar::$userinfo['userid']); + $bug->set('lastpostbyname', bugdar::$userinfo['displayname']); $bug->set('hiddenlastposttime', $comment->values['dateline']); - $bug->set('hiddenlastpostby', $bugsys->userinfo['userid']); - $bug->set('hiddenlastpostbyname', $bugsys->userinfo['displayname']); + $bug->set('hiddenlastpostby', bugdar::$userinfo['userid']); + $bug->set('hiddenlastpostbyname', bugdar::$userinfo['displayname']); $bug->update(); } diff --git a/docs/post-commit.php b/docs/post-commit.php index edc346b..f4df3d3 100755 --- a/docs/post-commit.php +++ b/docs/post-commit.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -53,7 +53,7 @@ if (preg_match_all('#(fixe(s|d)|close(s|d)) bug://(report/)?([0-9]*)#i', $output foreach ($matches[5] AS $id) { - $api = new BugAPI($bugsys); + $api = new BugAPI(); $api->set('bugid', $id); $api->set_condition(); $api->set('status', 4); @@ -62,10 +62,4 @@ if (preg_match_all('#(fixe(s|d)|close(s|d)) bug://(report/)?([0-9]*)#i', $output } } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/docs/systemglob.php b/docs/systemglob.php index b84c4a1..efcfdb2 100644 --- a/docs/systemglob.php +++ b/docs/systemglob.php @@ -5,7 +5,7 @@ require_once('./global.php'); echo '
';
 
-print_r($bugsys);
+print_r(get_class_vars('bugdar'));
 
 echo '
'; diff --git a/docs/update_bug_names.php b/docs/update_bug_names.php index 9e1a3a7..d33dc81 100644 --- a/docs/update_bug_names.php +++ b/docs/update_bug_names.php @@ -7,13 +7,13 @@ require_once('./global.php'); $userlist = array(); $users = $db->query("SELECT userid, displayname FROM " . TABLE_PREFIX . "user"); -while ($user = $db->fetch_array($users)) +foreach ($users as $user) { $userlist["$user[userid]"] = $user['displayname']; } $bugs = $db->query("SELECT * FROM " . TABLE_PREFIX . "bug"); -while ($bug = $db->fetch_array($bugs)) +foreach ($bugs as $bug) { $db->query(" UPDATE " . TABLE_PREFIX . "bug diff --git a/docs/update_bug_table_cache.php b/docs/update_bug_table_cache.php index 87a5956..189feea 100644 --- a/docs/update_bug_table_cache.php +++ b/docs/update_bug_table_cache.php @@ -5,7 +5,7 @@ require_once('./global.php'); $comments = $db->query("SELECT * FROM " . TABLE_PREFIX . "comment ORDER BY bugid, dateline ASC"); -while ($comment = $db->fetch_array($comments)) +foreach ($comments as $comment) { if (!isset($replace["$comment[bugid]"])) { diff --git a/docs/update_field_order_in_bugs.php b/docs/update_field_order_in_bugs.php index 2f96280..0c47bb4 100644 --- a/docs/update_field_order_in_bugs.php +++ b/docs/update_field_order_in_bugs.php @@ -25,19 +25,19 @@ $fields = array( ); $bugs = $db->query("SELECT * FROM " . TABLE_PREFIX . "bug"); -while ($bug = $db->fetch_array($bugs)) +foreach ($bugs as $bug) { $db->query("UPDATE " . TABLE_PREFIX . "bug SET priority = " . $fields['priority']["$bug[priority]"] . ", severity = " . $fields['severity']["$bug[severity]"] . " WHERE bugid = " . $bug['bugid']); } $severity = $db->query("SELECT * FROM " . TABLE_PREFIX . "severity"); -while ($thing = $db->fetch_array($severity)) +foreach ($severity as $thing) { $db->query("UPDATE " . TABLE_PREFIX . "severity SET severityid = " . rand(10, 100000) . " WHERE severityid = $thing[severityid]"); } $priority = $db->query("SELECT * FROM " . TABLE_PREFIX . "priority"); -while ($thing = $db->fetch_array($priority)) +foreach ($priority as $thing) { $db->query("UPDATE " . TABLE_PREFIX . "priority SET priorityid = " . rand(10, 100000) . " WHERE priorityid = $thing[priorityid]"); } diff --git a/docs/update_history.php b/docs/update_history.php index f430944..13b53ef 100644 --- a/docs/update_history.php +++ b/docs/update_history.php @@ -10,7 +10,7 @@ require_once('./global.php'); $total = $nodo = 0; $history = $db->query("SELECT * FROM " . TABLE_PREFIX . "history"); -while ($log = $db->fetch_array($history)) +foreach ($history as $log) { $matches = array(); if (preg_match('#custom_field([0-9]+?)#i', $log['field'], $matches)) diff --git a/editcomment.php b/editcomment.php index 2dbf56e..0b3de8c 100644 --- a/editcomment.php +++ b/editcomment.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -23,24 +23,20 @@ $fetchtemplates = array( 'editcomment' ); -define('SVN', '$Id$'); $focus['showreport'] = 'focus'; require_once('./global.php'); require_once('./includes/api_comment.php'); -require_once('./includes/class_api_error.php'); -APIError(array(new API_Error_Handler($message), 'user_cumulative')); -$commentapi = new CommentAPI($bugsys); -$commentapi->set('commentid', $bugsys->in['commentid']); -$commentapi->set_condition(); +$commentapi = new CommentAPI(); +$commentapi->set('commentid', $input->in['commentid']); $commentapi->fetch(); -$comment =& $commentapi->objdata; +$comment = &$commentapi->record; -$bug = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = $comment[bugid]"); +$bug = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = $comment[bugid]"); if (!check_bug_permissions($bug)) { @@ -64,14 +60,14 @@ if ($_POST['do'] == 'kill') } // get the last post (as in prior to deletion) - $lastpost = $db->query_first("SELECT commentid FROM " . TABLE_PREFIX . "comment WHERE bugid = $bug[bugid] ORDER BY dateline DESC"); + $lastpost = $db->queryFirst("SELECT commentid FROM " . TABLE_PREFIX . "comment WHERE bugid = $bug[bugid] ORDER BY dateline DESC"); - $commentapi->delete(); + $commentapi->remove(); // check to see if we need to rebuild the lastpost information if ($lastpost['commentid'] == $comment['commentid']) { - $lastgoodpublic = $db->query_first(" + $lastgoodpublic = $db->queryFirst(" SELECT comment.* AS comment, user.displayname AS username FROM " . TABLE_PREFIX . "comment AS comment LEFT JOIN " . TABLE_PREFIX . "user AS user @@ -79,7 +75,7 @@ if ($_POST['do'] == 'kill') WHERE bugid = $bug[bugid] AND !hidden ORDER BY dateline DESC "); - $lastgoodprivate = $db->query_first(" + $lastgoodprivate = $db->queryFirst(" SELECT comment.* AS comment, user.displayname AS username FROM " . TABLE_PREFIX . "comment AS comment LEFT JOIN " . TABLE_PREFIX . "user AS user @@ -91,10 +87,10 @@ if ($_POST['do'] == 'kill') UPDATE " . TABLE_PREFIX . "bug SET hiddenlastposttime = $lastgoodpublic[dateline], hiddenlastpostby = $lastgoodpublic[userid], - hiddenlastpostbyname = '" . $db->escape_string($lastgoodpublic['username']) . "', + hiddenlastpostbyname = '" . $db->escapeString($lastgoodpublic['username']) . "', lastposttime = $lastgoodprivate[dateline], lastpostby = $lastgoodprivate[userid], - lastpostbyname = '" . $db->escape_string($lastgoodprivate['username']) . "' + lastpostbyname = '" . $db->escapeString($lastgoodprivate['username']) . "' WHERE bugid = $bug[bugid]" ); } @@ -123,16 +119,16 @@ if ($_REQUEST['do'] == 'delete') if ($_POST['do'] == 'update') { - if (!((can_perform('caneditownreply', $bug['product']) AND $bugsys->userinfo['userid'] == $comment['userid']) OR (can_perform('caneditotherreply', $bug['product']) AND $bugsys->userinfo['userid'] != $comment['userid']))) + if (!((can_perform('caneditownreply', $bug['product']) AND bugdar::$userinfo['userid'] == $comment['userid']) OR (can_perform('caneditotherreply', $bug['product']) AND bugdar::$userinfo['userid'] != $comment['userid']))) { $message->errorPermission(); } - $commentapi->set('comment', $bugsys->in['comment']); - $commentapi->set('parselinks', $bugsys->in['parselinks']); - $commentapi->set('hidden', $bugsys->in['hidden']); + $commentapi->set('comment', $input->in['comment']); + $commentapi->set('parselinks', $input->in['parselinks']); + $commentapi->set('hidden', $input->in['hidden']); - if ($bugsys->in['commentid'] == $bug['initialreport'] AND $bugsys->in['hidden']) + if ($input->in['commentid'] == $bug['initialreport'] AND $input->in['hidden']) { $message->addError(T('You cannot hide the first comment/initial report of a bug. Instead, hide the entire bug.')); } @@ -144,13 +140,13 @@ if ($_POST['do'] == 'update') // setup logging require_once('./includes/class_logging.php'); $log = new Logging; - $log->set_bugid($bug['bugid']); - $log->set_commentid($comment['commentid']); + $log->setBugId($bug['bugid']); + $log->setCommentId($comment['commentid']); - $log->add_data(true, $commentapi->objdata, array('comment', 'hidden'), false, 'comment'); - $log->add_data(false, $commentapi->values, array('comment', 'hidden'), false, 'comment'); + $log->addData(true, $commentapi->record, array('comment', 'hidden'), false, 'comment'); + $log->addData(false, $commentapi->values, array('comment', 'hidden'), false, 'comment'); - $lastgood = $db->query_first(" + $lastgood = $db->queryFirst(" SELECT comment.* AS comment, user.displayname AS username FROM " . TABLE_PREFIX . "comment AS comment LEFT JOIN " . TABLE_PREFIX . "user AS user @@ -162,11 +158,11 @@ if ($_POST['do'] == 'update') UPDATE " . TABLE_PREFIX . "bug SET hiddenlastposttime = $lastgood[dateline], hiddenlastpostby = $lastgood[userid], - hiddenlastpostbyname = '" . $db->escape_string($lastgood['username']) . "' + hiddenlastpostbyname = '" . $db->escapeString($lastgood['username']) . "' WHERE bugid = $bug[bugid]" ); - $log->update_history(); + $log->updateHistory(); $message->redirect(T('The comment was modified successfully.'), "showreport.php?bugid=$bug[bugid]"); } @@ -174,8 +170,8 @@ if ($_POST['do'] == 'update') { $show['errors'] = true; $_REQUEST['do'] = 'edit'; - $comment['comment'] = $bugsys->in['comment']; - $comment['hidden'] = $bugsys->in['hidden']; + $comment['comment'] = $input->in['comment']; + $comment['hidden'] = $input->in['hidden']; } } @@ -183,30 +179,29 @@ if ($_POST['do'] == 'update') if ($_REQUEST['do'] == 'edit') { - if (!((can_perform('caneditownreply', $bug['product']) AND $bugsys->userinfo['userid'] == $comment['userid']) OR (can_perform('caneditotherreply', $bug['product']) AND $bugsys->userinfo['userid'] != $comment['userid']))) + if (!((can_perform('caneditownreply', $bug['product']) AND bugdar::$userinfo['userid'] == $comment['userid']) OR (can_perform('caneditotherreply', $bug['product']) AND bugdar::$userinfo['userid'] != $comment['userid']))) { $message->errorPermission(); } - $comment['posttime'] = $datef->format($bugsys->options['dateformat'], $comment['dateline']); + $comment['posttime'] = $datef->format(bugdar::$options['dateformat'], $comment['dateline']); if ($comment['userid']) { - $commenter = new UserAPI($bugsys); + $commenter = new UserAPI(); $commenter->set('userid', $comment['userid']); - $commenter->set_condition(); $commenter->fetch(); - $commenter = $commenter->objdata; + $commenter = $commenter->record; } $comment['postby'] = construct_user_display($commenter); - $comment['comment'] = $bugsys->sanitize($comment['comment']); - $show['hide'] = ($bug['initialreport'] != $comment['commentid'] ? true : false); - eval('$template->flush("' . $template->fetch('editcomment') . '");'); + $comment['comment'] = $input->sanitize($comment['comment']); + $show['hide'] = ($bug['initialreport'] != $comment['commentid']); + + $tpl = new BSTemplate('editcomment'); + $tpl->vars = array( + 'comment' => $comment, + 'bug' => $bug + ); + $tpl->evaluate()->flush(); } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/editreport.php b/editreport.php index fe27347..09d941e 100644 --- a/editreport.php +++ b/editreport.php @@ -19,7 +19,6 @@ || ################################################################### \*=====================================================================*/ -define('SVN', '$Id$'); $focus['showreport'] = 'focus'; @@ -29,15 +28,12 @@ require_once('./includes/class_notification.php'); require_once('./includes/api_bug.php'); require_once('./includes/api_comment.php'); -require_once('./includes/class_api_error.php'); -APIError(array(new API_Error_Handler($message), 'user_cumulative')); - -$bug = $db->query_first(" +$bug = $db->queryFirst(" SELECT bug.*, user.email, user.displayname, user.showemail FROM " . TABLE_PREFIX . "bug AS bug LEFT JOIN " . TABLE_PREFIX . "user AS user ON (bug.userid = user.userid) - WHERE bug.bugid = " . $bugsys->input_clean('bugid', TYPE_UINT) + WHERE bug.bugid = " . $input->inputClean('bugid', TYPE_UINT) ); if (!$bug) @@ -52,15 +48,13 @@ if (!check_bug_permissions($bug)) // setup logging require_once('./includes/class_logging.php'); -$log = new Logging; -$log->set_bugid($bug['bugid']); +$log = new Logging(); +$log->setBugId($bug['bugid']); -$notif = new NotificationCenter; +$notif = new NotificationCenter(); -$bugapi = new BugAPI($bugsys); -$bugapi->set('bugid', $bugsys->in['bugid']); -$bugapi->set_condition(); -$bugapi->dorelations = array(); +$bugapi = new BugAPI(); +$bugapi->set('bugid', $input->in['bugid']); $bugapi->fetch(); // ################################################################### @@ -72,7 +66,7 @@ if ($_POST['do'] == 'kill') $message->errorPermission(); } - $bugapi->delete(); + $bugapi->remove(); $message->redirect(T('The entire bug has been deleted.'), 'index.php'); } @@ -93,18 +87,18 @@ if ($_REQUEST['do'] == 'delete') if ($_POST['do'] == 'update') { - if (!((can_perform('caneditown', $bug['product']) AND $bugsys->userinfo['userid'] == $bug['userid']) OR (can_perform('caneditother', $bug['product']) AND $bugsys->userinfo['userid'] != $bug['userid'])) AND !can_perform('canpostcomments', $bug['product'])) + if (!((can_perform('caneditown', $bug['product']) && bugdar::$userinfo['userid'] == $bug['userid']) || (can_perform('caneditother', $bug['product']) && bugdar::$userinfo['userid'] != $bug['userid'])) && !can_perform('canpostcomments', $bug['product'])) { $message->errorPermission(); } - $log->add_data(true, $bugapi->objdata, $log->getCommonFields(), true); + $log->addData(true, $bugapi->record, $log->getCommonFields(), true); // ------------------------------------------------------------------- // handle automations - if ($bugsys->in['automation']) + if ($input->in['automation']) { - $automation = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "automation WHERE actionid = " . $bugsys->input_clean('automation', TYPE_UINT)); + $automation = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "automation WHERE actionid = " . $input->inputClean('automation', TYPE_UINT)); if ($automation) { $automation['fields'] = unserialize($automation['fieldchanges']); @@ -113,7 +107,7 @@ if ($_POST['do'] == 'update') { foreach ($automation['fields']['builtin'] AS $field => $value) { - $bugsys->in["$field"] = $value; + $input->in["$field"] = $value; } } @@ -121,7 +115,7 @@ if ($_POST['do'] == 'update') { foreach ($automation['fields']['custom'] AS $field => $value) { - $bugsys->in["custom$field"] = $value; + $input->in["custom$field"] = $value; } } } @@ -129,40 +123,40 @@ if ($_POST['do'] == 'update') // ------------------------------------------------------------------- // process comment stuff - if ($bugsys->in['comment'] OR $automation['comment']) + if ($input->in['comment'] OR $automation['comment']) { - if (!empty($bugsys->in['comment']) AND $automation['comment']) + if (!empty($input->in['comment']) AND $automation['comment']) { - $commenttext = $bugsys->in['comment'] . "\n\n" . T('--------------- AUTOMATIC RESPONSE ---------------') . "\n" . $automation['comment']; + $commenttext = $input->in['comment'] . "\n\n" . T('--------------- AUTOMATIC RESPONSE ---------------') . "\n" . $automation['comment']; } - else if (empty($bugsys->in['comment']) AND $automation['comment']) + else if (empty($input->in['comment']) AND $automation['comment']) { $commenttext = $automation['comment']; } else { - $commenttext = $bugsys->in['comment']; + $commenttext = $input->in['comment']; } - $comment = new CommentAPI($bugsys); - $comment->set('bugid', $bugsys->in['bugid']); - $comment->set('userid', $bugsys->userinfo['userid']); + $comment = new CommentAPI(); + $comment->set('bugid', $input->in['bugid']); + $comment->set('userid', bugdar::$userinfo['userid']); $comment->set('comment', $commenttext); - $comment->set('parselinks', $bugsys->in['parselinks']); + $comment->set('parselinks', $input->in['parselinks']); $comment->insert(); // we redefine the bug data later, but it needs to be here in order to generate the user list - $notif->set_bug_data($bugapi->objdata); - $notif->send_new_comment_notice($comment->values); + $notif->setBugData($bugapi->record); + $notif->sendNewCommentNotice($comment->values); $bugapi->set('lastposttime', $comment->values['dateline']); - $bugapi->set('lastpostby', $bugsys->userinfo['userid']); - $bugapi->set('lastpostbyname', $bugsys->userinfo['displayname']); + $bugapi->set('lastpostby', bugdar::$userinfo['userid']); + $bugapi->set('lastpostbyname', bugdar::$userinfo['displayname']); $bugapi->set('hiddenlastposttime', $comment->values['dateline']); - $bugapi->set('hiddenlastpostby', $bugsys->userinfo['userid']); - $bugapi->set('hiddenlastpostbyname', $bugsys->userinfo['displayname']); + $bugapi->set('hiddenlastpostby', bugdar::$userinfo['userid']); + $bugapi->set('hiddenlastpostbyname', bugdar::$userinfo['displayname']); - if (!((can_perform('caneditown', $bug['product']) AND $bugsys->userinfo['userid'] == $bug['userid']) OR (can_perform('caneditother', $bug['product']) AND $bugsys->userinfo['userid'] != $bug['userid']))) + if (!((can_perform('caneditown', $bug['product']) AND bugdar::$userinfo['userid'] == $bug['userid']) OR (can_perform('caneditother', $bug['product']) AND bugdar::$userinfo['userid'] != $bug['userid']))) { $bugapi->update(); $notif->finalize(); @@ -172,18 +166,18 @@ if ($_POST['do'] == 'update') // ------------------------------------------------------------------- // do update stuff - $dependencies = preg_split('#([^0-9].*?)#', $bugsys->in['dependency'], -1, PREG_SPLIT_NO_EMPTY); + $dependencies = preg_split('#([^0-9].*?)#', $input->in['dependency'], -1, PREG_SPLIT_NO_EMPTY); $dependencies = ((sizeof($dependencies) < 1) ? '' : implode(', ', $dependencies)); - if ((can_perform('caneditown', $bug['product']) AND $bugsys->userinfo['userid'] == $bug['userid']) OR (can_perform('caneditother', $bug['product']) AND $bugsys->userinfo['userid'] != $bug['userid'])) + if ((can_perform('caneditown', $bug['product']) && bugdar::$userinfo['userid'] == $bug['userid']) || (can_perform('caneditother', $bug['product']) && bugdar::$userinfo['userid'] != $bug['userid'])) { - $bugapi->set('summary', $bugsys->in['summary']); - $bugapi->set('severity', $bugsys->in['severity']); - $bugapi->set('duplicateof', $bugsys->in['duplicateof']); + $bugapi->set('summary', $input->in['summary']); + $bugapi->set('severity', $input->in['severity']); + $bugapi->set('duplicateof', $input->in['duplicateof']); $bugapi->set('dependency', $dependencies); - $bugapi->set('hidden', $bugsys->in['hidden']); + $bugapi->set('hidden', $input->in['hidden']); - $product = explode(',', $bugsys->in['product']); + $product = explode(',', $input->in['product']); $bugapi->set('product', $product[0]); $bugapi->set('component', $product[1]); $bugapi->set('version', $product[2]); @@ -191,13 +185,13 @@ if ($_POST['do'] == 'update') if (can_perform('canchangestatus', $bug['product'])) { - $bugapi->set('priority', $bugsys->in['priority']); - $bugapi->set('status', $bugsys->in['status']); - $bugapi->set('resolution', $bugsys->in['resolution']); + $bugapi->set('priority', $input->in['priority']); + $bugapi->set('status', $input->in['status']); + $bugapi->set('resolution', $input->in['resolution']); } if (can_perform('canassign', $bug['product'])) { - $bugapi->set('assignedto', $bugsys->in['assignedto']); + $bugapi->set('assignedto', $input->in['assignedto']); } process_custom_fields($bugapi, $message, false); @@ -205,8 +199,8 @@ if ($_POST['do'] == 'update') // ------------------------------------------------------------------- // handle logging and perform updates - $notif->set_bug_data($bugapi->objdata, array_merge($bugapi->objdata, $bugapi->values)); - $log->add_data(false, $bugapi->values, $log->getCommonFields(), true); + $notif->setBugData($bugapi->record, array_merge($bugapi->record, $bugapi->values)); + $log->addData(false, $bugapi->values, $log->getCommonFields(), true); if (!$message->hasErrors()) { @@ -220,19 +214,13 @@ if ($_POST['do'] == 'update') // ------------------------------------------------------------------- // do diff history - $log->update_history(); + $log->updateHistory(); - $notif->send_bug_changes_notice(); + $notif->sendBugChangeNotice(); $notif->finalize(); $message->redirect(T('Your changes to the bug have been saved.'), "showreport.php?bugid=$bug[bugid]"); } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/explain.php b/explain.php index 1e13099..88fc894 100644 --- a/explain.php +++ b/explain.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -25,7 +25,6 @@ $fetchtemplates = array( 'explain_row' ); -define('SVN', '$Id$'); $focus['showreport'] = 'focus'; @@ -42,12 +41,12 @@ if (empty($_REQUEST['do'])) if ($_REQUEST['do'] == 'products') { - if (!is_array($bugsys->datastore['product'])) + if (!is_array(bugdar::$datastore['product'])) { $message->error(T('There are no products set up.')); } - foreach ($bugsys->datastore['product'] AS $product) + foreach (bugdar::$datastore['product'] AS $product) { if ($product['parentid']) { @@ -59,7 +58,7 @@ if ($_REQUEST['do'] == 'products') } } - foreach ($bugsys->datastore['version'] AS $version) + foreach (bugdar::$datastore['version'] AS $version) { $versions["$version[productid]"]["$version[versionid]"] = $version; } @@ -67,73 +66,89 @@ if ($_REQUEST['do'] == 'products') // global versions if (is_array($versions['0'])) { - foreach ($versions['0'] AS $version) + foreach ($versions['0'] as $version) { - $left = $version['version']; - $right = null; - eval('$globalversions .= "' . $template->fetch('explain_row') . '";'); + $tpl = new BSTemplate('explain_row'); + $tpl->vars = array( + 'left' => $version['version'], + ); + $globalversions .= $tpl->evaluate()->getTemplate(); } } - foreach ($products AS $product) + foreach ($products as $product) { - $left = $product['title']; - $right = $product['description']; - $trextra = ' class="altcolor"'; - eval('$productlist .= "' . $template->fetch('explain_row') . '";'); + $tpl = new BSTemplate('explain_row'); + $tpl->vars = array( + 'left' => $product['title'], + 'right' => $product['description'], + 'trextra' => ' class="altcolor"' + ); + $productlist .= $tpl->evaluate()->getTemplate(); if (is_array($components["$product[productid]"])) { - foreach ($components["$product[productid]"] AS $component) + foreach ($components["$product[productid]"] as $component) { - $left = '  ›   ' . $component['title']; - $right = $component['description']; - $trextra = ''; - eval('$productlist .= "' . $template->fetch('explain_row') . '";'); + $tpl = new BSTemplate('explain_row'); + $tpl->vars = array( + 'left' => '  ›   ' . $component['title'], + 'right' => $component['description'], + ); + $productlist .= $tpl->evaluate()->getTemplate(); } } } - eval('$template->flush("' . $template->fetch('explain_product') . '");'); + $tpl = new BSTemplate('explain_product'); + $tpl->vars = array( + 'globalversions' => $globalversions, + 'productlist' => $productlist + ); + $tpl->evaluate()->flush(); } // ################################################################### if ($_REQUEST['do'] == 'automations') { - $fields_fetch = $bugsys->db->query(" + $fields_fetch = $db->query(" SELECT bugfield.*, MAX(permission.mask) AS mask FROM " . TABLE_PREFIX . "bugfield AS bugfield LEFT JOIN " . TABLE_PREFIX . "bugfieldpermission AS permission ON (bugfield.fieldid = permission.fieldid) WHERE (permission.mask = 2 OR permission.mask = 1) - AND permission.usergroupid IN ({$bugsys->userinfo['usergroupid']}" . (sizeof($bugsys->userinfo['groupids']) != 0 ? ',' . implode(',', $bugsys->userinfo['groupids']) : '') . ") + AND permission.usergroupid IN (" . bugdar::$userinfo['usergroupid'] . (sizeof(bugdar::$userinfo['groupids']) != 0 ? ',' . implode(',', bugdar::$userinfo['groupids']) : '') . ") GROUP BY (bugfield.fieldid) "); - while ($field = $bugsys->db->fetch_array($fields_fetch)) + foreach ($fields_fetch as $field) { $fields["$field[fieldid]"] = $field; } - if (is_array($bugsys->datastore['automation'])) + if (is_array(bugdar::$datastore['automation'])) { - foreach ($bugsys->datastore['automation'] AS $automation) + foreach (bugdar::$datastore['automation'] as $automation) { $automation['fieldchanges'] = unserialize($automation['fieldchanges']); - $left = $automation['name']; - $right = $automation['description']; - $trextra = ' class="listinghead"'; - - eval('$automations .= "' . $template->fetch('explain_row') . '";'); + $tpl = new BSTemplate('explain_row'); + $tpl->vars = array( + 'left' => $automation['name'], + 'right' => $automation['description'], + 'trextra' => ' class="listinghead"' + ); + $automations .= $tpl->evaluate()->getTemplate(); if ($automation['comment']) { - $left = T('Add Comment'); - $right = $automation['comment']; - $trextra = ' class="altcolor"'; - - eval('$automations .= "' . $template->fetch('explain_row') . '";'); + $tpl = new BSTemplate('explain_row'); + $tpl->vars = array( + 'left' => T('Add Comment'), + 'right' => $automation['comment'], + 'trextra' => ' class="altcolor"' + ); + $automations .= $tpl->evaluate()->getTemplate(); } $trextra = ''; @@ -142,9 +157,12 @@ if ($_REQUEST['do'] == 'automations') { foreach ($automation['fieldchanges']['builtin'] AS $name => $value) { - $left = $name; - $right = $bugsys->datastore["$left"]["$value"]["$left"]; - eval('$automations .= "' . $template->fetch('explain_row') . '";'); + $tpl = new BSTemplate('explain_row'); + $tpl->vars = array( + 'left' => $name, + 'right' => bugdar::$datastore["$name"]["$value"]["$name"], + ); + $automations .= $tpl->evaluate()->getTemplate(); } } @@ -157,21 +175,20 @@ if ($_REQUEST['do'] == 'automations') continue; } - $left = $fields["$id"]['name'] . ' ' . sprintf(T('(Custom #%1$d, type: %2$s)'), $id, $fields["$id"]['type']); - $right = $value; - eval('$automations .= "' . $template->fetch('explain_row') . '";'); + $tpl = new BSTemplate('explain_row'); + $tpl->vars = array( + 'left' => $fields["$id"]['name'] . ' ' . sprintf(T('(Custom #%1$d, type: %2$s)'), $id, $fields["$id"]['type']), + 'right' => $value, + ); + $automations .= $tpl->evaluate()->getTemplate(); } } } } - eval('$template->flush("' . $template->fetch('explain_automation') . '");'); + $tpl = new BSTemplate('explain_automation'); + $tpl->vars = array('automations' => $automations); + $tpl->evaluate()->flush(); } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/favorite.php b/favorite.php index b9a5951..5bc8889 100644 --- a/favorite.php +++ b/favorite.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -19,7 +19,6 @@ || ################################################################### \*=====================================================================*/ -define('SVN', '$Id$'); if (empty($_REQUEST['do'])) { @@ -41,8 +40,8 @@ require_once('./includes/class_sort.php'); if ($_REQUEST['do'] == 'handle') { - $bugsys->input_clean('bugid', TYPE_UINT); - $bug = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = " . $bugsys->in['bugid']); + $input->inputClean('bugid', TYPE_UINT); + $bug = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = " . $input->in['bugid']); if (!check_bug_permissions($bug)) { $message->errorPermission(); @@ -53,15 +52,15 @@ if ($_REQUEST['do'] == 'handle') $message->errorPermission(); } - if ($db->query_first("SELECT * FROM " . TABLE_PREFIX . "favorite WHERE userid = " . $bugsys->userinfo['userid'] . " AND bugid = " . $bugsys->in['bugid'])) + if ($db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "favorite WHERE userid = " . bugdar::$userinfo['userid'] . " AND bugid = " . $input->in['bugid'])) { - $db->query("DELETE FROM " . TABLE_PREFIX . "favorite WHERE userid = " . $bugsys->userinfo['userid'] . " AND bugid = " . $bugsys->in['bugid']); - $message->redirect(T('This bug has been removed from your favorites list.'), "showreport.php?bugid=" . $bugsys->in['bugid']); + $db->query("DELETE FROM " . TABLE_PREFIX . "favorite WHERE userid = " . bugdar::$userinfo['userid'] . " AND bugid = " . $input->in['bugid']); + $message->redirect(T('This bug has been removed from your favorites list.'), "showreport.php?bugid=" . $input->in['bugid']); } else { - $db->query("INSERT INTO " . TABLE_PREFIX . "favorite (userid, bugid) VALUES (" . $bugsys->userinfo['userid'] . ", " . $bugsys->in['bugid'] . ")"); - $message->redirect(T('This bug has been added to your favorites list.'), "showreport.php?bugid=" . $bugsys->in['bugid']); + $db->query("INSERT INTO " . TABLE_PREFIX . "favorite (userid, bugid) VALUES (" . bugdar::$userinfo['userid'] . ", " . $input->in['bugid'] . ")"); + $message->redirect(T('This bug has been added to your favorites list.'), "showreport.php?bugid=" . $input->in['bugid']); } } @@ -78,11 +77,11 @@ if ($_REQUEST['do'] == 'manage') SELECT favorite.bugid, bug.* FROM " . TABLE_PREFIX . "favorite AS favorite RIGHT JOIN " . TABLE_PREFIX . "bug AS bug ON (favorite.bugid = bug.bugid) - WHERE favorite.userid = " . $bugsys->userinfo['userid'] . " - AND (!bug.hidden OR (bug.hidden AND bug.product IN (" . fetch_on_bits('canviewhidden') . "))" . (can_perform('canviewownhidden') ? " OR (bug.hidden AND bug.userid = " . $bugsys->userinfo['userid'] . " AND bug.product IN (" . fetch_on_bits('canviewownhidden') . "))" : "") . ") + WHERE favorite.userid = " . bugdar::$userinfo['userid'] . " + AND (!bug.hidden OR (bug.hidden AND bug.product IN (" . fetch_on_bits('canviewhidden') . "))" . (can_perform('canviewownhidden') ? " OR (bug.hidden AND bug.userid = " . bugdar::$userinfo['userid'] . " AND bug.product IN (" . fetch_on_bits('canviewownhidden') . "))" : "") . ") "); - if ($db->num_rows($favorites) < 1) + if ($favorites->size() < 1) { $message->error(T('You do not have any favorites in your list. To add a bug to your list, while viewing the report, click the [Add to Favorites] link next to the bug\'s ID.')); } @@ -91,20 +90,19 @@ if ($_REQUEST['do'] == 'manage') $headers = $sort->constructColumnHeaders(false); - while ($bug = $db->fetch_array($favorites)) + foreach ($favorites as $bug) { - $funct->exec_swap_bg('altcolor', ''); - $bug = ProcessBugDataForDisplay($bug, $funct->bgcolour); + BSFunctions::swap_css_classes('altcolor', ''); + $bug = ProcessBugDataForDisplay($bug, BSFunctions::$cssClass); $bugs .= $sort->constructRow($bug); } - eval('$template->flush("' . $template->fetch('favorites') . '");'); + $tpl = new BSTemplate('favorites'); + $tpl->vars = array( + 'bugs' => $bugs, + 'headers' => $headers + ); + $tpl->evaluate()->flush(); } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/global.php b/global.php index 0405f84..0781b7c 100755 --- a/global.php +++ b/global.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -25,22 +25,28 @@ define('HTML_CHECKED', ' checked="checked"'); // ################################################################### // initialize template system -$bugsys->load('template_fs', 'template', true); -$template->setExtension('tpl'); -$template->setPreParseHook('isso_pre_parse_hook'); -$template->setTemplateDir('templates/'); -$template->setDatabaseCache(TABLE_PREFIX . 'template'); -$template->langcall = 'T'; +require_once ISSO . '/Template.php'; +BSTemplate::$preParseHook = 'isso_pre_parse_hook'; +BSTemplate::$dbCacheTable = TABLE_PREFIX . 'template'; +BSTemplate::$langcall = 'T'; +BSTemplate::$templatePath = 'templates/%s.tpl'; + +// ################################################################### +// initialize the email system +require_once ISSO . '/Mail.php'; +require_once 'includes/emails.php'; + +define('MAIL_FROM_ADDRESS', bugdar::$options['webmasteremail']); +define('MAIL_FROM_NAME', bugdar::$options['trackertitle']); // ################################################################### // global template variables -$datetime = $datef->format('l, F j, Y g:i A'); -$year = $datef->format('Y'); -$version = $bugsys->options['trackerversion']; -$show['admin'] = (bool)can_perform('canadminpanel'); -$show['newreport'] = (bool)can_perform('cansubmitbugs'); -$show['search'] = (bool)can_perform('cansearch'); +$show = array( + 'admin' => can_perform('canadminpanel'), + 'newreport' => can_perform('cansubmitbugs'), + 'search' => can_perform('cansearch') +); if (!(defined('NO_TEMPLATES') AND constant('NO_TEMPLATES') == true)) { @@ -66,32 +72,29 @@ if (!(defined('NO_TEMPLATES') AND constant('NO_TEMPLATES') == true)) $start = microtime(); - $template->cache(array_merge($globaltemplates, (array)$fetchtemplates)); + BSTemplate::cache(array_merge($globaltemplates, (array)$fetchtemplates)); - $bugsys->debug('time for tpl cache: ' . $funct->fetch_microtime_diff($start)); + BSApp::debug('time for tpl cache: ' . BSFunctions::fetch_microtime_diff($start)); - eval('$header = "' . $template->fetch('header') . '";'); - eval('$doctype = "' . $template->fetch('doctype') . '";'); - eval('$headinclude = "' . $template->fetch('headinclude') . '";'); - eval('$footer = "' . $template->fetch('footer') . '";'); + BSTemplate::$globalVars = array( + 'stylevar' => &$stylevar, + 'show' => &$show, + 'focus' => $focus + ); + + $globalTemplates = array( + 'header' => BSTemplate::fetch('header')->evaluate()->getTemplate(), + 'doctype' => BSTemplate::fetch('doctype')->evaluate()->getTemplate(), + 'headinclude' => BSTemplate::fetch('headinclude')->evaluate()->getTemplate(), + 'footer' => BSTemplate::fetch('footer')->evaluate()->getTemplate(), + ); + + BSTemplate::$globalVars = array_merge($globalTemplates, BSTemplate::$globalVars); } -// ################################################################### - -// ################################################################### -// initialize template variables -$show = array(); - // ################################################################### // create error reporter require_once('./includes/class_message_reporter.php'); $message = new MessageReporter(); -$bugsys->message =& $message; -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/help.php b/help.php index c22ba31..9c6eb0b 100644 --- a/help.php +++ b/help.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -23,27 +23,22 @@ $fetchtemplates = array( 'help_window' ); -define('SVN', '$Id$'); require_once('./global.php'); -if (!$bugsys->in['topic'] OR !isset($bugsys->datastore['help'][ $bugsys->in['topic'] ])) +if (!$input->in['topic'] OR !isset(bugdar::$datastore['help'][ $input->in['topic'] ])) { $topic['title'] = T('Invalid'); $topic['body'] = T('That help topic does not exist in the system.'); } else { - $topic = $bugsys->datastore['help'][ $bugsys->in['topic'] ]; + $topic = bugdar::$datastore['help'][ $input->in['topic'] ]; $topic['body'] = nl2br($topic['body']); } -eval('$template->flush("' . $template->fetch('help_window') . '");'); +$tpl = new BSTemplate('help_window'); +$tpl->vars = array('topic' => $topic); +$tpl->evaluate()->flush(); -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/includes/api_attachment.php b/includes/api_attachment.php index e3b6915..0f05e2c 100644 --- a/includes/api_attachment.php +++ b/includes/api_attachment.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -19,67 +19,70 @@ || ################################################################### \*=====================================================================*/ -$GLOBALS['isso:callback']->load('api', null); +require_once ISSO . '/Api.php'; /** -* API: Attachment -* -* @author Blue Static -* @copyright Copyright ©2002 - 2007, Blue Static -* @version $Revision$ -* @package Bugdar -* -*/ -class AttachmentAPI extends API + * API: Attachment + * + * @author Blue Static + * @copyright Copyright (c)2004 - 2008, Blue Static + * @package Bugdar + * + */ +class AttachmentAPI extends BSApi { /** - * Fields - * @var array - * @access private - */ - var $fields = array( - 'attachmentid' => array(TYPE_UINT, REQ_AUTO, 'verify_nozero'), - 'bugid' => array(TYPE_UINT, REQ_YES, null, array('includes/api_bug.php', 'BugAPI')), - 'filename' => array(TYPE_STR, REQ_YES, 'verify_noempty'), + * Fields + * @var array + */ + protected $fields = array( + 'attachmentid' => array(TYPE_UINT, REQ_AUTO), + 'bugid' => array(TYPE_UINT, REQ_YES), + 'filename' => array(TYPE_STR, REQ_YES), 'mimetype' => array(TYPE_STR, REQ_YES), 'filesize' => array(TYPE_INT, REQ_NO), 'attachment' => array(TYPE_BIN, REQ_YES), 'description' => array(TYPE_STR, REQ_YES), 'dateline' => array(TYPE_UINT, REQ_SET), - 'userid' => array(TYPE_UINT, REQ_YES, null, array('includes/api_user.php', 'UserAPI')), + 'userid' => array(TYPE_UINT, REQ_YES), 'obsolete' => array(TYPE_BOOL, REQ_NO) ); /** - * Database table - * @var string - * @access private - */ - var $table = 'attachment'; + * Database table + * @var string + */ + protected $table = 'attachment'; /** - * Table prefix - * @var string - * @access private - */ - var $prefix = TABLE_PREFIX; + * Table prefix + * @var string + */ + protected $prefix = TABLE_PREFIX; - // ################################################################### /** - * Set field: dateline - * - * @access private - */ - function set_dateline() + * Set field: dateline + */ + protected function set_dateline() { $this->set('dateline', time()); } + + /** + * Validate: attachmentid + */ + protected function validate_attachmentid($field) + { + return $this->_verifyIsNotZero($field); + } + + /** + * Validate: filename + */ + protected function validate_filename($field) + { + return $this->_verifyIsNotEmpty($field); + } } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/includes/api_automation.php b/includes/api_automation.php index becfda3..cef5401 100644 --- a/includes/api_automation.php +++ b/includes/api_automation.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -19,95 +19,94 @@ || ################################################################### \*=====================================================================*/ -$GLOBALS['isso:callback']->load('api', null); - +require_once ISSO . '/Api.php'; require_once('./includes/functions_datastore.php'); /** -* API: Automation -* -* @author Blue Static -* @copyright Copyright ©2002 - 2007, Blue Static -* @version $Revision$ -* @package Bugdar -* -*/ -class AutomationAPI extends API + * API: Automation + * + * @author Blue Static + * @copyright Copyright (c)2004 - 2008, Blue Static + * @package Bugdar + * + */ +class AutomationAPI extends BSApi { /** - * Fields - * @var array - * @access private - */ - var $fields = array( - 'actionid' => array(TYPE_UINT, REQ_AUTO, 'verify_nozero'), - 'name' => array(TYPE_STR, REQ_YES, 'verify_noempty'), + * Fields + * @var array + */ + protected $fields = array( + 'actionid' => array(TYPE_UINT, REQ_AUTO), + 'name' => array(TYPE_STR, REQ_YES), 'description' => array(TYPE_STR, REQ_NO), - 'fieldchanges' => array(TYPE_NONE, REQ_YES, ':self'), + 'fieldchanges' => array(TYPE_NONE, REQ_YES), 'comment' => array(TYPE_STR, REQ_NO) ); /** - * Table - * @var string - * @access private - */ - var $table = 'automation'; + * Table + * @var string + */ + protected $table = 'automation'; /** - * Table prefix - * @var string - * @access private - */ - var $prefix = TABLE_PREFIX; + * Table prefix + * @var string + */ + protected $prefix = TABLE_PREFIX; - // ################################################################### /** - * Post-insert - * - * @access private - */ - function post_insert() + * Post-insert + */ + protected function post_insert() { build_automations(); } - // ################################################################### /** - * Post-update - * - * @access private - */ - function post_update() + * Post-update + */ + protected function post_update() { build_automations(); } - // ################################################################### /** - * Post-delete - * - * @access private - */ - function post_delete() + * Post-delete + */ + protected function post_delete() { build_automations(); } - // ################################################################### /** - * Verify: fieldchanges - * - * @access private - */ - function verify_fieldchanges() + * Validate: actionid + */ + protected function validate_actionid($field) { - if (!is_array($this->values['fieldchanges']) OR sizeof($this->values['fieldchanges']) != 2 OR !is_array($this->values['fieldchanges']['custom']) OR !is_array($this->values['fieldchanges']['builtin'])) + return $this->_verifyIsNotZero($field); + } + + /** + * Validate: name + */ + protected function validate_name($field) + { + return $this->_verifyIsNotEmpty($field); + } + + /** + * Validate: fieldchanges + */ + protected function validate_fieldchanges() + { + if (!is_array($this->values['fieldchanges']) || sizeof($this->values['fieldchanges']) != 2 || !is_array($this->values['fieldchanges']['custom']) || !is_array($this->values['fieldchanges']['builtin'])) { return T('Invalid array type passed. The fieldchaneges array must be a two-dimensional array: array("builtin" => array("fieldname" => "newvalue" ...), "custom" => array("fieldname" => "fieldvalue" ...))'); } - if (sizeof($this->values['fieldchanges']['custom']) < 1 AND sizeof($this->values['fieldchanges']['builtin']) < 1) + if (sizeof($this->values['fieldchanges']['custom']) < 1 && sizeof($this->values['fieldchanges']['builtin']) < 1) { return T('You need to specify some fields to change.'); } @@ -118,10 +117,4 @@ class AutomationAPI extends API } } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/includes/api_bug.php b/includes/api_bug.php index bf4d8d1..7c40009 100644 --- a/includes/api_bug.php +++ b/includes/api_bug.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -19,41 +19,39 @@ || ################################################################### \*=====================================================================*/ -$GLOBALS['isso:callback']->load('api', null); +require_once ISSO . '/Api.php'; /** -* API: Bug -* -* Note: When priority, severity, status, and resolution should throw a -* verification error, they actually set it to the default value -* -* @author Blue Static -* @copyright Copyright ©2002 - 2007, Blue Static -* @version $Revision$ -* @package Bugdar -* -*/ -class BugAPI extends API + * API: Bug + * + * Note: When priority, severity, status, and resolution should throw a + * verification error, they actually set it to the default value + * + * @author Blue Static + * @copyright Copyright (c)2004 - 2008, Blue Static + * @package Bugdar + * + */ +class BugAPI extends BSApi { /** - * Database fields - * @var array - * @access private - */ - var $fields = array( - 'bugid' => array(TYPE_UINT, REQ_AUTO, 'verify_nozero'), + * Database fields + * @var array + */ + protected $fields = array( + 'bugid' => array(TYPE_UINT, REQ_AUTO), 'userid' => array(TYPE_UINT, REQ_NO), 'username' => array(TYPE_STR, REQ_NO), 'dateline' => array(TYPE_UINT, REQ_SET), - 'product' => array(TYPE_UINT, REQ_YES, ':self'), - 'component' => array(TYPE_UINT, REQ_NO, ':self'), - 'version' => array(TYPE_UINT, REQ_YES, ':self'), - 'summary' => array(TYPE_STR, REQ_YES, 'verify_noempty'), - 'priority' => array(TYPE_UINT, REQ_NO, ':self'), - 'severity' => array(TYPE_UINT, REQ_NO, ':self'), - 'status' => array(TYPE_UINT, REQ_NO, ':self'), - 'resolution' => array(TYPE_UINT, REQ_NO, ':self'), - 'assignedto' => array(TYPE_UINT, REQ_NO, ':self', array('includes/api_user.php', 'UserAPI')), + 'product' => array(TYPE_UINT, REQ_YES), + 'component' => array(TYPE_UINT, REQ_NO), + 'version' => array(TYPE_UINT, REQ_YES), + 'summary' => array(TYPE_STR, REQ_YES), + 'priority' => array(TYPE_UINT, REQ_NO), + 'severity' => array(TYPE_UINT, REQ_NO), + 'status' => array(TYPE_UINT, REQ_NO), + 'resolution' => array(TYPE_UINT, REQ_NO), + 'assignedto' => array(TYPE_UINT, REQ_NO), 'duplicateof' => array(TYPE_STR, REQ_NO), 'dependency' => array(TYPE_STR, REQ_NO), 'hidden' => array(TYPE_BOOL, REQ_NO), @@ -67,28 +65,25 @@ class BugAPI extends API ); /** - * Database table - * @var string - * @access private - */ - var $table = 'bug'; + * Database table + * @var string + */ + protected $table = 'bug'; /** - * Table prefix - * @var string - * @access private - */ - var $prefix = TABLE_PREFIX; + * Table prefix + * @var string + */ + protected $prefix = TABLE_PREFIX; - // ################################################################### /** - * Subclassed set() that will intercept any custom fields and handle - * them appropriately, but everyting else will be passed to the parent. - */ + * Subclassed set() that will intercept any custom fields and handle + * them appropriately, but everyting else will be passed to the parent. + */ function set($field, $value, $doclean = true, $doverify = true) { // it's a custom field, so add it in - if (preg_match('#^custom#', $field) == 1 AND !isset($this->fields["$field"])) + if (preg_match('/^custom/', $field) == 1 && !isset($this->fields["$field"])) { $this->fields["$field"] = array(TYPE_STR, REQ_NO); } @@ -97,187 +92,157 @@ class BugAPI extends API parent::set($field, $value, $doclean, $doverify); } - // ################################################################### /** - * Set field: dateline - * - * @access private - */ - function set_dateline() + * Set field: dateline + */ + protected function set_dateline() { $this->set('dateline', time()); } - // ################################################################### /** - * Post-insert - * - * @access private - */ - function post_insert() + * Post-insert + */ + protected function post_insert() { - $this->registry->db->query("INSERT INTO " . TABLE_PREFIX . "vote (bugid, votefor, voteagainst) VALUES (" . $this->insertid . ", 0, 0)"); + BSApp::$db->query("INSERT INTO " . TABLE_PREFIX . "vote (bugid, votefor, voteagainst) VALUES (" . $this->insertid . ", 0, 0)"); } - // ################################################################### /** - * Post-delete - * - * @access private - */ - function post_delete() + * Post-delete + */ + protected function post_delete() { - $this->registry->db->query("DELETE FROM " . TABLE_PREFIX . "comment WHERE bugid = " . $this->values['bugid']); - $this->registry->db->query("DELETE FROM " . TABLE_PREFIX . "favorite WHERE bugid = " . $this->values['bugid']); - $this->registry->db->query("DELETE FROM " . TABLE_PREFIX . "history WHERE bugid = " . $this->values['bugid']); - $this->registry->db->query("DELETE FROM " . TABLE_PREFIX . "vote WHERE bugid = " . $this->values['bugid']); + BSApp::$db->query("DELETE FROM " . TABLE_PREFIX . "comment WHERE bugid = " . $this->values['bugid']); + BSApp::$db->query("DELETE FROM " . TABLE_PREFIX . "favorite WHERE bugid = " . $this->values['bugid']); + BSApp::$db->query("DELETE FROM " . TABLE_PREFIX . "history WHERE bugid = " . $this->values['bugid']); + BSApp::$db->query("DELETE FROM " . TABLE_PREFIX . "vote WHERE bugid = " . $this->values['bugid']); } - // ################################################################### /** - * Verify: product - * - * @access private - */ - function verify_product() + * Verify: product + */ + protected function validate_product($field) { - if (!($nozero = $this->verify_nozero('product'))) + if (!$this->_verifyIsNotZero('product')) { - return $nozero; + return false; } - if (!$this->registry->datastore['product'][ $this->values['product'] ]) + if (!bugdar::$datastore['product'][$this->values['product']]) { + $this->_error(new FieldException(L_INVALID_ID, $field)); return false; } + return true; } - // ################################################################### /** - * Verify: componentid - * - * @access private - */ - function verify_component() + * Verify: componentid + */ + protected function validate_component($field) { if ($this->values['component'] != 0) { - $component = $this->registry->datastore['component'][ $this->values['component'] ]; - $product = $this->registry->datastore['product'][ $this->values['product'] ]; - $version = $this->registry->datastore['version'][ $this->values['version'] ]; + $component = bugdar::$datastore['component'][ $this->values['component'] ]; + $product = bugdar::$datastore['product'][ $this->values['product'] ]; + $version = bugdar::$datastore['version'][ $this->values['version'] ]; if ($component['parentid'] != $product['productid']) { + $this->_error(new FieldException(L_INVALID_ID, $field)); return false; } - if (($version['productid'] != $component['productid'] AND $version['productid'] != $product['productid']) AND $version['productid'] != 0) + if (($version['productid'] != $component['productid'] && $version['productid'] != $product['productid']) && $version['productid'] != 0) { + $this->_error(new FieldException(L_INVALID_ID, $field)); return false; } } return true; } - // ################################################################### /** - * Verify: versionid - * - * @access private - */ - function verify_version() + * Verify: versionid + */ + protected function validate_version() { - if (!($nozero = $this->verify_nozero('version'))) + if ($this->_verifyIsNotZero('version')) { - return $nozero; + return false; } - if (!$this->registry->datastore['version'][ $this->values['version'] ]) + if (!bugdar::$datastore['version'][ $this->values['version'] ]) { + $this->_error(new FieldException(L_INVALID_ID, $field)); return false; } return true; } - // ################################################################### /** - * Verify: priority - * - * @access private - */ - function verify_priority() + * Verify: priority + */ + protected function validate_priority() { - if (!$this->registry->datastore['priority'][ $this->values['priority'] ]) + if (!bugdar::$datastore['priority'][ $this->values['priority'] ]) { - $this->set('priority', $this->registry->options['defaultpriority']); + $this->set('priority', bugdar::$options['defaultpriority']); } return true; } - // ################################################################### /** - * Verify: severity - * - * @access private - */ - function verify_severity() + * Verify: severity + * + * @access private + */ + protected function validate_severity() { - if (!$this->registry->datastore['severity'][ $this->values['severity'] ]) + if (!bugdar::$datastore['severity'][ $this->values['severity'] ]) { - $this->set('severity', $this->registry->options['defaultseverity']); + $this->set('severity', bugdar::$options['defaultseverity']); } return true; } - // ################################################################### /** - * Verify: status - * - * @access private - */ - function verify_status() + * Verify: status + */ + protected function validate_status() { - if (!$this->registry->datastore['status'][ $this->values['status'] ]) + if (!bugdar::$datastore['status'][ $this->values['status'] ]) { - $this->set('status', $this->registry->options['defaultstatus']); + $this->set('status', bugdar::$options['defaultstatus']); } return true; } - // ################################################################### /** - * Verify: resolution - * - * @access private - */ - function verify_resolution() + * Verify: resolution + */ + protected function validate_resolution() { - if (!$this->registry->datastore['resolution'][ $this->values['resolution'] ]) + if (!bugdar::$datastore['resolution'][ $this->values['resolution'] ]) { - $this->set('resolution', $this->registry->options['defaultresolve']); + $this->set('resolution', bugdar::$options['defaultresolve']); } return true; } - // ################################################################### /** - * Verify: assignedto - * - * @access private - */ - function verify_assignedto() + * Verify: assignedto + * + * @access private + */ + protected function validate_assignedto() { - if (!$this->registry->datastore['assignto'][ $this->values['assignedto'] ] AND $this->values['assignedto'] != 0) + if (!bugdar::$datastore['assignto'][ $this->values['assignedto'] ] && $this->values['assignedto'] != 0) { - $this->set('assignedto', $this->registry->options['defaultassign']); + $this->set('assignedto', bugdar::$options['defaultassign']); } return true; } } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/includes/api_comment.php b/includes/api_comment.php index 738c0f2..9fe38cf 100644 --- a/includes/api_comment.php +++ b/includes/api_comment.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -19,67 +19,57 @@ || ################################################################### \*=====================================================================*/ -$GLOBALS['isso:callback']->load('api', null); +require_once ISSO . '/Api.php'; /** -* API: Comment -* -* @author Blue Static -* @copyright Copyright ©2002 - 2007, Blue Static -* @version $Revision$ -* @package Bugdar -* -*/ -class CommentAPI extends API + * API: Comment + * + * @author Blue Static + * @copyright Copyright (c)2004 - 2008, Blue Static + * @package Bugdar + * + */ +class CommentAPI extends BSApi { /** - * Fields - * @var array - * @access private - */ - var $fields = array( - 'commentid' => array(TYPE_UINT, REQ_AUTO, 'verify_nozero'), - 'bugid' => array(TYPE_UINT, REQ_YES, 'verify_nozero'), + * Fields + * @var array + */ + protected $fields = array( + 'commentid' => array(TYPE_UINT, REQ_AUTO), + 'bugid' => array(TYPE_UINT, REQ_YES), 'userid' => array(TYPE_UINT, REQ_NO), 'dateline' => array(TYPE_UINT, REQ_SET), 'parselinks' => array(TYPE_BOOL, REQ_NO), - 'comment' => array(TYPE_STR, REQ_YES, 'verify_noempty'), + 'comment' => array(TYPE_STR, REQ_YES), 'comment_parsed' => array(TYPE_NONE, REQ_SET), 'hidden' => array(TYPE_BOOL, REQ_NO) ); /** - * Database table - * @var string - * @access private - */ - var $table = 'comment'; + * Database table + * @var string + */ + protected $table = 'comment'; /** - * Table prefix - * @var string - * @access private - */ - var $prefix = TABLE_PREFIX; + * Table prefix + * @var string + */ + protected $prefix = TABLE_PREFIX; - // ################################################################### /** - * Set field: dateline - * - * @access private - */ - function set_dateline() + * Set field: dateline + */ + protected function set_dateline() { $this->set('dateline', time()); } - // ################################################################### /** - * Set field: comment_parsed - * - * @access private - */ - function set_comment_parsed() + * Set field: comment_parsed + */ + protected function set_comment_parsed() { $comment = $this->values['comment']; if ($this->values['parselinks']) @@ -89,9 +79,9 @@ class CommentAPI extends API $comment = preg_replace('#(https?://|www\.)\S+#i', '\0', $comment); } - if ($this->registry->options['allowhtml']) + if (bugdar::$options['allowhtml']) { - $this->set('comment_parsed', nl2br($this->registry->unsanitize($comment))); + $this->set('comment_parsed', nl2br(BSApp::$input->unsanitize($comment))); } else { @@ -99,36 +89,48 @@ class CommentAPI extends API } } - // ################################################################### /** - * Pre-update - * - * @access private - */ - function pre_update() + * Pre-update + */ + protected function pre_update() { $this->set_comment_parsed(); } - // ################################################################### /** - * Pre-delete - * - * @access private - */ - function pre_delete() + * Pre-delete + */ + protected function pre_delete() { - if ($this->registry->db->query_first("SELECT * FROM " . TABLE_PREFIX . "bug WHERE initialreport = " . $this->values['commentid'])) + if (BSApp::$db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "bug WHERE initialreport = " . $this->values['commentid'])) { $this->error(T('You cannot delete this comment because it is attached to the bug as the first comment. You have to delete the entire bug instead (which is not recommended unless it is spam).')); } } + + /** + * Validate: commentid + */ + protected function validate_commentid($field) + { + return $this->_verifyIsNotZero($field); + } + + /** + * Validate: Bug ID + */ + protected function validate_bugid($field) + { + return $this->_verifyIsNotZero($field); + } + + /** + * Validate: comment + */ + protected function validate_comment($field) + { + return $this->_verifyIsNotEmpty($field); + } } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/includes/api_field.php b/includes/api_field.php index cb30369..8abfd26 100644 --- a/includes/api_field.php +++ b/includes/api_field.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -19,32 +19,29 @@ || ################################################################### \*=====================================================================*/ -$GLOBALS['isso:callback']->load('api', null); - +require_once ISSO . '/Api.php'; require_once('./includes/functions_datastore.php'); /** -* API: Field -* -* @author Blue Static -* @copyright Copyright ©2002 - 2007, Blue Static -* @version $Revision$ -* @package Bugdar -* -*/ -class FieldAPI extends API + * API: Field + * + * @author Blue Static + * @copyright Copyright (c)2004 - 2008, Blue Static + * @package Bugdar + * + */ +class FieldAPI extends BSApi { /** - * Fields - * @var array - * @access private - */ - var $fields = array( - 'fieldid' => array(TYPE_UINT, REQ_AUTO, 'verify_nozero'), - 'name' => array(TYPE_STR, REQ_YES, 'verify_noempty'), + * Fields + * @var array + */ + protected $fields = array( + 'fieldid' => array(TYPE_UINT, REQ_AUTO), + 'name' => array(TYPE_STR, REQ_YES), 'description' => array(TYPE_STR, REQ_NO), - 'type' => array(TYPE_STR, REQ_YES, ':self'), - 'selects' => array(TYPE_STR, REQ_NO, ':self'), + 'type' => array(TYPE_STR, REQ_YES), + 'selects' => array(TYPE_STR, REQ_NO), 'required' => array(TYPE_BOOL, REQ_NO), 'cansearch' => array(TYPE_BOOL, REQ_NO), 'regexmatch' => array(TYPE_STR, REQ_NO), @@ -54,33 +51,27 @@ class FieldAPI extends API ); /** - * Database table - * @var string - * @access private - */ - var $table = 'bugfield'; + * Database table + * @var string + */ + protected $table = 'bugfield'; /** - * Table prefix - * @var string - * @access private - */ - var $prefix = TABLE_PREFIX; + * Table prefix + * @var string + */ + protected $prefix = TABLE_PREFIX; - // ################################################################### /** - * A static method that is used to return an array of all the allowed - * field types. - * - * @access public - * - * @param string Return the display name of a type if the key is passed - * - * @return array An array of all the allowed field types - */ - function field_types($type = null) + * A static method that is used to return an array of all the allowed + * field types. + * + * @param string Return the display name of a type if the key is passed + * + * @return array An array of all the allowed field types + */ + public static function field_types($type = null) { - global $lang; $types = array( 'input_text' => T('Single-Line Text Box'), 'input_checkbox' => T('Checkbox Flag'), @@ -97,71 +88,72 @@ class FieldAPI extends API } } - // ################################################################### /** - * Post-insert - * - * @access private - */ - function post_insert() + * Post-insert + */ + protected function post_insert() { build_user_help(); } - // ################################################################### /** - * Post-update - * - * @access private - */ - function post_update() + * Post-update + */ + protected function post_update() { build_user_help(); } - // ################################################################### /** - * Post-delete - * - * @access private - */ - function post_delete() + * Post-delete + */ + protected function post_delete() { - $this->registry->db->query("DELETE FROM " . TABLE_PREFIX . "bugfield WHERE fieldid = " . $this->values['fieldid']); - $this->registry->db->query("DELETE FROM " . TABLE_PREFIX . "bugfieldpermission WHERE fieldid = " . $this->values['fieldid']); - $this->registry->db->query("ALTER TABLE " . TABLE_PREFIX . "bug DROP custom" . $this->values['fieldid']); - $this->registry->db->query("OPTIMIZE TABLE " . TABLE_PREFIX . "bug"); + BSApp::$db->query("DELETE FROM " . TABLE_PREFIX . "bugfield WHERE fieldid = " . $this->values['fieldid']); + BSApp::$db->query("DELETE FROM " . TABLE_PREFIX . "bugfieldpermission WHERE fieldid = " . $this->values['fieldid']); + BSApp::$db->query("ALTER TABLE " . TABLE_PREFIX . "bug DROP custom" . $this->values['fieldid']); + BSApp::$db->query("OPTIMIZE TABLE " . TABLE_PREFIX . "bug"); build_user_help(); } - // ################################################################### /** - * Verify: type - * - * @access private - */ - function verify_type() + * Validate: fieldid + */ + protected function validate_fieldid($field) { - if (!in_array($this->values['type'], array_keys(FieldAPI::field_types()))) + return $this->_verifyIsNotZero($field); + } + + /** + * Validate: name + */ + protected function validate_name($field) + { + return $this->_verifyIsNotEmpty($field); + } + + /** + * Validate: type + */ + protected function validate_type() + { + if (!in_array($this->values['type'], array_keys(self::field_types()))) { return false; } return true; } - // ################################################################### /** - * Verify: selects - * - * @access private - */ - function verify_selects() + * Validate: selects + */ + protected function validate_selects() { static $serialized; - if ($this->values['type'] == 'select_single' OR $this->objdata['type'] == 'select_single') + if ($this->values['type'] == 'select_single' || $this->record['type'] == 'select_single') { - $this->registry->debug('it works'); + BSApp::debug('it works'); // can't use explode() here because explode() returns !empty() when splitting an empty string // so we have to use preg_split with the PREG_SPLIT_NO_EMPTY flag to prevent this $selects = preg_split("#\n#", trim($this->values['selects']), 0, PREG_SPLIT_NO_EMPTY); @@ -183,10 +175,4 @@ class FieldAPI extends API } } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/includes/api_language.php b/includes/api_language.php index 856f701..8469bac 100644 --- a/includes/api_language.php +++ b/includes/api_language.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -19,120 +19,113 @@ || ################################################################### \*=====================================================================*/ -$GLOBALS['isso:callback']->load('api', null); - +require_once ISSO . '/Api.php'; require_once('./includes/functions_datastore.php'); /** -* API: Language -* -* @author Blue Static -* @copyright Copyright ©2002 - 2007, Blue Static -* @version $Revision$ -* @package Bugdar -* -*/ -class LanguageAPI extends API + * API: Language + * + * @author Blue Static + * @copyright Copyright (c)2004 - 2008, Blue Static + * @package Bugdar + * + */ +class LanguageAPI extends BSApi { /** - * Fields - * @var array - * @access private - */ - var $fields = array( - 'languageid' => array(TYPE_UINT, REQ_AUTO, 'verify_nozero'), - 'title' => array(TYPE_STR, REQ_YES, 'verify_noempty'), + * Fields + * @var array + */ + protected $fields = array( + 'languageid' => array(TYPE_UINT, REQ_AUTO), + 'title' => array(TYPE_STR, REQ_YES), 'charset' => array(TYPE_STR, REQ_YES), - 'direction' => array(TYPE_STR, REQ_NO, ':self'), + 'direction' => array(TYPE_STR, REQ_NO), 'userselect' => array(TYPE_BOOL, REQ_NO), 'langcode' => array(TYPE_STR, REQ_YES) ); /** - * Table - * @var string - * @access private - */ - var $table = 'language'; + * Table + * @var string + */ + protected $table = 'language'; /** - * Table prefix - * @var string - * @access private - */ - var $prefix = TABLE_PREFIX; + * Table prefix + * @var string + */ + protected $prefix = TABLE_PREFIX; - // ################################################################### /** - * Post-insert - * - * @access private - */ - function post_insert() + * Post-insert + */ + protected function post_insert() { build_languages(); } - // ################################################################### /** - * Post-update - * - * @access private - */ - function post_update() + * Post-update + */ + protected function post_update() { build_languages(); } - // ################################################################### /** - * Pre-delete - */ - function pre_delete() + * Pre-delete + */ + protected function pre_delete() { - $count = $this->registry->db->query_first("SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "language"); + $count = BSApp::$db->queryFirst("SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "language"); if ($count['count'] < 2) { - $this->error(T('At least one language needs to be present. Deleting this language would violate that.')); + throw new FieldException(T('At least one language needs to be present. Deleting this language would violate that.'), 'languageid'); } - if ($this->registry->options['defaultlanguage'] == $this->values['languageid']) + if (bugdar::$options['defaultlanguage'] == $this->values['languageid']) { - $this->error(T('You cannot delete the default language. Please select another language to be the default language and then delete this one.')); + throw new FieldException(T('You cannot delete the default language. Please select another language to be the default language and then delete this one.'), 'languageid'); } } - // ################################################################### /** - * Post-delete - * - * @access private - */ - function post_delete() + * Post-delete + */ + protected function post_delete() { build_languages(); } - // ################################################################### /** - * Verify: direction - * - * @access private - */ - function verify_direction() + * Verify: direction + */ + protected function validate_direction($field) { if (!in_array($this->values['direction'], array('ltr', 'rtl'))) { - return T('The direction must be ltr (left-to-right) or rtl (right-to-left)'); + $this->_error(new FieldError(T('The direction must be ltr (left-to-right) or rtl (right-to-left)'), $field)); + return false; } return true; } + + /** + * Validate: languageid + */ + protected function validate_languageid($field) + { + return $this->_verifyIsNotZero($field); + } + + /** + * Validate: title + */ + protected function validate_title($field) + { + return $this->_verifyIsNotEmpty($field); + } } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/includes/api_priority.php b/includes/api_priority.php index 03511a0..48a1634 100644 --- a/includes/api_priority.php +++ b/includes/api_priority.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -19,85 +19,81 @@ || ################################################################### \*=====================================================================*/ -$GLOBALS['isso:callback']->load('api', null); - +require_once ISSO . '/Api.php'; require_once('./includes/functions_datastore.php'); /** -* API: Priority -* -* @author Blue Static -* @copyright Copyright ©2002 - 2007, Blue Static -* @version $Revision$ -* @package Bugdar -* -*/ -class PriorityAPI extends API + * API: Priority + * + * @author Blue Static + * @copyright Copyright (c)2004 - 2008, Blue Static + * @package Bugdar + * + */ +class PriorityAPI extends BSApi { /** - * Fields - * @var array - * @access private - */ - var $fields = array( - 'priorityid' => array(TYPE_UINT, REQ_AUTO, 'verify_nozero'), - 'priority' => array(TYPE_STR, REQ_YES, 'verify_noempty'), + * Fields + * @var array + */ + protected $fields = array( + 'priorityid' => array(TYPE_UINT, REQ_AUTO), + 'priority' => array(TYPE_STR, REQ_YES), 'displayorder' => array(TYPE_INT, REQ_NO) ); /** - * Database table - * @var string - * @access private - */ - var $table = 'priority'; + * Database table + * @var string + */ + protected $table = 'priority'; /** - * Table prefix - * @var string - * @access private - */ - var $prefix = TABLE_PREFIX; + * Table prefix + * @var string + */ + protected $prefix = TABLE_PREFIX; - // ################################################################### /** - * Post-insert - * - * @access protected - */ - function post_insert() + * Post-insert + */ + protected function post_insert() { build_priorities(); } - // ################################################################### /** - * Post-update - * - * @access protected - */ - function post_update() + * Post-update + */ + protected function post_update() { build_priorities(); } - // ################################################################### /** - * Post-delete - * - * @access protected - */ - function post_delete() + * Post-delete + */ + protected function post_delete() { build_priorities(); - $this->registry->db->query("UPDATE " . TABLE_PREFIX . "bug SET priority = " . $this->registry->options['defaultpriority'] . " WHERE priority = " . $this->values['priorityid']); + BSApp::$db->query("UPDATE " . TABLE_PREFIX . "bug SET priority = " . bugdar::$options['defaultpriority'] . " WHERE priority = " . $this->values['priorityid']); + } + + /** + * Validate: priorityid + */ + protected function validate_priorityid($field) + { + return $this->_verifyIsNotZero($field); + } + + /** + * Validate: priority + */ + protected function validate_priority($field) + { + return $this->_verifyIsNotEmpty($field); } } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/includes/api_resolution.php b/includes/api_resolution.php index e0b87a9..9161620 100644 --- a/includes/api_resolution.php +++ b/includes/api_resolution.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -19,85 +19,81 @@ || ################################################################### \*=====================================================================*/ -$GLOBALS['isso:callback']->load('api', null); - +require_once ISSO . '/Api.php'; require_once('./includes/functions_datastore.php'); /** -* API: Resolution -* -* @author Blue Static -* @copyright Copyright ©2002 - 2007, Blue Static -* @version $Revision$ -* @package Bugdar -* -*/ -class ResolutionAPI extends API + * API: Resolution + * + * @author Blue Static + * @copyright Copyright (c)2004 - 2008, Blue Static + * @package Bugdar + * + */ +class ResolutionAPI extends BSApi { /** - * Fields - * @var array - * @access private - */ - var $fields = array( - 'resolutionid' => array(TYPE_UINT, REQ_AUTO, 'verify_nozero'), - 'resolution' => array(TYPE_STR, REQ_YES, 'verify_noempty'), + * Fields + * @var array + */ + protected $fields = array( + 'resolutionid' => array(TYPE_UINT, REQ_AUTO), + 'resolution' => array(TYPE_STR, REQ_YES), 'displayorder' => array(TYPE_INT, REQ_NO) ); /** - * Database table - * @var string - * @access private - */ - var $table = 'resolution'; + * Database table + * @var string + */ + protected $table = 'resolution'; /** - * Table prefix - * @var string - * @access private - */ - var $prefix = TABLE_PREFIX; + * Table prefix + * @var string + */ + protected $prefix = TABLE_PREFIX; - // ################################################################### /** - * Post-insert - * - * @access protected - */ - function post_insert() + * Post-insert + */ + protected function post_insert() { build_resolutions(); } - // ################################################################### /** - * Post-update - * - * @access protected - */ - function post_update() + * Post-update + */ + protected function post_update() { build_resolutions(); } - // ################################################################### /** - * Post-delete - * - * @access protected - */ - function post_delete() + * Post-delete + */ + protected function post_delete() { build_resolutions(); - $this->registry->db->query("UPDATE " . TABLE_PREFIX . "bug SET resolution = " . $this->registry->clean($this->registry->options['defaultresolve'], TYPE_UINT) . " WHERE resolution = " . $this->values['resolutionid']); + BSApp::$db->query("UPDATE " . TABLE_PREFIX . "bug SET resolution = " . BSApp::$input->clean(bugdar::$options['defaultresolve'], TYPE_UINT) . " WHERE resolution = " . $this->values['resolutionid']); + } + + /** + * Validate: resolutionid + */ + protected function validate_resolutionid($field) + { + return $this->_verifyIsNotZero($field); + } + + /** + * Validate: resolution + */ + protected function validate_resolution($field) + { + return $this->_verifyIsNotEmpty($field); } } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/includes/api_severity.php b/includes/api_severity.php index ef083e0..eb0a7d2 100644 --- a/includes/api_severity.php +++ b/includes/api_severity.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -19,85 +19,82 @@ || ################################################################### \*=====================================================================*/ -$GLOBALS['isso:callback']->load('api', null); +require_once ISSO . '/Api.php'; require_once('./includes/functions_datastore.php'); /** -* API: Severity -* -* @author Blue Static -* @copyright Copyright ©2002 - 2007, Blue Static -* @version $Revision$ -* @package Bugdar -* -*/ -class SeverityAPI extends API + * API: Severity + * + * @author Blue Static + * @copyright Copyright (c)2004 - 2008, Blue Static + * @package Bugdar + * + */ +class SeverityAPI extends BSApi { /** - * Fields - * @var array - * @access private - */ - var $fields = array( - 'severityid' => array(TYPE_UINT, REQ_AUTO, 'verify_nozero'), - 'severity' => array(TYPE_STR, REQ_YES, 'verify_noempty'), + * Fields + * @var array + */ + protected $fields = array( + 'severityid' => array(TYPE_UINT, REQ_AUTO), + 'severity' => array(TYPE_STR, REQ_YES), 'displayorder' => array(TYPE_INT, REQ_NO) ); /** - * Database table - * @var string - * @access private - */ - var $table = 'severity'; + * Database table + * @var string + */ + protected $table = 'severity'; /** - * Table prefix - * @var string - * @access private - */ - var $prefix = TABLE_PREFIX; + * Table prefix + * @var string + */ + protected $prefix = TABLE_PREFIX; - // ################################################################### /** - * Post-insert - * - * @access protected - */ - function post_insert() + * Post-insert + */ + protected function post_insert() { build_severities(); } - // ################################################################### /** - * Post-update - * - * @access protected - */ - function post_update() + * Post-update + */ + protected function post_update() { build_severities(); } - // ################################################################### /** - * Post-delete - * - * @access protected - */ - function post_delete() + * Post-delete + */ + protected function post_delete() { build_severities(); - $this->registry->db->query("UPDATE " . TABLE_PREFIX . "bug SET severity = " . $this->registry->options['defaultseverity'] . " WHERE severity = " . $this->values['severityid']); + BSApp::$db->query("UPDATE " . TABLE_PREFIX . "bug SET severity = " . bugdar::$options['defaultseverity'] . " WHERE severity = " . $this->values['severityid']); + } + + /** + * Validate: severityid + */ + protected function validate_statusid($field) + { + return $this->_verifyIsNotZero($field); + } + + /** + * Validate: severity + */ + protected function validate_status($field) + { + return $this->_verifyIsNotEmpty($field); } } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/includes/api_status.php b/includes/api_status.php index 71810a1..96821e0 100644 --- a/includes/api_status.php +++ b/includes/api_status.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -19,86 +19,83 @@ || ################################################################### \*=====================================================================*/ -$GLOBALS['isso:callback']->load('api', null); +require_once ISSO . '/Api.php'; require_once('./includes/functions_datastore.php'); /** -* API: Status -* -* @author Blue Static -* @copyright Copyright ©2002 - 2007, Blue Static -* @version $Revision$ -* @package Bugdar -* -*/ -class StatusAPI extends API + * API: Status + * + * @author Blue Static + * @copyright Copyright (c)2004 - 2008, Blue Static + * @package Bugdar + * + */ +class StatusAPI extends BSApi { /** - * Fields - * @var array - * @access private - */ - var $fields = array( - 'statusid' => array(TYPE_UINT, REQ_AUTO, 'verify_nozero'), - 'status' => array(TYPE_STR, REQ_YES, 'verify_noempty'), + * Fields + * @var array + */ + protected $fields = array( + 'statusid' => array(TYPE_UINT, REQ_AUTO), + 'status' => array(TYPE_STR, REQ_YES), 'color' => array(TYPE_STR, REQ_NO), 'displayorder' => array(TYPE_INT, REQ_NO) ); /** - * Database table - * @var string - * @access private - */ - var $table = 'status'; + * Database table + * @var string + */ + protected $table = 'status'; /** - * Table prefix - * @var string - * @access private - */ - var $prefix = TABLE_PREFIX; + * Table prefix + * @var string + */ + protected $prefix = TABLE_PREFIX; - // ################################################################### /** - * Post-insert - * - * @access protected - */ + * Post-insert + */ function post_insert() { build_statuses(); } - // ################################################################### /** - * Post-update - * - * @access protected - */ - function post_update() + * Post-update + */ + protected function post_update() { build_statuses(); } - // ################################################################### /** - * Post-delete - * - * @access protected - */ - function post_delete() + * Post-delete + */ + protected function post_delete() { build_statuses(); - $this->registry->db->query("UPDATE " . TABLE_PREFIX . "bug SET status = " . $this->registry->options['defaultstatus'] . " WHERE status = " . $this->values['statusid']); + BSApp::$db->query("UPDATE " . TABLE_PREFIX . "bug SET status = " . bugdar::$options['defaultstatus'] . " WHERE status = " . $this->values['statusid']); + } + + /** + * Validate: statusid + */ + protected function validate_statusid($field) + { + return $this->_verifyIsNotZero($field); + } + + /** + * Validate: status + */ + protected function validate_status($field) + { + return $this->_verifyIsNotEmpty($field); } } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/includes/api_user.php b/includes/api_user.php index 1b1ee9a..e684658 100644 --- a/includes/api_user.php +++ b/includes/api_user.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -19,33 +19,30 @@ || ################################################################### \*=====================================================================*/ -$GLOBALS['isso:callback']->load('api', null); - +require_once ISSO . '/Api.php'; require_once('./includes/functions_datastore.php'); require_once('./includes/class_sort.php'); /** -* API: User -* -* @author Blue Static -* @copyright Copyright ©2002 - 2007, Blue Static -* @version $Revision$ -* @package Bugdar -* -*/ -class UserAPI extends API + * API: User + * + * @author Blue Static + * @copyright Copyright (c)2004 - 2008, Blue Static + * @package Bugdar + * + */ +class UserAPI extends BSApi { /** - * Database fields - * @var array - * @access private - */ - var $fields = array( - 'userid' => array(TYPE_UINT, REQ_AUTO, 'verify_nozero'), - 'email' => array(TYPE_STR, REQ_YES, ':self'), - 'displayname' => array(TYPE_STR, REQ_YES, ':self'), - 'usergroupid' => array(TYPE_UINT, REQ_YES, ':self'), - 'groupids' => array(TYPE_STR, REQ_NO, ':self'), + * Database fields + * @var array + */ + protected $fields = array( + 'userid' => array(TYPE_UINT, REQ_AUTO), + 'email' => array(TYPE_STR, REQ_YES), + 'displayname' => array(TYPE_STR, REQ_YES), + 'usergroupid' => array(TYPE_UINT, REQ_YES), + 'groupids' => array(TYPE_STR, REQ_NO), 'password' => array(TYPE_STR, REQ_YES), 'salt' => array(TYPE_STR, REQ_SET), 'authkey' => array(TYPE_STR, REQ_SET), @@ -54,69 +51,55 @@ class UserAPI extends API 'languageid' => array(TYPE_UINT, REQ_NO), 'timezone' => array(TYPE_FLOAT,REQ_NO), 'usedst' => array(TYPE_BOOL, REQ_NO), - 'hidestatuses' => array(TYPE_STR, REQ_NO, ':self'), - 'defaultsortkey' => array(TYPE_STR, REQ_NO, ':self'), - 'defaultsortas' => array(TYPE_STR, REQ_NO, ':self'), - 'columnoptions' => array(TYPE_STR, REQ_NO, ':self'), + 'hidestatuses' => array(TYPE_STR, REQ_NO), + 'defaultsortkey' => array(TYPE_STR, REQ_NO), + 'defaultsortas' => array(TYPE_STR, REQ_NO), + 'columnoptions' => array(TYPE_STR, REQ_NO), 'authid' => array(TYPE_STR, REQ_NO) ); /** - * Database table - * @var string - * @access private - */ - var $table = 'user'; + * Database table + * @var string + */ + protected $table = 'user'; /** - * Table prefix - * @var string - * @access private - */ - var $prefix = TABLE_PREFIX; + * Table prefix + * @var string + */ + protected $prefix = TABLE_PREFIX; - // ################################################################### /** - * Set field: salt - * - * @access private - */ - function set_salt() + * Set field: salt + */ + protected function set_salt() { - $this->set('salt', $this->registry->funct->rand(array(1, 15))); + $this->set('salt', BSFunctions::random(rand(3, 15))); } - // ################################################################### /** - * Set field: authkey - * - * @access private - */ - function set_authkey() + * Set field: authkey + */ + protected function set_authkey() { - $this->set('authkey', $this->registry->funct->rand()); + $this->set('authkey', BSFunctions::random()); } - // ################################################################### /** - * Pre-insert - * - * @access private - */ - function pre_insert() + * Pre-insert + */ + protected function pre_insert() { $this->set('password', md5(md5($this->values['password']) . md5($this->values['salt']))); } - // ################################################################### /** - * Post-insert - * - * @access protected - */ - function post_insert() + * Post-insert + */ + protected function post_insert() { - $this->registry->db->query(" + BSApp::$db->query(" INSERT INTO " . TABLE_PREFIX . "useremail (userid, mask, relation) VALUES @@ -131,84 +114,77 @@ class UserAPI extends API build_assignedto(); } - // ################################################################### /** - * Verify: email - * - * @access private - */ - function verify_email() + * Validate: email + */ + protected function validate_email($field) { - if (!is_bool($ne = $this->verify_noempty('email'))) + if (!$this->_verifyIsNotEmpty($field)) { - return $ne; + return false; } - if (!$this->registry->funct->is_valid_email($this->values['email'])) + if (!BSFunctions::is_valid_email($this->values['email'])) { - return T('The specified email is invalid.'); + $this->_error(new FieldException(T('The specified email is invalid.'), 'email')); + return false; } - if ($this->registry->db->query_first("SELECT * FROM " . TABLE_PREFIX . "user WHERE email = '" . $this->registry->db->escape_string($this->values['email']) . "' AND userid <> " . $this->registry->clean($this->values['userid'], TYPE_UINT))) + if (BSApp::$db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "user WHERE email = '" . BSApp::$input->escape($this->values['email']) . "' AND userid <> " . BSApp::$input->clean($this->values['userid'], TYPE_UINT))) { - return T('The specified email is already in use.'); + $this->_error(new FieldException(T('The specified email is already in use.'), 'email')); + return false; } return true; } - // ################################################################### /** - * Verify: displayname - * - * @access private - */ - function verify_displayname() + * Validate: displayname + */ + protected function validate_displayname($field) { - if (!is_bool($ne = $this->verify_noempty('displayname'))) + if (!$this->_verifyIsNotEmpty($field)) { - return $ne; + return false; } - if ($this->registry->db->query_first("SELECT * FROM " . TABLE_PREFIX . "user WHERE displayname = '" . $this->registry->db->escape_string($this->values['displayname']) . "' AND userid <> " . $this->registry->clean($this->values['userid'], TYPE_UINT))) + if (BSApp::$db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "user WHERE displayname = '" . BSApp::$input->escape($this->values['displayname']) . "' AND userid <> " . BSApp::$input->clean($this->values['userid'], TYPE_UINT))) { - return T('That display name is already in use by another user.'); + $this->_error(new FieldException(T('That display name is already in use by another user.'), 'displayname')); + return false; } return true; } - // ################################################################### /** - * Verify: usergroupid - * - * @access private - */ - function verify_usergroupid() + * Validate: usergroupid + */ + protected function validate_usergroupid($field) { - if (!isset($this->registry->datastore['usergroup'][ $this->values['usergroupid'] ])) + if (!isset(bugdar::$datastore['usergroup'][ $this->values['usergroupid'] ])) { + $this->_error(new FieldException(L_INVALID_ID, $field)); return false; } return true; } - // ################################################################### /** - * Verify: groupids - * - * @access private - */ - function verify_groupids() + * Validate: groupids + */ + protected function validate_groupids($field) { $groups = $this->values['groupids']; if (!is_array($groups)) { $groups = explode(',', $this->values['groupids']); } - $groups = $this->registry->funct->array_strip_empty($groups); + $groups = BSFunctions::array_strip_empty($groups); - foreach ($groups AS $group) + foreach ($groups as $group) { - if (!isset($this->registry->datastore['usergroup']["$group"])) + if (!isset(bugdar::$datastore['usergroup']["$group"])) { + $this->_error(new FieldException(L_INVALID_ID, $field)); return false; } } @@ -218,68 +194,60 @@ class UserAPI extends API return true; } - // ################################################################### /** - * Pre-update - * - * @access private - */ - function pre_update() + * Pre-update + */ + protected function pre_update() { - $this->set_condition(); + $this->setCondition(); $this->fetch(); if ($this->values['password'] == '') { - $this->set('password', $this->objdata['password']); + $this->set('password', $this->record['password']); } else { - $this->registry->debug("updating password = true"); - $this->set('password', md5(md5($this->values['password']) . md5($this->objdata['salt']))); + BSApp::debug("updating password = true"); + $this->set('password', md5(md5($this->values['password']) . md5($this->record['salt']))); } } - // ################################################################### /** - * Post-update - * - * @access protected - */ - function post_update() + * Post-update + */ + protected function post_update() { if (isset($this->values['displayname'])) { - $username = $this->registry->escape($this->values['displayname']); + $username = BSApp::$input->escape($this->values['displayname']); $id = $this->values['userid']; - $this->registry->db->query("UPDATE " . TABLE_PREFIX . "bug SET username = '$username' WHERE userid = $id"); - $this->registry->db->query("UPDATE " . TABLE_PREFIX . "bug SET lastpostbyname = '$username' WHERE lastpostby = $id"); - $this->registry->db->query("UPDATE " . TABLE_PREFIX . "bug SET hiddenlastpostbyname = '$username' WHERE hiddenlastpostby = $id"); + BSApp::$db->query("UPDATE " . TABLE_PREFIX . "bug SET username = '$username' WHERE userid = $id"); + BSApp::$db->query("UPDATE " . TABLE_PREFIX . "bug SET lastpostbyname = '$username' WHERE lastpostby = $id"); + BSApp::$db->query("UPDATE " . TABLE_PREFIX . "bug SET hiddenlastpostbyname = '$username' WHERE hiddenlastpostby = $id"); } - if (isset($this->values['displayname']) OR isset($this->values['email'])) + if (isset($this->values['displayname']) || isset($this->values['email'])) { build_assignedto(); } } - // ################################################################### /** - * Pre-delete - * - * @access protected - */ - function pre_delete() + * Pre-delete + */ + protected function pre_delete() { - if ($this->values['userid'] == $this->registry->userinfo['userid']) + if ($this->values['userid'] == bugdar::$userinfo['userid']) { + $this->error(T('You cannot delete your own account!')); } if ($this->values['usergroupid'] == 6) { - $count = $this->registry->db->query_first("SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "user WHERE usergroupid = 6 AND userid <> " . $this->values['userid']); + $count = BSApp::$db->queryFirst("SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "user WHERE usergroupid = 6 AND userid <> " . $this->values['userid']); if ($count['count'] < 1) { $this->error(T('At least one other administrator needs to be present before you can delete this user')); @@ -287,30 +255,24 @@ class UserAPI extends API } } - // ################################################################### /** - * Post-delete - * - * @access protected - */ - function post_delete() + * Post-delete + */ + protected function post_delete() { - $this->registry->db->query("DELETE FROM " . TABLE_PREFIX . "user WHERE userid = " . $this->values['userid']); - $this->registry->db->query("DELETE FROM " . TABLE_PREFIX . "favorite WHERE userid = " . $this->values['userid']); - $this->registry->db->query("DELETE FROM " . TABLE_PREFIX . "useractivation WHERE userid = " . $this->values['userid']); - $this->registry->db->query("DELETE FROM " . TABLE_PREFIX . "useremail WHERE userid = " . $this->values['userid']); - $this->registry->db->query("DELETE FROM " . TABLE_PREFIX . "search WHERE userid = " . $this->values['userid']); + BSApp::$db->query("DELETE FROM " . TABLE_PREFIX . "user WHERE userid = " . $this->values['userid']); + BSApp::$db->query("DELETE FROM " . TABLE_PREFIX . "favorite WHERE userid = " . $this->values['userid']); + BSApp::$db->query("DELETE FROM " . TABLE_PREFIX . "useractivation WHERE userid = " . $this->values['userid']); + BSApp::$db->query("DELETE FROM " . TABLE_PREFIX . "useremail WHERE userid = " . $this->values['userid']); + BSApp::$db->query("DELETE FROM " . TABLE_PREFIX . "search WHERE userid = " . $this->values['userid']); build_assignedto(); } - // ################################################################### /** - * Verify: hidestatuses - * - * @access private - */ - function verify_hidestatuses() + * Validate: hidestatuses + */ + protected function validate_hidestatuses($field) { if (is_array($this->values['hidestatuses'])) { @@ -320,45 +282,38 @@ class UserAPI extends API return true; } - // ################################################################### /** - * Verify: defaultsortkey - * - * @access private - */ - function verify_defaultsortkey() + * Validate: defaultsortkey + */ + protected function validate_defaultsortkey($field) { if (!ListSorter::fetch_by_text($this->values['defaultsortkey'])) { + $this->_error(new FieldException(L_INVALID_ID, $field)); return false; } return true; } - // ################################################################### /** - * Verify: defaultsortas - * - * @access private - */ - function verify_defaultsortas() + * Validate: defaultsortas + */ + protected function validate_defaultsortas($field) { if (!ListSorter::fetch_as_text($this->values['defaultsortas'])) { + $this->_error(new FieldException(L_INVALID_ID, $field)); return false; } return true; } - // ################################################################### /** - * Verify: columnoptions - * - * @access private - */ - function verify_columnoptions() + * Validate: columnoptions + */ + protected function validate_columnoptions($field) { if (is_array($this->values['columnoptions'])) { @@ -368,10 +323,4 @@ class UserAPI extends API } } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/includes/api_usergroup.php b/includes/api_usergroup.php index 2344287..46e2433 100644 --- a/includes/api_usergroup.php +++ b/includes/api_usergroup.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -19,105 +19,99 @@ || ################################################################### \*=====================================================================*/ -$GLOBALS['isso:callback']->load('api', null); - +require_once ISSO . '/Api.php'; require_once('./includes/functions_datastore.php'); /** -* API: Usergroup -* -* @author Blue Static -* @copyright Copyright ©2002 - 2007, Blue Static -* @version $Revision$ -* @package Bugdar -* -*/ -class UsergroupAPI extends API + * API: Usergroup + * + * @author Blue Static + * @copyright Copyright (c)2004 - 2008, Blue Static + * @package Bugdar + * + */ +class UsergroupAPI extends BSApi { /** - * Fields - * @var array - * @access private - */ - var $fields = array( - 'usergroupid' => array(TYPE_UINT, REQ_AUTO, 'verify_nozero'), - 'title' => array(TYPE_STR, REQ_YES, 'verify_noempty'), + * Fields + * @var array + */ + protected $fields = array( + 'usergroupid' => array(TYPE_UINT, REQ_AUTO), + 'title' => array(TYPE_STR, REQ_YES), 'displaytitle' => array(TYPE_STR, REQ_NO), 'permissions' => array(TYPE_UINT, REQ_NO) ); /** - * Database table - * @var string - * @access private - */ - var $table = 'usergroup'; + * Database table + * @var string + */ + protected $table = 'usergroup'; /** - * Table prefix - * @var string - * @access private - */ - var $prefix = TABLE_PREFIX; + * Table prefix + * @var string + */ + protected $prefix = TABLE_PREFIX; - // ################################################################### /** - * Post-insert - * - * @access private - */ - function post_insert() + * Post-insert + */ + protected function post_insert() { build_usergroups(); } - // ################################################################### /** - * Post-update - * - * @access private - */ - function post_update() + * Post-update + */ + protected function post_update() { build_usergroups(); build_assignedto(); } - // ################################################################### /** - * Pre-delete - * - * @access private - */ - function pre_delete() + * Pre-delete + */ + protected function pre_delete() { if ($this->values['usergroupid'] < 7) { - return T('You can\'t delete a default usergroup.'); + throw new FieldException(T('You can\'t delete a default usergroup.'), 'usergroupid'); + return false; } } - // ################################################################### /** - * Post-delete - * - * @access private - */ - function post_delete() + * Post-delete + */ + protected function post_delete() { - $this->registry->db->query("DELETE FROM " . TABLE_PREFIX . "permission WHERE usergroupid = " . $this->values['usergroupid']); - $this->registry->db->query("DELETE FROM " . TABLE_PREFIX . "bugfieldpermission WHERE usergroupid = " . $this->values['usergroupid']); - $this->registry->db->query("UPDATE " . TABLE_PREFIX . "user SET usergroupid = 2 WHERE usergroupid = " . $this->values['usergroupid']); + BSApp::$db->query("DELETE FROM " . TABLE_PREFIX . "permission WHERE usergroupid = " . $this->values['usergroupid']); + BSApp::$db->query("DELETE FROM " . TABLE_PREFIX . "bugfieldpermission WHERE usergroupid = " . $this->values['usergroupid']); + BSApp::$db->query("UPDATE " . TABLE_PREFIX . "user SET usergroupid = 2 WHERE usergroupid = " . $this->values['usergroupid']); build_usergroups(); build_permissions(); build_assignedto(); } + + /** + * Validate: usergroupid + */ + protected function validate_usergroupid($field) + { + return $this->_verifyIsNotZero($field); + } + + /** + * Validate: usergroup + */ + protected function validate_usergroup($field) + { + return $this->_verifyIsNotEmpty($field); + } } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/includes/api_userhelp.php b/includes/api_userhelp.php index 5cedef2..afd09b8 100644 --- a/includes/api_userhelp.php +++ b/includes/api_userhelp.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -19,56 +19,49 @@ || ################################################################### \*=====================================================================*/ -$GLOBALS['isso:callback']->load('api', null); +require_once ISSO . '/Api.php'; require_once('./includes/functions_datastore.php'); /** -* API: User help -* -* @author Blue Static -* @copyright Copyright ©2002 - 2007, Blue Static -* @version $Revision$ -* @package Bugdar -* -*/ -class UserHelpAPI extends API + * API: User help + * + * @author Blue Static + * @copyright Copyright (c)2004 - 2008, Blue Static + * @package Bugdar + * + */ +class UserHelpAPI extends BSApi { /** - * Fields - * @var array - * @access private - */ - var $fields = array( + * Fields + * @var array + */ + protected $fields = array( 'keystring' => array(TYPE_STR, REQ_AUTO), - 'title' => array(TYPE_STR, REQ_YES, 'verify_noempty'), + 'title' => array(TYPE_STR, REQ_YES), 'body' => array(TYPE_STR, REQ_YES) ); /** - * Database table - * @var string - * @access private - */ - var $table = 'fieldhelp'; + * Database table + * @var string + */ + protected $table = 'fieldhelp'; /** - * Table prefix - * @var string - * @access private - */ - var $prefix = TABLE_PREFIX; + * Table prefix + * @var string + */ + protected $prefix = TABLE_PREFIX; - // ################################################################### /** - * A static function that returns an array of all the keystrings that - * are not allowed to be deleted - * - * @access public - * - * @return array Array of keystrings - */ - function not_able_to_delete() + * A static function that returns an array of all the keystrings that + * are not allowed to be deleted + * + * @return array Array of keystrings + */ + public static function not_able_to_delete() { return array( 'assignedto', @@ -88,99 +81,73 @@ class UserHelpAPI extends API ); } - // ################################################################### /** - * Pre-insert - * - * @access private - */ - function pre_insert() - { - if (($err = $this->verify_keystring()) !== true) - { - $this->error($err); - } - } - - // ################################################################### - /** - * Post-insert - * - * @access private - */ - function post_insert() + * Post-insert + */ + protected function post_insert() { build_user_help(); } - // ################################################################### /** - * Post-update - * - * @access private - */ - function post_update() + * Post-update + */ + protected function post_update() { build_user_help(); } - // ################################################################### /** - * Pre-delete - * - * @access private - */ - function pre_delete() + * Pre-delete + */ + protected function pre_delete() { - if (in_array($this->values['keystring'], UserHelpAPI::not_able_to_delete())) + if (in_array($this->values['keystring'], self::not_able_to_delete())) { - return false; + throw new FieldException(T('You cannot delete this user help text because the system needs it.'), 'keystring'); } - return true; } - // ################################################################### /** - * Post-delete - * - * @access private - */ - function post_delete() + * Post-delete + */ + protected function post_delete() { build_user_help(); } - // ################################################################### /** - * Verify: keystring - * - * @access private - */ - function verify_keystring() + * Validate: title + */ + protected function validate_title($field) { - if (!is_bool($ne = $this->verify_noempty('keystring'))) + return $this->_verifyIsNotEmpty($field); + } + + /** + * Verify: keystring + */ + protected function validate_keystring($field) + { + if ($this->_verifyIsNotEmpty('keystring')) { - return $ne; + return false; } if (preg_match('#[^a-z0-9_]#', $this->values['keystring'])) { - return T('The unique key can only contain lowercase letters, underscores, and numbers.'); + $this->_error(new FieldException(T('The unique key can only contain lowercase letters, underscores, and numbers.'), $field)); + return false; } - if ($this->registry->db->query_first("SELECT * FROM " . TABLE_PREFIX . "fieldhelp WHERE keystring = '" . $this->registry->escape($this->values['keystring']) . "'")) + if (BSApp::$db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "fieldhelp WHERE keystring = '" . BSApp::$input->escape($this->values['keystring']) . "'")) { - return T('The unique key must be unique.'); + $this->_error(new FieldException(T('The unique key must be unique.'), $field)); + return false; } return true; } } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/includes/auth/auth.php b/includes/auth/auth.php index 34f7cd0..eb31b3e 100644 --- a/includes/auth/auth.php +++ b/includes/auth/auth.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -47,12 +47,6 @@ class Authentication */ var $db; - /** - * The Bugdar registry - * @var object - */ - var $registry; - /** * Array of user data from the AUTHENTICATION database * @var array @@ -82,12 +76,9 @@ class Authentication */ function __construct() { - global $bugsys; - - $this->registry =& $bugsys; - $this->db =& $bugsys->db; + $this->db = BSApp::$db; - $this->registry->debug('authentication system: ' . get_class($this)); + BSApp::debug('authentication system: ' . get_class($this)); $this->_setupDatabase(); } @@ -243,7 +234,7 @@ class Authentication */ function _fetchBugdarUserFromAuthUser() { - $user = $this->db->query_first("SELECT * FROM " . TABLE_PREFIX . "user WHERE authid = '" . $this->authUser[ $this->fieldMap['authid'] ] . "'"); + $user = $this->db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "user WHERE authid = '" . $this->authUser[ $this->fieldMap['authid'] ] . "'"); if (!$user) { return $this->_createBugdarUser(); @@ -264,7 +255,7 @@ class Authentication $user = new UserAPI($this->registry); // if the email already exists in the DB, it must be the same person so just hook up the authid - if ($check = $this->db->query_first("SELECT * FROM " . TABLE_PREFIX . "user WHERE email = '" . $this->db->escape_string($this->authUser[ $this->fieldMap['email'] ]) . "'")) + if ($check = $this->db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "user WHERE email = '" . $this->db->escape_string($this->authUser[ $this->fieldMap['email'] ]) . "'")) { $user->set('userid', $check['userid']); $user->set_condition(); @@ -272,7 +263,7 @@ class Authentication $user->update(); $user->fetch(); - return $user->objdata; + return $user->record; } else { @@ -338,10 +329,4 @@ class Authentication function _setCookies($permanent = false) {} } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/includes/auth/auth_default.php b/includes/auth/auth_default.php index 0fe42ca..4ceb556 100644 --- a/includes/auth/auth_default.php +++ b/includes/auth/auth_default.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -37,25 +37,25 @@ class AuthenticationDefault extends Authentication // ################################################################### function _setupDatabase() { - $this->authDb =& $this->db; + $this->authDb = $this->db; } // ################################################################### function _fetchCookieUniqueId() { - return $this->registry->input_clean(COOKIE_PREFIX . 'userid', TYPE_UINT); + return BSApp::$input->inputClean(COOKIE_PREFIX . 'userid', TYPE_UINT); } // ################################################################### function _fetchCookiePassword() { - return $this->registry->in[COOKIE_PREFIX . 'authkey']; + return BSApp::$input->in[COOKIE_PREFIX . 'authkey']; } // ################################################################### function _fetchUserUsingCookies() { - return $this->db->query_first("SELECT * FROM " . TABLE_PREFIX . "user WHERE userid = " . $this->_fetchCookieUniqueId()); + return $this->db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "user WHERE userid = " . $this->_fetchCookieUniqueId()); } // ################################################################### @@ -67,15 +67,15 @@ class AuthenticationDefault extends Authentication // ################################################################### function _setCookies($sticky = false) { - $this->registry->funct->cookie(COOKIE_PREFIX . 'userid', $this->authUser['userid'], $sticky); - $this->registry->funct->cookie(COOKIE_PREFIX . 'authkey', $this->authUser['authkey'], $sticky); + BSFunctions::cookie(COOKIE_PREFIX . 'userid', $this->authUser['userid'], $sticky); + BSFunctions::cookie(COOKIE_PREFIX . 'authkey', $this->authUser['authkey'], $sticky); } // ################################################################### function clearCookies() { - $this->registry->funct->cookie(COOKIE_PREFIX . 'userid'); - $this->registry->funct->cookie(COOKIE_PREFIX . 'authkey'); + BSFunctions::cookie(COOKIE_PREFIX . 'userid', false); + BSFunctions::cookie(COOKIE_PREFIX . 'authkey', false); } // ################################################################### @@ -87,7 +87,7 @@ class AuthenticationDefault extends Authentication // ################################################################### function _fetchUserWithIdentifier($email) { - return $this->authDb->query_first("SELECT * FROM " . TABLE_PREFIX . "user WHERE email = '" . $this->authDb->escape_string($email) . "'"); + return $this->authDb->queryFirst("SELECT * FROM " . TABLE_PREFIX . "user WHERE email = '" . $this->authDb->escapeString($email) . "'"); } // ################################################################### @@ -100,10 +100,4 @@ class AuthenticationDefault extends Authentication function _syncBugdarUser() {} } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ -?> +?> \ No newline at end of file diff --git a/includes/auth/auth_drupal.php b/includes/auth/auth_drupal.php index abcf296..aae7805 100644 --- a/includes/auth/auth_drupal.php +++ b/includes/auth/auth_drupal.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -53,14 +53,14 @@ class AuthenticationDrupal extends Authentication $this->cookieName = ($this->cookieName == null ? session_name() : $this->cookieName); // connect to the DB - $this->authDb = new DB_MySQL($this->registry); - $this->authDb->connect('DRUPAL_DATABASE_SERVER', 'DATABASE_USER', 'DATABASE_PASSWORD', 'DATABASE_NAME', false); + $this->authDb = new BSDbMySQLI(); + $this->authDb->connect('DRUPAL_DATABASE_SERVER', 'DATABASE_USER', 'DATABASE_PASSWORD', 'DATABASE_NAME'); } // ################################################################### function _fetchCookieUniqueId() { - return $this->registry->in[ $this->cookieName ]; + return BSApp::$input->in[$this->cookieName]; } // ################################################################### @@ -72,12 +72,12 @@ class AuthenticationDrupal extends Authentication // ################################################################### function _fetchUserUsingCookies() { - $session = $this->authDb->query_first("SELECT * FROM sessions WHERE sid = '" . $this->authDb->escape_string($this->_fetchCookieUniqueId()) . "'"); + $session = $this->authDb->queryFirst("SELECT * FROM sessions WHERE sid = '" . $this->authDb->escapeString($this->_fetchCookieUniqueId()) . "'"); if (!$session OR $session['uid'] == 0) { return false; } - return $this->authDb->query_first("SELECT * FROM users WHERE uid = " . $session['uid']); + return $this->authDb->queryFirst("SELECT * FROM users WHERE uid = " . $session['uid']); } // ################################################################### @@ -89,7 +89,7 @@ class AuthenticationDrupal extends Authentication // ################################################################### function _fetchUserWithIdentifier($string) { - return $this->authDb->query_first("SELECT * FROM users WHERE name = '" . $this->authDb->escape_string($string) . "'"); + return $this->authDb->queryFirst("SELECT * FROM users WHERE name = '" . $this->authDb->escapeString($string) . "'"); } // ################################################################### @@ -101,8 +101,8 @@ class AuthenticationDrupal extends Authentication // ################################################################### function clearCookies() { - $this->registry->funct->cookie($this->cookieName); - $this->authDb->query("DELETE FROM sessions WHERE sid = '" . $this->authDb->escape_string($this->_fetchCookieUniqueId()) . "'"); + BSFunctions::cookie($this->cookieName); + $this->authDb->query("DELETE FROM sessions WHERE sid = '" . $this->authDb->escapeString($this->_fetchCookieUniqueId()) . "'"); } // ################################################################### @@ -110,15 +110,9 @@ class AuthenticationDrupal extends Authentication { $sid = $this->_fetchCookieUniqueId(); $sid = ($sid ? $sid : md5(microtime() . rand())); - $this->registry->funct->cookie($this->cookieName, $sid, $permanent); - $this->authDb->query("REPLACE INTO sessions (sid, uid, hostname, timestamp) VALUES ('$sid', '" . $this->authUser['uid'] . "', '" . $this->authDb->escape_string($_SERVER['REMOTE_ADDR']) . "', " . time() . ")"); + BSFunctions::cookie($this->cookieName, $sid, $permanent); + $this->authDb->query("REPLACE INTO sessions (sid, uid, hostname, timestamp) VALUES ('$sid', '" . $this->authUser['uid'] . "', '" . $this->authDb->escapeString($_SERVER['REMOTE_ADDR']) . "', " . time() . ")"); } } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/includes/auth/auth_phpbb2.php b/includes/auth/auth_phpbb2.php index acabf9a..8fc4cae 100644 --- a/includes/auth/auth_phpbb2.php +++ b/includes/auth/auth_phpbb2.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -60,14 +60,14 @@ class AuthenticationPhpbb2 extends Authentication function _setupDatabase() { // connect to the DB - $this->authDb = new DB_MySQL($this->registry); - $this->authDb->connect('DATABASE_SERVER', 'DATABASE_USER', 'DATABASE_PASSWORD', 'DATABASE_NAME', false); + $this->authDb = new BSDbMySQLI($this->registry); + $this->authDb->connect('DATABASE_SERVER', 'DATABASE_USER', 'DATABASE_PASSWORD', 'DATABASE_NAME'); } // ################################################################### function _fetchCookieUniqueId() { - $val = $this->registry->in[$this->cookieName . '_sid']; + $val = BSApp::$input->in[$this->cookieName . '_sid']; return (!$val ? -1 : $val); // hack so we don't do stupid things but can still create a session } @@ -80,7 +80,7 @@ class AuthenticationPhpbb2 extends Authentication // ################################################################### function _fetchUserUsingCookies() { - $session = $this->authDb->query_first("SELECT * FROM {$this->phpBBTablePrefix}sessions WHERE session_id = '" . $this->authDb->escape_string($this->_fetchCookieUniqueId()) . "'"); + $session = $this->authDb->queryFirst("SELECT * FROM {$this->phpBBTablePrefix}sessions WHERE session_id = '" . $this->authDb->escapeString($this->_fetchCookieUniqueId()) . "'"); if (!$session) { // phpBB's wacky auto-login system @@ -89,7 +89,7 @@ class AuthenticationPhpbb2 extends Authentication { return false; } - return $this->authDb->query_first("SELECT * FROM {$this->phpBBTablePrefix}users WHERE user_id = " . $this->registry->clean($data['userid'], TYPE_UINT) . " AND user_password = '" . $this->authDb->escape_string($data['autologinid']) . "'"); + return $this->authDb->queryFirst("SELECT * FROM {$this->phpBBTablePrefix}users WHERE user_id = " . BSApp::$input->clean($data['userid'], TYPE_UINT) . " AND user_password = '" . $this->authDb->escapeString($data['autologinid']) . "'"); } else { @@ -97,7 +97,7 @@ class AuthenticationPhpbb2 extends Authentication { return false; } - return $this->authDb->query_first("SELECT * FROM {$this->phpBBTablePrefix}users WHERE user_id = " . $session['session_user_id']); + return $this->authDb->queryFirst("SELECT * FROM {$this->phpBBTablePrefix}users WHERE user_id = " . $session['session_user_id']); } } @@ -110,7 +110,7 @@ class AuthenticationPhpbb2 extends Authentication // ################################################################### function _fetchUserWithIdentifier($string) { - return $this->authDb->query_first("SELECT * FROM {$this->phpBBTablePrefix}users WHERE username = '" . $this->authDb->escape_string($string) . "'"); + return $this->authDb->queryFirst("SELECT * FROM {$this->phpBBTablePrefix}users WHERE username = '" . $this->authDb->escapeString($string) . "'"); } // ################################################################### @@ -122,9 +122,9 @@ class AuthenticationPhpbb2 extends Authentication // ################################################################### function clearCookies() { - $this->registry->funct->cookie($this->cookieName . '_data'); - $this->registry->funct->cookie($this->cookieName . '_sid'); - $this->authDb->query("DELETE FROM {$this->phpBBTablePrefix}sessions WHERE session_id = '" . $this->authDb->escape_string($this->_fetchCookieUniqueId()) . "'"); + BSFunctions::cookie($this->cookieName . '_data'); + BSFunctions::cookie($this->cookieName . '_sid'); + $this->authDb->query("DELETE FROM {$this->phpBBTablePrefix}sessions WHERE session_id = '" . $this->authDb->escapeString($this->_fetchCookieUniqueId()) . "'"); } // ################################################################### @@ -132,10 +132,10 @@ class AuthenticationPhpbb2 extends Authentication { $sid = $this->_fetchCookieUniqueId(); $sid = ($sid != '-1' ? $sid : md5(microtime() . rand())); - $this->registry->funct->cookie($this->cookieName . '_sid', $sid, false); + BSFunctions::cookie($this->cookieName . '_sid', $sid, false); if ($permanent) { - $this->registry->funct->cookie($this->cookieName . '_data', serialize(array('autologinid' => $this->authUser['user_password'], 'userid' => $this->authUser['user_id'])), true); + BSFunctions::cookie($this->cookieName . '_data', serialize(array('autologinid' => $this->authUser['user_password'], 'userid' => $this->authUser['user_id'])), true); } $this->authDb->query(" REPLACE INTO {$this->phpBBTablePrefix}sessions @@ -150,10 +150,4 @@ class AuthenticationPhpbb2 extends Authentication } } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/includes/auth/auth_vbulletin.php b/includes/auth/auth_vbulletin.php index 2d6da6b..2291e04 100644 --- a/includes/auth/auth_vbulletin.php +++ b/includes/auth/auth_vbulletin.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -62,26 +62,26 @@ class AuthenticationVbulletin extends Authentication // ################################################################### function _setupDatabase() { - $this->authDb = new DB_MySQL($this->registry); - $this->authDb->connect('VBULLETIN_DATABASE_SERVER', 'VB_DATABASE_USER', 'VB_DATABASE_PASSWORD', 'VBULLETIN_DATABASE_NAME', false); + $this->authDb = new BSDbMySqlI($this->registry); + $this->authDb->connect('VBULLETIN_DATABASE_SERVER', 'VB_DATABASE_USER', 'VB_DATABASE_PASSWORD', 'VBULLETIN_DATABASE_NAME'); } // ################################################################### function _fetchCookieUniqueId() { - return $this->registry->input_clean('bbuserid', TYPE_UINT); + return BSApp::$input->inputClean('bbuserid', TYPE_UINT); } // ################################################################### function _fetchCookiePassword() { - return $this->registry->in['bbpassword']; + return BSApp::$input->in['bbpassword']; } // ################################################################### function _fetchUserUsingCookies() { - return $this->authDb->query_first("SELECT * FROM {$this->vBTablePrefix}user WHERE userid = " . $this->_fetchCookieUniqueId()); + return $this->authDb->queryFirst("SELECT * FROM {$this->vBTablePrefix}user WHERE userid = " . $this->_fetchCookieUniqueId()); } // ################################################################### @@ -93,21 +93,21 @@ class AuthenticationVbulletin extends Authentication // ################################################################### function _setCookies($sticky = false) { - $this->registry->funct->cookie('bbuserid', $this->authUser['userid'], $sticky); - $this->registry->funct->cookie('bbpassword', md5($this->authUser['password'] . $this->licenseKey), $sticky); + BSFunctions::cookie('bbuserid', $this->authUser['userid'], $sticky); + BSFunctions::cookie('bbpassword', md5($this->authUser['password'] . $this->licenseKey), $sticky); } // ################################################################### function clearCookies() { - $this->registry->funct->cookie('bbpassword'); - $this->registry->funct->cookie('bbuserid'); + BSFunctions::cookie('bbpassword', false); + BSFunctions::cookie('bbuserid', false); } // ################################################################### function _fetchUserWithIdentifier($username) { - return $this->authDb->query_first("SELECT * FROM {$this->vBTablePrefix}user WHERE username = '" . $this->authDb->escape_string($username) . "'"); + return $this->authDb->queryFirst("SELECT * FROM {$this->vBTablePrefix}user WHERE username = '" . $this->authDb->escapeString($username) . "'"); } // ################################################################### @@ -117,10 +117,4 @@ class AuthenticationVbulletin extends Authentication } } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/includes/class_admin_navigation.php b/includes/class_admin_navigation.php index 7e7549c..a3efd3c 100644 --- a/includes/class_admin_navigation.php +++ b/includes/class_admin_navigation.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -26,7 +26,7 @@ * links for the Admin CP. * * @author Blue Static -* @copyright Copyright ©2002 - 2007, Blue Static +* @copyright Copyright (c)2004 - 2008, Blue Static * @version $Revision$ * @package Bugdar * @@ -407,10 +407,4 @@ class NavLinks } } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/includes/class_api_error.php b/includes/class_api_error.php deleted file mode 100644 index 9615c50..0000000 --- a/includes/class_api_error.php +++ /dev/null @@ -1,96 +0,0 @@ -object =& $obj; - } - - // ################################################################### - /** - * The user-end cumulative reporter requires that the class be - * instantiated. This collects messages in the set message reporting - * object, but never throws the error. It is the caller's responsibility - * to check for the presence of errors and to throw the front-end - * warning using the message object. - * - * @access public - * - * @param string Error message - */ - function user_cumulative($error) - { - $this->object->addError($error); - } - - // ################################################################### - /** - * This calls the simple ISSO.Printer error message for the - * administrative-side errors. - * - * @access public - * - * @param string Error message - */ - function admin_error($error) - { - $this->object->error($error); - } -} - -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ -?> \ No newline at end of file diff --git a/includes/class_logging.php b/includes/class_logging.php index 28d7d88..aad0648 100644 --- a/includes/class_logging.php +++ b/includes/class_logging.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -27,125 +27,103 @@ DELETE FROM history WHERE field IN ('lastposttime', 'lastpostby', 'hiddenlastpos */ /** -* Bug Change Logging -* -* This class is used to record changes in a bug's fields, comments, and -* attachments. -* -* @author Blue Static -* @copyright Copyright ©2002 - 2007, Blue Static -* @version $Revision$ -* @package Bugdar -* -*/ + * Bug Change Logging + * + * This class is used to record changes in a bug's fields, comments, and + * attachments. + * + * @author Blue Static + * @copyright Copyright (c)2004 - 2008, Blue Static + * @package Bugdar + * + */ class Logging { /** - * Bug ID - * @var integer - * @access private - */ - var $bugid = 0; + * Bug ID + * @var integer + */ + private $bugid = 0; /** - * Attachment ID - * @var integer - * @access private - */ - var $attachmentid = 0; + * Attachment ID + * @var integer + */ + private $attachmentid = 0; /** - * Comment ID - * @var integer - * @access private - */ - var $commentid = 0; + * Comment ID + * @var integer + */ + private $commentid = 0; /** - * The original data to compare against - * @var array - * @access private - */ - var $original = array(); + * The original data to compare against + * @var array + */ + private $original = array(); /** - * Modified data - * @var array - * @access private - */ - var $modified = array(); + * Modified data + * @var array + */ + private $modified = array(); /** - * Compared/diff'd data - * @var array - * @access private - */ - var $compared = array(); + * Compared/diff'd data + * @var array + */ + private $compared = array(); - // ################################################################### /** - * Sets the bug ID for the current logging instance - * - * @access public - * - * @param integer New bug ID - */ - function set_bugid($id) + * Sets the bug ID for the current logging instance + * + * @param integer New bug ID + */ + public function setBugId($id) { - global $bugsys; - $this->bugid = $bugsys->clean($id, TYPE_UINT); + $this->bugid = BSApp::$input->clean($id, TYPE_UINT); } - // ################################################################### /** - * Sets the attachment ID for the current logging instance - * - * @access public - * - * @param integer New attachment ID - */ - function set_attachmentid($id) + * Sets the attachment ID for the current logging instance + * + * @param integer New attachment ID + */ + public function setAttachmentId($id) { - global $bugsys; - $this->attachmentid = $bugsys->clean($id, TYPE_UINT); + $this->attachmentid = BSApp::$input->clean($id, TYPE_UINT); } - // ################################################################### /** - * Sets the current comment ID to be logged - * - * @access public - * - * @param integer New comment ID - */ - function set_commentid($id) + * Sets the current comment ID to be logged + * + * @param integer New comment ID + */ + public function setCommentId($id) { - global $bugsys; - $this->commentid = $bugsys->clean($id, TYPE_UINT); + $this->commentid = BSApp::$input->clean($id, TYPE_UINT); } - // ################################################################### /** - * Assigns data into the $this->original or $this->modified array based - * on the passed arrays of information and the fields to add (and what - * name to add them under), and any prefix - * - * @access public - * - * @param bool TRUE for original, FALSE for modified - * @param array Data array - * @param array List of fields in the data array to add; in format of array('field name' => 'display name', 'display name 2', 'display name 3') - * @param bool If TRUE, then the list of fields is used to exclude, not include - * @param string Field prefix - */ - function add_data($orig, $data, $fields, $exclude = false, $prefix = '') + * Assigns data into the $this->original or $this->modified array based + * on the passed arrays of information and the fields to add (and what + * name to add them under), and any prefix + * + * @param bool TRUE for original, FALSE for modified + * @param array Data array + * @param array List of fields in the data array to add; in format of array('field name' => 'display name', 'display name 2', 'display name 3') + * @param bool If TRUE, then the list of fields is used to exclude, not include + * @param string Field prefix + */ + public function addData($orig, $data, $fields, $exclude = false, $prefix = '') { $array = ($orig ? 'original' : 'modified'); $prefix .= '.'; if ($exclude == false) { - foreach ($fields AS $fname => $fdisplay) + foreach ($fields as $fname => $fdisplay) { if (is_numeric($fname)) { @@ -157,7 +135,7 @@ class Logging } else { - foreach ($data AS $fname => $value) + foreach ($data as $fname => $value) { if (!in_array($fname, $fields)) { @@ -167,61 +145,50 @@ class Logging } } - // ################################################################### /** - * Populates the $this->compared array as a diff between the original - * and modified data. This is then used to create the databse queries. - * - * @access private - */ - function compare_arrays() + * Populates the $this->compared array as a diff between the original + * and modified data. This is then used to create the databse queries. + */ + private function _compareArrays() { foreach ($this->modified AS $key => $value) { - if ($this->original["$key"] != $value AND !($value['value'] == '' AND $this->original["$key"]['value'] == '0') AND !($this->original["$key"]['value'] == '' AND $value['value'] == '0')) + if ($this->original["$key"] != $value && !($value['value'] == '' && $this->original["$key"]['value'] == '0') && !($this->original["$key"]['value'] == '' && $value['value'] == '0')) { $this->compared["$key"] = array('old' => $this->original["$key"]['value'], 'new' => $this->modified["$key"]['value']); } } } - // ################################################################### /** - * Runs $this->compare_arrays() and then takes the result and prepares - * it for insertion into the history database. - * - * @access public - */ - function update_history() + * Runs $this->_compareArrays() and then takes the result and prepares + * it for insertion into the history database. + */ + public function updateHistory() { - global $bugsys; - - $this->compare_arrays(); + $this->_compareArrays(); - foreach ($this->compared AS $field => $values) + foreach ($this->compared as $field => $values) { - $bugsys->db->query(" + BSApp::$db->query(" INSERT INTO " . TABLE_PREFIX . "history (bugid, attachmentid, commentid, dateline, userid, field, original, changed) VALUES - (" . $bugsys->clean($this->bugid, TYPE_UINT) . ", " . $bugsys->clean($this->attachmentid, TYPE_UINT) . ", - " . $bugsys->clean($this->commentid, TYPE_UINT) . ", " . TIMENOW . ", " . $bugsys->userinfo['userid'] . ", - '" . $bugsys->db->escape_string($field) . "', '" . $bugsys->db->escape_string($values['old']) . "', - '" . $bugsys->db->escape_string($values['new']) . "' + (" . BSApp::$input->clean($this->bugid, TYPE_UINT) . ", " . BSApp::$input->clean($this->attachmentid, TYPE_UINT) . ", + " . BSApp::$input->clean($this->commentid, TYPE_UINT) . ", " . TIMENOW . ", " . bugdar::$userinfo['userid'] . ", + '" . BSApp::$db->escapeString($field) . "', '" . BSApp::$db->escapeString($values['old']) . "', + '" . BSApp::$db->escapeString($values['new']) . "' ) "); } } - // ################################################################### /** - * Returns an array of the fields commonly ignored - * - * @access public - * - * @return array Fields ignored in logging - */ - function getCommonFields() + * Returns an array of the fields commonly ignored + * + * @return array Fields ignored in logging + */ + public function getCommonFields() { return array( 'bugid', @@ -235,10 +202,4 @@ class Logging } } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/includes/class_message_reporter.php b/includes/class_message_reporter.php index 8473bb8..45f1439 100755 --- a/includes/class_message_reporter.php +++ b/includes/class_message_reporter.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -82,15 +82,14 @@ class MessageReporter */ function error($error = null) { - global $bugsys; - global $doctype, $header, $headinclude, $footer, $focus, $show, $stylevar; - if ($error == null) { $error = $this->errorBox; } - eval('$bugsys->template->flush("' . $bugsys->template->fetch('std_error') . '");'); + $tpl = new BSTemplate('std_error'); + $tpl->vars = array('error' => $error); + $tpl->evaluate()->flush(); exit; } @@ -112,16 +111,18 @@ class MessageReporter */ function redirect($message, $url) { - global $bugsys; - global $doctype, $header, $headinclude, $footer, $focus, $show, $stylevar; - - if ($bugsys->options['redirectheaders']) + if (bugdar::$options['redirectheaders']) { header("Location: $url"); exit; } - eval('$bugsys->template->flush("' . $bugsys->template->fetch('std_redirect') . '");'); + $tpl = new BSTemplate('std_redirect'); + $tpl->vars = array( + 'message' => $message, + 'url' => $url + ); + $tpl->evaluate()->flush(); exit; } @@ -133,10 +134,11 @@ class MessageReporter */ function message($message) { - global $bugsys; - global $doctype, $header, $headinclude, $footer, $focus, $show, $stylevar; - - eval('$bugsys->template->flush("' . $bugsys->template->fetch('std_message') . '");'); + $tpl = new BSTemplate('std_message'); + $tpl->vars = array( + 'message' => $message + ); + $tpl->evaluate()->flush(); exit; } @@ -155,25 +157,27 @@ class MessageReporter */ function confirm($message, $action, $do, $button, $cancel, $arrextra) { - global $bugsys; - global $doctype, $header, $headinclude, $footer, $focus, $show, $stylevar; + global $show; $show['confirm'] = true; - foreach ($arrextra AS $name => $value) + foreach ($arrextra as $name => $value) { $extra .= '' . "\n"; } - eval('$bugsys->template->flush("' . $bugsys->template->fetch('std_message') . '");'); + $tpl = new BSTemplate('std_message'); + $tpl->vars = array( + 'message' => $message, + 'action' => $action, + 'do' => $do, + 'button' => $button, + 'cancel' => $cancel, + 'extra' => $extra + ); + $tpl->evaluate()->flush(); exit; } } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/includes/class_mo.php b/includes/class_mo.php index abe37f0..dd5669d 100644 --- a/includes/class_mo.php +++ b/includes/class_mo.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -28,7 +28,6 @@ * * @author rsesek * @copyright Copyright (c)2006 - 2008, Blue Static - * @version $Revision$ * @package Bugdar * */ @@ -108,12 +107,10 @@ class MOReader */ function _loadFile() { - global $bugsys; - $this->file = @fopen($this->filename, 'r'); if (!$this->file) { - $bugsys->debug("could not open MO file {$this->filename}"); + BSApp::debug("could not open MO file {$this->filename}"); return; } @@ -130,7 +127,7 @@ class MOReader } else { - trigger_error('Invalid MO file format'); + throw new Exception('Invalid MO file format'); } // read the revision (unused in MOs) @@ -168,10 +165,4 @@ class MOReader } } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/includes/class_notification.php b/includes/class_notification.php index ce043c7..4a1efbd 100644 --- a/includes/class_notification.php +++ b/includes/class_notification.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -20,53 +20,41 @@ \*=====================================================================*/ /** -* Notification Center -* -* This class determines which emails need to be sent out based on user -* options and bug changes, and then it sends said emails. -* -* @author Blue Static -* @copyright Copyright ©2002 - 2007, Blue Static -* @version $Revision$ -* @package Bugdar -* -*/ + * Notification Center + * + * This class determines which emails need to be sent out based on user + * options and bug changes, and then it sends said emails. + * + * @author Blue Static + * @copyright Copyright (c)2004 - 2008, Blue Static + * @package Bugdar + * + */ class NotificationCenter { /** - * Bug information - * @var array - * @access private - */ - var $bug = array(); - - /** - * Original bug data - * @var array - * @access private - */ - var $original = array(); + * Bug information + * @var array + */ + private $bug = array(); /** - * Modified bug data - * @var array - * @access private - */ - var $modified = array(); + * Original bug data + * @var array + */ + private $original = array(); /** - * Global bugsys registry - * @var object - * @access private - */ - var $registry = null; + * Modified bug data + * @var array + */ + private $modified = array(); /** - * Role list: a list of user IDs with their relations to the bug - * @var array - * @access private - */ - var $roles = array( + * Role list: a list of user IDs with their relations to the bug + * @var array + */ + private $roles = array( '-notapplicable-' => array(), 'reporter' => array(), 'assignee' => array(), @@ -76,54 +64,25 @@ class NotificationCenter ); /** - * User cache list - * @var array - * @access private - */ - var $users = array(); + * User cache list + * @var array + */ + private $users = array(); /** - * A list of notices per-user that are combined together in NotificationCenter::finalize() - * @var array - * @access private - */ - var $notices = array(); + * A list of notices per-user that are combined together in NotificationCenter::finalize() + * @var array + */ + private $notices = array(); - // ################################################################### /** - * Constructor: set database objects - * - * @access public - */ - function __construct() - { - global $bugsys; - - $this->registry =& $bugsys; - } - - // ################################################################### - /** - * (PHP 4) Constructor - * - * @access public - */ - function NotificationCenter() - { - $this->__construct(); - } - - // ################################################################### - /** - * Sets the bug data so that all methods in this class have access to - * it when sending emails. - * - * @access public - * - * @param array Original bug data - * @param array Modified bug data - */ - function set_bug_data($original, $modified = array()) + * Sets the bug data so that all methods in this class have access to + * it when sending emails. + * + * @param array Original bug data + * @param array Modified bug data + */ + public function setBugData($original, $modified = array()) { if (sizeof($modified) > 0) { @@ -141,52 +100,49 @@ class NotificationCenter $this->roles['reporter'] = array($original['userid']); $this->roles['assignee'][] = (sizeof($modified) > 0 ? $modified['assignedto'] : $original['assignedto']); - $this->fetch_user_cache(); + $this->_fetchUserCache(); } - // ################################################################### /** - * Fetches all the users who could be related to the bug and sticks - * their information into an array. - * - * @access private - */ - function fetch_user_cache() + * Fetches all the users who could be related to the bug and sticks + * their information into an array. + */ + private function _fetchUserCache() { - $newbuggers = $this->registry->db->query("SELECT userid FROM " . TABLE_PREFIX . "useremail WHERE relation = " . $this->registry->emailoptions['relations']['-notapplicable-'] . " AND mask & " . $this->registry->emailoptions['notifications']['newbug']); - while ($newbug = $this->registry->db->fetch_array($newbuggers)) + $newbuggers = BSApp::$db->query("SELECT userid FROM " . TABLE_PREFIX . "useremail WHERE relation = " . bugdar::$emailOptions['relations']['-notapplicable-'] . " AND mask & " . bugdar::$emailOptions['notifications']['newbug']); + foreach ($newbuggers as $newbug) { $this->roles['-notapplicable-']["$newbug[userid]"] = $newbug['userid']; } - $favorites = $this->registry->db->query("SELECT userid FROM " . TABLE_PREFIX . "favorite WHERE bugid = " . $this->registry->clean($this->bug['bugid'], TYPE_UINT)); - while ($fav = $this->registry->db->fetch_array($favorites)) + $favorites = BSApp::$db->query("SELECT userid FROM " . TABLE_PREFIX . "favorite WHERE bugid = " . BSApp::$input->clean($this->bug['bugid'], TYPE_UINT)); + foreach ($favorites as $fav) { $this->roles['favorite']["$fav[userid]"] = $fav['userid']; } - $voters = $this->registry->db->query_first("SELECT userids FROM " . TABLE_PREFIX . "vote WHERE bugid = " . $this->registry->clean($this->bug['bugid'], TYPE_UINT)); + $voters = BSApp::$db->queryFirst("SELECT userids FROM " . TABLE_PREFIX . "vote WHERE bugid = " . BSApp::$input->clean($this->bug['bugid'], TYPE_UINT)); $this->roles['voter'] = preg_split('#,#', $voters['userids'], 0, PREG_SPLIT_NO_EMPTY); - $commenters = $this->registry->db->query("SELECT userid FROM " . TABLE_PREFIX . "comment WHERE bugid = " . $this->registry->clean($this->bug['bugid'], TYPE_UINT)); - while ($comment = $this->registry->db->fetch_array($commenters)) + $commenters = BSApp::$db->query("SELECT userid FROM " . TABLE_PREFIX . "comment WHERE bugid = " . BSApp::$input->clean($this->bug['bugid'], TYPE_UINT)); + foreach ($commenters as $comment) { $this->roles['commenter']["$comment[userid]"] = $comment['userid']; } $masterids = array_merge($this->roles['-notapplicable-'], $this->roles['reporter'], $this->roles['assignee'], $this->roles['favorite'], $this->roles['voter'], $this->roles['commenter']); - $masterids = $this->registry->funct->array_strip_empty(array_unique($masterids)); + $masterids = BSFunctions::array_strip_empty(array_unique($masterids)); - if (is_array($masterids) AND sizeof($masterids) > 0) + if (is_array($masterids) && sizeof($masterids) > 0) { - $userinfo = $this->registry->db->query(" + $userinfo = BSApp::$db->query(" SELECT user.*, useremail.* FROM " . TABLE_PREFIX . "useremail AS useremail LEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = useremail.userid) WHERE useremail.userid IN (" . implode(',', $masterids) . ") "); - while ($user = $this->registry->db->fetch_array($userinfo)) + foreach ($userinfo as $user) { if (!is_array($this->users["$user[userid]"])) { @@ -198,16 +154,13 @@ class NotificationCenter } } - // ################################################################### /** - * Sends the appropriate emails for changes to bugs. This function - * works a lot like the Logging class by taking BugAPI->objdata and - * BugAPI->values and then comparing the two arries and sending emails - * with the differences. - * - * @access public - */ - function send_bug_changes_notice() + * Sends the appropriate emails for changes to bugs. This function + * works a lot like the Logging class by taking BugAPI->record and + * BugAPI->values and then comparing the two arries and sending emails + * with the differences. + */ + public function sendBugChangeNotice() { if (!isset($this->modified['bugid'])) { @@ -219,38 +172,38 @@ class NotificationCenter { if ($this->original['assignedto'] != '') { - $this->notice_no_longer_assigned($this->original['assignedto']); + $this->_noticeNoLongerAssigned($this->original['assignedto']); } if ($this->modified['assignedto'] != '') { - $this->notice_now_assigned($this->modified['assignedto']); + $this->_noticeNowAssigned($this->modified['assignedto']); } } if ($this->original['status'] != $this->modified['status']) { - $this->notice_status_change($this->original['status'], $this->modified['status']); + $this->_noticeStatusChange($this->original['status'], $this->modified['status']); } if ($this->original['resolution'] != $this->modified['resolution']) { - $this->notice_resolution_change($this->original['resolution'], $this->modified['resolution']); + $this->_noticeResolutionChange($this->original['resolution'], $this->modified['resolution']); } if ($this->original['duplicates'] != $this->modified['duplicates']) { - $this->notice_duplicates_change($this->original['duplicates'], $this->modified['duplicates']); + $this->_noticeDuplicatesChange($this->original['duplicates'], $this->modified['duplicates']); } // other standard fields that don't have custom masks if ($this->original['severity'] != $this->modified['severity']) { - $this->notice_severity_change($this->original['severity'], $this->modified['severity']); + $this->_noticeSeverityChange($this->original['severity'], $this->modified['severity']); } if ($this->original['priority'] != $this->modified['priority']) { - $this->notice_priority_change($this->original['priority'], $this->modified['priority']); + $this->_noticePriorityChange($this->original['priority'], $this->modified['priority']); } - if (($this->original['product'] != $this->modified['product']) OR ($this->original['component'] != $this->modified['component']) OR ($this->original['version'] != $this->modified['version'])) + if (($this->original['product'] != $this->modified['product']) || ($this->original['component'] != $this->modified['component']) || ($this->original['version'] != $this->modified['version'])) { - $this->notice_pcv_change(array($this->original['product'], $this->original['component'], $this->original['version']), array($this->modified['product'], $this->modified['component'], $this->modified['version'])); + $this->_noticePCVChange(array($this->original['product'], $this->original['component'], $this->original['version']), array($this->modified['product'], $this->modified['component'], $this->modified['version'])); } $dofields = array( @@ -258,294 +211,277 @@ class NotificationCenter 'dependency' => -1, 'hidden' => -1 ); - foreach ($dofields AS $field => $lookup) + foreach ($dofields as $field => $lookup) { if ($this->original["$field"] != $this->modified["$field"]) { - $this->notice_other_change($field, $this->original["$field"], $this->modified["$field"]); + $this->_noticeOtherChange($field, $this->original["$field"], $this->modified["$field"]); } } } - // ################################################################### /** - * Sends an email to the specified user ID that they are no longer the - * person assigned to the bug. - * - * @access private - * - * @param integer User ID to send to - */ - function notice_no_longer_assigned($userid) + * Sends an email to the specified user ID that they are no longer the + * person assigned to the bug. + * + * @param integer User ID to send to + */ + private function _noticeNoLongerAssigned($userid) { - if ($this->users["$userid"]['options'][0] & $this->registry->emailoptions['notifications']['assignedto'] AND in_array($userid, $this->roles['-notapplicable-'])) + if ($this->users["$userid"]['options'][0] & bugdar::$emailOptions['notifications']['assignedto'] && in_array($userid, $this->roles['-notapplicable-'])) { - $user = construct_user_display($this->registry->userinfo, false); - eval('$part = "' . $this->registry->template->fetch(FetchEmailPath('notice_unassigned.part', $this->_localeFromUserId($userid))) . '";'); - $this->notices["$userid"][] = $part; + $user = construct_user_display(bugdar::$userinfo, false); + + $email = get_email_text('notice_unassigned'); + $this->notices["$userid"][] = sprintf($email['part'], $user); } } - // ################################################################### /** - * Informs the user that they have been made the assignee of the bug. - * - * @access private - * - * @param integer User ID - */ - function notice_now_assigned($userid) + * Informs the user that they have been made the assignee of the bug. + * + * @param integer User ID + */ + private function _noticeNowAssigned($userid) { - if ($this->users["$userid"]['options'][0] & $this->registry->emailoptions['notifications']['assignedto'] AND in_array($userid, $this->roles['-notapplicable-'])) + if ($this->users["$userid"]['options'][0] & bugdar::$emailOptions['notifications']['assignedto'] && in_array($userid, $this->roles['-notapplicable-'])) { - $user = construct_user_display($this->registry->userinfo, false); - eval('$email = "' . $this->registry->template->fetch(FetchEmailPath('notice_assigned.part', $this->_localeFromUserId($userid))) . '";'); - $this->notices["$userid"][] = $email; + $user = construct_user_display(bugdar::$userinfo, false); + + $email = get_email_text('notice_assigned'); + $this->notices["$userid"][] = sprintf($email['part'], $user); } } - // ################################################################### /** - * Sends a message to inform users that the status has changed. - * - * @access private - * - * @param integer Old status - * @param integer New status - */ - function notice_status_change($old, $new) + * Sends a message to inform users that the status has changed. + * + * @param integer Old status + * @param integer New status + */ + private function _noticeStatusChange($old, $new) { - $userlist = $this->fetch_users_with_on_bit('statusresolve'); - foreach ($userlist AS $userid => $user) + $userlist = $this->_fetchUsersWithOnBit('statusresolve'); + + $old = bugdar::$datastore['status'][$old]['status']; + $new = bugdar::$datastore['status'][$new]['status']; + + foreach ($userlist as $userid => $user) { - eval('$email = "' . $this->registry->template->fetch(FetchEmailPath('notice_status.part', $this->_localeFromUserId($userid))) . '";'); - $this->notices["$user[userid]"][] = $email; + $email = get_email_text('notice_status'); + $this->notices["$user[userid]"][] = sprintf($email['part'], $new, $old); } } - // ################################################################### /** - * Sends an email to inform users that the resolution has changed. - * - * @access private - * - * @param integer Old resolution - * @param integer New resolution - */ - function notice_resolution_change($old, $new) + * Sends an email to inform users that the resolution has changed. + * + * @param integer Old resolution + * @param integer New resolution + */ + private function _noticeResolutionChange($old, $new) { - $userlist = $this->fetch_users_with_on_bit('statusresolve'); - foreach ($userlist AS $userid => $user) + $userlist = $this->_fetchUsersWithOnBit('statusresolve'); + + $old = bugdar::$datastore['resolution'][$old]['resolution']; + $new = bugdar::$datastore['resolution'][$new]['resolution']; + + foreach ($userlist as $userid => $user) { - eval('$email = "' . $this->registry->template->fetch(FetchEmailPath('notice_resolution.part', $this->_localeFromUserId($userid))) . '";'); - $this->notices["$user[userid]"][] = $email; + $email = get_email_text('notice_resolution'); + $this->notices["$user[userid]"][] = sprintf($email['part'], $new, $old); } } - // ################################################################### /** - * Informs users that the duplicates list has changed. - * - * @access private - * - * @param string Old duplicates list - * @param string New duplicates list - */ - function notice_duplicates_change($old, $new) + * Informs users that the duplicates list has changed. + * + * @param string Old duplicates list + * @param string New duplicates list + */ + private function _noticeDuplicatesChange($old, $new) { - $userlist = $this->fetch_useres_with_on_bit('duplicates'); - foreach ($userlist AS $userid => $user) + $userlist = $this->_fetchUsersWithOnBit('duplicates'); + + foreach ($userlist as $userid => $user) { - eval('$email = "' . $this->registry->template->fetch(FetchEmailPath('notice_duplicates.part', $this->_localeFromUserId($userid))) . '";'); - $this->notices["$user[userid]"][] = $email; + $email = get_email_text('notice_duplicates'); + $this->notices["$user[userid]"][] = sprintf($email['part'], $old, $new); } } - // ################################################################### /** - * Sends an email to inform users that the severity has changed. - * - * @access private - * - * @param integer Old severity - * @param integer New severity - */ - function notice_severity_change($old, $new) + * Sends an email to inform users that the severity has changed. + * + * @param integer Old severity + * @param integer New severity + */ + private function _noticeSeverityChange($old, $new) { - $userlist = $this->fetch_users_with_on_bit('otherfield'); - foreach ($userlist AS $userid => $user) + $userlist = $this->_fetchUsersWithOnBit('otherfield'); + + $old = bugdar::$datastore['severity'][$old]['severity']; + $new = bugdar::$datastore['severity'][$new]['severity']; + + foreach ($userlist as $userid => $user) { - eval('$email = "' . $this->registry->template->fetch(FetchEmailPath('notice_severity.part', $this->_localeFromUserId($userid))) . '";'); - $this->notices["$user[userid]"][] = $email; + $this->notices["$user[userid]"][] = sprintf($email['part'], $old, $new); } } - // ################################################################### /** - * Informs users that the priority changed. - * - * @access private - * - * @param integer Old priority - * @param integer New priority - */ - function notice_priority_change($old, $new) + * Informs users that the priority changed. + * + * @param integer Old priority + * @param integer New priority + */ + private function _noticePriorityChange($old, $new) { - $userlist = $this->fetch_users_with_on_bit('otherfield'); - foreach ($userlist AS $userid => $user) + $userlist = $this->_fetchUsersWithOnBit('otherfield'); + + $old = bugdar::$datastore['priority'][$old]['priority']; + $new = bugdar::$datastore['priority'][$new]['priority']; + + foreach ($userlist as $userid => $user) { - eval('$email = "' . $this->registry->template->fetch(FetchEmailPath('notice_priority.part', $this->_localeFromUserId($userid))) . '";'); - $this->notices["$user[userid]"][] = $email; + $email = get_email_text('notice_priority'); + $this->notices["$user[userid]"][] = sprintf($email['part'], $old, $new); } } - // ################################################################### /** - * Sends an email telling users that the product, component, or version - * has changed. This is done all at once because you really need to see - * the whole thing in the notice. - * - * @access private - * - * @param array Original PCV - * @param array Modified PCV - */ - function notice_pcv_change($old, $new) + * Sends an email telling users that the product, component, or version + * has changed. This is done all at once because you really need to see + * the whole thing in the notice. + * + * @param array Original PCV + * @param array Modified PCV + */ + private function _noticePCVChange($old, $new) { - $userlist = $this->fetch_users_with_on_bit('otherfield'); + $userlist = $this->_fetchUsersWithOnBit('otherfield'); + + $products = &bugdar::$datastore['product']; + $versions = &bugdar::$datastore['version']; - $old = $this->registry->datastore['product']["$old[0]"]['title'] . '/' . ($old[1] ? $this->registry->datastore['product']["$old[1]"]['title'] . '/' : '') . $this->registry->datastore['version']["$old[2]"]['version']; - $new = $this->registry->datastore['product']["$new[0]"]['title'] . '/' . ($new[1] ? $this->registry->datastore['product']["$new[1]"]['title'] . '/' : '') . $this->registry->datastore['version']["$new[2]"]['version']; + $old = $products[$old[0]]['title'] . '/' . ($old[1] ? $products[$old[1]]['title'] . '/' : '') . $versions[$old[2]]['version']; + $new = $products[$new[0]]['title'] . '/' . ($new[1] ? $products[$new[1]]['title'] . '/' : '') . $versions[$new[2]]['version']; - foreach ($userlist AS $userid => $user) + foreach ($userlist as $userid => $user) { - eval('$email = "' . $this->registry->template->fetch(FetchEmailPath('notice_product.part', $this->_localeFromUserId($userid))) . '";'); - $this->notices["$user[userid]"][] = $email; + $email = get_email_text('notice_product'); + $this->notices["$user[userid]"][] = sprintf($email['part'], $old, $new); } } - // ################################################################### /** * Sends the appropriate users information about a new comment being * posted to the bug report. * - * @access public - * * @param array CommentAPI->values array */ - function send_new_comment_notice($comment) + public function sendNewCommentNotice($comment) { - $userlist = $this->fetch_users_with_on_bit('newcomment'); - foreach ($userlist AS $userid => $user) + $userlist = $this->_fetchUsersWithOnBit('newcomment'); + foreach ($userlist as $userid => $user) { - $user = construct_user_display($this->registry->userinfo, false); - $date = $this->registry->modules['date']->format($this->registry->options['dateformat'], $comment['dateline']); + $user = construct_user_display(bugdar::$userinfo, false); + $date = BSApp::$date->format(bugdar::$options['dateformat'], $comment['dateline']); - eval('$email = "' . $this->registry->template->fetch(FetchEmailPath('notice_comment.part', $this->_localeFromUserId($userid))) . '";'); - $this->notices["$userid"][] = $email; + $email = get_email_text('notice_comment'); + $this->notices["$userid"][] = sprintf($email['part'], $user, $date, $comment['comment']); } } - // ################################################################### /** - * A notice for an individual field changing. - * - * @access private - * - * @param string Field name - * @param mixed Original value - * @param mixed Modified value - */ - function notice_other_change($name, $old, $new) + * A notice for an individual field changing. + * + * @param string Field name + * @param mixed Original value + * @param mixed Modified value + */ + private function _noticeOtherChange($name, $old, $new) { - $userlist = $this->fetch_users_with_on_bit('otherfield'); - foreach ($userlist AS $userid => $user) + $userlist = $this->_fetchUsersWithOnBit('otherfield'); + foreach ($userlist as $userid => $user) { - eval('$email = "' . $this->registry->template->fetch(FetchEmailPath('notice_other.part', $this->_localeFromUserId($userid))) . '";'); - $this->notices["$user[userid]"][] = $email; + $email = get_email_text('notice_other'); + $this->notices["$user[userid]"][] = sprintf($email['part'], $name, $old, $new); } } - // ################################################################### /** - * Sends appropriate users a notice when a new attachment has been - * added. - * - * @access public - * - * @param array AttachmentAPI->values array - * @param array List of all attachments made obsolete - * @param array Newly-inserted attachment ID - */ - function send_new_attachment_notice($attachment, $obsolete, $id) + * Sends appropriate users a notice when a new attachment has been + * added. + * + * @param array AttachmentAPI->values array + * @param array List of all attachments made obsolete + * @param array Newly-inserted attachment ID + */ + public function sendNewAttachmentNotice($attachment, $obsolete, $id) { - $userlist = $this->fetch_users_with_on_bit('newattachment'); - foreach ($userlist AS $userid => $user) + $userlist = $this->_fetchUsersWithOnBit('newattachment'); + foreach ($userlist as $userid => $user) { - $user = construct_user_display($this->registry->userinfo, false); + $user = construct_user_display(bugdar::$userinfo, false); $obsoletes = implode(', ', (array)$obsolete); - eval('$email = "' . $this->registry->template->fetch(FetchEmailPath('notice_attachment.part', $this->_localeFromUserId($userid))) . '";'); - $this->notices["$userid"][] = $email; + $email = get_email_text('notice_attachment'); + $this->notices["$userid"][] = sprintf($email['part'], $user, $attachment['filename'], $attachment['description'], $attachment['filesize'], $obsoletes, bugdar::$options['trackerurl'], $attachment['attachmentid']); } } - // ################################################################### /** - * Sends a new bug notification notice to all those who have the option - * turned no. This does not use fetch_users_with_on_bit() because a - * query is more effective. - * - * @access public - * - * @param array Bug values array - * @param array Comment values array - */ - function send_new_bug_notice($bug, $comment) + * Sends a new bug notification notice to all those who have the option + * turned no. This does not use fetchUsersWithOnBit() because a + * query is more effective. + * + * @param array Bug values array + * @param array Comment values array + */ + public function sendNewBugNotice($bug, $comment) { - $userinfo = $this->registry->db->query(" + $userinfo = BSApp::$db->query(" SELECT user.*, useremail.* FROM " . TABLE_PREFIX . "useremail AS useremail LEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = useremail.userid) WHERE useremail.relation = 0 - AND useremail.mask & " . $this->registry->emailoptions['notifications']['newbug'] . " + AND useremail.mask & " . bugdar::$emailOptions['notifications']['newbug'] . " "); - while ($userInfo = $this->registry->db->fetch_array($userinfo)) + foreach ($userinfo as $userInfo) { if (!is_array($this->users["$userInfo[userid]"])) { - $user = construct_user_display($this->registry->userinfo, false); + $user = construct_user_display(bugdar::$userinfo, false); $this->users["$userInfo[userid]"] = $userInfo; - $product = $this->registry->datastore['product']["$bug[product]"]['title'] . '/' . ($bug['component'] ? $this->registry->datastore['product']["$bug[component]"]['title'] . '/' : '') . $this->registry->datastore['version']["$bug[version]"]['version']; - eval('$email = "' . $this->registry->template->fetch(FetchEmailPath('notice_new_bug.part', $this->_localeFromUserId($userInfo['userid']))) . '";'); - $this->notices["$userInfo[userid]"][] = $email; + $product = bugdar::$datastore['product']["$bug[product]"]['title'] . '/' . ($bug['component'] ? bugdar::$datastore['product']["$bug[component]"]['title'] . '/' : '') . bugdar::$datastore['version']["$bug[version]"]['version']; + + $email = get_email_text('notice_new_bug'); + $this->notices["$userInfo[userid]"][] = sprintf($email['part'], $bug['bugid'], $bug['summary'], $user, $product, $comment['comment']); unset($this->users["$userInfo[userid]"]['mask'], $this->users["$userInfo[userid]"]['relation']); } $this->users["$userInfo[userid]"]['options']["$userInfo[relation]"] = $userInfo['mask']; } } - // ################################################################### /** - * Generates an array of users who have a given email notification flag - * turned on in their bitfields. - * - * @access private - * - * @param string Notification bitfield name - * - * @return array Array of users and their data - */ - function fetch_users_with_on_bit($bitname) + * Generates an array of users who have a given email notification flag + * turned on in their bitfields. + * + * @param string Notification bitfield name + * + * @return array Array of users and their data + */ + private function _fetchUsersWithOnBit($bitname) { $idlist = array(); - foreach ($this->users AS $user) + foreach ($this->users as $user) { - foreach ($this->registry->emailoptions['relations'] AS $name => $bit) + foreach (bugdar::$emailOptions['relations'] as $name => $bit) { - if (in_array($user['userid'], $this->roles["$name"]) AND $user['options']["$bit"] & $this->registry->emailoptions['notifications']["$bitname"]) + if (in_array($user['userid'], $this->roles["$name"]) && $user['options']["$bit"] & bugdar::$emailOptions['notifications']["$bitname"]) { $idlist[] = $user['userid']; } @@ -555,80 +491,75 @@ class NotificationCenter $masters = array_unique($idlist); $return = array(); - foreach ($masters AS $userid) + foreach ($masters as $userid) { - $return["$userid"] =& $this->users["$userid"]; + $return["$userid"] = &$this->users["$userid"]; } return $return; } - // ################################################################### /** - * Compiles and sends the actual emails to users. - * - * @access public - */ - function finalize() + * Compiles and sends the actual emails to users. + */ + public function finalize() { // get the current bug for permissions checks - $bug = $this->registry->db->query_first("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = " . $this->bug['bugid']); - foreach ($this->notices AS $userid => $noticelist) + $bug = BSApp::$db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = " . $this->bug['bugid']); + foreach ($this->notices as $userid => $noticelist) { - if ($userid == $this->registry->userinfo['userid']) + if ($userid == bugdar::$userinfo['userid']) { - $this->registry->debug("skipping user $userid because they're the one doing the thing"); + BSApp::debug("skipping user $userid because they're the one doing the thing"); continue; } // we wouldn't want people who favorite bugs getting hidden notices if (!check_bug_permissions($bug, $this->users["$userid"])) { - $this->registry->debug("skipping user $userid ({$this->users[$userid]['email']}) because of permissions"); + BSApp::debug("skipping user $userid ({$this->users[$userid]['email']}) because of permissions"); continue; } $parts = implode("\n\n", $noticelist); - eval('$email = "' . $this->registry->template->fetch(FetchEmailPath('bugnotification.xml', $this->_localeFromUserId($userid))) . '";'); - $email = $this->registry->xml->parse($email, true); - $this->registry->mail->setSubject($email['email']['subject']['value']); - $this->registry->mail->setBodyText($email['email']['bodyText']['value']); + $email = get_email_text('bug_notification'); + + $body = sprintf($email['bodyText'], $this->users[$userid]['displayname'], bugdar::$options['trackertitle'], $this->bug['summary'], $this->bug['bugid'], bugdar::$options['trackerurl'], $parts); + + $mail = new BSMail(); + $mail->setSubject(sprintf($email['subject'], bugdar::$options['trackertitle'], $this->bug['summary'])); + $mail->setBodyText($body); + $mail->setFromAddress(MAIL_FROM_ADDRESS); + $mail->setFromName(MAIL_FROM_NAME); if (!empty($this->users["$userid"]['email'])) { - $this->registry->mail->send($this->users["$userid"]['email'], $this->users["$userid"]['displayname']); + $mail->send($this->users[$userid]['email'], $this->users[$userid]['displayname']); } else { - $this->registry->debug("not sending an email to " . $userid . " because they don't have one?"); + BSApp::debug("not sending an email to " . $userid . " because they don't have one?"); } } } - // ################################################################### /** - * Returns the locale name from a given user ID - * - * @param integer User ID - * - * @return string Locale - */ - function _localeFromUserId($userid) + * Returns the locale name from a given user ID + * + * @param integer User ID + * + * @return string Locale + */ + private function _localeFromUserId($userid) { - $langcode = $this->registry->datastore['language'][$this->users[$userid]['languageid']]['langcode']; + $langcode = bugdar::$datastore['language'][$this->users[$userid]['languageid']]['langcode']; if (!$langcode) { - $langcode = $this->registry->datastore['language'][$this->registry->options['defaultlanguage']]['langcode']; + $langcode = bugdar::$datastore['language'][bugdar::$options['defaultlanguage']]['langcode']; } return $langcode; } } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/includes/class_sort.php b/includes/class_sort.php index 25d7f9e..624acee 100644 --- a/includes/class_sort.php +++ b/includes/class_sort.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -20,108 +20,93 @@ \*=====================================================================*/ /** -* Bug Listing Sorter -* -* This class is used to sort bugs based on user-sent options and variables. -* -* @author Blue Static -* @copyright Copyright ©2002 - 2007, Blue Static -* @version $Revision$ -* @package Bugdar -* -*/ + * Bug Listing Sorter + * + * This class is used to sort bugs based on user-sent options and variables. + * + * @author Blue Static + * @copyright Copyright (c)2004 - 2008, Blue Static + * @package Bugdar + * + */ class ListSorter { /** - * Bugsys registry - * @var object - * @access private - */ - var $registry; + * Bugsys registry + * @var object + */ + private $db; /** - * Page name - * @var string - * @access public - */ - var $page = ''; + * Page name + * @var string + */ + public $page = ''; /** - * Current sort key - * @var string - * @access private - */ - var $sortkey = ''; + * Current sort key + * @var string + */ + public $sortkey = ''; /** - * Current sort direction - * @var string - * @access private - */ - var $direction = ''; + * Current sort direction + * @var string + */ + private $direction = ''; /** - * Column array for table heads - * @var array - */ - var $columns; + * Column array for table heads + * @var array + */ + private $columns; - // ################################################################### /** - * Constructor: set the page name - * - * @access public - * - * @param string File name without the .php extension - */ - function ListSorter($page) + * Constructor: set the page name + * + * @param string File name without the .php extension + */ + public function __construct($page) { - global $bugsys; - $this->registry = $bugsys; + $this->db = BSApp::$db; $this->page = $page; - $this->process_incoming(); + $this->_processIncoming(); } - // ################################################################### /** - * Processes the incoming variables and then sets all the sort order - * information appropriately - * - * @access private - */ - function process_incoming() + * Processes the incoming variables and then sets all the sort order + * information appropriately + */ + private function _processIncoming() { - $this->sortkey = $this->registry->in['by']; - if (!$this->fetch_by_text($this->registry->in['by'])) + $this->sortkey = BSApp::$input->in['by']; + if (!self::fetch_by_text(BSApp::$input->in['by'])) { - $this->sortkey = (isset($this->registry->userinfo['defaultsortkey']) ? $this->registry->userinfo['defaultsortkey'] : $this->registry->options['defaultsortkey']); + $this->sortkey = (isset(bugdar::$userinfo['defaultsortkey']) ? bugdar::$userinfo['defaultsortkey'] : bugdar::$options['defaultsortkey']); } - $this->direction = $this->registry->in['as']; + $this->direction = BSApp::$input->in['as']; if (!in_array($this->direction, array('asc', 'desc'))) { - $this->direction = (isset($this->registry->userinfo['defaultsortas']) ? $this->registry->userinfo['defaultsortas'] : $this->registry->options['defaultsortas']); + $this->direction = (isset(bugdar::$userinfo['defaultsortas']) ? bugdar::$userinfo['defaultsortas'] : bugdar::$options['defaultsortas']); } } - // ################################################################### /** - * Fetch a SQL query to gather bugs with the sort filters applied - * - * @access public - * - * @param string Additional WHERE clauses in an array - * @param string A LIMIT clause - * - * @return string Compiled SQL query - */ - function fetch_sql_query($where = null, $limit = null) + * Fetch a SQL query to gather bugs with the sort filters applied + * + * @param string Additional WHERE clauses in an array + * @param string A LIMIT clause + * + * @return string Compiled SQL query + */ + public function fetchSqlQuery($where = null, $limit = null) { // this WHERE clause is used for all the queries $basewhere = "bug.product IN (" . fetch_on_bits('canviewbugs') . ") - AND (!bug.hidden OR (bug.hidden AND bug.product IN (" . fetch_on_bits('canviewhidden') . "))" . (can_perform('canviewownhidden') ? " OR (bug.hidden AND bug.userid = " . $this->registry->userinfo['userid'] . " AND bug.product IN (" . fetch_on_bits('canviewownhidden') . "))" : "") . ")" . - (($this->registry->options['hidestatuses'] OR isset($this->registry->userinfo['hidestatuses'])) ? " - AND bug.status NOT IN (" . ($this->registry->userinfo['hidestatuses'] != '' ? $this->registry->userinfo['hidestatuses'] : $this->registry->options['hidestatuses']) . ")" : ""); + AND (!bug.hidden OR (bug.hidden AND bug.product IN (" . fetch_on_bits('canviewhidden') . "))" . (can_perform('canviewownhidden') ? " OR (bug.hidden AND bug.userid = " . bugdar::$userinfo['userid'] . " AND bug.product IN (" . fetch_on_bits('canviewownhidden') . "))" : "") . ")" . + ((bugdar::$options['hidestatuses'] || isset(bugdar::$userinfo['hidestatuses'])) ? " + AND bug.status NOT IN (" . (bugdar::$userinfo['hidestatuses'] != '' ? bugdar::$userinfo['hidestatuses'] : bugdar::$options['hidestatuses']) . ")" : ""); // remap the sort keys to be actual SQL fields $querykeys = array( @@ -177,7 +162,7 @@ class ListSorter WHERE $basewhere" . (is_array($where) ? " AND " . implode("\nAND ", $where) : "") . " - ORDER BY vote.votefor " . strtoupper($this->direction) . ", vote.voteagainst " . strtoupper($this->fetch_opposite_sort_direction()) . ", bug.$querykeys[lastpost] " . strtoupper($this->direction) . ($limit ? " + ORDER BY vote.votefor " . strtoupper($this->direction) . ", vote.voteagainst " . strtoupper($this->fetchOppositeSortDirection()) . ", bug.$querykeys[lastpost] " . strtoupper($this->direction) . ($limit ? " LIMIT $limit" : ""); break; default: @@ -200,21 +185,16 @@ class ListSorter return $query; } - // ################################################################### /** - * Returns the display text for a given sort order key - * - * @access public static - * - * @param string Sort order key, or FALSE for the array - * @param bool Permission check the custom fields? - * - * @return mixed Display text if param is string, or array of all key=>text if param is NULL - */ - function fetch_by_text($key, $doPerm = true) + * Returns the display text for a given sort order key + * + * @param string Sort order key, or FALSE for the array + * @param bool Permission check the custom fields? + * + * @return mixed Display text if param is string, or array of all key=>text if param is NULL + */ + public static function fetch_by_text($key, $doPerm = true) { - global $bugsys; - $keys = array( 'lastpost' => T('Last Post Time'), 'bugid' => T('Bug ID'), @@ -231,7 +211,7 @@ class ListSorter 'assignedto' => T('Assigned To') ); - $fields = self::_fetchCustomFields($doPerm); + $fields = self::_fetch_custom_fields($doPerm); foreach ($fields AS $field) { $keys['custom' . $field['fieldid']] = $field['name']; @@ -247,20 +227,15 @@ class ListSorter } } - // ################################################################### /** - * Returns the display text for a given sort order direction - * - * @access public static - * - * @param string Sort direction, or FALSE for the array - * - * @return mixed Display text if param is string, or array of all key=>text if param is NULL - */ - function fetch_as_text($key) + * Returns the display text for a given sort order direction + * + * @param string Sort direction, or FALSE for the array + * + * @return mixed Display text if param is string, or array of all key=>text if param is NULL + */ + public static function fetch_as_text($key) { - global $lang; - $keys = array( 'desc' => T('Descending'), 'asc' => T('Ascending') @@ -276,75 +251,63 @@ class ListSorter } } - // ################################################################### /** - * Returns a multi-dimensional array with sort by keys indexing arrays - * with 'image' and 'href' keys that store the values from - * fetch_sort_image() and fetch_sort_link(), respectively - * - * @access public - * - * @param string Extra GET parameters to pass to fetch_sort_link() - * - * @return array Array as described above - */ - function fetch_display_array($params = null) + * Returns a multi-dimensional array with sort by keys indexing arrays + * with 'image' and 'href' keys that store the values from + * fetchSortImage() and fetchSortLink(), respectively + * + * @param string Extra GET parameters to pass to fetchSortLink() + * + * @return array Array as described above + */ + public function fetchDisplayArray($params = null) { - $return = $this->fetch_by_text(false); + $return = self::fetch_by_text(false); - foreach ($return AS $key => $nil) + foreach ($return as $key => $nil) { - $return["$key"] = array('image' => ($this->sortkey == $key ? $this->fetch_sort_image() : ''), 'href' => $this->fetch_sort_link($key, $params, true)); + $return["$key"] = array('image' => ($this->sortkey == $key ? $this->fetchSortImage() : ''), 'href' => $this->fetchSortLink($key, $params, true)); } return $return; } - // ################################################################### /** - * Returns the entire tag for the sort arrow - * - * @access public - * - * @return string HTML tag - */ - function fetch_sort_image() + * Returns the entire tag for the sort arrow + * + * @return string HTML tag + */ + public function fetchSortImage() { - return ''; + return ''; } - // ################################################################### /** - * Returns the href value for an tag by generating all the necessary - * bits and concat'ing it onto an extra string of GETs (optional) - * - * @access public - * - * @param string Sorting key - * @param string Additional GET parameters - * @param bool Highlight the current sortkey if that's passed? - * - * @return string HREF - */ - function fetch_sort_link($key, $params = null, $highlight = false) + * Returns the href value for an tag by generating all the necessary + * bits and concat'ing it onto an extra string of GETs (optional) + * + * @param string Sorting key + * @param string Additional GET parameters + * @param bool Highlight the current sortkey if that's passed? + * + * @return string HREF + */ + public function fetchSortLink($key, $params = null, $highlight = false) { if ($params) { $params .= '&'; } - return $this->page . '.php?' . $params . 'by=' . $key . '&as=' . (($this->sortkey == $key AND $highlight) ? $this->fetch_opposite_sort_direction() . '" class="select' : $this->fetch_sort_direction()); + return $this->page . '.php?' . $params . 'by=' . $key . '&as=' . (($this->sortkey == $key && $highlight) ? $this->fetchOppositeSortDirection() . '" class="select' : $this->fetchSortDirection()); } - // ################################################################### /** - * Returns the OPPOSITE direction to sort when you click on a link - * - * @access public - * - * @return string Either asc or desc - */ - function fetch_opposite_sort_direction() + * Returns the OPPOSITE direction to sort when you click on a link + * + * @return string Either asc or desc + */ + public function fetchOppositeSortDirection() { if ($this->direction == 'asc') { @@ -356,71 +319,70 @@ class ListSorter } } - // ################################################################### /** - * Returns the current sorted direction for the image path - * - * @access public - * - * @return string Either asc or desc - */ - function fetch_sort_direction() + * Returns the current sorted direction for the image path + * + * @return string Either asc or desc + */ + public function fetchSortDirection() { return $this->direction; } - // ################################################################### /** - * Returns the HTML code for bug listing table column headers - * - * @param bool Include the sort links/image? - * @param string Additional GET params to pass to fetch_sort_link() - * - * @return string HTML code - */ - function constructColumnHeaders($sortable, $params = null) + * Returns the HTML code for bug listing table column headers + * + * @param bool Include the sort links/image? + * @param string Additional GET params to pass to fetchSortLink() + * + * @return string HTML code + */ + public function constructColumnHeaders($sortable, $params = null) { $this->_processColumns(); $names = self::fetch_by_text(false); $output = ''; - foreach ($this->columns AS $columns) + foreach ($this->columns as $columns) { $build = array(); - foreach ($columns AS $column) + foreach ($columns as $column) { - $build[] = ($sortable ? '' . $names[$column] . '' : $names[$column]); + $build[] = ($sortable ? '' . $names[$column] . '' : $names[$column]); } - $image = ((in_array($this->sortkey, $columns) AND $sortable) ? $this->fetch_sort_image() : ''); + $image = ((in_array($this->sortkey, $columns) && $sortable) ? $this->fetchSortImage() : ''); $name = implode(' / ', $build); - eval('$output .= "' . $this->registry->template->fetch('list_head') . '";'); + + $tpl = new BSTemplate('list_head'); + $tpl->vars = array( + 'name' => $name, + 'image' => $image + ); + $output .= $tpl->evaluate()->getTemplate(); } return $output; } - // ################################################################### /** - * Returns the HTML code for a row of data for the bug listing - * - * @param array Bug data array - * @param string Additional link params - * - * @return string Row HTML - */ + * Returns the HTML code for a row of data for the bug listing + * + * @param array Bug data array + * @param string Additional link params + * + * @return string Row HTML + */ function constructRow($bug, $params = null) { - global $bugsys; - $this->_processColumns(); - foreach ($this->columns AS $columns) + foreach ($this->columns as $columns) { if (sizeof($columns) > 1) { $build = array(); - foreach ($columns AS $column) + foreach ($columns as $column) { $build[] = $this->_processDataForColumn($bug, $column, $params, true); } @@ -433,22 +395,25 @@ class ListSorter $fields .= "\n\t"; } - eval('$output = "' . $this->registry->template->fetch('trackerhome_bits') . '";'); - return $output; + $tpl = new BSTemplate('trackerhome_bits'); + $tpl->vars = array( + 'bug' => $bug, + 'fields'=> $fields + ); + return $tpl->evaluate()->getTemplate(); } - // ################################################################### /** - * Handler for special-case column data - * - * @param array Bug data - * @param string Column name - * @param string Additional URL params - * @param bool Will this column have multiple data sets? - * - * @return string Processed column data - */ - function _processDataForColumn($bug, $column, $params = null, $multi = false) + * Handler for special-case column data + * + * @param array Bug data + * @param string Column name + * @param string Additional URL params + * @param bool Will this column have multiple data sets? + * + * @return string Processed column data + */ + private function _processDataForColumn($bug, $column, $params = null, $multi = false) { $open = ($multi ? '
' : ''); $close = ($multi ? '
' : ''); @@ -467,12 +432,11 @@ class ListSorter } } - // ################################################################### /** - * Sets up $this->columns so that the data can be processed more - * easily - */ - function _processColumns() + * Sets up $this->columns so that the data can be processed more + * easily + */ + private function _processColumns() { if (is_array($this->columns)) { @@ -481,9 +445,9 @@ class ListSorter $columns = self::fetch_by_text(false); - $array = (($this->registry->userinfo['userid'] AND is_array($this->registry->userinfo['columnoptions'])) ? $this->registry->userinfo['columnoptions'] : $this->registry->options['columnoptions']); + $array = ((bugdar::$userinfo['userid'] && is_array(bugdar::$userinfo['columnoptions'])) ? bugdar::$userinfo['columnoptions'] : bugdar::$options['columnoptions']); - foreach ($array AS $column => $position) + foreach ($array as $column => $position) { // the column doesn't exist, or more likely, we don't have permission to view it if (!isset($columns[$column])) @@ -499,7 +463,6 @@ class ListSorter ksort($this->columns); } - // ################################################################### /** * Returns an array of all the custom fields that the current user * has permission to use @@ -508,38 +471,37 @@ class ListSorter * * @return array */ - private static function _fetchCustomFields($doPerm = true) + private static function _fetch_custom_fields($doPerm = true) { - global $bugsys; static $fields = array(), $fieldsPerm = array(); - if ($doPerm AND !empty($fieldsPerm)) + if ($doPerm && !empty($fieldsPerm)) { return $fieldsPerm; } - else if (!$doPerm AND !empty($fields)) + else if (!$doPerm && !empty($fields)) { return $fields; } if ($doPerm) { - $fields_fetch = $bugsys->db->query(" + $fields_fetch = BSApp::$db->query(" SELECT bugfield.*, MAX(permission.mask) AS mask FROM " . TABLE_PREFIX . "bugfield AS bugfield LEFT JOIN " . TABLE_PREFIX . "bugfieldpermission AS permission ON (bugfield.fieldid = permission.fieldid) WHERE (permission.mask = 2 OR permission.mask = 1) - AND permission.usergroupid IN ({$bugsys->userinfo['usergroupid']}" . (sizeof($bugsys->userinfo['groupids']) != 0 ? ',' . implode(',', $bugsys->userinfo['groupids']) : '') . ") + AND permission.usergroupid IN (" . bugdar::$userinfo['usergroupid'] . (sizeof(bugdar::$userinfo['groupids']) != 0 ? ',' . implode(',', bugdar::$userinfo['groupids']) : '') . ") GROUP BY (bugfield.fieldid) "); } else { - $fields_fetch = $bugsys->db->query("SELECT * FROM " . TABLE_PREFIX . "bugfield"); + $fields_fetch = BSApp::$db->query("SELECT * FROM " . TABLE_PREFIX . "bugfield"); } - while ($field = $bugsys->db->fetch_array($fields_fetch)) + foreach ($fields_fetch as $field) { if ($doPerm) { @@ -554,10 +516,4 @@ class ListSorter } } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/includes/config.php.new b/includes/config.php.new index 5e1d366..a5be85f 100644 --- a/includes/config.php.new +++ b/includes/config.php.new @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -80,10 +80,4 @@ $tableprefix = ''; // reason. $cookieprefix = 'bt'; -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/includes/emails.php b/includes/emails.php new file mode 100644 index 0000000..b4e1910 --- /dev/null +++ b/includes/emails.php @@ -0,0 +1,223 @@ + array( + 'subject' => sprintf(T('Welcome to %1$s'), bugdar::$options['trackertitle']), + 'bodyText' => T('Hi %1$s, + +Thank you for taking the time to register at %2$s. We look forward to your contributations to making our products better. + +If you have any questions, please don\'t hesitate to contact the webmaster.') + ), + + // reset password + // vars: username, trackertitle, trackerurl, activation id + 'password_reset' => array( + 'subject' => sprintf(T('%1$s Password Reset'), bugdar::$options['trackertitle']), + 'bodyText' => T('Hi %1$s, + +You requested this lost password email at the %2$s bug tracker. To reset your password, simply click the link below (or paste it into your browser window exactly) and enter a new password. + +%3$s/login.php?do=recoverpw&activator=%4$s + +If you did not request this, do not worry as this notice will expire in 24 hours.') + ), + + // account approved and active + // vars: username, trackertitle + 'account_approved' => array( + 'subject' => sprintf(T('Account Approved at %1$s'), bugdar::$options['trackertitle']), + 'bodyText' => T('Hi %1$s, + +Your account was awaiting moderation at %2$s. Today, an administrator approved your registration and you are now able to use the bug tracker fully. + +If you have any questions, please don\'t hesitate to contact the webmaster.') + ), + + // activation code + // vars: username, trackertitle, trackerurl, userid, activationid + 'activate_account' => array( + 'subject' => sprintf(T('Welcome to %1$s'), bugdar::$options['trackertitle']), + 'bodyText' => T('Hi %1$s, + +Welcome to the %2$s tracker. Before you can begin posting bug reports, you\'ll need to activate your account. To do this, please click this link: + +%3$s/register.php?do=activate&userid=%4$d&activator=%5$s') + ), + + // bug notification + // vars: trackertitle, bug.summary + // vars: username, trackertitle, bug.summary, bug.id, trackerurl, parts + 'notification' => array( + 'subject' => T('%1$s Bug Notification - %2$s'), + 'bodyText' => T('Hi %1$s, + +You are receiving this email because you have opted to get notifications for the %2$s bug tracker. + +The bug is "%3$s" (id: %4$d) located at %5$s/showreport.php?bugid=%4$d + +Here are the notices: +################################################################### + +%5$s + +################################################################### +If you no longer want to receive email from us, please log into your account and click the "My Controls" tab at the top of the screen to change email preferences. + +%5$s') + ), + + // assigned to bug + // vars + 'notice_assigned' => array( + 'part' => T('You have been assigned to this bug by %1$s.') + ), + + // unassigned from bug + // vars: changer.displayname + 'notice_unassigned' => array( + 'part' => T('You are no longer assigned to this bug, per %1$s\'s changes.') + ), + + // status change + // vars: new, old + 'notice_status' => array( + 'part' => T('The status of the bug is now "%1$s", from "%2$s".') + ), + + // resolution change + // vars: new, old + 'notice_resolution' => array( + 'part' => T('This bug has been resolved with resolution "%1$s", from "%2$s".') + ), + + // duplicates list change + // vars: old, new + 'notice_duplicates' => array( + 'part' => T('The duplicates list has changed from "%1$s" to "%2$s".') + ), + + // severity change + // vars: old, new + 'notice_severity' => array( + 'part' => T('The severity has been elevated from "%1$s" to "%2$s".') + ), + + // priority change + // vars: old, new + 'notice_priority' => array( + 'part' => T('The priority has been elevatd from "%1$s" to "%2$s".') + ), + + // PCV change + // vars: old, new + 'notice_product' => array( + 'part' => T('The product, component, and version combination has changed from "%1$s" to "%2$s".') + ), + + // new comment + // vars: user, date, comment + 'notice_comment' => array( + 'part' => T('The following comment was added by %1$s on %2$s: +============================================ +%3$s +============================================') + ), + + // other change + // vars: field, old, new + 'notice_other' => array( + 'part' => T('The %1$s field changed from "%2$s" to "%3$s".') + ), + + // new attachment + // vars: username, filename, description, filesize, obsoletes, trackerurl, attachmentid + 'notice_attachment' => array( + 'part' => T('%1$s has uploaded a new attachment: +============================================ +File name: %2$s +Description: %3$s +File size: %4$d Bytes +Makes obsolete: %5$s +View: %6$s/viewattachment.php?attachmentid=%7$d +============================================') + ), + + // new bug + // vars: bugid, summary, reporter, product, initial comment + 'notice_new_bug' => array( + 'part' => T('This bug has been added to the database: +============================================ +Bug ID: %1$d +Summary: %2$s +Reporter: %3$s +Product/Component/Version: %4$s +Initial report: +-------------------------------------------- +%5$s +-------------------------------------------- +============================================') + ), + + // bug notification + // vars: trackertitle, bug.summary + // vars: displayname, trackertitle, bug.summary, bug.id, trackerurl, parts + 'bug_notification' => array( + 'subject' => T('%1$s Bug Notification - %2$s'), + 'bodyText' => T('Hi %1$s, + +You are receiving this email because you have opted to get notifications for the %2$s bug tracker. + +The bug is "%3$s" (id: %4$d) located at %4$s/showreport.php?bugid=%5$d + +Here are the notices: +################################################################### + +%6$s + +################################################################### +If you no longer want to receive email from us, please log into your account and click the "My Controls" tab at the top of the screen to change email preferences. + +%4$s') + ) + ); + + if (!isset($_emails[$name])) + { + throw new Exception('Unknown email template "' . $name . '"'); + } + return $_emails[$name]; +} + +?> \ No newline at end of file diff --git a/includes/framework b/includes/framework index b4f6983..f43a67b 160000 --- a/includes/framework +++ b/includes/framework @@ -1 +1 @@ -Subproject commit b4f6983f45d12cd8a8fb5d1193cd9db796606434 +Subproject commit f43a67bd362838ad8fcfe3a7d0532b4d0dbf25c5 diff --git a/includes/functions.php b/includes/functions.php index 06441db..9fa4162 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -38,8 +38,6 @@ */ function construct_option_select($name, $array, $selected = 0, $valuekey = '', $labelkey = '', $includenil = false, $multiple = false) { - global $bugsys; - if ($multiple) { $selected = explode(',', $selected); @@ -59,12 +57,15 @@ function construct_option_select($name, $array, $selected = 0, $valuekey = '', $ return '"; } -// ################### Start construct_user_display ################## -// $userinfo needs userid, email, displayname, and showemail +/** + * Constructs the user information link + * + * @param array Userinfo array - requires userid, email, displayname, and showemail values + * @param bool Return HTML or just a string? + * @return string + */ function construct_user_display($userinfo, $html = true) { - global $bugsys; - if (!$userinfo['userid']) { $userinfo['displayname'] = T('Guest'); @@ -73,7 +74,9 @@ function construct_user_display($userinfo, $html = true) if ($html) { - eval('$username = "' . $bugsys->template->fetch('username_display') . '";'); + $tpl = new BSTemplate('username_display'); + $tpl->vars = array('userinfo' => $userinfo); + $username = $tpl->evaluate()->getTemplate(); } else { @@ -94,8 +97,6 @@ function construct_user_display($userinfo, $html = true) // short-hand for bitwise & function can_perform($bitmask, $productid = 0, $userinfo = null) { - global $bugsys; - // masks that aren't product-specific static $inspecific = array( 'cansearch', @@ -111,12 +112,12 @@ function can_perform($bitmask, $productid = 0, $userinfo = null) if ($userinfo == null) { - $userinfo =& $bugsys->userinfo; + $userinfo =& bugdar::$userinfo; } - $permissions =& $bugsys->datastore['permission']; + $permissions =& bugdar::$datastore['permission']; - if (!isset($bugsys->permissions["$bitmask"])) + if (!isset(bugdar::$permissions["$bitmask"])) { trigger_error('Invalid bitmask "' . $bitmask . '" specified for can_perform() [includes/functions.php]', E_USER_WARNING); } @@ -128,43 +129,40 @@ function can_perform($bitmask, $productid = 0, $userinfo = null) if ($productid AND !in_array($bitmask, $inspecific)) { - $verdict = (isset($permissions["$userinfo[usergroupid]"]["$productid"]) ? ($permissions["$userinfo[usergroupid]"]["$productid"] & $bugsys->permissions["$bitmask"]) : ($userinfo['permissions'] & $bugsys->permissions["$bitmask"])); + $verdict = (isset($permissions["$userinfo[usergroupid]"]["$productid"]) ? ($permissions["$userinfo[usergroupid]"]["$productid"] & bugdar::$permissions["$bitmask"]) : ($userinfo['permissions'] & bugdar::$permissions["$bitmask"])); foreach ($userinfo['groupids'] AS $group) { if (isset($permissions["$group"]["$productid"])) { - $verdict |= ($permissions["$group"]["$productid"] & $bugsys->permissions["$bitmask"]); + $verdict |= ($permissions["$group"]["$productid"] & bugdar::$permissions["$bitmask"]); } } - $bugsys->debug("verdict* on can_perform($bitmask, $productid, $userinfo[userid]) = $verdict"); + BSApp::debug("verdict* on can_perform($bitmask, $productid, $userinfo[userid]) = $verdict"); return $verdict; } - $bugsys->debug("verdict on can_perform($bitmask, $productid, $userinfo[userid]) = " . ($userinfo['permissions'] & $bugsys->permissions["$bitmask"])); - return ($userinfo['permissions'] & $bugsys->permissions["$bitmask"]); + BSApp::debug("verdict on can_perform($bitmask, $productid, $userinfo[userid]) = " . ($userinfo['permissions'] & bugdar::$permissions["$bitmask"])); + return ($userinfo['permissions'] & bugdar::$permissions["$bitmask"]); } -// ################################################################### /** -* Runs through a given datastore item and creates a series of + * options. + * + * @access public + * + * @param string Datastore name + * @param string Array index for the label + * @param string Array index for the value + * @param mixed The selected value(s) + * @param bool Include a blank option? TRUE will set a null value, FALSE turns it off, anything else is used as the value for the blank option + * @param bool Generate it using admin printers? + * + * @return string Unelss in admin mode, returns the constructed options + */ function construct_datastore_select($datastore, $labelname, $valuename, $selectedvalue = 0, $includeblank = false, $adminmode = false) { - global $bugsys; - if ($adminmode) { global $admin; @@ -181,14 +179,17 @@ function construct_datastore_select($datastore, $labelname, $valuename, $selecte } else { - $label = ''; - $value = $newval; - $selected = ((!$selectedvalue OR (is_array($selectedvalue) AND in_array($newval, $selectedvalue))) ? true : false); - eval('$select .= "' . $bugsys->template->fetch('selectoption') . '";'); + $tpl = new BSTemplate('selectoption'); + $tpl->vars = array( + 'label' => '', + 'value' => $newval, + 'selected' => (!$selectedvalue || (is_array($selectedvalue) && in_array($newval, $selectedvalue))) + ); + $select .= $tpl->evaluate()->getTemplate(); } } - foreach ($bugsys->datastore["$datastore"] AS $item) + foreach (bugdar::$datastore["$datastore"] AS $item) { $label = $item["$labelname"]; $value = $item["$valuename"]; @@ -200,7 +201,13 @@ function construct_datastore_select($datastore, $labelname, $valuename, $selecte } else { - eval('$select .= "' . $bugsys->template->fetch('selectoption') . '";'); + $tpl = new BSTemplate('selectoption'); + $tpl->vars = array( + 'label' => $label, + 'value' => $value, + 'selected' => $selected + ); + $select .= $tpl->evaluate()->getTemplate(); } } @@ -213,22 +220,21 @@ function construct_datastore_select($datastore, $labelname, $valuename, $selecte // ################## Start construct_custom_fields ################## function construct_custom_fields($bug = array(), $ignore21mask = false, $nodefault = false, $searchMode = false) { - global $bugsys; static $fields; if (!is_array($fields)) { $fields = array(); - $fields_fetch = $bugsys->db->query(" + $fields_fetch = BSApp::$db->query(" SELECT bugfield.*, MAX(permission.mask) AS mask FROM " . TABLE_PREFIX . "bugfield AS bugfield LEFT JOIN " . TABLE_PREFIX . "bugfieldpermission AS permission ON (bugfield.fieldid = permission.fieldid) WHERE (permission.mask = 2 OR permission.mask = 1) - AND permission.usergroupid IN ({$bugsys->userinfo['usergroupid']}" . (sizeof($bugsys->userinfo['groupids']) != 0 ? ',' . implode(',', $bugsys->userinfo['groupids']) : '') . ") + AND permission.usergroupid IN (" . bugdar::$userinfo['usergroupid'] . (sizeof(bugdar::$userinfo['groupids']) != 0 ? ',' . implode(',', bugdar::$userinfo['groupids']) : '') . ") GROUP BY (bugfield.fieldid) "); - while ($field = $bugsys->db->fetch_array($fields_fetch)) + foreach ($fields_fetch as $field) { $fields["$field[fieldid]"] = $field; } @@ -245,7 +251,7 @@ function construct_custom_fields($bug = array(), $ignore21mask = false, $nodefau if (!is_null($bug["custom$field[fieldid]"])) { - $bugsys->debug("not null: $field[fieldid]"); + BSApp::debug("not null: $field[fieldid]"); $value = $bug["custom$field[fieldid]"]; } else @@ -263,56 +269,62 @@ function construct_custom_fields($bug = array(), $ignore21mask = false, $nodefau switch ($field['type']) { case 'input_text': - eval('$tempfield = "' . $bugsys->template->fetch('bugfield_input_text') . '";'); + $tpl = new BSTemplate('bugfield_input_text'); + $tpl->vars = array( + 'field' => $field, + 'value' => $value + ); + $tempfield = $tpl->evaluate()->getTemplate(); break; case 'input_checkbox': - $selected = ($value ? ' checked="checked"' : ''); - eval('$tempfield = "' . $bugsys->template->fetch('bugfield_input_checkbox') . '";'); + $tpl = new BSTemplate('bugfield_input_checkbox'); + $tpl->vars = array( + 'field' => $field, + 'searchMode' => $searchMode, + 'selected' => ($value ? ' checked="checked"' : '') + ); + $tempfield = $tpl->evaluate()->getTemplate(); break; case 'select_single': $selects = unserialize($field['selects']); $value = trim($value); - $options = ''; + $tpl = new BSTemplate('bugfield_select_single_option'); + $tpl->vars = array( + 'id' => -1, + 'select' => '', + 'selected' => ((!$field['usedefault'] && !trim($value)) ? ' selected="selected"' : '') + ); + $options = $tpl->evaluate()->getTemplate(); - $id = -1; - $select = ''; - if (!$field['usedefault'] AND !trim($value)) - { - $selected = ' selected="selected"'; - } - else + foreach ($selects as $id => $select) { - $selected = ''; + $tpl = new BSTemplate('bugfield_select_single_option'); + $tpl->vars = array( + 'id' => $id, + 'select' => stripslashes(trim($select)), + 'selected' => (($select == $value || ($field['usedefault'] && $id == 0)) ? ' selected="selected"' : '') + ); + $options .= $tpl->evaluate()->getTemplate(); } - eval('$options .= "' . $bugsys->template->fetch('bugfield_select_single_option') . '";'); - foreach ($selects AS $id => $select) - { - $selected = ''; - $select = stripslashes(trim($select)); - if ($select == $value) - { - $selected = ' selected="selected"'; - } - else if ($field['usedefault'] AND $id == 0) - { - $selected = ' selected="selected"'; - } - eval('$options .= "' . $bugsys->template->fetch('bugfield_select_single_option') . '";'); - } - eval('$tempfield = "' . $bugsys->template->fetch('bugfield_select_single') . '";'); + $tpl = new BSTemplate('bugfield_select_single'); + $tpl->vars = array( + 'field' => $field, + 'options' => $options + ); + $tempfield = $tpl->evaluate()->getTemplate(); break; } } else { - $bugsys->debug('mask 1 processing'); + BSApp::debug('mask 1 processing'); if (is_null($bug["custom$field[fieldid]"])) { - $bugsys->debug("is null: $field[fieldid]"); + BSApp::debug("is null: $field[fieldid]"); if ($field['type'] == 'select_single') { if ($field['usedefault']) @@ -340,7 +352,10 @@ function construct_custom_fields($bug = array(), $ignore21mask = false, $nodefau $value = ($value ? 'True' : 'False'); } $field['value'] = $value; - eval('$tempfield = "' . $bugsys->template->fetch('bugfield_static_text') . '";'); + + $tpl = new BSTemplate('bugfield_static_text'); + $tpl->vars = array('field' => $field); + $tempfield = $tpl->evaluate()->getTemplate(); } $fieldbits[] = $tempfield; } @@ -363,23 +378,21 @@ function construct_custom_fields($bug = array(), $ignore21mask = false, $nodefau */ function process_custom_fields(&$bugapi, &$msg, $errorbox = false, $searchMode = false) { - global $bugsys; - if (!$inputdata) { - $inputdata =& $bugsys->in; + $inputdata = &BSApp::$input->in; } - $fields = $bugsys->db->query(" + $fields = BSApp::$db->query(" SELECT bugfield.*, MAX(permission.mask) AS mask FROM " . TABLE_PREFIX . "bugfield AS bugfield LEFT JOIN " . TABLE_PREFIX . "bugfieldpermission AS permission ON (bugfield.fieldid = permission.fieldid) WHERE permission.mask = 2 - AND permission.usergroupid IN ({$bugsys->userinfo['usergroupid']}" . (sizeof($bugsys->userinfo['groupids']) != 0 ? ',' . implode(',', $bugsys->userinfo['groupids']) : '') . ") + AND permission.usergroupid IN (" . bugdar::$userinfo['usergroupid'] . (sizeof(bugdar::$userinfo['groupids']) != 0 ? ',' . implode(',', bugdar::$userinfo['groupids']) : '') . ") GROUP BY (bugfield.fieldid) "); - while ($field = $bugsys->db->fetch_array($fields)) + foreach ($fields as $field) { $fieldname = "custom$field[fieldid]"; @@ -464,11 +477,9 @@ function process_custom_fields(&$bugapi, &$msg, $errorbox = false, $searchMode = // ####################### Start fetch_on_bits ####################### function fetch_on_bits($mask, $userinfo = null) { - global $bugsys; - if ($userinfo == null) { - $userinfo =& $bugsys->userinfo; + $userinfo =& bugdar::$userinfo; } $onbits = array(); @@ -479,14 +490,14 @@ function fetch_on_bits($mask, $userinfo = null) $groups[] = $usergroupid; // product-inspecific work - if (is_array($bugsys->datastore['product'])) + if (is_array(bugdar::$datastore['product'])) { foreach ($groups AS $groupid) { // we only need to do this so long as there's no onbits array because this isn't product specific - if (sizeof($onbits) == 0 AND $bugsys->datastore['usergroup']["$groupid"]['permissions'] & $bugsys->permissions["$mask"]) + if (sizeof($onbits) == 0 AND bugdar::$datastore['usergroup']["$groupid"]['permissions'] & bugdar::$permissions["$mask"]) { - foreach ($bugsys->datastore['product'] AS $id => $product) + foreach (bugdar::$datastore['product'] AS $id => $product) { $onbits["$id"] = $id; } @@ -500,11 +511,11 @@ function fetch_on_bits($mask, $userinfo = null) // product specific work foreach ($groups AS $groupid) { - if (is_array($bugsys->datastore['permission']["$groupid"])) + if (is_array(bugdar::$datastore['permission']["$groupid"])) { - foreach ($bugsys->datastore['permission']["$groupid"] AS $productid => $bit) + foreach (bugdar::$datastore['permission']["$groupid"] AS $productid => $bit) { - if ($bit & $bugsys->permissions["$mask"]) + if ($bit & bugdar::$permissions["$mask"]) { $explicit["$productid"] = $productid; $onbits["$productid"] = $productid; @@ -531,36 +542,43 @@ function fetch_on_bits($mask, $userinfo = null) return implode(',', $onbits); } -// #################### Start isso_pre_parse_hook #################### -// the pre-parse hook for ISSO's template engine +/** + * Pre-parse hook for BSTemplate class. This merely substitutes help links + * + * @param string Template + * @return string + */ function isso_pre_parse_hook($template) { - $template = preg_replace('#\$help\[(.*)\]#', '" . fetch_help_link("\1") . "', $template); + $template = preg_replace('#\$help\[(.*)\]#', '', $template); return $template; } -// ###################### Start fetch_help_link ###################### -// returns a prepared link to insert into templates that opens up a -// help popup in the user-end +/** + * Returns the HTML used to generate a help link for a given topic + * + * @param string Topic name + * @return string + */ function fetch_help_link($topic) { - global $bugsys; + $tpl = new BSTemplate('help_link'); + $tpl->vars = array('topic' => $topic); - if (isset($bugsys->datastore['help']["$topic"])) + if (isset(bugdar::$datastore['help']["$topic"])) { - eval('$temp = "' . $bugsys->template->fetch('help_link') . '";'); - return $temp; + return $tpl->evaluate()->getTemplate(); } else { - if ($bugsys->debug) + if (BSApp::get_debug()) { return "[[INVALID TOPIC: $topic]]"; } // do we want this? else if (null == 1) { - return eval('$temp = "' . $bugsys->template->fetch('help_link') . '";'); + return $tpl->evaluate()->getTemplate(); } } } @@ -577,8 +595,6 @@ function fetch_help_link($topic) */ function fetch_guest_user() { - global $bugsys; - return array( 'usergroupid' => 1, 'groupids' => array(), @@ -586,9 +602,9 @@ function fetch_guest_user() 'email' => '', 'displayname' => '', 'showcolors' => 1, - 'permissions' => $bugsys->datastore['usergroup'][1]['permissions'], - 'displaytitle' => $bugsys->datastore['usergroup'][1]['displaytitle'], - 'timezone' => $bugsys->options['defaulttimezone'] + 'permissions' => bugdar::$datastore['usergroup'][1]['permissions'], + 'displaytitle' => bugdar::$datastore['usergroup'][1]['displaytitle'], + 'timezone' => bugdar::$options['defaulttimezone'] ); } @@ -607,24 +623,23 @@ function fetch_guest_user() */ function check_bug_permissions($bug, $userinfo = null) { - global $bugsys; if ($userinfo == null) { - $userinfo = $bugsys->userinfo; + $userinfo = bugdar::$userinfo; } - $bugsys->debug("checking permissions for $userinfo[userid] on bug $bug[bugid]"); + BSApp::debug("checking permissions for $userinfo[userid] on bug $bug[bugid]"); - $bugsys->debug('*** START VERBOSE CHECK ***'); + BSApp::debug('*** START VERBOSE CHECK ***'); - $bugsys->debug('* !can_perform(canviewbugs, $bug[product], $userinfo) = ' . (int)(!can_perform('canviewbugs', $bug['product'], $userinfo))); - $bugsys->debug('* $bug[hidden] = ' . (int)$bug['hidden']); - $bugsys->debug('* $userinfo[userid] (' . $userinfo['userid'] . ') == $bug[userid] (' . $bug['userid'] . ') = ' . (int)($userinfo['userid'] == $bug['userid'])); - $bugsys->debug('* can_perform(canviewownhidden, $bug[product], $userinfo) = ' . (int)(!!can_perform('canviewownhidden', $bug['product'], $userinfo))); - $bugsys->debug('* can_perform(canviewhidden, $bug[product], $userinfo) = ' . (int)(!!can_perform('canviewhidden', $bug['product'], $userinfo))); - $bugsys->debug('* !$bug[hidden] = ' . (int)(!$bug['hidden'])); + BSApp::debug('* !can_perform(canviewbugs, $bug[product], $userinfo) = ' . (int)(!can_perform('canviewbugs', $bug['product'], $userinfo))); + BSApp::debug('* $bug[hidden] = ' . (int)$bug['hidden']); + BSApp::debug('* $userinfo[userid] (' . $userinfo['userid'] . ') == $bug[userid] (' . $bug['userid'] . ') = ' . (int)($userinfo['userid'] == $bug['userid'])); + BSApp::debug('* can_perform(canviewownhidden, $bug[product], $userinfo) = ' . (int)(!!can_perform('canviewownhidden', $bug['product'], $userinfo))); + BSApp::debug('* can_perform(canviewhidden, $bug[product], $userinfo) = ' . (int)(!!can_perform('canviewhidden', $bug['product'], $userinfo))); + BSApp::debug('* !$bug[hidden] = ' . (int)(!$bug['hidden'])); - $bugsys->debug('*** END PERMISSIONS CHECK ***'); + BSApp::debug('*** END PERMISSIONS CHECK ***'); if ( @@ -645,11 +660,11 @@ function check_bug_permissions($bug, $userinfo = null) ) ) { - $bugsys->debug('*** DONE WITH REAL CALLS ***'); + BSApp::debug('*** DONE WITH REAL CALLS ***'); return false; } - $bugsys->debug('*** DONE WITH REAL CALLS ***'); + BSApp::debug('*** DONE WITH REAL CALLS ***'); return true; } @@ -666,89 +681,27 @@ function check_bug_permissions($bug, $userinfo = null) * @param array Bug array with data fit for display */ function ProcessBugDataForDisplay($bug, $color = '') -{ - global $bugsys; - - $bug['hiddendisplay'] = ($bug['hidden'] AND (can_perform('canviewhidden', $bug['product']) OR (can_perform('canviewownhidden') AND $bug['userid'] == $bugsys->userinfo['userid']))); - - $bug['bgcolor'] = ($bugsys->userinfo['showcolors'] ? $bugsys->datastore['status']["$bug[status]"]['color'] : $color); - $bug['product'] = $bugsys->datastore['product']["$bug[product]"]['title']; - $bug['version'] = $bugsys->datastore['version']["$bug[version]"]['version']; - $bug['component'] = $bugsys->datastore['component']["$bug[component]"]['title']; - $bug['status'] = $bugsys->datastore['status']["$bug[status]"]['status']; - $bug['resolution'] = $bugsys->datastore['resolution']["$bug[resolution]"]['resolution']; - $bug['priority'] = $bugsys->datastore['priority']["$bug[priority]"]['priority']; - $bug['severity'] = $bugsys->datastore['severity']["$bug[severity]"]['severity']; - $bug['assignedto'] = ((empty($bug['assignedto']) OR !isset($bugsys->datastore['assignto']["$bug[assignedto]"])) ? '' : construct_user_display($bugsys->datastore['assignto']["$bug[assignedto]"])); +{ + $bug['hiddendisplay'] = ($bug['hidden'] AND (can_perform('canviewhidden', $bug['product']) OR (can_perform('canviewownhidden') AND $bug['userid'] == bugdar::$userinfo['userid']))); + + $bug['bgcolor'] = (bugdar::$userinfo['showcolors'] ? bugdar::$datastore['status']["$bug[status]"]['color'] : $color); + $bug['product'] = bugdar::$datastore['product']["$bug[product]"]['title']; + $bug['version'] = bugdar::$datastore['version']["$bug[version]"]['version']; + $bug['component'] = bugdar::$datastore['component']["$bug[component]"]['title']; + $bug['status'] = bugdar::$datastore['status']["$bug[status]"]['status']; + $bug['resolution'] = bugdar::$datastore['resolution']["$bug[resolution]"]['resolution']; + $bug['priority'] = bugdar::$datastore['priority']["$bug[priority]"]['priority']; + $bug['severity'] = bugdar::$datastore['severity']["$bug[severity]"]['severity']; + $bug['assignedto'] = ((empty($bug['assignedto']) OR !isset(bugdar::$datastore['assignto']["$bug[assignedto]"])) ? '' : construct_user_display(bugdar::$datastore['assignto']["$bug[assignedto]"])); $bug['lastposttime'] = ($bug['hiddendisplay'] ? $bug['hiddenlastposttime'] : $bug['lastposttime']); $bug['lastpost'] = ($bug['hiddendisplay'] ? $bug['hiddenlastpostbyname'] : $bug['lastpostbyname']); - $bug['lastposttime'] = $bugsys->datef->format($bugsys->options['dateformat'], $bug['lastposttime']); + $bug['lastposttime'] = BSApp::$date->format(bugdar::$options['dateformat'], $bug['lastposttime']); return $bug; } -// ################################################################### -/** -* Loads the pagination module and sets all of the appropriate options -* for it -* -* @access public -*/ -function LoadPaginationFramework() -{ - global $bugsys; - - $bugsys->load('pagination', 'pagination', true); - $bugsys->pagination->setDefaultPerPage($bugsys->options['defaultpp']); - $bugsys->pagination->setMaxPerPage($bugsys->options['maxpp']); - $bugsys->pagination->setPageLinks($bugsys->options['pagelinks']); - $bugsys->pagination->setPageVar('p'); - $bugsys->pagination->setPerPageVar('pp'); - $bugsys->pagination->setBitProcessor('PageNavigatorBitCallback'); - $bugsys->pagination->setNavigatorProcessor('PageNavigatorCallback'); - $bugsys->pagination->processIncomingData(); -} - -// ################################################################### -/** -* Callback function for the Pagination->BitProcessor() -* -* @param string Base link -* @param bool Do not show this as a link -* @param integer Page number -* @param object Page navigator framework -* -* @return string Processed HTML -*/ -function PageNavigatorBitCallback($baselink, $nolink, $number, $paginator) -{ - global $bugsys; - eval('$return = "' . $bugsys->template->fetch('pagenav_bit') . '";'); - return $return; -} - -// ################################################################### -/** -* Callback function for the Pagination->NavigatorProcessor() -* -* @param string Base URL -* @param integer Next page number -* @param integer Previous page number -* @param array Show information -* @param string Individual page bits -* @param object Page navigator framework -* -* @return string Processed HTML -*/ -function PageNavigatorCallback($baselink, $nextpage, $prevpage, $show, $pagebits, $paginator) -{ - global $bugsys; - eval('$return = "' . $bugsys->template->fetch('pagenav') . '";'); - return $return; -} - // ################################################################### /** * Determines the correct permissions of the user. This is especially @@ -763,18 +716,16 @@ function PageNavigatorCallback($baselink, $nextpage, $prevpage, $show, $pagebits */ function FetchUserPermissions(&$user) { - global $bugsys; - - $perms = (int)$bugsys->datastore['usergroup']["$user[usergroupid]"]['permissions']; + $perms = (int)bugdar::$datastore['usergroup']["$user[usergroupid]"]['permissions']; if (!is_array($user['groupids'])) { - $user['groupids'] = explode(',', $bugsys->userinfo['groupids']); + $user['groupids'] = explode(',', bugdar::$userinfo['groupids']); } - $user['groupids'] = $bugsys->funct->array_strip_empty($user['groupids']); + $user['groupids'] = BSFunctions::array_strip_empty($user['groupids']); foreach ($user['groupids'] AS $group) { - $perms |= (int)$bugsys->datastore['usergroup']["$group"]['permissions']; + $perms |= (int)bugdar::$datastore['usergroup']["$group"]['permissions']; } return $perms; @@ -795,10 +746,4 @@ function FetchEmailPath($name, $locale) return '../locale/' . $locale . '/emails/' . $name; } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/includes/functions_datastore.php b/includes/functions_datastore.php index c51a176..43fe666 100755 --- a/includes/functions_datastore.php +++ b/includes/functions_datastore.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -22,133 +22,119 @@ // ###################### Start build_languages ###################### function build_languages() { - global $bugsys; - - $languages = $bugsys->db->query("SELECT * FROM " . TABLE_PREFIX . "language"); - while ($language = $bugsys->db->fetch_array($languages)) + $languages = BSApp::$db->query("SELECT * FROM " . TABLE_PREFIX . "language"); + foreach ($languages as $language) { $tempstore["$language[languageid]"] = $language; } - $bugsys->db->query(" + BSApp::$db->query(" ### replacing the language cache ### REPLACE INTO " . TABLE_PREFIX . "datastore (title, data) - VALUES ('language', '" . $bugsys->escape(serialize($tempstore)) . "')" + VALUES ('language', '" . BSApp::$input->escape(serialize($tempstore)) . "')" ); - $bugsys->datastore['language'] = $tempstore; + bugdar::$datastore['language'] = $tempstore; } // ####################### Start build_settings ###################### function build_settings() { - global $bugsys; - - $settings = $bugsys->db->query("SELECT * FROM " . TABLE_PREFIX . "setting"); - while ($setting = $bugsys->db->fetch_array($settings)) + $settings = BSApp::$db->query("SELECT * FROM " . TABLE_PREFIX . "setting"); + foreach ($settings as $setting) { $options["$setting[varname]"] = $setting['value']; } - $bugsys->db->query(" + BSApp::$db->query(" ### replacing the setting cache ### REPLACE INTO " . TABLE_PREFIX . "datastore (title, data) - VALUES ('setting', '" . $bugsys->escape(serialize($options)) . "')" + VALUES ('setting', '" . BSApp::$input->escape(serialize($options)) . "')" ); - $bugsys->datastore['setting'] = $options; + bugdar::$datastore['setting'] = $options; } // ###################### Start build_usergroups ##################### function build_usergroups() { - global $bugsys; - - $usergroups = $bugsys->db->query("SELECT * FROM " . TABLE_PREFIX . "usergroup"); - while ($usergroup = $bugsys->db->fetch_array($usergroups)) + $usergroups = BSApp::$db->query("SELECT * FROM " . TABLE_PREFIX . "usergroup"); + foreach ($usergroups as $usergroup) { $groups["$usergroup[usergroupid]"] = $usergroup; } - $bugsys->db->query(" + BSApp::$db->query(" ### replacing usergroup cache ### REPLACE INTO " . TABLE_PREFIX . "datastore (title, data) - VALUES ('usergroup', '" . $bugsys->escape(serialize($groups)) . "')" + VALUES ('usergroup', '" . BSApp::$input->escape(serialize($groups)) . "')" ); - $bugsys->datastore['usergroup'] = $groups; + bugdar::$datastore['usergroup'] = $groups; } // ####################### Start build_statuses ###################### function build_statuses() { - global $bugsys; - - $statuses = $bugsys->db->query("SELECT * FROM " . TABLE_PREFIX . "status ORDER BY displayorder ASC"); - while ($status = $bugsys->db->fetch_array($statuses)) + $statuses = BSApp::$db->query("SELECT * FROM " . TABLE_PREFIX . "status ORDER BY displayorder ASC"); + foreach ($statuses as $status) { $tempstore["$status[statusid]"] = $status; } - $bugsys->db->query(" + BSApp::$db->query(" ### replacing status cache ### REPLACE INTO " . TABLE_PREFIX . "datastore (title, data) - VALUES ('status', '" . $bugsys->escape(serialize($tempstore)) . "')" + VALUES ('status', '" . BSApp::$input->escape(serialize($tempstore)) . "')" ); - $bugsys->datastore['status'] = $tempstore; + bugdar::$datastore['status'] = $tempstore; } // ###################### Start build_severities ##################### function build_severities() { - global $bugsys; - - $severities = $bugsys->db->query("SELECT * FROM " . TABLE_PREFIX . "severity ORDER BY displayorder ASC"); - while ($severity = $bugsys->db->fetch_array($severities)) + $severities = BSApp::$db->query("SELECT * FROM " . TABLE_PREFIX . "severity ORDER BY displayorder ASC"); + foreach ($severities as $severity) { $tempstore["$severity[severityid]"] = $severity; } - $bugsys->db->query(" + BSApp::$db->query(" ### replacing severity cache ### REPLACE INTO " . TABLE_PREFIX . "datastore (title, data) - VALUES ('severity', '" . $bugsys->escape(serialize($tempstore)) . "')" + VALUES ('severity', '" . BSApp::$input->escape(serialize($tempstore)) . "')" ); - $bugsys->datastore['severity'] = $tempstore; + bugdar::$datastore['severity'] = $tempstore; } // ###################### Start build_priorities ##################### function build_priorities() { - global $bugsys; - - $priorities = $bugsys->db->query("SELECT * FROM " . TABLE_PREFIX . "priority ORDER BY displayorder ASC"); - while ($priority = $bugsys->db->fetch_array($priorities)) + $priorities = BSApp::$db->query("SELECT * FROM " . TABLE_PREFIX . "priority ORDER BY displayorder ASC"); + foreach ($priorities as $priority) { $tempstore["$priority[priorityid]"] = $priority; } - $bugsys->db->query(" + BSApp::$db->query(" ### replacing priority cache ### REPLACE INTO " . TABLE_PREFIX . "datastore (title, data) - VALUES ('priority', '" . $bugsys->escape(serialize($tempstore)) . "')" + VALUES ('priority', '" . BSApp::$input->escape(serialize($tempstore)) . "')" ); - $bugsys->datastore['priority'] = $tempstore; + bugdar::$datastore['priority'] = $tempstore; } // ###################### Start build_assignedto ##################### function build_assignedto() { - global $bugsys; - // determine the groups that are assignable $ids = $exprs = array(); - foreach ($bugsys->datastore['usergroup'] AS $id => $group) + foreach (bugdar::$datastore['usergroup'] AS $id => $group) { - if ($group['permissions'] & $bugsys->permissions['canbeassignedto']) + if ($group['permissions'] & bugdar::$permissions['canbeassignedto']) { $ids[] = $id; $exprs[] = "FIND_IN_SET($id, groupids)"; @@ -157,72 +143,66 @@ function build_assignedto() $ids = implode(',', $ids); $exprs = implode(' OR ', $exprs); - $users = $bugsys->db->query(" + $users = BSApp::$db->query(" SELECT email, displayname, userid, showemail FROM " . TABLE_PREFIX . "user AS user WHERE usergroupid IN ($ids) OR $exprs" ); - while ($user = $bugsys->db->fetch_array($users)) + foreach ($users as $user) { $devs["$user[userid]"] = $user; } - $bugsys->db->query(" + BSApp::$db->query(" ### replacing developer / assign to cache ### REPLACE INTO " . TABLE_PREFIX . "datastore (title, data) - VALUES ('assignto', '" . $bugsys->escape(serialize($devs)) . "')" + VALUES ('assignto', '" . BSApp::$input->escape(serialize($devs)) . "')" ); - $bugsys->datastore['assignto'] = $devs; + bugdar::$datastore['assignto'] = $devs; } // ##################### Start build_resolutions ##################### function build_resolutions() { - global $bugsys; - - $resolutions = $bugsys->db->query("SELECT * FROM " . TABLE_PREFIX . "resolution ORDER BY displayorder ASC"); - while ($resolution = $bugsys->db->fetch_array($resolutions)) + $resolutions = BSApp::$db->query("SELECT * FROM " . TABLE_PREFIX . "resolution ORDER BY displayorder ASC"); + foreach ($resolutions as $resolution) { $tempstore["$resolution[resolutionid]"] = $resolution; } - $bugsys->db->query(" + BSApp::$db->query(" ### replacing resolution cache ### REPLACE INTO " . TABLE_PREFIX . "datastore (title, data) - VALUES ('resolution', '" . $bugsys->escape(serialize($tempstore)) . "')" + VALUES ('resolution', '" . BSApp::$input->escape(serialize($tempstore)) . "')" ); - $bugsys->datastore['resolution'] = $tempstore; + bugdar::$datastore['resolution'] = $tempstore; } // ####################### Start build_versions ###################### function build_versions() { - global $bugsys; - - $versions = $bugsys->db->query("SELECT * FROM " . TABLE_PREFIX . "version ORDER BY displayorder ASC"); - while ($version = $bugsys->db->fetch_array($versions)) + $versions = BSApp::$db->query("SELECT * FROM " . TABLE_PREFIX . "version ORDER BY displayorder ASC"); + foreach ($versions as $version) { $tempstore["$version[versionid]"] = $version; } - $bugsys->db->query(" + BSApp::$db->query(" ### replacing version cache ### REPLACE INTO " . TABLE_PREFIX . "datastore (title, data) - VALUES ('version', '" . $bugsys->escape(serialize($tempstore)) . "')" + VALUES ('version', '" . BSApp::$input->escape(serialize($tempstore)) . "')" ); - $bugsys->datastore['version'] = $tempstore; + bugdar::$datastore['version'] = $tempstore; } // ####################### Start build_products ###################### function build_products() { - global $bugsys; - - $products = $bugsys->db->query("SELECT * FROM " . TABLE_PREFIX . "product ORDER BY displayorder ASC"); - while ($product = $bugsys->db->fetch_array($products)) + $products = BSApp::$db->query("SELECT * FROM " . TABLE_PREFIX . "product ORDER BY displayorder ASC"); + foreach ($products as $product) { if ($product['parentid']) { @@ -234,90 +214,78 @@ function build_products() } } - $bugsys->db->query(" + BSApp::$db->query(" ### replacing product / component cache ### REPLACE INTO " . TABLE_PREFIX . "datastore (title, data) VALUES - ('product', '" . $bugsys->escape(serialize($tempstore['product'])) . "'), - ('component', '" . $bugsys->escape(serialize($tempstore['component'])) . "')" + ('product', '" . BSApp::$input->escape(serialize($tempstore['product'])) . "'), + ('component', '" . BSApp::$input->escape(serialize($tempstore['component'])) . "')" ); - $bugsys->datastore['product'] = $tempstore['product']; - $bugsys->datastore['component'] = $tempstore['component']; + bugdar::$datastore['product'] = $tempstore['product']; + bugdar::$datastore['component'] = $tempstore['component']; } // ##################### Start build_permissions ##################### function build_permissions() { - global $bugsys; - - $permissions = $bugsys->db->query("SELECT * FROM " . TABLE_PREFIX . "permission ORDER BY usergroupid, productid"); - while ($permission = $bugsys->db->fetch_array($permissions)) + $permissions = BSApp::$db->query("SELECT * FROM " . TABLE_PREFIX . "permission ORDER BY usergroupid, productid"); + foreach ($permissions as $permission) { $tempstore["$permission[usergroupid]"]["$permission[productid]"] = $permission['mask']; } - $bugsys->db->query(" + BSApp::$db->query(" ### replacing permissions cache ### REPLACE INTO " . TABLE_PREFIX . "datastore (title, data) - VALUES ('permission', '" . $bugsys->escape(serialize($tempstore)) . "')" + VALUES ('permission', '" . BSApp::$input->escape(serialize($tempstore)) . "')" ); - $bugsys->datastore['permission'] = $tempstore; + bugdar::$datastore['permission'] = $tempstore; } // ##################### Start build_automations #################### function build_automations() { - global $bugsys; - - $automations = $bugsys->db->query("SELECT * FROM " . TABLE_PREFIX . "automation ORDER BY name ASC"); - while ($automation = $bugsys->db->fetch_array($automations)) + $automations = BSApp::$db->query("SELECT * FROM " . TABLE_PREFIX . "automation ORDER BY name ASC"); + foreach ($automations as $automation) { $actions["$automation[actionid]"] = $automation; } - $bugsys->db->query(" + BSApp::$db->query(" ### replacing automation cache ### REPLACE INTO " . TABLE_PREFIX . "datastore (title, data) - VALUES ('automation', '" . $bugsys->escape(serialize($actions)) . "')" + VALUES ('automation', '" . BSApp::$input->escape(serialize($actions)) . "')" ); - $bugsys->datastore['automation'] = $actions; + bugdar::$datastore['automation'] = $actions; } // ###################### Start build_user_help ###################### function build_user_help() { - global $bugsys; - // custom field descriptions - $descriptions = $bugsys->db->query("SELECT fieldid, name, description FROM " . TABLE_PREFIX . "bugfield"); - while ($field = $bugsys->db->fetch_array($descriptions)) + $descriptions = BSApp::$db->query("SELECT fieldid, name, description FROM " . TABLE_PREFIX . "bugfield"); + foreach ($descriptions as $field) { $help["field$field[fieldid]"] = array('title' => $field['name'], 'body' => $field['description']); } // standard help texts - $texts = $bugsys->db->query("SELECT * FROM " . TABLE_PREFIX . "fieldhelp"); - while ($field = $bugsys->db->fetch_array($texts)) + $texts = BSApp::$db->query("SELECT * FROM " . TABLE_PREFIX . "fieldhelp"); + foreach ($texts as $field) { $help["$field[keystring]"] = $field; } - $bugsys->db->query(" + BSApp::$db->query(" ### replacing user help cache ### REPLACE INTO " . TABLE_PREFIX . "datastore (title, data) - VALUES ('help', '" . $bugsys->escape(serialize($help)) . "')" + VALUES ('help', '" . BSApp::$input->escape(serialize($help)) . "')" ); - $bugsys->datastore['help'] = $help; + bugdar::$datastore['help'] = $help; } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/includes/functions_product.php b/includes/functions_product.php index a6a3196..5377859 100644 --- a/includes/functions_product.php +++ b/includes/functions_product.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -19,54 +19,51 @@ || ################################################################### \*=====================================================================*/ -// ################################################################### /** -* Constructs a massive HTML -*/ -function ConstructProductSelect($action = 'canviewbugs', $select = null, $obsolete = true) + * Constructs a massive HTML + */ +function construct_product_select($action = 'canviewbugs', $select = null, $obsolete = true) { - global $bugsys; - $output = ''; // index all of the components by parent and ID $components = array(); - if (is_array($bugsys->datastore['component'])) + if (is_array(bugdar::$datastore['component'])) { - foreach ($bugsys->datastore['component'] AS $id => $prod) + foreach (bugdar::$datastore['component'] as $id => $prod) { $components["$prod[parentid]"]["$id"] = $prod; } } // these are products - foreach ($bugsys->datastore['product'] AS $productid => $product) + foreach (bugdar::$datastore['product'] as $productid => $product) { - if (!can_perform($action, $product['productid']) OR !can_perform('canviewbugs', $product['productid'])) + if (!can_perform($action, $product['productid']) || !can_perform('canviewbugs', $product['productid'])) { continue; } - if ($versions = ConstructVersionSelect($productid, $select, $obsolete)) + if ($versions = construct_version_select($productid, $select, $obsolete)) { - $output .= ConstructOptionGroup($product['title'], $versions); + $output .= construct_option_group($product['title'], $versions); } // these are components if ($components["$productid"]) { - foreach ($components["$productid"] AS $componentid => $component) + foreach ($components["$productid"] as $componentid => $component) { - $output .= ConstructOptionGroup($product['title'] . '/' . $component['title'], ConstructVersionSelect($componentid, $select, $obsolete)); + $output .= construct_option_group($product['title'] . '/' . $component['title'], construct_version_select($componentid, $select, $obsolete)); } } } @@ -74,23 +71,20 @@ function ConstructProductSelect($action = 'canviewbugs', $select = null, $obsole return $output; } -// ################################################################### /** -* Constructs a string of HTML block from a label and a string of -* HTML -* @param string HTML bits -* -* @return string Composed HTML -*/ -function ConstructOptionGroup($glabel, $optbits) + * Constructs an block from a label and a string of + * HTML + * @param string HTML bits + * + * @return string Composed HTML + */ +function construct_option_group($glabel, $optbits) { - global $bugsys; - eval('$HTML = "' . $bugsys->template->fetch('selectoptgroup') . '";'); - return $HTML; + $tpl = new BSTemplate('selectoptgroup'); + $tpl->vars = array( + 'glabel' => $glabel, + 'optbits' => $optbits + ); + return $tpl->evaluate()->getTemplate(); } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/includes/init.php b/includes/init.php index 9704302..1b9263e 100755 --- a/includes/init.php +++ b/includes/init.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -22,20 +22,13 @@ error_reporting(E_ALL & ~E_NOTICE); // ################################################################### -// initialize the database +// load the framework define('ISSO_MT_START', microtime()); define('ISSO_CHECK_POST_REFERER', 1); require_once('./includes/version.php'); -require_once('./framework/kernel.php'); -$bugsys = new ISSO(); - -$bugsys->setAppPath(getcwd()); -$bugsys->setApplication('Bugdar'); -$bugsys->setAppVersion(BUGDAR_VERSION); - if (!file_exists('./includes/config.php')) { echo 'includes/config.php needs to be present!'; @@ -44,28 +37,28 @@ if (!file_exists('./includes/config.php')) require_once('./includes/config.php'); -$bugsys->setDebug($debug); - -// ========================= new framework system ======================== define('ISSO', getcwd() . '/includes/framework/'); require_once ISSO . '/App.php'; BSApp::set_debug($debug); -// ======================================================================= -define('ISSO_DB_LAYER', 'db_mysql'); -$bugsys->load('db_mysql', 'db', true); -$db->connect($servername, $username, $password, $database, $usepconnect); +require_once ISSO . '/Functions.php'; +BSFunctions::set_cookie_timeout(3600); + +require_once ISSO . '/Input.php'; +$input = BSApp::$input = new BSInput(); + +// ################################################################### +// initialize the database + +require_once ISSO . '/DbMySqlI.php'; +$db = BSApp::$db = new BSDBMySQLI(); + +$db->connect($servername, $username, $password, $database); if ($utf8) { $db->query("SET NAMES utf8"); } -$bugsys->load('functions', 'funct', true); -$bugsys->load('xml', 'xml', true); - -// change cookie expiration to one hour -$funct->cookieexp = 3600; - define('DEVDEBUG', $debug); define('TABLE_PREFIX', $tableprefix); define('COOKIE_PREFIX', $cookieprefix); @@ -78,9 +71,18 @@ require_once('./includes/language.php'); // ################################################################### // init the big three -$bugsys->options = array(); -$bugsys->userinfo = array(); -$bugsys->datastore = array(); + +class bugdar +{ + public static $options = array(); + public static $userinfo = array(); + public static $datastore = array(); + + public static $permissions = array(); + public static $emailOptions = array(); + + private function __construct() {} +} // ################################################################### // send nocache @@ -106,15 +108,13 @@ if (!$datastoretemp) $db->error('Invalid SQL error'); } -while ($store = $db->fetch_array($datastoretemp)) +foreach ($datastoretemp as $store) { - $bugsys->datastore["$store[title]"] = unserialize($store['data']); + bugdar::$datastore["$store[title]"] = unserialize($store['data']); } -$bugsys->options = $bugsys->datastore['setting']; -$bugsys->options['columnoptions'] = unserialize($bugsys->options['columnoptions']); -unset($bugsys->datastore['setting']); - -$bugsys->setAppVersion($bugsys->options['trackerversion']); +bugdar::$options = bugdar::$datastore['setting']; +bugdar::$options['columnoptions'] = unserialize(bugdar::$options['columnoptions']); +unset(bugdar::$datastore['setting']); // ################################################################### // load permissions @@ -124,22 +124,22 @@ require_once('./includes/permissions.php'); // ################################################################### // load userinfo -$authMethod = ((defined('USE_DEFAULT_AUTH_METHOD') AND constant('USE_DEFAULT_AUTH_METHOD') == 1) ? 'default' : $bugsys->options['authmethod']); +$authMethod = ((defined('USE_DEFAULT_AUTH_METHOD') AND constant('USE_DEFAULT_AUTH_METHOD') == 1) ? 'default' : bugdar::$options['authmethod']); require_once('./includes/auth/auth_' . $authMethod . '.php'); $authClass = 'Authentication' . str_replace(' ', '', ucwords(str_replace('_', ' ', $authMethod))); -$bugsys->auth = $auth = new $authClass(); +$auth = new $authClass(); if ($auth->authenticateCookies()) { - $bugsys->userinfo = $auth->fetchBugdarUser(); - $bugsys->userinfo['permissions'] = FetchUserPermissions($bugsys->userinfo); - $bugsys->userinfo['displaytitle'] = $bugsys->datastore['usergroup'][ $bugsys->userinfo['usergroupid'] ]['displaytitle']; - $bugsys->userinfo['columnoptions'] = unserialize($bugsys->userinfo['columnoptions']); + bugdar::$userinfo = $auth->fetchBugdarUser(); + bugdar::$userinfo['permissions'] = FetchUserPermissions(bugdar::$userinfo); + bugdar::$userinfo['displaytitle'] = bugdar::$datastore['usergroup'][ bugdar::$userinfo['usergroupid'] ]['displaytitle']; + bugdar::$userinfo['columnoptions'] = unserialize(bugdar::$userinfo['columnoptions']); } else { - $bugsys->userinfo = fetch_guest_user(); + bugdar::$userinfo = fetch_guest_user(); } // ################################################################### @@ -154,7 +154,7 @@ $stylevar['left'] = ($language['direction'] == 'ltr' ? 'left' : 'right'); $stylevar['right'] = ($language['direction'] == 'ltr' ? 'right' : 'left'); // start gettext engine -if (!$bugsys->options['devgettext']) +if (!bugdar::$options['devgettext']) { putenv("LANG=$language[langcode]"); putenv("LANGUAGE=$language[langcode]"); @@ -168,26 +168,14 @@ if (!$bugsys->options['devgettext']) } else { - $bugsys->debug("using custom MOReader instead of Gettext"); + BSApp::debug("using custom MOReader instead of Gettext"); } // ################################################################### // initialize the date system -$bugsys->load('date', 'datef', true); -$datef->usertz = $bugsys->userinfo['timezone'] + ($bugsys->userinfo['usedst'] * 1); -$bugsys->debug('user tz = ' . $bugsys->userinfo['timezone'] . '; use version = ' . $datef->usertz); -$datef->fetch_offset(); +require_once ISSO . '/Date.php'; +$datef = BSApp::$date = new BSDate(); +$datef->setUserTimeZone(bugdar::$userinfo['timezone'] + (bugdar::$userinfo['usedst'] * 1)); +BSApp::debug('user tz = ' . bugdar::$userinfo['timezone'] . '; use version = ' . $datef->usertz); -// ################################################################### -// mail system -$bugsys->load('mail', 'mail', true); -$mail->setFromAddress($bugsys->options['webmasteremail']); -$mail->setFromName(T('Bugdar Notification')); - -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/includes/language.php b/includes/language.php index e808ca9..dfaa1bc 100644 --- a/includes/language.php +++ b/includes/language.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -30,7 +30,7 @@ if (!function_exists('gettext')) function textdomain() {} function bind_textdomain_codeset() {} - $bugsys->debug('NOTICE: gettext not installed'); + BSApp::debug('NOTICE: gettext not installed'); } // ################################################################### @@ -42,22 +42,20 @@ define('L_INVALID_ID', T('That is an invalid ID.')); // determines the user's language function fetch_user_language() { - global $bugsys; - - if ($bugsys->userinfo['userid']) + if (bugdar::$userinfo['userid']) { - $languageid = $bugsys->userinfo['languageid']; - $language = $bugsys->datastore['language']["$languageid"]; + $languageid = bugdar::$userinfo['languageid']; + $language = bugdar::$datastore['language']["$languageid"]; } - if (!$languageid AND is_array($bugsys->datastore['language'])) + if (!$languageid AND is_array(bugdar::$datastore['language'])) { - foreach ($bugsys->datastore['language'] AS $language) + foreach (bugdar::$datastore['language'] AS $language) { - if ($bugsys->options['defaultlanguage'] == $language['languageid']) + if (bugdar::$options['defaultlanguage'] == $language['languageid']) { $languageid = $language['languageid']; - $language = $bugsys->datastore['language']["$languageid"]; + $language = bugdar::$datastore['language']["$languageid"]; break; } } @@ -83,10 +81,9 @@ function fetch_user_language() */ function T($str) { - global $bugsys; static $mo; - if (!$bugsys->options['devgettext']) + if (!bugdar::$options['devgettext']) { return _($str); } @@ -97,7 +94,7 @@ function T($str) $info = fetch_user_language(); if ($info['langcode'] == null) { - $bugsys->debug("cannot translate '$str'"); + BSApp::debug("cannot translate '$str'"); return $str; } $mo = new MOReader("locale/$info[langcode]/LC_MESSAGES/messages.mo"); @@ -106,10 +103,4 @@ function T($str) return $mo->T($str); } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/includes/pagination.php b/includes/pagination.php new file mode 100644 index 0000000..2984e8c --- /dev/null +++ b/includes/pagination.php @@ -0,0 +1,84 @@ +page = BSApp::$input->inputClean('p', TYPE_UINT); + $this->defaultperpage = bugdar::$options['defaultpp']; + $this->perpage = BSApp::$input->inputClean('pp', TYPE_UINT); + $this->pagelinks = bugdar::$options['pagelinks']; + $this->maxperpage = bugdar::$options['maxpp']; + } + + /** + * Processes an individual page link + */ + protected function _bitProcessor($baselink, $isCurrent, $pagenumber) + { + $template = new BSTemplate('pagenav_bit'); + $template->vars = array( + 'baselink' => $baselink, + 'nolink' => $isCurrent, + 'number' => $pagenumber, + 'paginator' => $this + ); + return $template->evaluate()->getTemplate(); + } + + /** + * Generates the entire page navigation HTML + */ + protected function _navigationProcessor($baselink, $next, $prev, $show2, $bits) + { + global $show; + + $show = array_merge($show, $show2); + + $template = new BSTemplate('pagenav'); + $template->vars = array( + 'baselink' => $baselink, + 'nextpage' => $next, + 'prevpage' => $prev, + 'pagebits' => $bits, + 'paginator' => $this + ); + return $template->evaluate()->getTemplate(); + } +} + +?> \ No newline at end of file diff --git a/includes/permissions.php b/includes/permissions.php index 1dda260..4298920 100644 --- a/includes/permissions.php +++ b/includes/permissions.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -19,7 +19,7 @@ || ################################################################### \*=====================================================================*/ -$bugsys->permissions = array( +bugdar::$permissions = array( 'canviewbugs' => 1, // can view bugs 'cansearch' => 2, // can use the search 'cansubscribe' => 4, // can email subscribe @@ -48,7 +48,7 @@ $bugsys->permissions = array( 'canviewownhidden' => 33554432 // can view own hidden bugs ); -$bugsys->emailoptions = array( +bugdar::$emailOptions = array( 'relations' => array( // a user's relation to the bug '-notapplicable-' => 0, // not applicable @@ -71,10 +71,4 @@ $bugsys->emailoptions = array( ) ); -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/includes/version.php b/includes/version.php index 2a9eef6..b992647 100644 --- a/includes/version.php +++ b/includes/version.php @@ -2,7 +2,7 @@ /*=====================================================================* || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -24,10 +24,4 @@ if (!defined('BUGDAR_VERSION')) define('BUGDAR_VERSION', '1.2.1'); } -/*=====================================================================* -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/index.php b/index.php index 9181c6c..c34b673 100644 --- a/index.php +++ b/index.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -27,7 +27,6 @@ $fetchtemplates = array( 'pagenav_bit' ); -define('SVN', '$Id$'); $focus['index'] = 'focus'; @@ -40,16 +39,19 @@ if (!can_perform('canviewbugs')) } $sort = new ListSorter('index'); -LoadPaginationFramework(); + +require_once 'includes/pagination.php'; +$pagination = new Pagination(); +$pagination->processIncomingData(); // ################################################################### -$count = $db->query_first(" +$count = $db->queryFirst(" SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "bug - WHERE (!hidden OR (hidden AND product IN (" . fetch_on_bits('canviewhidden') . "))" . (can_perform('canviewownhidden') ? " OR (hidden AND userid = " . $bugsys->userinfo['userid'] . " AND product IN (" . fetch_on_bits('canviewownhidden') . "))" : "") . ") - AND product IN (" . fetch_on_bits('canviewbugs') . ")" . (($bugsys->options['hidestatuses'] OR isset($bugsys->userinfo['hidestatuses'])) ? " - AND status NOT IN (" . ($bugsys->userinfo['hidestatuses'] != '' ? $bugsys->userinfo['hidestatuses'] : $bugsys->options['hidestatuses']) . ")" : "") + WHERE (!hidden OR (hidden AND product IN (" . fetch_on_bits('canviewhidden') . "))" . (can_perform('canviewownhidden') ? " OR (hidden AND userid = " . bugdar::$userinfo['userid'] . " AND product IN (" . fetch_on_bits('canviewownhidden') . "))" : "") . ") + AND product IN (" . fetch_on_bits('canviewbugs') . ")" . ((bugdar::$options['hidestatuses'] OR isset(bugdar::$userinfo['hidestatuses'])) ? " + AND status NOT IN (" . (bugdar::$userinfo['hidestatuses'] != '' ? bugdar::$userinfo['hidestatuses'] : bugdar::$options['hidestatuses']) . ")" : "") ); if (!$count['count']) @@ -60,27 +62,26 @@ if (!$count['count']) $pagination->setTotal($count['count']); $pagination->splitPages(); -$bugs_fetch = $db->query($sort->fetch_sql_query(null, $pagination->fetchLimit($pagination->getPage() - 1) . ", " . $pagination->getPerPage())); +$bugs_fetch = $db->query($sort->fetchSqlQuery(null, $pagination->fetchLimit($pagination->getPage() - 1) . ", " . $pagination->getPerPage())); -while ($bug = $db->fetch_array($bugs_fetch)) +foreach ($bugs_fetch as $bug) { - $funct->exec_swap_bg('altcolor', ''); - $bug = ProcessBugDataForDisplay($bug, $funct->bgcolour); + BSFunctions::swap_css_classes('altcolor', ''); + $bug = ProcessBugDataForDisplay($bug, BSFunctions::$cssClass); $bugs .= $sort->constructRow($bug); } -$db->free_result($bugs_fetch); +$bugs_fetch->free(); $columnHeads = $sort->constructColumnHeaders(true, 'p=' . $pagination->page . '&pp=' . $pagination->perpage); $show['pagenav'] = ($pagination->getPageCount() > 1); -$pagenav = $pagination->constructPageNav($sort->fetch_sort_link($sort->sortkey)); -eval('$template->flush("' . $template->fetch('trackerhome') . '");'); +$tpl = new BSTemplate('trackerhome'); +$tpl->vars = array( + 'columnHeads' => $columnHeads, + 'bugs' => $bugs, + 'pagenav' => $pagination->constructPageNav($sort->fetchSortLink($sort->sortkey)) +); +$tpl->evaluate()->flush(); -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/install/convert_database_charset.php b/install/convert_database_charset.php index def3532..1765e98 100644 --- a/install/convert_database_charset.php +++ b/install/convert_database_charset.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -19,7 +19,6 @@ || ################################################################### \*=====================================================================*/ -define('SVN', '$Id$'); chdir('../admin/'); require_once('./global.php'); @@ -29,7 +28,7 @@ define('ISSO_PRINTER_NO_NAVIGATION', 1); // you can change what you want to conver to here define('TARGET', 'utf8_general_ci'); -$bugsys->input_clean('step', TYPE_UINT); +$input->inputClean('step', TYPE_UINT); // columns to convert per table $columnConversions = array(); @@ -56,9 +55,9 @@ $admin->page_start('Convert Database Character Set'); // ################################################################### -if ($bugsys->in['step'] == 0) +if ($input->in['step'] == 0) { - $collation = $db->query_first("SHOW VARIABLES LIKE 'collation_database'"); + $collation = $db->queryFirst("SHOW VARIABLES LIKE 'collation_database'"); echo '

Convert Database Character Set

'; echo '

Earlier versions of Bugdar did not check or enforce the MySQL database character set or collation. It is recommended that the database be set at ' . TARGET . '. This script can migrate all of data from your current character set/collation of ' . $collation['Value'] . '. If you would like to convert your database to utf8, please click the link below.

'; @@ -70,7 +69,7 @@ if ($bugsys->in['step'] == 0) // ################################################################### -else if ($bugsys->in['step'] == 1) +else if ($input->in['step'] == 1) { echo '

Preserve Existing Data

'; echo '

This converts all the table columns that are stored with a character set to a BLOB type to ensure there are no problems with the target character set.

'; @@ -91,7 +90,7 @@ else if ($bugsys->in['step'] == 1) while ($table = $db->fetch_array($tables, false)) { $columns = $db->query("SHOW FULL COLUMNS FROM $table[0]"); - while ($col = $db->fetch_array($columns)) + foreach ($columns as $col) { if (!is_null($col['Collation']) AND (strpos($col['Type'], 'char') !== false OR strpos($col['Type'], 'text') !== false)) { @@ -163,7 +162,7 @@ else if ($bugsys->in['step'] == 1) // ################################################################### -else if ($bugsys->in['step'] == 2) +else if ($input->in['step'] == 2) { echo '

Conversion Complete

'; echo '

Your database has now been converted to the ' . TARGET . ' collation. Congratulations. Please check that everything is operating correctly.

'; @@ -173,10 +172,4 @@ else if ($bugsys->in['step'] == 2) $admin->page_end(); -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/install/default_data.php b/install/default_data.php index 2fdcab7..7dbf7d4 100644 --- a/install/default_data.php +++ b/install/default_data.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -257,10 +257,4 @@ The "Automation" drop-down next to this box (which may be hidden) will ) ); -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/install/global.php b/install/global.php index c0f2950..1c833d0 100644 --- a/install/global.php +++ b/install/global.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -73,9 +73,9 @@ require_once('./includes/permissions.php'); // ################################################################### // init the big three -$bugsys->options = array(); -$bugsys->userinfo = array(); -$bugsys->datastore = array(); +bugdar::$options = array(); +bugdar::$userinfo = array(); +bugdar::$datastore = array(); // ################################################################### @@ -104,9 +104,9 @@ $bugsys->versions = array( $bugsys->load('installer', null); -$bugsys->input_clean('mark', TYPE_UINT); +$input->inputClean('mark', TYPE_UINT); -if ($bugsys->in['mark'] == STOP_MARK) +if ($input->in['mark'] == STOP_MARK) { if (!preg_match('#^upgrade([0-9]*)\.php$#i', ACTIVE_SITE, $matches)) { @@ -126,10 +126,4 @@ if ($bugsys->in['mark'] == STOP_MARK) } } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/install/install.css b/install/install.css index df7ec28..22270d2 100644 --- a/install/install.css +++ b/install/install.css @@ -1,7 +1,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by diff --git a/install/install.php b/install/install.php index b7c5b6d..6111ba7 100644 --- a/install/install.php +++ b/install/install.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -31,7 +31,7 @@ page_start(); // ################################################################### -if ($bugsys->in['mark'] == 0) +if ($input->in['mark'] == 0) { ?>

Welcome to Bugdar

@@ -46,7 +46,7 @@ if ($bugsys->in['mark'] == 0) // ################################################################### -if ($bugsys->in['mark'] == 1) +if ($input->in['mark'] == 1) { ?>

Installation Check

@@ -115,7 +115,7 @@ if ($bugsys->in['mark'] == 1) // ################################################################### -if ($bugsys->in['mark'] == 2) +if ($input->in['mark'] == 2) { ?>

Initializing Database

@@ -138,7 +138,7 @@ if ($bugsys->in['mark'] == 2) // ################################################################### -if ($bugsys->in['mark'] == 3) +if ($input->in['mark'] == 3) { ?>

Loading Default Data

@@ -172,7 +172,7 @@ if ($bugsys->in['mark'] == 3) // ################################################################### -if ($bugsys->in['mark'] == 4) +if ($input->in['mark'] == 4) { ?>

Loading Settings

@@ -194,7 +194,7 @@ if ($bugsys->in['mark'] == 4) // ################################################################### -if ($bugsys->in['mark'] == 5) +if ($input->in['mark'] == 5) { ?>

Cache Data

@@ -240,7 +240,7 @@ if ($bugsys->in['mark'] == 5) // ################################################################### -if ($bugsys->in['mark'] == 6) +if ($input->in['mark'] == 6) { $value = 'http' . ($_SERVER['HTTPS'] == 'on' ? 's' : '') . '://' . $_SERVER['SERVER_NAME'] . ($_SERVER['SERVER_PORT'] != '80' ? ':' . $_SERVER['SERVER_PORT'] : '') . str_replace('/install/install.php', '', $_SERVER['SCRIPT_NAME']); ?> @@ -266,7 +266,7 @@ if ($bugsys->in['mark'] == 6) // ################################################################### -if ($bugsys->in['mark'] == 7) +if ($input->in['mark'] == 7) { ?>

New Administrator

@@ -296,7 +296,7 @@ if ($bugsys->in['mark'] == 7) // ################################################################### -if ($bugsys->in['mark'] == 8) +if ($input->in['mark'] == 8) { ?>

User Added

@@ -310,10 +310,10 @@ if ($bugsys->in['mark'] == 8) // the installer, so we need to do it manually build_usergroups(); - $user = new UserAPI($bugsys); - $user->set('email', $bugsys->in['email']); - $user->set('displayname', $bugsys->in['displayname']); - $user->set('password', $bugsys->in['password']); + $user = new UserAPI(); + $user->set('email', $input->in['email']); + $user->set('displayname', $input->in['displayname']); + $user->set('password', $input->in['password']); $user->set('showcolors', 1); $user->set('usergroupid', 6, true, false); // don't verify because we haven't cached usergroups yet $user->insert(); @@ -323,10 +323,4 @@ if ($bugsys->in['mark'] == 8) page_end(); -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/install/schema.php b/install/schema.php index 10a3401..502c431 100644 --- a/install/schema.php +++ b/install/schema.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -350,10 +350,4 @@ CREATE TABLE " . TABLE_PREFIX . "vote PRIMARY KEY (bugid) );"; -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/install/settings.php b/install/settings.php index 3c9b452..32b8866 100644 --- a/install/settings.php +++ b/install/settings.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -56,10 +56,4 @@ $settings = array( 'redirectheaders' => '0', ); -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/install/upgrade.php b/install/upgrade.php index 6dca12e..9b5795b 100644 --- a/install/upgrade.php +++ b/install/upgrade.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -23,11 +23,11 @@ require_once('./global.php'); // ################################################################### -if (!isset($bugsys->in['next'])) +if (!isset($input->in['next'])) { $db->showerrors = false; - $version = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "setting WHERE varname = 'trackerversion'"); + $version = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "setting WHERE varname = 'trackerversion'"); $version = $version['value']; if ($version == '[#]version[#]') @@ -63,18 +63,12 @@ if (!isset($bugsys->in['next'])) else { - if ($bugsys->versions[ $bugsys->in['next'] ] == -1) + if ($bugsys->versions[ $input->in['next'] ] == -1) { die('Bugdar is up-to-date already'); } - header("Location: upgrade" . $bugsys->versions[ $bugsys->in['next'] ] . ".php"); + header("Location: upgrade" . $bugsys->versions[ $input->in['next'] ] . ".php"); } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/install/upgrade1.php b/install/upgrade1.php index 0d335af..cbe8129 100644 --- a/install/upgrade1.php +++ b/install/upgrade1.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -28,7 +28,7 @@ page_start(); // ################################################################### -if ($bugsys->in['mark'] == 0) +if ($input->in['mark'] == 0) { ?>

Welcome to Bugdar

@@ -43,7 +43,7 @@ if ($bugsys->in['mark'] == 0) // ################################################################### -if ($bugsys->in['mark'] == 1) +if ($input->in['mark'] == 1) { ?>

Version Number Change

@@ -67,10 +67,4 @@ if ($bugsys->in['mark'] == 1) page_end(); -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/install/upgrade10.php b/install/upgrade10.php index a571d9f..b26d828 100644 --- a/install/upgrade10.php +++ b/install/upgrade10.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -29,7 +29,7 @@ page_start(); // ################################################################### -if ($bugsys->in['mark'] == 0) +if ($input->in['mark'] == 0) { ?>

Welcome to Bugdar

@@ -42,7 +42,7 @@ if ($bugsys->in['mark'] == 0) // ################################################################### -if ($bugsys->in['mark'] == 1) +if ($input->in['mark'] == 1) { ?>

Version Number Change

@@ -66,10 +66,4 @@ if ($bugsys->in['mark'] == 1) page_end(); -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/install/upgrade11.php b/install/upgrade11.php index a8575f5..47e09d7 100644 --- a/install/upgrade11.php +++ b/install/upgrade11.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -29,7 +29,7 @@ page_start(); // ################################################################### -if ($bugsys->in['mark'] == 0) +if ($input->in['mark'] == 0) { ?>

Welcome to Bugdar

@@ -42,7 +42,7 @@ if ($bugsys->in['mark'] == 0) // ################################################################### -if ($bugsys->in['mark'] == 1) +if ($input->in['mark'] == 1) { ?>

Minor Database Table Changes

@@ -70,7 +70,7 @@ if ($bugsys->in['mark'] == 1) // ################################################################### -if ($bugsys->in['mark'] == 2) +if ($input->in['mark'] == 2) { ?>

Search Table Changes

@@ -95,7 +95,7 @@ if ($bugsys->in['mark'] == 2) // ################################################################### -if ($bugsys->in['mark'] == 3) +if ($input->in['mark'] == 3) { ?>

Custom Field Updates

@@ -104,7 +104,7 @@ if ($bugsys->in['mark'] == 3) query("SELECT * FROM " . TABLE_PREFIX . "bugfield"); - while ($field = $db->fetch_array($fields)) + foreach ($fields as $field) { // create the database field $db->query("ALTER TABLE " . TABLE_PREFIX . "bug ADD custom$field[fieldid] MEDIUMTEXT NULL"); @@ -113,7 +113,7 @@ if ($bugsys->in['mark'] == 3) // update all the data $data = $db->query("SELECT * FROM " . TABLE_PREFIX . "bugvaluefill"); - while ($custom = $db->fetch_array($data)) + foreach ($data as $custom) { echo "."; $db->query("UPDATE " . TABLE_PREFIX . "bug SET custom$field[fieldid] = '" . $db->escape_string($custom["field$field[fieldid]"]) . "' WHERE bugid = $custom[bugid]"); @@ -126,7 +126,7 @@ if ($bugsys->in['mark'] == 3) // ################################################################### -if ($bugsys->in['mark'] == 4) +if ($input->in['mark'] == 4) { ?>

Database Table Changes

@@ -175,7 +175,7 @@ if ($bugsys->in['mark'] == 4) // ################################################################### -if ($bugsys->in['mark'] == 5) +if ($input->in['mark'] == 5) { ?>

Version Number Change

@@ -203,10 +203,4 @@ if ($bugsys->in['mark'] == 5) page_end(); -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/install/upgrade12.php b/install/upgrade12.php index a5a19f0..a28774d 100644 --- a/install/upgrade12.php +++ b/install/upgrade12.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -29,7 +29,7 @@ page_start(); // ################################################################### -if ($bugsys->in['mark'] == 0) +if ($input->in['mark'] == 0) { ?>

Welcome to Bugdar

@@ -42,7 +42,7 @@ if ($bugsys->in['mark'] == 0) // ################################################################### -if ($bugsys->in['mark'] == 1) +if ($input->in['mark'] == 1) { ?>

Schema Updates

@@ -55,7 +55,7 @@ if ($bugsys->in['mark'] == 1) // ################################################################### -if ($bugsys->in['mark'] == 2) +if ($input->in['mark'] == 2) { ?>

Version Number Change

@@ -79,10 +79,4 @@ if ($bugsys->in['mark'] == 2) page_end(); -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/install/upgrade13.php b/install/upgrade13.php index 8815b37..74ee509 100644 --- a/install/upgrade13.php +++ b/install/upgrade13.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -29,7 +29,7 @@ page_start(); // ################################################################### -if ($bugsys->in['mark'] == 0) +if ($input->in['mark'] == 0) { ?>

Welcome to Bugdar

@@ -42,7 +42,7 @@ if ($bugsys->in['mark'] == 0) // ################################################################### -if ($bugsys->in['mark'] == 1) +if ($input->in['mark'] == 1) { ?>

Potential Schema Updates

@@ -77,7 +77,7 @@ if ($bugsys->in['mark'] == 1) // ################################################################### -if ($bugsys->in['mark'] == 2) +if ($input->in['mark'] == 2) { ?>

Version Number Change

@@ -101,10 +101,4 @@ if ($bugsys->in['mark'] == 2) page_end(); -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/install/upgrade14.php b/install/upgrade14.php index 1644e66..718d95f 100644 --- a/install/upgrade14.php +++ b/install/upgrade14.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -29,7 +29,7 @@ page_start(); // ################################################################### -if ($bugsys->in['mark'] == 0) +if ($input->in['mark'] == 0) { ?>

Welcome to Bugdar

@@ -42,7 +42,7 @@ if ($bugsys->in['mark'] == 0) // ################################################################### -if ($bugsys->in['mark'] == 1) +if ($input->in['mark'] == 1) { ?>

Version Number Change

@@ -66,10 +66,4 @@ if ($bugsys->in['mark'] == 1) page_end(); -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/install/upgrade15.php b/install/upgrade15.php index b8e38fc..0a14695 100644 --- a/install/upgrade15.php +++ b/install/upgrade15.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -29,7 +29,7 @@ page_start(); // ################################################################### -if ($bugsys->in['mark'] == 0) +if ($input->in['mark'] == 0) { ?>

Welcome to Bugdar

@@ -42,7 +42,7 @@ if ($bugsys->in['mark'] == 0) // ################################################################### -if ($bugsys->in['mark'] == 1) +if ($input->in['mark'] == 1) { ?>

Version Number Change

@@ -66,10 +66,4 @@ if ($bugsys->in['mark'] == 1) page_end(); -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/install/upgrade16.php b/install/upgrade16.php index 010e105..2fbb302 100644 --- a/install/upgrade16.php +++ b/install/upgrade16.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -29,7 +29,7 @@ page_start(); // ################################################################### -if ($bugsys->in['mark'] == 0) +if ($input->in['mark'] == 0) { ?>

Welcome to Bugdar

@@ -42,7 +42,7 @@ if ($bugsys->in['mark'] == 0) // ################################################################### -if ($bugsys->in['mark'] == 1) +if ($input->in['mark'] == 1) { ?>

Version Number Change

@@ -66,10 +66,4 @@ if ($bugsys->in['mark'] == 1) page_end(); -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/install/upgrade17.php b/install/upgrade17.php index 76a8c4f..7a31758 100644 --- a/install/upgrade17.php +++ b/install/upgrade17.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -29,7 +29,7 @@ page_start(); // ################################################################### -if ($bugsys->in['mark'] == 0) +if ($input->in['mark'] == 0) { ?>

Welcome to Bugdar

@@ -42,7 +42,7 @@ if ($bugsys->in['mark'] == 0) // ################################################################### -if ($bugsys->in['mark'] == 1) +if ($input->in['mark'] == 1) { ?>

Version Number Change

@@ -66,10 +66,4 @@ if ($bugsys->in['mark'] == 1) page_end(); -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/install/upgrade2.php b/install/upgrade2.php index 9b04826..056ec1a 100644 --- a/install/upgrade2.php +++ b/install/upgrade2.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -28,7 +28,7 @@ page_start(); // ################################################################### -if ($bugsys->in['mark'] == 0) +if ($input->in['mark'] == 0) { ?>

Welcome to Bugdar

@@ -43,7 +43,7 @@ if ($bugsys->in['mark'] == 0) // ################################################################### -if ($bugsys->in['mark'] == 1) +if ($input->in['mark'] == 1) { ?>

Major Table Changes

@@ -69,7 +69,7 @@ if ($bugsys->in['mark'] == 1) // ################################################################### -if ($bugsys->in['mark'] == 2) +if ($input->in['mark'] == 2) { ?>

User Table Changes

@@ -93,7 +93,7 @@ if ($bugsys->in['mark'] == 2) // ################################################################### -if ($bugsys->in['mark'] == 3) +if ($input->in['mark'] == 3) { ?>

Minor Table Changes

@@ -124,7 +124,7 @@ if ($bugsys->in['mark'] == 3) // ################################################################### -if ($bugsys->in['mark'] == 4) +if ($input->in['mark'] == 4) { ?>

Caching User Data in Bug Table

@@ -142,13 +142,13 @@ if ($bugsys->in['mark'] == 4) $userlist = array(); $users = $db->query("SELECT userid, displayname FROM " . TABLE_PREFIX . "user"); - while ($user = $db->fetch_array($users)) + foreach ($users as $user) { $userlist["$user[userid]"] = $user['displayname']; } $bugs = $db->query("SELECT * FROM " . TABLE_PREFIX . "bug"); - while ($bug = $db->fetch_array($bugs)) + foreach ($bugs as $bug) { $db->query(" UPDATE " . TABLE_PREFIX . "bug @@ -165,7 +165,7 @@ if ($bugsys->in['mark'] == 4) // ################################################################### -if ($bugsys->in['mark'] == 5) +if ($input->in['mark'] == 5) { ?>

Updating Old History Items

@@ -176,7 +176,7 @@ if ($bugsys->in['mark'] == 5) echo "Updating historical records"; $history = $db->query("SELECT * FROM " . TABLE_PREFIX . "history"); - while ($log = $db->fetch_array($history)) + foreach ($history as $log) { $matches = array(); if (preg_match('#custom_field([0-9]+?)#i', $log['field'], $matches)) @@ -214,7 +214,7 @@ if ($bugsys->in['mark'] == 5) // ################################################################### -if ($bugsys->in['mark'] == 6) +if ($input->in['mark'] == 6) { ?>

Adding User Email Options

@@ -225,7 +225,7 @@ if ($bugsys->in['mark'] == 6) echo "Setting email options"; $users = $db->query("SELECT userid FROM " . TABLE_PREFIX . "user"); - while ($user = $db->fetch_array($users)) + foreach ($users as $user) { $db->query(" INSERT INTO " . TABLE_PREFIX . "useremail @@ -247,7 +247,7 @@ if ($bugsys->in['mark'] == 6) // ################################################################### -if ($bugsys->in['mark'] == 7) +if ($input->in['mark'] == 7) { ?>

Version Number Change

@@ -278,10 +278,4 @@ if ($bugsys->in['mark'] == 7) page_end(); -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/install/upgrade3.php b/install/upgrade3.php index 4f9cd4c..af3b7a5 100644 --- a/install/upgrade3.php +++ b/install/upgrade3.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -28,7 +28,7 @@ page_start(); // ################################################################### -if ($bugsys->in['mark'] == 0) +if ($input->in['mark'] == 0) { ?>

Welcome to Bugdar

@@ -43,7 +43,7 @@ if ($bugsys->in['mark'] == 0) // ################################################################### -if ($bugsys->in['mark'] == 1) +if ($input->in['mark'] == 1) { ?>

Language System Updates

@@ -74,7 +74,7 @@ if ($bugsys->in['mark'] == 1) // ################################################################### -if ($bugsys->in['mark'] == 2) +if ($input->in['mark'] == 2) { ?>

English US Changes

@@ -93,7 +93,7 @@ if ($bugsys->in['mark'] == 2) // ################################################################### -if ($bugsys->in['mark'] == 3) +if ($input->in['mark'] == 3) { ?>

Adding New Permission Mask

@@ -108,7 +108,7 @@ if ($bugsys->in['mark'] == 3) // ################################################################### -if ($bugsys->in['mark'] == 4) +if ($input->in['mark'] == 4) { ?>

Version Number Change

@@ -132,10 +132,4 @@ if ($bugsys->in['mark'] == 4) page_end(); -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/install/upgrade4.php b/install/upgrade4.php index 8384670..b68fc2d 100644 --- a/install/upgrade4.php +++ b/install/upgrade4.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -28,7 +28,7 @@ page_start(); // ################################################################### -if ($bugsys->in['mark'] == 0) +if ($input->in['mark'] == 0) { ?>

Welcome to Bugdar

@@ -43,7 +43,7 @@ if ($bugsys->in['mark'] == 0) // ################################################################### -if ($bugsys->in['mark'] == 1) +if ($input->in['mark'] == 1) { ?>

Version Number Change

@@ -67,10 +67,4 @@ if ($bugsys->in['mark'] == 1) page_end(); -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/install/upgrade5.php b/install/upgrade5.php index 4b7be8e..3f85d8d 100644 --- a/install/upgrade5.php +++ b/install/upgrade5.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -29,7 +29,7 @@ page_start(); // ################################################################### -if ($bugsys->in['mark'] == 0) +if ($input->in['mark'] == 0) { ?>

Welcome to Bugdar

@@ -44,7 +44,7 @@ if ($bugsys->in['mark'] == 0) // ################################################################### -if ($bugsys->in['mark'] == 1) +if ($input->in['mark'] == 1) { ?>

Rename Automatic Actions

@@ -61,7 +61,7 @@ if ($bugsys->in['mark'] == 1) build_automations(); echo "Rebuilding the automations cahce
\n"; - $topic = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "fieldhelp WHERE keystring = 'newreply'"); + $topic = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "fieldhelp WHERE keystring = 'newreply'"); if (md5($topic['body']) == '7e1154340454ca6d8f8ba47aab057c23') { $topic = $db->query("UPDATE " . TABLE_PREFIX . "fieldhelp SET body = 'Here you can specify additional comments. If you do not change any fields, this will merely attach a comment. @@ -77,7 +77,7 @@ The \"Automation\" drop-down next to this box (which may be hidden) will allow y // ################################################################### -if ($bugsys->in['mark'] == 2) +if ($input->in['mark'] == 2) { ?>

Version Number Change

@@ -101,10 +101,4 @@ if ($bugsys->in['mark'] == 2) page_end(); -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/install/upgrade6.php b/install/upgrade6.php index 2e34f45..51c04cd 100644 --- a/install/upgrade6.php +++ b/install/upgrade6.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -29,7 +29,7 @@ page_start(); // ################################################################### -if ($bugsys->in['mark'] == 0) +if ($input->in['mark'] == 0) { ?>

Welcome to Bugdar

@@ -44,7 +44,7 @@ if ($bugsys->in['mark'] == 0) // ################################################################### -if ($bugsys->in['mark'] == 1) +if ($input->in['mark'] == 1) { ?>

Version Number Change

@@ -68,10 +68,4 @@ if ($bugsys->in['mark'] == 1) page_end(); -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/install/upgrade7.php b/install/upgrade7.php index 07c0afd..904d959 100644 --- a/install/upgrade7.php +++ b/install/upgrade7.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -29,7 +29,7 @@ page_start(); // ################################################################### -if ($bugsys->in['mark'] == 0) +if ($input->in['mark'] == 0) { ?>

Welcome to Bugdar

@@ -44,7 +44,7 @@ if ($bugsys->in['mark'] == 0) // ################################################################### -if ($bugsys->in['mark'] == 1) +if ($input->in['mark'] == 1) { ?>

Version Number Change

@@ -68,10 +68,4 @@ if ($bugsys->in['mark'] == 1) page_end(); -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/install/upgrade8.php b/install/upgrade8.php index fea0985..7c1a09e 100644 --- a/install/upgrade8.php +++ b/install/upgrade8.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -29,7 +29,7 @@ page_start(); // ################################################################### -if ($bugsys->in['mark'] == 0) +if ($input->in['mark'] == 0) { ?>

Welcome to Bugdar

@@ -44,7 +44,7 @@ if ($bugsys->in['mark'] == 0) // ################################################################### -if ($bugsys->in['mark'] == 1) +if ($input->in['mark'] == 1) { ?>

Version Number Change

@@ -68,10 +68,4 @@ if ($bugsys->in['mark'] == 1) page_end(); -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/install/upgrade9.php b/install/upgrade9.php index 062edaf..1276db5 100644 --- a/install/upgrade9.php +++ b/install/upgrade9.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -29,7 +29,7 @@ page_start(); // ################################################################### -if ($bugsys->in['mark'] == 0) +if ($input->in['mark'] == 0) { ?>

Welcome to Bugdar

@@ -42,7 +42,7 @@ if ($bugsys->in['mark'] == 0) // ################################################################### -if ($bugsys->in['mark'] == 1) +if ($input->in['mark'] == 1) { ?>

Schema Changes

@@ -57,7 +57,7 @@ if ($bugsys->in['mark'] == 1) // ################################################################### -if ($bugsys->in['mark'] == 2) +if ($input->in['mark'] == 2) { ?>

Version Number Change

@@ -81,10 +81,4 @@ if ($bugsys->in['mark'] == 2) page_end(); -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/locale/en_US/emails/accountapproved.xml.tpl b/locale/en_US/emails/accountapproved.xml.tpl index d60908c..fd81c9b 100644 --- a/locale/en_US/emails/accountapproved.xml.tpl +++ b/locale/en_US/emails/accountapproved.xml.tpl @@ -1,8 +1,8 @@ - Account Approved at {$bugsys->options['trackertitle']} + Account Approved at {bugdar::$options['trackertitle']} Hi $user[displayname], -Your account was awaiting moderation at {$bugsys->options['trackertitle']}. Today, an administrator approved your registration and you are now able to use the bug tracker fully. +Your account was awaiting moderation at {bugdar::$options['trackertitle']}. Today, an administrator approved your registration and you are now able to use the bug tracker fully. If you have any questions, please don't hesitate to contact the webmaster. \ No newline at end of file diff --git a/locale/en_US/emails/activateaccount.xml.tpl b/locale/en_US/emails/activateaccount.xml.tpl index e1f2673..f542d29 100644 --- a/locale/en_US/emails/activateaccount.xml.tpl +++ b/locale/en_US/emails/activateaccount.xml.tpl @@ -1,8 +1,8 @@ - Welcome to {$bugsys->options['trackertitle']} - Hi {$bugsys->in['displayname']}, + Welcome to {bugdar::$options['trackertitle']} + Hi {$input->in['displayname']}, -Welcome to the {$bugsys->options['trackertitle']} tracker. Before you can begin posting bug reports, you'll need to activate your account. To do this, please click this link: +Welcome to the {bugdar::$options['trackertitle']} tracker. Before you can begin posting bug reports, you'll need to activate your account. To do this, please click this link: -{$bugsys->options['trackerurl']}/register.php?do=activate&userid=$userid&activator=$activationid +{bugdar::$options['trackerurl']}/register.php?do=activate&userid=$userid&activator=$activationid \ No newline at end of file diff --git a/locale/en_US/emails/bugnotification.xml.tpl b/locale/en_US/emails/bugnotification.xml.tpl index e301974..9b6651f 100644 --- a/locale/en_US/emails/bugnotification.xml.tpl +++ b/locale/en_US/emails/bugnotification.xml.tpl @@ -1,10 +1,10 @@ - {$this->registry->options['trackertitle']} Bug Notification - {$this->bug['summary']} + {bugdar::$options['trackertitle']} Bug Notification - {$this->bug['summary']} Hi {$this->users[$userid]['displayname']}, -You are receiving this email because you have opted to get notifications for the {$this->registry->options['trackertitle']} bug tracker. +You are receiving this email because you have opted to get notifications for the {bugdar::$options['trackertitle']} bug tracker. -The bug is "{$this->bug['summary']}" (id: {$this->bug['bugid']}) located at {$this->registry->options['trackerurl']}/showreport.php?bugid={$this->bug['bugid']} +The bug is "{$this->bug['summary']}" (id: {$this->bug['bugid']}) located at {bugdar::$options['trackerurl']}/showreport.php?bugid={$this->bug['bugid']} Here are the notices: ################################################################### @@ -14,5 +14,5 @@ $parts ################################################################### If you no longer want to receive email from us, please log into your account and click the "My Controls" tab at the top of the screen to change email preferences. -{$this->registry->options['trackerurl']} +{bugdar::$options['trackerurl']} \ No newline at end of file diff --git a/locale/en_US/emails/notice_attachment.part.tpl b/locale/en_US/emails/notice_attachment.part.tpl index 53fee41..3dfd93a 100644 --- a/locale/en_US/emails/notice_attachment.part.tpl +++ b/locale/en_US/emails/notice_attachment.part.tpl @@ -4,5 +4,5 @@ File name: $attachment[filename] Description: $attachment[description] File size: $attachment[filesize] Bytes Makes obsolete: $obsoletes -View: {$this->registry->options['trackerurl']}/viewattachment.php?attachmentid=$id +View: {bugdar::$options['trackerurl']}/viewattachment.php?attachmentid=$id ============================================ \ No newline at end of file diff --git a/locale/en_US/emails/notice_priority.part.tpl b/locale/en_US/emails/notice_priority.part.tpl index c8294fb..467ebfd 100644 --- a/locale/en_US/emails/notice_priority.part.tpl +++ b/locale/en_US/emails/notice_priority.part.tpl @@ -1 +1 @@ -The priority has been elevatd from "{$this->registry->datastore['priority'][$old]['priority']}" to "{$this->registry->datastore['priority'][$new]['priority']}". \ No newline at end of file +The priority has been elevatd from "{bugdar::$datastore['priority'][$old]['priority']}" to "{bugdar::$datastore['priority'][$new]['priority']}". \ No newline at end of file diff --git a/locale/en_US/emails/notice_resolution.part.tpl b/locale/en_US/emails/notice_resolution.part.tpl index 5ed9152..86b0475 100644 --- a/locale/en_US/emails/notice_resolution.part.tpl +++ b/locale/en_US/emails/notice_resolution.part.tpl @@ -1 +1 @@ -This bug has been resolved with resolution "{$this->registry->datastore['resolution'][$new]['resolution']}", from "{$this->registry->datastore['resolution'][$old]['resolution']}". \ No newline at end of file +This bug has been resolved with resolution "{bugdar::$datastore['resolution'][$new]['resolution']}", from "{bugdar::$datastore['resolution'][$old]['resolution']}". \ No newline at end of file diff --git a/locale/en_US/emails/notice_severity.part.tpl b/locale/en_US/emails/notice_severity.part.tpl index 4408d92..1292ab7 100644 --- a/locale/en_US/emails/notice_severity.part.tpl +++ b/locale/en_US/emails/notice_severity.part.tpl @@ -1 +1 @@ -The severity has been elevated from "{$this->registry->datastore['severity'][$old]['severity']}" to "{$this->registry->datastore['severity'][$new]['severity']}". \ No newline at end of file +The severity has been elevated from "{bugdar::$datastore['severity'][$old]['severity']}" to "{bugdar::$datastore['severity'][$new]['severity']}". \ No newline at end of file diff --git a/locale/en_US/emails/notice_status.part.tpl b/locale/en_US/emails/notice_status.part.tpl index 6115362..5bd532c 100644 --- a/locale/en_US/emails/notice_status.part.tpl +++ b/locale/en_US/emails/notice_status.part.tpl @@ -1 +1 @@ -The status of the bug is now "{$this->registry->datastore['status'][$new]['status']}", from "{$this->registry->datastore['status'][$old]['status']}". \ No newline at end of file +The status of the bug is now "{bugdar::$datastore['status'][$new]['status']}", from "{bugdar::$datastore['status'][$old]['status']}". \ No newline at end of file diff --git a/locale/en_US/emails/passwordreset.xml.tpl b/locale/en_US/emails/passwordreset.xml.tpl index eab2f01..a7b95de 100644 --- a/locale/en_US/emails/passwordreset.xml.tpl +++ b/locale/en_US/emails/passwordreset.xml.tpl @@ -1,10 +1,10 @@ - {$bugsys->options['trackertitle']} Password Reset - Hi {$user->objdata['displayname']}, + <%- bugdar::$options['trackertitle'] %> Password Reset + Hi {$user->record['displayname']}, -You requested this lost password email at the {$bugsys->options['trackertitle']} bug tracker. To reset your password, simply click the link below (or paste it into your browser window exactly) and enter a new password. +You requested this lost password email at the <%- bugdar::$options['trackertitle'] %> bug tracker. To reset your password, simply click the link below (or paste it into your browser window exactly) and enter a new password. -{$bugsys->options['trackerurl']}/login.php?do=recoverpw&activator=$activator +<%- bugdar::$options['trackerurl'] %>/login.php?do=recoverpw&activator=<%- $activator %> If you did not request this, do not worry as this notice will expire in 24 hours. \ No newline at end of file diff --git a/locale/en_US/emails/welcome.xml.tpl b/locale/en_US/emails/welcome.xml.tpl index 494779a..71930bd 100644 --- a/locale/en_US/emails/welcome.xml.tpl +++ b/locale/en_US/emails/welcome.xml.tpl @@ -1,8 +1,8 @@ - Welcome to {$bugsys->options['trackertitle']} + Welcome to {bugdar::$options['trackertitle']} Hi {$displayName}, -Thank you for taking the time to register at {$bugsys->options['trackertitle']}. We look forward to your contributations to making our products better. +Thank you for taking the time to register at {bugdar::$options['trackertitle']}. We look forward to your contributations to making our products better. If you have any questions, please don't hesitate to contact the webmaster. \ No newline at end of file diff --git a/login.php b/login.php index e1e54b5..c38ca45 100755 --- a/login.php +++ b/login.php @@ -25,19 +25,15 @@ $fetchtemplates = array( 'passwordreset' ); -define('SVN', '$Id$'); $focus['user'] = 'focus'; require_once('./global.php'); require_once('./includes/api_user.php'); -require_once('./includes/class_api_error.php'); - -APIError(array(new API_Error_Handler($message), 'user_cumulative')); // ################################################################### -if ($bugsys->userinfo['userid'] AND $_REQUEST['do'] != 'logout' AND $_POST['do'] != 'cplogin' AND $_REQUEST['do'] != 'cplogout') +if (bugdar::$userinfo['userid'] AND $_REQUEST['do'] != 'logout' AND $_POST['do'] != 'cplogin' AND $_REQUEST['do'] != 'cplogout') { $message->error(T('You are already logged in.')); } @@ -46,14 +42,14 @@ if ($bugsys->userinfo['userid'] AND $_REQUEST['do'] != 'logout' AND $_POST['do'] if (empty($_REQUEST['do'])) { - eval('$template->flush("' . $template->fetch('login') . '");'); + BSTemplate::fetch('login')->evaluate()->flush(); } // ################################################################### if ($_POST['do'] == 'login' OR $_POST['do'] == 'cplogin') { - $keeplogin = $bugsys->input_clean('rememberme', TYPE_BOOL); + $keeplogin = $input->inputClean('rememberme', TYPE_BOOL); if ($_POST['cplogin']) { $keeplogin = 0; @@ -68,14 +64,14 @@ if ($_POST['do'] == 'login' OR $_POST['do'] == 'cplogin') $url = 'index.php'; } - if ($auth->authenticateLogin($bugsys->in['email'], $bugsys->in['password'], $keeplogin)) + if ($auth->authenticateLogin($input->in['email'], $input->in['password'], $keeplogin)) { if ($_POST['do'] == 'cplogin') { - $hash = $funct->rand(90); + $hash = BSFunctions::random(90); $db->query("DELETE FROM " . TABLE_PREFIX . "adminsession WHERE dateline < " . (TIMENOW - 3600)); $db->query("INSERT INTO " . TABLE_PREFIX . "adminsession (sessionid, userid, dateline) VALUES ('$hash', " . $auth->bugdarUser['userid'] . ", " . TIMENOW . ")"); - $funct->cookie(COOKIE_PREFIX . 'adminsession', $hash, false); + BSFunctions::cookie(COOKIE_PREFIX . 'adminsession', $hash, false); } $message->redirect(T('Welcome back! You are now logged in.'), $url); } @@ -89,11 +85,11 @@ if ($_POST['do'] == 'login' OR $_POST['do'] == 'cplogin') if ($_REQUEST['do'] == 'logout') { - if ($bugsys->userinfo['userid']) + if (bugdar::$userinfo['userid']) { - $db->query("DELETE FROM " . TABLE_PREFIX . "adminsession WHERE sessionid = '" . $bugsys->input_escape(COOKIE_PREFIX . 'adminsession') . "'"); + $db->query("DELETE FROM " . TABLE_PREFIX . "adminsession WHERE sessionid = '" . $input->inputEscape(COOKIE_PREFIX . 'adminsession') . "'"); $auth->clearCookies(); - $funct->cookie(COOKIE_PREFIX . 'adminsession'); + BSFunctions::cookie(COOKIE_PREFIX . 'adminsession', false); $message->redirect(T('You have been logged out.'), ($_SERVER['HTTP_REFERER'] ? $_SERVER['HTTP_REFERER'] : 'index.php')); } else @@ -106,9 +102,9 @@ if ($_REQUEST['do'] == 'logout') if ($_POST['do'] == 'sendpw') { - $user = new UserAPI($bugsys); - $user->set('email', $bugsys->in['email'], true, false); // don't verify so we don't get errors about existing emails - $user->set_condition(array('email')); + $user = new UserAPI(); + $user->set('email', $input->in['email'], true, false); // don't verify so we don't get errors about existing emails + $user->setCondition(array('email')); $user->fetch(); if ($message->hasErrors()) @@ -118,18 +114,18 @@ if ($_POST['do'] == 'sendpw') } else { - $activator = $funct->rand(25); - $db->query("INSERT INTO " . TABLE_PREFIX . "passwordreset (activatorid, dateline, userid) VALUES ('" . $activator . "', " . TIMENOW . ", " . $user->objdata['userid'] . ")"); - - eval('$email = "' . $template->fetch(FetchEmailPath('passwordreset.xml', $bugsys->datastore['language'][$user->objdata['languageid']]['langcode'])) . '";'); - $email = $bugsys->xml->parse($email); + $activator = BSFunctions::random(25); + $db->query("INSERT INTO " . TABLE_PREFIX . "passwordreset (activatorid, dateline, userid) VALUES ('" . $activator . "', " . TIMENOW . ", " . $user->record['userid'] . ")"); - $mail->setSubject($email['email']['subject']['value']); - $mail->setBodyText($email['email']['bodyText']['value']); + $email = get_email_text('password_reset'); + $mail = new BSMail(); + $mail->setSubject($email['subject']); + $mail->setBodyText(sprintf($email['bodyText'], $user->record['displayname'], bugdar::$options['trackertitle'], bugdar::$options['trackerurl'], $activator)); + $mail->setFromAddress(MAIL_FROM_ADDRESS); + $mail->setFromName(MAIL_FROM_NAME); + $mail->send($user->record['email'], $user->record['displayname']); - $mail->send($user->objdata['email'], $user->objdata['displayname']); - - $message->message(sprintf(T('An email has been dispatched to %1$s that contains instructions on how to reset your password.'), $user->objdata['email'])); + $message->message(sprintf(T('An email has been dispatched to %1$s that contains instructions on how to reset your password.'), $user->record['email'])); } } @@ -137,7 +133,7 @@ if ($_POST['do'] == 'sendpw') if ($_REQUEST['do'] == 'lostpw') { - eval('$template->flush("' . $template->fetch('lostpassword') . '");'); + BSTemplate::fetch('lostpassword')->evaluate()->flush(); } // ################################################################### @@ -148,26 +144,25 @@ if ($_POST['do'] == 'resetpw') $db->query("DELETE FROM " . TABLE_PREFIX . "passwordreset WHERE dateline < " . (TIMENOW - 86400)); // now look for ours - $activation = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "passwordreset WHERE activatorid = '" . $bugsys->input_escape('activator') . "'"); + $activation = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "passwordreset WHERE activatorid = '" . $input->inputEscape('activator') . "'"); if (!$activation) { $message->error(L_INVALID_ID); } - $user = new UserAPI($bugsys); + $user = new UserAPI(); $user->set('userid', $activation['userid']); - $user->set_condition(); - if ($bugsys->in['fix_password'] != $bugsys->in['confirm_password']) + if ($input->in['fix_password'] != $input->in['confirm_password']) { $message->addError(T('The passwords you entered do not patch.')); } - if (empty($bugsys->in['fix_password'])) + if (empty($input->in['fix_password'])) { $message->addError(T('Your new password cannot be empty.')); } - $user->set('password', $bugsys->in['fix_password']); + $user->set('password', $input->in['fix_password']); if (!$message->hasErrors()) { @@ -192,13 +187,18 @@ if ($_REQUEST['do'] == 'recoverpw') $db->query("DELETE FROM " . TABLE_PREFIX . "passwordreset WHERE dateline < " . (TIMENOW - 86400)); // now look for ours - $activation = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "passwordreset WHERE activatorid = '" . $bugsys->input_escape('activator') . "'"); + $activation = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "passwordreset WHERE activatorid = '" . $input->inputEscape('activator') . "'"); if (!$activation) { $message->error(T('Invalid activation reset key. Please make sure you copied the URL exactly as it appeared in the email.')); } - eval('$template->flush("' . $template->fetch('passwordreset') . '");'); + $tpl = new BSTemplate('passwordreset'); + $tpl->vars = array( + 'activation' => $activation, + 'message' => $message + ); + $tpl->evaluate()->flush(); } // ################################################################### @@ -207,8 +207,8 @@ if ($_REQUEST['do'] == 'cplogout') { if ($_COOKIE[COOKIE_PREFIX . 'adminsession']) { - $db->query("DELETE FROM " . TABLE_PREFIX . "adminsession WHERE sessionid = '" . $bugsys->input_escape(COOKIE_PREFIX . 'adminsession') . "'"); - $funct->cookie(COOKIE_PREFIX . 'adminsession'); + $db->query("DELETE FROM " . TABLE_PREFIX . "adminsession WHERE sessionid = '" . $input->inputEscape(COOKIE_PREFIX . 'adminsession') . "'"); + BSFunctions::cookie(COOKIE_PREFIX . 'adminsession', false); $message->redirect(T('You have been logged out.'), 'admin/'); } else @@ -217,10 +217,4 @@ if ($_REQUEST['do'] == 'cplogout') } } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/newreport.php b/newreport.php index 5255a56..a845111 100755 --- a/newreport.php +++ b/newreport.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -23,7 +23,6 @@ $fetchtemplates = array( 'newreport', ); -define('SVN', '$Id$'); $focus['newreport'] = 'focus'; @@ -33,10 +32,8 @@ require_once('./includes/class_notification.php'); require_once('./includes/api_bug.php'); require_once('./includes/api_comment.php'); -require_once('./includes/class_api_error.php'); -APIError(array(new API_Error_Handler($message), 'user_cumulative')); -$product = explode(',', $bugsys->in['product']); +$product = explode(',', $input->in['product']); if (!can_perform('cansubmitbugs', $product[0])) { $message->errorPermission(); @@ -53,45 +50,45 @@ if (empty($_REQUEST['do'])) if ($_POST['do'] == 'insert') { - $bug = new BugAPI($bugsys); - $comment = new CommentAPI($bugsys); + $bug = new BugAPI(); + $comment = new CommentAPI(); $notif = new NotificationCenter(); - $bug->set('userid', $bugsys->userinfo['userid']); - $bug->set('username', $bugsys->userinfo['displayname']); - $bug->set('summary', $bugsys->in['summary']); - $bug->set('severity', $bugsys->in['severity']); + $bug->set('userid', bugdar::$userinfo['userid']); + $bug->set('username', bugdar::$userinfo['displayname']); + $bug->set('summary', $input->in['summary']); + $bug->set('severity', $input->in['severity']); - $comment->set('userid', $bugsys->userinfo['userid']); - $comment->set('comment', $bugsys->in['comment']); - $comment->set('parselinks', $bugsys->in['parselinks']); + $comment->set('userid', bugdar::$userinfo['userid']); + $comment->set('comment', $input->in['comment']); + $comment->set('parselinks', $input->in['parselinks']); // ------------------------------------------------------------------- // check permissions on various input values - if (!can_perform('canchangestatus', $bugsys->in['product'])) + if (!can_perform('canchangestatus', $input->in['product'])) { - $bug->set('priority', $bugsys->options['defaultpriority']); - $bug->set('status', $bugsys->options['defaultstatus']); - $bug->set('resolution', $bugsys->options['defaultresolve']); + $bug->set('priority', bugdar::$options['defaultpriority']); + $bug->set('status', bugdar::$options['defaultstatus']); + $bug->set('resolution', bugdar::$options['defaultresolve']); } else { - $bug->set('priority', $bugsys->in['priority']); - $bug->set('status', $bugsys->in['status']); - $bug->set('resolution', $bugsys->in['resolution']); + $bug->set('priority', $input->in['priority']); + $bug->set('status', $input->in['status']); + $bug->set('resolution', $input->in['resolution']); } - if (!can_perform('canassign', $bugsys->in['product'])) + if (!can_perform('canassign', $input->in['product'])) { - $bug->set('assignedto', $bugsys->options['defaultassign']); + $bug->set('assignedto', bugdar::$options['defaultassign']); } else { // assigned person is not a dev or a valid user - $bug->set('assignedto', $bugsys->in['assignedto']); + $bug->set('assignedto', $input->in['assignedto']); } - $product = explode(',', $bugsys->in['product']); + $product = explode(',', $input->in['product']); $bug->set('product', $product[0]); $bug->set('component', $product[1]); $bug->set('version', $product[2]); @@ -105,28 +102,26 @@ if ($_POST['do'] == 'insert') $comment->set('bugid', $bug->insertid); $comment->insert(); - $notif->send_new_bug_notice($bug->values, $comment->values); + $notif->sendNewBugNotice($bug->values, $comment->values); - $bug = new BugAPI($bugsys); // need to destroy because update will think the insert fields need to be changed, too - $bug->dorelations = array(); + $bug = new BugAPI(); // need to destroy because update will think the insert fields need to be changed, too $bug->set('bugid', $comment->values['bugid']); - $bug->set_condition(); $bug->fetch(); $bug->set('dateline', $comment->values['dateline']); $bug->set('initialreport', $comment->insertid); $bug->set('lastposttime', $comment->values['dateline']); - $bug->set('lastpostby', $bugsys->userinfo['userid']); - $bug->set('lastpostbyname', $bugsys->userinfo['displayname']); + $bug->set('lastpostby', bugdar::$userinfo['userid']); + $bug->set('lastpostbyname', bugdar::$userinfo['displayname']); $bug->set('hiddenlastposttime', $comment->values['dateline']); - $bug->set('hiddenlastpostby', $bugsys->userinfo['userid']); - $bug->set('hiddenlastpostbyname', $bugsys->userinfo['displayname']); + $bug->set('hiddenlastpostby', bugdar::$userinfo['userid']); + $bug->set('hiddenlastpostbyname', bugdar::$userinfo['displayname']); $bug->update(); - $notif->set_bug_data($bug->objdata); + $notif->setBugData($bug->record); $notif->finalize(); - $message->redirect(T('The bug has been added to the database.'), ($bugsys->in['submit_reload'] == '' ? "showreport.php?bugid=" . $bug->values['bugid'] : 'newreport.php')); + $message->redirect(T('The bug has been added to the database.'), ($input->in['submit_reload'] == '' ? "showreport.php?bugid=" . $bug->values['bugid'] : 'newreport.php')); } else { @@ -139,41 +134,44 @@ if ($_POST['do'] == 'insert') if ($_REQUEST['do'] == 'add') { - if (!is_array($bugsys->datastore['product'])) + if (!is_array(bugdar::$datastore['product'])) { $message->error(T('No products have been setup, therefore no bugs can be added.')); } - if (!is_array($bugsys->datastore['version'])) + if (!is_array(bugdar::$datastore['version'])) { $message->error(T('No versions have been setup underneath your product(s), therefore no bugs can be added.')); } - $select['severity'] = construct_datastore_select('severity', 'severity', 'severityid', ($bugsys->in['severity'] ? $bugsys->in['severity'] : $bugsys->options['defaultseverity'])); + $select['severity'] = construct_datastore_select('severity', 'severity', 'severityid', ($input->in['severity'] ? $input->in['severity'] : bugdar::$options['defaultseverity'])); $show['changestatus'] = can_perform('canchangestatus'); if (can_perform('canchangestatus')) { - $select['priority'] = construct_datastore_select('priority', 'priority', 'priorityid', ($bugsys->in['priority'] ? $bugsys->in['priority'] : $bugsys->options['defaultpriority'])); - $select['status'] = construct_datastore_select('status', 'status', 'statusid', ($bugsys->in['status'] ? $bugsys->in['status'] : $bugsys->options['defaultstatus'])); - $select['resolution'] = construct_datastore_select('resolution', 'resolution', 'resolutionid', ($bugsys->in['resolution'] ? $bugsys->in['resolution'] : $bugsys->options['defaultresolve'])); + $select['priority'] = construct_datastore_select('priority', 'priority', 'priorityid', ($input->in['priority'] ? $input->in['priority'] : bugdar::$options['defaultpriority'])); + $select['status'] = construct_datastore_select('status', 'status', 'statusid', ($input->in['status'] ? $input->in['status'] : bugdar::$options['defaultstatus'])); + $select['resolution'] = construct_datastore_select('resolution', 'resolution', 'resolutionid', ($input->in['resolution'] ? $input->in['resolution'] : bugdar::$options['defaultresolve'])); } $show['assign'] = can_perform('canassign'); if (can_perform('canassign')) { - foreach ($bugsys->datastore['assignto'] AS $dev) + foreach (bugdar::$datastore['assignto'] as $dev) { - $value = $dev['userid']; - $label = construct_user_display($dev, false); - $selected = ($bugsys->in['assignedto'] ? ($bugsys->in['assignedto'] == $dev['userid']) : ($dev['userid'] == $bugsys->options['defaultassign'])); - eval('$select[dev] .= "' . $template->fetch('selectoption') . '";'); + $tpl = new BSTemplate('selectoption'); + $tpl->vars = array( + 'value' => $dev['userid'], + 'label' => construct_user_display($dev, false), + 'selected' => ($input->in['assignedto'] ? ($input->in['assignedto'] == $dev['userid']) : ($dev['userid'] == bugdar::$options['defaultassign'])) + ); + $select['dev'] = $tpl->evaluate()->getTemplate(); } } // custom fields - $fields = construct_custom_fields($bugsys->in, true); + $fields = construct_custom_fields($input->in, true); $i = 0; foreach ($fields AS $field) { @@ -188,17 +186,14 @@ if ($_REQUEST['do'] == 'add') $i++; } - $productSelect = ConstructProductSelect('cansubmitbugs', $bugsys->in['product'], false); - - $reporter = construct_user_display($bugsys->userinfo); - - eval('$template->flush("' . $template->fetch('newreport') . '");'); + $tpl = new BSTemplate('newreport'); + $tpl->vars = array( + 'reporter' => construct_user_display(bugdar::$userinfo), + 'productSelect' => construct_product_select('cansubmitbugs', $input->in['product'], false), + 'select' => $select, + 'customfields' => $customfields + ); + $tpl->evaluate()->flush(); } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/register.php b/register.php index c849890..1da5109 100755 --- a/register.php +++ b/register.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -23,47 +23,43 @@ $fetchtemplates = array( 'register' ); -define('SVN', '$Id$'); $focus['user'] = 'focus'; require_once('./global.php'); require_once('./includes/api_user.php'); -require_once('./includes/class_api_error.php'); -APIError(array(new API_Error_Handler($message), 'user_cumulative')); - // ################################################################### if ($_POST['do'] == 'insert') { - if ($bugsys->userinfo['userid']) + if (bugdar::$userinfo['userid']) { $message->error(T('Sorry, you are already registered.')); } - if (!$bugsys->options['allownewreg']) + if (!bugdar::$options['allownewreg']) { $message->error(T('Sorry, we don\'t allow new registrations.')); } - if ($bugsys->in['email'] != $bugsys->in['confirmemail']) + if ($input->in['email'] != $input->in['confirmemail']) { $message->addError(T('The emails you entered do not match.')); } - if ($bugsys->in['password'] != $bugsys->in['confirmpassword']) + if ($input->in['password'] != $input->in['confirmpassword']) { $message->addError(T('The passwords you entered did not match.')); } - if ($bugsys->options['verifyemail']) + if (bugdar::$options['verifyemail']) { $usergroupid = 3; } else { - if ($bugsys->options['moderatenewusers']) + if (bugdar::$options['moderatenewusers']) { $usergroupid = 4; } @@ -73,14 +69,14 @@ if ($_POST['do'] == 'insert') } } - $user = new UserAPI($bugsys); - $user->set('email', $bugsys->in['email']); - $user->set('displayname', $bugsys->in['displayname']); - $user->set('password', $bugsys->in['password']); - $user->set('showemail', $bugsys->in['showemail']); + $user = new UserAPI(); + $user->set('email', $input->in['email']); + $user->set('displayname', $input->in['displayname']); + $user->set('password', $input->in['password']); + $user->set('showemail', $input->in['showemail']); $user->set('showcolors', 1); - $user->set('languageid', $bugsys->in['languageid']); - $user->set('timezone', $bugsys->options['defaulttimezone']); + $user->set('languageid', $input->in['languageid']); + $user->set('timezone', bugdar::$options['defaulttimezone']); $user->set('usergroupid', $usergroupid); if (!$message->hasErrors()) @@ -92,29 +88,33 @@ if ($_POST['do'] == 'insert') // Verify email address if ($usergroupid == 3) { - $activationid = $funct->rand(25); + $activationid = BSFunctions::random(25); $db->query("INSERT INTO " . TABLE_PREFIX . "useractivation (userid, activator, dateline, usergroupid) VALUES ($userid, '$activationid', " . TIMENOW . ", 2)"); - eval('$email = "' . $template->fetch(FetchEmailPath('activateaccount.xml', $bugsys->datastore['language'][$bugsys->in['languageid']]['langcode'])) . '";'); - $email = $bugsys->xml->parse($email); - $mail->setSubject($email['email']['subject']['value']); - $mail->setBodyText($email['email']['bodyText']['value']); - - $mail->send($bugsys->in['email'], $bugsys->in['displayname']); + $email = get_email_text('activate_account'); + $mail = new BSMail(); + $mail->setSubject($email['subject']); + $mail->setBodyText(sprintf($email['bodyText'], $input->in['displayname'], bugdar::$options['trackertitle'], bugdar::$options['trackerurl'], $userid, $activationid)); + $mail->setFromAddress(MAIL_FROM_ADDRESS); + $mail->setFromName(MAIL_FROM_NAME); + $mail->send($input->in['email'], $input->in['displayname']); $message->message(T('You now need to activate your account via email.')); } else if ($usergroupid == 4 OR $usergroupid == 2) { - if ($bugsys->options['sendwelcomemail']) + if (bugdar::$options['sendwelcomemail']) { - $displayName = $bugsys->in['displayname']; - eval('$email = "' . $template->fetch(FetchEmailPath('welcome.xml', $bugsys->datastore['language'][$bugsys->in['languageid']]['langcode'])) . '";'); - $email = $bugsys->xml->parse($email); - $mail->setSubject($email['email']['subject']['value']); - $mail->setBodyText($email['email']['bodyText']['value']); - $mail->send($bugsys->in['email'], $bugsys->in['displayname']); + $displayName = $input->in['displayname']; + + $email = get_email_text('welcome'); + $mail = new BSMail(); + $mail->setSubject($email['subject']); + $mail->setBodyText(sprintf($email['bodyText'], $input->in['displayname'], bugdar::$options['trackertitle'])); + $mail->setFromAddress(MAIL_FROM_ADDRESS); + $mail->setFromName(MAIL_FROM_NAME); + $mail->send($input->in['email'], $input->in['displayname']); } if ($usergroupid == 4) @@ -138,44 +138,55 @@ if ($_POST['do'] == 'insert') if (empty($_REQUEST['do'])) { - if ($bugsys->userinfo['userid']) + if (bugdar::$userinfo['userid']) { $message->error(T('Sorry, you are already registered.')); } - if (!$bugsys->options['allownewreg']) + if (!bugdar::$options['allownewreg']) { $message->error(T('Sorry, we don\'t allow new registrations.')); } - foreach ($bugsys->datastore['language'] AS $value => $temp) + foreach (bugdar::$datastore['language'] as $value => $temp) { - $label = $temp['title']; - $selected = ($value == $bugsys->in['languageid']); - eval('$opts .= "' . $template->fetch('selectoption') . '";'); + $tpl = new BSTemplate('selectoption'); + $tpl->vars = array( + 'value' => $value, + 'label' => $temp['title'], + 'selected' => ($value == $input->in['languageid']) + ); + $opts .= $tpl->evaluate()->getTemplate(); } - eval('$template->flush("' . $template->fetch('register') . '");'); + $tpl = new BSTemplate('register'); + $tpl->vars = array( + 'opts' => $opts + ); + $tpl->evaluate()->flush(); } // ################################################################### if ($_REQUEST['do'] == 'activate') { - $bugsys->input_clean('userid', TYPE_UINT); - if ($useractivation = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "useractivation WHERE userid = " . $bugsys->in['userid'] . " AND activator = '" . $bugsys->input_escape('activator') . "'")) + $input->inputClean('userid', TYPE_UINT); + if ($useractivation = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "useractivation WHERE userid = " . $input->in['userid'] . " AND activator = '" . $input->inputEscape('activator') . "'")) { - $user = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "user WHERE userid = " . $bugsys->in['userid']); - $db->query("UPDATE " . TABLE_PREFIX . "user SET usergroupid = $useractivation[usergroupid] WHERE userid = " . $bugsys->in['userid']); - $db->query("DELETE FROM " . TABLE_PREFIX . "useractivation WHERE userid = " . $bugsys->in['userid']); + $user = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "user WHERE userid = " . $input->in['userid']); + $db->query("UPDATE " . TABLE_PREFIX . "user SET usergroupid = $useractivation[usergroupid] WHERE userid = " . $input->in['userid']); + $db->query("DELETE FROM " . TABLE_PREFIX . "useractivation WHERE userid = " . $input->in['userid']); - if ($bugsys->options['sendwelcomemail']) + if (bugdar::$options['sendwelcomemail']) { $displayName = $user['displayname']; - eval('$email = "' . $template->fetch(FetchEmailPath('welcome.xml', $bugsys->datastore['language'][$user['languageid']]['langcode'])) . '";'); - $email = $bugsys->xml->parse($email); - $mail->setSubject($email['email']['subject']['value']); - $mail->setBodyText($email['email']['bodyText']['value']); + + $email = get_email_text('welcome'); + $mail = new BSMail(); + $mail->setSubject($email['subject']); + $mail->setBodyText(sprintf($email['bodyText'], $user['displayname'], bugdar::$options['trackertitle'])); + $mail->setFromAddress(MAIL_FROM_ADDRESS); + $mail->setFromName(MAIL_FROM_NAME); $mail->send($user['email'], $user['displayname']); } @@ -187,10 +198,4 @@ if ($_REQUEST['do'] == 'activate') } } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/search.php b/search.php index e22c3b6..4b323e2 100644 --- a/search.php +++ b/search.php @@ -30,7 +30,6 @@ $fetchtemplates = array( 'pagenav' ); -define('SVN', '$Id$'); $focus['search'] = 'focus'; @@ -39,9 +38,6 @@ require_once('./includes/functions_product.php'); require_once('./includes/class_sort.php'); require_once('./includes/class_logging.php'); require_once('./includes/api_bug.php'); -require_once('./includes/class_api_error.php'); - -APIError(array($message, 'error')); if (!can_perform('cansearch')) { @@ -52,7 +48,7 @@ define('MODE_ANY', 1); define('MODE_ALL', 2); define('MODE_RAW', 3); -$var = $db->query_first("SHOW VARIABLES LIKE 'ft_min_word_len'"); +$var = $db->queryFirst("SHOW VARIABLES LIKE 'ft_min_word_len'"); define('SEARCH_WORD_MIN', $var['Value']); $db->query("DELETE FROM " . TABLE_PREFIX . "search WHERE userid = 0 AND dateline < " . (TIMENOW - 3600)); @@ -70,17 +66,17 @@ if (empty($_REQUEST['do'])) if ($_REQUEST['do'] == 'search') { - if ($bugsys->in['new']) + if ($input->in['new']) { $newsearch = true; } - else if ($bugsys->in['searchid']) + else if ($input->in['searchid']) { - $cachedsearch = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "search WHERE searchid = " . $bugsys->input_clean('searchid', TYPE_UINT) . " AND userid = " . $bugsys->userinfo['userid']); + $cachedsearch = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "search WHERE searchid = " . $input->inputClean('searchid', TYPE_UINT) . " AND userid = " . bugdar::$userinfo['userid']); } - else if ($bugsys->userinfo['userid']) + else if (bugdar::$userinfo['userid']) { - $cachedsearch = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "search WHERE name IS NULL AND userid = " . $bugsys->userinfo['userid']); + $cachedsearch = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "search WHERE name IS NULL AND userid = " . bugdar::$userinfo['userid']); } else { @@ -90,11 +86,11 @@ if ($_REQUEST['do'] == 'search') if ($cachedsearch) { $show['cached'] = true; - if ($cachedsearch['dateline'] < TIMENOW - 900 OR $bugsys->in['rerun']) + if ($cachedsearch['dateline'] < TIMENOW - 900 OR $input->in['rerun']) { $_REQUEST['do'] = 'process'; - $bugsys->in = array_merge(unserialize($cachedsearch['query']), $bugsys->in); - $bugsys->debug('rerunning the search'); + $input->in = array_merge(unserialize($cachedsearch['query']), $input->in); + BSApp::debug('rerunning the search'); } else { @@ -109,18 +105,16 @@ if ($_REQUEST['do'] == 'search') if ($newsearch) { - if (!is_array($bugsys->datastore['product'])) + if (!is_array(bugdar::$datastore['product'])) { $message->error(T('No products are setup, therefore there can be no bugs and thus search cannot function.')); } - if (!is_array($bugsys->datastore['version'])) + if (!is_array(bugdar::$datastore['version'])) { $message->error(T('No versions have been added underneath your product(s), there can be no bugs and thus search cannot function.')); } - $productSelect = ConstructProductSelect(); - // ------------------------------------------------------------------- // custom fields $fields = construct_custom_fields(null, true, false, true); @@ -146,26 +140,39 @@ if ($_REQUEST['do'] == 'search') $select['resolution'] = construct_datastore_select('resolution', 'resolution', 'resolutionid'); $searches = ''; - if ($bugsys->userinfo['userid']) + if (bugdar::$userinfo['userid']) { - $searchesFetch = $db->query("SELECT * FROM " . TABLE_PREFIX . "search WHERE name IS NOT NULL AND userid = " . $bugsys->userinfo['userid']); - while ($search = $db->fetch_array($searchesFetch)) + $searchesFetch = $db->query("SELECT * FROM " . TABLE_PREFIX . "search WHERE name IS NOT NULL AND userid = " . bugdar::$userinfo['userid']); + foreach ($searchesFetch as $search) { - $value = $search['searchid']; - $label = $search['name']; - eval('$searches .= "' . $template->fetch('selectoption') . '";'); + $tpl = new BSTemplate('selectoption'); + $tpl->vars = array( + 'value' => $search['searchid'], + 'label' => $search['name'] + ); + $searches .= $tpl->evaluate()->getTemplate(); } } $select['dev'] = ''; - foreach ($bugsys->datastore['assignto'] AS $dev) + foreach (bugdar::$datastore['assignto'] AS $dev) { - $value = $dev['userid']; - $label = construct_user_display($dev, false); - eval('$select[dev] .= "' . $template->fetch('selectoption') . '";'); + $tpl = new BSTemplate('selectoption'); + $tpl->vars = array( + 'value' => $dev['userid'], + 'label' => construct_user_display($dev, false) + ); + $select['dev'] .= $tpl->evaluate()->getTemplate(); } - - eval('$template->flush("' . $template->fetch('search') . '");'); + + $tpl = new BSTemplate('search'); + $tpl->vars = array( + 'select' => $select, + 'productSelect' => construct_product_select(), + 'customfields' => $customfields, + 'searches' => $searches + ); + $tpl->evaluate()->flush(); } } @@ -175,9 +182,9 @@ if ($_REQUEST['do'] == 'process') { // ------------------------------------------------------------------- // handle keywords - if ($bugsys->in['summary']) + if ($input->in['summary']) { - $keywords = preg_split('#\s+#', $bugsys->in['summary']); + $keywords = preg_split('#\s+#', $input->in['summary']); // TODO - need to have some str to bool conversions @@ -188,7 +195,7 @@ if ($_REQUEST['do'] == 'process') continue; } - if ($bugsys->in['mode'] == MODE_ALL) + if ($input->in['mode'] == MODE_ALL) { $querybuild['text'] .= " +$word"; } @@ -209,7 +216,7 @@ if ($_REQUEST['do'] == 'process') $temp = trim($querybuild['text']); - if ($bugsys->in['mode'] == MODE_ALL OR $bugsys->in['mode'] == MODE_RAW) + if ($input->in['mode'] == MODE_ALL OR $input->in['mode'] == MODE_RAW) { $bool_flag = ' IN BOOLEAN MODE'; } @@ -219,11 +226,11 @@ if ($_REQUEST['do'] == 'process') // ------------------------------------------------------------------- // reporter - if ($bugsys->in['reporter']) + if ($input->in['reporter']) { // force email or name?? make a distinction? // more elegant way to do this? probably - $user = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "user WHERE email LIKE '%" . str_replace('%', '\%', $bugsys->input_escape('reporter')) . "' OR displayname LIKE '%" . str_replace('%', '\%', $bugsys->input_escape('reporter')) . "%'"); + $user = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "user WHERE email LIKE '%" . str_replace('%', '\%', $input->inputEscape('reporter')) . "' OR displayname LIKE '%" . str_replace('%', '\%', $input->inputEscape('reporter')) . "%'"); if ($user['userid']) { $querybuild['reporter'] = "AND bug.userid = $user[userid] OR comment.userid = $user[userid]"; @@ -232,12 +239,12 @@ if ($_REQUEST['do'] == 'process') // ------------------------------------------------------------------- // product/component/version stuff - if (is_array($bugsys->in['product'])) + if (is_array($input->in['product'])) { - foreach ($bugsys->in['product'] AS $prod) + foreach ($input->in['product'] AS $prod) { $product = explode(',', $prod); - $product = $bugsys->clean($product, TYPE_UINT); + $product = $input->clean($product, TYPE_UINT); $products[] = $product[0]; $components[] = $product[1]; $versions[] = $product[2]; @@ -249,72 +256,72 @@ if ($_REQUEST['do'] == 'process') // severity, priority, status, resolution, assignedto // severity - if ($bugsys->in['severity']) + if ($input->in['severity']) { - $bugsys->input_clean('severity', TYPE_UINT); - $querybuild['severity'] = "AND bug.severity IN (" . implode(',', $bugsys->in['severity']) . ")"; + $input->inputClean('severity', TYPE_UINT); + $querybuild['severity'] = "AND bug.severity IN (" . implode(',', $input->in['severity']) . ")"; } // priority - if ($bugsys->in['priority']) + if ($input->in['priority']) { - $bugsys->input_clean('priority', TYPE_UINT); - $querybuild['priority'] = "AND bug.priority IN (" . implode(',', $bugsys->in['priority']) . ")"; + $input->inputClean('priority', TYPE_UINT); + $querybuild['priority'] = "AND bug.priority IN (" . implode(',', $input->in['priority']) . ")"; } // status - if ($bugsys->in['status']) + if ($input->in['status']) { - $bugsys->input_clean('status', TYPE_UINT); - $querybuild['status'] = "AND bug.status IN (" . implode(',', $bugsys->in['status']) . ")"; + $input->inputClean('status', TYPE_UINT); + $querybuild['status'] = "AND bug.status IN (" . implode(',', $input->in['status']) . ")"; } // resolution - if ($bugsys->in['resolution']) + if ($input->in['resolution']) { - $bugsys->input_clean('resolution', TYPE_UINT); - $querybuild['resolution'] = "AND bug.resolution IN (" . implode(',', $bugsys->in['resolution']) . ")"; + $input->inputClean('resolution', TYPE_UINT); + $querybuild['resolution'] = "AND bug.resolution IN (" . implode(',', $input->in['resolution']) . ")"; } // assignment - if ($bugsys->in['assignedto']) + if ($input->in['assignedto']) { - $bugsys->input_clean('assignedto', TYPE_UINT); - $querybuild['assignedto'] = "AND bug.assignedto IN (" . implode(',', $bugsys->in['assignedto']) . ")"; + $input->inputClean('assignedto', TYPE_UINT); + $querybuild['assignedto'] = "AND bug.assignedto IN (" . implode(',', $input->in['assignedto']) . ")"; } // ------------------------------------------------------------------- // date - if ($bugsys->in['date']) + if ($input->in['date']) { // now - (seconds/day * number of days) - $dateline = time() - ($bugsys->input_clean('date', TYPE_INT) * 3600); + $dateline = time() - ($input->inputClean('date', TYPE_INT) * 3600); $querybuild['date'] = "AND bug.dateline >= $dateline"; } // ------------------------------------------------------------------- // favorites - $bugsys->input_clean('favorite', TYPE_INT); - if ($bugsys->in['favorite'] != 0 AND $bugsys->userinfo['userid']) + $input->inputClean('favorite', TYPE_INT); + if ($input->in['favorite'] != 0 AND bugdar::$userinfo['userid']) { - $favorites = $db->query("SELECT * FROM " . TABLE_PREFIX . "favorite WHERE userid = " . $bugsys->userinfo['userid']); - while ($favorite = $db->fetch_array($favorites)) + $favorites = $db->query("SELECT * FROM " . TABLE_PREFIX . "favorite WHERE userid = " . bugdar::$userinfo['userid']); + foreach ($favorites as $favorite) { $ids[] = $favorite['bugid']; } - $querybuild['favorites'] = "AND bug.bugid " . ($bugsys->in['favorite'] > 0 ? "IN" : "NOT IN") . " (" . implode(', ', $ids) . ")"; + $querybuild['favorites'] = "AND bug.bugid " . ($input->in['favorite'] > 0 ? "IN" : "NOT IN") . " (" . implode(', ', $ids) . ")"; } // ------------------------------------------------------------------- // sort by $sortby = array('bugid', 'severity', 'priority', 'status', 'resolution', 'dateline'); $orderby = array('ASC', 'DESC'); - $bugsys->in['orderby'] = strtoupper($bugsys->in['orderby']); - if (in_array($bugsys->in['sortby'], $sortby) AND in_array($bugsys->in['orderby'], $orderby)) + $input->in['orderby'] = strtoupper($input->in['orderby']); + if (in_array($input->in['sortby'], $sortby) AND in_array($input->in['orderby'], $orderby)) { - $sortclause = "ORDER BY " . $bugsys->in['sortby'] . ' ' . $bugsys->in['orderby']; + $sortclause = "ORDER BY " . $input->in['sortby'] . ' ' . $input->in['orderby']; } - else if ($bugsys->in['sortby'] == 'relevance') + else if ($input->in['sortby'] == 'relevance') { $sortclause = ''; } @@ -325,32 +332,32 @@ if ($_REQUEST['do'] == 'process') // ------------------------------------------------------------------- // custom fields - $fields_fetch = $bugsys->db->query(" + $fields_fetch = $db->query(" SELECT bugfield.*, MAX(permission.mask) AS mask FROM " . TABLE_PREFIX . "bugfield AS bugfield LEFT JOIN " . TABLE_PREFIX . "bugfieldpermission AS permission ON (bugfield.fieldid = permission.fieldid) WHERE mask <> 0 - AND permission.usergroupid IN ({$bugsys->userinfo['usergroupid']}" . (sizeof($bugsys->userinfo['groupids']) != 0 ? ',' . implode(',', $bugsys->userinfo['groupids']) : '') . ") + AND permission.usergroupid IN (" . bugdar::$userinfo['usergroupid'] . (sizeof(bugdar::$userinfo['groupids']) != 0 ? ',' . implode(',', bugdar::$userinfo['groupids']) : '') . ") AND bugfield.cansearch = 1 GROUP BY (bugfield.fieldid)" ); - while ($field = $bugsys->db->fetch_array($fields_fetch)) + foreach ($fields_fetch as $field) { - if (!empty($bugsys->in["custom$field[fieldid]"]) OR ($field['type'] == 'select_single' AND isset($bugsys->in["custom$field[fieldid]"]))) + if (!empty($input->in["custom$field[fieldid]"]) OR ($field['type'] == 'select_single' AND isset($input->in["custom$field[fieldid]"]))) { - if ($field['type'] == 'input_checkbox' AND $bugsys->input_clean("custom$field[fieldid]", TYPE_INT) != 0) + if ($field['type'] == 'input_checkbox' AND $input->inputClean("custom$field[fieldid]", TYPE_INT) != 0) { - $querybuild[] = "AND bug.custom$field[fieldid] = " . ($bugsys->in["custom$field[fieldid]"] > 0 ? 1 : 0); + $querybuild[] = "AND bug.custom$field[fieldid] = " . ($input->in["custom$field[fieldid]"] > 0 ? 1 : 0); } else if ($field['type'] == 'input_text') { - $querybuild[] = "AND bug.custom$field[fieldid] LIKE '%" . $bugsys->in["custom$field[fieldid]"] . "%'"; + $querybuild[] = "AND bug.custom$field[fieldid] LIKE '%" . $input->in["custom$field[fieldid]"] . "%'"; } - else if ($field['type'] == 'select_single' AND $bugsys->in["custom$field[fieldid]"] != -1) + else if ($field['type'] == 'select_single' AND $input->in["custom$field[fieldid]"] != -1) { $temp = unserialize($field['selects']); - $querybuild[] = "AND bug.custom$field[fieldid] = '" . trim($temp[ intval($bugsys->in["custom$field[fieldid]"]) ]) . "'"; + $querybuild[] = "AND bug.custom$field[fieldid] = '" . trim($temp[ intval($input->in["custom$field[fieldid]"]) ]) . "'"; } } } @@ -378,33 +385,33 @@ if ($_REQUEST['do'] == 'process') OR (bug.hidden AND bug.product IN (" . fetch_on_bits('canviewhidden') . "))" . (can_perform('canviewownhidden') ? " OR - (bug.hidden AND bug.userid = " . $bugsys->userinfo['userid'] . " AND bug.product IN (" . fetch_on_bits('canviewonhidden') . "))" : "") . " + (bug.hidden AND bug.userid = " . bugdar::$userinfo['userid'] . " AND bug.product IN (" . fetch_on_bits('canviewonhidden') . "))" : "") . " ) " . implode("\n\t\t", $querybuild) . " GROUP BY bug.bugid $sortclause "); - $numrows = $db->num_rows($search); + $numrows = $search->size(); if ($numrows < 1) { $message->error(T('No search results were returned that matched your criteria. Please try again with different search requirements.')); } - while ($result = $db->fetch_array($search)) + foreach ($search as $result) { $ids[] = $result['bugid']; $results[] = $result; } - if ($bugsys->userinfo['userid'] AND !$cachedsearch AND !$bugsys->in['rerun']) + if (bugdar::$userinfo['userid'] AND !$cachedsearch AND !$input->in['rerun']) { - $db->query("DELETE FROM " . TABLE_PREFIX . "search WHERE userid = " . $bugsys->userinfo['userid'] . " AND name IS NULL"); + $db->query("DELETE FROM " . TABLE_PREFIX . "search WHERE userid = " . bugdar::$userinfo['userid'] . " AND name IS NULL"); } // store the search params - $params = $bugsys->in; + $params = $input->in; foreach ($_COOKIE AS $key => $value) { unset($params["$key"]); @@ -423,14 +430,14 @@ if ($_REQUEST['do'] == 'process') INSERT INTO " . TABLE_PREFIX . "search (userid, dateline, query, ids, orderby, hilight, resultcount) VALUES - (" . $bugsys->userinfo['userid'] . ", - " . TIMENOW . ", '" . $bugsys->escape(serialize($params)) . "', - '" . implode(',', $ids) . "', '" . $bugsys->escape($sortclause) . "', - '" . $bugsys->escape($hilight) . "', + (" . bugdar::$userinfo['userid'] . ", + " . TIMENOW . ", '" . $input->escape(serialize($params)) . "', + '" . implode(',', $ids) . "', '" . $input->escape($sortclause) . "', + '" . $input->escape($hilight) . "', " . sizeof($results) . " )" ); - $search = array('searchid' => $db->insert_id(), 'ids' => implode(',', $ids), 'orderby' => $sortclause, 'hilight' => $hilight, 'resultcount' => sizeof($results)); + $search = array('searchid' => $db->insertId(), 'ids' => implode(',', $ids), 'orderby' => $sortclause, 'hilight' => $hilight, 'resultcount' => sizeof($results)); } $_POST['do'] = 'results'; @@ -440,14 +447,12 @@ if ($_REQUEST['do'] == 'process') if ($_REQUEST['do'] == 'update') { - $search = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "search WHERE searchid = " . $bugsys->input_clean('searchid', TYPE_UINT) . " AND userid = " . $bugsys->userinfo['userid']); + $search = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "search WHERE searchid = " . $input->inputClean('searchid', TYPE_UINT) . " AND userid = " . bugdar::$userinfo['userid']); if (!$search OR !can_perform('caneditother')) { $message->errorPermission(); } - $productSelect = ConstructProductSelect(); - $show['update'] = true; // ------------------------------------------------------------------- @@ -474,27 +479,39 @@ if ($_REQUEST['do'] == 'update') $select['status'] = construct_datastore_select('status', 'status', 'statusid', 0, 0); $select['resolution'] = construct_datastore_select('resolution', 'resolution', 'resolutionid', 0, 0); - $select['dev'] = ''; - $value = '0'; - $label = ''; - $selected = true; - eval('$select[dev] .= "' . $template->fetch('selectoption') . '";'); - $selected = false; - foreach ($bugsys->datastore['assignto'] AS $dev) + $tpl = new BSTemplate('selectoption'); + $tpl->vars = array( + 'value' => 0, + 'label' => '', + 'selected' => true + ); + $select['dev'] = $tpl->evaluate()->getTemplate(); + + foreach (bugdar::$datastore['assignto'] as $dev) { - $value = $dev['userid']; - $label = construct_user_display($dev, false); - eval('$select[dev] .= "' . $template->fetch('selectoption') . '";'); + $tpl = new BSTemplate('selectoption'); + $tpl->vars = array( + 'value' => $dev['userid'], + 'label' => construct_user_display($dev, false) + ); + $select['dev'] .= $tpl->evaluate()->getTemplate(); } - - eval('$template->flush("' . $template->fetch('search_update') . '");'); + + $tpl = new BSTemplate('search_update'); + $tpl->vars = array( + 'search' => $search, + 'select' => $select, + 'customfields' => $customfields, + 'productSelect' => construct_product_select() + ); + $tpl->evaluate()->flush(); } // ################################################################### if ($_POST['do'] == 'doupdate') { - $search = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "search WHERE searchid = " . $bugsys->input_clean('searchid', TYPE_UINT) . " AND userid = " . $bugsys->userinfo['userid']); + $search = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "search WHERE searchid = " . $input->inputClean('searchid', TYPE_UINT) . " AND userid = " . bugdar::$userinfo['userid']); if (!$search OR !can_perform('caneditother')) { $message->errorPermission(); @@ -509,48 +526,47 @@ if ($_POST['do'] == 'doupdate') ( product IN (" . fetch_on_bits('caneditother') . ") OR - (userid = " . $bugsys->userinfo['userid'] . " AND product IN (" . fetch_on_bits('caneditown') . ")) + (userid = " . bugdar::$userinfo['userid'] . " AND product IN (" . fetch_on_bits('caneditown') . ")) ) "); - while ($bug = $db->fetch_array($bugs)) + foreach ($bugs as $bug) { - if (!((can_perform('caneditown', $bug['product']) AND $bugsys->userinfo['userid'] == $bug['userid']) OR (can_perform('caneditother', $bug['product']) AND $bugsys->userinfo['userid'] != $bug['userid'])) AND !can_perform('canpostcomments', $bug['product'])) + if (!((can_perform('caneditown', $bug['product']) AND bugdar::$userinfo['userid'] == $bug['userid']) OR (can_perform('caneditother', $bug['product']) AND bugdar::$userinfo['userid'] != $bug['userid'])) AND !can_perform('canpostcomments', $bug['product'])) { continue; } - $api = new BugApi($bugsys); + $api = new BugApi(); $api->set('bugid', $bug['bugid']); - $api->set_condition(); $api->values = $bug; $log = new Logging(); - $log->set_bugid($bug['bugid']); - $log->add_data(true, $bug, $log->getCommonFields(), true); + $log->setBugId($bug['bugid']); + $log->addData(true, $bug, $log->getCommonFields(), true); - if ($bugsys->in['status'] AND can_perform('canchangestatus', $bug['product'])) + if ($input->in['status'] AND can_perform('canchangestatus', $bug['product'])) { - $api->set('status', $bugsys->in['status']); + $api->set('status', $input->in['status']); } - if ($bugsys->in['priority'] AND can_perform('canchangestatus', $bug['product'])) + if ($input->in['priority'] AND can_perform('canchangestatus', $bug['product'])) { - $api->set('priority', $bugsys->in['priority']); + $api->set('priority', $input->in['priority']); } - if ($bugsys->in['severity']) + if ($input->in['severity']) { - $api->set('severity', $bugsys->in['severity']); + $api->set('severity', $input->in['severity']); } - if ($bugsys->in['resolution'] AND can_perform('canchangestatus', $bug['product'])) + if ($input->in['resolution'] AND can_perform('canchangestatus', $bug['product'])) { - $api->set('resolution', $bugsys->in['resolution']); + $api->set('resolution', $input->in['resolution']); } - if ($bugsys->in['assignedto'] AND can_perform('canassign', $bug['product'])) + if ($input->in['assignedto'] AND can_perform('canassign', $bug['product'])) { - $api->set('assignedto', $bugsys->in['assignedto']); + $api->set('assignedto', $input->in['assignedto']); } - if ($bugsys->in['product']) + if ($input->in['product']) { - $product = explode(',', $bugsys->in['product']); + $product = explode(',', $input->in['product']); $api->set('product', $product[0]); $api->set('component', $product[1]); $api->set('version', $product[2]); @@ -558,26 +574,26 @@ if ($_POST['do'] == 'doupdate') process_custom_fields($api, $message, false, true); - $log->add_data(false, $api->values, $log->getCommonFields(), true); + $log->addData(false, $api->values, $log->getCommonFields(), true); $api->update(); - $log->update_history(); + $log->updateHistory(); } - $message->redirect(T('The specified bugs have been updated and you will now return to your search results.'), 'search.php?searchid=' . $bugsys->in['searchid']); + $message->redirect(T('The specified bugs have been updated and you will now return to your search results.'), 'search.php?searchid=' . $input->in['searchid']); } // ################################################################### if ($_REQUEST['do'] == 'export') { - if (!$bugsys->in['searchid'] AND $bugsys->userinfo['userid']) + if (!$input->in['searchid'] AND bugdar::$userinfo['userid']) { - $search = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "search WHERE name IS NULL AND userid = " . $bugsys->userinfo['userid']); + $search = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "search WHERE name IS NULL AND userid = " . bugdar::$userinfo['userid']); } - else if ($bugsys->in['searchid']) + else if ($input->in['searchid']) { - $search = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "search WHERE searchid = " . $bugsys->input_clean('searchid', TYPE_UINT) . " AND userid = " . $bugsys->userinfo['userid']); + $search = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "search WHERE searchid = " . $input->inputClean('searchid', TYPE_UINT) . " AND userid = " . bugdar::$userinfo['userid']); } else { @@ -593,9 +609,9 @@ if ($_REQUEST['do'] == 'export') $xml = ' -'; +'; - while ($bug = $db->fetch_array($bugs)) + foreach ($bugs as $bug) { $xml .= "\n\t"; @@ -605,7 +621,7 @@ if ($_REQUEST['do'] == 'export') $xml .= "\n\t\t" . $datef->format('r', $bug['dateline']) . ""; if ($bug['userid']) { - $xml .= "\n\t\t" . construct_user_display($db->query_first("SELECT * FROM " . TABLE_PREFIX . "user WHERE userid = $bug[userid]"), false) . ""; + $xml .= "\n\t\t" . construct_user_display($db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "user WHERE userid = $bug[userid]"), false) . ""; } $xml .= "\n\t\t" . $bug['summary'] . ""; $xml .= "\n\t\t" . $bug['product'] . ""; @@ -617,7 +633,7 @@ if ($_REQUEST['do'] == 'export') $xml .= "\n\t\t" . $bug['status'] . ""; if ($bug['assignedto']) { - $xml .= "\n\t\t" . construct_user_display($bugsys->datastore['assignto']["$bug[assignedto]"], false) . ""; + $xml .= "\n\t\t" . construct_user_display(bugdar::$datastore['assignto']["$bug[assignedto]"], false) . ""; } $xml .= "\n\t\t" . $bug['resolution'] . ""; $xml .= "\n\t\t" . $bug['severity'] . ""; @@ -628,14 +644,14 @@ if ($_REQUEST['do'] == 'export') $xml .= "\n"; - $funct->download_file($xml, T('bugdar-search-' . $search['searchid'] . '.xml'), true); + BSFunctions::download_file($xml, T('bugdar-search-' . $search['searchid'] . '.xml'), true); } // ################################################################### if ($_POST['do'] == 'dosave') { - $search = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "search WHERE searchid = " . $bugsys->input_clean('searchid', TYPE_UINT) . " AND userid = " . $bugsys->userinfo['userid']); + $search = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "search WHERE searchid = " . $input->inputClean('searchid', TYPE_UINT) . " AND userid = " . bugdar::$userinfo['userid']); if (!$search) { $message->addError(T('The search does not exist.')); @@ -644,14 +660,14 @@ if ($_POST['do'] == 'dosave') { $message->addError(sprintf(T('This search has already been named "%1$s".'), $search['name'])); } - if (empty($bugsys->in['name'])) + if (empty($input->in['name'])) { $message->addError(T('The name cannot be empty.')); } if (!$message->hasErrors()) { - $db->query("UPDATE " . TABLE_PREFIX . "search SET name = '" . $bugsys->input_escape('name') . "' WHERE searchid = " . $bugsys->in['searchid']); + $db->query("UPDATE " . TABLE_PREFIX . "search SET name = '" . $input->inputEscape('name') . "' WHERE searchid = " . $input->in['searchid']); $message->redirect(T('Your search has been saved.'), 'search.php?searchid=' . $search['searchid']); } else @@ -665,12 +681,18 @@ if ($_POST['do'] == 'dosave') if ($_REQUEST['do'] == 'save') { - if (!$bugsys->userinfo['userid']) + if (!bugdar::$userinfo['userid']) { $message->errorPermission(); } - eval('$template->flush("' . $template->fetch('search_save') . '");'); + $tpl = new BSTemplate('search_save'); + $tpl->vars = array( + 'message' => $message, + 'searchid' => $input->in['searchid'], + 'name' => $input->in['name'] + ); + $tpl->evaluate()->flush(); } // ################################################################### @@ -684,22 +706,24 @@ if ($_POST['do'] == 'results') $searchid = $search['searchid']; $hilight = $search['hilight']; - - LoadPaginationFramework(); + + require_once 'includes/pagination.php'; + $pagination = new Pagination(); + $pagination->processIncomingData(); $pagination->setTotal($search['resultcount']); $pagination->splitPages(); $sort = new ListSorter('search'); - $show['save'] = ($bugsys->userinfo['userid'] AND !$search['name']); + $show['save'] = (bugdar::$userinfo['userid'] AND !$search['name']); $show['update'] = can_perform('caneditother'); $bugs = ''; $search = $db->query("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid IN ($search[ids]) $search[orderby] LIMIT " . $pagination->fetchLimit($pagination->getPage() - 1) . ", " . $pagination->getPerPage()); - while ($bug = $db->fetch_array($search)) + foreach ($search as $bug) { - $funct->exec_swap_bg('altcolor', ''); - $bug = ProcessBugDataForDisplay($bug, $funct->bgcolour); + BSFunctions::swap_css_classes('altcolor', ''); + $bug = ProcessBugDataForDisplay($bug, BSFunctions::$cssClass); $bugs .= $sort->constructRow($bug, "&hilight=$hilight"); } @@ -707,13 +731,13 @@ if ($_POST['do'] == 'results') $show['pagenav'] = ($pagination->getPageCount() > 1); $pagenav = $pagination->constructPageNav('search.php?searchid=' . $searchid); - eval('$template->flush("' . $template->fetch('search_results') . '");'); + $tpl = new BSTemplate('search_results'); + $tpl->vars = array( + 'columnHeads' => $columnHeads, + 'bugs' => $bugs, + 'searchid' => $searchid + ); + $tpl->evaluate()->flush(); } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/showhistory.php b/showhistory.php index ebef405..b21e3c3 100644 --- a/showhistory.php +++ b/showhistory.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -24,14 +24,13 @@ $fetchtemplates = array( 'history_bit' ); -define('SVN', '$Id$'); $focus['showreport'] = 'focus'; require_once('./global.php'); require_once('./includes/api_user.php'); -$bug = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = " . $bugsys->input_clean('bugid', TYPE_UINT)); +$bug = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = " . $input->inputClean('bugid', TYPE_UINT)); if (!$bug) { $message->error(L_INVALID_ID); @@ -60,11 +59,11 @@ $customfields = $db->query(" LEFT JOIN " . TABLE_PREFIX . "bugfieldpermission AS permission ON (bugfield.fieldid = permission.fieldid) WHERE mask <> 0 - AND permission.usergroupid IN ({$bugsys->userinfo['usergroupid']}" . (sizeof($bugsys->userinfo['groupids']) != 0 ? ',' . implode(',', $bugsys->userinfo['groupids']) : '') . ") + AND permission.usergroupid IN (" . bugdar::$userinfo['usergroupid'] . (sizeof(bugdar::$userinfo['groupids']) != 0 ? ',' . implode(',', bugdar::$userinfo['groupids']) : '') . ") GROUP BY (bugfield.fieldid)" ); -while ($field = $db->fetch_array($customfields)) +foreach ($customfields as $field) { $fieldlist["$field[fieldid]"] = sprintf(T('Custom Field %1$s (%2$s)'), $field['fieldid'], $field['name']); } @@ -79,9 +78,9 @@ $logs_fetch = $db->query(" ON (user.userid = history.userid) WHERE bugid = $bug[bugid]" ); -while ($log = $db->fetch_array($logs_fetch)) +foreach ($logs_fetch as $log) { - $log['date'] = $datef->format($bugsys->options['dateformat'], $log['dateline']); + $log['date'] = $datef->format(bugdar::$options['dateformat'], $log['dateline']); $log['user'] = construct_user_display($log); $logs["$log[dateline]"]["$log[historyid]"] = $log; @@ -133,35 +132,39 @@ foreach ($logs AS $dateline => $logitems) if (isset($lookupfields["$matches[1]"])) { $lookup = $matches[1]; - $log['original'] = $bugsys->datastore["$lookup"]["$log[original]"][ $lookupfields["$lookup"] ]; - $log['changed'] = $bugsys->datastore["$lookup"]["$log[changed]"][ $lookupfields["$lookup"] ]; + $log['original'] = bugdar::$datastore["$lookup"]["$log[original]"][ $lookupfields["$lookup"] ]; + $log['changed'] = bugdar::$datastore["$lookup"]["$log[changed]"][ $lookupfields["$lookup"] ]; } else if ($matches[1] == 'assignto' OR $matches[1] == 'assignedto') { if ($log['original']) { - $user = new UserAPI($bugsys); + $user = new UserAPI(); $user->set('userid', $log['original']); - $user->set_condition(); + $user->setCondition(); $user->fetch(); - $log['original'] = construct_user_display($user->objdata); + $log['original'] = construct_user_display($user->record); } if ($log['changed']) { - $user = new UserAPI($bugsys); + $user = new UserAPI(); $user->set('userid', $log['changed']); - $user->set_condition(); + $user->setCondition(); $user->fetch(); - $log['changed'] = construct_user_display($user->objdata); + $log['changed'] = construct_user_display($user->record); } } } - $funct->exec_swap_bg('', 'altcolor'); - $bgcolor = $funct->bgcolour; + BSFunctions::swap_css_classes('', 'altcolor'); - eval('$history .= "' . $template->fetch('history_bit') . '";'); + $tpl = new BSTemplate('history_bit'); + $tpl->vars = array( + 'bgcolor' => BSFunctions::$cssClass, + 'log' => $log + ); + $history .= $tpl->evaluate()->getTemplate(); $show['group'] = false; } } @@ -172,12 +175,11 @@ if (sizeof($toKill) > 0) $db->query("DELETE FROM " . TABLE_PREFIX . "history WHERE historyid IN (" . implode(',', $toKill) . ")"); } -eval('$template->flush("' . $template->fetch('history') . '");'); +$tpl = new BSTemplate('history'); +$tpl->vars = array( + 'history' => $history, + 'bug' => $bug +); +$tpl->evaluate()->flush(); -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/showreport.php b/showreport.php index 7119bad..fec4c42 100644 --- a/showreport.php +++ b/showreport.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -27,14 +27,13 @@ $fetchtemplates = array( 'bugfield_static_text' ); -define('SVN', '$Id$'); $focus['showreport'] = 'focus'; require_once('./global.php'); require_once('./includes/functions_product.php'); -$bugid = $bugsys->input_clean('bugid', TYPE_UINT); +$bugid = $input->inputClean('bugid', TYPE_UINT); // ################################################################### @@ -42,7 +41,7 @@ if (empty($bugid) OR $_REQUEST['do'] == 'quicksearch') { if (!empty($bugid)) { - if ($db->query_first("SELECT bugid FROM " . TABLE_PREFIX . "bug WHERE bugid = $bugid")) + if ($db->queryFirst("SELECT bugid FROM " . TABLE_PREFIX . "bug WHERE bugid = $bugid")) { header("Location: showreport.php?bugid=$bugid"); exit; @@ -53,7 +52,9 @@ if (empty($bugid) OR $_REQUEST['do'] == 'quicksearch') } } - eval('$template->flush("' . $template->fetch('quicksearch') . '");'); + $tpl = new BSTemplate('quicksearch'); + $tpl->vars = array('error' => $error); + $tpl->evaluate()->flush(); exit; } @@ -61,7 +62,7 @@ if (empty($bugid) OR $_REQUEST['do'] == 'quicksearch') // ------------------------------------------------------------------- // get the report -$bug = $db->query_first(" +$bug = $db->queryFirst(" SELECT bug.*, user.email, user.displayname, user.showemail FROM " . TABLE_PREFIX . "bug AS bug LEFT JOIN " . TABLE_PREFIX . "user AS user @@ -79,7 +80,7 @@ if (!check_bug_permissions($bug)) $message->errorPermission(); } -$show['edit'] = ((can_perform('caneditown', $bug['product']) AND $bugsys->userinfo['userid'] == $bug['userid'] AND $bug['userid'] != 0) OR (can_perform('caneditother', $bug['product']) AND $bugsys->userinfo['userid'] != $bug['userid'])); +$show['edit'] = ((can_perform('caneditown', $bug['product']) AND bugdar::$userinfo['userid'] == $bug['userid'] AND $bug['userid'] != 0) OR (can_perform('caneditother', $bug['product']) AND bugdar::$userinfo['userid'] != $bug['userid'])); $show['delete'] = can_perform('candeletedata', $bug['product']); // ################################################################### @@ -97,36 +98,39 @@ if ($show['edit']) } else { - $bug['status'] = $bugsys->datastore['status']["$bug[status]"]['status']; - $bug['resolution'] = $bugsys->datastore['resolution']["$bug[resolution]"]['resolution']; - $bug['severity'] = $bugsys->datastore['severity']["$bug[severity]"]['severity']; - $bug['priority'] = $bugsys->datastore['priority']["$bug[priority]"]['priority']; + $bug['status'] = bugdar::$datastore['status']["$bug[status]"]['status']; + $bug['resolution'] = bugdar::$datastore['resolution']["$bug[resolution]"]['resolution']; + $bug['severity'] = bugdar::$datastore['severity']["$bug[severity]"]['severity']; + $bug['priority'] = bugdar::$datastore['priority']["$bug[priority]"]['priority']; } - $show['assign'] = (can_perform('canassign', $bug['product']) ? true : false); - if (can_perform('canassign', $bug['product']) AND is_array($bugsys->datastore['assignto'])) + $show['assign'] = (can_perform('canassign', $bug['product'])); + if (can_perform('canassign', $bug['product']) && is_array(bugdar::$datastore['assignto'])) { - foreach ($bugsys->datastore['assignto'] AS $dev) + foreach (bugdar::$datastore['assignto'] as $dev) { - $value = $dev['userid']; - $selected = (($dev['userid'] == $bug['assignedto']) ? true : false); - $label = construct_user_display($dev, false); - eval('$select[dev] .= "' . $template->fetch('selectoption') . '";'); + $tpl = new BSTemplate('selectoption'); + $tpl->vars = array( + 'value' => $dev['userid'], + 'label' => construct_user_display($dev, false), + 'selected' => ($dev['userid'] == $bug['assignedto']) + ); + $select['dev'] .= $tpl->evaluate()->getTemplate(); } } - $productSelect = ConstructProductSelect('canviewbugs', "$bug[product],$bug[component],$bug[version]"); + $productSelect = construct_product_select('canviewbugs', "$bug[product],$bug[component],$bug[version]"); if ($bug['duplicateof']) { - $duplicate = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = $bug[duplicateof]"); + $duplicate = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = $bug[duplicateof]"); } if ($bug['dependency']) { $depends = array(); $dependencies = $db->query("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid IN ($bug[dependency])"); - while ($dependency = $db->fetch_array($dependencies)) + foreach ($dependencies as $dependency) { $depends[] = "$dependency[bugid]"; } @@ -135,22 +139,28 @@ if ($show['edit']) $select['automations'] = ''; $show['automations'] = false; - if (is_array($bugsys->datastore['automation'])) + if (is_array(bugdar::$datastore['automation'])) { - foreach ($bugsys->datastore['automation'] AS $action) + foreach (bugdar::$datastore['automation'] as $action) { - $label = $action['name']; - $value = $action['actionid']; - $selected = false; - eval('$select[automation] .= "' . $template->fetch('selectoption') . '";'); + $tpl = new BSTemplate('selectoption'); + $tpl->vars = array( + 'label' => $action['name'], + 'value' => $action['actionid'], + 'selected' => false + ); + $select['automation'] .= $tpl->evaluate()->getTemplate(); $show['automations'] = true; } if ($show['automations']) { - $label = ''; - $value = 0; - $selected = true; - eval('$select[automation] = "' . $template->fetch('selectoption') . '" . $select[automation];'); + $tpl = new BSTemplate('selectoption'); + $tpl->vars = array( + 'label' => '', + 'value' => 0, + 'selected' => true + ); + $select['automation'] = $tpl->evaluate()->getTemplate() . $select['automation']; } } } @@ -161,19 +171,19 @@ else { // ------------------------------------------------------------------- // prep display - $bug['status'] = $bugsys->datastore['status']["$bug[status]"]['status']; - $bug['resolution'] = $bugsys->datastore['resolution']["$bug[resolution]"]['resolution']; - $bug['severity'] = $bugsys->datastore['severity']["$bug[severity]"]['severity']; - $bug['priority'] = $bugsys->datastore['priority']["$bug[priority]"]['priority']; + $bug['status'] = bugdar::$datastore['status']["$bug[status]"]['status']; + $bug['resolution'] = bugdar::$datastore['resolution']["$bug[resolution]"]['resolution']; + $bug['severity'] = bugdar::$datastore['severity']["$bug[severity]"]['severity']; + $bug['priority'] = bugdar::$datastore['priority']["$bug[priority]"]['priority']; - $assigninfo = $bugsys->datastore['assignto']["$bug[assignedto]"]; + $assigninfo = bugdar::$datastore['assignto']["$bug[assignedto]"]; $bug['assigninfo'] = ((is_array($assigninfo)) ? construct_user_display($assigninfo) : ''); - $duplicateof = $db->query_first("SELECT bugid, summary FROM " . TABLE_PREFIX . "bug WHERE bugid = $bug[duplicateof]"); + $duplicateof = $db->queryFirst("SELECT bugid, summary FROM " . TABLE_PREFIX . "bug WHERE bugid = $bug[duplicateof]"); $dupelist = array(); $duplicates = $db->query("SELECT bugid, summary FROM " . TABLE_PREFIX . "bug WHERE duplicateof = $bug[bugid]"); - while ($duplicate = $db->fetch_array($duplicates)) + foreach ($duplicates as $duplicate) { $dupelist[] = "$duplicate[summary]"; } @@ -183,7 +193,7 @@ else { $depends = array(); $dependencies = $db->query("SELECT bugid, summary FROM " . TABLE_PREFIX . "bug WHERE bugid IN ($bug[dependency])"); - while ($dependency = $db->fetch_array($dependencies)) + foreach ($dependencies as $dependency) { $depends[] = "$dependency[bugid]"; } @@ -196,17 +206,17 @@ else $show['subscribe'] = can_perform('cansubscribe', $bug['product']); -$favorite = (bool)$db->query_first("SELECT * FROM " . TABLE_PREFIX . "favorite WHERE bugid = $bug[bugid] AND userid = " . $bugsys->userinfo['userid']); +$favorite = (bool)$db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "favorite WHERE bugid = $bug[bugid] AND userid = " . bugdar::$userinfo['userid']); $favoritetext = ($favorite ? T('Remove from Favorites') : T('Add to Favorites')); $bug['userinfo'] = construct_user_display($bug); -$bug['datetime'] = $datef->format($bugsys->options['dateformat'], $bug['dateline']); +$bug['datetime'] = $datef->format(bugdar::$options['dateformat'], $bug['dateline']); $bug['productid'] = $bug['product']; -$bug['product'] = $bugsys->datastore['product']["$bug[product]"]['title']; +$bug['product'] = bugdar::$datastore['product']["$bug[product]"]['title']; $bug['componentid'] = $bug['component']; -$bug['component'] = ($bug['component'] ? $bugsys->datastore['product']["$bug[component]"]['title'] : ''); +$bug['component'] = ($bug['component'] ? bugdar::$datastore['product']["$bug[component]"]['title'] : ''); $bug['versionid'] = $bug['version']; -$bug['version'] = $bugsys->datastore['version']["$bug[version]"]['version']; +$bug['version'] = bugdar::$datastore['version']["$bug[version]"]['version']; // ################################################################### // custom field output @@ -231,23 +241,23 @@ foreach ($fields AS $field) // ------------------------------------------------------------------- // hilight -$words = explode(' ', $bugsys->in['hilight']); +$words = explode(' ', $input->in['hilight']); foreach ($words AS $word) { if (trim($word)) { - $word = preg_quote($bugsys->unsanitize($word)); + $word = preg_quote($input->unsanitize($word)); $hilight[] = $temp = trim(preg_replace('#[^0-9a-zA-Z_ ]#', '', $word)); } } // ------------------------------------------------------------------- // attachments -$show['getattachments'] = ((can_perform('cangetattach', $bug['productid']) OR can_perform('caneditattach', $bug['productid'])) ? true : false); -$show['putattachments'] = ((can_perform('canputattach', $bug['productid']) OR can_perform('caneditattach', $bug['productid'])) ? true : false); -$show['attachments'] = ($show['getattachments'] OR $show['putattachments']) ? true : false; +$show['getattachments'] = (can_perform('cangetattach', $bug['productid']) || can_perform('caneditattach', $bug['productid'])); +$show['putattachments'] = (can_perform('canputattach', $bug['productid']) || can_perform('caneditattach', $bug['productid'])); +$show['attachments'] = ($show['getattachments'] || $show['putattachments']); -if ($show['getattachments'] OR $show['putattachments']) +if ($show['getattachments'] || $show['putattachments']) { $attachments_fetch = $db->query(" SELECT attachment.attachmentid, attachment.filename, @@ -262,22 +272,27 @@ if ($show['getattachments'] OR $show['putattachments']) ); $attaches = false; - while ($attachment = $db->fetch_array($attachments_fetch)) + foreach ($attachments_fetch as $attachment) { $attaches = true; - $show['editattach'] = ((can_perform('caneditattach', $bug['productid']) OR ($attachment['userid'] == $bugsys->userinfo['userid'] AND can_perform('canputattach', $bug['productid']))) ? true : false); - $attachment['date'] = $datef->format($bugsys->options['dateformat'], $attachment['dateline']); + $show['editattach'] = (can_perform('caneditattach', $bug['productid']) || ($attachment['userid'] == bugdar::$userinfo['userid'] && can_perform('canputattach', $bug['productid']))); + $attachment['date'] = $datef->format(bugdar::$options['dateformat'], $attachment['dateline']); $attachment['user'] = construct_user_display($attachment, false); - eval('$attachments .= "' . $template->fetch('showreport_attachment') . '";'); + + $tpl = new BSTemplate('showreport_attachment'); + $tpl->vars = array( + 'attachment' => $attachment + ); + $attachments .= $tpl->evaluate()->getTemplate(); } - $show['attachments'] = (!$show['putattachments'] AND !$attaches) ? false : true; + $show['attachments'] = ($show['putattachments'] && $attaches); } // ------------------------------------------------------------------- // votes -$vote = $db->query_first("SELECT *, FIND_IN_SET(" . $bugsys->userinfo['userid'] . ", userids) AS uservote FROM " . TABLE_PREFIX . "vote WHERE bugid = $bug[bugid]"); +$vote = $db->queryFirst("SELECT *, FIND_IN_SET(" . bugdar::$userinfo['userid'] . ", userids) AS uservote FROM " . TABLE_PREFIX . "vote WHERE bugid = $bug[bugid]"); $vote['total'] = $vote['votefor'] + $vote['voteagainst']; if ($vote['total'] != 0) @@ -304,15 +319,15 @@ $comments_fetch = $db->query(" AND !hidden" : '') . " ORDER BY comment.dateline ASC" ); -while ($comment = $db->fetch_array($comments_fetch)) +foreach ($comments_fetch as $comment) { - $comment['posttime'] = $datef->format($bugsys->options['dateformat'], $comment['dateline']); + $comment['posttime'] = $datef->format(bugdar::$options['dateformat'], $comment['dateline']); $comment['postby'] = construct_user_display($comment); - $show['editcomment'] = ((can_perform('caneditownreply', $bug['productid']) AND $bugsys->userinfo['userid'] == $comment['userid']) OR (can_perform('caneditotherreply', $bug['productid']) AND $bugsys->userinfo['userid'] != $comment['userid'])); + $show['editcomment'] = ((can_perform('caneditownreply', $bug['productid']) AND bugdar::$userinfo['userid'] == $comment['userid']) OR (can_perform('caneditotherreply', $bug['productid']) AND bugdar::$userinfo['userid'] != $comment['userid'])); - $bugsys->debug('can edit own replies: ' . (int)(can_perform('caneditownreply', $bug['productid']) AND $bugsys->userinfo['userid'] == $comment['userid'])); - $bugsys->debug('can edit other replies:' . (int)(can_perform('caneditotherreply', $bug['productid']) AND $bugsys->userinfo['userid'] != $comment['userid'])); - $bugsys->debug('$show[editcomment]: ' . $show['editcomment']); + BSApp::debug('can edit own replies: ' . (int)(can_perform('caneditownreply', $bug['productid']) AND bugdar::$userinfo['userid'] == $comment['userid'])); + BSApp::debug('can edit other replies:' . (int)(can_perform('caneditotherreply', $bug['productid']) AND bugdar::$userinfo['userid'] != $comment['userid'])); + BSApp::debug('$show[editcomment]: ' . $show['editcomment']); if (is_array($hilight)) { @@ -324,7 +339,9 @@ while ($comment = $db->fetch_array($comments_fetch)) } } - eval('$comments .= "' . $template->fetch('showreport_comment') . '";'); + $tpl = new BSTemplate('showreport_comment'); + $tpl->vars = array('comment' => $comment); + $comments .= $tpl->evaluate()->getTemplate(); } $show['newreply'] = (can_perform('canpostcomments', $bug['productid']) ? true : false); @@ -340,12 +357,17 @@ if (is_array($hilight) AND !$show['edit']) } } -eval('$template->flush("' . $template->fetch('showreport') . '");'); +$tpl = new BSTemplate('showreport'); +$tpl->vars = array( + 'bug' => $bug, + 'comments' => $comments, + 'select' => $select, + 'vote' => $vote, + 'favoritetext' => $favoritetext, + 'customfields' => $customfields, + 'attachments' => $attachments, + 'productSelect' => $productSelect +); +$tpl->evaluate()->flush(); -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/syndicate.php b/syndicate.php index 0f0329b..cea2ef1 100644 --- a/syndicate.php +++ b/syndicate.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -44,9 +44,9 @@ $bugs_fetch = $db->query(" WHERE bug.product IN (" . fetch_on_bits('canviewbugs', fetch_guest_user()) . ") AND (!bug.hidden OR (bug.hidden AND bug.product IN (" . fetch_on_bits('canviewhidden', fetch_guest_user()) . "))) ORDER BY " . (can_perform('canviewhidden', 0, fetch_guest_user()) ? "bug.lastposttime" : "bug.hiddenlastposttime") . " DESC - LIMIT " . $bugsys->options['syndicateditems'] + LIMIT " . bugdar::$options['syndicateditems'] ); -while ($bug = $db->fetch_array($bugs_fetch)) +foreach ($bugs_fetch as $bug) { $syndicate .= ' @@ -68,21 +68,21 @@ while ($bug = $db->fetch_array($bugs_fetch))
- + - + - +
$data
' . T('Product/Component/Version') . ':' . $bugsys->datastore['product']["$bug[product]"]['title'] . '/' . (($bug['component']) ? $bugsys->datastore['product']["$bug[component]"]['title'] . '/' : '') . $bugsys->datastore['version']["$bug[version]"]['version'] . '' . bugdar::$datastore['product']["$bug[product]"]['title'] . '/' . (($bug['component']) ? bugdar::$datastore['product']["$bug[component]"]['title'] . '/' : '') . bugdar::$datastore['version']["$bug[version]"]['version'] . '
' . T('Status') . ':' . $bugsys->datastore['status']["$bug[status]"]['status'] . '' . bugdar::$datastore['status']["$bug[status]"]['status'] . '
' . T('Severity') . ':' . $bugsys->datastore['severity']["$bug[severity]"]['severity'] . '' . bugdar::$datastore['severity']["$bug[severity]"]['severity'] . '

' . $bug['comment_parsed'] . '

') . ' ' . htmlspecialchars($bug['comment_parsed']) . ' - + '; $lastupdated = $bug["$timestamp"]; @@ -91,8 +91,8 @@ while ($bug = $db->fetch_array($bugs_fetch)) echo ' - ' . sprintf(T('%1$s Syndication Feed'), $bugsys->options['trackertitle']) . ' - + ' . sprintf(T('%1$s Syndication Feed'), bugdar::$options['trackertitle']) . ' + ' . gmdate('Y-m-d\TH:i:s\Z', $lastupdated) . ' @@ -105,10 +105,4 @@ echo ' '; -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/templates/box.css b/templates/box.css index eb286b1..87a87b3 100644 --- a/templates/box.css +++ b/templates/box.css @@ -1,7 +1,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by diff --git a/templates/bugfield_input_checkbox.tpl b/templates/bugfield_input_checkbox.tpl index acad0e0..27008fd 100644 --- a/templates/bugfield_input_checkbox.tpl +++ b/templates/bugfield_input_checkbox.tpl @@ -1,6 +1,6 @@ - +
- $field[name] $help[field$field[fieldid]] -
+ <%- $field['name'] %> help[field<%- $field['fieldid'] %>] +
<% if ($searchMode): %><% else: %> /><% endif %>
- \ No newline at end of file + \ No newline at end of file diff --git a/templates/bugfield_input_text.tpl b/templates/bugfield_input_text.tpl index 576fc8f..b1e420b 100644 --- a/templates/bugfield_input_text.tpl +++ b/templates/bugfield_input_text.tpl @@ -1,6 +1,6 @@ - +
- $field[name] $help[field$field[fieldid]] -
maxlength="$field[maxlength]" />
+ <%- $field['name'] %> help[field<%- $field['fieldid'] %>] +
maxlength="<%- $field['maxlength'] %>"<% endif %> />
- + diff --git a/templates/bugfield_select_single.tpl b/templates/bugfield_select_single.tpl index 919adab..bf3048f 100644 --- a/templates/bugfield_select_single.tpl +++ b/templates/bugfield_select_single.tpl @@ -1,6 +1,6 @@ - +
- $field[name] $help[field$field[fieldid]] -
+ <%- $field['name'] %> <%- $help['field' . $field['fieldid']] %> +
- \ No newline at end of file + \ No newline at end of file diff --git a/templates/bugfield_static_text.tpl b/templates/bugfield_static_text.tpl index 617bcda..c58fa58 100644 --- a/templates/bugfield_static_text.tpl +++ b/templates/bugfield_static_text.tpl @@ -1,6 +1,6 @@ - +
- $field[name] $help[field$field[fieldid]] -
$field[value]
+ <%- $field['name'] %> help[field<%- $field['fieldid'] %>] +
<%- $field['value'] %>
- + diff --git a/templates/editattach.tpl b/templates/editattach.tpl index bfffd9e..fc5fe40 100644 --- a/templates/editattach.tpl +++ b/templates/editattach.tpl @@ -1,44 +1,44 @@ -$doctype - +<%- $doctype %> + -$headinclude +<%- $headinclude %> - $attachment[filename] - $bug[summary] + <%- $attachment['filename'] %> - <%- $bug['summary'] %> -$header +<%- $header %>
- +
-
- {@"Attachment #%1$s for Bug #%2$s %3$s"} +
+ <%- sprintf(T('Attachment #%1$s for Bug #%2$s %3$s'), $attachment['attachmentid'], $bug['bugid'], $bug['summary']) %>
-
-
{@"Attachment"}: {@"View"} [$attachment[filename]]
+
+
<%-T("Attachment")%>: <%-T("View")%> [<%- $attachment['filename'] %>]
-
-
{@"Description"}:
-
{@"Obsolete"}: checked="checked" />
+
+
<%-T("Description")%>:
+
<%-T("Obsolete")%>: checked="checked"<% endif %> />

- - - - + " accesskey="s" /> + <% if ($show['delete']): %> " /><% endif %> + " accesskey="r" /> +
-$footer \ No newline at end of file +<%- $footer %> \ No newline at end of file diff --git a/templates/editcomment.tpl b/templates/editcomment.tpl index 570e8f4..1eaa36d 100644 --- a/templates/editcomment.tpl +++ b/templates/editcomment.tpl @@ -1,46 +1,46 @@ -$doctype - +<%- $doctype %> + -$headinclude +<%- $headinclude %> - <lang 1="$comment[commentid]">{@"Edit Comment %1$s"}</lang> - $bug[summary] + <%- sprintf(T('Edit Comment %1$s'), $comment['commentid']) %> - <%- $bug['summary'] %> -$header +<%- $header %> - -
- {@"The following errors occurred"}: - {$message->errorBox} +<% if ($show['errors']): %> +
+ <%-T("The following errors occurred")%>: + <%- $message->errorBox %>
- +<% endif %>
- +
-
- {@"Comment #%1$s in bug #%2$s %3$s"} +
+ <%- sprintf(T('Comment #%1$s in bug #%2$s %3$s'), $comment['commentid'], $bug['bugid'], $bug['summary']) %>
-
{@"Posted on %1$s by %2$s"}
+
<%- sprintf(T('Posted on %1$s by %2$s'), $comment['posttime'], $comment['postby']) %>
-
-
style="color: red">{@"Hidden"}: checked="checked" />
-
{@"Parse Links in the Comment"}: checked="checked" />
- +
+ <% if ($show['hide']): %>
style="color: red"<% endif %>><%-T("Hidden")%>: checked="checked"<% endif %> />
<% endif %> +
<%-T("Parse Links in the Comment")%>: checked="checked"<% endif %> />
+

- - - + " /> + " /> +
-$footer \ No newline at end of file +<%- $footer %> \ No newline at end of file diff --git a/templates/explain_automation.tpl b/templates/explain_automation.tpl index 90fb868..437f4d3 100644 --- a/templates/explain_automation.tpl +++ b/templates/explain_automation.tpl @@ -1,18 +1,18 @@ -$doctype - +<%- $doctype %> + -$headinclude - {$bugsys->options['trackertitle']} - {@"Automations"} +<%- $headinclude %> + <%- bugdar::$options['trackertitle'] %> - <%-T("Automations")%> -$header +<%- $header %> -

{@"Explication of Automations"}

+

<%-T("Explication of Automations")%>

-$automations +<%- $automations %>
-$footer \ No newline at end of file +<%- $footer %> \ No newline at end of file diff --git a/templates/explain_product.tpl b/templates/explain_product.tpl index cc841b4..7bc71f4 100644 --- a/templates/explain_product.tpl +++ b/templates/explain_product.tpl @@ -1,35 +1,35 @@ -$doctype - +<%- $doctype %> + -$headinclude - {$bugsys->options['trackertitle']} - {@"Products"} +<%- $headinclude %> + <%- bugdar::$options['trackertitle'] %> - <%-T("Products")%> -$header +<%- $header %> -

{@"Explication of Products"}

+

<%-T("Explication of Products")%>

- +<% if ($globalversions): %> - + - + - $globalversions + <%- $globalversions %>
{@"Global Versions"}<%-T("Global Versions")%>
{@"These versions are avaliable for every product, component, and version."}<%-T("These versions are avaliable for every product, component, and version.")%>
-
+<% endif %>
- + -$productlist +<%- $productlist %>
{@"Products (components are in white)"}<%-T("Products (components are in white)")%>
-$footer \ No newline at end of file +<%- $footer %> \ No newline at end of file diff --git a/templates/explain_row.tpl b/templates/explain_row.tpl index 4eb5af7..07691a5 100644 --- a/templates/explain_row.tpl +++ b/templates/explain_row.tpl @@ -1,4 +1,4 @@ - - $left - $right +> + <%- $left %> + <%- $right %> diff --git a/templates/favorites.tpl b/templates/favorites.tpl index 36e9234..3b31eb5 100644 --- a/templates/favorites.tpl +++ b/templates/favorites.tpl @@ -1,27 +1,27 @@ -$doctype - +<%- $doctype %> + -$headinclude - {$bugsys->options['trackertitle']} - {@"My Favorite Bugs"} +<%- $headinclude %> + <%- bugdar::$options['trackertitle'] %> - <%-T("My Favorite Bugs")%> -$header +<%- $header %> -$headers +<%- $headers %> -$bugs +<%- $bugs %>
- +<% if ($show['pagenav']): %>
-$pagenav +<%- $pagenav %>
-
+<% endif %> -$footer \ No newline at end of file +<%- $footer %> \ No newline at end of file diff --git a/templates/fields.css b/templates/fields.css index bca50a9..91d88d5 100644 --- a/templates/fields.css +++ b/templates/fields.css @@ -1,7 +1,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by diff --git a/templates/footer.tpl b/templates/footer.tpl index 139f555..2c4f880 100644 --- a/templates/footer.tpl +++ b/templates/footer.tpl @@ -1,7 +1,7 @@
diff --git a/templates/global.css b/templates/global.css index 3b698de..ad79d35 100644 --- a/templates/global.css +++ b/templates/global.css @@ -1,7 +1,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by diff --git a/templates/global.js b/templates/global.js index 72ae173..3b136fa 100644 --- a/templates/global.js +++ b/templates/global.js @@ -1,7 +1,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by diff --git a/templates/header.tpl b/templates/header.tpl index 9f56107..b464cad 100644 --- a/templates/header.tpl +++ b/templates/header.tpl @@ -1,44 +1,44 @@ - +<% if (!bugdar::$userinfo['userid']): %>
- {@"Hello, guest. We have noticed that you are not registered at this bug tracker. Your experience will be greatly enhanced if you log in. To do so, you first must register by clicking on the Register tab at the top. If you are already registered, you can login at the Login tab."} + <%-T('Hello, guest. We have noticed that you are not registered at this bug tracker. Your experience will be greatly enhanced if you log in. To do so, you first must register by clicking on the Register tab at the top. If you are already registered, you can login at the Login tab.')%>
-
+<% endif %>
- {@ {@"Syndicate"} + <%-T(" style="border: 0px" /> <%-T("Syndicate")%> - {@"Listing"} - - {@"New"} - - {@"Display"} - - {@"Search"} - - - {@"Favorites"} - - userinfo['userid']">userctrl.php">{@"Options"}login.php">{@"Login/Register"} - - {@"Administration"} - - - {@"Logout"} - + <%-T("Listing")%> + <% if ($show['newreport']): %> + <%-T("New")%> + <% endif %> + <%-T("Display")%> + <% if ($show['search']): %> + <%-T("Search")%> + <% endif %> + <% if (bugdar::$userinfo['userid']): %> + <%-T("Favorites")%> + <% endif %> + <%-T("Options")%><% else: %>login.php"><%-T("Login/Register")%><% endif %> + <% if ($show['admin']): %> + <%-T("Administration")%> + <% endif %> + <% if (bugdar::$userinfo['userid']): %> + ')"><%-T("Logout")%> + <% endif %>
\ No newline at end of file diff --git a/templates/headinclude.tpl b/templates/headinclude.tpl index 339ec1a..a73a61a 100644 --- a/templates/headinclude.tpl +++ b/templates/headinclude.tpl @@ -1,6 +1,6 @@ - + - + \ No newline at end of file diff --git a/templates/help_link.tpl b/templates/help_link.tpl index 67ad92e..e7c9180 100644 --- a/templates/help_link.tpl +++ b/templates/help_link.tpl @@ -1 +1 @@ -? \ No newline at end of file +">? \ No newline at end of file diff --git a/templates/help_window.tpl b/templates/help_window.tpl index 181aa55..44e6355 100644 --- a/templates/help_window.tpl +++ b/templates/help_window.tpl @@ -1,19 +1,19 @@ -$doctype - +<%- $doctype %> + -$headinclude +<%- $headinclude %> - {@"Help"} - $topic[title] + <%-T("Help")%> - <%- $topic['title'] %>
-
{@"Help"} : $topic[title]
+
<%-T("Help")%> : <%- $topic['title'] %>
- $topic[body] + <%- $topic['body'] %>
diff --git a/templates/history.tpl b/templates/history.tpl index 88add76..d7ab840 100644 --- a/templates/history.tpl +++ b/templates/history.tpl @@ -1,25 +1,25 @@ -$doctype - +<%- $doctype %> + -$headinclude - {@"Bug History"} - $bug[summary] +<%- $headinclude %> + <%-T("Bug History")%> - <%- $bug['summary'] %> -$header +<%- $header %> -

{@"History for %1$s (bugid: %2$s)"}

+

<%- sprintf(T('History for %1$s (bugid: %2$s)'), $bug['summary'], $bug['bugid']) %>

- - - - - + + + + + -$history +<%- $history %>
{@"User"}{@"Date"}{@"Field"}{@"Old Value"}{@"New Value"}<%-T("User")%><%-T("Date")%><%-T("Field")%><%-T("Old Value")%><%-T("New Value")%>
-$footer \ No newline at end of file +<%- $footer %> \ No newline at end of file diff --git a/templates/history_bit.tpl b/templates/history_bit.tpl index 599b25c..ccede12 100644 --- a/templates/history_bit.tpl +++ b/templates/history_bit.tpl @@ -1,7 +1,7 @@ - class="$bgcolor"> - $log[user]  - $log[date]  - $log[field] - $log[original] - $log[changed] + class="<%- $bgcolor %>"<% endif %>> + <% if ($show['group']): %><%- $log['user'] %><% else: %> <% endif %> + <% if ($show['group']): %><%- $log['date'] %><% else: %> <% endif %> + <%- $log['field'] %> + <%- $log['original'] %> + <%- $log['changed'] %> diff --git a/templates/list_head.tpl b/templates/list_head.tpl index 2c05ff5..6add150 100644 --- a/templates/list_head.tpl +++ b/templates/list_head.tpl @@ -1 +1 @@ - $name $image + <%- $name %> <%- $image %> diff --git a/templates/login.tpl b/templates/login.tpl index 17840a2..8a02d62 100644 --- a/templates/login.tpl +++ b/templates/login.tpl @@ -1,14 +1,14 @@ -$doctype - +<%- $doctype %> + -$headinclude +<%- $headinclude %> - {$bugsys->options['trackertitle']} - {@"Login"} + <%- bugdar::$options['trackertitle'] %> - <%-T("Login")%> -$header +<%- $header %>
@@ -16,23 +16,23 @@ $header
-
{@"Login"}
+
<%-T("Login")%>
-
{@"Email"}:
-
{@"Password"}:
-
{@"Remember Me"}: {@"Yes"}
+
<%-T("Email")%>:
+
<%-T("Password")%>:
+
<%-T("Remember Me")%>: <%-T("Yes")%>

- [{@"Register"}] [{@"Lost Password"}] + [<%-T("Register")%>] [<%-T("Lost Password")%>]
- - + " accesskey="s" /> + " accesskey="r" />
-$footer \ No newline at end of file +<%- $footer %> \ No newline at end of file diff --git a/templates/lostpassword.tpl b/templates/lostpassword.tpl index 9694a9f..e47c6d0 100644 --- a/templates/lostpassword.tpl +++ b/templates/lostpassword.tpl @@ -1,35 +1,35 @@ -$doctype - +<%- $doctype %> + -$headinclude +<%- $headinclude %> - {$bugsys->options['trackertitle']} - {@"Lost Password"} + <%- bugdar::$options['trackertitle'] %> - <%-T("Lost Password")%> -$header +<%- $header %>
-
{@"Lost Password Recovery"}
+
<%-T("Lost Password Recovery")%>
-
{@"The specified email could not be found or it is invalid."}
-
{@"Enter your email in the box below and you will receive a message with instructions on how to set a new password."}
-
{@"Email"}:
+ <% if ($show['lostpwerror']): %>
<%-T("The specified email could not be found or it is invalid.")%>
<% endif %> +
<%-T("Enter your email in the box below and you will receive a message with instructions on how to set a new password.")%>
+
<%-T("Email")%>:
- - + " accesskey="s" /> + " accesskey="r" />
-$footer \ No newline at end of file +<%- $footer %> \ No newline at end of file diff --git a/templates/newattach.tpl b/templates/newattach.tpl index 99e6892..e209aa6 100644 --- a/templates/newattach.tpl +++ b/templates/newattach.tpl @@ -1,63 +1,63 @@ -$doctype - +<%- $doctype %> + -$headinclude +<%- $headinclude %> - {@"New Attachment"} - $bug[summary] + <%-T("New Attachment")%> - <%- $bug['summary'] %> -$header +<%- $header %> - -
- {@"The following errors occurred"}: - {$message->errorBox} +<% if ($show['errors']): %> +
+ <%-T("The following errors occurred")%>: + <%- $message->errorBox %>
- +<% endif %>
- - + +
-
{@"New Attachment for Bug #%1$s %2$s"}
+
<%- sprintf(T('New Attachment for Bug #%1$s %2$s'), $bug['bugid'], $bug['summary']) %>
-
+
-
{@"Description"}:
+
<%-T("Description")%>:
- -
-
{@"Mark the Following Attachments Obsolete"}: - $obsoletes + <% if ($show['obsoletes']): %> +
+
<%-T("Mark the Following Attachments Obsolete")%>: + <%- $obsoletes %>
- + <% endif %> - -
-
{@"Add Comment"}: + <% if ($show['addcomment']): %> +
+
<%-T("Add Comment")%>:
- +
- + <% endif %>

- - - + " accesskey="s" /> + " accesskey="r" /> +
-$footer \ No newline at end of file +<%- $footer %> \ No newline at end of file diff --git a/templates/newreport.tpl b/templates/newreport.tpl index 61c8801..550caa8 100644 --- a/templates/newreport.tpl +++ b/templates/newreport.tpl @@ -1,103 +1,103 @@ -$doctype - +<%- $doctype %> + -$headinclude +<%- $headinclude %> - {@"New Bug Report"} - {$bugsys->options['trackertitle']} + <%-T("New Bug Report")%> - <%- bugdar::$options['trackertitle'] %> -$header +<%- $header %> - -
- {@"The following errors occurred"}: - {$message->errorBox} +<% if ($show['errors']): %> +
+ <%-T("The following errors occurred")%>: + <%- $message->errorBox %>
- +<% endif %>
-
+
- {@"Reporter"} $help[reporter] -
$reporter
+ <%-T("Reporter")%> $help[reporter] +
<%- $reporter %>
- {@"Product/Version"} $help[product] -
+ <%-T("Product/Version")%> $help[product] +
- + <% if ($show['changestatus']): %>
- {@"Status"} $help[status] -
+ <%-T("Status")%> $help[status] +
-
+ <% endif %>
- {@"Severity"} $help[severity] -
+ <%-T("Severity")%> $help[severity] +
- $customfields[left] + <%- $customfields['left'] %>
-
+
- {@"Summary"} $help[summary] -
+ <%-T("Summary")%> $help[summary] +
- + <% if ($show['assign']): %>
- {@"Assignment"} $help[assignedto] -
+ <%-T("Assignment")%> $help[assignedto] +
-
+ <% endif %> - + <% if ($show['changestatus']): %>
- {@"Resolution"} $help[resolution] -
+ <%-T("Resolution")%> $help[resolution] +
-
+ <% endif %> - + <% if ($show['changestatus']): %>
- {@"Priority"} $help[priority] -
+ <%-T("Priority")%> $help[priority] +
-
+ <% endif %> - $customfields[right] + <%- $customfields['right'] %>
@@ -108,25 +108,25 @@ $header
- {@"Description/Initial Report"} + <%-T("Description/Initial Report")%> - + -
checked="checked" /> {@"Parse Links in the Comment"}
+
in['parselinks']): %> checked="checked"<% endif %> /> <%-T("Parse Links in the Comment")%>
- - - + " accesskey="s" /> + " accesskey="r" /> + " accesskey="e" />
- + -$footer \ No newline at end of file +<%- $footer %> \ No newline at end of file diff --git a/templates/pagenav.tpl b/templates/pagenav.tpl index 9146ae9..7973744 100644 --- a/templates/pagenav.tpl +++ b/templates/pagenav.tpl @@ -1,7 +1,7 @@
- {@"First"} ... - {@"Prev"} ... -$pagebits - ... {@"Next"} - ... {@"Last"} + <% if ($show['first']): %><%-T("First")%> ...<% endif %> + <% if ($show['prev']): %><%-T("Prev")%> ...<% endif %> +<%- $pagebits %> + <% if ($show['next']): %>... <%-T("Next")%><% endif %> + <% if ($show['last']): %>... <%-T("Last")%><% endif %>
\ No newline at end of file diff --git a/templates/pagenav_bit.tpl b/templates/pagenav_bit.tpl index 5febc85..1d77a07 100644 --- a/templates/pagenav_bit.tpl +++ b/templates/pagenav_bit.tpl @@ -1 +1 @@ - $number$number \ No newline at end of file + <% if ($nolink): %><%- $number %><% else: %><%- $number %><% endif %> \ No newline at end of file diff --git a/templates/passwordreset.tpl b/templates/passwordreset.tpl index 7ce3eb2..508bd3a 100644 --- a/templates/passwordreset.tpl +++ b/templates/passwordreset.tpl @@ -1,43 +1,43 @@ -$doctype - +<%- $doctype %> + -$headinclude +<%- $headinclude %> - {$bugsys->options['trackertitle']} - {@"Reset Password"} + <%- bugdar::$options['trackertitle'] %> - <%-T("Reset Password")%> -$header +<%- $header %>
- + - -
- {@"The following errors occurred"}: - {$message->errorBox} +<% if ($show['errors']): %> +
+ <%-T("The following errors occurred")%>: + <%- $message->errorBox %>
- +<% endif %>
-
{@"Lost Password Recovery: Password Reset"}
+
<%-T("Lost Password Recovery: Password Reset")%>
-
{@"Enter a new password below and then confirm it."}
-
{@"New Password"}:
-
{@"Confirm Password"}:
+
<%-T("Enter a new password below and then confirm it.")%>
+
<%-T("New Password")%>:
+
<%-T("Confirm Password")%>:
- - + " accesskey="s" /> + " accesskey="r" />
-$footer \ No newline at end of file +<%- $footer %> \ No newline at end of file diff --git a/templates/quicksearch.tpl b/templates/quicksearch.tpl index 4c6cdd1..f5d9eab 100644 --- a/templates/quicksearch.tpl +++ b/templates/quicksearch.tpl @@ -1,32 +1,32 @@ -$doctype - +<%- $doctype %> + -$headinclude +<%- $headinclude %> - {$bugsys->options['trackertitle']} - {@"Quick Search"} + <%- bugdar::$options['trackertitle'] %> - <%-T("Quick Search")%> -$header +<%- $header %>
-
{@"Quick Search"}
+
<%-T("Quick Search")%>
-
- -
$error
-
+
+ <% if ($error): %> +
<%- $error %>
+ <% endif %>
- {@"Go to bug ID"} + <%-T("Go to bug ID")%> " />
-$footer \ No newline at end of file +<%- $footer %> \ No newline at end of file diff --git a/templates/register.tpl b/templates/register.tpl index 5eec074..63a37cd 100644 --- a/templates/register.tpl +++ b/templates/register.tpl @@ -1,46 +1,46 @@ -$doctype - +<%- $doctype %> + -$headinclude +<%- $headinclude %> - {$bugsys->options['trackertitle']} - {@"Register"} + <%- bugdar::$options['trackertitle'] %> - <%-T("Register")%> -$header +<%- $header %> - -
- {@"The following errors occurred"}: - {$message->errorBox} +<% if ($show['errors']): %> +
+ <%-T("The following errors occurred")%>: + <%- $message->errorBox %>
- +<% endif %>
-
{@"Register"}
+
<%-T("Register")%>
-
{@"Email"}:
-
{@"Confirm Email"}:
-
{@"Display Name"}:
-
{@"Password"}:
-
{@"Confirm Password"}:
-
{@"Show My Email Publicly"}: checked="checked" /> {@"Yes"}
-
{@"Language"}:
+
<%-T("Email")%>:
+
<%-T("Confirm Email")%>:
+
<%-T("Display Name")%>:
+
<%-T("Password")%>:
+
<%-T("Confirm Password")%>:
+
<%-T("Show My Email Publicly")%>: in['showemail']): %> checked="checked"<% endif %> /> <%-T("Yes")%>
+
<%-T("Language")%>:
- - + " accesskey="s" /> + " accesskey="r" />
-$footer \ No newline at end of file +<%- $footer %> \ No newline at end of file diff --git a/templates/report.css b/templates/report.css index 4ecf191..dbedb78 100644 --- a/templates/report.css +++ b/templates/report.css @@ -1,7 +1,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by diff --git a/templates/search.tpl b/templates/search.tpl index bbfcbc1..887a1c6 100644 --- a/templates/search.tpl +++ b/templates/search.tpl @@ -1,24 +1,24 @@ -$doctype - +<%- $doctype %> + -$headinclude +<%- $headinclude %> - {$bugsys->options['trackertitle']} - {@"Search"} + <%- bugdar::$options['trackertitle'] %> - <%-T("Search")%> -$header +<%- $header %> - -
-{@"Run Saved Search"}: - +<% if ($searches): %> + +<%-T("Run Saved Search")%>: + " />
-
+<% endif %> -

{@"Any fields left blank or unselected will be excluded from the search query."}

+

<%-T("Any fields left blank or unselected will be excluded from the search query.")%>

@@ -29,13 +29,13 @@ $header
- {@"Search Mode"} + <%-T("Search Mode")%>
@@ -43,41 +43,41 @@ $header
- {@"Reporter"} $help[reporter] + <%-T("Reporter")%> $help[reporter]
- {@"Product / Version"} $help[product] -
+ <%-T("Product / Version")%> $help[product] +
- {@"Status"} $help[status] -
+ <%-T("Status")%> $help[status] +
- {@"Priority"} $help[priority] -
+ <%-T("Priority")%> $help[priority] +
- {@"Date (submitted since)"} + <%-T("Date (submitted since)")%>
- {@"Sort By"} + <%-T("Sort By")%>
@@ -128,41 +128,41 @@ $header
- {@"Assignment"} $help[assignedto] -
+ <%-T("Assignment")%> $help[assignedto] +
- {@"Resolution"} $help[resolution] -
+ <%-T("Resolution")%> $help[resolution] +
- {@"Severity"} $help[severity] -
+ <%-T("Severity")%> $help[severity] +
- + <% if (bugdar::$userinfo['userid']): %>
- {@"Favorite"} + <%-T("Favorite")%>
-
+ <% endif %> - $customfields[right] + <%- $customfields['right'] %>
@@ -171,10 +171,10 @@ $header
- - + " accesskey="s" /> + " accesskey="r" />
-$footer \ No newline at end of file +<%- $footer %> \ No newline at end of file diff --git a/templates/search_results.tpl b/templates/search_results.tpl index a7e730d..d823380 100644 --- a/templates/search_results.tpl +++ b/templates/search_results.tpl @@ -1,39 +1,39 @@ -$doctype - +<%- $doctype %> + -$headinclude - {$bugsys->options['trackertitle']} - {@"Search Results"} +<%- $headinclude %> + <%- bugdar::$options['trackertitle'] %> - <%-T("Search Results")%> -$header +<%- $header %> - - - +<% if ($show['cached']): %> + +
-
+<% endif %> -$columnHeads +<%- $columnHeads %> -$bugs +<%- $bugs %>
- +<% if ($show['pagenav']): %> -
-$pagenav +
+<%- $pagenav %>
- +<% endif %> -$footer \ No newline at end of file +<%- $footer %> \ No newline at end of file diff --git a/templates/search_save.tpl b/templates/search_save.tpl index fe20921..3212e6c 100644 --- a/templates/search_save.tpl +++ b/templates/search_save.tpl @@ -1,46 +1,46 @@ -$doctype - +<%- $doctype %> + -$headinclude +<%- $headinclude %> - {$bugsys->options['trackertitle']} - {@"Save Search"} + <%- bugdar::$options['trackertitle'] %> - <%-T("Save Search")%> -$header +<%- $header %> - -
- {@"The following errors occurred"}: - {$message->errorBox} +<% if ($show['errors']): %> +
+ <%-T("The following errors occurred")%>: + <%- $message->errorBox %>
- +<% endif %>
- +
-
{@"Save Search"}
+
<%-T("Save Search")%>
- {@"You can save this search criteria for later by naming this search."} + <%-T("You can save this search criteria for later by naming this search.")%>

-
{@"Name"}:
+
<%-T("Name")%>:
- - + " accesskey="s" /> + " accesskey="r" />
-$footer \ No newline at end of file +<%- $footer %> \ No newline at end of file diff --git a/templates/search_update.tpl b/templates/search_update.tpl index 5fbcc9c..f9e2b5d 100644 --- a/templates/search_update.tpl +++ b/templates/search_update.tpl @@ -1,21 +1,21 @@ -$doctype - +<%- $doctype %> + -$headinclude +<%- $headinclude %> - {$bugsys->options['trackertitle']} - {@"Mass Update"} + <%- bugdar::$options['trackertitle'] %> - <%-T("Mass Update")%> -$header +<%- $header %> -

{@"Any fields left blank or unselected will not be changed."}

+

<%-T("Any fields left blank or unselected will not be changed.")%>

- +
@@ -23,26 +23,26 @@ $header
- {@"Product / Version"} $help[product] -
+ <%-T("Product / Version")%> $help[product] +
- {@"Status"} $help[status] -
+ <%-T("Status")%> $help[status] +
- {@"Priority"} $help[priority] -
+ <%-T("Priority")%> $help[priority] +
- $customfields[left] + <%- $customfields['left'] %>
@@ -52,41 +52,41 @@ $header
- {@"Assignment"} $help[assignedto] -
+ <%-T("Assignment")%> $help[assignedto] +
- {@"Resolution"} $help[resolution] -
+ <%-T("Resolution")%> $help[resolution] +
- {@"Severity"} $help[severity] -
+ <%-T("Severity")%> $help[severity] +
- + <% if (bugdar::$userinfo['userid']): %>
- {@"Favorite"} + <%-T("Favorite")%>
-
+ <% endif %> - $customfields[right] + <%- $customfields['right'] %>
@@ -95,10 +95,10 @@ $header
- - + " accesskey="s" /> + " accesskey="r" />
-$footer \ No newline at end of file +<%- $footer %> \ No newline at end of file diff --git a/templates/selectoptgroup.tpl b/templates/selectoptgroup.tpl index ca21403..e576fc0 100644 --- a/templates/selectoptgroup.tpl +++ b/templates/selectoptgroup.tpl @@ -1,3 +1,3 @@ - -$optbits + +<%- $optbits %> \ No newline at end of file diff --git a/templates/selectoption.tpl b/templates/selectoption.tpl index 5ee431c..41f43c0 100644 --- a/templates/selectoption.tpl +++ b/templates/selectoption.tpl @@ -1 +1 @@ -
>$label \ No newline at end of file + \ No newline at end of file diff --git a/templates/showreport.tpl b/templates/showreport.tpl index 967e4eb..33a7eac 100644 --- a/templates/showreport.tpl +++ b/templates/showreport.tpl @@ -1,181 +1,181 @@ -$doctype - +<%- $doctype %> + -$headinclude +<%- $headinclude %> - <lang 1="$bug[bugid]">{@"Bug Report %1$s"}</lang> - $bug[summary_title] + <%- sprintf(T('Bug Report %1$s'), $bug['bugid']) %> - <%- $bug['summary_title'] %> -$header +<%- $header %>
- +
-
+
- {@"Bug Id"} $help[bugid] + <%-T("Bug Id")%> $help[bugid]
- $bug[bugid] + <%- $bug['bugid'] %> - + <% if ($show['edit']): %> / - class="error">{@"Hidden"}: - checked="checked" /> - - / {@"Hidden Bug"} - - - / [{@"Show Bug History"}] - / [$favoritetext] - / [{@"Delete"}] + class="error"<% endif %>><%-T("Hidden")%>: + checked="checked"<% endif %> /> + <% else: %> + <% if ($bug['hidden']): %> / <%-T("Hidden Bug")%><% endif %> + <% endif %> + + / [<%-T("Show Bug History")%>] + <% if ($show['subscribe']): %>/ [<%- $favoritetext %>]<% endif %> + <% if ($show['delete']): %>/ [<%-T("Delete")%>]<% endif %>
- {@"Reporter"} $help[reporter] -
$bug[userinfo]
+ <%-T("Reporter")%> $help[reporter] +
<%- $bug['userinfo'] %>
- {@"Product/Version"} $help[product] -
$bug[product] / $bug[component] / $bug[version]
+ <%-T('Product/Version') %> $help[product] +
<%- $bug['product'] %> <% if ($bug['component']): %>/ <%- $bug['component'] %><% endif %> / <% if ($show['edit']): %><% else: %><%- $bug['version'] %><% endif %>
- {@"Status"} $help[status] + <%-T("Status")%> $help[status]
- - - - $bug[status] - + <% if ($show['changestatus']): %> + + <% else: %> + <%- $bug['status'] %> + <% endif %>
- {@"Severity"} $help[severity] + <%-T("Severity")%> $help[severity]
- - - - $bug[severity] - + <% if ($show['edit']): %> + + <% else: %> + <%- $bug['severity'] %> + <% endif %>
- {@"Duplicate Of"} $help[duplicateof] + <%-T("Duplicate Of")%> $help[duplicateof]
- - $bug[duplicateof]" /> - $duplicate[bugid] - - $duplicateof[summary]{@"- none -"} - + <% if ($show['edit']): %> + + <% if ($bug['duplicateof']): %><%- $duplicate['bugid'] %><% endif %> + <% else: %> + <% if ($bug['duplicateof']): %><%- $duplicateof['summary'] %><% else: %><%- T("- none -") %><% endif %> + <% endif %>
- $customfields[left] + <%- $customfields['left'] %>
-
+
- {@"Summary"} $help[summary] + <%-T("Summary")%> $help[summary]
- - - - $bug[summary] - + <% if ($show['edit']): %> + + <% else: %> + <%- $bug['summary'] %> + <% endif %>
- {@"Report Time"} $help[dateline] -
$bug[datetime]
+ <%-T("Report Time")%> $help[dateline] +
<%- $bug['datetime'] %>
- {@"Assignment"} $help[assignedto] + <%-T("Assignment")%> $help[assignedto]
- - - - $bug[assigninfo]{@"- none -"} - + <% if ($show['assign']): %> + + <% else: %> + <% if ($bug['assigninfo']): %><%- $bug['assigninfo'] %><% else: %>{@"- none -"}<% endif %> + <% endif %>
- {@"Resolution"} $help[resolution] + <%-T("Resolution")%> $help[resolution]
- - - - $bug[resolution] - + <% if ($show['changestatus']): %> + + <% else: %> + <%- $bug['resolution'] %> + <% endif %>
- {@"Priority"} $help[priority] + <%-T("Priority")%> $help[priority]
- - - - $bug[priority] - + <% if ($show['changestatus']): %> + + <% else: %> + <%- $bug['priority'] %> + <% endif %>
- {@"Dependencies"} $help[dependency] + <%-T("Dependencies")%> $help[dependency]
- - $dependencies - - $dependencies{@"- none -"} - + <% if ($show['edit']): %> + <%- $dependencies %> + <% else: %> + <% if ($dependencies): %><%- $dependencies %><% else: %><%- T("- none -") %><% endif %> + <% endif %>
- $customfields[right] + <%- $customfields['right'] %>
@@ -184,24 +184,24 @@ $header
- +<% if ($show['newreply']): %>
- {@"New Reply"} : {@"Automation"} $help[newreply] + <%-T("New Reply")%><% if ($show['automations']): %> : <%-T("Automation")%> <% endif %> $help[newreply] -
checked="checked" /> {@"Parse Links in the Comment"}
+
in['parselinks']): %>> checked="checked"<% endif %> /> <%-T("Parse Links in the Comment")%>
-
+<% endif %>
- - + " accesskey="s" /> + " accesskey="r" />
@@ -212,48 +212,48 @@ $header
- + <% if ($show['attachments']): %> -
+
- {@"Attachments"} : {@"New"} + <%-T("Attachments")%><% if ($show['putattachments']): %> : <%-T("New")%><% endif %> - $attachments + <%- $attachments %>
- + <% endif %> -
fiftyhundred"> +
- {@"Votes"} + <%-T("Votes")%> -
{@"For"}: $vote[votefor] ($vote[forpercent]%)
-
{@"Against"}: $vote[voteagainst] ($vote[againstpercent]%)
-
{@"Total"}: $vote[total]
+
<%-T("For")%>: <%- $vote['votefor'] %> (<%- $vote['forpercent'] %>%)
+
<%-T("Against")%>: <%- $vote['voteagainst'] %> (<%- $vote['againstpercent'] %>%)
+
<%-T("Total")%>: <%- $vote['total'] %>
- + <% if ($show['vote']): %>
- {@"Your Vote"} + <%-T("Your Vote")%> - - {@"Vote For (+1)"}
- {@"Vote Against (-1)"}
+ + <%-T("Vote For (+1)")%>
+ <%-T("Vote Against (-1)")%>
- + " accesskey="v" />
-
+ <% endif %>
@@ -261,6 +261,6 @@ $header
-$comments +<%- $comments %> -$footer \ No newline at end of file +<%- $footer %> \ No newline at end of file diff --git a/templates/showreport_attachment.tpl b/templates/showreport_attachment.tpl index de4a24c..042789d 100644 --- a/templates/showreport_attachment.tpl +++ b/templates/showreport_attachment.tpl @@ -1,6 +1,6 @@ diff --git a/templates/showreport_comment.tpl b/templates/showreport_comment.tpl index 4821074..8782ade 100644 --- a/templates/showreport_comment.tpl +++ b/templates/showreport_comment.tpl @@ -1,26 +1,26 @@ - +
-
- $comment[posttime] - $comment[postby] +
+ <%- $comment['posttime'] %> + <%- $comment['postby'] %>
-
- $comment[comment_parsed] +
+ <%- $comment['comment_parsed'] %>
- -
- - [{@"Delete"}] - [{@"Edit Comment"}] + <% if ($show['editcomment']): %> +
+ + <% if ($show['delete']): %>[<%-T("Delete")%>]<% endif %> + [<%-T("Edit Comment")%>] - {@"Hidden"}{@"Visible"} + <% if ($comment['hidden']): %><%-T("Hidden")%><% else: %><%-T("Visible")%><% endif %>
- + <% endif %>
- +
diff --git a/templates/std_error.tpl b/templates/std_error.tpl index d821a31..7af0fca 100644 --- a/templates/std_error.tpl +++ b/templates/std_error.tpl @@ -1,23 +1,23 @@ -$doctype - +<%- $doctype %> + -$headinclude +<%- $headinclude %> - {$bugsys->options['trackertitle']} - {@"Error"} + <%- bugdar::$options['trackertitle'] %> - <%-T("Error")%> -$header +<%- $header %>
-
{@"Error"}
+
<%-T("Error")%>
-
- $error +
+ <%- $error %>
-$footer \ No newline at end of file +<%- $footer %> \ No newline at end of file diff --git a/templates/std_message.tpl b/templates/std_message.tpl index 1b7afaa..be392e8 100644 --- a/templates/std_message.tpl +++ b/templates/std_message.tpl @@ -1,43 +1,43 @@ -$doctype - +<%- $doctype %> + -$headinclude +<%- $headinclude %> - {$bugsys->options['trackertitle']} - <if condition="$show['confirm']">{@"Confirm"}<else />{@"Notice"}</if> + <%- bugdar::$options['trackertitle'] %> - <% if ($show['confirm']): %><%-T("Confirm")%><% else: %><%-T("Notice")%><% endif %> -$header +<%- $header %> - -
- -$extra - +<% if ($show['confirm']): %> + + +<%- $extra %> +<% endif %>
-
{@"Confirm"}{@"Notice"}
+
<% if ($show['confirm']): %><%-T("Confirm")%><% else: %><%-T("Notice")%><% endif %>
-
- $message +
+ <%- $message %> - + <% if ($show['confirm']): %>

- - + +
-
+ <% endif %>
- +<% if ($show['confirm']): %> - +<% endif %> -$footer \ No newline at end of file +<%- $footer %> \ No newline at end of file diff --git a/templates/std_redirect.tpl b/templates/std_redirect.tpl index 22276f5..1cd2f21 100644 --- a/templates/std_redirect.tpl +++ b/templates/std_redirect.tpl @@ -1,29 +1,29 @@ -$doctype - +<%- $doctype %> + -$headinclude +<%- $headinclude %> - - {$bugsys->options['trackertitle']} - {@"Redirect..."} + + <%- bugdar::$options['trackertitle'] %> - <%-T("Redirect...")%> -$header +<%- $header %>
-$footer \ No newline at end of file +<%- $footer %> \ No newline at end of file diff --git a/templates/trackerhome.tpl b/templates/trackerhome.tpl index f446a41..cb076e9 100644 --- a/templates/trackerhome.tpl +++ b/templates/trackerhome.tpl @@ -1,26 +1,26 @@ -$doctype - +<%- $doctype %> + -$headinclude - {$bugsys->options['trackertitle']} - {@"Bug Listing"} +<%- $headinclude %> + <%- bugdar::$options['trackertitle'] %> - <%-T("Bug Listing")%> -$header +<%- $header %> - $columnHeads -$bugs + <%- $columnHeads %> +<%- $bugs %>
- +<% if ($show['pagenav']): %> -
-$pagenav +
+<%- $pagenav %>
- +<% endif %> -$footer \ No newline at end of file +<%- $footer %> \ No newline at end of file diff --git a/templates/trackerhome_bits.tpl b/templates/trackerhome_bits.tpl index 5ec5db5..2a11c25 100644 --- a/templates/trackerhome_bits.tpl +++ b/templates/trackerhome_bits.tpl @@ -1,6 +1,6 @@ - - style="background-color: $bug[bgcolor]; font-style: italic" class="$bug[bgcolor]" style="font-style: italic"> -$fields + + style="background-color: <%- $bug['bgcolor'] %><% if ($bug['hidden']): %>; font-style: italic<% endif %>"<% else: %> class="<%- $bug['bgcolor'] %>"<% if ($bug['hidden']): %> style="font-style: italic"<% endif %><% endif %>> +<%- $fields %> - + diff --git a/templates/userctrl.tpl b/templates/userctrl.tpl index 8c4fc62..3831244 100644 --- a/templates/userctrl.tpl +++ b/templates/userctrl.tpl @@ -1,66 +1,66 @@ -$doctype - +<%- $doctype %> + -$headinclude +<%- $headinclude %> - {$bugsys->options['trackertitle']} - {@"User Options"} + <%- bugdar::$options['trackertitle'] %> - <%-T("User Options")%> -$header +<%- $header %>
- -
- {@"The following errors occurred"}: - {$message->errorBox} +<% if ($show['errors']): %> +
+ <%-T("The following errors occurred")%>: + <%- $message->errorBox %>
- +<% endif %> - - + + \ No newline at end of file diff --git a/templates/userctrl_search.tpl b/templates/userctrl_search.tpl index aa7b50d..8f77d66 100644 --- a/templates/userctrl_search.tpl +++ b/templates/userctrl_search.tpl @@ -1,7 +1,7 @@
- - [{@"Run Search"}] - [{@"Delete"}] + + [<%-T("Run Search")%>] + [<%-T("Delete")%>] - $search[name] + <%- $search['name'] %>
\ No newline at end of file diff --git a/templates/username_display.tpl b/templates/username_display.tpl index a42ef53..73abcfe 100644 --- a/templates/username_display.tpl +++ b/templates/username_display.tpl @@ -1 +1 @@ -{@"User ID: %1$s"}">$userinfo[displayname]$userinfo[displayname] \ No newline at end of file +<% if ($userinfo['showemail']): %><%- $userinfo['displayname'] %><% else: %><%- $userinfo['displayname'] %><% endif %> \ No newline at end of file diff --git a/userctrl.php b/userctrl.php index 100e17f..c973f86 100644 --- a/userctrl.php +++ b/userctrl.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -25,26 +25,22 @@ $fetchtemplates = array( 'userctrl_search' ); -define('SVN', '$Id$'); $focus['user'] = 'focus'; require_once('./global.php'); -require_once('./includes/class_api_error.php'); require_once('./includes/api_user.php'); -APIError(array(new API_Error_Handler($message), 'user_cumulative')); - -if (!$bugsys->userinfo['userid']) +if (!bugdar::$userinfo['userid']) { $message->errorPermission(); } -$userapi = new UserAPI($bugsys); -$userapi->set('userid', $bugsys->userinfo['userid']); -$userapi->set_condition(); +$userapi = new UserAPI(); +$userapi->set('userid', bugdar::$userinfo['userid']); +$userapi->setCondition(); -$userinfo = $bugsys->userinfo; +$userinfo = bugdar::$userinfo; // ################################################################### @@ -57,13 +53,13 @@ if (empty($_REQUEST['do'])) if ($_POST['do'] == 'killsearch') { - $search = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "search WHERE searchid = " . $bugsys->input_clean('searchid', TYPE_UINT) . " AND userid = " . $bugsys->userinfo['userid']); + $search = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "search WHERE searchid = " . $input->inputClean('searchid', TYPE_UINT) . " AND userid = " . bugdar::$userinfo['userid']); if (!$search) { $message->errorPermission(); } - $db->query("DELETE FROM " . TABLE_PREFIX . "search WHERE searchid = " . $bugsys->in['searchid']); + $db->query("DELETE FROM " . TABLE_PREFIX . "search WHERE searchid = " . $input->in['searchid']); $message->redirect(T('This saved search has been removed from your list.'), 'userctrl.php'); } @@ -72,13 +68,13 @@ if ($_POST['do'] == 'killsearch') if ($_REQUEST['do'] == 'deletesearch') { - $search = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "search WHERE searchid = " . $bugsys->input_clean('searchid', TYPE_UINT) . " AND userid = " . $bugsys->userinfo['userid']); + $search = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "search WHERE searchid = " . $input->inputClean('searchid', TYPE_UINT) . " AND userid = " . bugdar::$userinfo['userid']); if (!$search) { $message->errorPermission(); } - $message->confirm(T('Are you sure you want to delete this saved search?'), 'userctrl.php', 'killsearch', T('Delete'), T('Cancel'), array('searchid' => $bugsys->in['searchid'])); + $message->confirm(T('Are you sure you want to delete this saved search?'), 'userctrl.php', 'killsearch', T('Delete'), T('Cancel'), array('searchid' => $input->in['searchid'])); } // ################################################################### @@ -87,15 +83,15 @@ if ($_POST['do'] == 'update') { // ------------------------------------------------------------------- // authentication - if (!empty($bugsys->in['password_change']) OR !empty($bugsys->in['email_change'])) + if (!empty($input->in['password_change']) OR !empty($input->in['email_change'])) { - if (empty($bugsys->in['validate'])) + if (empty($input->in['validate'])) { $message->addError(T('You need to enter your current password to change your email or password')); } else { - if (md5(md5($bugsys->in['validate']) . md5($bugsys->userinfo['salt'])) != $bugsys->userinfo['password']) + if (md5(md5($input->in['validate']) . md5(bugdar::$userinfo['salt'])) != bugdar::$userinfo['password']) { $message->addError(T('Your authentication password does not match the one in our records')); } @@ -104,66 +100,66 @@ if ($_POST['do'] == 'update') // ------------------------------------------------------------------- // email validation - if (!empty($bugsys->in['email_change'])) + if (!empty($input->in['email_change'])) { - if (!empty($bugsys->in['email_change']) AND empty($bugsys->in['email_confirm'])) + if (!empty($input->in['email_change']) AND empty($input->in['email_confirm'])) { $message->addError(T('You need to enter both the email and confirm email fields to change your address')); } - if ($bugsys->in['email_change'] != $bugsys->in['email_confirm']) + if ($input->in['email_change'] != $input->in['email_confirm']) { $message->addError(T('Your email and confirm email addresses do not match')); } - $userapi->set('email', $bugsys->in['email_change']); + $userapi->set('email', $input->in['email_change']); } // ------------------------------------------------------------------- // password validation - if (!empty($bugsys->in['password_change'])) + if (!empty($input->in['password_change'])) { - if (!empty($bugsys->in['password_change']) AND empty($bugsys->in['password_confirm'])) + if (!empty($input->in['password_change']) AND empty($input->in['password_confirm'])) { $message->addError(T('You need to enter both the password and confirm password fields to change your password')); } else { - if ($bugsys->in['password_change'] != $bugsys->in['password_confirm']) + if ($input->in['password_change'] != $input->in['password_confirm']) { $message->addError(T('Your password and confirm password do not match')); } } - $userapi->set('password', $bugsys->in['password_change']); + $userapi->set('password', $input->in['password_change']); } - $userapi->set('displayname', $bugsys->in['displayname']); - $userapi->set('showemail', $bugsys->in['showemail']); - $userapi->set('showcolors', $bugsys->in['showcolors']); - $userapi->set('languageid', $bugsys->in['languageid']); - $userapi->set('timezone', $bugsys->in['timezone']); - $userapi->set('usedst', $bugsys->in['usedst']); - $userapi->set('hidestatuses', $bugsys->in['hidestatuses']); - $userapi->set('defaultsortkey', $bugsys->in['defaultsortkey']); - $userapi->set('defaultsortas', $bugsys->in['defaultsortas']); - $userapi->set('columnoptions', $bugsys->input_clean('columnoptions', TYPE_UINT)); + $userapi->set('displayname', $input->in['displayname']); + $userapi->set('showemail', $input->in['showemail']); + $userapi->set('showcolors', $input->in['showcolors']); + $userapi->set('languageid', $input->in['languageid']); + $userapi->set('timezone', $input->in['timezone']); + $userapi->set('usedst', $input->in['usedst']); + $userapi->set('hidestatuses', $input->in['hidestatuses']); + $userapi->set('defaultsortkey', $input->in['defaultsortkey']); + $userapi->set('defaultsortas', $input->in['defaultsortas']); + $userapi->set('columnoptions', $input->inputClean('columnoptions', TYPE_UINT)); // ------------------------------------------------------------------- // copy fields - $userinfo['displayname'] = $bugsys->in['displayname']; - $userinfo['showemail'] = $bugsys->in['showemail']; - $userinfo['showcolors'] = $bugsys->in['showcolors']; - $userinfo['languageid'] = $bugsys->in['languageid']; - $userinfo['timezone'] = $bugsys->in['timezone']; - $userinfo['usedst'] = $bugsys->in['usedst']; - $userinfo['hidestatuses'] = $bugsys->in['hidestatuses']; - $userinfo['defaultsorkey'] = $bugsys->in['defaultsorkey']; - $userinfo['defaultsortas'] = $bugsys->in['defaultsortas']; - $userinfo['columnoptions'] = $bugsys->in['columnoptions']; + $userinfo['displayname'] = $input->in['displayname']; + $userinfo['showemail'] = $input->in['showemail']; + $userinfo['showcolors'] = $input->in['showcolors']; + $userinfo['languageid'] = $input->in['languageid']; + $userinfo['timezone'] = $input->in['timezone']; + $userinfo['usedst'] = $input->in['usedst']; + $userinfo['hidestatuses'] = $input->in['hidestatuses']; + $userinfo['defaultsorkey'] = $input->in['defaultsorkey']; + $userinfo['defaultsortas'] = $input->in['defaultsortas']; + $userinfo['columnoptions'] = $input->in['columnoptions']; - $email = $bugsys->in['email_change']; - $email_confirm = $bugsys->in['email_confirm']; + $email = $input->in['email_change']; + $email_confirm = $input->in['email_confirm']; // ------------------------------------------------------------------- // error handling @@ -176,11 +172,11 @@ if ($_POST['do'] == 'update') { $userapi->update(); - $db->query("DELETE FROM " . TABLE_PREFIX . "useremail WHERE userid = " . $bugsys->userinfo['userid']); - $bugsys->input_clean('emailopts', TYPE_INT); - if (is_array($bugsys->in['emailopts'])) + $db->query("DELETE FROM " . TABLE_PREFIX . "useremail WHERE userid = " . bugdar::$userinfo['userid']); + $input->inputClean('emailopts', TYPE_INT); + if (is_array($input->in['emailopts'])) { - foreach ($bugsys->in['emailopts'] AS $relation => $bitarr) + foreach ($input->in['emailopts'] AS $relation => $bitarr) { $bitmask = 0; if (is_array($bitarr)) @@ -190,7 +186,7 @@ if ($_POST['do'] == 'update') $bitmask += $option * $yes; } } - $db->query("INSERT INTO " . TABLE_PREFIX . "useremail (userid, relation, mask) VALUES (" . $bugsys->userinfo['userid'] . ", $relation, $bitmask)"); + $db->query("INSERT INTO " . TABLE_PREFIX . "useremail (userid, relation, mask) VALUES (" . bugdar::$userinfo['userid'] . ", $relation, $bitmask)"); } } @@ -205,26 +201,31 @@ if ($_REQUEST['do'] == 'modify') $langselect = construct_datastore_select('language', 'title', 'languageid', $userinfo['languageid']); $hidestatuses = construct_datastore_select('status', 'status', 'statusid', (!is_array($userinfo['hidestatuses']) ? explode(',', $userinfo['hidestatuses']) : $userinfo['hidestatuses']), 0); - $hidestatusesnum = (sizeof($bugsys->datastore['status']) < 8 ? sizeof($bugsys->datastore['status']) + 1 : 8); + $hidestatusesnum = (sizeof(bugdar::$datastore['status']) < 8 ? sizeof(bugdar::$datastore['status']) + 1 : 8); $defaultsortkey = construct_option_select('defaultsortkey', ListSorter::fetch_by_text(false), $userinfo['defaultsortkey']); $defaultsortas = construct_option_select('defaultsortas', ListSorter::fetch_as_text(false), $userinfo['defaultsortas']); - foreach ($datef->fetch_timezone_list() AS $value => $label) + foreach ($datef->fetch_timezone_list() as $value => $label) { - $selected = ($value == $userinfo['timezone']); - eval('$tzselect .= "' . $template->fetch('selectoption') . '";'); + $tpl = new BSTemplate('selectoption'); + $tpl->vars = array( + 'value' => $value, + 'label' => $label, + 'selected' => ($value == $userinfo['timezone']) + ); + $tzselect .= $tpl->evaluate()->getTemplate(); } $checked = array(); - if (!is_array($bugsys->in['emailopts'])) + if (!is_array($input->in['emailopts'])) { - $options = $db->query("SELECT * FROM " . TABLE_PREFIX . "useremail WHERE userid = " . $bugsys->userinfo['userid']); - while ($opt = $db->fetch_array($options)) + $options = $db->query("SELECT * FROM " . TABLE_PREFIX . "useremail WHERE userid = " . bugdar::$userinfo['userid']); + foreach ($options as $opt) { - foreach ($bugsys->emailoptions['notifications'] AS $name => $notif) + foreach (bugdar::$emailOptions['notifications'] AS $name => $notif) { - foreach ($bugsys->emailoptions['relations'] AS $name => $relation) + foreach (bugdar::$emailOptions['relations'] AS $name => $relation) { if ($opt['mask'] & $notif AND $opt['relation'] == $relation) { @@ -236,7 +237,7 @@ if ($_REQUEST['do'] == 'modify') } else { - $checked = $bugsys->in['emailopts']; + $checked = $input->in['emailopts']; foreach ($checked AS $key1 => $value1) { foreach ($value1 AS $key2 => $value2) @@ -252,45 +253,66 @@ if ($_REQUEST['do'] == 'modify') $columns = array(); $columnOptions = ''; require_once('./includes/class_sort.php'); - if (!is_array($bugsys->in['columnoptions'])) + if (!is_array($input->in['columnoptions'])) { foreach (ListSorter::fetch_by_text(false) AS $column => $name) { - if (is_array($bugsys->userinfo['columnoptions'])) + if (is_array(bugdar::$userinfo['columnoptions'])) { - $columns["$column"] = $bugsys->userinfo['columnoptions']["$column"]; + $columns["$column"] = bugdar::$userinfo['columnoptions']["$column"]; } else { - $columns["$column"] = $bugsys->options['columnoptions']["$column"]; + $columns["$column"] = bugdar::$options['columnoptions']["$column"]; } - eval('$columnOptions .= "' . $template->fetch('userctrl_column') . '";'); + $tpl = new BSTemplate('userctrl_column'); + $tpl->vars = array( + 'columns' => $columns, + 'column' => $column, + 'name' => $name + ); + $columnOptions .= $tpl->evaluate()->getTemplate(); } } else { - $columns = $bugsys->in['columnoptions']; - foreach (ListSorter::fetch_by_text(false) AS $column => $name) + $columns = $input->in['columnoptions']; + foreach (ListSorter::fetch_by_text(false) as $column => $name) { - eval('$columnOptions .= "' . $template->fetch('userctrl_column') . '";'); + $tpl = new BSTemplate('userctrl_column'); + $tpl->vars = array( + 'columns' => $columns, + 'column' => $column, + 'name' => $name + ); + $columnOptions .= $tpl->evaluate()->getTemplate(); } } // searches $searches = ''; - $searchesFetch = $db->query("SELECT * FROM " . TABLE_PREFIX . "search WHERE name IS NOT NULL AND userid = " . $bugsys->userinfo['userid']); - while ($search = $db->fetch_array($searchesFetch)) + $searchesFetch = $db->query("SELECT * FROM " . TABLE_PREFIX . "search WHERE name IS NOT NULL AND userid = " . bugdar::$userinfo['userid']); + foreach ($searchesFetch as $search) { - eval('$searches .= "' . $template->fetch('userctrl_search') . '";'); + $tpl = new BSTemplate('userctrl_search'); + $tpl->vars = array('search' => $search); + $searches .= $tpl->evaluate()->getTemplate(); } - eval('$template->flush("' . $template->fetch('userctrl') . '");'); + $tpl = new BSTemplate('userctrl'); + $tpl->vars = array( + 'checked' => $checked, + 'userinfo' => $userinfo, + 'searches' => $searches, + 'defaultsortkey' => $defaultsortkey, + 'hidestatusesnum' => $hidestatusesnum, + 'hidestatuses' => $hidestatuses, + 'defaultsortas' => $defaultsortas, + 'columnOptions' => $columnOptions, + 'langselect' => $langselect, + 'tzselect' => $tzselect + ); + $tpl->evaluate()->flush(); } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/viewattachment.php b/viewattachment.php index 8548999..05eeb6d 100755 --- a/viewattachment.php +++ b/viewattachment.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -21,19 +21,18 @@ ob_start(); -define('SVN', '$Id$'); $focus['showreport'] = 'focus'; require_once('./global.php'); -$attachment = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "attachment WHERE attachmentid = " . $bugsys->input_clean('attachmentid', TYPE_UINT)); +$attachment = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "attachment WHERE attachmentid = " . $input->inputClean('attachmentid', TYPE_UINT)); if (!$attachment) { $message->error(L_INVALID_ID); } -$bug = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = $attachment[bugid]"); +$bug = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = $attachment[bugid]"); if (!check_bug_permissions($bug)) { $message->errorPermission(); @@ -48,7 +47,7 @@ ob_clean(); ob_end_clean(); // only allow certain images to be displayed inline because all other types are a potential XSS issue waiting to happen -if (in_array(strtolower($funct->fetch_extension($attachment['filename'])), array('jpg', 'jpeg', 'png', 'gif'))) +if (in_array(strtolower(BSFunctions::fetch_extension($attachment['filename'])), array('jpg', 'jpeg', 'png', 'gif'))) { header("Content-Disposition: inline; filename=$attachment[filename]"); header("Content-transfer-encoding: binary"); @@ -62,10 +61,4 @@ header("Content-Type: $attachment[mimetype]"); print($attachment['attachment']); -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file diff --git a/vote.php b/vote.php index 7c35db3..129c1a0 100644 --- a/vote.php +++ b/vote.php @@ -2,7 +2,7 @@ /*=====================================================================*\ || ################################################################### || # Bugdar -|| # Copyright ©2002-2007 Blue Static +|| # Copyright (c)2004-2008 Blue Static || # || # This program is free software; you can redistribute it and/or modify || # it under the terms of the GNU General Public License as published by @@ -19,7 +19,6 @@ || ################################################################### \*=====================================================================*/ -define('SVN', '$Id$'); $focus['showreport'] = 'focus'; @@ -36,8 +35,8 @@ if (empty($_REQUEST['do'])) if ($_REQUEST['do'] == 'vote') { - $bug = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = " . $bugsys->input_clean('bugid', TYPE_UINT)); - $vote = $db->query_first("SELECT *, FIND_IN_SET(" . $bugsys->userinfo['userid'] . ", userids) AS uservote FROM " . TABLE_PREFIX . "vote WHERE bugid = $bug[bugid]"); + $bug = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = " . $input->inputClean('bugid', TYPE_UINT)); + $vote = $db->queryFirst("SELECT *, FIND_IN_SET(" . bugdar::$userinfo['userid'] . ", userids) AS uservote FROM " . TABLE_PREFIX . "vote WHERE bugid = $bug[bugid]"); if (!check_bug_permissions($bug)) { @@ -61,19 +60,19 @@ if ($_REQUEST['do'] == 'vote') // handle userids $userids = $vote['userids']; - if ($bugsys->userinfo['userid']) + if (bugdar::$userinfo['userid']) { if (trim($vote['userids'])) { - $userids .= ',' . $bugsys->userinfo['userid']; + $userids .= ',' . bugdar::$userinfo['userid']; } else { - $userids = $bugsys->userinfo['userid']; + $userids = bugdar::$userinfo['userid']; } } - $uservote = $bugsys->input_clean('vote', TYPE_INT); + $uservote = $input->inputClean('vote', TYPE_INT); $votefor = $vote['votefor']; $voteagainst = $vote['voteagainst']; @@ -96,10 +95,4 @@ if ($_REQUEST['do'] == 'vote') $message->redirect(T('Your vote has been added.'), "showreport.php?bugid=$bug[bugid]"); } -/*=====================================================================*\ -|| ################################################################### -|| # $HeadURL$ -|| # $Id$ -|| ################################################################### -\*=====================================================================*/ ?> \ No newline at end of file -- 2.43.5
-
{@"User Options"}
+
<%-T("User Options")%>
- + <% if (bugdar::$options['authmethod'] == 'default'): %>
- {@"Display Name"} - + <%-T("Display Name")%> +
-
+ <% endif %>
- {@"Show Email Publicly"} - checked="checked" /> {@"Yes"} - checked="checked" /> {@"No"} + <%-T("Show Email Publicly")%> + checked="checked"<% endif %> /> <%-T("Yes")%> + checked="checked"<% endif %> /> <%-T("No")%>
- {@"Show Status Colors on Bug Listings"} - checked="checked" /> {@"Yes"} - checked="checked" /> {@"No"} + <%-T("Show Status Colors on Bug Listings")%> + checked="checked"<% endif %> /> <%-T("Yes")%> + checked="checked"<% endif %> /> <%-T("No")%>
- {@"Language"} - + <%-T("Language")%> +
- {@"Timezone"} - + <%-T("Timezone")%> +
- {@"Observe Daylight Savings Time (DST)"} - checked="checked" /> {@"Yes, I'm currently observing DST"} + <%-T("Observe Daylight Savings Time (DST)")%> + checked="checked"<% endif %> /> <%-T("Yes, I'm currently observing DST")%>
@@ -70,72 +70,72 @@ $header
-
{@"Email Options"}
+
<%-T("Email Options")%>
- - - - - + + + + + - - + + - - + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + +
 {@"Reporter"}{@"Assignee"}{@"Favorite"}{@"Voter"}{@"Commenter"}<%-T("Reporter")%><%-T("Assignee")%><%-T("Favorite")%><%-T("Voter")%><%-T("Commenter")%>
{@"New bug is added"}<%-T("New bug is added")%> value="1" />
{@"I am made the assignee"}<%-T("I am made the assignee")%> value="1" />
{@"Status or resolution changes"}<%-T("Status or resolution changes")%> value="1" /> value="1" /> value="1" /> value="1" /> value="1" />
{@"'Duplicates' field is changed"}<%-T("'Duplicates' field is changed")%> value="1" /> value="1" /> value="1" /> value="1" /> value="1" />
{@"A new comment is added"}<%-T("A new comment is added")%> value="1" /> value="1" /> value="1" /> value="1" /> value="1" />
{@"A new attachment is added"}<%-T("A new attachment is added")%> value="1" /> value="1" /> value="1" /> value="1" /> value="1" />
{@"Any other field changes"}<%-T("Any other field changes")%> value="1" /> value="1" /> value="1" /> value="1" /> value="1" />
@@ -144,25 +144,25 @@ $header
- + <% if ($searches): %>
-
{@"Saved Searches"}
+
<%-T("Saved Searches")%>
- $searches + <%- $searches %>
-
+ <% endif %>
- + <% if (bugdar::$options['authmethod'] == 'default'): %>
-
- {@"Please enter your password to change these fields"}: +
+ <%-T("Please enter your password to change these fields")%>:
@@ -170,57 +170,57 @@ $header
- {@"Password"} + <%-T("Password")%>
- {@"Confirm Password"} + <%-T("Confirm Password")%>
- {@"Email"} - + <%-T("Email")%> +
- {@"Confirm Email"} - + <%-T("Confirm Email")%> +

- + <% endif %>
-
{@"Bug List Display Options"}
+
<%-T("Bug List Display Options")%>
- {@"Hidden Statuses on Bug Listing"} - + <%-T("Hidden Statuses on Bug Listing")%> +
- {@"Default Sort Order Column"} - $defaultsortkey + <%-T("Default Sort Order Column")%> + <%- $defaultsortkey %>
- {@"Default Sort Order Direction"} - $defaultsortas + <%-T("Default Sort Order Direction")%> + <%- $defaultsortas %>
- {@"Bug List Columns"} $help[columnorder] + <%-T("Bug List Columns")%> $help[columnorder] - $columnOptions + <%- $columnOptions %>
@@ -233,8 +233,8 @@ $header
- - + " accesskey="s" /> + " accesskey="r" />
diff --git a/templates/userctrl_column.tpl b/templates/userctrl_column.tpl index e769cf0..36f5e38 100644 --- a/templates/userctrl_column.tpl +++ b/templates/userctrl_column.tpl @@ -1,4 +1,4 @@
$name:<%- $name %>: