Squash-merging the ISSO3 branch back onto master
authorRobert Sesek <rsesek@bluestatic.org>
Wed, 17 Sep 2008 14:44:16 +0000 (10:44 -0400)
committerRobert Sesek <rsesek@bluestatic.org>
Wed, 17 Sep 2008 14:44:16 +0000 (10:44 -0400)
166 files changed:
admin/automation.php
admin/field.php
admin/global.php
admin/index.php
admin/language.php
admin/permission.php
admin/priority.php
admin/product.php
admin/resolution.php
admin/setting.php
admin/severity.php
admin/status.php
admin/user.php
admin/usergroup.php
admin/userhelp.php
attachment.php
docs/cache_templates.php
docs/datatools.php
docs/dev_phases_2-0.txt [new file with mode: 0644]
docs/mailtest.php
docs/migrate_custom_fields.php
docs/populate.php
docs/post-commit.php
docs/systemglob.php
docs/update_bug_names.php
docs/update_bug_table_cache.php
docs/update_field_order_in_bugs.php
docs/update_history.php
editcomment.php
editreport.php
explain.php
favorite.php
global.php
help.php
includes/api_attachment.php
includes/api_automation.php
includes/api_bug.php
includes/api_comment.php
includes/api_field.php
includes/api_language.php
includes/api_priority.php
includes/api_resolution.php
includes/api_severity.php
includes/api_status.php
includes/api_user.php
includes/api_usergroup.php
includes/api_userhelp.php
includes/auth/auth.php
includes/auth/auth_default.php
includes/auth/auth_drupal.php
includes/auth/auth_phpbb2.php
includes/auth/auth_vbulletin.php
includes/class_admin_navigation.php
includes/class_api_error.php [deleted file]
includes/class_logging.php
includes/class_message_reporter.php
includes/class_mo.php
includes/class_notification.php
includes/class_sort.php
includes/config.php.new
includes/emails.php [new file with mode: 0644]
includes/framework
includes/functions.php
includes/functions_datastore.php
includes/functions_product.php
includes/init.php
includes/language.php
includes/pagination.php [new file with mode: 0644]
includes/permissions.php
includes/version.php
index.php
install/convert_database_charset.php
install/default_data.php
install/global.php
install/install.css
install/install.php
install/schema.php
install/settings.php
install/upgrade.php
install/upgrade1.php
install/upgrade10.php
install/upgrade11.php
install/upgrade12.php
install/upgrade13.php
install/upgrade14.php
install/upgrade15.php
install/upgrade16.php
install/upgrade17.php
install/upgrade2.php
install/upgrade3.php
install/upgrade4.php
install/upgrade5.php
install/upgrade6.php
install/upgrade7.php
install/upgrade8.php
install/upgrade9.php
locale/en_US/emails/accountapproved.xml.tpl
locale/en_US/emails/activateaccount.xml.tpl
locale/en_US/emails/bugnotification.xml.tpl
locale/en_US/emails/notice_attachment.part.tpl
locale/en_US/emails/notice_priority.part.tpl
locale/en_US/emails/notice_resolution.part.tpl
locale/en_US/emails/notice_severity.part.tpl
locale/en_US/emails/notice_status.part.tpl
locale/en_US/emails/passwordreset.xml.tpl
locale/en_US/emails/welcome.xml.tpl
login.php
newreport.php
register.php
search.php
showhistory.php
showreport.php
syndicate.php
templates/box.css
templates/bugfield_input_checkbox.tpl
templates/bugfield_input_text.tpl
templates/bugfield_select_single.tpl
templates/bugfield_static_text.tpl
templates/editattach.tpl
templates/editcomment.tpl
templates/explain_automation.tpl
templates/explain_product.tpl
templates/explain_row.tpl
templates/favorites.tpl
templates/fields.css
templates/footer.tpl
templates/global.css
templates/global.js
templates/header.tpl
templates/headinclude.tpl
templates/help_link.tpl
templates/help_window.tpl
templates/history.tpl
templates/history_bit.tpl
templates/list_head.tpl
templates/login.tpl
templates/lostpassword.tpl
templates/newattach.tpl
templates/newreport.tpl
templates/pagenav.tpl
templates/pagenav_bit.tpl
templates/passwordreset.tpl
templates/quicksearch.tpl
templates/register.tpl
templates/report.css
templates/search.tpl
templates/search_results.tpl
templates/search_save.tpl
templates/search_update.tpl
templates/selectoptgroup.tpl
templates/selectoption.tpl
templates/showreport.tpl
templates/showreport_attachment.tpl
templates/showreport_comment.tpl
templates/std_error.tpl
templates/std_message.tpl
templates/std_redirect.tpl
templates/trackerhome.tpl
templates/trackerhome_bits.tpl
templates/userctrl.tpl
templates/userctrl_column.tpl
templates/userctrl_search.tpl
templates/username_display.tpl
userctrl.php
viewattachment.php
vote.php

index 5d1ea04749d350624168d23317815169ddb8d957..16e8739702cfe687f67326f517a5ce33bcbb2ed7 100644 (file)
@@ -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<div class=\"smallfont\">$action[description]</div>", "<a href=\"automation.php?do=edit&amp;actionid=$action[actionid]\">[" . T('Edit') . "]</a> <a href=\"automation.php?do=delete&amp;actionid=$action[actionid]\">[" . T('Delete') . "]</a>");
        }
@@ -230,10 +229,4 @@ if ($_REQUEST['do'] == 'modify')
        $admin->page_end();
 }
 
-/*=====================================================================*\
-|| ###################################################################
-|| # $HeadURL$
-|| # $Id$
-|| ###################################################################
-\*=====================================================================*/
 ?>
\ No newline at end of file
index c27f40c204339b4503533a85ef70376c1eec5524..04e1fd86dd79e13cc53092a18c732af776511854 100644 (file)
@@ -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
index 89eacdfd7877e1c5e2dd96d8dc7b2be90dc369fb..9ba31175aa181f1a967bffa4441f2a9c79460bb7 100755 (executable)
@@ -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 '<div style="margin-top: 15px; float: ' . $stylevar['right'] . '">' . $return . '</div>';
 }
 
-/*=====================================================================*\
-|| ###################################################################
-|| # $HeadURL$
-|| # $Id$
-|| ###################################################################
-\*=====================================================================*/
 ?>
\ No newline at end of file
index 4375764e48da58d76adc2a9c6466289039cd621b..10d1d24eda971626737b493745ee2b101d8b6629 100755 (executable)
@@ -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, '<version-check>') !== false)
        {
                $check = $bugsys->xml->parse($check);
                if (isset($check['version-check']['update']))
                {
-                       $admin->page_code('<div style="background-color: white; border-color: red; border-width: 2px; border-style: solid; color: red; padding: 4px"><div style="font-size: 18px; font-weight: bold">' . T('Update Avaliable') . ':</div>' . sprintf(T('Your installation of Bugdar is out-of-date. You are running version <strong>%1$s</strong> and the latest version is <strong>%2$s</strong>. You can download the update at <a href="http://www.bluestatic.org">Blue Static\'s website</a>. 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']) . '</div>');
+                       $admin->page_code('<div style="background-color: white; border-color: red; border-width: 2px; border-style: solid; color: red; padding: 4px"><div style="font-size: 18px; font-weight: bold">' . T('Update Avaliable') . ':</div>' . sprintf(T('Your installation of Bugdar is out-of-date. You are running version <strong>%1$s</strong> and the latest version is <strong>%2$s</strong>. You can download the update at <a href="http://www.bluestatic.org">Blue Static\'s website</a>. 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']) . '</div>');
                }
                else if (isset($check['version-check']['up-to-date']))
                {
-                       $admin->page_code('<div style="background-color: white; border-color: green; border-width: 2px; border-style: solid; color: green; padding: 4px"><div style="font-size: 18px; font-weight: bold">' . T('Up-to-Date') . ':</div>' . sprintf(T('Your installation of Bugdar is up-to-date. You are running version <strong>%1$s</strong>.'), $bugsys->options['trackerversion']) . '</div>');
+                       $admin->page_code('<div style="background-color: white; border-color: green; border-width: 2px; border-style: solid; color: green; padding: 4px"><div style="font-size: 18px; font-weight: bold">' . T('Up-to-Date') . ':</div>' . sprintf(T('Your installation of Bugdar is up-to-date. You are running version <strong>%1$s</strong>.'), bugdar::$options['trackerversion']) . '</div>');
                }
        }
 }
@@ -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
index fdad1581267440bac1eb4f08969d130f2523fa35..595e78a67b18296e5d8dc80acfc7f12b55472ecd 100644 (file)
@@ -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(
                        "<a href=\"language.php?do=edit&amp;languageid=$language[languageid]\">$language[title]</a>" => 'l',
                        $language['langcode'] . ' / ' . $language['charset'] => 'c',
-                       (($bugsys->options['defaultlanguage'] == $language['languageid']) ? '<strong>' . T('DEFAULT LANGUAGE') . '</strong> / ' : '') . ($language['userselect'] ? T('User Selectable') : T('Private')) => 'c'
+                       ((bugdar::$options['defaultlanguage'] == $language['languageid']) ? '<strong>' . T('DEFAULT LANGUAGE') . '</strong> / ' : '') . ($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
index 43ffea9577c51c026c933dbe7b74f4754a62d5a4..591b675521fdafd8bcddb841f89b6bf47f75940e 100755 (executable)
@@ -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'] ? "<a href=\"permission.php?do=modify&amp;usergroupid=$group[usergroupid]\">[" . T('Expand') . "]</a>" : ''), 'top', 2, 'alt3');
+               $admin->row_text($group['title'], ($input->in['usergroupid'] != $group['usergroupid'] ? "<a href=\"permission.php?do=modify&amp;usergroupid=$group[usergroupid]\">[" . T('Expand') . "]</a>" : ''), '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
index 93bc424246f1c44b098853eb704db96ffcba3680..0078ac7f55dc414930828b0800b7dedc6f924618 100755 (executable)
@@ -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<div><dfn>The title of this priority flag (eg: `Slated for Development` or `Address Now`)</dfn></div>'), 'priority', $priority->objdata['priority']);
-       $admin->row_input(T('Display Order<div><dfn>The order in which the priorities are displayed. The higher the number, the lower down in the list it is.</dfn></div>'), '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<div><dfn>The title of this priority flag (eg: `Slated for Development` or `Address Now`)</dfn></div>'), 'priority', $priority->record['priority']);
+       $admin->row_input(T('Display Order<div><dfn>The order in which the priorities are displayed. The higher the number, the lower down in the list it is.</dfn></div>'), '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]: <a href=\"priority.php?do=edit&amp;priorityid=$priority[priorityid]\">$priority[priority]</a>", "(priorityid: $priority[priorityid]) <a href=\"priority.php?do=edit&amp;priorityid=$priority[priorityid]\">[" . T('Edit') . "]</a> <a href=\"priority.php?do=delete&amp;priorityid=$priority[priorityid]\">[" . T('Delete') . "]</a>");
        }
@@ -160,10 +159,4 @@ if ($_REQUEST['do'] == 'modify')
        $admin->page_end();
 }
 
-/*=====================================================================*\
-|| ###################################################################
-|| # $HeadURL$
-|| # $Id$
-|| ###################################################################
-\*=====================================================================*/
 ?>
\ No newline at end of file
index 82705fde99b07c71538ed6a194482443d72cd51f..16d344d9d14dd2c235270fc091f0235db14b2198 100755 (executable)
@@ -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 <strong>delete all the bugs with this version</strong>.'), '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 <strong>delete all the bugs with this version</strong>.'), '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<div><dfn>This is the version string for this product.</dfn></div>'), '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 <strong>and any bugs that have been assigned those products or components</strong>?'), '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 <strong>and any bugs that have been assigned those products or components</strong>?'), '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
index 1f8d3893f5264a2d1113cd687f4635a58fd6d442..bdf08dbe43bc8171f00fe4fa7bb7d92eba50a74d 100755 (executable)
@@ -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<div><dfn>The title of this resolution flag (eg: `Fixed` or `Bogus`)</dfn></div>'), 'resolution', $resolution->objdata['resolution']);
-       $admin->row_input(T('Display Order<div><dfn>The order in which the resolutions are displayed. The higher the number, the lower down in the list it is.</dfn></div>'), '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<div><dfn>The title of this resolution flag (eg: `Fixed` or `Bogus`)</dfn></div>'), 'resolution', $resolution->record['resolution']);
+       $admin->row_input(T('Display Order<div><dfn>The order in which the resolutions are displayed. The higher the number, the lower down in the list it is.</dfn></div>'), '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]: <a href=\"resolution.php?do=edit&amp;resolutionid=$resolution[resolutionid]\">$resolution[resolution]</a>", "(resolutionid: $resolution[resolutionid]) <a href=\"resolution.php?do=edit&amp;resolutionid=$resolution[resolutionid]\">[" . T('Edit') . "]</a> <a href=\"resolution.php?do=delete&amp;resolutionid=$resolution[resolutionid]\">[" . T('Delete') . "]</a>");
        }
@@ -160,10 +159,4 @@ if ($_REQUEST['do'] == 'modify')
        $admin->page_end();
 }
 
-/*=====================================================================*\
-|| ###################################################################
-|| # $HeadURL$
-|| # $Id$
-|| ###################################################################
-\*=====================================================================*/
 ?>
\ No newline at end of file
index 359e2783fddea527300d4b5b08aabe8ac2f74787..f3d3b1e2d4f5c0e43255883239f89b4f797af814 100755 (executable)
@@ -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 <em>yes</em>, then new users will be allowed to register.'), 'setting[allownewreg]', $bugsys->options['allownewreg']);
+       $admin->row_yesno(T('If this is set to <em>yes</em>, 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 <em>yes</em> will send each new verified user a welcome email.'), 'setting[sendwelcomemail]', $bugsys->options['sendwelcomemail']);
+       $admin->row_yesno(T('Setting this option to <em>yes</em> 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. <strong>Be sure that this does not end in a trailing slash (&quot;/&quot;).</strong><br />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. <strong>Be sure that this does not end in a trailing slash (&quot;/&quot;).</strong><br />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 <em>yes</em> if you want to allow users to post raw HTML in their bug reports. This is <strong>very</strong> dangerous and it is not recommended.'), 'setting[allowhtml]', $bugsys->options['allowhtml']);
+       $admin->row_yesno(T('Set this to <em>yes</em> if you want to allow users to post raw HTML in their bug reports. This is <strong>very</strong> 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 <em>Not Selected</em>.'), 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 <em>Not Selected</em>.'), 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 = '<table cellspacing="2" cellpadding="1" border="0">';
        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
index 6b7aa7e329765345bc0b410d39d205cd3477f662..9eb080f0774c41e4ae7f27e3036bc6728a38cb98 100755 (executable)
@@ -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<div><dfn>The title of this severity flag (eg: `Major` or `Critical`)</dfn></div>'), 'severity', $severity->objdata['severity']);
-       $admin->row_input(T('Display Order<div><dfn>The order in which the severities are displayed. The higher the number, the lower down in the list it is.</dfn></div>'), '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<div><dfn>The title of this severity flag (eg: `Major` or `Critical`)</dfn></div>'), 'severity', $severity->record['severity']);
+       $admin->row_input(T('Display Order<div><dfn>The order in which the severities are displayed. The higher the number, the lower down in the list it is.</dfn></div>'), '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]: <a href=\"severity.php?do=edit&amp;severityid=$severity[severityid]\">$severity[severity]</a>", "(severityid: $severity[severityid]) <a href=\"severity.php?do=edit&amp;severityid=$severity[severityid]\">[" . T('Edit') . "]</a> <a href=\"severity.php?do=delete&amp;severityid=$severity[severityid]\">[" . T('Delete') . "]</a>");
        }
@@ -160,10 +159,4 @@ if ($_REQUEST['do'] == 'modify')
        $admin->page_end();
 }
 
-/*=====================================================================*\
-|| ###################################################################
-|| # $HeadURL$
-|| # $Id$
-|| ###################################################################
-\*=====================================================================*/
 ?>
\ No newline at end of file
index 88ea3cd3403957d2a67e2df07cd4535305dd8801..37989aae34628ade15d0eadcedb365bdff7366cd 100755 (executable)
@@ -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<div><dfn>The title of this status flag (eg: `Confirmed` or `Closed (Fixed)`)</dfn></div>'), 'status', $status->objdata['status']);
-       $admin->row_input(T('Display Order<div><dfn>The order in which the statuses ar displayed.</dfn></div>'), 'displayorder', $status->objdata['displayorder']);
-       $admin->row_input(T('Status Color<div><dfn>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.</dfn></div>'), '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<div><dfn>The title of this status flag (eg: `Confirmed` or `Closed (Fixed)`)</dfn></div>'), 'status', $status->record['status']);
+       $admin->row_input(T('Display Order<div><dfn>The order in which the statuses ar displayed.</dfn></div>'), 'displayorder', $status->record['displayorder']);
+       $admin->row_input(T('Status Color<div><dfn>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.</dfn></div>'), '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 = '<span style="float: right"><div style="height: 12px; width: 12px; background-color: ' . $status['color'] . '; border: 1px black solid"></div></span>';
                $admin->row_text("$colorblock$status[displayorder]: <a href=\"status.php?do=edit&amp;statusid=$status[statusid]\">$status[status]</a>", "(statusid: $status[statusid]) <a href=\"status.php?do=edit&amp;statusid=$status[statusid]\">[" . T('Edit') . "]</a> <a href=\"status.php?do=delete&amp;statusid=$status[statusid]\">[" . T('Delete') . "]</a>");
@@ -163,10 +162,4 @@ if ($_REQUEST['do'] == 'modify')
        $admin->page_end();
 }
 
-/*=====================================================================*\
-|| ###################################################################
-|| # $HeadURL$
-|| # $Id$
-|| ###################################################################
-\*=====================================================================*/
 ?>
\ No newline at end of file
index a2d9a0e15c62022ee09e3de6764012eb81ee8d79..9d88f0e2bd8c04c680296ea629418c2ebb7f4026 100644 (file)
@@ -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
index 7cefd891cc50d9c982f805252673890f91d6c707..b69ca14cf2c72ed219da4de1af2c8c913b9fec8c 100755 (executable)
@@ -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<div><dfn>This is the title that others will be able to see when comments are posted.</dfn></div>'), '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<div><dfn>This is the title that others will be able to see when comments are posted.</dfn></div>'), '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(
                        '<a href="user.php?do=edit&amp;userid=' . $user['userid'] . '">' . $user['email'] . '</a>' => 'l',
-                       $bugsys->datastore['usergroup']["$user[usergroupid]"]['title'] => 'c',
+                       bugdar::$datastore['usergroup']["$user[usergroupid]"]['title'] => 'c',
                        '<input name="approve[' . $user['userid'] . ']" type="checkbox" value="1" />' => '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
index 55000555757b9b35a484e84f53e6b11d2cbb94d8..2cca973e8943b3ea0f092da8247286f82458051a 100755 (executable)
@@ -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 = '<input type="text" class="input" name="help[' . $topic['keystring'] . '][title]" value="' . $topic['title'] . '" size="35" />';
                $delete = (!in_array($topic['keystring'], UserHelpAPI::not_able_to_delete()) ? '<br /><br /><a href="userhelp.php?do=delete&amp;keystring=' . $topic['keystring'] . '">[' . T('Delete') . ']</a>' : '');
@@ -149,10 +148,4 @@ if ($_REQUEST['do'] == 'modify')
        $admin->page_end();
 }
 
-/*=====================================================================*\
-|| ###################################################################
-|| # $HeadURL$
-|| # $Id$
-|| ###################################################################
-\*=====================================================================*/
 ?>
\ No newline at end of file
index 3406c8d1e40f06616843b51a01d6a251141d845f..97251394b42dcaaca018ba357525a74a2e54f7b0 100755 (executable)
@@ -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 .= "<div><input name=\"obsoletes[]\" type=\"checkbox\" value=\"$obsolete[attachmentid]\"" . (is_array($bugsys->in['obsoletes']) AND in_array($obsolete['attachmentid'], $bugsys->in['obsoletes']) ? ' checked="checked"' : '') . " /> $obsolete[filename]" . ($obsolete['description'] ? " [$obsolete[description]]" : '') . "</div>\n";
+               $obsoletes .= "<div><input name=\"obsoletes[]\" type=\"checkbox\" value=\"$obsolete[attachmentid]\"" . (is_array($input->in['obsoletes']) AND in_array($obsolete['attachmentid'], $input->in['obsoletes']) ? ' checked="checked"' : '') . " /> $obsolete[filename]" . ($obsolete['description'] ? " [$obsolete[description]]" : '') . "</div>\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
index 3310f60996ef89460bfa17f0eacaaf230104ebde..cf47230b7c82051fee140fd06ecf681238dd0c1b 100644 (file)
@@ -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() . ")");
                }
index ab3be6e1a411ee1fd8a1ea6c195c369cfddd2e18..a0393668cb8fc83b36f249560d369a7414d6fd34 100644 (file)
@@ -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 (file)
index 0000000..1ea39ed
--- /dev/null
@@ -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
+
index a80b5d56a5aa747e87f3d8ec9a7465019df6e618..a228757afc390ef75984ec5b5ed9d4ffc663c320 100644 (file)
@@ -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';
 
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
@@ -45,7 +45,7 @@ require_once('./global.php');
 
 <?php
 
-if (empty($bugsys->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 '<p style="color: red">You did not fill in all the fields or the email addresses are not valid. Please <a href="mailtest.php">go back</a>.</p>';
        }
@@ -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']);
        
 ?>
 
        <h2>Complete</h2>
-       <p>All the test emails were sent to <em><?= $bugsys->in['receive'] ?></em>. Please check that you received all 4 tests.</p>
+       <p>All the test emails were sent to <em><?= $input->in['receive'] ?></em>. Please check that you received all 4 tests.</p>
        
 <?php
        }
@@ -123,10 +126,4 @@ Sendmail (Path): \"" . ini_get('sendmail_path') . "\"";
 </html>
 <?php
 
-/*=====================================================================*\
-|| ###################################################################
-|| # $HeadURL$
-|| # $Id$
-|| ###################################################################
-\*=====================================================================*/
 ?>
\ No newline at end of file
index 338544121d60770fe19362488471c95030b937a7..9738c10cb74ed0f91ca5aee6b3c92969a5942f6d 100644 (file)
@@ -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]");
        }
index df0c02bb2f8941638930a42a307fce402e9d8643..00b5f50295580bf5b8a8d5093e25619265f4fb10 100644 (file)
@@ -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();
 }
 
index edc346b6fd352680d0e91edceb341f7bfe72ea54..f4df3d35ac97599424c952bfd746db893a261ac8 100755 (executable)
@@ -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
index b84c4a1c58b14c5e0e9ed305c1cb8bbac0d483b2..efcfdb20bbbcdcad1ae4ba307c37f619ed1d95ca 100644 (file)
@@ -5,7 +5,7 @@ require_once('./global.php');
 
 echo '<pre>';
 
-print_r($bugsys);
+print_r(get_class_vars('bugdar'));
 
 echo '</pre>';
 
index 9e1a3a7308a3b87400f4e428ca0830498727673f..d33dc817da5691c07c2ea663dfe23d93958b2e09 100644 (file)
@@ -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
index 87a59562b29c073b4134357fcdda1ea8da40df16..189feea5bc6ae4b9ee61ec6c4189de51be1adad1 100644 (file)
@@ -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]"]))
        {
index 2f96280aa4755e1fb00aac36ea4964e154b37f2a..0c47bb476b67318d53de635807e7c17ae7b17ab6 100644 (file)
@@ -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]");
 }
index f430944cd869e2d9877a48b6052565768404131a..13b53ef4831e54ec973ac6144bf9bcb94436a61a 100644 (file)
@@ -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))
index 2dbf56e4893130f489b79f5df8a3f631aef78bb9..0b3de8c0d22c5d0005534afa3fb65f11667b7e5d 100644 (file)
@@ -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
index fe2734760dcc59452479afba78d988eb85bb0122..09d941e46e1c4a76a984cab299131140433c990f 100644 (file)
@@ -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
index 1e130998126c38f176fd7e76e4fb7b99d47ed0a8..88fc8949ecf52f8c02b400a043cfcdf7e9f5d8b0 100644 (file)
@@ -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 = '&nbsp; &rsaquo; &nbsp; ' . $component['title'];
-                               $right = $component['description'];
-                               $trextra = '';
-                               eval('$productlist .= "' . $template->fetch('explain_row') . '";');
+                               $tpl = new BSTemplate('explain_row');
+                               $tpl->vars = array(
+                                       'left'          => '&nbsp; &rsaquo; &nbsp; ' . $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
index b9a59513910158d26ce7f16da1afeb46dae4cf81..5bc8889f97aec3e2681351d1623deb414748602c 100644 (file)
@@ -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
index 0405f844ec4f5bad690c208543b0b0ad0f1e3318..0781b7c4bcf10fed1d491d0ae2b19b472e7f11ae 100755 (executable)
@@ -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
index c22ba31dce5225e6c673509bd3f15d0b33d95deb..9c6eb0b066a692b86faf5066489d65e81e3dc5cf 100644 (file)
--- 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
index e3b69154ddf03d268d1dca0d422675c5466f7cc1..0f05e2c771bec8c364ce026aa0396b3a83dd639d 100644 (file)
@@ -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
 || ###################################################################
 \*=====================================================================*/
 
-$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
index becfda365fbc45d34bcaa07395f98510ee245af3..cef540102063c4a029a7d1793d4b05f5864f264e 100644 (file)
@@ -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
 || ###################################################################
 \*=====================================================================*/
 
-$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
index bf4d8d14c11b443338bdb969ee44dbcb5cc260ba..7c400094c719e3302061d4c68f66fc8d0b39e288 100644 (file)
@@ -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
 || ###################################################################
 \*=====================================================================*/
 
-$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
index 738c0f2295ac1ed1860e8a56d6ce62b471f1da30..9fe38cf0831ea2bf77c0a5ad058092ea21049ec2 100644 (file)
@@ -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
 || ###################################################################
 \*=====================================================================*/
 
-$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', '<a href="\0">\0</a>', $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
index cb303692e323eccebcf46cbb3db376c2b9aaff82..8abfd26dcddf4ef3a238d7ebe8e36b7145e05300 100644 (file)
@@ -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
 || ###################################################################
 \*=====================================================================*/
 
-$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
index 856f70178c3456c83c01a24567966950f5b3a6a7..8469bac5589381ac22c7d6185763b544e10479e7 100644 (file)
@@ -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
 || ###################################################################
 \*=====================================================================*/
 
-$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
index 03511a041a22cd4a28c3426cc89968784ea9589c..48a1634243c34d7e9a601ceafc1ace197a561ee6 100644 (file)
@@ -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
 || ###################################################################
 \*=====================================================================*/
 
-$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
index e0b87a94ee62595619f0fe3e635723be076a8d20..91616203c53dc1ec2bc3a92af7dc7456cf8ac1fb 100644 (file)
@@ -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
 || ###################################################################
 \*=====================================================================*/
 
-$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
index ef083e076543ee4ac53862e1644bf814e2821408..eb0a7d2a8e88d8b3aef19af435b70543ebdc5bc3 100644 (file)
@@ -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
 || ###################################################################
 \*=====================================================================*/
 
-$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
index 71810a11add051ecb49c1114c44aaf3c20eb3308..96821e088741c235552f69c2c998f0aa24c0d3c3 100644 (file)
@@ -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
 || ###################################################################
 \*=====================================================================*/
 
-$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
index 1b1ee9a6a0be4252385965085eb5745f9ddac0dd..e6846585f3716bac0e6fac7283717655b98e7989 100644 (file)
@@ -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
 || ###################################################################
 \*=====================================================================*/
 
-$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
index 2344287cb7bc3d1d35b3bc36953263044e64f11d..46e2433a197cad182f7bd02d3cd801f6a30a742b 100644 (file)
@@ -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
 || ###################################################################
 \*=====================================================================*/
 
-$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
index 5cedef27b7dc93ce3c55cfcfccd3ddad2db05f48..afd09b8b5bf50b2e7a0d9b7ecc9609c7d6de0a84 100644 (file)
@@ -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
 || ###################################################################
 \*=====================================================================*/
 
-$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
index 34f7cd053358c473be6cf223c13ddc8e650ea45a..eb31b3ed59fdde3ad97a8a838af8cf36ff073929 100644 (file)
@@ -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
index 0fe42cae1e7b112ca0690ac56d7f0d0e29798cbe..4ceb5560de6d75a0f4cc2d58c52cd609ddb5c0d6 100644 (file)
@@ -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
index abcf29682ee47bb3c56817c1d41244d1ceb91756..aae7805997c6058e62553aae96c852bb2d94cc56 100644 (file)
@@ -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
index acabf9a81a703abb3584359a769a84dee74e392f..8fc4cae0de6d8217518aee19c2e50994921b2a93 100644 (file)
@@ -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
index 2d6da6be9be3eaf6329645d7b801009ffbc94c9a..2291e0428433cbc0dd2db97ac14b87417de43c42 100644 (file)
@@ -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
index 7e7549cd3ef48fe0fc72a5ca8ce6d57e0fa6e441..a3efd3c40619e7beed9074d7177861b8d93a1ce4 100644 (file)
@@ -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 (file)
index 9615c50..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-<?php
-/*=====================================================================*\
-|| ###################################################################
-|| # Bugdar
-|| # Copyright ©2002-2007 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
-|| # the Free Software Foundation; version 2 of the License.
-|| #
-|| # This program is distributed in the hope that it will be useful, but
-|| # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-|| # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-|| # more details.
-|| #
-|| # You should have received a copy of the GNU General Public License along
-|| # with this program; if not, write to the Free Software Foundation, Inc.,
-|| # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-|| ###################################################################
-\*=====================================================================*/
-
-/**
-* API Error Handler
-*
-* This class is used to catch different kinds of API errors and throw the
-* appropriate front-size error depending on the context. Unlike normal
-* handlers, this class can be both instantiated and used statically: check
-* the method documentation for more information.
-*
-* @author              Blue Static
-* @copyright   Copyright ©2002 - 2007, Blue Static
-* @version             $Revision$
-* @package             Bugdar
-* 
-*/
-class API_Error_Handler
-{
-       /**
-       * Instance of an object that can run erros
-       * @var  object
-       * @access       private
-       */
-       var $object = null;
-       
-       // ###################################################################
-       /**
-       * Constructor: set the actionable object
-       *
-       * @access       public
-       *
-       * @param        object  Actionable object
-       */
-       function API_Error_Handler(&$obj)
-       {
-               $this->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
index 28d7d88b4f682547a4dde18edcc476e2819d72cb..aad0648047754fe46d26c0b2908270444bc689db 100644 (file)
@@ -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
index 8473bb840ec41bbd6d922b569ec436cb6ed60798..45f1439012c16e54952e8cf4f26e4c1213516ad6 100755 (executable)
@@ -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 .= '<input type="hidden" name="' . $name . '" value="' . $value . '" />' . "\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
index abe37f018bd8c92f8c5e164823d2935d906008da..dd5669db7463dc3b65258169aac84591a820b359 100644 (file)
@@ -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
index ce043c7e55cfe7338e2e8bfe37808094b608eb32..4a1efbddb13991380db03e73099ed65458914fac 100644 (file)
@@ -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
 \*=====================================================================*/
 
 /**
-* 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
index 25d7f9e9df24d38f82281a30998fe897bd5720ec..624aceefe06f5032d17bc6a72d1642b6effb1f7a 100644 (file)
@@ -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
 \*=====================================================================*/
 
 /**
-* 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 <img> tag for the sort arrow
-       *
-       * @access       public
-       *
-       * @return       string  HTML <img> tag
-       */
-       function fetch_sort_image()
+        * Returns the entire <img> tag for the sort arrow
+        *
+        * @return      string  HTML <img> tag
+        */
+       public function fetchSortImage()
        {
-               return '<img src="templates/images/arrow_' . $this->fetch_sort_direction() . '.gif" alt="" style="vertical-align: top; border: none" />';
+               return '<img src="templates/images/arrow_' . $this->fetchSortDirection() . '.gif" alt="" style="vertical-align: top; border: none" />';
        }
        
-       // ###################################################################
        /**
-       * Returns the href value for an <a> 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 <a> 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 .= '&amp;';
                }
                
-               return $this->page . '.php?' . $params . 'by=' . $key . '&amp;as=' . (($this->sortkey == $key AND $highlight) ? $this->fetch_opposite_sort_direction() . '" class="select' : $this->fetch_sort_direction());
+               return $this->page . '.php?' . $params . 'by=' . $key . '&amp;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 ? '<a href="' . $this->fetch_sort_link($column, $params, true) . '">' . $names[$column] . '</a>' : $names[$column]);
+                               $build[] = ($sortable ? '<a href="' . $this->fetchSortLink($column, $params, true) . '">' . $names[$column] . '</a>' : $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<td>$data</td>";
                }
                
-               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 ? '<div>' : '');
                $close = ($multi ? '</div>' : '');
@@ -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
index 5e1d3665c66a0fc52353fe3d0050365da1e8ead0..a5be85f78d548d3dd16b383efe2cbbcf16214880 100644 (file)
@@ -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 (file)
index 0000000..b4e1910
--- /dev/null
@@ -0,0 +1,223 @@
+<?php
+/*=====================================================================*\
+|| ###################################################################
+|| # Bugdar
+|| # 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
+|| # the Free Software Foundation; version 2 of the License.
+|| #
+|| # This program is distributed in the hope that it will be useful, but
+|| # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+|| # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+|| # more details.
+|| #
+|| # You should have received a copy of the GNU General Public License along
+|| # with this program; if not, write to the Free Software Foundation, Inc.,
+|| # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+|| ###################################################################
+\*=====================================================================*/
+
+/**
+ * Returns an email's translated text, for use in sprintf(), given a variable
+ * name
+ * 
+ * @param      string  Name of the email
+ *
+ * @return     array   Array of translated items (subject, bodyText, bodyHtml)
+ */
+function get_email_text($name)
+{
+       $_emails = array(
+               // welcome email
+               // vars: username, trackertitle
+               'welcome' => 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
index b4f6983f45d12cd8a8fb5d1193cd9db796606434..f43a67bd362838ad8fcfe3a7d0532b4d0dbf25c5 160000 (submodule)
@@ -1 +1 @@
-Subproject commit b4f6983f45d12cd8a8fb5d1193cd9db796606434
+Subproject commit f43a67bd362838ad8fcfe3a7d0532b4d0dbf25c5
index 06441db3f64948e64a9c21f14076ecef25ac7476..9fa4162062ff621e7d497d80ebfc0b0568df84bf 100755 (executable)
@@ -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 '<select class="input" name="' . $name . ($multiple ? '[]' : '') . '"' . ($multiple ? ' multiple="multiple" size="' . (sizeof($array) < 8 ? sizeof($array) + 1 : 8) . '"' : '') . '>' . implode("\n\t", $opts) . "\r</select>";
 }
 
-// ################### 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 <select>
-* 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
-*/
+ * Runs through a given datastore item and creates a series of <select>
+ * 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\[(.*)\]#', '<?php echo fetch_help_link("\1") ?>', $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
index c51a1761c3caeb93e484f6c02c3d62914aa200cb..43fe6668e42da9c8bf1a27023bb988c51d8fc5f4 100755 (executable)
@@ -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
 // ###################### 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
index a6a31960f08bfed4c31f36f17bfe05998182503e..5377859c781c125c90ab90e60a6e2fcd0de01d8c 100644 (file)
@@ -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
 || ###################################################################
 \*=====================================================================*/
 
-// ###################################################################
 /**
-* Constructs a massive <select> form element to create non-valid XHTML
-* for product selection. We have to use nested <optgroup>s (invalid)
-* because certain browsers (Safari) do not support <option disabled>,
-* which is how I want to implement components.
-*
-* @param       string  Permission action to verify against for a product
-* @param       string  Selection
-* @param       bool    Include obsolete versions?
-*
-* @return      string  A large blob of <select> HTML
-*/
-function ConstructProductSelect($action = 'canviewbugs', $select = null, $obsolete = true)
+ * Constructs a massive <select> form element to create non-valid XHTML
+ * for product selection. We have to use nested <optgroup>s (invalid)
+ * because certain browsers (Safari) do not support <option disabled>,
+ * which is how I want to implement components.
+ *
+ * @param      string  Permission action to verify against for a product
+ * @param      string  Selection
+ * @param      bool    Include obsolete versions?
+ *
+ * @return     string  A large blob of <select> 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 <option>s for a given product ID. This
-* will always include global versions and inherited versions (if the
-* passed ID is that of a component).
-*
-* @param       integer Product ID
-* @param       string  Selection
-* @param       bool    Include obsolete versions?
-*
-* @return      string  Constructed <option> HTML
-*/
-function ConstructVersionSelect($productid, $select, $obsolete)
+ * Constructs a string of HTML <option>s for a given product ID. This
+ * will always include global versions and inherited versions (if the
+ * passed ID is that of a component).
+ *
+ * @param      integer Product ID
+ * @param      string  Selection
+ * @param      bool    Include obsolete versions?
+ *
+ * @return     string  Constructed <option> HTML
+ */
+function construct_version_select($productid, $select, $obsolete)
 {
-       global $bugsys;
-       
-       $product = $bugsys->datastore['product']["$productid"];
+       $product = bugdar::$datastore['product']["$productid"];
        $component = null;
        
        $build = '';
@@ -98,45 +92,44 @@ function ConstructVersionSelect($productid, $select, $obsolete)
        // this is a component
        if ($product == null)
        {
-               $component = $bugsys->datastore['component']["$productid"];
-               $product = $bugsys->datastore['product']["$component[parentid]"];
+               $component = bugdar::$datastore['component']["$productid"];
+               $product = bugdar::$datastore['product']["$component[parentid]"];
        }
        
-       foreach ($bugsys->datastore['version'] AS $versionid => $version)
+       foreach (bugdar::$datastore['version'] as $versionid => $version)
        {
-               if ((!$version['productid'] OR $version['productid'] == $component['productid'] OR $version['productid'] == $product['productid']) AND (!$version['obsolete'] OR ($version['obsolete'] AND $obsolete)))
+               if ((!$version['productid'] || $version['productid'] == $component['productid'] || $version['productid'] == $product['productid']) && (!$version['obsolete'] || ($version['obsolete'] && $obsolete)))
                {
-                       $value = intval($product['productid']) . ',' . intval($component['productid']) . ',' . intval($versionid);
-                       $label = $version['version'];
-                       $selected = ($value == $select);
-                       eval('$build .= "' . $bugsys->template->fetch('selectoption') . '";');
+                       $tpl = new BSTemplate('selectoption');
+                       $tpl->vars = array(
+                               'value'         => intval($product['productid']) . ',' . intval($component['productid']) . ',' . intval($versionid),
+                               'label'         => $version['version']
+                       );
+                       $tpl->vars['selected'] = ($tpl->vars['value'] == $select);
+                       $build .= $tpl->evaluate()->getTemplate();
                }
        }
        
        return $build;
 }
 
-// ###################################################################
 /**
-* Constructs an <optgroup> block from a label and a string of
-* HTML <option> elements.
-*
-* @param       string  Label for this <optgroup>
-* @param       string  HTML bits
-*
-* @return      string  Composed HTML
-*/
-function ConstructOptionGroup($glabel, $optbits)
+ * Constructs an <optgroup> block from a label and a string of
+ * HTML <option> elements.
+ *
+ * @param      string  Label for this <optgroup>
+ * @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
index 97043026fe813e7b00d638ce9c6c24c479e310f7..1b9263e7512847257b86040b4dd80d97bfc09837 100755 (executable)
@@ -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
 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
index e808ca9efc37805891ea6bc298925bd21eff3d52..dfaa1bcd7982bb495f8e9ba1ba732f6b0e08f3ad 100644 (file)
@@ -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 (file)
index 0000000..2984e8c
--- /dev/null
@@ -0,0 +1,84 @@
+<?php
+/*=====================================================================*\
+|| ###################################################################
+|| # Bugdar
+|| # Copyright (c)2005-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
+|| # the Free Software Foundation; version 2 of the License.
+|| #
+|| # This program is distributed in the hope that it will be useful, but
+|| # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+|| # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+|| # more details.
+|| #
+|| # You should have received a copy of the GNU General Public License along
+|| # with this program; if not, write to the Free Software Foundation, Inc.,
+|| # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+|| ###################################################################
+\*=====================================================================*/
+
+require_once ISSO . '/Pagination.php';
+
+/**
+ * Pagination
+ *
+ * Subclass of BSPagination
+ *
+ * @author             rsesek
+ * @copyright  Copyright (c)2005 - 2008, Blue Static
+ * @package            Bugdar
+ *
+ */
+class Pagination extends BSPagination
+{
+       /**
+        * Sets the variables used by the system
+        */
+       protected function _setVariables()
+       {
+               $this->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
index 1dda26042280075e4219231147e8ce3826d22bba..4298920355d533aad88720f19100367cbb9bd255 100644 (file)
@@ -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
index 2a9eef6941b4cc555a54c852044521c07e5fb7a9..b992647cd27f4a7ab8ad017924f3021c0be3ee5c 100644 (file)
@@ -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
index 9181c6ca51dbb168358149d539c112b57310f153..c34b673c223fc1284813756d45126f1dd854cf14 100644 (file)
--- 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 . '&amp;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
index def3532da674c9ac8b6b11aff5fc2d3d8bfa021c..1765e980e6af3786daded51f29567a8ccb255f44 100644 (file)
@@ -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 '<h1>Convert Database Character Set</h1>';
        echo '<p>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 <strong>' . TARGET . '</strong>. This script can migrate all of data from your current character set/collation of <strong>' . $collation['Value'] . '</strong>. If you would like to convert your database to utf8, please click the link below.</p>';
@@ -70,7 +69,7 @@ if ($bugsys->in['step'] == 0)
 
 // ###################################################################
 
-else if ($bugsys->in['step'] == 1)
+else if ($input->in['step'] == 1)
 {
        echo '<h1>Preserve Existing Data</h1>';
        echo '<p>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.</p>';
@@ -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 '<h1>Conversion Complete</h1>';
        echo '<p>Your database has now been converted to the <strong>' . TARGET . '</strong> collation. Congratulations. Please check that everything is operating correctly.</p>';
@@ -173,10 +172,4 @@ else if ($bugsys->in['step'] == 2)
 
 $admin->page_end();
 
-/*=====================================================================*\
-|| ###################################################################
-|| # $HeadURL$
-|| # $Id$
-|| ###################################################################
-\*=====================================================================*/
 ?>
\ No newline at end of file
index 2fdcab72237c6ef509c51752f121a0b4b7ec18f0..7dbf7d44dc7bfaa8f545ad04f24351a2b47fd075 100644 (file)
@@ -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 &quot;Automation&quot; drop-down next to this box (which may be hidden) will
        )
 );
 
-/*=====================================================================*\
-|| ###################################################################
-|| # $HeadURL$
-|| # $Id$
-|| ###################################################################
-\*=====================================================================*/
 ?>
\ No newline at end of file
index c0f29509247eadf0fc8787a3a9a75d165a161d65..1c833d0aacc932d74e5572b0fc2b4c3ebc0a4f6a 100644 (file)
@@ -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
index df7ec28ee6f9fadb9de25e10d92103b20315d7b0..22270d2e02ba017caed223d41c446f03df43be71 100644 (file)
@@ -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
index b7c5b6dfea1990a88b99147fb5a75d38f4faf6da..6111ba77ae209a9b18d22d5b01496eb833aa4d40 100644 (file)
@@ -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)
 {
 ?>
 <h1>Welcome to Bugdar</h1>
@@ -46,7 +46,7 @@ if ($bugsys->in['mark'] == 0)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 1)
+if ($input->in['mark'] == 1)
 {
 ?>
 <h1>Installation Check</h1>
@@ -115,7 +115,7 @@ if ($bugsys->in['mark'] == 1)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 2)
+if ($input->in['mark'] == 2)
 {
 ?>
 <h1>Initializing Database</h1>
@@ -138,7 +138,7 @@ if ($bugsys->in['mark'] == 2)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 3)
+if ($input->in['mark'] == 3)
 {
 ?>
 <h1>Loading Default Data</h1>
@@ -172,7 +172,7 @@ if ($bugsys->in['mark'] == 3)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 4)
+if ($input->in['mark'] == 4)
 {
 ?>
 <h1>Loading Settings</h1>
@@ -194,7 +194,7 @@ if ($bugsys->in['mark'] == 4)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 5)
+if ($input->in['mark'] == 5)
 {
 ?>
 <h1>Cache Data</h1>
@@ -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)
 {
 ?>
 <h1>New Administrator</h1>
@@ -296,7 +296,7 @@ if ($bugsys->in['mark'] == 7)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 8)
+if ($input->in['mark'] == 8)
 {
 ?>
 <h1>User Added</h1>
@@ -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
index 10a3401161976f1399147b475a52ac0127a6c157..502c431f7859060ebe82460ca8da04a9e4bfb073 100644 (file)
@@ -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
index 3c9b4520fcccf5ff1cd60d6499645e1ed9894bbc..32b88660f7071e2e88e20efc6f4480f7e0d2b7ff 100644 (file)
@@ -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
index 6dca12e10ab2445cd4b9a52c129aff28ec668e25..9b5795bac8d69df48629f0e4111191b1bce0ac2c 100644 (file)
@@ -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
index 0d335af37c0fb37dd852e9fe8ecad947b16a6734..cbe81292135119e010ffedfd59bc9d5ec201c31b 100644 (file)
@@ -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)
 {
 ?>
 <h1>Welcome to Bugdar</h1>
@@ -43,7 +43,7 @@ if ($bugsys->in['mark'] == 0)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 1)
+if ($input->in['mark'] == 1)
 {
 ?>
 <h1>Version Number Change</h1>
@@ -67,10 +67,4 @@ if ($bugsys->in['mark'] == 1)
 
 page_end();
 
-/*=====================================================================*\
-|| ###################################################################
-|| # $HeadURL$
-|| # $Id$
-|| ###################################################################
-\*=====================================================================*/
 ?>
\ No newline at end of file
index a571d9f756a91f06b8de4d92bd4d1a841456b214..b26d8280e55e027753b945a1bc6ab55f5dcb0404 100644 (file)
@@ -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)
 {
 ?>
 <h1>Welcome to Bugdar</h1>
@@ -42,7 +42,7 @@ if ($bugsys->in['mark'] == 0)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 1)
+if ($input->in['mark'] == 1)
 {
 ?>
 <h1>Version Number Change</h1>
@@ -66,10 +66,4 @@ if ($bugsys->in['mark'] == 1)
 
 page_end();
 
-/*=====================================================================*\
-|| ###################################################################
-|| # $HeadURL$
-|| # $Id$
-|| ###################################################################
-\*=====================================================================*/
 ?>
\ No newline at end of file
index a8575f5cb85da339da0f01ec9e84ab8ecf32b064..47e09d7df7069e93009f55201b838b86935c03f6 100644 (file)
@@ -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)
 {
 ?>
 <h1>Welcome to Bugdar</h1>
@@ -42,7 +42,7 @@ if ($bugsys->in['mark'] == 0)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 1)
+if ($input->in['mark'] == 1)
 {
 ?>
 <h1>Minor Database Table Changes</h1>
@@ -70,7 +70,7 @@ if ($bugsys->in['mark'] == 1)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 2)
+if ($input->in['mark'] == 2)
 {
 ?>
 <h1>Search Table Changes</h1>
@@ -95,7 +95,7 @@ if ($bugsys->in['mark'] == 2)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 3)
+if ($input->in['mark'] == 3)
 {
 ?>
 <h1>Custom Field Updates</h1>
@@ -104,7 +104,7 @@ if ($bugsys->in['mark'] == 3)
 <?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");
@@ -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)
 {
 ?>
 <h1>Database Table Changes</h1>
@@ -175,7 +175,7 @@ if ($bugsys->in['mark'] == 4)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 5)
+if ($input->in['mark'] == 5)
 {
 ?>
 <h1>Version Number Change</h1>
@@ -203,10 +203,4 @@ if ($bugsys->in['mark'] == 5)
 
 page_end();
 
-/*=====================================================================*\
-|| ###################################################################
-|| # $HeadURL$
-|| # $Id$
-|| ###################################################################
-\*=====================================================================*/
 ?>
\ No newline at end of file
index a5a19f0c0172215ffb050ab0da6bb930eb87743f..a28774df139515c23b1afbee7312d0919e4f860f 100644 (file)
@@ -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)
 {
 ?>
 <h1>Welcome to Bugdar</h1>
@@ -42,7 +42,7 @@ if ($bugsys->in['mark'] == 0)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 1)
+if ($input->in['mark'] == 1)
 {
 ?>
 <h1>Schema Updates</h1>
@@ -55,7 +55,7 @@ if ($bugsys->in['mark'] == 1)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 2)
+if ($input->in['mark'] == 2)
 {
 ?>
 <h1>Version Number Change</h1>
@@ -79,10 +79,4 @@ if ($bugsys->in['mark'] == 2)
 
 page_end();
 
-/*=====================================================================*\
-|| ###################################################################
-|| # $HeadURL$
-|| # $Id$
-|| ###################################################################
-\*=====================================================================*/
 ?>
\ No newline at end of file
index 8815b372ac9f7dd9e26225bc912e995bfb307cdd..74ee50955c36bd37bfc5e3bf51d6ad64d07557c2 100644 (file)
@@ -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)
 {
 ?>
 <h1>Welcome to Bugdar</h1>
@@ -42,7 +42,7 @@ if ($bugsys->in['mark'] == 0)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 1)
+if ($input->in['mark'] == 1)
 {
 ?>
 <h1>Potential Schema Updates</h1>
@@ -77,7 +77,7 @@ if ($bugsys->in['mark'] == 1)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 2)
+if ($input->in['mark'] == 2)
 {
 ?>
 <h1>Version Number Change</h1>
@@ -101,10 +101,4 @@ if ($bugsys->in['mark'] == 2)
 
 page_end();
 
-/*=====================================================================*\
-|| ###################################################################
-|| # $HeadURL$
-|| # $Id$
-|| ###################################################################
-\*=====================================================================*/
 ?>
\ No newline at end of file
index 1644e667359750ef27dc9bb3fe5e58bd60214c5e..718d95f55c2ffd7fa63a6030d558e4805733de7b 100644 (file)
@@ -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)
 {
 ?>
 <h1>Welcome to Bugdar</h1>
@@ -42,7 +42,7 @@ if ($bugsys->in['mark'] == 0)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 1)
+if ($input->in['mark'] == 1)
 {
 ?>
 <h1>Version Number Change</h1>
@@ -66,10 +66,4 @@ if ($bugsys->in['mark'] == 1)
 
 page_end();
 
-/*=====================================================================*\
-|| ###################################################################
-|| # $HeadURL$
-|| # $Id$
-|| ###################################################################
-\*=====================================================================*/
 ?>
\ No newline at end of file
index b8e38fcc80e865c3150ffc0c574fe6b5962e1777..0a146957d3235daf51176627baf4eabbc0544114 100644 (file)
@@ -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)
 {
 ?>
 <h1>Welcome to Bugdar</h1>
@@ -42,7 +42,7 @@ if ($bugsys->in['mark'] == 0)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 1)
+if ($input->in['mark'] == 1)
 {
 ?>
 <h1>Version Number Change</h1>
@@ -66,10 +66,4 @@ if ($bugsys->in['mark'] == 1)
 
 page_end();
 
-/*=====================================================================*\
-|| ###################################################################
-|| # $HeadURL$
-|| # $Id$
-|| ###################################################################
-\*=====================================================================*/
 ?>
\ No newline at end of file
index 010e105e214a8629ab8e4bf5854ac980379f7e5a..2fbb302c61164ca26f91ded21e3045f5a9f6d252 100644 (file)
@@ -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)
 {
 ?>
 <h1>Welcome to Bugdar</h1>
@@ -42,7 +42,7 @@ if ($bugsys->in['mark'] == 0)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 1)
+if ($input->in['mark'] == 1)
 {
 ?>
 <h1>Version Number Change</h1>
@@ -66,10 +66,4 @@ if ($bugsys->in['mark'] == 1)
 
 page_end();
 
-/*=====================================================================*\
-|| ###################################################################
-|| # $HeadURL$
-|| # $Id$
-|| ###################################################################
-\*=====================================================================*/
 ?>
\ No newline at end of file
index 76a8c4fbccce5958c83f6c8f4ef365956589d064..7a3175808a910e1f384d6517c21213d6f2f54b77 100644 (file)
@@ -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)
 {
 ?>
 <h1>Welcome to Bugdar</h1>
@@ -42,7 +42,7 @@ if ($bugsys->in['mark'] == 0)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 1)
+if ($input->in['mark'] == 1)
 {
 ?>
 <h1>Version Number Change</h1>
@@ -66,10 +66,4 @@ if ($bugsys->in['mark'] == 1)
 
 page_end();
 
-/*=====================================================================*\
-|| ###################################################################
-|| # $HeadURL$
-|| # $Id$
-|| ###################################################################
-\*=====================================================================*/
 ?>
\ No newline at end of file
index 9b04826cb23a2900e9114ead9182dea558e04528..056ec1abccbb95d673b117adb08236896513e954 100644 (file)
@@ -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)
 {
 ?>
 <h1>Welcome to Bugdar</h1>
@@ -43,7 +43,7 @@ if ($bugsys->in['mark'] == 0)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 1)
+if ($input->in['mark'] == 1)
 {
 ?>
        <h1>Major Table Changes</h1>
@@ -69,7 +69,7 @@ if ($bugsys->in['mark'] == 1)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 2)
+if ($input->in['mark'] == 2)
 {
 ?>
        <h1>User Table Changes</h1>
@@ -93,7 +93,7 @@ if ($bugsys->in['mark'] == 2)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 3)
+if ($input->in['mark'] == 3)
 {
 ?>
        <h1>Minor Table Changes</h1>
@@ -124,7 +124,7 @@ if ($bugsys->in['mark'] == 3)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 4)
+if ($input->in['mark'] == 4)
 {
 ?>
        <h1>Caching User Data in Bug Table</h1>
@@ -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)
 {
 ?>
        <h1>Updating Old History Items</h1>
@@ -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)
 {
 ?>
 <h1>Adding User Email Options</h1>
@@ -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)
 {
 ?>
 <h1>Version Number Change</h1>
@@ -278,10 +278,4 @@ if ($bugsys->in['mark'] == 7)
 
 page_end();
 
-/*=====================================================================*\
-|| ###################################################################
-|| # $HeadURL$
-|| # $Id$
-|| ###################################################################
-\*=====================================================================*/
 ?>
\ No newline at end of file
index 4f9cd4c01f934bc046335cfb1d3ca9953c4f8773..af3b7a51b64fbb7b404c8098e5f5ed5ca9617aa7 100644 (file)
@@ -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)
 {
 ?>
 <h1>Welcome to Bugdar</h1>
@@ -43,7 +43,7 @@ if ($bugsys->in['mark'] == 0)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 1)
+if ($input->in['mark'] == 1)
 {
 ?>
        <h1>Language System Updates</h1>
@@ -74,7 +74,7 @@ if ($bugsys->in['mark'] == 1)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 2)
+if ($input->in['mark'] == 2)
 {
 ?>
        <h1>English US Changes</h1>
@@ -93,7 +93,7 @@ if ($bugsys->in['mark'] == 2)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 3)
+if ($input->in['mark'] == 3)
 {
 ?>
        <h1>Adding New Permission Mask</h1>
@@ -108,7 +108,7 @@ if ($bugsys->in['mark'] == 3)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 4)
+if ($input->in['mark'] == 4)
 {
 ?>
 <h1>Version Number Change</h1>
@@ -132,10 +132,4 @@ if ($bugsys->in['mark'] == 4)
 
 page_end();
 
-/*=====================================================================*\
-|| ###################################################################
-|| # $HeadURL$
-|| # $Id$
-|| ###################################################################
-\*=====================================================================*/
 ?>
\ No newline at end of file
index 838467099a9df8504cc1e03e4350798129a10670..b68fc2d21a8e8379620443982fb1115557e16927 100644 (file)
@@ -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)
 {
 ?>
 <h1>Welcome to Bugdar</h1>
@@ -43,7 +43,7 @@ if ($bugsys->in['mark'] == 0)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 1)
+if ($input->in['mark'] == 1)
 {
 ?>
 <h1>Version Number Change</h1>
@@ -67,10 +67,4 @@ if ($bugsys->in['mark'] == 1)
 
 page_end();
 
-/*=====================================================================*\
-|| ###################################################################
-|| # $HeadURL$
-|| # $Id$
-|| ###################################################################
-\*=====================================================================*/
 ?>
\ No newline at end of file
index 4b7be8e99e0729219beec0117025d50777ea32d6..3f85d8d7d87d3a83ee7c1f533b1462579c648d6c 100644 (file)
@@ -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)
 {
 ?>
 <h1>Welcome to Bugdar</h1>
@@ -44,7 +44,7 @@ if ($bugsys->in['mark'] == 0)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 1)
+if ($input->in['mark'] == 1)
 {
 ?>
        <h1>Rename Automatic Actions</h1>
@@ -61,7 +61,7 @@ if ($bugsys->in['mark'] == 1)
        build_automations();
        echo "Rebuilding the automations cahce<br />\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)
 {
 ?>
 <h1>Version Number Change</h1>
@@ -101,10 +101,4 @@ if ($bugsys->in['mark'] == 2)
 
 page_end();
 
-/*=====================================================================*\
-|| ###################################################################
-|| # $HeadURL$
-|| # $Id$
-|| ###################################################################
-\*=====================================================================*/
 ?>
\ No newline at end of file
index 2e34f457f0410403fd9f19942962c955d758e907..51c04cd8af20be11e7043c8bffd04c8d9c3c9a71 100644 (file)
@@ -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)
 {
 ?>
 <h1>Welcome to Bugdar</h1>
@@ -44,7 +44,7 @@ if ($bugsys->in['mark'] == 0)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 1)
+if ($input->in['mark'] == 1)
 {
 ?>
 <h1>Version Number Change</h1>
@@ -68,10 +68,4 @@ if ($bugsys->in['mark'] == 1)
 
 page_end();
 
-/*=====================================================================*\
-|| ###################################################################
-|| # $HeadURL$
-|| # $Id$
-|| ###################################################################
-\*=====================================================================*/
 ?>
\ No newline at end of file
index 07c0afdc617cad7add841d2c7d9f658e03cdf25d..904d959f54ea27ee6348f167bd9d14cbb5d3c20b 100644 (file)
@@ -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)
 {
 ?>
 <h1>Welcome to Bugdar</h1>
@@ -44,7 +44,7 @@ if ($bugsys->in['mark'] == 0)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 1)
+if ($input->in['mark'] == 1)
 {
 ?>
 <h1>Version Number Change</h1>
@@ -68,10 +68,4 @@ if ($bugsys->in['mark'] == 1)
 
 page_end();
 
-/*=====================================================================*\
-|| ###################################################################
-|| # $HeadURL$
-|| # $Id$
-|| ###################################################################
-\*=====================================================================*/
 ?>
\ No newline at end of file
index fea0985655aee58afc8e32eb8f4f2b303826d24b..7c1a09e9160cbfb33a63aa28a43167f1e7a665e4 100644 (file)
@@ -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)
 {
 ?>
 <h1>Welcome to Bugdar</h1>
@@ -44,7 +44,7 @@ if ($bugsys->in['mark'] == 0)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 1)
+if ($input->in['mark'] == 1)
 {
 ?>
 <h1>Version Number Change</h1>
@@ -68,10 +68,4 @@ if ($bugsys->in['mark'] == 1)
 
 page_end();
 
-/*=====================================================================*\
-|| ###################################################################
-|| # $HeadURL$
-|| # $Id$
-|| ###################################################################
-\*=====================================================================*/
 ?>
\ No newline at end of file
index 062edafb3bd362e7b5d91ca23cd95af8fb0ed787..1276db5124944132dc889a39687b20dba4f9e545 100644 (file)
@@ -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)
 {
 ?>
 <h1>Welcome to Bugdar</h1>
@@ -42,7 +42,7 @@ if ($bugsys->in['mark'] == 0)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 1)
+if ($input->in['mark'] == 1)
 {
 ?>
 <h1>Schema Changes</h1>
@@ -57,7 +57,7 @@ if ($bugsys->in['mark'] == 1)
 
 // ###################################################################
 
-if ($bugsys->in['mark'] == 2)
+if ($input->in['mark'] == 2)
 {
 ?>
 <h1>Version Number Change</h1>
@@ -81,10 +81,4 @@ if ($bugsys->in['mark'] == 2)
 
 page_end();
 
-/*=====================================================================*\
-|| ###################################################################
-|| # $HeadURL$
-|| # $Id$
-|| ###################################################################
-\*=====================================================================*/
 ?>
\ No newline at end of file
index d60908c2d451beb2fa03fe2861029524c1c2604d..fd81c9bf45f28c40d411700eaa24190437334ffd 100644 (file)
@@ -1,8 +1,8 @@
 <email>
-       <subject>Account Approved at {$bugsys->options['trackertitle']}</subject>
+       <subject>Account Approved at {bugdar::$options['trackertitle']}</subject>
        <bodyText>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.</bodyText>
 </email>
\ No newline at end of file
index e1f2673696853a244a095fb79e589afaaa38ad21..f542d29f6aac832589ba829e577583eaba224a8f 100644 (file)
@@ -1,8 +1,8 @@
 <email>
-       <subject>Welcome to {$bugsys->options['trackertitle']}</subject>
-       <bodyText>Hi {$bugsys->in['displayname']},
+       <subject>Welcome to {bugdar::$options['trackertitle']}</subject>
+       <bodyText>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&amp;userid=$userid&amp;activator=$activationid</bodyText>
+{bugdar::$options['trackerurl']}/register.php?do=activate&amp;userid=$userid&amp;activator=$activationid</bodyText>
 </email>
\ No newline at end of file
index e3019740fad47dcce0b2d8e143068d51b2cc8d00..9b6651f275688ff5160f60a3d42211a44d02f868 100644 (file)
@@ -1,10 +1,10 @@
 <email>
-       <subject>{$this->registry->options['trackertitle']} Bug Notification - {$this->bug['summary']}</subject>
+       <subject>{bugdar::$options['trackertitle']} Bug Notification - {$this->bug['summary']}</subject>
        <bodyText>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']}</bodyText>
+{bugdar::$options['trackerurl']}</bodyText>
 </email>
\ No newline at end of file
index 53fee41dc44a6d9b31b3f3140cd955cb1f77f3fa..3dfd93a1d1a93fe7ea5f04585e3922b5aa5c1ba1 100644 (file)
@@ -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
index c8294fb7ef2e1338e47bdd00c7d183740d1800f4..467ebfdb9c9a82d5eae264e5f0d109c6f397b0e2 100644 (file)
@@ -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
index 5ed9152486f15368e9d717ea6749bb8ca77994ef..86b0475cc37dd6dbed56302ea84320e54b15d685 100644 (file)
@@ -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
index 4408d9249591bad02f91dc244158f753394d431d..1292ab7eaaa5f6e6b00451a71cf98b6149383e31 100644 (file)
@@ -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
index 61153627dc64cdb64bb916c8294ba3b7e5cb1d5d..5bd532cb41fd93b5043245d55280b7e6ffad5580 100644 (file)
@@ -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
index eab2f01155e11206bd49cae9bcf099e4533b360a..a7b95dea5faff0344cdb0a2e09dcf7ae5bee1d26 100644 (file)
@@ -1,10 +1,10 @@
 <email>
-       <subject>{$bugsys->options['trackertitle']} Password Reset</subject>
-       <bodyText>Hi {$user->objdata['displayname']},
+       <subject><%- bugdar::$options['trackertitle'] %> Password Reset</subject>
+       <bodyText>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&amp;activator=$activator
+<%- bugdar::$options['trackerurl'] %>/login.php?do=recoverpw&amp;activator=<%- $activator %>
 
 If you did not request this, do not worry as this notice will expire in 24 hours.</bodyText>
 </email>
\ No newline at end of file
index 494779a3c798e184b1b036e9587407ad2ae34a52..71930bd472d4f4db0388ab1df5ab8549de7a26b8 100644 (file)
@@ -1,8 +1,8 @@
 <email>
-       <subject>Welcome to {$bugsys->options['trackertitle']}</subject>
+       <subject>Welcome to {bugdar::$options['trackertitle']}</subject>
        <bodyText>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.</bodyText>
 </email>
\ No newline at end of file
index e1e54b518405aef40ba5de51b61f716ae4740248..c38ca4553232b92fd205ba929d506a6eedd64643 100755 (executable)
--- 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
index 5255a561189058b3c195e6453b96c11db4be6801..a845111b8af24a3605df8a8c6843127ea5adc14d 100755 (executable)
@@ -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
index c849890e122ec25d260812c4061fab8a79613817..1da5109405d41d3e6aca2e8847d48fa2f94ff74b 100755 (executable)
@@ -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
index e22c3b6bb79a2e5c3868db4deac12a955b66db6b..4b323e2ef39fdcb9849b91808a6d022d96075417 100644 (file)
@@ -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 <a href="search.php?new=1">try again</a> 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 = '<?xml version="1.0" encoding="' . $language['charset'] . '"?>
 
-<bugdarExport user="' . $bugsys->unsanitize(construct_user_display($bugsys->userinfo, false)) . '" date="' . $datef->format('r', TIMENOW) . '" searchid="' . $search['searchid'] . '">';
+<bugdarExport user="' . $input->unsanitize(construct_user_display(bugdar::$userinfo, false)) . '" date="' . $datef->format('r', TIMENOW) . '" searchid="' . $search['searchid'] . '">';
 
-       while ($bug = $db->fetch_array($bugs))
+       foreach ($bugs as $bug)
        {
                $xml .= "\n\t<bug>";
                
@@ -605,7 +621,7 @@ if ($_REQUEST['do'] == 'export')
                $xml .= "\n\t\t<dateReported>" . $datef->format('r', $bug['dateline']) . "</dateReported>";
                if ($bug['userid'])
                {
-                       $xml .= "\n\t\t<reporter>" . construct_user_display($db->query_first("SELECT * FROM " . TABLE_PREFIX . "user WHERE userid = $bug[userid]"), false) . "</reporter>";
+                       $xml .= "\n\t\t<reporter>" . construct_user_display($db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "user WHERE userid = $bug[userid]"), false) . "</reporter>";
                }
                $xml .= "\n\t\t<summary>" . $bug['summary'] . "</summary>";
                $xml .= "\n\t\t<product>" . $bug['product'] . "</product>";
@@ -617,7 +633,7 @@ if ($_REQUEST['do'] == 'export')
                $xml .= "\n\t\t<status>" . $bug['status'] . "</status>";
                if ($bug['assignedto'])
                {
-                       $xml .= "\n\t\t<assignedTo>" . construct_user_display($bugsys->datastore['assignto']["$bug[assignedto]"], false) . "</assignedTo>";
+                       $xml .= "\n\t\t<assignedTo>" . construct_user_display(bugdar::$datastore['assignto']["$bug[assignedto]"], false) . "</assignedTo>";
                }
                $xml .= "\n\t\t<resolution>" . $bug['resolution'] . "</resolution>";
                $xml .= "\n\t\t<severity>" . $bug['severity'] . "</severity>";
@@ -628,14 +644,14 @@ if ($_REQUEST['do'] == 'export')
        
        $xml .= "\n</bugdarExport>";
        
-       $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, "&amp;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
index ebef405970a74726972d56001c0f378d5a2d5f1e..b21e3c372e42030517f3097a7e56e9048774c730 100644 (file)
@@ -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
index 7119bad73d9555c2e4f960d6b12f504ef59ffb8a..fec4c42a4abb97481127f0dffc0b3784cbc1066d 100644 (file)
@@ -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[] = "<a href=\"showreport.php?bugid=$dependency[bugid]\" title=\"$dependency[summary]\">$dependency[bugid]</a>";
                }
@@ -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[] = "<a href=\"showreport.php?bugid=$duplicate[bugid]\" target=\"_blank\">$duplicate[summary]</a>";
        }
@@ -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[] = "<a href=\"showreport.php?bugid=$dependency[bugid]\" title=\"$dependency[summary]\" target=\"_blank\">$dependency[bugid]</a>";
                }
@@ -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
index 0f0329bbb9c35e0e6eac4f448a09e0362df95cf1..cea2ef1ceab9727d7a1d46dea433df305fa97f54 100644 (file)
@@ -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 .= '
        <entry>
@@ -68,21 +68,21 @@ while ($bug = $db->fetch_array($bugs_fetch))
                        </tr>
                        <tr>
                                <td><strong>' . T('Product/Component/Version') . ':</strong></td>
-                               <td>' . $bugsys->datastore['product']["$bug[product]"]['title'] . '/' . (($bug['component']) ? $bugsys->datastore['product']["$bug[component]"]['title'] . '/' : '') . $bugsys->datastore['version']["$bug[version]"]['version'] . '</td>
+                               <td>' . bugdar::$datastore['product']["$bug[product]"]['title'] . '/' . (($bug['component']) ? bugdar::$datastore['product']["$bug[component]"]['title'] . '/' : '') . bugdar::$datastore['version']["$bug[version]"]['version'] . '</td>
                        </tr>
                        <tr>
                                <td><strong>' . T('Status') . ':</strong></td>
-                               <td>' . $bugsys->datastore['status']["$bug[status]"]['status'] . '</td>
+                               <td>' . bugdar::$datastore['status']["$bug[status]"]['status'] . '</td>
                        </tr>
                        <tr>
                                <td><strong>' . T('Severity') . ':</strong></td>
-                               <td>' . $bugsys->datastore['severity']["$bug[severity]"]['severity'] . '</td>
+                               <td>' . bugdar::$datastore['severity']["$bug[severity]"]['severity'] . '</td>
                        </table>
                        
                        <p>' . $bug['comment_parsed'] . '</p>') . '
                </content>
                <summary type="text">' . htmlspecialchars($bug['comment_parsed']) . '</summary>
-               <link rel="alternate" href="' . $bugsys->options['trackerurl'] . '/showreport.php?bugid=' . $bug['bugid'] . '"/>
+               <link rel="alternate" href="' . bugdar::$options['trackerurl'] . '/showreport.php?bugid=' . $bug['bugid'] . '"/>
        </entry>';
        
        $lastupdated = $bug["$timestamp"];
@@ -91,8 +91,8 @@ while ($bug = $db->fetch_array($bugs_fetch))
 echo '<?xml version="1.0" encoding="' . $language['charset'] . '"?>
 <feed xmlns="http://www.w3.org/2005/Atom">
 
-       <title>' . sprintf(T('%1$s Syndication Feed'), $bugsys->options['trackertitle']) . '</title>
-       <link href="' . $bugsys->options['trackerurl'] . '"/>
+       <title>' . sprintf(T('%1$s Syndication Feed'), bugdar::$options['trackertitle']) . '</title>
+       <link href="' . bugdar::$options['trackerurl'] . '"/>
        <updated>' . gmdate('Y-m-d\TH:i:s\Z', $lastupdated) . '</updated>
        
        <!-- entries -->
@@ -105,10 +105,4 @@ echo '
 
 </feed>';
 
-/*=====================================================================*\
-|| ###################################################################
-|| # $HeadURL$
-|| # $Id$
-|| ###################################################################
-\*=====================================================================*/
 ?>
\ No newline at end of file
index eb286b15e29c81e44d106b679caa161a56dce50c..87a87b36d595c726ca27d4ae8a1e6458bbf7123d 100644 (file)
@@ -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
index acad0e05b47ba213e3450b8f13bdbfe62cf1304e..27008fd1961e2a944949e2f18cc830c7e8f2fabb 100644 (file)
@@ -1,6 +1,6 @@
-       <!-- custom field$field[fieldid] -->
+       <!-- custom field<%- $field['fieldid'] %> -->
        <fieldset>
-               <legend>$field[name] $help[field$field[fieldid]]</legend>
-               <div class="field"><if condition="$searchMode"><select name="custom$field[fieldid]"><option value="0">{@"Ignore"}</option><option value="1">{@"Yes"}</option><option value="-1">{@"No"}</option></select><else /><input name="custom$field[fieldid]" type="checkbox" value="1"$selected /></if></div>
+               <legend><%- $field['name'] %> help[field<%- $field['fieldid'] %>]</legend>
+               <div class="field"><% if ($searchMode): %><select name="custom<%- $field['fieldid'] %>"><option value="0"><%-T("Ignore")%></option><option value="1"><%-T("Yes")%></option><option value="-1"><%-T("No")%></option></select><% else: %><input name="custom<%- $field['fieldid'] %>" type="checkbox" value="1"<%- $selected %> /><% endif %></div>
        </fieldset>
-       <!-- / custom field$field[fieldid] -->
\ No newline at end of file
+       <!-- / custom field<%- $field['fieldid'] %> -->
\ No newline at end of file
index 576fc8f0bb817c4866a0032e7712e85710e8bb3e..b1e420ba8a61b8424cc9ec20e9e9bbbeccee9553 100644 (file)
@@ -1,6 +1,6 @@
-       <!-- custom field$field[fieldid] -->
+       <!-- custom field<%- $field['fieldid'] %> -->
        <fieldset>
-               <legend>$field[name] $help[field$field[fieldid]]</legend>
-               <div class="field"><input name="custom$field[fieldid]" type="text" value="$value" size="35"<if condition="$field['maxlength']"> maxlength="$field[maxlength]"</if> /></div>
+               <legend><%- $field['name'] %> help[field<%- $field['fieldid'] %>]</legend>
+               <div class="field"><input name="custom<%- $field['fieldid'] %>" type="text" value="<%- $value %>" size="35"<% if ($field['maxlength']): %> maxlength="<%- $field['maxlength'] %>"<% endif %> /></div>
        </fieldset>
-       <!-- / custom field$field[fieldid] -->
+       <!-- / custom field<%- $field['fieldid'] %> -->
index 919adab90e62f3f0254ac0b4b5b83cbe3d51a9c2..bf3048f00b001fdf2d21d155e35d78d590ce6122 100644 (file)
@@ -1,6 +1,6 @@
-       <!-- custom field$field[fieldid] -->
+       <!-- custom field<%- $field['fieldid'] %> -->
        <fieldset>
-               <legend>$field[name] $help[field$field[fieldid]]</legend>
-               <div class="field"><select name="custom$field[fieldid]">$options</select></div>
+               <legend><%- $field['name'] %> <%- $help['field' . $field['fieldid']] %></legend>
+               <div class="field"><select name="custom<%- $field['fieldid'] %>"><%- $options %></select></div>
        </fieldset>
-       <!-- / custom field$field[fieldid] -->
\ No newline at end of file
+       <!-- / custom field<%- $field['fieldid'] %> -->
\ No newline at end of file
index 617bcdaf2e5d798e912e75c560be4ff3793e475c..c58fa58101972e3a1bf0983f72a95b21856133ef 100644 (file)
@@ -1,6 +1,6 @@
-       <!-- custom field$field[fieldid] -->
+       <!-- custom field<%- $field['fieldid'] %> -->
        <fieldset>
-               <legend>$field[name] $help[field$field[fieldid]]</legend>
-               <div class="field">$field[value]</div>
+               <legend><%- $field['name'] %> help[field<%- $field['fieldid'] %>]</legend>
+               <div class="field"><%- $field['value'] %></div>
        </fieldset>
-       <!-- / custom field$field[fieldid] -->
+       <!-- / custom field<%- $field['fieldid'] %> -->
index bfffd9e81c2a8db2dc8d6890f6d13b0e3c56198f..fc5fe40dc19457f66ffdb854b613476a46a96352 100644 (file)
@@ -1,44 +1,44 @@
-$doctype
-<html xmlns="http://www.w3.org/1999/xhtml" lang="$stylevar[lang]" xml:lang="$stylevar[lang]" dir="$stylevar[lang_dir]">
+<%- $doctype %>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="<%- $stylevar['lang'] %>" xml:lang="<%- $stylevar['lang'] %>" dir="<%- $stylevar['lang_dir'] %>">
 <head>
-$headinclude
+<%- $headinclude %>
        <link rel="stylesheet" type="text/css" href="templates/box.css" media="screen" />
-       <title>$attachment[filename] - $bug[summary]</title>
+       <title><%- $attachment['filename'] %> - <%- $bug['summary'] %></title>
 </head>
 
 <body>
 
-$header
+<%- $header %>
 
 <form action="attachment.php" method="post" enctype="multipart/form-data" name="newattach">
 
 <input name="do" type="hidden" value="update" />
-<input name="attachmentid" type="hidden" value="$attachment[attachmentid]" />
+<input name="attachmentid" type="hidden" value="<%- $attachment['attachmentid'] %>" />
 
 <div class="box">
-       <div class="box-head" style="text-align: $stylevar[left]">
-               <lang 1="$attachment[attachmentid]" 2="$bug[bugid]" 3="$bug[summary]">{@"Attachment #%1$s for Bug #%2$s %3$s"}</lang>
+       <div class="box-head" style="text-align: <%- $stylevar['left'] %>">
+               <%- sprintf(T('Attachment #%1$s for Bug #%2$s %3$s'), $attachment['attachmentid'], $bug['bugid'], $bug['summary']) %>
        </div>
 
-       <div class="box-mid box-margmod-bottom" style="text-align: $stylevar[left]">
-               <div><strong>{@"Attachment"}:</strong> <a href="viewattachment.php?attachmentid=$attachment[attachmentid]">{@"View"}</a> [$attachment[filename]]</div>
+       <div class="box-mid box-margmod-bottom" style="text-align: <%- $stylevar['left'] %>">
+               <div><strong><%-T("Attachment")%>:</strong> <a href="viewattachment.php?attachmentid=<%- $attachment['attachmentid'] %>"><%-T("View")%></a> [<%- $attachment['filename'] %>]</div>
        </div>
 
-       <div class="box-mid" style="text-align: $stylevar[left]">
-               <div><strong>{@"Description"}:</strong> <input name="description" type="text" size="35" maxlength="250" value="$attachment[description]" /></div>
-               <div><strong>{@"Obsolete"}:</strong> <input name="obsolete" type="checkbox" value="1"<if condition="$attachment['obsolete']"> checked="checked"</if> /></div>
+       <div class="box-mid" style="text-align: <%- $stylevar['left'] %>">
+               <div><strong><%-T("Description")%>:</strong> <input name="description" type="text" size="35" maxlength="250" value="<%- $attachment['description'] %>" /></div>
+               <div><strong><%-T("Obsolete")%>:</strong> <input name="obsolete" type="checkbox" value="1"<% if ($attachment['obsolete']): %> checked="checked"<% endif %> /></div>
        </div>
 </div>
 
 <br />
 
 <div id="submitrow">
-       <input name="submit" type="submit" value="  {@"Submit"}  " accesskey="s" />
-       <if condition="$show['delete']"><input name="__delete__" type="submit" value="  {@"Delete"}  " /></if>
-       <input name="reset" type="reset" value="  {@"Reset"}  " accesskey="r" />
-       <script type="text/javascript"> draw_cancel("showreport.php?bugid=$bug[bugid]"); </script>
+       <input name="submit" type="submit" value="  <%-T("Submit")%>  " accesskey="s" />
+       <% if ($show['delete']): %><input name="__delete__" type="submit" value="  <%-T("Delete")%>  " /><% endif %>
+       <input name="reset" type="reset" value="  <%-T("Reset")%>  " accesskey="r" />
+       <script type="text/javascript"> draw_cancel("showreport.php?bugid=<%- $bug['bugid'] %>"); </script>
 </div>
 
 </form>
 
-$footer
\ No newline at end of file
+<%- $footer %>
\ No newline at end of file
index 570e8f4250e8843c1c3d329e3182bca1cc73fd3c..1eaa36dc6e295f20de484bf3bb0b50e1b68aeeee 100644 (file)
@@ -1,46 +1,46 @@
-$doctype
-<html xmlns="http://www.w3.org/1999/xhtml" lang="$stylevar[lang]" xml:lang="$stylevar[lang]" dir="$stylevar[lang_dir]">
+<%- $doctype %>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="<%- $stylevar['lang'] %>" xml:lang="<%- $stylevar['lang'] %>" dir="<%- $stylevar['lang_dir'] %>">
 <head>
-$headinclude
+<%- $headinclude %>
        <link rel="stylesheet" type="text/css" href="templates/box.css" media="screen" />
-       <title><lang 1="$comment[commentid]">{@"Edit Comment %1$s"}</lang> - $bug[summary]</title>
+       <title><%- sprintf(T('Edit Comment %1$s'), $comment['commentid']) %> - <%- $bug['summary'] %></title>
 </head>
 
 <body>
 
-$header
+<%- $header %>
 
-<if condition="$show['errors']">
-<div class="error" style="text-align: $stylevar[left]">
-       {@"The following errors occurred"}:
-       {$message->errorBox}
+<% if ($show['errors']): %>
+<div class="error" style="text-align: <%- $stylevar['left'] %>">
+       <%-T("The following errors occurred")%>:
+       <%- $message->errorBox %>
 </div>
-</if>
+<% endif %>
 
 <form name="editcomment" method="post" action="editcomment.php">
 <input type="hidden" name="do" value="update" />
-<input type="hidden" name="commentid" value="$comment[commentid]" />
+<input type="hidden" name="commentid" value="<%- $comment['commentid'] %>" />
 
 <div class="box">
-       <div class="box-head" style="text-align: $stylevar[left]">
-               <lang 1="$comment[commentid]" 2="$bug[bugid]" 3="$bug[summary]">{@"Comment #%1$s in bug #%2$s <em>%3$s</em>"}</lang>
+       <div class="box-head" style="text-align: <%- $stylevar['left'] %>">
+               <%- sprintf(T('Comment #%1$s in bug #%2$s <em>%3$s</em>'), $comment['commentid'], $bug['bugid'], $bug['summary']) %>
        </div>
 
-       <div class="box-foot box-margmod-bottom" style="text-align: $stylevar[left]"><lang 1="$comment[posttime]" 2="$comment[postby]">{@"Posted on %1$s by %2$s"}</lang></div>
+       <div class="box-foot box-margmod-bottom" style="text-align: <%- $stylevar['left'] %>"><%- sprintf(T('Posted on %1$s by %2$s'), $comment['posttime'], $comment['postby']) %></div>
 
-       <div class="box-mid" style="text-align: $stylevar[left]">
-               <if condition="$show['hide']"><div><strong<if condition="$comment['hidden']"> style="color: red"</if>>{@"Hidden"}:</strong> <input type="checkbox" name="hidden" value="1"<if condition="$comment['hidden']"> checked="checked"</if> /></div></if>
-               <div><strong>{@"Parse Links in the Comment"}:</strong> <input type="checkbox" name="parselinks" value="1"<if condition="$comment['parselinks']"> checked="checked"</if> /></div>
-               <textarea name="comment" cols="50" rows="15" class="textarea">$comment[comment]</textarea>
+       <div class="box-mid" style="text-align: <%- $stylevar['left'] %>">
+               <% if ($show['hide']): %><div><strong<% if ($comment['hidden']): %> style="color: red"<% endif %>><%-T("Hidden")%>:</strong> <input type="checkbox" name="hidden" value="1"<% if ($comment['hidden']): %> checked="checked"<% endif %> /></div><% endif %>
+               <div><strong><%-T("Parse Links in the Comment")%>:</strong> <input type="checkbox" name="parselinks" value="1"<% if ($comment['parselinks']): %> checked="checked"<% endif %> /></div>
+               <textarea name="comment" cols="50" rows="15" class="textarea"><%- $comment['comment'] %></textarea>
        </div>
 </div>
 
 <br />
 
 <div id="submitrow">
-       <input type="submit" name="submit" accesskey="s" value="  {@"Save Changes"}  " />
-       <input type="reset" name="reset" accesskey="r" value="  {@"Reset Fields"}  " />
-       <script type="text/javascript"> draw_cancel("showreport.php?bugid=$bug[bugid]"); </script>
+       <input type="submit" name="submit" accesskey="s" value="  <%-T("Save Changes")%>  " />
+       <input type="reset" name="reset" accesskey="r" value="  <%-T("Reset Fields")%>  " />
+       <script type="text/javascript"> draw_cancel("showreport.php?bugid=<%- $bug['bugid'] %>"); </script>
 </div>
 
-$footer
\ No newline at end of file
+<%- $footer %>
\ No newline at end of file
index 90fb8684791a2229d399fac27e08343559b6f35f..437f4d335d451c79f53f9ec0d133c48cbde63d62 100644 (file)
@@ -1,18 +1,18 @@
-$doctype
-<html xmlns="http://www.w3.org/1999/xhtml" lang="$stylevar[lang]" xml:lang="$stylevar[lang]" dir="$stylevar[lang_dir]">
+<%- $doctype %>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="<%- $stylevar['lang'] %>" xml:lang="<%- $stylevar['lang'] %>" dir="<%- $stylevar['lang_dir'] %>">
 <head>
-$headinclude
-       <title>{$bugsys->options['trackertitle']} - {@"Automations"}</title>
+<%- $headinclude %>
+       <title><%- bugdar::$options['trackertitle'] %> - <%-T("Automations")%></title>
 </head>
 
 <body>
 
-$header
+<%- $header %>
 
-<h2>{@"Explication of Automations"}</h2>
+<h2><%-T("Explication of Automations")%></h2>
 
 <table class="table">
-$automations
+<%- $automations %>
 </table>
 
-$footer
\ No newline at end of file
+<%- $footer %>
\ No newline at end of file
index cc841b4fcfcc869e4c390fafe54989379ccc084b..7bc71f412f7c5c1385941573197b3e58e775ba4a 100644 (file)
@@ -1,35 +1,35 @@
-$doctype
-<html xmlns="http://www.w3.org/1999/xhtml" lang="$stylevar[lang]" xml:lang="$stylevar[lang]" dir="$stylevar[lang_dir]">
+<%- $doctype %>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="<%- $stylevar['lang'] %>" xml:lang="<%- $stylevar['lang'] %>" dir="<%- $stylevar['lang_dir'] %>">
 <head>
-$headinclude
-       <title>{$bugsys->options['trackertitle']} - {@"Products"}</title>
+<%- $headinclude %>
+       <title><%- bugdar::$options['trackertitle'] %> - <%-T("Products")%></title>
 </head>
 
 <body>
 
-$header
+<%- $header %>
 
-<h2>{@"Explication of Products"}</h2>
+<h2><%-T("Explication of Products")%></h2>
 
-<if condition="$globalversions">
+<% if ($globalversions): %>
        <table class="table">
        <tr class="listinghead">
-               <td colspan="2">{@"Global Versions"}</td>
+               <td colspan="2"><%-T("Global Versions")%></td>
        </tr>
        <tr class="altcolor">
-               <td colspan="2">{@"These versions are avaliable for every product, component, and version."}</td>
+               <td colspan="2"><%-T("These versions are avaliable for every product, component, and version.")%></td>
        </tr>
-       $globalversions
+       <%- $globalversions %>
        </table>
-</if>
+<% endif %>
 
 <br />
 
 <table class="table">
 <tr class="listinghead">
-       <td colspan="2">{@"Products (components are in white)"}</td>
+       <td colspan="2"><%-T("Products (components are in white)")%></td>
 </tr>
-$productlist
+<%- $productlist %>
 </table>
 
-$footer
\ No newline at end of file
+<%- $footer %>
\ No newline at end of file
index 4eb5af72e2b980ae4110b94d5b24e0baab47094c..07691a534d79d2718f5f9aadbf2adc109da6869e 100644 (file)
@@ -1,4 +1,4 @@
-<tr$trextra>
-       <td width="50%">$left</td>
-       <td>$right</td>
+<tr<%- $trextra %>>
+       <td width="50%"><%- $left %></td>
+       <td><%- $right %></td>
 </tr>
index 36e92349b9138b91f48655d25e698cc9ff403559..3b31eb563b8ade3b21f1e278f3a0579f7a18d1da 100644 (file)
@@ -1,27 +1,27 @@
-$doctype
-<html xmlns="http://www.w3.org/1999/xhtml" lang="$stylevar[lang]" xml:lang="$stylevar[lang]" dir="$stylevar[lang_dir]">
+<%- $doctype %>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="<%- $stylevar['lang'] %>" xml:lang="<%- $stylevar['lang'] %>" dir="<%- $stylevar['lang_dir'] %>">
 <head>
-$headinclude
-       <title>{$bugsys->options['trackertitle']} - {@"My Favorite Bugs"}</title>
+<%- $headinclude %>
+       <title><%- bugdar::$options['trackertitle'] %> - <%-T("My Favorite Bugs")%></title>
 </head>
 
 <body>
 
-$header
+<%- $header %>
 
 <table class="table">
 <tr class="listinghead">
-$headers
+<%- $headers %>
 </tr>
-$bugs
+<%- $bugs %>
 </table>
 
-<if condition="$show['pagenav']">
+<% if ($show['pagenav']): %>
 <!-- pagenav -->
 <div align="right">
-$pagenav
+<%- $pagenav %>
 </div>
 <!-- / pagenav -->
-</if>
+<% endif %>
 
-$footer
\ No newline at end of file
+<%- $footer %>
\ No newline at end of file
index bca50a9e22be1a6f54a14bb5875da2b5de49eb94..91d88d503e6f923ea9bfb440421add32eadd15e9 100644 (file)
@@ -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
index 139f555c04b43fcf29311e9992d39434d8df4aee..2c4f8809b0a3e9690416c4251dcc8c1ced6ecc6b 100644 (file)
@@ -1,7 +1,7 @@
 </div>
 
 <div id="copyright">
-       <div>{@"Powered by Bugdar"}, {@"Copyright"} &copy;2002 - $year Blue Static</div>
+       <div><%-T("Powered by Bugdar")%>, <%-T("Copyright")%> &copy;2002 - <%- date('Y') %> Blue Static</div>
 </div>
 
 </body>
index 3b698def76145516c6f5d22961c812029c79d2cc..ad79d35e69c09bbc258d974bdb44b2625bb79010 100644 (file)
@@ -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
index 72ae17334daedd381b8fdfadeeb8361f1124a8c8..3b136fa47907a153dabc5980900d08eba78af9e9 100644 (file)
@@ -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
index 9f561074957eb25caa1fe7c54b916170a36d1002..b464cad01858fbf666aca9f3a11ac7842b776733 100644 (file)
@@ -1,44 +1,44 @@
 <div id="header">
        <!-- quick search -->
-       <form name="quicksearch" action="showreport.php" method="post" id="quicksearch" style="float: $stylevar[right]">
+       <form name="quicksearch" action="showreport.php" method="post" id="quicksearch" style="float: <%- $stylevar['right'] %>">
        <input type="hidden" name="do" value="quicksearch" />
-       {@"Go to bug ID"} <input type="text" name="bugid" size="5" /> <input type="submit" name="submit" value="  {@"Go"}  " />
+       <%-T("Go to bug ID")%> <input type="text" name="bugid" size="5" /> <input type="submit" name="submit" value="  <%-T("Go")%>  " />
        </form>
        <!-- / quick search -->
        
-       <span id="title"><a href="index.php">{$bugsys->options['trackertitle']}</a></span>
+       <span id="title"><a href="index.php"><%- bugdar::$options['trackertitle'] %></a></span>
        &nbsp;
-       <img src="templates/images/clock.gif" alt="{@"Current Date and Time"}" />
-       <span id="time">$datetime</span>
+       <img src="templates/images/clock.gif" alt="<%-T("Current Date and Time")%>" />
+       <span id="time"><%- BSApp::$date->format('l, F j, Y g:i A') %></span>
 </div>
 
-<if condition="!$bugsys->userinfo['userid']">
+<% if (!bugdar::$userinfo['userid']): %>
 <div class="alertbox">
-       {@"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 <a href="register.php">Register</a> tab at the top. If you are already registered, you can login at the <a href="login.php">Login</a> 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 <a href="register.php">Register</a> tab at the top. If you are already registered, you can login at the <a href="login.php">Login</a> tab.')%>
 </div>
-</if>
+<% endif %>
 
 <div id="tabbar">
-       <span style="float: $stylevar[right]" class="smallfont"><a href="syndicate.php"><img src="templates/images/feed.gif" alt="{@"Syndicate"}" style="border: 0px" /> {@"Syndicate"}</a></span>
+       <span style="float: <%- $stylevar['right'] %>" class="smallfont"><a href="syndicate.php"><img src="templates/images/feed.gif" alt="<%-T("Syndicate")%>" style="border: 0px" /> <%-T("Syndicate")%></a></span>
        
-       <a class="tab$focus[index]" href="index.php">{@"Listing"}</a>
-       <if condition="$show['newreport']">
-               <a class="tab$focus[newreport]" href="newreport.php">{@"New"}</a>
-       </if>
-       <a class="tab$focus[showreport]" href="showreport.php">{@"Display"}</a>
-       <if condition="$show['search']">
-               <a class="tab$focus[search]" href="search.php">{@"Search"}</a>
-       </if>
-       <if condition="$bugsys->userinfo['userid']">
-               <a class="tab$focus[favorites]" href="favorite.php">{@"Favorites"}</a>
-       </if>
-       <a class="tab$focus[user]" href="<if condition="$bugsys->userinfo['userid']">userctrl.php">{@"Options"}<else />login.php">{@"Login/Register"}</if></a>
-       <if condition="$show['admin']">
-               <a class="tab" href="admin/index.php">{@"Administration"}</a>
-       </if>
-       <if condition="$bugsys->userinfo['userid']">
-               <a class="tab$focus[logout]" href="login.php?do=logout" onclick="return confirm('{@"Are you sure you want to log out?"}')">{@"Logout"}</a>
-       </if>
+       <a class="tab<%- $focus['index'] %>" href="index.php"><%-T("Listing")%></a>
+       <% if ($show['newreport']): %>
+               <a class="tab<%- $focus['newreport'] %>" href="newreport.php"><%-T("New")%></a>
+       <% endif %>
+       <a class="tab<%- $focus['showreport'] %>" href="showreport.php"><%-T("Display")%></a>
+       <% if ($show['search']): %>
+               <a class="tab<%- $focus['search'] %>" href="search.php"><%-T("Search")%></a>
+       <% endif %>
+       <% if (bugdar::$userinfo['userid']): %>
+               <a class="tab<%- $focus['favorites'] %>" href="favorite.php"><%-T("Favorites")%></a>
+       <% endif %>
+       <a class="tab<%- $focus['user'] %>" href="<% if (bugdar::$userinfo['userid']): %>userctrl.php"><%-T("Options")%><% else: %>login.php"><%-T("Login/Register")%><% endif %></a>
+       <% if ($show['admin']): %>
+               <a class="tab" href="admin/index.php"><%-T("Administration")%></a>
+       <% endif %>
+       <% if (bugdar::$userinfo['userid']): %>
+               <a class="tab<%- $focus['logout'] %>" href="login.php?do=logout" onclick="return confirm('<%-T("Are you sure you want to log out?")%>')"><%-T("Logout")%></a>
+       <% endif %>
 </div>
 
 <div id="content">
\ No newline at end of file
index 339ec1a5fa183f1423fc5fe128311c02fac685d6..a73a61ad2ed9fc4f58622e4833848c302c658a9a 100644 (file)
@@ -1,6 +1,6 @@
        <!-- CSS and JavaScript goes here -->
-       <meta http-equiv="Content-Type" content="text/html; charset=$stylevar[charset]" />
+       <meta http-equiv="Content-Type" content="text/html; charset=<%- $stylevar[charset] %>" />
        <link rel="stylesheet" type="text/css" href="templates/global.css" media="screen" />
        <link rel="alternate" type="application/atom+xml" title="Atom 1.0" href="syndicate.php" />
-       <script type="text/javascript"> var lang = { "Cancel" : "{@"Cancel"}" }; </script>
+       <script type="text/javascript"> var lang = { "Cancel" : "<%-T("Cancel")%>" }; </script>
        <script src="templates/global.js" type="text/javascript"></script>
\ No newline at end of file
index 67ad92e84c713299111d802af9337c4923a44b0a..e7c9180568fd5793d4a75372c65d50a630390d60 100644 (file)
@@ -1 +1 @@
-<a href="#" onclick="window.open('help.php?topic=$topic', 'helpwindow', 'menubar=no,toolbar=no,status=no,height=300,width=275')" title="{@"Help"}"><img src="templates/images/question-mark.gif" alt="?" class="helplink" /></a>
\ No newline at end of file
+<a href="#" onclick="window.open('help.php?topic=<%- $topic %>', 'helpwindow', 'menubar=no,toolbar=no,status=no,height=300,width=275')" title="<%-T("Help")%>"><img src="templates/images/question-mark.gif" alt="?" class="helplink" /></a>
\ No newline at end of file
index 181aa55f3993d0e7ed1e7393e9e829511ae59375..44e635568f85201e021a09091d946250b7e6abee 100644 (file)
@@ -1,19 +1,19 @@
-$doctype
-<html xmlns="http://www.w3.org/1999/xhtml" lang="$stylevar[lang]" xml:lang="$stylevar[lang]" dir="$stylevar[lang_dir]">
+<%- $doctype %>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="<%- $stylevar['lang'] %>" xml:lang="<%- $stylevar['lang'] %>" dir="<%- $stylevar['lang_dir'] %>">
 <head>
-$headinclude
+<%- $headinclude %>
        <link rel="stylesheet" type="text/css" href="templates/box.css" media="screen" />
-       <title>{@"Help"} - $topic[title]</title>
+       <title><%-T("Help")%> - <%- $topic['title'] %></title>
 </head>
 
 <body>
 
 <div align="center" style="margin-top: 10px">
        <div class="box" style="width: 90%">
-               <div class="box-head">{@"Help"} : $topic[title]</div>
+               <div class="box-head"><%-T("Help")%> : <%- $topic['title'] %></div>
 
                <div class="box-mid box-overpad">
-                       $topic[body]
+                       <%- $topic['body'] %>
                </div>
        </div>
 </div>
index 88add76c3af1dea4b0799a5561133108285a2b54..d7ab840adc8c263738dd5ee0605a3470a0404d84 100644 (file)
@@ -1,25 +1,25 @@
-$doctype
-<html xmlns="http://www.w3.org/1999/xhtml" lang="$stylevar[lang]" xml:lang="$stylevar[lang]" dir="$stylevar[lang_dir]">
+<%- $doctype %>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="<%- $stylevar['lang'] %>" xml:lang="<%- $stylevar['lang'] %>" dir="<%- $stylevar['lang_dir'] %>">
 <head>
-$headinclude
-       <title>{@"Bug History"} - $bug[summary]</title>
+<%- $headinclude %>
+       <title><%-T("Bug History")%> - <%- $bug['summary'] %></title>
 </head>
 
 <body>
 
-$header
+<%- $header %>
 
-<h2><lang 1="$bug[summary]" 2="$bug[bugid]">{@"History for <a href="showreport.php?bugid=%2$d"><em>%1$s</em></a> (bugid: %2$s)"}</lang></h2>
+<h2><%- sprintf(T('History for <a href="showreport.php?bugid=%2$d"><em>%1$s</em></a> (bugid: %2$s)'), $bug['summary'], $bug['bugid']) %></h2>
 
 <table class="table">
 <tr class="listinghead">
-       <td>{@"User"}</td>
-       <td>{@"Date"}</td>
-       <td>{@"Field"}</td>
-       <td>{@"Old Value"}</td>
-       <td>{@"New Value"}</td>
+       <td><%-T("User")%></td>
+       <td><%-T("Date")%></td>
+       <td><%-T("Field")%></td>
+       <td><%-T("Old Value")%></td>
+       <td><%-T("New Value")%></td>
 </tr>
-$history
+<%- $history %>
 </table>
 
-$footer
\ No newline at end of file
+<%- $footer %>
\ No newline at end of file
index 599b25ce5546610b2db46f47b4537f4ead5cf3a1..ccede1230d9ac260de2a89670ce86de9a525d545 100644 (file)
@@ -1,7 +1,7 @@
-<tr style="vertical-align: top"<if condition="$bgcolor"> class="$bgcolor"</if>>
-       <td width="10%"><if condition="$show['group']">$log[user]<else />&nbsp;</if></td>
-       <td width="20%"><if condition="$show['group']">$log[date]<else />&nbsp;</if></td>
-       <td width="20%">$log[field]</td>
-       <td width="25%">$log[original]</td>
-       <td width="25%">$log[changed]</td>
+<tr style="vertical-align: top"<% if ($bgcolor): %> class="<%- $bgcolor %>"<% endif %>>
+       <td width="10%"><% if ($show['group']): %><%- $log['user'] %><% else: %>&nbsp;<% endif %></td>
+       <td width="20%"><% if ($show['group']): %><%- $log['date'] %><% else: %>&nbsp;<% endif %></td>
+       <td width="20%"><%- $log['field'] %></td>
+       <td width="25%"><%- $log['original'] %></td>
+       <td width="25%"><%- $log['changed'] %></td>
 </tr>
index 2c05ff51856117828ab9fc388a107f4a207d595e..6add1506428da3bf86eb520455e9f318e4f95500 100644 (file)
@@ -1 +1 @@
-       <td>$name $image</td>
+       <td><%- $name %> <%- $image %></td>
index 17840a2f406d5cc21a6de7db05ca464145c54ee4..8a02d6226141a8738da713b67ee1ae5caacb997f 100644 (file)
@@ -1,14 +1,14 @@
-$doctype
-<html xmlns="http://www.w3.org/1999/xhtml" lang="$stylevar[lang]" xml:lang="$stylevar[lang]" dir="$stylevar[lang_dir]">
+<%- $doctype %>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="<%- $stylevar['lang'] %>" xml:lang="<%- $stylevar['lang'] %>" dir="<%- $stylevar['lang_dir'] %>">
 <head>
-$headinclude
+<%- $headinclude %>
        <link rel="stylesheet" type="text/css" href="templates/box.css" media="screen" />
-       <title>{$bugsys->options['trackertitle']} - {@"Login"}</title>
+       <title><%- bugdar::$options['trackertitle'] %> - <%-T("Login")%></title>
 </head>
 
 <body>
 
-$header
+<%- $header %>
 
 <form action="login.php" name="register" method="post">
 <input type="hidden" name="do" value="login" />
@@ -16,23 +16,23 @@ $header
 
 <div align="center" style="margin-top: 10px">
        <div class="box altwidth">
-               <div class="box-head">{@"Login"}</div>
+               <div class="box-head"><%-T("Login")%></div>
 
                <div class="box-mid">
-                       <div><strong>{@"Email"}:</strong> <input type="text" name="email" size="30" /></div>
-                       <div><strong>{@"Password"}:</strong> <input type="password" name="password" size="30" /></div>
-                       <div><strong>{@"Remember Me"}:</strong> <input type="checkbox" name="rememberme" value="1" /> {@"Yes"}</div>
+                       <div><strong><%-T("Email")%>:</strong> <input type="text" name="email" size="30" /></div>
+                       <div><strong><%-T("Password")%>:</strong> <input type="password" name="password" size="30" /></div>
+                       <div><strong><%-T("Remember Me")%>:</strong> <input type="checkbox" name="rememberme" value="1" /> <%-T("Yes")%></div>
                        <br />
-                       [<a href="register.php">{@"Register"}</a>] [<a href="login.php?do=lostpw">{@"Lost Password"}</a>]
+                       [<a href="register.php"><%-T("Register")%></a>] [<a href="login.php?do=lostpw"><%-T("Lost Password")%></a>]
                </div>
 
                <div class="box-foot box-center">
-                       <input type="submit" name="submit" value="  {@"Login"}  " accesskey="s" />
-                       <input type="reset" name="reset" value="  {@"Reset"}  " accesskey="r" />
+                       <input type="submit" name="submit" value="  <%-T("Login")%>  " accesskey="s" />
+                       <input type="reset" name="reset" value="  <%-T("Reset")%>  " accesskey="r" />
                </div>
        </div>
 </div>
 
 </form>
 
-$footer
\ No newline at end of file
+<%- $footer %>
\ No newline at end of file
index 9694a9fbd360aec078b26a78913446b13c7ed22b..e47c6d0a9d04fd1473aa272927b46e394a7a415f 100644 (file)
@@ -1,35 +1,35 @@
-$doctype
-<html xmlns="http://www.w3.org/1999/xhtml" lang="$stylevar[lang]" xml:lang="$stylevar[lang]" dir="$stylevar[lang_dir]">
+<%- $doctype %>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="<%- $stylevar['lang'] %>" xml:lang="<%- $stylevar['lang'] %>" dir="<%- $stylevar['lang_dir'] %>">
 <head>
-$headinclude
+<%- $headinclude %>
        <link rel="stylesheet" type="text/css" href="templates/box.css" media="screen" />
-       <title>{$bugsys->options['trackertitle']} - {@"Lost Password"}</title>
+       <title><%- bugdar::$options['trackertitle'] %> - <%-T("Lost Password")%></title>
 </head>
 
 <body>
 
-$header
+<%- $header %>
 
 <form action="login.php" name="lostpw" method="post">
 <input type="hidden" name="do" value="sendpw" />
 
 <div align="center" style="margin-top: 10px">
        <div class="box altwidth">
-               <div class="box-head">{@"Lost Password Recovery"}</div>
+               <div class="box-head"><%-T("Lost Password Recovery")%></div>
 
                <div class="box-mid">
-                       <if condition="$show['lostpwerror']"><div class="error">{@"The specified email could not be found or it is invalid."}</div></if>
-                       <div>{@"Enter your email in the box below and you will receive a message with instructions on how to set a new password."}</div>
-                       <div><strong>{@"Email"}:</strong> <input type="text" name="email" size="30" value="{$bugsys->in['email']}" /></div>
+                       <% if ($show['lostpwerror']): %><div class="error"><%-T("The specified email could not be found or it is invalid.")%></div><% endif %>
+                       <div><%-T("Enter your email in the box below and you will receive a message with instructions on how to set a new password.")%></div>
+                       <div><strong><%-T("Email")%>:</strong> <input type="text" name="email" size="30" value="<%- $input->in['email'] %>" /></div>
                </div>
 
                <div class="box-foot box-center">
-                       <input type="submit" name="submit" value="  {@"Submit"}  " accesskey="s" />
-                       <input type="reset" name="reset" value="  {@"Reset"}  " accesskey="r" />
+                       <input type="submit" name="submit" value="  <%-T("Submit")%>  " accesskey="s" />
+                       <input type="reset" name="reset" value="  <%-T("Reset")%>  " accesskey="r" />
                </div>
        </div>
 </div>
 
 </form>
 
-$footer
\ No newline at end of file
+<%- $footer %>
\ No newline at end of file
index 99e6892aa57214e476475514eab5f0ef54be7600..e209aa65246606edf4e77ab82d086da8aa283793 100644 (file)
@@ -1,63 +1,63 @@
-$doctype
-<html xmlns="http://www.w3.org/1999/xhtml" lang="$stylevar[lang]" xml:lang="$stylevar[lang]" dir="$stylevar[lang_dir]">
+<%- $doctype %>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="<%- $stylevar['lang'] %>" xml:lang="<%- $stylevar['lang'] %>" dir="<%- $stylevar['lang_dir'] %>">
 <head>
-$headinclude
+<%- $headinclude %>
        <link rel="stylesheet" type="text/css" href="templates/box.css" media="screen" />
-       <title>{@"New Attachment"} - $bug[summary]</title>
+       <title><%-T("New Attachment")%> - <%- $bug['summary'] %></title>
 </head>
 
 <body>
 
-$header
+<%- $header %>
 
-<if condition="$show['errors']">
-<div class="error" style="text-align: $stylevar[left]">
-       {@"The following errors occurred"}:
-       {$message->errorBox}
+<% if ($show['errors']): %>
+<div class="error" style="text-align: <%- $stylevar['left'] %>">
+       <%-T("The following errors occurred")%>:
+       <%- $message->errorBox %>
 </div>
-</if>
+<% endif %>
 
 <form action="attachment.php" method="post" enctype="multipart/form-data" name="newattach">
 
 <input name="do" type="hidden" value="insert" />
-<input name="bugid" type="hidden" value="$bug[bugid]" />
-<input name="MAX_FILE_SIZE" type="hidden" value="$MAXFILESIZE" />
+<input name="bugid" type="hidden" value="<%- $bug['bugid'] %>" />
+<input name="MAX_FILE_SIZE" type="hidden" value="<%- $MAXFILESIZE %>" />
 
 <div class="box">
-       <div class="box-head" style="text-align: $stylevar[left]"><lang 1="$bug[bugid]" 2="$bug[summary]">{@"New Attachment for Bug #%1$s %2$s"}</lang></div>
+       <div class="box-head" style="text-align: <%- $stylevar['left'] %>"><%- sprintf(T('New Attachment for Bug #%1$s %2$s'), $bug['bugid'], $bug['summary']) %></div>
 
-       <div class="box-mid box-margmod-bottom" style="text-align: $stylevar[left]">
+       <div class="box-mid box-margmod-bottom" style="text-align: <%- $stylevar['left'] %>">
                <div><input name="attachment" type="file" /></div>
-               <div><strong>{@"Description"}:</strong> <input name="description" type="text" size="35" value="{$bugsys->in['description']}" maxlength="250" /></div>
+               <div><strong><%-T("Description")%>:</strong> <input name="description" type="text" size="35" value="<%- $input->in['description'] %>" maxlength="250" /></div>
        </div>
 
-       <if condition="$show['obsoletes']">
-       <div class="box-mid box-margmod-bottom" style="text-align: $stylevar[left]">
-               <div><strong>{@"Mark the Following Attachments Obsolete"}:</strong>
-                       $obsoletes
+       <% if ($show['obsoletes']): %>
+       <div class="box-mid box-margmod-bottom" style="text-align: <%- $stylevar['left'] %>">
+               <div><strong><%-T("Mark the Following Attachments Obsolete")%>:</strong>
+                       <%- $obsoletes %>
                </div>
        </div>
-       </if>
+       <% endif %>
 
-       <if condition="$show['addcomment']">
-       <div class="box-mid" style="text-align: $stylevar[left]">
-               <div><strong>{@"Add Comment"}:</strong>
+       <% if ($show['addcomment']): %>
+       <div class="box-mid" style="text-align: <%- $stylevar['left'] %>">
+               <div><strong><%-T("Add Comment")%>:</strong>
                        <div>
-                               <textarea name="comment" rows="10" cols="50" class="textarea">{$bugsys->in['comment']}</textarea>
+                               <textarea name="comment" rows="10" cols="50" class="textarea"><%- $input->in['comment'] %></textarea>
                        </div>
                </div>
        </div>
-       </if>
+       <% endif %>
 </div>
 
 <br />
 
 <div id="submitrow">
-       <input name="submit" type="submit" value="  {@"Submit"}  " accesskey="s" />
-       <input name="reset" type="reset" value="  {@"Reset"}  " accesskey="r" />
-       <script type="text/javascript"> draw_cancel("showreport.php?bugid=$bug[bugid]"); </script>
+       <input name="submit" type="submit" value="  <%-T("Submit")%>  " accesskey="s" />
+       <input name="reset" type="reset" value="  <%-T("Reset")%>  " accesskey="r" />
+       <script type="text/javascript"> draw_cancel("showreport.php?bugid=<%- $bug['bugid'] %>"); </script>
 </div>
 
 </form>
 
-$footer
\ No newline at end of file
+<%- $footer %>
\ No newline at end of file
index 61c8801a377f1d796f5d87842284fea692c2786b..550caa810752ef31c1d54dba717bc03b2ccda2fb 100644 (file)
-$doctype
-<html xmlns="http://www.w3.org/1999/xhtml" lang="$stylevar[lang]" xml:lang="$stylevar[lang]" dir="$stylevar[lang_dir]">
+<%- $doctype %>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="<%- $stylevar['lang'] %>" xml:lang="<%- $stylevar['lang'] %>" dir="<%- $stylevar['lang_dir'] %>">
 <head>
-$headinclude
+<%- $headinclude %>
        <link rel="stylesheet" type="text/css" href="templates/report.css" media="screen" />
        <link rel="stylesheet" type="text/css" href="templates/fields.css" media="screen" />
-       <title>{@"New Bug Report"} - {$bugsys->options['trackertitle']}</title>
+       <title><%-T("New Bug Report")%> - <%- bugdar::$options['trackertitle'] %></title>
 </head>
 
 <body>
 
-$header
+<%- $header %>
 
-<if condition="$show['errors']">
-<div class="error" style="text-align: $stylevar[left]">
-       {@"The following errors occurred"}:
-       {$message->errorBox}
+<% if ($show['errors']): %>
+<div class="error" style="text-align: <%- $stylevar['left'] %>">
+       <%-T("The following errors occurred")%>:
+       <%- $message->errorBox %>
 </div>
-</if>
+<% endif %>
 
 <form name="bugreport" action="newreport.php" method="post" class="form">
 <input type="hidden" name="do" value="insert" />
 
 <div id="fieldbody">
        <!-- LEFT COLUMN -->
-       <div id="$stylevar[left]col">
+       <div id="<%- $stylevar['left'] %>col">
 
                <!-- summary -->
                <fieldset>
-                       <legend>{@"Reporter"} $help[reporter]</legend>
-                       <div class="field">$reporter</div>
+                       <legend><%-T("Reporter")%> $help[reporter]</legend>
+                       <div class="field"><%- $reporter %></div>
                </fieldset>
                <!-- / summary -->
 
                <!-- product -->
                <fieldset>
-                       <legend><a href="explain.php?do=products">{@"Product/Version"}</a> $help[product]</legend>
-                       <div class="field"><select name="product"><if condition="!$bugsys->in['product']"><option value="0" selected="selected">{@"Select..."}</option></if>$productSelect</select></div>
+                       <legend><a href="explain.php?do=products"><%-T("Product/Version")%></a> $help[product]</legend>
+                       <div class="field"><select name="product"><% if (!$input->in['product']): %><option value="0" selected="selected"><%-T("Select...")%></option><% endif %><%- $productSelect %></select></div>
                </fieldset>
                <!-- / product -->
 
-               <if condition="$show['changestatus']">
+               <% if ($show['changestatus']): %>
                <!-- status -->
                <fieldset>
-                       <legend>{@"Status"} $help[status]</legend>
-                       <div class="field"><select name="status">$select[status]</select></div>
+                       <legend><%-T("Status")%> $help[status]</legend>
+                       <div class="field"><select name="status"><%- $select['status'] %></select></div>
                </fieldset>
                <!-- / status -->
-               </if>
+               <% endif %>
 
                <!-- severity -->
                <fieldset>
-                       <legend>{@"Severity"} $help[severity]</legend>
-                       <div class="field"><select name="severity">$select[severity]</select></div>
+                       <legend><%-T("Severity")%> $help[severity]</legend>
+                       <div class="field"><select name="severity"><%- $select['severity'] %></select></div>
                </fieldset>
                <!-- / severity -->
 
-               $customfields[left]
+               <%- $customfields['left'] %>
 
        </div>
        <!-- / LEFT COLUMN -->
 
        <!-- RIGHT COLUMN -->
-       <div id="$stylevar[right]col">
+       <div id="<%- $stylevar['right'] %>col">
 
                <!-- summary -->
                <fieldset>
-                       <legend>{@"Summary"} $help[summary]</legend>
-                       <div class="field"><input type="text" name="summary" size="25" value="{$bugsys->in['summary']}" style="width: 100%" maxlength="250" /></div>
+                       <legend><%-T("Summary")%> $help[summary]</legend>
+                       <div class="field"><input type="text" name="summary" size="25" value="<%- $input->in['summary'] %>" style="width: 100%" maxlength="250" /></div>
                </fieldset>
                <!-- / summary -->
 
-               <if condition="$show['assign']">
+               <% if ($show['assign']): %>
                <!-- assignment -->
                <fieldset>
-                       <legend>{@"Assignment"} $help[assignedto]</legend>
-                       <div class="field"><select name="assignedto"><option value="0" selected="selected">{@"No Assignment"}</option>$select[dev]</select></div>
+                       <legend><%-T("Assignment")%> $help[assignedto]</legend>
+                       <div class="field"><select name="assignedto"><option value="0" selected="selected"><%-T("No Assignment")%></option><%- $select['dev'] %></select></div>
                </fieldset>
                <!-- / assignment -->
-               </if>
+               <% endif %>
 
-               <if condition="$show['changestatus']">
+               <% if ($show['changestatus']): %>
                <!-- resolution -->
                <fieldset>
-                       <legend>{@"Resolution"} $help[resolution]</legend>
-                       <div class="field"><select name="resolution">$select[resolution]</select></div>
+                       <legend><%-T("Resolution")%> $help[resolution]</legend>
+                       <div class="field"><select name="resolution"><%- $select['resolution'] %></select></div>
                </fieldset>
                <!-- / resolution -->
-               </if>
+               <% endif %>
 
-               <if condition="$show['changestatus']">
+               <% if ($show['changestatus']): %>
                <!-- priority -->
                <fieldset>
-                       <legend>{@"Priority"} $help[priority]</legend>
-                       <div class="field"><select name="priority">$select[priority]</select></div>
+                       <legend><%-T("Priority")%> $help[priority]</legend>
+                       <div class="field"><select name="priority"><%- $select['priority'] %></select></div>
                </fieldset>
                <!-- / priority -->
-               </if>
+               <% endif %>
 
-               $customfields[right]
+               <%- $customfields['right'] %>
 
        </div>
        <!-- / RIGHT COLUMN -->
@@ -108,25 +108,25 @@ $header
 <!-- new reply -->
 <div style="width: 100%">
        <fieldset>
-               <legend>{@"Description/Initial Report"}</legend>
+               <legend><%-T("Description/Initial Report")%></legend>
 
-               <textarea name="comment" cols="50" rows="10" class="textarea"><if condition="$bugsys->in['comment']">{$bugsys->in['comment']}<else />{$bugsys->options['defaultcomment']}</if></textarea>
+               <textarea name="comment" cols="50" rows="10" class="textarea"><% if ($input->in['comment']): %><%- $input->in['comment'] %><% else: %><%- bugdar::$options['defaultcomment'] %><% endif %></textarea>
 
-               <div><input type="checkbox" name="parselinks" value="1"<if condition="$bugsys->in['parselinks']"> checked="checked"</if> /> {@"Parse Links in the Comment"}</div>
+               <div><input type="checkbox" name="parselinks" value="1"<% if ($input->in['parselinks']): %> checked="checked"<% endif %> /> <%-T("Parse Links in the Comment")%></div>
        </fieldset>
 </div>
 <!-- / new reply -->
 
 <!-- submit row -->
 <div id="submitrow">
-       <input type="submit" name="submit" value="  {@"Submit Report"} " accesskey="s" />
-       <input type="reset" name="reset" value="  {@"Reset Fields"}  " accesskey="r" />
-       <input type="submit" name="submit_reload" value="  {@"Submit Report and Add Another Bug"} " accesskey="e" />
+       <input type="submit" name="submit" value="  <%-T("Submit Report")%> " accesskey="s" />
+       <input type="reset" name="reset" value="  <%-T("Reset Fields")%>  " accesskey="r" />
+       <input type="submit" name="submit_reload" value="  <%-T("Submit Report and Add Another Bug")%> " accesskey="e" />
 </div>
 <!-- / submit row -->
 
 </form>
 
-<!-- <script type="text/javascript"> setup_report("{$bugsys->in['product']}", "{$bugsys->in['component']}", "{$bugsys->in['version']}"); </script> -->
+<!-- <script type="text/javascript"> setup_report("{$input->in['product']}", "{$input->in['component']}", "{$input->in['version']}"); </script> -->
 
-$footer
\ No newline at end of file
+<%- $footer %>
\ No newline at end of file
index 9146ae95c7198e479ada357bb1c032f32647efec..7973744ae5b23ed4c511bb93994ea5b4d069edb0 100644 (file)
@@ -1,7 +1,7 @@
 <div>
-       <if condition="$show['first']"><a href="{$baselink}p=1&amp;pp={$paginator->perpage}">{@"First"}</a> ...</if>
-       <if condition="$show['prev']"><a href="{$baselink}p=$prevpage&amp;pp={$paginator->perpage}">{@"Prev"}</a> ...</if>
-$pagebits
-       <if condition="$show['next']">... <a href="{$baselink}p=$nextpage&amp;pp={$paginator->perpage}">{@"Next"}</a></if>
-       <if condition="$show['last']">... <a href="{$baselink}p={$paginator->pagecount}&amp;pp={$paginator->perpage}">{@"Last"}</a></if>
+       <% if ($show['first']): %><a href="<%- $baselink %>&amp;p=1&amp;pp=<%- $paginator->perpage %>"><%-T("First")%></a> ...<% endif %>
+       <% if ($show['prev']): %><a href="<%- $baselink %>&amp;p=<%- $prevpage %>&amp;pp=<%- $paginator->perpage %>"><%-T("Prev")%></a> ...<% endif %>
+<%- $pagebits %>
+       <% if ($show['next']): %>... <a href="<%- $baselink %>&amp;p=<%- $nextpage %>&amp;pp=<%- $paginator->perpage %>"><%-T("Next")%></a><% endif %>
+       <% if ($show['last']): %>... <a href="<%- $baselink %>&amp;p=<%- $paginator->pagecount %>&amp;pp=<%- $paginator->perpage %>"><%-T("Last")%></a><% endif %>
 </div>
\ No newline at end of file
index 5febc857f5778b9b8b39dc7c501fa691fd629a00..1d77a07ea23e9b38fcac168ff81977237a81895a 100644 (file)
@@ -1 +1 @@
-       <if condition="$nolink"><strong>$number</strong><else /><a href="{$baselink}p=$number&amp;pp={$paginator->perpage}">$number</a></if>
\ No newline at end of file
+       <% if ($nolink): %><strong><%- $number %></strong><% else: %><a href="<%- $baselink %>&amp;p=<%- $number %>&amp;pp=<%- $paginator->perpage %>"><%- $number %></a><% endif %>
\ No newline at end of file
index 7ce3eb2dfd1a90c6f4666e337e8e7fa374367b3f..508bd3a4261ea0e15d2fc3557a036b6f38de0123 100644 (file)
@@ -1,43 +1,43 @@
-$doctype
-<html xmlns="http://www.w3.org/1999/xhtml" lang="$stylevar[lang]" xml:lang="$stylevar[lang]" dir="$stylevar[lang_dir]">
+<%- $doctype %>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="<%- $stylevar['lang'] %>" xml:lang="<%- $stylevar['lang'] %>" dir="<%- $stylevar['lang_dir'] %>">
 <head>
-$headinclude
+<%- $headinclude %>
        <link rel="stylesheet" type="text/css" href="templates/box.css" media="screen" />
-       <title>{$bugsys->options['trackertitle']} - {@"Reset Password"}</title>
+       <title><%- bugdar::$options['trackertitle'] %> - <%-T("Reset Password")%></title>
 </head>
 
 <body>
 
-$header
+<%- $header %>
 
 <form action="login.php" name="resetpw" method="post">
 <input type="hidden" name="do" value="resetpw" />
-<input type="hidden" name="activator" value="$activation[activatorid]" />
+<input type="hidden" name="activator" value="<%- $activation['activatorid'] %>" />
 
-<if condition="$show['errors']">
-<div class="error" style="text-align: $stylevar[left]">
-       {@"The following errors occurred"}:
-       {$message->errorBox}
+<% if ($show['errors']): %>
+<div class="error" style="text-align: <%- $stylevar['left'] %>">
+       <%-T("The following errors occurred")%>:
+       <%- $message->errorBox %>
 </div>
-</if>
+<% endif %>
 
 <div align="center" style="margin-top: 10px">
        <div class="box altwidth">
-               <div class="box-head">{@"Lost Password Recovery: Password Reset"}</div>
+               <div class="box-head"><%-T("Lost Password Recovery: Password Reset")%></div>
 
                <div class="box-mid">
-                       <div>{@"Enter a new password below and then confirm it."}</div>
-                       <div><strong>{@"New Password"}:</strong> <input type="password" name="fix_password" size="30" /></div>
-                       <div><strong>{@"Confirm Password"}:</strong> <input type="password" name="confirm_password" size="30" /></div>
+                       <div><%-T("Enter a new password below and then confirm it.")%></div>
+                       <div><strong><%-T("New Password")%>:</strong> <input type="password" name="fix_password" size="30" /></div>
+                       <div><strong><%-T("Confirm Password")%>:</strong> <input type="password" name="confirm_password" size="30" /></div>
                </div>
 
                <div class="box-foot box-center">
-                       <input type="submit" name="submit" value="  {@"Submit"}  " accesskey="s" />
-                       <input type="reset" name="reset" value="  {@"Reset"}  " accesskey="r" />
+                       <input type="submit" name="submit" value="  <%-T("Submit")%>  " accesskey="s" />
+                       <input type="reset" name="reset" value="  <%-T("Reset")%>  " accesskey="r" />
                </div>
        </div>
 </div>
 
 </form>
 
-$footer
\ No newline at end of file
+<%- $footer %>
\ No newline at end of file
index 4c6cdd153bd0517ce26dc1374e98bd6e1bf5cce6..f5d9eab15f38bf5b6311f313ff18269a5ab163fb 100644 (file)
@@ -1,32 +1,32 @@
-$doctype
-<html xmlns="http://www.w3.org/1999/xhtml" lang="$stylevar[lang]" xml:lang="$stylevar[lang]" dir="$stylevar[lang_dir]">
+<%- $doctype %>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="<%- $stylevar['lang'] %>" xml:lang="<%- $stylevar['lang'] %>" dir="<%- $stylevar['lang_dir'] %>">
 <head>
-$headinclude
+<%- $headinclude %>
        <link rel="stylesheet" type="text/css" href="templates/box.css" media="screen" />
-       <title>{$bugsys->options['trackertitle']} - {@"Quick Search"}</title>
+       <title><%- bugdar::$options['trackertitle'] %> - <%-T("Quick Search")%></title>
 </head>
 
 <body>
 
-$header
+<%- $header %>
 
 <div align="center" style="margin-top: 10px">
        <div class="box altwidth">
-               <div class="box-head" style="text-align: $stylevar[left]">{@"Quick Search"}</div>
+               <div class="box-head" style="text-align: <%- $stylevar['left'] %>"><%-T("Quick Search")%></div>
 
-               <div class="box-mid box-overpad" style="text-align: $stylevar[left]">
-                       <if condition="$error">
-                               <div class="error" style="margin-bottom: 5px; text-align: $stylevar[left]">$error</div>
-                       </if>
+               <div class="box-mid box-overpad" style="text-align: <%- $stylevar['left'] %>">
+                       <% if ($error): %>
+                               <div class="error" style="margin-bottom: 5px; text-align: <%- $stylevar['left'] %>"><%- $error %></div>
+                       <% endif %>
 
                        <form name="quicksearch" action="showreport.php" method="post" class="form">
                        <input type="hidden" name="do" value="quicksearch" />
 
-                       {@"Go to bug ID"} <input type="text" name="bugid" size="5" /> <input type="submit" name="submit" value="  {@"Go"}  " />
+                       <%-T("Go to bug ID")%> <input type="text" name="bugid" size="5" /> <input type="submit" name="submit" value="  <%-T("Go")%>  " />
 
                        </form>
                </div>
        </div>
 </div>
 
-$footer
\ No newline at end of file
+<%- $footer %>
\ No newline at end of file
index 5eec07477a0de0dab556c511118ffeb510d5482c..63a37cd8fef4c62aac884a6c57da3b0feb6aafa6 100644 (file)
@@ -1,46 +1,46 @@
-$doctype
-<html xmlns="http://www.w3.org/1999/xhtml" lang="$stylevar[lang]" xml:lang="$stylevar[lang]" dir="$stylevar[lang_dir]">
+<%- $doctype %>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="<%- $stylevar['lang'] %>" xml:lang="<%- $stylevar['lang'] %>" dir="<%- $stylevar['lang_dir'] %>">
 <head>
-$headinclude
+<%- $headinclude %>
        <link rel="stylesheet" type="text/css" href="templates/box.css" media="screen" />
-       <title>{$bugsys->options['trackertitle']} - {@"Register"}</title>
+       <title><%- bugdar::$options['trackertitle'] %> - <%-T("Register")%></title>
 </head>
 
 <body>
 
-$header
+<%- $header %>
 
-<if condition="$show['errors']">
-<div class="error" style="text-align: $stylevar[left]">
-       {@"The following errors occurred"}:
-       {$message->errorBox}
+<% if ($show['errors']): %>
+<div class="error" style="text-align: <%- $stylevar['left'] %>">
+       <%-T("The following errors occurred")%>:
+       <%- $message->errorBox %>
 </div>
-</if>
+<% endif %>
 
 <form action="register.php" name="register" method="post">
 <input type="hidden" name="do" value="insert" />
 
 <div align="center" style="margin-top: 10px">
        <div class="box altwidth">
-               <div class="box-head">{@"Register"}</div>
+               <div class="box-head"><%-T("Register")%></div>
 
                <div class="box-mid">
-                       <div><strong>{@"Email"}:</strong> <input type="text" name="email" size="30" value="{$bugsys->in['email']}" /></div>
-                       <div><strong>{@"Confirm Email"}:</strong> <input type="text" name="confirmemail" size="30" value="{$bugsys->in['confirmemail']}" /></div>
-                       <div><strong>{@"Display Name"}:</strong> <input type="text" name="displayname" size="30" value="{$bugsys->in['displayname']}" /></div>
-                       <div><strong>{@"Password"}:</strong> <input type="password" name="password" size="30" /></div>
-                       <div><strong>{@"Confirm Password"}:</strong> <input type="password" name="confirmpassword" size="30" /></div>
-                       <div><strong>{@"Show My Email Publicly"}:</strong> <input type="checkbox" value="1" name="showemail"<if condition="$bugsys->in['showemail']"> checked="checked"</if> /> {@"Yes"}</div>
-                       <div><strong>{@"Language"}:</strong> <select name="languageid">$opts</select></div>
+                       <div><strong><%-T("Email")%>:</strong> <input type="text" name="email" size="30" value="<%- $input->in['email'] %>" /></div>
+                       <div><strong><%-T("Confirm Email")%>:</strong> <input type="text" name="confirmemail" size="30" value="<%- $input->in['confirmemail'] %>" /></div>
+                       <div><strong><%-T("Display Name")%>:</strong> <input type="text" name="displayname" size="30" value="<%- $input->in['displayname'] %>" /></div>
+                       <div><strong><%-T("Password")%>:</strong> <input type="password" name="password" size="30" /></div>
+                       <div><strong><%-T("Confirm Password")%>:</strong> <input type="password" name="confirmpassword" size="30" /></div>
+                       <div><strong><%-T("Show My Email Publicly")%>:</strong> <input type="checkbox" value="1" name="showemail"<% if ($input->in['showemail']): %> checked="checked"<% endif %> /> <%-T("Yes")%></div>
+                       <div><strong><%-T("Language")%>:</strong> <select name="languageid"><%- $opts %></select></div>
                </div>
 
                <div class="box-foot box-center">
-                       <input type="submit" name="submit" value="  {@"Register"}  " accesskey="s" />
-                       <input type="reset" name="reset" value="  {@"Reset"}  " accesskey="r" />
+                       <input type="submit" name="submit" value="  <%-T("Register")%>  " accesskey="s" />
+                       <input type="reset" name="reset" value="  <%-T("Reset")%>  " accesskey="r" />
                </div>
        </div>
 </div>
 
 </form>
 
-$footer
\ No newline at end of file
+<%- $footer %>
\ No newline at end of file
index 4ecf19113332d4700c95f352e80895fbd456f387..dbedb78cb3b120ce0265b4c66ee21bcbffe60fb3 100644 (file)
@@ -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
index bbfcbc113126c02ece02a504dfa2763968a1e248..887a1c6d98ff92fe7d106611a31fbde266335bde 100644 (file)
@@ -1,24 +1,24 @@
-$doctype
-<html xmlns="http://www.w3.org/1999/xhtml" lang="$stylevar[lang]" xml:lang="$stylevar[lang]" dir="$stylevar[lang_dir]">
+<%- $doctype %>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="<%- $stylevar['lang'] %>" xml:lang="<%- $stylevar['lang'] %>" dir="<%- $stylevar['lang_dir'] %>">
 <head>
-$headinclude
+<%- $headinclude %>
        <link rel="stylesheet" type="text/css" href="templates/report.css" media="screen" />
        <link rel="stylesheet" type="text/css" href="templates/fields.css" media="screen" />
-       <title>{$bugsys->options['trackertitle']} - {@"Search"}</title>
+       <title><%- bugdar::$options['trackertitle'] %> - <%-T("Search")%></title>
 </head>
 
 <body>
 
-$header
+<%- $header %>
 
-<if condition="$searches">
-<form style="float: $stylevar[right]; display: inline" action="search.php" method="get">
-{@"Run Saved Search"}: <select name="searchid">$searches</select>
-<input type="submit" value="  {@"Go"}  " />
+<% if ($searches): %>
+<form style="float: <%- $stylevar[right] %>; display: inline" action="search.php" method="get">
+<%-T("Run Saved Search")%>: <select name="searchid"><%- $searches %></select>
+<input type="submit" value="  <%-T("Go")%>  " />
 </form>
-</if>
+<% endif %>
 
-<p>{@"Any fields left blank or unselected will be excluded from the search query."}</p>
+<p><%-T("Any fields left blank or unselected will be excluded from the search query.")%></p>
 
 <form name="search" action="search.php" method="post" class="form">
 <input type="hidden" name="do" value="process" />
@@ -29,13 +29,13 @@ $header
 
                <!-- search mode -->
                <fieldset>
-                       <legend>{@"Search Mode"}</legend>
+                       <legend><%-T("Search Mode")%></legend>
 
                        <div class="field">
                                <select name="mode">
-                                       <option value="1" selected="selected">{@"Any Words"}</option>
-                                       <option value="2">{@"All Words"}</option>
-                                       <option value="3">{@"Raw Boolean Search"}</option>
+                                       <option value="1" selected="selected"><%-T("Any Words")%></option>
+                                       <option value="2"><%-T("All Words")%></option>
+                                       <option value="3"><%-T("Raw Boolean Search")%></option>
                                </select>
                        </div>
                </fieldset>
@@ -43,41 +43,41 @@ $header
 
                <!-- reporter -->
                <fieldset>
-                       <legend>{@"Reporter"} $help[reporter]</legend>
+                       <legend><%-T("Reporter")%> $help[reporter]</legend>
                        <div class="field"><input type="text" name="reporter" size="25" style="width: 100%" /></div>
                </fieldset>
                <!-- / reporter -->
 
                <!-- product & version -->
                <fieldset>
-                       <legend>{@"Product / Version"} $help[product]</legend>
-                       <div class="field"><select name="product[]" size="10" multiple="multiple">$productSelect</select></div>
+                       <legend><%-T("Product / Version")%> $help[product]</legend>
+                       <div class="field"><select name="product[]" size="10" multiple="multiple"><%- $productSelect %></select></div>
                </fieldset>
                <!-- / product & version -->
 
                <!-- status -->
                <fieldset>
-                       <legend>{@"Status"} $help[status]</legend>
-                       <div class="field"><select name="status[]" size="4" multiple="multiple">$select[status]</select></div>
+                       <legend><%-T("Status")%> $help[status]</legend>
+                       <div class="field"><select name="status[]" size="4" multiple="multiple"><%- $select['status'] %></select></div>
                </fieldset>
                <!-- / status -->
 
                <!-- priority -->
                <fieldset>
-                       <legend>{@"Priority"} $help[priority]</legend>
-                       <div class="field"><select name="priority[]" size="4" multiple="multiple">$select[priority]</select></div>
+                       <legend><%-T("Priority")%> $help[priority]</legend>
+                       <div class="field"><select name="priority[]" size="4" multiple="multiple"><%- $select['priority'] %></select></div>
                </fieldset>
                <!-- / priority -->
 
                <!-- date -->
                <fieldset>
-                       <legend>{@"Date (submitted since)"}</legend>
+                       <legend><%-T("Date (submitted since)")%></legend>
 
                        <div class="field">
                                <select name="date">
-                                       <option value="0">{@"Any Date"}</option>
-                                       <option value="1">{@"Today"}</option>
-                                       <option value="2">{@"Yesterday"}</option>
+                                       <option value="0"><%-T("Any Date")%></option>
+                                       <option value="1"><%-T("Today")%></option>
+                                       <option value="2"><%-T("Yesterday")%></option>
                                        <option value="7">{@"1 Week"}</option>
                                        <option value="15">{@"15 Days"}</option>
                                        <option value="30">{@"30 Days"}</option>
@@ -88,7 +88,7 @@ $header
                </fieldset>
                <!-- / date -->
 
-               $customfields[left]
+               <%- $customfields['left'] %>
 
        </div>
        <!-- / LEFT COLUMN -->
@@ -98,29 +98,29 @@ $header
 
                <!-- summary -->
                <fieldset>
-                       <legend>{@"Summary / Comment Text"}</legend>
+                       <legend><%-T("Summary / Comment Text")%></legend>
                        <div class="field"><input type="text" name="summary" size="25" style="width: 100%" /></div>
                </fieldset>
                <!-- / summary -->
 
                <!-- sort by -->
                <fieldset>
-                       <legend>{@"Sort By"}</legend>
+                       <legend><%-T("Sort By")%></legend>
 
                        <div class="field">
                                <select name="sortby">
-                                       <option value="relevance">{@"Relevance"}</option>
-                                       <option value="bugid">{@"Bug ID"}</option>
-                                       <option value="severity">{@"Severity"}</option>
-                                       <option value="priority">{@"Priority"}</option>
-                                       <option value="status">{@"Status"}</option>
-                                       <option value="resolution">{@"Resolution"}</option>
-                                       <option value="dateline">{@"Date"}</option>
+                                       <option value="relevance"><%-T("Relevance")%></option>
+                                       <option value="bugid"><%-T("Bug ID")%></option>
+                                       <option value="severity"><%-T("Severity")%></option>
+                                       <option value="priority"><%-T("Priority")%></option>
+                                       <option value="status"><%-T("Status")%></option>
+                                       <option value="resolution"><%-T("Resolution")%></option>
+                                       <option value="dateline"><%-T("Date")%></option>
                                </select>
 
                                <select name="orderby">
-                                       <option value="asc" selected="selected">{@"Ascending"}</option>
-                                       <option value="desc">{@"Descending"}</option>
+                                       <option value="asc" selected="selected"><%-T("Ascending")%></option>
+                                       <option value="desc"><%-T("Descending")%></option>
                                </select>
                        </div>
                </fieldset>
@@ -128,41 +128,41 @@ $header
 
                <!-- assignment -->
                <fieldset>
-                       <legend>{@"Assignment"} $help[assignedto]</legend>
-                       <div class="field"><select name="assignedto[]" size="4" multiple="multiple">$select[dev]</select></div>
+                       <legend><%-T("Assignment")%> $help[assignedto]</legend>
+                       <div class="field"><select name="assignedto[]" size="4" multiple="multiple"><%- $select['dev'] %></select></div>
                </fieldset>
                <!-- / assignment -->
 
                <!-- resolution -->
                <fieldset>
-                       <legend>{@"Resolution"} $help[resolution]</legend>
-                       <div class="field"><select name="resolution[]" size="4" multiple="multiple">$select[resolution]</select></div>
+                       <legend><%-T("Resolution")%> $help[resolution]</legend>
+                       <div class="field"><select name="resolution[]" size="4" multiple="multiple"><%- $select['resolution'] %></select></div>
                </fieldset>
                <!-- / resolution -->
 
                <!-- severity -->
                <fieldset>
-                       <legend>{@"Severity"} $help[severity]</legend>
-                       <div class="field"><select name="severity[]" size="4" multiple="multiple">$select[severity]</select></div>
+                       <legend><%-T("Severity")%> $help[severity]</legend>
+                       <div class="field"><select name="severity[]" size="4" multiple="multiple"><%- $select['severity'] %></select></div>
                </fieldset>
                <!-- / severity -->
 
-               <if condition="$bugsys->userinfo['userid']">
+               <% if (bugdar::$userinfo['userid']): %>
                <!-- favorite -->
                <fieldset>
-                       <legend>{@"Favorite"}</legend>
+                       <legend><%-T("Favorite")%></legend>
                        <div class="field">
                                <select name="favorite">
-                                       <option value="0">{@"Ignore"}</option>
-                                       <option value="1">{@"Yes"}</option>
-                                       <option value="-1">{@"No"}</option>
+                                       <option value="0"><%-T("Ignore")%></option>
+                                       <option value="1"><%-T("Yes")%></option>
+                                       <option value="-1"><%-T("No")%></option>
                                </select>
                        </div>
                </fieldset>
                <!-- / favorite -->
-               </if>
+               <% endif %>
 
-               $customfields[right]
+               <%- $customfields['right'] %>
 
        </div>
        <!-- / RIGHT COLUMN -->
@@ -171,10 +171,10 @@ $header
 <div class="clearspill"></div>
 
 <div id="submitrow">
-       <input type="submit" name="submit" value="  {@"Search Reports"}  " accesskey="s" />
-       <input type="reset" name="reset" value="  {@"Reset Fields"}  " accesskey="r" />
+       <input type="submit" name="submit" value="  <%-T("Search Reports")%>  " accesskey="s" />
+       <input type="reset" name="reset" value="  <%-T("Reset Fields")%>  " accesskey="r" />
 </div>
 
 </form>
 
-$footer
\ No newline at end of file
+<%- $footer %>
\ No newline at end of file
index a7e730d386037802e2c8b78ac318bb962dd551ee..d8233802553b3428c9dc743869cb061b0ae51a11 100644 (file)
@@ -1,39 +1,39 @@
-$doctype
-<html xmlns="http://www.w3.org/1999/xhtml" lang="$stylevar[lang]" xml:lang="$stylevar[lang]" dir="$stylevar[lang_dir]">
+<%- $doctype %>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="<%- $stylevar['lang'] %>" xml:lang="<%- $stylevar['lang'] %>" dir="<%- $stylevar['lang_dir'] %>">
 <head>
-$headinclude
-       <title>{$bugsys->options['trackertitle']} - {@"Search Results"}</title>
+<%- $headinclude %>
+       <title><%- bugdar::$options['trackertitle'] %> - <%-T("Search Results")%></title>
 </head>
 
 <body>
 
-$header
+<%- $header %>
 
-<if condition="$show['cached']">
-<div style="font-weight: bold"><a href="search.php?new=1">{@"This search has been cached for your convenience. You can perform a new search by clicking here."}</a></div>
-<div><a href="search.php?rerun=1&amp;searchid=$searchid">{@"Alternatively, you can re-run this search by clicking here."}</a></div>
+<% if ($show['cached']): %>
+<div style="font-weight: bold"><a href="search.php?new=1"><%-T("This search has been cached for your convenience. You can perform a new search by clicking here.")%></a></div>
+<div><a href="search.php?rerun=1&amp;searchid=<%- $searchid %>"><%-T("Alternatively, you can re-run this search by clicking here.")%></a></div>
 <br />
-</if>
+<% endif %>
 
 <table class="table">
 <tr class="listinghead">
-$columnHeads
+<%- $columnHeads %>
 </tr>
-$bugs
+<%- $bugs %>
 </table>
 
 <div>
-       <a href="search.php?do=export&amp;searchid=$searchid">[{@"Export results as XML"}]</a>
-       <if condition="$show['save']"><a href="search.php?do=save&amp;searchid=$searchid">[{@"Save Search"}]</a></if>
-       <if condition="$show['update']"><a href="search.php?do=update&amp;searchid=$searchid">[{@"Mass Update Bugs in Result"}]</a></if>
+       <a href="search.php?do=export&amp;searchid=<%- $searchid %>">[<%-T("Export results as XML")%>]</a>
+       <% if ($show['save']): %><a href="search.php?do=save&amp;searchid=<%- $searchid %>">[<%-T("Save Search")%>]</a><% endif %>
+       <% if ($show['update']): %><a href="search.php?do=update&amp;searchid=<%- $searchid %>">[<%-T("Mass Update Bugs in Result")%>]</a><% endif %>
 </div>
 
-<if condition="$show['pagenav']">
+<% if ($show['pagenav']): %>
 <!-- pagenav -->
-<div align="$stylevar[right]">
-$pagenav
+<div align="<%- $stylevar[right] %>">
+<%- $pagenav %>
 </div>
 <!-- / pagenav -->
-</if>
+<% endif %>
 
-$footer
\ No newline at end of file
+<%- $footer %>
\ No newline at end of file
index fe2092107eb55698a6d4e1a877bf91742677dc5f..3212e6c3ab86af03f9c5093784263872286d0ac1 100644 (file)
@@ -1,46 +1,46 @@
-$doctype
-<html xmlns="http://www.w3.org/1999/xhtml" lang="$stylevar[lang]" xml:lang="$stylevar[lang]" dir="$stylevar[lang_dir]">
+<%- $doctype %>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="<%- $stylevar['lang'] %>" xml:lang="<%- $stylevar['lang'] %>" dir="<%- $stylevar['lang_dir'] %>">
 <head>
-$headinclude
+<%- $headinclude %>
        <link rel="stylesheet" type="text/css" href="templates/box.css" media="screen" />
-       <title>{$bugsys->options['trackertitle']} - {@"Save Search"}</title>
+       <title><%- bugdar::$options['trackertitle'] %> - <%-T("Save Search")%></title>
 </head>
 
 <body>
 
-$header
+<%- $header %>
 
-<if condition="$show['errors']">
-<div class="error" style="text-align: $stylevar[left]">
-       {@"The following errors occurred"}:
-       {$message->errorBox}
+<% if ($show['errors']): %>
+<div class="error" style="text-align: <%- $stylevar[left] %>">
+       <%-T("The following errors occurred")%>:
+       <%- $message->errorBox %>
 </div>
-</if>
+<% endif %>
 
 <form action="search.php" name="register" method="post">
 <input type="hidden" name="do" value="dosave" />
-<input type="hidden" name="searchid" value="{$bugsys->in['searchid']}" />
+<input type="hidden" name="searchid" value="<%- $searchid %>" />
 
 <div align="center" style="margin-top: 10px">
        <div class="box altwidth">
-               <div class="box-head">{@"Save Search"}</div>
+               <div class="box-head"><%-T("Save Search")%></div>
 
                <div class="box-mid">
-                       {@"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.")%>
 
                        <br />
                        <br />
 
-                       <div><strong>{@"Name"}:</strong> <input type="text" name="name" size="30" maxlength="250" value="{$bugsys->in['name']}" /></div>
+                       <div><strong><%-T("Name")%>:</strong> <input type="text" name="name" size="30" maxlength="250" value="<%- $name %>" /></div>
                </div>
 
                <div class="box-foot box-center">
-                       <input type="submit" name="submit" value="  {@"Save"}  " accesskey="s" />
-                       <input type="reset" name="reset" value="  {@"Reset"}  " accesskey="r" />
+                       <input type="submit" name="submit" value="  <%-T("Save")%>  " accesskey="s" />
+                       <input type="reset" name="reset" value="  <%-T("Reset")%>  " accesskey="r" />
                </div>
        </div>
 </div>
 
 </form>
 
-$footer
\ No newline at end of file
+<%- $footer %>
\ No newline at end of file
index 5fbcc9c176a7e23e6de820af66419920ea17b870..f9e2b5d04ce58d36d0243c22a492362d21a254a6 100644 (file)
@@ -1,21 +1,21 @@
-$doctype
-<html xmlns="http://www.w3.org/1999/xhtml" lang="$stylevar[lang]" xml:lang="$stylevar[lang]" dir="$stylevar[lang_dir]">
+<%- $doctype %>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="<%- $stylevar['lang'] %>" xml:lang="<%- $stylevar['lang'] %>" dir="<%- $stylevar['lang_dir'] %>">
 <head>
-$headinclude
+<%- $headinclude %>
        <link rel="stylesheet" type="text/css" href="templates/report.css" media="screen" />
        <link rel="stylesheet" type="text/css" href="templates/fields.css" media="screen" />
-       <title>{$bugsys->options['trackertitle']} - {@"Mass Update"}</title>
+       <title><%- bugdar::$options['trackertitle'] %> - <%-T("Mass Update")%></title>
 </head>
 
 <body>
 
-$header
+<%- $header %>
 
-<p>{@"Any fields left blank or unselected will not be changed."}</p>
+<p><%-T("Any fields left blank or unselected will not be changed.")%></p>
 
 <form name="search" action="search.php" method="post" class="form">
 <input type="hidden" name="do" value="doupdate" />
-<input type="hidden" name="searchid" value="$search[searchid]" />
+<input type="hidden" name="searchid" value="<%- $search['searchid'] %>" />
 
 <div id="fieldbody">
        <!-- LEFT COLUMN -->
@@ -23,26 +23,26 @@ $header
 
                <!-- product & version -->
                <fieldset>
-                       <legend>{@"Product / Version"} $help[product]</legend>
-                       <div class="field"><select name="product"><option value="">&nbsp;</option>$productSelect</select></div>
+                       <legend><%-T("Product / Version")%> $help[product]</legend>
+                       <div class="field"><select name="product"><option value="">&nbsp;</option><%- $productSelect %></select></div>
                </fieldset>
                <!-- / product & version -->
 
                <!-- status -->
                <fieldset>
-                       <legend>{@"Status"} $help[status]</legend>
-                       <div class="field"><select name="status">$select[status]</select></div>
+                       <legend><%-T("Status")%> $help[status]</legend>
+                       <div class="field"><select name="status"><%- $select['status'] %></select></div>
                </fieldset>
                <!-- / status -->
 
                <!-- priority -->
                <fieldset>
-                       <legend>{@"Priority"} $help[priority]</legend>
-                       <div class="field"><select name="priority">$select[priority]</select></div>
+                       <legend><%-T("Priority")%> $help[priority]</legend>
+                       <div class="field"><select name="priority"><%- $select['priority'] %></select></div>
                </fieldset>
                <!-- / priority -->
 
-               $customfields[left]
+               <%- $customfields['left'] %>
 
        </div>
        <!-- / LEFT COLUMN -->
@@ -52,41 +52,41 @@ $header
 
                <!-- assignment -->
                <fieldset>
-                       <legend>{@"Assignment"} $help[assignedto]</legend>
-                       <div class="field"><select name="assignedto">$select[dev]</select></div>
+                       <legend><%-T("Assignment")%> $help[assignedto]</legend>
+                       <div class="field"><select name="assignedto"><%- $select['dev'] %></select></div>
                </fieldset>
                <!-- / assignment -->
 
                <!-- resolution -->
                <fieldset>
-                       <legend>{@"Resolution"} $help[resolution]</legend>
-                       <div class="field"><select name="resolution">$select[resolution]</select></div>
+                       <legend><%-T("Resolution")%> $help[resolution]</legend>
+                       <div class="field"><select name="resolution"><%- $select['resolution'] %></select></div>
                </fieldset>
                <!-- / resolution -->
 
                <!-- severity -->
                <fieldset>
-                       <legend>{@"Severity"} $help[severity]</legend>
-                       <div class="field"><select name="severity">$select[severity]</select></div>
+                       <legend><%-T("Severity")%> $help[severity]</legend>
+                       <div class="field"><select name="severity"><%- $select['severity'] %></select></div>
                </fieldset>
                <!-- / severity -->
 
-               <if condition="$bugsys->userinfo['userid']">
+               <% if (bugdar::$userinfo['userid']): %>
                <!-- favorite -->
                <fieldset>
-                       <legend>{@"Favorite"}</legend>
+                       <legend><%-T("Favorite")%></legend>
                        <div class="field">
                                <select name="favorite">
-                                       <option value="0">{@"Ignore"}</option>
-                                       <option value="1">{@"Yes"}</option>
-                                       <option value="-1">{@"No"}</option>
+                                       <option value="0"><%-T("Ignore")%></option>
+                                       <option value="1"><%-T("Yes")%></option>
+                                       <option value="-1"><%-T("No")%></option>
                                </select>
                        </div>
                </fieldset>
                <!-- / favorite -->
-               </if>
+               <% endif %>
 
-               $customfields[right]
+               <%- $customfields['right'] %>
 
        </div>
        <!-- / RIGHT COLUMN -->
@@ -95,10 +95,10 @@ $header
 <div class="clearspill"></div>
 
 <div id="submitrow">
-       <input type="submit" name="submit" value="  {@"Update Results"}  " accesskey="s" />
-       <input type="reset" name="reset" value="  {@"Reset Fields"}  " accesskey="r" />
+       <input type="submit" name="submit" value="  <%-T("Update Results")%>  " accesskey="s" />
+       <input type="reset" name="reset" value="  <%-T("Reset Fields")%>  " accesskey="r" />
 </div>
 
 </form>
 
-$footer
\ No newline at end of file
+<%- $footer %>
\ No newline at end of file
index ca21403495650eb3a73742236f538758cd3fd2cb..e576fc0b6c7c5ff119f7b86a7dc388d431ab8f92 100644 (file)
@@ -1,3 +1,3 @@
-<optgroup label="$glabel">
-$optbits
+<optgroup label="<%- $glabel %>">
+<%- $optbits %>
 </optgroup>
\ No newline at end of file
index 5ee431cdcf9dfd86eec954f126b467725547b150..41f43c01f61a9bc7e6ef40befe703d9aca989535 100644 (file)
@@ -1 +1 @@
-<option value="$value"<if condition="$selected"> selected="selected"</if>>$label</option>
\ No newline at end of file
+<option value="<%- $value %>"<% if ($selected): %> selected="selected"<% endif %>><%- $label %></option>
\ No newline at end of file
index 967e4eb7cffd09554a99a8c5cf1061fa9447cea5..33a7eacb7f4f2937371202c4735ebe100243d9ca 100644 (file)
-$doctype
-<html xmlns="http://www.w3.org/1999/xhtml" lang="$stylevar[lang]" xml:lang="$stylevar[lang]" dir="$stylevar[lang_dir]">
+<%- $doctype %>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="<%- $stylevar['lang'] %>" xml:lang="<%- $stylevar['lang'] %>" dir="<%- $stylevar['lang_dir'] %>">
 <head>
-$headinclude
+<%- $headinclude %>
        <link rel="stylesheet" type="text/css" href="templates/report.css" media="screen" />
        <link rel="stylesheet" type="text/css" href="templates/fields.css" media="screen" />
        <link rel="stylesheet" type="text/css" href="templates/box.css" media="screen" />
-       <title><lang 1="$bug[bugid]">{@"Bug Report %1$s"}</lang> - $bug[summary_title]</title>
+       <title><%- sprintf(T('Bug Report %1$s'), $bug['bugid']) %> - <%- $bug['summary_title'] %></title>
 </head>
 
 <body>
 
-$header
+<%- $header %>
 
 <form name="bugreport" action="editreport.php" method="post" class="form">
 <input type="hidden" name="do" value="update" />
-<input type="hidden" name="bugid" value="$bug[bugid]" />
+<input type="hidden" name="bugid" value="<%- $bug['bugid'] %>" />
 
 <div id="fieldbody">
        <!-- LEFT COLUMN -->
-       <div id="$stylevar[left]col">
+       <div id="<%- $stylevar['left'] %>col">
 
                <!-- bug id & hidden -->
                <fieldset>
-                       <legend>{@"Bug Id"} $help[bugid]</legend>
+                       <legend><%-T("Bug Id")%> $help[bugid]</legend>
                        <div class="field">
-                               $bug[bugid]
+                               <%- $bug['bugid'] %>
 
-                               <if condition="$show['edit']">
+                               <% if ($show['edit']): %>
                                        /
-                                       <strong<if condition="$bug['hidden']"> class="error"</if>>{@"Hidden"}:</strong>
-                                       <input type="checkbox" name="hidden" value="1"<if condition="$bug['hidden']"> checked="checked"</if> />
-                               <else />
-                                       <if condition="$bug['hidden']"> / <span class="error">{@"Hidden Bug"}</span></if>
-                               </if>
-
-                               / [<a href="showhistory.php?bugid=$bug[bugid]">{@"Show Bug History"}</a>]
-                               <if condition="$show['subscribe']">/ [<a href="favorite.php?do=handle&amp;bugid=$bug[bugid]">$favoritetext</a>]</if>
-                               <if condition="$show['delete']">/ [<a href="editreport.php?do=delete&amp;bugid=$bug[bugid]">{@"Delete"}</a>]</if>
+                                       <strong<% if ($bug['hidden']): %> class="error"<% endif %>><%-T("Hidden")%>:</strong>
+                                       <input type="checkbox" name="hidden" value="1"<% if ($bug['hidden']): %> checked="checked"<% endif %> />
+                               <% else: %>
+                                       <% if ($bug['hidden']): %> / <span class="error"><%-T("Hidden Bug")%></span><% endif %>
+                               <% endif %>
+
+                               / [<a href="showhistory.php?bugid=<%- $bug['bugid'] %>"><%-T("Show Bug History")%></a>]
+                               <% if ($show['subscribe']): %>/ [<a href="favorite.php?do=handle&amp;bugid=<%- $bug['bugid'] %>"><%- $favoritetext %></a>]<% endif %>
+                               <% if ($show['delete']): %>/ [<a href="editreport.php?do=delete&amp;bugid=<%- $bug['bugid'] %>"><%-T("Delete")%></a>]<% endif %>
                        </div>
                </fieldset>
                <!-- / bug id & hidden -->
 
                <!-- reporter -->
                <fieldset>
-                       <legend>{@"Reporter"} $help[reporter]</legend>
-                       <div class="field">$bug[userinfo]</div>
+                       <legend><%-T("Reporter")%> $help[reporter]</legend>
+                       <div class="field"><%- $bug['userinfo'] %></div>
                </fieldset>
                <!-- / reporter -->
 
                <!-- product -->
                <fieldset>
-                       <legend><a href="explain.php?do=products">{@"Product/Version"}</a> $help[product]</legend>
-                       <div class="field">$bug[product] <if condition="$bug['component']">/ $bug[component]</if> / <if condition="$show['edit']"><select name="product">$productSelect</select><else />$bug[version]</if></div>
+                       <legend><a href="explain.php?do=products"><%-T('Product/Version') %></a> $help[product]</legend>
+                       <div class="field"><%- $bug['product'] %> <% if ($bug['component']): %>/ <%- $bug['component'] %><% endif %> / <% if ($show['edit']): %><select name="product"><%- $productSelect %></select><% else: %><%- $bug['version'] %><% endif %></div>
                </fieldset>
                <!-- / product -->
 
                <!-- status -->
                <fieldset>
-                       <legend>{@"Status"} $help[status]</legend>
+                       <legend><%-T("Status")%> $help[status]</legend>
                        <div class="field">
-                               <if condition="$show['changestatus']">
-                                       <select name="status">$select[status]</select>
-                               <else />
-                                       $bug[status]
-                               </if>
+                               <% if ($show['changestatus']): %>
+                                       <select name="status"><%- $select['status'] %></select>
+                               <% else: %>
+                                       <%- $bug['status'] %>
+                               <% endif %>
                        </div>
                </fieldset>
                <!-- / status -->
 
                <!-- severity -->
                <fieldset>
-                       <legend>{@"Severity"} $help[severity]</legend>
+                       <legend><%-T("Severity")%> $help[severity]</legend>
                        <div class="field">
-                               <if condition="$show['edit']">
-                                       <select name="severity">$select[severity]</select>
-                               <else />
-                                       $bug[severity]
-                               </if>
+                               <% if ($show['edit']): %>
+                                       <select name="severity"><%- $select['severity'] %></select>
+                               <% else: %>
+                                       <%- $bug['severity'] %>
+                               <% endif %>
                        </div>
                </fieldset>
                <!-- / severity -->
 
                <!-- duplicate -->
                <fieldset>
-                       <legend>{@"Duplicate Of"} $help[duplicateof]</legend>
+                       <legend><%-T("Duplicate Of")%> $help[duplicateof]</legend>
                        <div class="field">
-                               <if condition="$show['edit']">
-                                       <input type="text" name="duplicateof" size="10" value="<if condition="$bug['duplicateof']">$bug[duplicateof]</if>" />
-                                       <if condition="$bug['duplicateof']"><a href="showreport.php?bugid=$bug[duplicateof]" title="$duplicate[summary]" target="_blank">$duplicate[bugid]</a></if>
-                               <else />
-                                       <if condition="$bug['duplicateof']"><a href="showreport.php?bugid=$bug[duplicateof]">$duplicateof[summary]</a><else />{@"- none -"}</if>
-                               </if>
+                               <% if ($show['edit']): %>
+                                       <input type="text" name="duplicateof" size="10" value="<% if ($bug['duplicateof']): %><%- $bug['duplicateof'] %><% endif %>" />
+                                       <% if ($bug['duplicateof']): %><a href="showreport.php?bugid=<%- $bug['duplicateof'] %>" title="<%- $duplicate['summary'] %>" target="_blank"><%- $duplicate['bugid'] %></a><% endif %>
+                               <% else: %>
+                                       <% if ($bug['duplicateof']): %><a href="showreport.php?bugid=<%- $bug['duplicateof'] %>"><%- $duplicateof['summary'] %></a><% else: %><%- T("- none -") %><% endif %>
+                               <% endif %>
                        </div>
                </fieldset>
                <!-- / duplicate -->
 
-               $customfields[left]
+               <%- $customfields['left'] %>
 
        </div>
        <!-- / LEFT COLUMN -->
 
        <!-- RIGHT COLUMN -->
-       <div id="$stylevar[right]col">
+       <div id="<%- $stylevar['right'] %>col">
 
                <!-- summary -->
                <fieldset>
-                       <legend>{@"Summary"} $help[summary]</legend>
+                       <legend><%-T("Summary")%> $help[summary]</legend>
                        <div class="field">
-                               <if condition="$show['edit']">
-                                       <input type="text" name="summary" size="25" value="$bug[summary]" style="width: 100%" maxlength="250" />
-                               <else />
-                                       $bug[summary]
-                               </if>
+                               <% if ($show['edit']): %>
+                                       <input type="text" name="summary" size="25" value="<%- $bug['summary'] %>" style="width: 100%" maxlength="250" />
+                               <% else: %>
+                                       <%- $bug['summary'] %>
+                               <% endif %>
                        </div>
                </fieldset>
                <!-- / summary -->
 
                <!-- reporting time -->
                <fieldset>
-                       <legend>{@"Report Time"} $help[dateline]</legend>
-                       <div class="field">$bug[datetime]</div>
+                       <legend><%-T("Report Time")%> $help[dateline]</legend>
+                       <div class="field"><%- $bug['datetime'] %></div>
                </fieldset>
                <!-- / reporting time -->
 
                <!-- assignment -->
                <fieldset>
-                       <legend>{@"Assignment"} $help[assignedto]</legend>
+                       <legend><%-T("Assignment")%> $help[assignedto]</legend>
                        <div class="field">
-                               <if condition="$show['assign']">
-                                       <select name="assignedto"><option value="0"<if condition="!$bug['assignedto']"> selected="selected"</if>>{@"No Assignment"}</option>$select[dev]</select>
-                               <else />
-                                       <if condition="$bug['assigninfo']">$bug[assigninfo]<else />{@"- none -"}</if>
-                               </if>
+                               <% if ($show['assign']): %>
+                                       <select name="assignedto"><option value="0"<% if (!$bug['assignedto']): %> selected="selected"<% endif %>><%-T("No Assignment")%></option><%- $select['dev'] %></select>
+                               <% else: %>
+                                       <% if ($bug['assigninfo']): %><%- $bug['assigninfo'] %><% else: %>{@"- none -"}<% endif %>
+                               <% endif %>
                        </div>
                </fieldset>
                <!-- / assignment -->
 
                <!-- resolution -->
                <fieldset>
-                       <legend>{@"Resolution"} $help[resolution]</legend>
+                       <legend><%-T("Resolution")%> $help[resolution]</legend>
                        <div class="field">
-                               <if condition="$show['changestatus']">
-                                       <select name="resolution">$select[resolution]</select>
-                               <else />
-                                       $bug[resolution]
-                               </if>
+                               <% if ($show['changestatus']): %>
+                                       <select name="resolution"><%- $select['resolution'] %></select>
+                               <% else: %>
+                                       <%- $bug['resolution'] %>
+                               <% endif %>
                        </div>
                </fieldset>
                <!-- / resolution -->
 
                <!-- priority -->
                <fieldset>
-                       <legend>{@"Priority"} $help[priority]</legend>
+                       <legend><%-T("Priority")%> $help[priority]</legend>
                        <div class="field">
-                               <if condition="$show['changestatus']">
-                                       <select name="priority">$select[priority]</select>
-                               <else />
-                                       $bug[priority]
-                               </if>
+                               <% if ($show['changestatus']): %>
+                                       <select name="priority"><%- $select['priority'] %></select>
+                               <% else: %>
+                                       <%- $bug['priority'] %>
+                               <% endif %>
                        </div>
                </fieldset>
                <!-- / priority -->
 
                <!-- dependencies -->
                <fieldset>
-                       <legend>{@"Dependencies"} $help[dependency]</legend>
+                       <legend><%-T("Dependencies")%> $help[dependency]</legend>
                        <div class="field">
-                               <if condition="$show['edit']">
-                                       <input type="text" name="dependency" size="25" value="$bug[dependency]" /> $dependencies
-                               <else />
-                                       <if condition="$dependencies">$dependencies<else />{@"- none -"}</if>
-                               </if>
+                               <% if ($show['edit']): %>
+                                       <input type="text" name="dependency" size="25" value="<%- $bug['dependency'] %>" /> <%- $dependencies %>
+                               <% else: %>
+                                       <% if ($dependencies): %><%- $dependencies %><% else: %><%- T("- none -") %><% endif %>
+                               <% endif %>
                        </div>
                </fieldset>
                <!-- / dependencies -->
 
-               $customfields[right]
+               <%- $customfields['right'] %>
        </div>
        <!-- / RIGHT COLUMN -->
 </div>
@@ -184,24 +184,24 @@ $header
 
 <br />
 
-<if condition="$show['newreply']">
+<% if ($show['newreply']): %>
 <!-- new reply -->
 <div style="width: 100%">
        <fieldset>
-               <legend>{@"New Reply"}<if condition="$show['automations']"> : <a href="explain.php?do=automations">{@"Automation"}</a> <select name="automation">$select[automation]</select></if> $help[newreply]</legend>
+               <legend><%-T("New Reply")%><% if ($show['automations']): %> : <a href="explain.php?do=automations"><%-T("Automation")%></a> <select name="automation"><%- $select['automation'] %></select><% endif %> $help[newreply]</legend>
 
                <textarea name="comment" cols="50" rows="10" class="textarea"></textarea>
 
-               <div><input type="checkbox" name="parselinks" value="1"<if condition="$bugsys->in['parselinks']"> checked="checked"</if> /> {@"Parse Links in the Comment"}</div>
+               <div><input type="checkbox" name="parselinks" value="1"<% if ($input->in['parselinks']): %>> checked="checked"<% endif %> /> <%-T("Parse Links in the Comment")%></div>
        </fieldset>
 </div>
 <!-- / new reply -->
-</if>
+<% endif %>
 
 <!-- submit row -->
 <div id="submitrow">
-       <input type="submit" name="submit" value="  {@"Commit Changes"} " accesskey="s" />
-       <input type="reset" name="reset" value="  {@"Reset Fields"}  " accesskey="r" />
+       <input type="submit" name="submit" value="  <%-T("Commit Changes")%> " accesskey="s" />
+       <input type="reset" name="reset" value="  <%-T("Reset Fields")%>  " accesskey="r" />
 </div>
 <!-- / submit row -->
 
@@ -212,48 +212,48 @@ $header
 <!-- attachments & voting -->
 <div id="attachvote">
 
-       <if condition="$show['attachments']">
+       <% if ($show['attachments']): %>
        <!-- attachments -->
-       <div id="attachments" style="float: $stylevar[right]">
+       <div id="attachments" style="float: <%- $stylevar['right'] %>">
        <fieldset>
-               <legend>{@"Attachments"}<if condition="$show['putattachments']"> : <a href="attachment.php?do=add&amp;bugid=$bug[bugid]">{@"New"}</a></if></legend>
+               <legend><%-T("Attachments")%><% if ($show['putattachments']): %> : <a href="attachment.php?do=add&amp;bugid=<%- $bug['bugid'] %>"><%-T("New")%></a><% endif %></legend>
 
-               $attachments
+               <%- $attachments %>
        </fieldset>
        </div>
        <!-- / attachments -->
-       </if>
+       <% endif %>
 
        <!-- show votes -->
-       <div id="votes<if condition="$show['attachments']"><if condition="!$show['vote']">fifty</if><else /><if condition="!$show['vote']">hundred</if></if>">
+       <div id="votes<% if ($show['attachments']): %><% if (!$show['vote']): %>fifty<% endif %><% else: %><% if (!$show['vote']): %>hundred<% endif %><% endif %>">
        <fieldset>
-               <legend>{@"Votes"}</legend>
+               <legend><%-T("Votes")%></legend>
 
-               <div><strong>{@"For"}:</strong> $vote[votefor] ($vote[forpercent]%)</div>
-               <div><strong>{@"Against"}:</strong> $vote[voteagainst] ($vote[againstpercent]%)</div>
-               <div><strong>{@"Total"}:</strong> $vote[total]</div>
+               <div><strong><%-T("For")%>:</strong> <%- $vote['votefor'] %> (<%- $vote['forpercent'] %>%)</div>
+               <div><strong><%-T("Against")%>:</strong> <%- $vote['voteagainst'] %> (<%- $vote['againstpercent'] %>%)</div>
+               <div><strong><%-T("Total")%>:</strong> <%- $vote['total'] %></div>
        </fieldset>
        </div>
        <!-- / show votes -->
 
-       <if condition="$show['vote']">
+       <% if ($show['vote']): %>
        <!-- your vote -->
        <div id="yourvote">
        <fieldset>
-               <legend>{@"Your Vote"}</legend>
+               <legend><%-T("Your Vote")%></legend>
 
                <form name="vote" action="vote.php" method="post" class="form">
                        <input type="hidden" name="do" value="vote" />
-                       <input type="hidden" name="bugid" value="$bug[bugid]" />
-                       <input type="radio" name="vote" value="1" /> {@"Vote For (+1)"}<br />
-                       <input type="radio" name="vote" value="-1" /> {@"Vote Against (-1)"}<br />
+                       <input type="hidden" name="bugid" value="<%- $bug['bugid'] %>" />
+                       <input type="radio" name="vote" value="1" /> <%-T("Vote For (+1)")%><br />
+                       <input type="radio" name="vote" value="-1" /> <%-T("Vote Against (-1)")%><br />
 
-                       <input type="submit" name="submit" value="  {@"Vote"}  " accesskey="v" />
+                       <input type="submit" name="submit" value="  <%-T("Vote")%>  " accesskey="v" />
                </form>
        </fieldset>
        </div>
        <!-- / your vote -->
-       </if>
+       <% endif %>
 </div>
 <!-- / attachments & voting -->
 
@@ -261,6 +261,6 @@ $header
 
 <br />
 
-$comments
+<%- $comments %>
 
-$footer
\ No newline at end of file
+<%- $footer %>
\ No newline at end of file
index de4a24c96aa9f36f4c175ade704fb3e4ed1cd756..042789d6e55da80a0cc1cdd081e78d9b94b1e66a 100644 (file)
@@ -1,6 +1,6 @@
                <div>
-                       <if condition="$show['editattach']"><span style="float: $stylevar[right]; font-size: 10px">[<a href="attachment.php?do=edit&amp;attachmentid=$attachment[attachmentid]">{@"Edit"}</a>]</span></if>
-                       <strong><a href="viewattachment.php?attachmentid=$attachment[attachmentid]" target="_blank"<if condition="$attachment['obsolete']"> style="text-decoration: line-through"</if> title="<lang 1="$attachment[user]">{@"Posted by %1$s"}</lang>\n($attachment[date])">$attachment[filename]</a></strong>
-                       <span style="font-size: 10px">$attachment[description]</span>
+                       <% if ($show['editattach']): %><span style="float: <%- $stylevar['right'] %>; font-size: 10px">[<a href="attachment.php?do=edit&amp;attachmentid=<%- $attachment['attachmentid'] %>"><%-T("Edit")%></a>]</span><% endif %>
+                       <strong><a href="viewattachment.php?attachmentid=<%- $attachment['attachmentid'] %>" target="_blank"<% if ($attachment['obsolete']): %> style="text-decoration: line-through"<% endif %> title="<%- sprintf(T('Posted by %1$s'), $attachment['user']) %>\n(<%- $attachment['date'] %>)"><%- $attachment['filename'] %></a></strong>
+                       <span style="font-size: 10px"><%- $attachment['description'] %></span>
                </div>
 
index 4821074ef16dfdb02736741c70915e26631dbdeb..8782adeff0b3a25625a2046979e8b8512d427838 100644 (file)
@@ -1,26 +1,26 @@
 
-<!-- comment $comment[commentid] -->
+<!-- comment <%- $comment['commentid'] %> -->
 <div class="box">
-       <div class="box-head" style="text-align: $stylevar[left]">
-               <span style="float: $stylevar[right]">$comment[posttime]</span>
-               $comment[postby]
+       <div class="box-head" style="text-align: <%- $stylevar['left'] %>">
+               <span style="float: <%- $stylevar['right'] %>"><%- $comment['posttime'] %></span>
+               <%- $comment['postby'] %>
        </div>
        
-       <div class="box-mid" style="text-align: $stylevar[left]">
-               $comment[comment_parsed]
+       <div class="box-mid" style="text-align: <%- $stylevar['left'] %>">
+               <%- $comment['comment_parsed'] %>
        </div>
        
-       <if condition="$show['editcomment']">
-       <div class="box-foot" style="text-align: $stylevar[left]">
-               <span style="float: $stylevar[right]">
-                       <if condition="$show['delete']">[<a href="editcomment.php?do=delete&amp;commentid=$comment[commentid]">{@"Delete"}</a>]</if>
-                       [<a href="editcomment.php?commentid=$comment[commentid]">{@"Edit Comment"}</a>]
+       <% if ($show['editcomment']): %>
+       <div class="box-foot" style="text-align: <%- $stylevar['left'] %>">
+               <span style="float: <%- $stylevar['right'] %>">
+                       <% if ($show['delete']): %>[<a href="editcomment.php?do=delete&amp;commentid=<%- $comment['commentid'] %>"><%-T("Delete")%></a>]<% endif %>
+                       [<a href="editcomment.php?commentid=<%- $comment['commentid'] %>"><%-T("Edit Comment")%></a>]
                </span>
-               <if condition="$comment['hidden']"><strong>{@"Hidden"}</strong><else />{@"Visible"}</if>
+               <% if ($comment['hidden']): %><strong><%-T("Hidden")%></strong><% else: %><%-T("Visible")%><% endif %>
        </div>
-       </if>
+       <% endif %>
 </div>
-<!-- / comment $comment[commentid] -->
+<!-- / comment <%- $comment['commentid'] %> -->
 
 
 <br />
index d821a31ad78532a14b58f322ea1fe1fd2f10ecca..7af0fcacdd252eeb46d72666d17356b431fedbd2 100644 (file)
@@ -1,23 +1,23 @@
-$doctype
-<html xmlns="http://www.w3.org/1999/xhtml" lang="$stylevar[lang]" xml:lang="$stylevar[lang]" dir="$stylevar[lang_dir]">
+<%- $doctype %>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="<%- $stylevar['lang'] %>" xml:lang="<%- $stylevar['lang'] %>" dir="<%- $stylevar['lang_dir'] %>">
 <head>
-$headinclude
+<%- $headinclude %>
        <link rel="stylesheet" type="text/css" href="templates/box.css" media="screen" />
-       <title>{$bugsys->options['trackertitle']} - {@"Error"}</title>
+       <title><%- bugdar::$options['trackertitle'] %> - <%-T("Error")%></title>
 </head>
 
 <body>
 
-$header
+<%- $header %>
 
 <div align="center" style="margin-top: 10px">
        <div class="box altwidth">
-               <div class="box-head" style="text-align: $stylevar[left]">{@"Error"}</div>
+               <div class="box-head" style="text-align: <%- $stylevar['left'] %>"><%-T("Error")%></div>
 
-               <div class="box-mid box-overpad" style="text-align: $stylevar[left]">
-                       $error
+               <div class="box-mid box-overpad" style="text-align: <%- $stylevar['left'] %>">
+                       <%- $error %>
                </div>
        </div>
 </div>
 
-$footer
\ No newline at end of file
+<%- $footer %>
\ No newline at end of file
index 1b7afaa4ce7e2ca28edfe808b7c340c00c1e619f..be392e8d88d70b1fcd72ea4f66763229630a814f 100644 (file)
@@ -1,43 +1,43 @@
-$doctype
-<html xmlns="http://www.w3.org/1999/xhtml" lang="$stylevar[lang]" xml:lang="$stylevar[lang]" dir="$stylevar[lang_dir]">
+<%- $doctype %>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="<%- $stylevar['lang'] %>" xml:lang="<%- $stylevar['lang'] %>" dir="<%- $stylevar['lang_dir'] %>">
 <head>
-$headinclude
+<%- $headinclude %>
        <link rel="stylesheet" type="text/css" href="templates/box.css" media="screen" />
-       <title>{$bugsys->options['trackertitle']} - <if condition="$show['confirm']">{@"Confirm"}<else />{@"Notice"}</if></title>
+       <title><%- bugdar::$options['trackertitle'] %> - <% if ($show['confirm']): %><%-T("Confirm")%><% else: %><%-T("Notice")%><% endif %></title>
 </head>
 
 <body>
 
-$header
+<%- $header %>
 
-<if condition="$show['confirm']">
-<form name="confirm" action="$action" method="post">
-<input type="hidden" name="do" value="$do" />
-$extra
-</if>
+<% if ($show['confirm']): %>
+<form name="confirm" action="<%- $action %>" method="post">
+<input type="hidden" name="do" value="<%- $do %>" />
+<%- $extra %>
+<% endif %>
 
 <div align="center" style="margin-top: 10px">
        <div class="box altwidth">
-               <div class="box-head" style="text-align: $stylevar[left]"><if condition="$show['confirm']">{@"Confirm"}<else />{@"Notice"}</if></div>
+               <div class="box-head" style="text-align: <%- $stylevar['left'] %>"><% if ($show['confirm']): %><%-T("Confirm")%><% else: %><%-T("Notice")%><% endif %></div>
 
-               <div class="box-mid box-overpad" style="text-align: $stylevar[left]">
-                       $message
+               <div class="box-mid box-overpad" style="text-align: <%- $stylevar['left'] %>">
+                       <%- $message %>
 
-                       <if condition="$show['confirm']">
+                       <% if ($show['confirm']): %>
                                <br />
                                <br />
 
                                <div id="submitrow">
-                                       <input type="submit" name="submit" value="$button" />
-                                       <script type="text/javascript"> draw_cancel("$cancel"); </script>
+                                       <input type="submit" name="submit" value="<%- $button %>" />
+                                       <script type="text/javascript"> draw_cancel("<%- $cancel %>"); </script>
                                </div>
-                       </if>
+                       <% endif %>
                </div>
        </div>
 </div>
 
-<if condition="$show['confirm']">
+<% if ($show['confirm']): %>
 </form>
-</if>
+<% endif %>
 
-$footer
\ No newline at end of file
+<%- $footer %>
\ No newline at end of file
index 22276f5b851b0d2ccd0217565917e63cb4835bbf..1cd2f213c3761fea33a7e5f7bc716019727d7f52 100644 (file)
@@ -1,29 +1,29 @@
-$doctype
-<html xmlns="http://www.w3.org/1999/xhtml" lang="$stylevar[lang]" xml:lang="$stylevar[lang]" dir="$stylevar[lang_dir]">
+<%- $doctype %>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="<%- $stylevar['lang'] %>" xml:lang="<%- $stylevar['lang'] %>" dir="<%- $stylevar['lang_dir'] %>">
 <head>
-$headinclude
+<%- $headinclude %>
        <link rel="stylesheet" type="text/css" href="templates/box.css" media="screen" />
-       <meta http-equiv="refresh" content="2; url=$url" />
-       <title>{$bugsys->options['trackertitle']} - {@"Redirect..."}</title>
+       <meta http-equiv="refresh" content="2; url=<%- $url %>" />
+       <title><%- bugdar::$options['trackertitle'] %> - <%-T("Redirect...")%></title>
 </head>
 
 <body>
 
-$header
+<%- $header %>
 
 <div align="center" style="margin-top: 10px">
        <div class="box altwidth">
-               <div class="box-head" style="text-align: $stylevar[left]">{@"Redirect..."}</div>
+               <div class="box-head" style="text-align: <%- $stylevar['left'] %>"><%-T("Redirect...")%></div>
 
-               <div class="box-mid box-overpad" style="text-align: $stylevar[left]">
-                       $message
+               <div class="box-mid box-overpad" style="text-align: <%- $stylevar['left'] %>">
+                       <%- $message %>
 
                        <br />
                        <br />
 
-                       <a href="$url">{@"If you are not redirected in a few seconds, click here."}</a>
+                       <a href="<%- $url %>"><%-T("If you are not redirected in a few seconds, click here.")%></a>
                </div>
        </div>
 </div>
 
-$footer
\ No newline at end of file
+<%- $footer %>
\ No newline at end of file
index f446a41ad3c541e167a6213337a3e6f6ddd59018..cb076e9d688cfa4ef93a7267c7cb2ebc93284ec5 100644 (file)
@@ -1,26 +1,26 @@
-$doctype
-<html xmlns="http://www.w3.org/1999/xhtml" lang="$stylevar[lang]" xml:lang="$stylevar[lang]" dir="$stylevar[lang_dir]">
+<%- $doctype %>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="<%- $stylevar[lang] %>" xml:lang="<%- $stylevar[lang] %>" dir="<%- $stylevar[lang_dir] %>">
 <head>
-$headinclude
-       <title>{$bugsys->options['trackertitle']} - {@"Bug Listing"}</title>
+<%- $headinclude %>
+       <title><%- bugdar::$options['trackertitle'] %> - <%-T("Bug Listing")%></title>
 </head>
 
 <body>
 
-$header
+<%- $header %>
 
 <table class="table">
 <tr class="listinghead">
-       $columnHeads</tr>
-$bugs
+       <%- $columnHeads %></tr>
+<%- $bugs %>
 </table>
 
-<if condition="$show['pagenav']">
+<% if ($show['pagenav']): %>
 <!-- pagenav -->
-<div align="$stylevar[right]">
-$pagenav
+<div align="<%- $stylevar[right] %>">
+<%- $pagenav %>
 </div>
 <!-- / pagenav -->
-</if>
+<% endif %>
 
-$footer
\ No newline at end of file
+<%- $footer %>
\ No newline at end of file
index 5ec5db5a13fcec4310688db9133f27f7d9aa7ca3..2a11c2532d680248e4e6e64c9e33d2b94f9220a0 100644 (file)
@@ -1,6 +1,6 @@
 
-<!-- bug $bug[bugid] -->
-<tr<if condition="$bugsys->userinfo['showcolors']"> style="background-color: $bug[bgcolor]<if condition="$bug['hidden']">; font-style: italic</if>"<else /> class="$bug[bgcolor]"<if condition="$bug['hidden']"> style="font-style: italic"</if></if>>
-$fields
+<!-- bug <%- $bug[bugid] %> -->
+<tr<% if (bugdar::$userinfo['showcolors']): %> 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 %>
 </tr>
-<!-- / bug $bug[bugid] -->
+<!-- / bug <%- $bug[bugid] %> -->
index 8c4fc62bc257fc17a27cc3307a9861fbfc83367e..383124471ba884d86ba24c37d07a1460fe5348bc 100644 (file)
@@ -1,66 +1,66 @@
-$doctype
-<html xmlns="http://www.w3.org/1999/xhtml" lang="$stylevar[lang]" xml:lang="$stylevar[lang]" dir="$stylevar[lang_dir]">
+<%- $doctype %>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="<%- $stylevar['lang'] %>" xml:lang="<%- $stylevar['lang'] %>" dir="<%- $stylevar['lang_dir'] %>">
 <head>
-$headinclude
+<%- $headinclude %>
        <link rel="stylesheet" type="text/css" href="templates/box.css" media="screen" />
        <link rel="stylesheet" type="text/css" href="templates/fields.css" media="screen" />
-       <title>{$bugsys->options['trackertitle']} - {@"User Options"}</title>
+       <title><%- bugdar::$options['trackertitle'] %> - <%-T("User Options")%></title>
 </head>
 
 <body>
 
-$header
+<%- $header %>
 
 <form action="userctrl.php" name="options" method="post">
 <input type="hidden" name="do" value="update" />
 
-<if condition="$show['errors']">
-<div class="error" style="text-align: $stylevar[left]">
-       {@"The following errors occurred"}:
-       {$message->errorBox}
+<% if ($show['errors']): %>
+<div class="error" style="text-align: <%- $stylevar['left'] %>">
+       <%-T("The following errors occurred")%>:
+       <%- $message->errorBox %>
 </div>
-</if>
+<% endif %>
 
 <table class="table">
        <tr valign="top">
                <td width="50%">
                        <!-- user options -->
                        <div class="box">
-                               <div class="box-head" style="text-align: $stylevar[left]">{@"User Options"}</div>
+                               <div class="box-head" style="text-align: <%- $stylevar['left'] %>"><%-T("User Options")%></div>
 
                                <div class="box-mid">
-                                       <if condition="$bugsys->options['authmethod'] == 'default'">
+                                       <% if (bugdar::$options['authmethod'] == 'default'): %>
                                        <fieldset>
-                                               <legend>{@"Display Name"}</legend>
-                                               <input type="text" name="displayname" value="{$userinfo['displayname']}" size="25" style="width: 100%" maxlength="250" />
+                                               <legend><%-T("Display Name")%></legend>
+                                               <input type="text" name="displayname" value="<%- $userinfo['displayname'] %>" size="25" style="width: 100%" maxlength="250" />
                                        </fieldset>
-                                       </if>
+                                       <% endif %>
 
                                        <fieldset>
-                                               <legend>{@"Show Email Publicly"}</legend>
-                                               <input type="radio" name="showemail" value="1"<if condition="$userinfo['showemail']"> checked="checked"</if> /> {@"Yes"}
-                                               <input type="radio" name="showemail" value="0"<if condition="!$userinfo['showemail']"> checked="checked"</if> /> {@"No"}
+                                               <legend><%-T("Show Email Publicly")%></legend>
+                                               <input type="radio" name="showemail" value="1"<% if ($userinfo['showemail']): %> checked="checked"<% endif %> /> <%-T("Yes")%>
+                                               <input type="radio" name="showemail" value="0"<% if (!$userinfo['showemail']): %> checked="checked"<% endif %> /> <%-T("No")%>
                                        </fieldset>
 
                                        <fieldset>
-                                               <legend>{@"Show Status Colors on Bug Listings"}</legend>
-                                               <input type="radio" name="showcolors" value="1"<if condition="$userinfo['showcolors']"> checked="checked"</if> /> {@"Yes"}
-                                               <input type="radio" name="showcolors" value="0"<if condition="!$userinfo['showcolors']"> checked="checked"</if> /> {@"No"}
+                                               <legend><%-T("Show Status Colors on Bug Listings")%></legend>
+                                               <input type="radio" name="showcolors" value="1"<% if ($userinfo['showcolors']): %> checked="checked"<% endif %> /> <%-T("Yes")%>
+                                               <input type="radio" name="showcolors" value="0"<% if (!$userinfo['showcolors']): %> checked="checked"<% endif %> /> <%-T("No")%>
                                        </fieldset>
 
                                        <fieldset>
-                                               <legend>{@"Language"}</legend>
-                                               <select name="languageid">$langselect</select>
+                                               <legend><%-T("Language")%></legend>
+                                               <select name="languageid"><%- $langselect %></select>
                                        </fieldset>
 
                                        <fieldset>
-                                               <legend>{@"Timezone"}</legend>
-                                               <select name="timezone">$tzselect</select>
+                                               <legend><%-T("Timezone")%></legend>
+                                               <select name="timezone"><%- $tzselect %></select>
                                        </fieldset>
 
                                        <fieldset>
-                                               <legend>{@"Observe Daylight Savings Time (DST)"}</legend>
-                                               <input type="checkbox" name="usedst" value="1"<if condition="$userinfo['usedst']"> checked="checked"</if> /> {@"Yes, I'm currently observing DST"}
+                                               <legend><%-T("Observe Daylight Savings Time (DST)")%></legend>
+                                               <input type="checkbox" name="usedst" value="1"<% if ($userinfo['usedst']): %> checked="checked"<% endif %> /> <%-T("Yes, I'm currently observing DST")%>
                                        </fieldset>
                                </div>
                        </div>
@@ -70,72 +70,72 @@ $header
 
                        <!-- email options -->
                        <div class="box">
-                               <div class="box-head" style="text-align: $stylevar[left]">{@"Email Options"}</div>
+                               <div class="box-head" style="text-align: <%- $stylevar['left'] %>"><%-T("Email Options")%></div>
 
                                <div class="box-mid">
                                        <table class="table">
                                        <tr style="text-align: center">
                                                <td>&nbsp;</td>
-                                               <td class="altcolor"><strong>{@"Reporter"}</strong></td>
-                                               <td><strong>{@"Assignee"}</strong></td>
-                                               <td class="altcolor"><strong>{@"Favorite"}</strong></td>
-                                               <td><strong>{@"Voter"}</strong></td>
-                                               <td class="altcolor"><strong>{@"Commenter"}</strong></td>
+                                               <td class="altcolor"><strong><%-T("Reporter")%></strong></td>
+                                               <td><strong><%-T("Assignee")%></strong></td>
+                                               <td class="altcolor"><strong><%-T("Favorite")%></strong></td>
+                                               <td><strong><%-T("Voter")%></strong></td>
+                                               <td class="altcolor"><strong><%-T("Commenter")%></strong></td>
                                        </tr>
 
                                        <tr class="altcolor textcenter">
-                                               <td style="text-align: $stylevar[left]">{@"New bug is added"}</td>
-                                               <td colspan="5"><input type="checkbox" name="emailopts[0][2048]"{$checked[0][2048]} value="1" /></td>
+                                               <td style="text-align: <%- $stylevar['left'] %>"><%-T("New bug is added")%></td>
+                                               <td colspan="5"><input type="checkbox" name="emailopts[0][2048]"<%- $checked[0][2048] %> value="1" /></td>
                                        </tr>
 
                                        <tr style="text-align: center">
-                                               <td style="text-align: $stylevar[left]">{@"I am made the assignee"}</td>
-                                               <td colspan="5"><input type="checkbox" name="emailopts[0][32]"{$checked[0][32]} value="1" /></td>
+                                               <td style="text-align: <%- $stylevar['left'] %>"><%-T("I am made the assignee")%></td>
+                                               <td colspan="5"><input type="checkbox" name="emailopts[0][32]"<%- $checked[0][32] %> value="1" /></td>
                                        </tr>
 
                                        <tr class="altcolor textcenter">
-                                               <td style="text-align: $stylevar[left]">{@"Status or resolution changes"}</td>
-                                               <td><input type="checkbox" name="emailopts[1][64]"{$checked[1][64]} value="1" /></td>
-                                               <td><input type="checkbox" name="emailopts[2][64]"{$checked[2][64]} value="1" /></td>
-                                               <td><input type="checkbox" name="emailopts[4][64]"{$checked[4][64]} value="1" /></td>
-                                               <td><input type="checkbox" name="emailopts[8][64]"{$checked[8][64]} value="1" /></td>
-                                               <td><input type="checkbox" name="emailopts[16][64]"{$checked[16][64]} value="1" /></td>
+                                               <td style="text-align: <%- $stylevar['left'] %>"><%-T("Status or resolution changes")%></td>
+                                               <td><input type="checkbox" name="emailopts[1][64]"<%- $checked[1][64] %> value="1" /></td>
+                                               <td><input type="checkbox" name="emailopts[2][64]"<%- $checked[2][64] %> value="1" /></td>
+                                               <td><input type="checkbox" name="emailopts[4][64]"<%- $checked[4][64] %> value="1" /></td>
+                                               <td><input type="checkbox" name="emailopts[8][64]"<%- $checked[8][64] %> value="1" /></td>
+                                               <td><input type="checkbox" name="emailopts[16][64]"<%- $checked[16][64] %> value="1" /></td>
                                        </tr>
 
                                        <tr style="text-align: center">
-                                               <td style="text-align: $stylevar[left]">{@"'Duplicates' field is changed"}</td>
-                                               <td><input type="checkbox" name="emailopts[1][128]"{$checked[1][128]} value="1" /></td>
-                                               <td><input type="checkbox" name="emailopts[2][128]"{$checked[2][128]} value="1" /></td>
-                                               <td><input type="checkbox" name="emailopts[4][128]"{$checked[4][128]} value="1" /></td>
-                                               <td><input type="checkbox" name="emailopts[8][128]"{$checked[8][128]} value="1" /></td>
-                                               <td><input type="checkbox" name="emailopts[16][128]"{$checked[16][128]} value="1" /></td>
+                                               <td style="text-align: <%- $stylevar['left'] %>"><%-T("'Duplicates' field is changed")%></td>
+                                               <td><input type="checkbox" name="emailopts[1][128]"<%- $checked[1][128] %> value="1" /></td>
+                                               <td><input type="checkbox" name="emailopts[2][128]"<%- $checked[2][128] %> value="1" /></td>
+                                               <td><input type="checkbox" name="emailopts[4][128]"<%- $checked[4][128] %> value="1" /></td>
+                                               <td><input type="checkbox" name="emailopts[8][128]"<%- $checked[8][128] %> value="1" /></td>
+                                               <td><input type="checkbox" name="emailopts[16][128]"<%- $checked[16][128] %> value="1" /></td>
                                        </tr>
 
                                        <tr class="altcolor textcenter">
-                                               <td style="text-align: $stylevar[left]">{@"A new comment is added"}</td>
-                                               <td><input type="checkbox" name="emailopts[1][256]"{$checked[1][256]} value="1" /></td>
-                                               <td><input type="checkbox" name="emailopts[2][256]"{$checked[2][256]} value="1" /></td>
-                                               <td><input type="checkbox" name="emailopts[4][256]"{$checked[4][256]} value="1" /></td>
-                                               <td><input type="checkbox" name="emailopts[8][256]"{$checked[8][256]} value="1" /></td>
-                                               <td><input type="checkbox" name="emailopts[16][256]"{$checked[16][256]} value="1" /></td>
+                                               <td style="text-align: <%- $stylevar['left'] %>"><%-T("A new comment is added")%></td>
+                                               <td><input type="checkbox" name="emailopts[1][256]"<%- $checked[1][256] %> value="1" /></td>
+                                               <td><input type="checkbox" name="emailopts[2][256]"<%- $checked[2][256] %> value="1" /></td>
+                                               <td><input type="checkbox" name="emailopts[4][256]"<%- $checked[4][256] %> value="1" /></td>
+                                               <td><input type="checkbox" name="emailopts[8][256]"<%- $checked[8][256] %> value="1" /></td>
+                                               <td><input type="checkbox" name="emailopts[16][256]"<%- $checked[16][256] %> value="1" /></td>
                                        </tr>
 
                                        <tr style="text-align: center">
-                                               <td style="text-align: $stylevar[left]">{@"A new attachment is added"}</td>
-                                               <td><input type="checkbox" name="emailopts[1][512]"{$checked[1][512]} value="1" /></td>
-                                               <td><input type="checkbox" name="emailopts[2][512]"{$checked[2][512]} value="1" /></td>
-                                               <td><input type="checkbox" name="emailopts[4][512]"{$checked[4][512]} value="1" /></td>
-                                               <td><input type="checkbox" name="emailopts[8][512]"{$checked[8][512]} value="1" /></td>
-                                               <td><input type="checkbox" name="emailopts[16][512]"{$checked[16][512]} value="1" /></td>
+                                               <td style="text-align: <%- $stylevar[left] %>"><%-T("A new attachment is added")%></td>
+                                               <td><input type="checkbox" name="emailopts[1][512]"<%- $checked[1][512] %> value="1" /></td>
+                                               <td><input type="checkbox" name="emailopts[2][512]"<%- $checked[2][512] %> value="1" /></td>
+                                               <td><input type="checkbox" name="emailopts[4][512]"<%- $checked[4][512] %> value="1" /></td>
+                                               <td><input type="checkbox" name="emailopts[8][512]"<%- $checked[8][512] %> value="1" /></td>
+                                               <td><input type="checkbox" name="emailopts[16][512]"<%- $checked[16][512] %> value="1" /></td>
                                        </tr>
 
                                        <tr class="altcolor textcenter">
-                                               <td style="text-align: $stylevar[left]">{@"Any other field changes"}</td>
-                                               <td><input type="checkbox" name="emailopts[1][1024]"{$checked[1][1024]} value="1" /></td>
-                                               <td><input type="checkbox" name="emailopts[2][1024]"{$checked[2][1024]} value="1" /></td>
-                                               <td><input type="checkbox" name="emailopts[4][1024]"{$checked[4][1024]} value="1" /></td>
-                                               <td><input type="checkbox" name="emailopts[8][1024]"{$checked[8][1024]} value="1" /></td>
-                                               <td><input type="checkbox" name="emailopts[16][1024]"{$checked[16][1024]} value="1" /></td>
+                                               <td style="text-align: <%- $stylevar[left] %>"><%-T("Any other field changes")%></td>
+                                               <td><input type="checkbox" name="emailopts[1][1024]"<%- $checked[1][1024] %> value="1" /></td>
+                                               <td><input type="checkbox" name="emailopts[2][1024]"<%- $checked[2][1024] %> value="1" /></td>
+                                               <td><input type="checkbox" name="emailopts[4][1024]"<%- $checked[4][1024] %> value="1" /></td>
+                                               <td><input type="checkbox" name="emailopts[8][1024]"<%- $checked[8][1024] %> value="1" /></td>
+                                               <td><input type="checkbox" name="emailopts[16][1024]"<%- $checked[16][1024] %> value="1" /></td>
                                        </tr>
                                        </table>
                                </div>
@@ -144,25 +144,25 @@ $header
 
                        <br />
 
-                       <if condition="$searches">
+                       <% if ($searches): %>
                        <!-- saved searches -->
                        <div class="box">
-                               <div class="box-head" style="text-align: $stylevar[left]">{@"Saved Searches"}</div>
+                               <div class="box-head" style="text-align: <%- $stylevar['left'] %>"><%-T("Saved Searches")%></div>
 
                                <div class="box-mid">
-                                       $searches
+                                       <%- $searches %>
                                </div>
                        </div>
                        <!-- / saved searches -->
-                       </if>
+                       <% endif %>
                </td>
 
                <td>
-                       <if condition="$bugsys->options['authmethod'] == 'default'">
+                       <% if (bugdar::$options['authmethod'] == 'default'): %>
                        <!-- password and email -->
                        <div class="box">
-                               <div class="box-head" style="text-align: $stylevar[left]">
-                                       {@"Please enter your password to change these fields"}:
+                               <div class="box-head" style="text-align: <%- $stylevar['left'] %>">
+                                       <%-T("Please enter your password to change these fields")%>:
                                        <br />
 
                                        <input type="password" name="validate" size="35" maxlength="250" />
@@ -170,57 +170,57 @@ $header
 
                                <div class="box-mid box-margmod-top">
                                        <fieldset>
-                                               <legend>{@"Password"}</legend>
+                                               <legend><%-T("Password")%></legend>
                                                <input type="password" name="password_change" size="25" style="width: 100%" maxlength="250" />
                                        </fieldset>
 
                                        <fieldset>
-                                               <legend>{@"Confirm Password"}</legend>
+                                               <legend><%-T("Confirm Password")%></legend>
                                                <input type="password" name="password_confirm" size="25" style="width: 100%" maxlength="250" />
                                        </fieldset>
                                </div>
 
                                <div class="box-mid box-margmod-top">
                                        <fieldset>
-                                               <legend>{@"Email"}</legend>
-                                               <input type="text" name="email_change" size="25" value="$email" style="width: 100%" maxlength="250" />
+                                               <legend><%-T("Email")%></legend>
+                                               <input type="text" name="email_change" size="25" value="<%- $email %>" style="width: 100%" maxlength="250" />
                                        </fieldset>
 
                                        <fieldset>
-                                               <legend>{@"Confirm Email"}</legend>
-                                               <input type="text" name="email_confirm" size="25" value="$email_confirm" style="width: 100%" maxlength="250" />
+                                               <legend><%-T("Confirm Email")%></legend>
+                                               <input type="text" name="email_confirm" size="25" value="<%- $email_confirm %>" style="width: 100%" maxlength="250" />
                                        </fieldset>
                                </div>
                        </div>
                        <!-- / password and email -->
 
                        <br />
-                       </if>
+                       <% endif %>
 
                        <!-- display options -->
                        <div class="box">
-                               <div class="box-head" style="text-align: $stylevar[left]">{@"Bug List Display Options"}</div>
+                               <div class="box-head" style="text-align: <%- $stylevar['left'] %>"><%-T("Bug List Display Options")%></div>
 
                                <div class="box-mid">
                                        <fieldset>
-                                               <legend>{@"Hidden Statuses on Bug Listing"}</legend>
-                                               <select name="hidestatuses[]" multiple="multiple" size="$hidestatusesnum">$hidestatuses</select>
+                                               <legend><%-T("Hidden Statuses on Bug Listing")%></legend>
+                                               <select name="hidestatuses[]" multiple="multiple" size="<%- $hidestatusesnum %>"><%- $hidestatuses %></select>
                                        </fieldset>
 
                                        <fieldset>
-                                               <legend>{@"Default Sort Order Column"}</legend>
-                                               $defaultsortkey
+                                               <legend><%-T("Default Sort Order Column")%></legend>
+                                               <%- $defaultsortkey %>
                                        </fieldset>
 
                                        <fieldset>
-                                               <legend>{@"Default Sort Order Direction"}</legend>
-                                               $defaultsortas
+                                               <legend><%-T("Default Sort Order Direction")%></legend>
+                                               <%- $defaultsortas %>
                                        </fieldset>
 
                                        <fieldset>
-                                               <legend>{@"Bug List Columns"} $help[columnorder]</legend>
+                                               <legend><%-T("Bug List Columns")%> $help[columnorder]</legend>
                                                <table class="table" style="width: auto">
-                                               $columnOptions
+                                               <%- $columnOptions %>
                                                </table>
                                        </fieldset>
                                </div>
@@ -233,8 +233,8 @@ $header
 <br />
 
 <div class="submitrow">
-       <input name="submit" type="submit" value="  {@"Submit"}  " accesskey="s" />
-       <input name="reset" type="reset" value="  {@"Reset"}  " accesskey="r" />
+       <input name="submit" type="submit" value="  <%-T("Submit")%>  " accesskey="s" />
+       <input name="reset" type="reset" value="  <%-T("Reset")%>  " accesskey="r" />
 </div>
 
 </form>
index e769cf0a327ba2c63e863a77e40f66578bbdd9c3..36f5e3896f2080cb2232b952eb769c263cb6faf1 100644 (file)
@@ -1,4 +1,4 @@
 <tr>
-       <td>$name:</td>
-       <td><input type="text" size="2" maxlength="2" name="columnoptions[$column]" value="{$columns[$column]}" /></td>
+       <td><%- $name %>:</td>
+       <td><input type="text" size="2" maxlength="2" name="columnoptions[<%- $column %>]" value="<%- $columns[$column] %>" /></td>
 </tr>
\ No newline at end of file
index aa7b50dcc1d097db59d73d8e616e85764ce7ad31..8f77d66748d133c1ae11bf983bfc67e5b706df33 100644 (file)
@@ -1,7 +1,7 @@
 <div>
-       <span style="float: $stylevar[right]">
-               <a href="search.php?searchid=$search[searchid]&amp;rerun=1">[{@"Run Search"}]</a>
-               <a href="userctrl.php?do=deletesearch&amp;searchid=$search[searchid]">[{@"Delete"}]</a>
+       <span style="float: <%- $stylevar['right'] %>">
+               <a href="search.php?searchid=<%- $search['searchid'] %>&amp;rerun=1">[<%-T("Run Search")%>]</a>
+               <a href="userctrl.php?do=deletesearch&amp;searchid=<%- $search['searchid'] %>">[<%-T("Delete")%>]</a>
        </span>
-       $search[name]
+       <%- $search['name'] %>
 </div>
\ No newline at end of file
index a42ef5352198969f9233669db14417ffb7143e2d..73abcfe44838e7857b5a954ac33133aa041b0d78 100644 (file)
@@ -1 +1 @@
-<span title="<lang 1="$userinfo[userid]">{@"User ID: %1$s"}</lang>"><if condition="$userinfo['showemail']"><a href="mailto:$userinfo[email]">$userinfo[displayname]</a><else />$userinfo[displayname]</if></span>
\ No newline at end of file
+<span title="<%- sprintf(T('User ID: %1$s'), $userinfo['userid']) %>"><% if ($userinfo['showemail']): %><a href="mailto:<%- $userinfo['email'] %>"><%- $userinfo['displayname'] %></a><% else: %><%- $userinfo['displayname'] %><% endif %></span>
\ No newline at end of file
index 100e17fd04f49a91a08befdcbac0294926e15ee5..c973f86130e9bd8c81b259433d73493261ee2684 100644 (file)
@@ -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
index 85489997a832f3e1f1518331c75cbaec097de3f4..05eeb6d1e2cb4a0c96665ec7fc6994964d5c837f 100755 (executable)
@@ -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
 
 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
index 7c35db3db0caa8ccfe5c6ec04f79aead61d640ad..129c1a0385f8bef6602d00a843ba9ce7669caa40 100644 (file)
--- 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