$action->set('actionid', $bugsys->in['actionid']);
$action->set_condition();
$action->delete();
-
+
$admin->redirect('automation.php?do=modify');
}
if ($_POST['do'] == 'insert' OR $_POST['do'] == 'update')
{
$deltas = array('builtin' => array(), 'custom' => array());
-
+
if (is_array($bugsys->in['fields']))
{
foreach ($bugsys->in['fields'] AS $key => $value)
}
}
}
-
+
if (is_array($bugsys->in['fields']['custom']))
{
foreach ($bugsys->in['fields']['custom'] AS $key => $value)
}
}
}
-
+
$action = new AutomationAPI($bugsys);
$action->set('name', $bugsys->in['name']);
$action->set('description', $bugsys->in['description']);
$action->set('fieldchanges', $deltas);
$action->set('comment', $bugsys->in['comment']);
-
+
if ($_POST['do'] == 'insert')
{
$action->insert();
-
+
$admin->redirect('automation.php');
}
else
$action->set('actionid', $bugsys->in['actionid']);
$action->set_condition();
$action->update();
-
+
$admin->redirect('automation.php');
}
}
{
$add = ($_REQUEST['do'] == 'add');
$edit = !$add;
-
+
if ($edit)
{
NavLinks::automationsEdit($bugsys->in['actionid']);
$navigator->set_focus('link', 'fields-pages-automations', 'fields-pages');
-
+
$action = new AutomationAPI($bugsys);
$action->set('actionid', $bugsys->in['actionid']);
$action->set_condition();
}
$admin->page_start(($add ? T('New Automation') : T('Edit Automation')));
-
+
$admin->form_start('automation.php', ($add ? 'insert' : 'update'));
-
+
if ($edit)
{
$admin->form_hidden_field('actionid', $action->objdata['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_span(T('Field Changes'), 'thead', 'center');
-
+
// -------------------------------------------------------------------
- // built-in fields
+ // built-in fields
construct_datastore_select('severity', 'severity', 'severityid', $action->objdata['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);
$admin->row_list(T('Priority'), 'fields[priority]');
-
+
construct_datastore_select('status', 'status', 'statusid', $action->objdata['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);
$admin->row_list(T('Resolution'), 'fields[resolution]');
-
+
$admin->row_span('', 'tcat', 'center');
-
+
// -------------------------------------------------------------------
// custom fields
$fields_fetch = $db->query("SELECT * FROM " . TABLE_PREFIX . "bugfield ORDER BY fieldid ASC");
case 'input_text':
$admin->row_input($field['name'], "fields[custom][$field[fieldid]]", $action->objdata['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->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));
-
+
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));
}
}
unset($select);
-
+
$admin->row_submit();
$admin->table_end();
$admin->form_end();
-
+
$admin->page_end();
}
{
NavLinks::automationsAdd();
$navigator->set_focus('link', 'fields-pages-automations', 'fields-pages');
-
+
$admin->page_start(T('Automations'));
-
+
$admin->table_start();
$admin->table_head(T('Automations'));
-
+
$actions = $db->query("SELECT * FROM " . TABLE_PREFIX . "automation ORDER BY name ASC");
while ($action = $db->fetch_array($actions))
{
$admin->row_text($action['name'] . "\n<div class=\"smallfont\">$action[description]</div>", "<a href=\"automation.php?do=edit&actionid=$action[actionid]\">[" . T('Edit') . "]</a> <a href=\"automation.php?do=delete&actionid=$action[actionid]\">[" . T('Delete') . "]</a>");
}
-
+
$admin->table_end();
-
+
$admin->page_end();
}
$field->set('fieldid', $bugsys->in['fieldid']);
$field->set_condition();
$field->delete();
-
+
$admin->redirect('field.php?do=modify');
}
// ###################################################################
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']));
}
{
$edit = false;
$add = true;
-
+
$type = $bugsys->in['type'];
-
+
$field = new FieldAPI($bugsys);
-
+
if ($bugsys->in['fieldid'])
{
$field->set('fieldid', $bugsys->in['fieldid']);
$field->set_condition();
$field->fetch();
-
+
$edit = true;
$add = false;
$type = $field->objdata['type'];
{
$field->set('type', $type);
}
-
+
switch ($type)
{
case 'input_text':
$field->set('regexmatch', $bugsys->in['regexmatch']);
$field->set('maxlength', $bugsys->in['maxlength']);
break;
-
+
case 'input_checkbox':
$field->set('defaultvalue', $bugsys->in['defaultvalue']);
break;
-
+
case 'select_single':
$field->set('selects', $bugsys->in['selects']);
$field->set('usedefault', $bugsys->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']);
-
+
if ($add)
{
$field->insert();
$fieldid = $field->insertid;
-
+
$db->query("ALTER TABLE " . TABLE_PREFIX . "bug ADD custom$fieldid MEDIUMTEXT NULL");
$db->query("OPTIMIZE TABLE " . TABLE_PREFIX . "bug");
}
$field->update();
$fieldid = $field->values['fieldid'];
}
-
+
$bugsys->input_clean('custom', TYPE_UINT);
foreach ($bugsys->in['custom'] AS $usergroupid => $mask)
{
$values[] = $bugsys->clean($usergroupid, TYPE_UINT) . ", $fieldid, " . $mask;
}
-
+
$db->query("
REPLACE INTO " . TABLE_PREFIX . "bugfieldpermission
(usergroupid, fieldid, mask)
VALUES
(" . implode("),\n\t\t\t(", $values) . ")"
);
-
+
$admin->redirect('field.php?do=modify', ($add ? T('The custom field has been added') : T('The custom field has been updated')));
}
if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit')
{
$field = new FieldAPI($bugsys);
-
+
$add = (($_REQUEST['do'] == 'add') ? true : false);
$typeselect = (($add AND empty($bugsys->in['step'])) ? true : false);
$edit = (($add) ? false : true);
-
+
if ($add)
{
NavLinks::fieldsAdd();
NavLinks::fieldsEdit($bugsys->in['fieldid']);
$navigator->set_focus('link', 'fields-pages-fields', 'fields-pages');
}
-
+
$admin->page_start(($add ? T('Add New Custom Field') : T('Edit Custom Field')));
$admin->form_start('field.php', ($typeselect ? 'add' : 'update'));
if ($add AND !$typeselect)
$admin->table_start();
$admin->table_head(($add ? T('Add New Bug Field') . ' - ' . FieldAPI::field_types($bugsys->in['type']) : T('Edit Field')));
}
-
+
if ($edit)
{
$field->set('fieldid', $bugsys->in['fieldid']);
$field->set_condition();
$field->fetch();
-
+
$admin->form_hidden_field('fieldid', $field->objdata['fieldid']);
}
-
+
if (!$typeselect)
{
$type = (($add) ? $bugsys->in['type'] : $field->objdata['type']);
}
-
+
// show type selector
if (empty($bugsys->in['step']) AND $add)
{
$admin->list_item($description, $name);
}
$admin->row_list(T('Field Type'), 'type', false);
-
+
$admin->row_submit();
$admin->table_end();
}
else
{
$field->set('type', $type);
-
+
// global fields
$admin->row_span(T('Global Fields'), 'thead', 'center');
$admin->row_text(T('Field Type'), FieldAPI::field_types($type));
$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));
-
+
// type-specific fields
$admin->row_span(T('Type-Specific Fields'), 'thead', 'center');
-
+
switch ($type)
{
case 'input_text':
$admin->row_input(T('Regular Expression Match'), 'regexmatch', $field->objdata['regexmatch']);
$admin->row_input(T('Maximum Length'), 'maxlength', $field->objdata['maxlength'], 2, 10);
break;
-
+
case 'input_checkbox':
$admin->row_yesno(T('Checked By Default'), 'defaultvalue', $field->objdata['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']);
break;
}
-
+
$admin->table_end();
-
+
// custom field permissions
$admin->table_start();
$admin->table_head(T('Custom Field Permissions'));
-
+
if ($edit)
{
$perms = $db->query("SELECT usergroupid, mask FROM " . TABLE_PREFIX . "bugfieldpermission WHERE fieldid = " . $field->objdata['fieldid']);
$permissions["$perm[usergroupid]"] = $perm['mask'];
}
}
-
+
$usergroups = $db->query("SELECT * FROM " . TABLE_PREFIX . "usergroup ORDER BY usergroupid");
while ($usergroup = $db->fetch_array($usergroups))
{
$admin->list_item(T('Can View, Edit Field'), 2, $permissions["$usergroup[usergroupid]"] == 2);
$admin->row_list($usergroup['title'], "custom[$usergroup[usergroupid]]");
}
-
+
$admin->table_end();
-
+
// end table
$admin->table_start();
$admin->row_submit();
$admin->table_end();
$admin->form_end();
}
-
+
$admin->page_end();
}
{
NavLinks::fieldsAdd();
$navigator->set_focus('link', 'fields-pages-fields', 'fields-pages');
-
+
$admin->page_start(T('Additional Bug Fields'));
-
+
$admin->table_start();
$admin->table_head(T('Additional Bug Fields'), 3, 'custom_bug_fields');
$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))
{
)
);
}
-
+
$admin->table_end();
-
+
$admin->page_end();
}
function admin_login()
{
global $admin, $bugsys;
-
+
define('ISSO_PRINTER_NO_NAVIGATION', 1);
-
+
$admin->page_start(T('Login'), null, '', 'document.cplogin.' . ($bugsys->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_submit('', T('Login'));
$admin->table_end();
$admin->form_end();
-
+
$admin->page_end();
}
function AdminPageNavigatorCallback($baselink, $nextpage, $prevpage, $show, $pagebits, $paginator)
{
global $stylevar;
-
+
$return = '';
-
+
if ($show['first'])
{
$return .= '<a href="' . $baselink . 'p=1&pp=' . $paginator->getPerPage() . '">' . T('First') . '</a> ...';
{
$return .= '<a href="' . $baselink . 'p=' . $prevpage . '&pp=' . $paginator->getPerPage() . '">' . T('Prev') . '</a> ...';
}
-
+
$return .= $pagebits;
-
+
if ($show['next'])
{
$return .= '... <a href="' . $baselink . 'p=' . $nextpage . '&pp=' . $paginator->getPerPage() . '">' . T('Next') . '</a>';
$language->set('languageid', $bugsys->in['languageid']);
$language->set_condition();
$language->delete();
-
+
$admin->redirect('language.php?do=modify');
}
$language->set('userselect', $bugsys->in['userselect']);
$language->set('langcode', $bugsys->in['langcode']);
$language->insert();
-
+
$admin->redirect('language.php?do=modify');
}
{
NavLinks::languagesAdd();
$navigator->set_focus('link', 'options-languages-add', 'options-languages');
-
+
$admin->page_start(T('New Language'));
-
+
$admin->form_start('language.php', 'insert');
$admin->table_start();
$admin->table_head(T('New Language'));
-
+
$admin->row_input(T('Title'), 'title');
$admin->row_input(T('Gettext Language Code (<em><a href="http://www.gnu.org/software/gettext/manual/html_chapter/gettext_15.html">language</a></em>_<em><a href="http://www.gnu.org/software/gettext/manual/html_chapter/gettext_16.html">COUNTRY</a></em>)'), 'langcode');
$admin->row_input(T('Character Set'), 'charset', 'utf-8');
$admin->list_item(T('Right-to-Left'), 'rtl');
$admin->row_list(T('Direction'), 'direction');
$admin->row_yesno(T('User Selectable'), 'userselect', true);
-
+
$admin->row_submit();
$admin->table_end();
$admin->form_end();
-
+
$admin->page_end();
}
$language->set('userselect', $bugsys->in['userselect']);
$language->set('langcode', $bugsys->in['langcode']);
$language->update();
-
+
$admin->redirect('language.php?do=modify');
}
{
NavLinks::languagesEdit($bugsys->in['languageid']);
$navigator->set_focus('link', 'options-languages-edit', 'options-languages');
-
+
$languageapi = new LanguageAPI($bugsys);
$languageapi->set('languageid', $bugsys->in['languageid']);
$languageapi->set_condition();
$languageapi->fetch();
-
+
$language =& $languageapi->objdata;
-
+
$admin->page_start(T('Edit Language'));
-
+
$admin->form_start('language.php', 'update');
$admin->table_start();
$admin->table_head(sprintf(T('Edit Language - %1$s'), $language['title']));
-
+
$admin->form_hidden_field('languageid', $language['languageid']);
-
+
$admin->row_input(T('Title'), 'title', $language['title']);
$admin->row_input(T('Gettext Language Code (<em><a href="http://www.gnu.org/software/gettext/manual/html_chapter/gettext_15.html">language</a></em>_<em><a href="http://www.gnu.org/software/gettext/manual/html_chapter/gettext_16.html">COUNTRY</a></em>)'), 'langcode', $language['langcode']);
$admin->row_input(T('Character Set'), 'charset', $language['charset']);
$admin->list_item(T('Right-to-Left'), 'rtl', (($language['direction'] == 'rtl') ? true : false));
$admin->row_list(T('Direction'), 'direction');
$admin->row_yesno(T('User Selectable'), 'userselect', $language['userselect']);
-
+
$admin->row_submit();
$admin->table_end();
$admin->form_end();
-
+
$admin->page_end();
}
{
NavLinks::languagesAdd();
$navigator->set_focus('link', 'options-pages-languages', 'options-pages');
-
+
$admin->page_start(T('Manage Languages'));
-
+
$admin->table_start();
$admin->table_head(T('Manage Languages'), 3, 'language_manage');
-
+
$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))
{
(($bugsys->options['defaultlanguage'] == $language['languageid']) ? '<strong>' . T('DEFAULT LANGUAGE') . '</strong> / ' : '') . ($language['userselect'] ? T('User Selectable') : T('Private')) => 'c'
));
}
-
+
$admin->table_end();
-
+
$admin->page_end();
}
'canviewownhidden' => T('Can View Own Hidden Bugs'),
'cansubscribe' => T('Can Subscribe to Bugs'),
),
-
+
T('Posting/Submitting Permissions') => array(
'canvote' => T('Can Vote on Polls'),
'cansubmitbugs' => T('Can Submit Bugs'),
'canputattach' => T('Can Upload/Edit Own Attachments'),
'caneditattach' => T('Can Manage All Attachments')
),
-
+
T('Moderation/Managment Permissions') => array(
'caneditown' => T('Can Edit Own Bugs'),
'caneditother' => T('Can Edit Others\' Bugs'),
{
$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));
-
+
build_permissions();
-
+
$admin->redirect('permission.php?do=modify&usergroupid=' . $bugsys->in['usergroupid']);
}
$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']);
-
+
if (!$usergroup OR !$product)
{
$admin->error(L_INVALID_ID);
}
-
+
$admin->page_start(T('Edit Permissions'));
-
+
$admin->form_start('permission.php', 'update');
$admin->form_hidden_field('usergroupid', $usergroup['usergroupid']);
$admin->form_hidden_field('productid', $product['productid']);
-
+
// determine the value to work off of
if ($perm)
{
{
$mask = $usergroup['permissions'];
}
-
+
// Permission
$admin->table_start();
$admin->table_head(sprintf(T('Permissions: %1$s - %2$s'), $usergroup['title'], $product['title']));
-
+
foreach ($permissions AS $group => $settings)
{
$admin->row_span($group, 'thead', 'center');
{
$permissionvalue += $bugsys->permissions["$permtitle"] * $binaryswitch;
}
-
+
$db->query("
REPLACE INTO " . TABLE_PREFIX . "permission
(usergroupid, productid, mask)
$permissionvalue
)"
);
-
+
build_permissions();
-
+
$admin->redirect('permission.php?do=modify&usergroupid=' . $bugsys->in['usergroupid']);
}
if ($_REQUEST['do'] == 'modify')
{
$admin->page_start(T('Permission Manager'));
-
+
$admin->table_start();
$admin->table_head(T('Permission Manager'));
-
+
$groups = $db->query("SELECT * FROM " . TABLE_PREFIX . "usergroup ORDER BY usergroupid ASC");
while ($group = $db->fetch_array($groups))
{
$usergroups["$group[usergroupid]"] = $group;
}
$db->free_result($groups);
-
+
foreach ($usergroups AS $group)
{
$admin->row_text($group['title'], ($bugsys->in['usergroupid'] != $group['usergroupid'] ? "<a href=\"permission.php?do=modify&usergroupid=$group[usergroupid]\">[" . T('Expand') . "]</a>" : ''), 'top', 2, 'alt3');
-
+
if ($bugsys->in['usergroupid'] == $group['usergroupid'])
{
$permissions_fetch = $db->query("SELECT * FROM " . TABLE_PREFIX . "permission WHERE usergroupid = $group[usergroupid]");
{
$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))
{
$groupid = $group['usergroupid'];
$prodid = $product['productid'];
-
+
if (!isset($permissions["$product[productid]"]))
{
$statuslink = T('Inherited From Usergroup Settings: ');
$statuslink .= "<a href=\"permission.php?do=edit&usergroupid=$groupid&productid=$prodid\">[" . T('Edit') . ']</a>';
$statuslink .= " <a href=\"permission.php?do=delete&usergroupid=$groupid&productid=$prodid\">[" . T('Revert') . ']</a>';
}
-
+
$admin->row_text($product['title'], $statuslink);
}
}
}
-
+
$admin->table_end();
-
+
$admin->page_end();
}
$priority->set('priorityid', $bugsys->in['priorityid']);
$priority->set_condition();
$priority->delete();
-
+
$admin->redirect('priority.php?do=modify');
}
$priority->set('priority', $bugsys->in['priority']);
$priority->set('displayorder', $bugsys->in['displayorder']);
$priority->insert();
-
+
$admin->redirect('priority.php?do=modify');
}
{
NavLinks::prioritiesAdd();
$navigator->set_focus('link', 'priorities-add', 'priorities');
-
+
$admin->page_start(T('Add New Priority'));
-
+
$admin->form_start('priority.php', 'insert');
$admin->table_start();
$admin->table_head(T('New Priority'));
$admin->row_submit();
$admin->table_end();
$admin->form_end();
-
+
$admin->page_end();
}
$priority->set('priority', $bugsys->in['priority']);
$priority->set('displayorder', $bugsys->in['displayorder']);
$priority->update();
-
+
$admin->redirect('priority.php?do=modify');
}
{
NavLinks::prioritiesEdit($bugsys->in['priorityid']);
$navigator->set_focus('link', 'fields-pages-priorities', 'fields-pages');
-
+
$priority = new PriorityAPI($bugsys);
$priority->set('priorityid', $bugsys->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->table_start();
$admin->row_submit();
$admin->table_end();
$admin->form_end();
-
+
$admin->page_end();
}
{
NavLinks::prioritiesAdd();
$navigator->set_focus('link', 'fields-pages-priorities', 'fields-pages');
-
+
$admin->page_start(T('Priority Manager'));
-
+
$priorities = $db->query("SELECT * FROM " . TABLE_PREFIX . "priority ORDER BY displayorder");
-
+
$admin->form_start('priority.php', 'null');
$admin->table_start();
$admin->table_head(T('Priority Manager'));
-
+
while ($priority = $db->fetch_array($priorities))
{
$admin->row_text("$priority[displayorder]: <a href=\"priority.php?do=edit&priorityid=$priority[priorityid]\">$priority[priority]</a>", "(priorityid: $priority[priorityid]) <a href=\"priority.php?do=edit&priorityid=$priority[priorityid]\">[" . T('Edit') . "]</a> <a href=\"priority.php?do=delete&priorityid=$priority[priorityid]\">[" . T('Delete') . "]</a>");
}
$db->free_result($priorities);
-
+
$admin->table_end();
$admin->form_end();
-
+
$admin->page_end();
}
function construct_option_list($type_display, $type, $id, $edit, $addcomponent, $addversion, $delete, $displayorder)
{
global $bugsys;
-
+
$type = ($type == 'component' ? 'product' : $type);
$type_action = (($type == 'version') ? 'versionid' : 'productid');
-
+
if ($edit)
{
$opt .= '<option value="product.php?do=edit' . $type . '&' . $type_action . '=' . $id . '">' . sprintf(T('Edit %1$s'), $type_display) . '</option>';
}
-
+
if ($delete)
{
$opt .= '<option value="product.php?do=delete' . $type . '&' . $type_action . '=' . $id . '">' . sprintf(T('Delete %1$s'), $type_display) . '</option>';
}
-
+
if ($addcomponent)
{
$opt .= '<option value="product.php?do=addproduct&productid=' . $id . '">' . T('Add Component') . '</option>';
}
-
+
if ($addversion)
{
$opt .= '<option value="product.php?do=addversion&productid=' . $id . '">' . T('Add Version') . '</option>';
}
-
+
$type = strtolower($type);
-
+
$name = $type . '_' . $id;
-
+
$displayorder = (($displayorder != -1) ? '<input type="text" name="displayorder[' . $name . ']" value="' . $displayorder . '" size="4" class="input" /> ' : '');
-
+
return $displayorder . '<select id="' . $name . '" name="' . $name . '" onchange="exec_action(\'' . $name . '\')" class="input">' . $opt . '</select> <input type="button" class="button" name="gobutton" value=" ' . T('Go') . ' " onclick="exec_action(\'' . $name . '\')" />';
}
$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']);
-
+
build_versions();
-
+
$admin->redirect('product.php?do=modify');
}
{
NavLinks::productsEdit($bugsys->input_clean('productid', TYPE_UINT));
$navigator->set_focus('link', 'products-edit-version', 'products-edit');
-
+
if ($bugsys->in['productid'] != -1)
{
$product = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "product WHERE productid = " . $bugsys->in['productid']);
{
$bugsys->in['productid'] = 0;
}
-
+
$admin->page_start(T('Add Version'));
-
+
$admin->form_start('product.php', 'insertversion');
$admin->form_hidden_field('productid', $bugsys->in['productid']);
$admin->table_start();
$admin->row_submit();
$admin->table_end();
$admin->form_end();
-
+
$admin->page_end();
}
{
$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));
build_versions();
-
+
$admin->redirect('product.php?do=modify');
}
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));
if (!is_array($version))
{
$admin->error(L_INVALID_ID);
}
-
+
$admin->form_start('product.php', 'updateversion');
$admin->form_hidden_field('versionid', $version['versionid']);
$admin->table_start();
$admin->row_submit();
$admin->table_end();
$admin->form_end();
-
+
$admin->page_end();
}
{
$list[] = $prod['productid'];
}
-
+
$db->query("DELETE FROM " . TABLE_PREFIX . "product WHERE productid IN (" . implode(', ', $list) . ")");
$db->query("DELETE FROM " . TABLE_PREFIX . "version WHERE productid IN (" . implode(', ', $list) . ")");
$db->query("DELETE FROM " . TABLE_PREFIX . "bug WHERE product IN (" . implode(', ', $list) . ")");
-
+
build_products();
-
+
$admin->redirect('product.php?do=modify');
}
{
$admin->error(T('Please go back and fill in the title field.'));
}
-
+
$db->query("
INSERT INTO " . TABLE_PREFIX . "product
(title, parentid, description, displayorder)
)"
);
build_products();
-
+
$admin->redirect('product.php?do=modify');
}
NavLinks::productsAdd();
}
$navigator->set_focus('link', 'products-add', 'products');
-
+
$admin->page_start(T('Add New Product'));
-
+
$admin->form_start('product.php', 'insertproduct');
$admin->form_hidden_field('parentid', $bugsys->in['productid']);
$admin->table_start();
$admin->row_submit();
$admin->table_end();
$admin->form_end();
-
+
$admin->page_end();
}
{
$admin->error(T('Please go back and fill in the title field.'));
}
-
+
if (empty($bugsys->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));
build_products();
-
+
$admin->redirect('product.php?do=modify');
}
{
NavLinks::productsEdit($bugsys->input_clean('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']);
if (!is_array($product))
{
$admin->error(L_INVALID_ID);
}
-
+
$admin->form_start('product.php', 'updateproduct');
$admin->form_hidden_field('productid', $product['productid']);
$admin->table_start();
$admin->row_submit();
$admin->table_end();
$admin->form_end();
-
+
$admin->page_end();
}
if ($_REQUEST['do'] == 'modify')
{
$navigator->set_focus('link', 'products-manage', 'products');
-
+
$admin->page_start(T('Products and Versions'));
-
+
$javascript = <<<EOF
<script type="text/javascript">
<!--
//-->
</script>
EOF;
-
+
$admin->page_code($javascript);
-
+
$admin->form_start('product.php', 'displayorder');
-
+
$products_get = $db->query("SELECT * FROM " . TABLE_PREFIX . "product ORDER BY displayorder ASC");
$products = array();
while ($prod = $db->fetch_array($products_get))
}
$version["$prod[productid]"] = array();
}
-
+
$versions_get = $db->query("SELECT * FROM " . TABLE_PREFIX . "version ORDER BY displayorder ASC");
$versions = array();
while ($vers = $db->fetch_array($versions_get))
{
$versions["$vers[productid]"]["$vers[versionid]"] = $vers;
}
-
+
$admin->table_start();
$admin->table_head(T('Products / Versions'));
-
+
// Handle our global versions
if (is_array($versions['0']))
{
$admin->row_text('-- ' . $version['version'], construct_option_list(T('Version'), 'version', $version['versionid'], 1, 0, 0, 1, $version['displayorder']), 'middle', 2, 'alt2');
}
}
-
+
// Now let's do the rest of the versions
foreach ($products AS $product)
{
// Product
$admin->row_text("<a href=\"product.php?do=editproduct&productid=$product[productid]\">$product[title]</a>", construct_option_list(T('Product'), 'product', $product['productid'], 1, 1, 1, 1, $product['displayorder']), 'middle', 2, 'alt3');
-
+
// Versions
if (is_array($versions["$product[productid]"]))
{
$admin->row_text('-- ' . $version['version'], construct_option_list(T('Version'), 'version', $version['versionid'], 1, 0, 0, 1, $version['displayorder']), 'middle', 2, 'alt2');
}
}
-
+
// Components
if (is_array($components["$product[productid]"]))
{
foreach ($components["$product[productid]"] AS $comp)
{
$admin->row_text("-- <a href=\"product.php?do=editproduct&productid=$comp[productid]\">$comp[title]</a>", construct_option_list(T('Component'), 'component', $comp['productid'], 1, 0, 1, 1, $comp['displayorder']), 'middle', 2, 'alt1');
-
+
// Component versions
if (is_array($versions["$comp[productid]"]))
{
}
}
}
-
+
$admin->row_submit(null, T('Save Display Order'), null);
-
+
$admin->table_end();
-
+
$admin->form_end();
-
+
$admin->page_end();
}
$data->set_condition();
$data->delete();
}
-
+
$admin->redirect('purge_inactive.php');
}
if ($_REQUEST['do'] == 'modify')
{
NavLinks::usersAdd();
-
+
LoadPaginationFramework();
$pagination->setBitProcessor('AdminPageNavigatorBitCallback');
$pagination->setNavigatorProcessor('AdminPageNavigatorCallback');
-
+
$admin->page_start(T('Inactive Users'));
$admin->table_start();
$admin->table_head(T('Users Awaiting Email Confirmation for more than 30 Days'), 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 ($query) AS inactive");
$pagination->setTotal($count['count']);
$pagination->splitPages();
-
+
$users = $db->query("
$query
ORDER BY userid ASC LIMIT " . $pagination->fetchLimit($pagination->getPage() - 1) . ", " . $pagination->getPerPage()
'<a href="user.php?do=edit&userid=' . $user['userid'] . '">[' . T('Edit') . ']</a>' => 'c'
));
}
-
+
$admin->row_tfoot('<a href="purge_inactive.php?do=delete">[Remove All]</a>', 4);
-
+
$admin->table_end();
-
+
$admin->page_code($pagination->constructPageNav('purge_inactive.php'));
-
+
$admin->page_end();
}
$resolution->set('resolutionid', $bugsys->in['resolutionid']);
$resolution->set_condition();
$resolution->delete();
-
+
$admin->redirect('resolution.php?do=modify');
}
$resolution->set('resolution', $bugsys->in['resolution']);
$resolution->set('displayorder', $bugsys->in['displayorder']);
$resolution->insert();
-
+
$admin->redirect('resolution.php?do=modify');
}
{
NavLinks::resolutionsAdd();
$navigator->set_focus('link', 'resolutions-add', 'resolutions');
-
+
$admin->page_start(T('Add New Resolution'));
-
+
$admin->form_start('resolution.php', 'insert');
$admin->table_start();
$admin->table_head(T('New Resolution'));
$admin->row_submit();
$admin->table_end();
$admin->form_end();
-
+
$admin->page_end();
}
$resolution->set('resolution', $bugsys->in['resolution']);
$resolution->set('displayorder', $bugsys->in['displayorder']);
$resolution->update();
-
+
$admin->redirect('resolution.php?do=modify');
}
{
NavLinks::resolutionsEdit($bugsys->in['resolutionid']);
$navigator->set_focus('link', 'fields-pages-resolutions', 'fields-pages');
-
+
$resolution = new ResolutionAPI($bugsys);
$resolution->set('resolutionid', $bugsys->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->table_start();
$admin->row_submit();
$admin->table_end();
$admin->form_end();
-
+
$admin->page_end();
}
{
NavLinks::resolutionsAdd();
$navigator->set_focus('link', 'fields-pages-resolutions', 'fields-pages');
-
+
$admin->page_start(T('Resolution Manager'));
-
+
$resolutions = $db->query("SELECT * FROM " . TABLE_PREFIX . "resolution ORDER BY displayorder");
-
+
$admin->form_start('resolution.php', 'null');
$admin->table_start();
$admin->table_head(T('Resolution Manager'));
-
+
while ($resolution = $db->fetch_array($resolutions))
{
$admin->row_text("$resolution[displayorder]: <a href=\"resolution.php?do=edit&resolutionid=$resolution[resolutionid]\">$resolution[resolution]</a>", "(resolutionid: $resolution[resolutionid]) <a href=\"resolution.php?do=edit&resolutionid=$resolution[resolutionid]\">[" . T('Edit') . "]</a> <a href=\"resolution.php?do=delete&resolutionid=$resolution[resolutionid]\">[" . T('Delete') . "]</a>");
}
$db->free_result($resolutions);
-
+
$admin->table_end();
$admin->form_end();
-
+
$admin->page_end();
}
$value = implode(',', $value);
}
}
-
+
$updates[] = "('" . $bugsys->escape($varname) . "', '" . $bugsys->escape($value) . "')";
}
-
+
$db->query("REPLACE INTO " . TABLE_PREFIX . "setting (varname, value) VALUES " . implode(',', $updates));
-
+
build_settings();
-
+
$admin->redirect('setting.php');
}
if ($_REQUEST['do'] == 'modify')
{
$admin->page_start(T('Settings'));
-
+
$admin->form_start('setting.php', 'update');
-
+
$IS_SETTINGS = true;
-
+
// ###################################################################
$admin->table_start();
$admin->table_head(T('General Options'));
-
+
// authmethod
$admin->row_span(T('Authentication Method'), 'thead');
$methods = $funct->scandir('./includes/auth/');
}
}
$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']);
-
+
// 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']);
-
+
// 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']);
-
+
// 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']);
-
+
// 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']);
-
+
// 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']);
-
+
// 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 ("/").</strong><br />Example: http://www.bluestatic.org/bugs'), 'setting[trackerurl]', $bugsys->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']);
-
+
// 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']);
-
+
// 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]', bugdar::$datastore['language'], $bugsys->options['defaultlanguage'], 'languageid', 'title'), $bugsys->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']);
-
+
// 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->table_end();
-
+
// ###################################################################
$admin->table_start();
$admin->table_head(T('Bug Reporting Options'));
-
+
// 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']);
-
+
// 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]', bugdar::$datastore['severity'], $bugsys->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]', bugdar::$datastore['priority'], $bugsys->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]', bugdar::$datastore['status'], $bugsys->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]', bugdar::$datastore['resolution'], $bugsys->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]', bugdar::$datastore['assignto'], $bugsys->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->table_end();
-
+
// ###################################################################
$admin->table_start();
$admin->table_head(T('Bug Listing Display Options'));
-
+
// 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]', bugdar::$datastore['status'], $bugsys->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), $bugsys->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']));
-
+
// columnoptions
$admin->row_span(T('Default Column Ordering Options'), 'thead');
$admin->row_text(T('Specify the order of the columns for bug listings. The value 0 disables the display of a column and if two or more columns have the same position number, they will be displayed in the same column.'), ConstructColumnOptionsSetting());
-
+
$admin->table_end();
-
+
// ###################################################################
$admin->table_start();
$admin->table_head(T('Pagination Options'));
-
+
// 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']);
-
+
// 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']);
-
+
// 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->table_end();
-
+
// ###################################################################
if (DEVDEBUG)
{
$admin->row_submit();
$admin->table_end();
$admin->form_end();
-
+
$admin->page_end();
}
function ConstructColumnOptionsSetting()
{
global $bugsys;
-
+
$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']);
-
+
$return = '<table cellspacing="2" cellpadding="1" border="0">';
foreach ($bugsys->columns AS $column => $mask)
{
$severity->set('severityid', $bugsys->in['severityid']);
$severity->set_condition();
$severity->delete();
-
+
$admin->redirect('severity.php?do=modify');
}
$severity->set('severity', $bugsys->in['severity']);
$severity->set('displayorder', $bugsys->in['displayorder']);
$severity->insert();
-
+
$admin->redirect('severity.php?do=modify');
}
{
NavLinks::severitiesAdd();
$navigator->set_focus('link', 'severities-add', 'severities');
-
+
$admin->page_start(T('Add New Severity'));
-
+
$admin->form_start('severity.php', 'insert');
$admin->table_start();
$admin->table_head(T('New Severity'));
$admin->row_submit();
$admin->table_end();
$admin->form_end();
-
+
$admin->page_end();
}
$severity->set('severity', $bugsys->in['severity']);
$severity->set('displayorder', $bugsys->in['displayorder']);
$severity->update();
-
+
$admin->redirect('severity.php?do=modify');
}
{
NavLinks::severitiesEdit($bugsys->in['severityid']);
$navigator->set_focus('link', 'fields-pages-severities', 'fields-pages');
-
+
$severity = new SeverityAPI($bugsys);
$severity->set('severityid', $bugsys->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->table_start();
$admin->row_submit();
$admin->table_end();
$admin->form_end();
-
+
$admin->page_end();
}
{
NavLinks::severitiesAdd();
$navigator->set_focus('link', 'fields-pages-severities', 'fields-pages');
-
+
$admin->page_start(T('Severity Manager'));
-
+
$severities = $db->query("SELECT * FROM " . TABLE_PREFIX . "severity ORDER BY displayorder");
-
+
$admin->form_start('severity.php', 'null');
$admin->table_start();
$admin->table_head(T('Severity Manager'));
-
+
while ($severity = $db->fetch_array($severities))
{
$admin->row_text("$severity[displayorder]: <a href=\"severity.php?do=edit&severityid=$severity[severityid]\">$severity[severity]</a>", "(severityid: $severity[severityid]) <a href=\"severity.php?do=edit&severityid=$severity[severityid]\">[" . T('Edit') . "]</a> <a href=\"severity.php?do=delete&severityid=$severity[severityid]\">[" . T('Delete') . "]</a>");
}
$db->free_result($severities);
-
+
$admin->table_end();
$admin->form_end();
-
+
$admin->page_end();
}
$status->set('statusid', $bugsys->in['statusid']);
$status->set_condition();
$status->delete();
-
+
$admin->redirect('status.php?do=modify');
}
$status->set('color', $bugsys->in['color']);
$status->set('displayorder', $bugsys->in['displayorder']);
$status->insert();
-
+
$admin->redirect('status.php?do=modify');
}
{
NavLinks::statusesAdd();
$navigator->set_focus('link', 'statuses-add', 'statuses');
-
+
$admin->page_start(T('Add New Status'));
-
+
$admin->form_start('status.php', 'insert');
$admin->table_start();
$admin->table_head(T('New Status'));
$admin->row_submit();
$admin->table_end();
$admin->form_end();
-
+
$admin->page_end();
}
$status->set('color', $bugsys->in['color']);
$status->set('displayorder', $bugsys->in['displayorder']);
$status->update();
-
+
$admin->redirect('status.php?do=modify');
}
{
NavLinks::statusesEdit($bugsys->in['statusid']);
$navigator->set_focus('link', 'fields-pages-statuses', 'fields-pages');
-
+
$status = new StatusAPI($bugsys);
$status->set('statusid', $bugsys->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->table_start();
$admin->row_submit();
$admin->table_end();
$admin->form_end();
-
+
$admin->page_end();
}
{
NavLinks::statusesAdd();
$navigator->set_focus('link', 'fields-pages-statuses', 'fields-pages');
-
+
$admin->page_start(T('Status Manager'));
-
+
$statuses = $db->query("SELECT * FROM " . TABLE_PREFIX . "status");
-
+
$admin->table_start();
$admin->table_head(T('Status Manager'));
-
+
while ($status = $db->fetch_array($statuses))
{
$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&statusid=$status[statusid]\">$status[status]</a>", "(statusid: $status[statusid]) <a href=\"status.php?do=edit&statusid=$status[statusid]\">[" . T('Edit') . "]</a> <a href=\"status.php?do=delete&statusid=$status[statusid]\">[" . T('Delete') . "]</a>");
}
$db->free_result($statuses);
-
+
$admin->table_end();
-
+
$admin->page_end();
}
$user->set('userid', $bugsys->in['userid']);
$user->set_condition();
$user->delete();
-
+
$admin->redirect('user.php');
}
$user->set('defaultsortkey', $bugsys->in['defaultsortkey']);
$user->set('defaultsortas', $bugsys->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']))
{
$db->query("INSERT INTO " . TABLE_PREFIX . "useremail (userid, relation, mask) VALUES (" . $user->insertid . ", $relation, $bitmask)");
}
}
-
+
$admin->redirect('user.php?do=edit&userid=' . $user->insertid);
}
$user->set('defaultsortkey', $bugsys->in['defaultsortkey']);
$user->set('defaultsortas', $bugsys->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']))
$db->query("INSERT INTO " . TABLE_PREFIX . "useremail (userid, relation, mask) VALUES (" . $user->values['userid'] . ", $relation, $bitmask)");
}
}
-
+
$admin->redirect('user.php?do=edit&userid=' . $user->objdata['userid']);
}
{
$add = ($_REQUEST['do'] == 'add');
$edit = (!$add);
-
+
if ($edit)
{
NavLinks::usersEdit($bugsys->in['userid']);
$navigator->set_focus('link', 'users-pages-users', 'users-pages');
-
+
$user = new UserAPI($bugsys);
$user->set('userid', $bugsys->in['userid']);
$user->set_condition();
NavLinks::usersAdd();
$navigator->set_focus('link', 'users-add', 'users');
}
-
+
$admin->page_start(($add ? T('Add User') : T('Edit User')));
-
+
$admin->form_start('user.php', ($add ? 'insert' : 'update'));
-
+
if ($edit)
{
$admin->form_hidden_field('userid', $user->objdata['userid']);
}
-
+
$admin->table_start();
-
+
$admin->table_head(($add ? T('Add User') : sprintf(T('Edit User (userid: %1$s)'), $user->objdata['userid'])));
-
+
$admin->row_input(T('Display Name'), 'displayname', $user->objdata['displayname']);
$admin->row_input(T('Email'), 'email', $user->objdata['email']);
$admin->row_input(($add ? T('Password') : T('Password (Leave blank for no change)')), 'password');
-
+
foreach (bugdar::$datastore['usergroup'] AS $group)
{
$admin->list_item($group['title'], $group['usergroupid'], ($user->objdata['usergroupid'] == $group['usergroupid']));
}
$admin->row_list(T('Primary Usergroup'), 'usergroupid');
-
+
$ids = explode(',', $user->objdata['groupids']);
foreach (bugdar::$datastore['usergroup'] AS $id => $group)
{
$admin->list_item($group['title'], $group['usergroupid'], in_array($id, $ids));
}
$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']);
-
+
foreach (bugdar::$datastore['language'] AS $language)
{
$admin->list_item($language['title'], $language['languageid'], ($user->objdata['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->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', bugdar::$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_text(T('Default Sort Order Direction'), construct_option_select('defaultsortas', ListSorter::fetch_as_text(false), $user->objdata['defaultsortas']));
+
$admin->table_end();
-
+
// -------------------------------------------------------------------
$admin->table_start(false);
$admin->table_head(T('Email Options'), 6);
-
+
if ($user->objdata['userid'])
{
$options = $db->query("SELECT * FROM " . TABLE_PREFIX . "useremail WHERE userid = " . $user->objdata['userid']);
}
}
}
-
+
$admin->table_column_head(array('', T('Reporter'), T('Assignee'), T('Favorite'), T('Voter'), T('Commenter')));
-
+
// -------------------------------------------------------------------
-
+
$admin->row_text(T('New bug is added'), '<div style="text-align: center">' . draw_checkbox('emailopts[0][2048]', $checked[0][2048]) . '</div>', 'top', 6);
-
+
$admin->row_text(T('I am made the assignee'), '<div style="text-align: center">' . draw_checkbox('emailopts[0][32]', $checked[0][32]) . '</div>', 'top', 6);
-
+
$admin->row_multi_item(array(
T('Status or resolution changes') => 'l',
draw_checkbox('emailopts[1][64]', $checked[1][64]) => 'c',
draw_checkbox('emailopts[8][64]', $checked[8][64]) => 'c',
draw_checkbox('emailopts[16][64]', $checked[16][64]) => 'c',
));
-
+
$admin->row_multi_item(array(
T("'Duplicates' field is changed") => 'l',
draw_checkbox('emailopts[1][128]', $checked[1][128]) => 'c',
draw_checkbox('emailopts[8][128]', $checked[8][128]) => 'c',
draw_checkbox('emailopts[16][128]', $checked[16][128]) => 'c',
));
-
+
$admin->row_multi_item(array(
T('A new comment is added') => 'l',
draw_checkbox('emailopts[1][256]', $checked[1][256]) => 'c',
draw_checkbox('emailopts[8][256]', $checked[8][256]) => 'c',
draw_checkbox('emailopts[16][256]', $checked[16][256]) => 'c',
));
-
+
$admin->row_multi_item(array(
T('A new attachment is added') => 'l',
draw_checkbox('emailopts[1][512]', $checked[1][512]) => 'c',
draw_checkbox('emailopts[8][512]', $checked[8][512]) => 'c',
draw_checkbox('emailopts[16][512]', $checked[16][512]) => 'c',
));
-
+
$admin->row_multi_item(array(
T('Any other field changes') => 'l',
draw_checkbox('emailopts[1][1024]', $checked[1][1024]) => 'c',
draw_checkbox('emailopts[8][1024]', $checked[8][1024]) => 'c',
draw_checkbox('emailopts[16][1024]', $checked[16][1024]) => 'c',
));
-
+
// -------------------------------------------------------------------
$admin->row_submit(null, ':save:', ':reset:', 6);
-
+
$admin->table_end();
$admin->form_end();
-
+
$admin->page_end();
}
if ($_REQUEST['do'] == 'search')
{
$fail = false;
-
+
NavLinks::usersAdd();
$navigator->set_focus('link', 'users-pages-users', 'users-pages');
-
+
if (is_numeric($bugsys->in['userdata']))
{
$bugsys->input_clean('userdata', TYPE_UINT);
{
$bugsys->in['userdata'] = str_replace('%', '\%', $bugsys->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)
{
$fail = true;
else
{
$admin->page_start(T('Search Results'));
-
+
$admin->table_start();
$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))
{
$admin->row_multi_item(array(
'<a href="user.php?do=edit&userid=' . $row['userid'] . '">[' . T('Edit') . ']</a>' => 'c'
));
}
-
+
$admin->table_end();
-
+
$admin->page_end();
}
}
-
+
if ($fail)
{
$admin->error(T('Sorry, we could not find any users that matched your criteria.'));
{
NavLinks::usersAdd();
$navigator->set_focus('link', 'users-showall', 'users');
-
+
LoadPaginationFramework();
$pagination->setBitProcessor('AdminPageNavigatorBitCallback');
$pagination->setNavigatorProcessor('AdminPageNavigatorCallback');
-
+
$admin->page_start(T('Show All Users'));
$admin->table_start();
$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");
$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))
{
'<a href="user.php?do=edit&userid=' . $user['userid'] . '">[' . T('Edit') . ']</a>' => 'c'
));
}
-
+
$admin->table_end();
-
+
$admin->page_code($pagination->constructPageNav('user.php?do=showall'));
-
+
$admin->page_end();
}
{
NavLinks::usersAdd();
$navigator->set_focus('link', 'users-pages-users', 'users-pages');
-
+
$admin->page_start(T('User Search'));
-
+
$admin->form_start('user.php', 'search');
$admin->table_start(true, '45%');
-
+
$admin->table_head(T('User Search'));
$admin->row_input(T('Name/Email/ID'), 'userdata');
-
+
$admin->row_submit('', ':save:', '');
-
+
$admin->table_end();
$admin->form_end();
-
+
$admin->page_end();
}
'cansubscribe' => T('Can Subscribe to Bugs'),
'canbeassignedto' => T('Can Be Assigned Bugs')
),
-
+
T('Posting/Submitting Permissions') => array(
'canvote' => T('Can Vote on Polls'),
'cansubmitbugs' => T('Can Submit Bugs'),
'canputattach' => T('Can Upload/Edit Own Attachments'),
'caneditattach' => T('Can Manage All Attachments')
),
-
+
T('Moderation/Managment Permissions') => array(
'caneditown' => T('Can Edit Own Bugs'),
'caneditother' => T('Can Edit Others\' Bugs'),
'canchangestatus' => T('Can Change Status'),
'candeletedata' => T('Can Delete Bugs and Comments')
),
-
+
T('Administrator Permissions') => array(
'canadminpanel' => T('Can Access Control Panel'),
'canadminbugs' => T('Can Administer Bug Reports'),
$usergroup->set('usergroupid', $bugsys->in['usergroupid']);
$usergroup->set_condition();
$usergroup->delete();
-
+
$admin->redirect('usergroup.php?do=modify');
}
{
$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']));
}
$clone = ($_REQUEST['do'] == 'clone');
$add = ($_REQUEST['do'] == 'add' OR $clone);
$edit = !$add;
-
+
if ($edit)
{
NavLinks::usergroupsEdit($bugsys->in['usergroupid']);
NavLinks::usergroupsAdd();
$navigator->set_focus('link', 'usergroups-add', 'usergroups');
}
-
+
$admin->page_start(($add ? T('New Usergroup') : T('Edit Usergroup')));
-
+
$admin->form_start('usergroup.php', ($add ? 'insert' : 'update'));
-
+
if ($edit OR $clone)
{
$usergroup = new UsergroupAPI($bugsys);
$usergroup->set('usergroupid', $bugsys->in['usergroupid']);
$usergroup->set_condition();
$usergroup->fetch();
-
+
if ($clone)
{
$admin->form_hidden_field('cloneid', $usergroup->objdata['usergroupid']);
{
$usergroup['permissions'] = 319;
}
-
+
// 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->table_end();
-
+
// Permission
$admin->table_start();
-
+
$admin->table_head(T('Permission Settings'));
-
+
foreach ($permissions AS $group => $settings)
{
$admin->row_span($group, 'thead', 'center');
$admin->row_yesno($name, "perm[$setting]", ($usergroup->objdata['permissions'] & $bugsys->permissions["$setting"]));
}
}
-
+
$admin->table_end();
-
+
// custom field permissions
$admin->table_start();
$admin->table_head(T('Custom Field Permissions'));
-
+
if ($edit OR $clone)
{
$perms = $db->query("SELECT fieldid, mask FROM " . TABLE_PREFIX . "bugfieldpermission WHERE usergroupid = " . $usergroup->objdata['usergroupid']);
$permissions["$perm[fieldid]"] = $perm['mask'];
}
}
-
+
$fields = $db->query("SELECT fieldid, name FROM " . TABLE_PREFIX . "bugfield ORDER BY fieldid");
while ($field = $db->fetch_array($fields))
{
$admin->list_item(T('Can View, Edit Field'), 2, $permissions["$field[fieldid]"] == 2);
$admin->row_list($field['name'], "custom[$field[fieldid]]");
}
-
+
$admin->table_end();
-
+
// Submit
$admin->table_start();
$admin->row_submit();
$admin->table_end();
-
+
$admin->form_end();
-
+
$admin->page_end();
}
{
$permissionvalue += $bugsys->permissions["$permtitle"] * $binaryswitch;
}
-
+
$usergroup = new UsergroupAPI($bugsys);
$usergroup->set('title', $bugsys->in['title']);
$usergroup->set('displaytitle', $bugsys->in['displaytitle']);
$usergroup->set('permissions', $permissionvalue);
$usergroup->insert();
-
+
$bugsys->input_clean('custom', TYPE_UINT);
if (is_array($bugsys->in['custom']))
{
$values[] = $usergroup->insertid . ", " . $bugsys->clean($fieldid, TYPE_UINT) . ", " . $mask;
}
}
-
+
if (is_array($values))
{
$db->query("
)"
);
}
-
+
// copy product permissions from cloning
if ($bugsys->input_clean('cloneid', TYPE_UINT))
{
}
build_permissions();
}
-
+
$admin->redirect('usergroup.php?do=modify');
}
{
$permissionvalue += $bugsys->permissions["$permtitle"] * $binaryswitch;
}
-
+
$usergroup = new UsergroupAPI($bugsys);
$usergroup->set('usergroupid', $bugsys->in['usergroupid']);
$usergroup->set_condition();
$usergroup->set('displaytitle', $bugsys->in['displaytitle']);
$usergroup->set('permissions', $permissionvalue);
$usergroup->update();
-
+
$bugsys->input_clean('custom', TYPE_UINT);
if (is_array($bugsys->in['custom']))
{
$values[] = $usergroup->values['usergroupid'] . ", " . $bugsys->clean($fieldid, TYPE_UINT) . ", " . $mask;
}
}
-
+
if (is_array($values))
{
$db->query("
);
}
-
+
$admin->redirect('usergroup.php?do=modify');
}
if ($_POST['do'] == 'doapprove')
{
$bugsys->input_clean('approve', TYPE_UINT);
-
+
$idlist = array();
if (is_array($bugsys->in['approve']))
{
}
}
}
-
+
// load the template system...
$bugsys->load('template_fs', 'template', true);
$template->setExtension('tpl');
$template->setTemplateDir('templates/');
$template->setDatabaseCache(TABLE_PREFIX . 'template');
-
+
if (sizeof($idlist) > 0)
{
$users = $db->query("SELECT * FROM " . TABLE_PREFIX . "user WHERE userid IN (" . implode(',', $idlist) . ")");
$mail->setBodyText($email['email']['bodyText']['value']);
$mail->send($user['email'], $user['displayname']);
}
-
+
$db->query("UPDATE " . TABLE_PREFIX . "user SET usergroupid = 2 WHERE userid IN (" . implode(',', $idlist) . ")");
}
-
+
$admin->redirect('usergroup.php', T('The selected users have been promoted to the "Registered" usergroup.'));
}
{
NavLinks::usergroupsAdd();
$navigator->set_focus('link', 'usergroups-approve', 'usergroups');
-
+
$admin->page_start(T('Moderate Awaiting Users'), 3);
-
+
$admin->form_start('usergroup.php', 'doapprove');
$admin->table_start();
$admin->table_head(T('Moderate Un-Approved Users'), 3);
-
+
$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))
{
$admin->row_multi_item(array(
'<a href="user.php?do=edit&userid=' . $user['userid'] . '">' . $user['email'] . '</a>' => 'l',
bugdar::$datastore['usergroup']["$user[usergroupid]"]['title'] => 'c',
- '<input name="approve[' . $user['userid'] . ']" type="checkbox" value="1" />' => 'c'
+ '<input name="approve[' . $user['userid'] . ']" type="checkbox" value="1" />' => 'c'
));
}
-
+
$admin->row_submit(false, ':save:', ':reset:', 3);
$admin->table_end();
$admin->form_end();
-
+
$admin->page_end();
}
{
NavLinks::usergroupsAdd();
$navigator->set_focus('link', 'users-pages-usergroups', 'users-pages');
-
+
$admin->page_start(T('Usergroup Manager'));
-
+
$admin->form_start('usergroup.php', 'null');
$admin->table_start();
$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))
{
$usergroups["$group[usergroupid]"] = $group;
}
$db->free_result($groups);
-
+
$groups = $db->query("
SELECT COUNT(user.userid) AS total, user.usergroupid
FROM " . TABLE_PREFIX . "user AS user
{
$usergroups["$group[usergroupid]"]['total'] = $group['total'];
}
-
+
$admin->table_column_head(array(T('Usergroup'), T('Number of Users'), T('Action')));
foreach ($usergroups AS $group)
{
($group['usergroupid'] > 6 ? " <a href=\"usergroup.php?do=delete&usergroupid=$group[usergroupid]\">[" . T('Delete') . "]</a>" : '') => 'c'
));
}
-
+
$admin->table_end();
$admin->form_end();
-
+
$admin->page_end();
}
$help = new UserHelpAPI($bugsys);
$help->set('keystring', $bugsys->in['keystring']);
$help->delete();
-
+
build_user_help();
-
+
$admin->redirect('userhelp.php?do=modify');
}
$help->set('title', $bugsys->in['title']);
$help->set('body', $bugsys->in['body']);
$help->insert();
-
+
$admin->redirect('userhelp.php?do=modify');
}
if ($_REQUEST['do'] == 'add')
{
$navigator->set_focus('link', 'options-userhelp-add', 'options-userhelp');
-
+
$admin->page_start(T('New Help Text'));
-
+
$admin->form_start('userhelp.php', 'insert');
-
+
$admin->table_start();
$admin->table_head(T('New Help Text'));
-
+
$admin->row_input(T('Topic Title'), 'title');
$admin->row_input(T('Unique Key<br />(lowercase letters, underscores, and numbers only)'), 'keystring');
$admin->row_textarea(T('Body Text'), 'body');
-
+
$admin->row_submit();
-
+
$admin->table_end();
-
+
$admin->form_end();
-
+
$admin->page_end();
}
}
build_user_help();
-
+
$admin->redirect('userhelp.php?do=modify');
}
if ($_REQUEST['do'] == 'modify')
{
$navigator->set_focus('link', 'options-pages-userhelp', 'options-pages');
-
+
$admin->page_start(T('Edit User Help'));
-
+
$admin->form_start('userhelp.php', 'update');
-
+
$admin->table_start();
$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))
{
$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&keystring=' . $topic['keystring'] . '">[' . T('Delete') . ']</a>' : '');
-
+
$admin->row_textarea($inputfield . '<br /><em>' . $topic['keystring'] . '</em>' . $delete, 'help[' . $topic['keystring'] . '][body]', $topic['body']);
}
-
+
$admin->row_submit();
$admin->table_end();
-
+
$admin->page_end();
}
{
$attachapi = new AttachmentAPI($bugsys);
$attachapi->set('bugid', $bugsys->in['bugid']);
-
+
if (!can_perform('canputattach', $bug['product']))
{
$message->errorPermission();
}
-
+
// max packet size
$var = $db->query_first("SHOW VARIABLES LIKE 'max_allowed_packet'");
$bugsys->debug("max_allowed_packet = $var[Value]");
-
+
// create alias
$FILE =& $_FILES['attachment'];
-
+
// PHP errors
switch ($FILE['error'])
{
case 4: $message->addError(T('The file was not uploaded at all.')); break;
case 6: $message->addError(T('PHP could not find the /tmp directory.')); break;
}
-
+
// did it upload?
if (!is_uploaded_file($FILE['tmp_name']))
{
$message->addError(T('The file you specified did not upload.'));
}
-
+
// TODO - put some MIME-type validation here
-
+
if (filesize($FILE['tmp_name']) > $var['Value'])
{
$message->addError(T('The file you specified exceeds MySQL\'s maximum allowed packet.'));
}
-
+
$attachapi->set('attachment', file_get_contents($FILE['tmp_name']));
$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']);
-
+
// insert an attachment
if (!$message->hasErrors())
{
$attachapi->insert();
-
+
$obsoletes = $bugsys->input_clean('obsoletes', TYPE_UINT);
-
+
$notif->send_new_attachment_notice($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)
{
$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->add_data(false, array('obsolete' => 1), array('obsolete'), false, 'attachment');
$log->update_history();
}
}
-
+
// handle comment stuff
if (can_perform('canpostcomments', $bug['product']) AND trim($bugsys->in['comment']))
{
$comment->set('comment', $bugsys->in['comment']);
$comment->set('dateline', $attachapi->values['dateline']);
$comment->insert();
-
+
$notif->send_new_comment_notice($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]");
-
+
$notif->finalize();
-
+
$message->redirect(T('The attachment has been added to the bug.'), "showreport.php?bugid=$bug[bugid]");
}
else
{
$message->errorPermission();
}
-
+
$MAXFILESIZE = $funct->fetch_max_attachment_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))
$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";
}
-
+
eval('$template->flush("' . $template->fetch('newattach') . '");');
}
{
$message->errorPermission();
}
-
+
$attachapi = new AttachmentAPI($bugsys);
$attachapi->set('attachmentid', $bugsys->in['attachmentid']);
$attachapi->dorelations = array();
$attachapi->set_condition();
-
+
if ($bugsys->in['__delete__'] != '')
{
if (!(can_perform('caneditattach', $bug['product']) AND can_perform('candeletedata', $bug['productid'])))
{
$message->errorPermission();
}
-
+
$attachapi->delete();
-
+
$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']);
-
+
$attachapi->fetch();
-
+
$log->add_data(true, $attachapi->objdata, array('attachment'), true, 'attachment');
-
+
$attachapi->set('description', $bugsys->in['description']);
$attachapi->set('obsolete', $bugsys->in['obsolete']);
$attachapi->update();
-
+
$log->add_data(false, $attachapi->values, array('attachment'), true, 'attachment');
-
+
$log->update_history();
-
+
$message->redirect(T('The attachment was successfully modified.'), "showreport.php?bugid=$bug[bugid]");
}
}
{
$message->errorPermission();
}
-
+
$show['delete'] = (can_perform('caneditattach', $bug['product']) AND can_perform('candeletedata', $bug['productid']));
-
+
eval('$template->flush("' . $template->fetch('editattach') . '");');
}
'table' => 'usergroup',
'rebuild' => 'build_usergroups'
),
-
+
'statuses' => array(
'table' => 'status',
'rebuild' => 'build_statuses'
),
-
+
'severity' => array(
'table' => 'severity',
'rebuild' => 'build_severities'
),
-
+
'priorities' => array(
'table' => 'priority',
'rebuild' => 'build_priorities'
),
-
+
'resolutions' => array(
'table' => 'resolution',
'rebuild' => 'build_resolutions'
),
-
+
'user help' => array(
'table' => 'fieldhelp',
'rebuild' => 'build_user_help',
$exportlist["$display"][] = $fitem;
}
$db->free_result($fetch);
-
+
echo "Exported $display\n";
}
-
+
$phpfile = '<?' . 'php
// stores exported data data
// SVN $' . 'Id: $
-$DATASTORE = "' . addslashes(serialize($exportlist)) . '";
+$DATASTORE = "' . addslashes(serialize($exportlist)) . '";
?' . '>';
-
+
if ($handle = fopen('./docs/datatools_store.php', 'w'))
{
if (fwrite($handle, $phpfile))
echo 'Could not open the file with mode "w"';
exit;
}
-
+
echo "Wrote the file\n";
}
{
require('./docs/datatools_store.php');
$DATASTORE = unserialize(stripslashes($DATASTORE));
-
+
foreach ($THELIST AS $display => $data)
{
$db->query("TRUNCATE TABLE " . TABLE_PREFIX . "$data[table]");
-
+
$fields = array();
$values = array();
foreach ($DATASTORE["$display"] AS $mainarray)
echo str_replace(array('>', '<'), array('>', '<'), $query) . "\n";
$db->query($query);
}
-
+
$data['rebuild']();
echo "Rebuilding $data[table]\n\n";
}
{
require_once('./docs/datatools_store.php');
$DATASTORE = unserialize(stripslashes($DATASTORE));
-
+
$build = '$data = array(';
-
+
foreach ($THELIST AS $display => $data)
{
$build .= "\n\t'$data[table]' => array(";
$build .= "\n\t),";
}
$build = substr($build, 0, strlen($build) - 1);
-
+
$build .= "\n);";
-
+
echo '<textarea style="height: 500px; width: 100%">' . htmlspecialchars($build) . '</textarea>';
}
\$settings = array(
FILE;
-
+
$settings = $db->query("SELECT * FROM " . TABLE_PREFIX . "setting");
while ($setting = $db->fetch_array($settings))
{
$fout .= "\n\t'$setting[varname]' => '" . str_replace("'", "\'", $setting['value']) . "',";
}
-
+
$fout .= <<<FILE
);
\*=====================================================================*/
?>
FILE;
-
+
file_put_contents('install/settings.php', $fout);
chmod('install/settings.php', 0777);
-
+
echo 'Dumping current settings into install/settings.php';
}
// stores exported data data
// SVN $Id$
-$DATASTORE = "a:6:{s:10:\"usergroups\";a:6:{i:0;a:4:{s:11:\"usergroupid\";s:1:\"1\";s:5:\"title\";s:26:\"Unregistered/Not Logged In\";s:12:\"displaytitle\";s:5:\"Guest\";s:11:\"permissions\";s:2:\"83\";}i:1;a:4:{s:11:\"usergroupid\";s:1:\"2\";s:5:\"title\";s:16:\"Registered Users\";s:12:\"displaytitle\";s:10:\"Registered\";s:11:\"permissions\";s:8:\"33554687\";}i:2;a:4:{s:11:\"usergroupid\";s:1:\"3\";s:5:\"title\";s:27:\"Awaiting Email Confirmation\";s:12:\"displaytitle\";s:18:\"Pending Activation\";s:11:\"permissions\";s:1:\"7\";}i:3;a:4:{s:11:\"usergroupid\";s:1:\"4\";s:5:\"title\";s:16:\"Pending Approval\";s:12:\"displaytitle\";s:15:\"Account Pending\";s:11:\"permissions\";s:1:\"3\";}i:4;a:4:{s:11:\"usergroupid\";s:1:\"5\";s:5:\"title\";s:10:\"Developers\";s:12:\"displaytitle\";s:9:\"Developer\";s:11:\"permissions\";s:8:\"49291263\";}i:5;a:4:{s:11:\"usergroupid\";s:1:\"6\";s:5:\"title\";s:14:\"Administrators\";s:12:\"displaytitle\";s:13:\"Administrator\";s:11:\"permissions\";s:8:\"67108863\";}}s:8:\"statuses\";a:5:{i:0;a:4:{s:8:\"statusid\";s:1:\"1\";s:6:\"status\";s:11:\"Unconfirmed\";s:12:\"displayorder\";s:1:\"1\";s:5:\"color\";s:7:\"#D96640\";}i:1;a:4:{s:8:\"statusid\";s:1:\"2\";s:6:\"status\";s:9:\"Confirmed\";s:12:\"displayorder\";s:1:\"2\";s:5:\"color\";s:7:\"#FFFF40\";}i:2;a:4:{s:8:\"statusid\";s:1:\"3\";s:6:\"status\";s:8:\"Assigned\";s:12:\"displayorder\";s:1:\"3\";s:5:\"color\";s:7:\"#B266D9\";}i:3;a:4:{s:8:\"statusid\";s:1:\"4\";s:6:\"status\";s:6:\"Closed\";s:12:\"displayorder\";s:1:\"4\";s:5:\"color\";s:7:\"#8CD940\";}i:4;a:4:{s:8:\"statusid\";s:1:\"5\";s:6:\"status\";s:8:\"Reopened\";s:12:\"displayorder\";s:1:\"5\";s:5:\"color\";s:7:\"#40D9FF\";}}s:8:\"severity\";a:6:{i:0;a:3:{s:10:\"severityid\";s:1:\"1\";s:8:\"severity\";s:11:\"Enhancement\";s:12:\"displayorder\";s:1:\"1\";}i:1;a:3:{s:10:\"severityid\";s:1:\"2\";s:8:\"severity\";s:7:\"Trivial\";s:12:\"displayorder\";s:1:\"2\";}i:2;a:3:{s:10:\"severityid\";s:1:\"3\";s:8:\"severity\";s:5:\"Minor\";s:12:\"displayorder\";s:1:\"3\";}i:3;a:3:{s:10:\"severityid\";s:1:\"4\";s:8:\"severity\";s:8:\"Moderate\";s:12:\"displayorder\";s:1:\"4\";}i:4;a:3:{s:10:\"severityid\";s:1:\"5\";s:8:\"severity\";s:5:\"Major\";s:12:\"displayorder\";s:1:\"5\";}i:5;a:3:{s:10:\"severityid\";s:1:\"6\";s:8:\"severity\";s:8:\"Critical\";s:12:\"displayorder\";s:1:\"6\";}}s:10:\"priorities\";a:5:{i:0;a:3:{s:10:\"priorityid\";s:1:\"1\";s:8:\"priority\";s:8:\"Deferred\";s:12:\"displayorder\";s:1:\"1\";}i:1;a:3:{s:10:\"priorityid\";s:1:\"2\";s:8:\"priority\";s:3:\"Low\";s:12:\"displayorder\";s:1:\"2\";}i:2;a:3:{s:10:\"priorityid\";s:1:\"3\";s:8:\"priority\";s:6:\"Normal\";s:12:\"displayorder\";s:1:\"3\";}i:3;a:3:{s:10:\"priorityid\";s:1:\"4\";s:8:\"priority\";s:4:\"High\";s:12:\"displayorder\";s:1:\"4\";}i:4;a:3:{s:10:\"priorityid\";s:1:\"5\";s:8:\"priority\";s:11:\"Address Now\";s:12:\"displayorder\";s:1:\"5\";}}s:11:\"resolutions\";a:6:{i:0;a:3:{s:12:\"resolutionid\";s:1:\"1\";s:10:\"resolution\";s:4:\"Open\";s:12:\"displayorder\";s:1:\"1\";}i:1;a:3:{s:12:\"resolutionid\";s:1:\"2\";s:10:\"resolution\";s:5:\"Fixed\";s:12:\"displayorder\";s:1:\"2\";}i:2;a:3:{s:12:\"resolutionid\";s:1:\"3\";s:10:\"resolution\";s:5:\"Bogus\";s:12:\"displayorder\";s:1:\"3\";}i:3;a:3:{s:12:\"resolutionid\";s:1:\"4\";s:10:\"resolution\";s:9:\"Duplicate\";s:12:\"displayorder\";s:1:\"4\";}i:4;a:3:{s:12:\"resolutionid\";s:1:\"5\";s:10:\"resolution\";s:9:\"Won\'t Fix\";s:12:\"displayorder\";s:1:\"5\";}i:5;a:3:{s:12:\"resolutionid\";s:1:\"6\";s:10:\"resolution\";s:12:\"Works for Me\";s:12:\"displayorder\";s:1:\"6\";}}s:9:\"user help\";a:14:{i:0;a:3:{s:9:\"keystring\";s:5:\"bugid\";s:5:\"title\";s:15:\"Bug ID & Hidden\";s:4:\"body\";s:358:\"The bug ID is a unique identification number that can be used to to quickly locate it. The ID is also used for duplicates and dependencies. Marking a bug as "hidden" will prevent all users who cannot see hidden bugs (see the Bugdar manual regarding permissions). Hiding is useful for critical security issues that you do not want to be made public.\";}i:1;a:3:{s:9:\"keystring\";s:7:\"summary\";s:5:\"title\";s:7:\"Summary\";s:4:\"body\";s:108:\"The bug summary is used to give an overall description of the problem. It is displayed on all listing pages.\";}i:2;a:3:{s:9:\"keystring\";s:8:\"reporter\";s:5:\"title\";s:8:\"Reporter\";s:4:\"body\";s:139:\"The reporter is the user who is responsible for the initial bug report. If you need to get follow-up information, you should ask this user.\";}i:3;a:3:{s:9:\"keystring\";s:8:\"dateline\";s:5:\"title\";s:11:\"Report Time\";s:4:\"body\";s:63:\"The report time is the date and time of the initial bug report.\";}i:4;a:3:{s:9:\"keystring\";s:7:\"product\";s:5:\"title\";s:15:\"Product/Version\";s:4:\"body\";s:252:\"The product, component, and version show the general area where the problem occurs. Products are broad--for instance a car--whereas components would be like a door, using our car analogy. Versions show the specific revision at which the problem occurs.\";}i:5;a:3:{s:9:\"keystring\";s:10:\"assignedto\";s:5:\"title\";s:10:\"Assignment\";s:4:\"body\";s:103:\"The person who the bug is assigned to (if anybody) is the developer who is charged with fixing the bug.\";}i:6;a:3:{s:9:\"keystring\";s:6:\"status\";s:5:\"title\";s:6:\"Status\";s:4:\"body\";s:83:\"Status describes the state of the bug and how it is being handled, if it is at all.\";}i:7;a:3:{s:9:\"keystring\";s:10:\"resolution\";s:5:\"title\";s:10:\"Resolution\";s:4:\"body\";s:140:\"The resolution is the explanation for the status. Usually the resolution is set when a bug is marked "Closed" in the status field.\";}i:8;a:3:{s:9:\"keystring\";s:8:\"severity\";s:5:\"title\";s:8:\"Severity\";s:4:\"body\";s:145:\"Severity is the degree of the problem. This allows differentiation between a critical security flaw versus a slight annoyance with a work-around.\";}i:9;a:3:{s:9:\"keystring\";s:8:\"priority\";s:5:\"title\";s:8:\"Priority\";s:4:\"body\";s:221:\"The priority shows the degree of celerity with which the bug will be fixed. This is different from severity in that, a bug could be a valid issue, but it could be for an old version and thus the priority wouldn\'t be high.\";}i:10;a:3:{s:9:\"keystring\";s:11:\"duplicateof\";s:5:\"title\";s:12:\"Duplicate Of\";s:4:\"body\";s:107:\"If a bug is the same as another one in the bug tracker, you can enter the bug ID of that bug in this field.\";}i:11;a:3:{s:9:\"keystring\";s:10:\"dependency\";s:5:\"title\";s:12:\"Dependencies\";s:4:\"body\";s:177:\"If a bug is affected by another bug, you can enter the ID of the bug that affects this bug here. You can enter multiple values into this field by separating the IDs with spaces.\";}i:12;a:3:{s:9:\"keystring\";s:8:\"newreply\";s:5:\"title\";s:9:\"New Reply\";s:4:\"body\";s:557:\"Here you can specify additional comments. If you do not change any fields, this will merely attach a comment.\r
-\r
-The "Automation" drop-down next to this box (which may be hidden) will allow you to perform a common task. These administrator-defined tasks can change any of the bug fields automatically and then add an automatic reply. If you change a field that will be altered by the action, the action\'s change will take precedence. Also, if you enter a comment and the action specifies a comment, the automatic comment will be attached to yours.\";}i:13;a:3:{s:9:\"keystring\";s:11:\"columnorder\";s:5:\"title\";s:22:\"Custom Column Ordering\";s:4:\"body\";s:351:\"You can change the ordering and display of columns on the bug list using these settings. Any column with a position value of "0" will not be displayed in the list. Columns are positioned in the grid with the lowest numbered column starting at the far-left. If columns share a position number, they will be placed in the same column position.\";}}}";
+$DATASTORE = "a:6:{s:10:\"usergroups\";a:6:{i:0;a:4:{s:11:\"usergroupid\";s:1:\"1\";s:5:\"title\";s:26:\"Unregistered/Not Logged In\";s:12:\"displaytitle\";s:5:\"Guest\";s:11:\"permissions\";s:2:\"83\";}i:1;a:4:{s:11:\"usergroupid\";s:1:\"2\";s:5:\"title\";s:16:\"Registered Users\";s:12:\"displaytitle\";s:10:\"Registered\";s:11:\"permissions\";s:8:\"33554687\";}i:2;a:4:{s:11:\"usergroupid\";s:1:\"3\";s:5:\"title\";s:27:\"Awaiting Email Confirmation\";s:12:\"displaytitle\";s:18:\"Pending Activation\";s:11:\"permissions\";s:1:\"7\";}i:3;a:4:{s:11:\"usergroupid\";s:1:\"4\";s:5:\"title\";s:16:\"Pending Approval\";s:12:\"displaytitle\";s:15:\"Account Pending\";s:11:\"permissions\";s:1:\"3\";}i:4;a:4:{s:11:\"usergroupid\";s:1:\"5\";s:5:\"title\";s:10:\"Developers\";s:12:\"displaytitle\";s:9:\"Developer\";s:11:\"permissions\";s:8:\"49291263\";}i:5;a:4:{s:11:\"usergroupid\";s:1:\"6\";s:5:\"title\";s:14:\"Administrators\";s:12:\"displaytitle\";s:13:\"Administrator\";s:11:\"permissions\";s:8:\"67108863\";}}s:8:\"statuses\";a:5:{i:0;a:4:{s:8:\"statusid\";s:1:\"1\";s:6:\"status\";s:11:\"Unconfirmed\";s:12:\"displayorder\";s:1:\"1\";s:5:\"color\";s:7:\"#D96640\";}i:1;a:4:{s:8:\"statusid\";s:1:\"2\";s:6:\"status\";s:9:\"Confirmed\";s:12:\"displayorder\";s:1:\"2\";s:5:\"color\";s:7:\"#FFFF40\";}i:2;a:4:{s:8:\"statusid\";s:1:\"3\";s:6:\"status\";s:8:\"Assigned\";s:12:\"displayorder\";s:1:\"3\";s:5:\"color\";s:7:\"#B266D9\";}i:3;a:4:{s:8:\"statusid\";s:1:\"4\";s:6:\"status\";s:6:\"Closed\";s:12:\"displayorder\";s:1:\"4\";s:5:\"color\";s:7:\"#8CD940\";}i:4;a:4:{s:8:\"statusid\";s:1:\"5\";s:6:\"status\";s:8:\"Reopened\";s:12:\"displayorder\";s:1:\"5\";s:5:\"color\";s:7:\"#40D9FF\";}}s:8:\"severity\";a:6:{i:0;a:3:{s:10:\"severityid\";s:1:\"1\";s:8:\"severity\";s:11:\"Enhancement\";s:12:\"displayorder\";s:1:\"1\";}i:1;a:3:{s:10:\"severityid\";s:1:\"2\";s:8:\"severity\";s:7:\"Trivial\";s:12:\"displayorder\";s:1:\"2\";}i:2;a:3:{s:10:\"severityid\";s:1:\"3\";s:8:\"severity\";s:5:\"Minor\";s:12:\"displayorder\";s:1:\"3\";}i:3;a:3:{s:10:\"severityid\";s:1:\"4\";s:8:\"severity\";s:8:\"Moderate\";s:12:\"displayorder\";s:1:\"4\";}i:4;a:3:{s:10:\"severityid\";s:1:\"5\";s:8:\"severity\";s:5:\"Major\";s:12:\"displayorder\";s:1:\"5\";}i:5;a:3:{s:10:\"severityid\";s:1:\"6\";s:8:\"severity\";s:8:\"Critical\";s:12:\"displayorder\";s:1:\"6\";}}s:10:\"priorities\";a:5:{i:0;a:3:{s:10:\"priorityid\";s:1:\"1\";s:8:\"priority\";s:8:\"Deferred\";s:12:\"displayorder\";s:1:\"1\";}i:1;a:3:{s:10:\"priorityid\";s:1:\"2\";s:8:\"priority\";s:3:\"Low\";s:12:\"displayorder\";s:1:\"2\";}i:2;a:3:{s:10:\"priorityid\";s:1:\"3\";s:8:\"priority\";s:6:\"Normal\";s:12:\"displayorder\";s:1:\"3\";}i:3;a:3:{s:10:\"priorityid\";s:1:\"4\";s:8:\"priority\";s:4:\"High\";s:12:\"displayorder\";s:1:\"4\";}i:4;a:3:{s:10:\"priorityid\";s:1:\"5\";s:8:\"priority\";s:11:\"Address Now\";s:12:\"displayorder\";s:1:\"5\";}}s:11:\"resolutions\";a:6:{i:0;a:3:{s:12:\"resolutionid\";s:1:\"1\";s:10:\"resolution\";s:4:\"Open\";s:12:\"displayorder\";s:1:\"1\";}i:1;a:3:{s:12:\"resolutionid\";s:1:\"2\";s:10:\"resolution\";s:5:\"Fixed\";s:12:\"displayorder\";s:1:\"2\";}i:2;a:3:{s:12:\"resolutionid\";s:1:\"3\";s:10:\"resolution\";s:5:\"Bogus\";s:12:\"displayorder\";s:1:\"3\";}i:3;a:3:{s:12:\"resolutionid\";s:1:\"4\";s:10:\"resolution\";s:9:\"Duplicate\";s:12:\"displayorder\";s:1:\"4\";}i:4;a:3:{s:12:\"resolutionid\";s:1:\"5\";s:10:\"resolution\";s:9:\"Won\'t Fix\";s:12:\"displayorder\";s:1:\"5\";}i:5;a:3:{s:12:\"resolutionid\";s:1:\"6\";s:10:\"resolution\";s:12:\"Works for Me\";s:12:\"displayorder\";s:1:\"6\";}}s:9:\"user help\";a:14:{i:0;a:3:{s:9:\"keystring\";s:5:\"bugid\";s:5:\"title\";s:15:\"Bug ID & Hidden\";s:4:\"body\";s:358:\"The bug ID is a unique identification number that can be used to to quickly locate it. The ID is also used for duplicates and dependencies. Marking a bug as "hidden" will prevent all users who cannot see hidden bugs (see the Bugdar manual regarding permissions). Hiding is useful for critical security issues that you do not want to be made public.\";}i:1;a:3:{s:9:\"keystring\";s:7:\"summary\";s:5:\"title\";s:7:\"Summary\";s:4:\"body\";s:108:\"The bug summary is used to give an overall description of the problem. It is displayed on all listing pages.\";}i:2;a:3:{s:9:\"keystring\";s:8:\"reporter\";s:5:\"title\";s:8:\"Reporter\";s:4:\"body\";s:139:\"The reporter is the user who is responsible for the initial bug report. If you need to get follow-up information, you should ask this user.\";}i:3;a:3:{s:9:\"keystring\";s:8:\"dateline\";s:5:\"title\";s:11:\"Report Time\";s:4:\"body\";s:63:\"The report time is the date and time of the initial bug report.\";}i:4;a:3:{s:9:\"keystring\";s:7:\"product\";s:5:\"title\";s:15:\"Product/Version\";s:4:\"body\";s:252:\"The product, component, and version show the general area where the problem occurs. Products are broad--for instance a car--whereas components would be like a door, using our car analogy. Versions show the specific revision at which the problem occurs.\";}i:5;a:3:{s:9:\"keystring\";s:10:\"assignedto\";s:5:\"title\";s:10:\"Assignment\";s:4:\"body\";s:103:\"The person who the bug is assigned to (if anybody) is the developer who is charged with fixing the bug.\";}i:6;a:3:{s:9:\"keystring\";s:6:\"status\";s:5:\"title\";s:6:\"Status\";s:4:\"body\";s:83:\"Status describes the state of the bug and how it is being handled, if it is at all.\";}i:7;a:3:{s:9:\"keystring\";s:10:\"resolution\";s:5:\"title\";s:10:\"Resolution\";s:4:\"body\";s:140:\"The resolution is the explanation for the status. Usually the resolution is set when a bug is marked "Closed" in the status field.\";}i:8;a:3:{s:9:\"keystring\";s:8:\"severity\";s:5:\"title\";s:8:\"Severity\";s:4:\"body\";s:145:\"Severity is the degree of the problem. This allows differentiation between a critical security flaw versus a slight annoyance with a work-around.\";}i:9;a:3:{s:9:\"keystring\";s:8:\"priority\";s:5:\"title\";s:8:\"Priority\";s:4:\"body\";s:221:\"The priority shows the degree of celerity with which the bug will be fixed. This is different from severity in that, a bug could be a valid issue, but it could be for an old version and thus the priority wouldn\'t be high.\";}i:10;a:3:{s:9:\"keystring\";s:11:\"duplicateof\";s:5:\"title\";s:12:\"Duplicate Of\";s:4:\"body\";s:107:\"If a bug is the same as another one in the bug tracker, you can enter the bug ID of that bug in this field.\";}i:11;a:3:{s:9:\"keystring\";s:10:\"dependency\";s:5:\"title\";s:12:\"Dependencies\";s:4:\"body\";s:177:\"If a bug is affected by another bug, you can enter the ID of the bug that affects this bug here. You can enter multiple values into this field by separating the IDs with spaces.\";}i:12;a:3:{s:9:\"keystring\";s:8:\"newreply\";s:5:\"title\";s:9:\"New Reply\";s:4:\"body\";s:557:\"Here you can specify additional comments. If you do not change any fields, this will merely attach a comment.
+
+The "Automation" drop-down next to this box (which may be hidden) will allow you to perform a common task. These administrator-defined tasks can change any of the bug fields automatically and then add an automatic reply. If you change a field that will be altered by the action, the action\'s change will take precedence. Also, if you enter a comment and the action specifies a comment, the automatic comment will be attached to yours.\";}i:13;a:3:{s:9:\"keystring\";s:11:\"columnorder\";s:5:\"title\";s:22:\"Custom Column Ordering\";s:4:\"body\";s:351:\"You can change the ordering and display of columns on the bug list using these settings. Any column with a position value of "0" will not be displayed in the list. Columns are positioned in the grid with the lowest numbered column starting at the far-left. If columns share a position number, they will be placed in the same column position.\";}}}";
?>
\ No newline at end of file
<title>Bugdar: Mail Test</title>
</head>
<body>
-
+
<h1>Mail Test</h1>
<p>This tool will run a few email tests to make sure that emailing works. Follow the instructions below.</p>
-
+
<hr />
<?php
<h2>Email Addresses</h2>
<p><strong>Enter in the following email addresses for sending and receiving.</strong></p>
-
+
<form action="mailtest.php" method="get" accept-charset="utf-8">
<p>Email address to <em>receieve</em> all tests: <input type="text" name="receive" value="" size="25" /></p>
<p>An email address that exists on the mail server that is <em>not</em> the one receiving the tests: <input type="text" name="sender" value="" size="25 /"></p>
PHP: " . phpversion() . "
Mail Test: " . '$Revision$' . "
Sendmail (From): \"" . ini_get('sendmail_from') . "\"
-Sendmail (Path): \"" . ini_get('sendmail_path') . "\"";
-
+Sendmail (Path): \"" . ini_get('sendmail_path') . "\"";
+
$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']))
{
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>';
// normal Bugdar mailing
$mail->setBodyText(sprintf($text, 1, 'sending with the Bugdar-configured address'));
$mail->send($bugsys->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 from self
$mail->setBodyText(sprintf($text, 3, 'sending from the receiving address'));
$mail->setFromAddress($bugsys->in['receive']);
$mail->send($bugsys->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']);
-
+
?>
<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>
-
+
<?php
}
}
{
// 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))
echo "<input type=\"hidden\" name=\"do\" value=\"go\" />\r";
echo '<table border="1" cellspacing="2" cellpadding="3">';
echo "\r<tr><td><strong>Name</strong></td><td><strong>Value</strong></td><td><strong>Del</strong></td></tr>";
-
+
foreach ($_COOKIE AS $varname => $value)
{
echo "\r<tr><td>" . $varname . '</td><td>' . $value . '</td><td><input type="checkbox" name="del[' . $varname . ']" value="' . $varname . '" /></tr>';
}
-
- echo '</table>';
-
+
+ echo '</table>';
+
echo "\r<br />\r<input type=\"submit\" name=\"submit\" value=\"Delete Cookies\" /></form>";
}
else
{
setcookie($remove, '', time() - (2 * 900), '/');
}
-
+
header("Location: mycookies.php");
}
include 'includes/api_comment.php';
for ($i = 11; $i < 111; $i++)
-{
+{
$bug = new BugAPI($bugsys);
$comment = new CommentAPI($bugsys);
-
+
$bug->set('userid', $bugsys->userinfo['userid']);
$bug->set('username', $bugsys->userinfo['displayname']);
$bug->set('summary', 'AUTO POPULATE: ' . $i);
$bug->set('severity', 1);
-
+
$comment->set('userid', $bugsys->userinfo['userid']);
$comment->set('comment', $funct->rand(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('product', 6);
$bug->set('component', 0);
$bug->set('version', 14);
-
+
$bug->insert();
-
+
$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->dorelations = array();
$bug->set('bugid', $comment->values['bugid']);
chdir(BUGDAR_BASE);
include 'includes/init.php';
include 'includes/api_bug.php';
-
+
foreach ($matches[5] AS $id)
{
$api = new BugAPI($bugsys);
$replace["$comment[bugid]"]['hiddenlastposttime'] = $comment['dateline'];
$replace["$comment[bugid]"]['hiddenlastpostby'] = $comment['userid'];
}
-
+
$replace["$comment[bugid]"]['lastposttime'] = $comment['dateline'];
}
3 => 4,
4 => 5
),
-
+
'severity' => array(
6 => 1,
1 => 2,
{
$message->errorPermission();
}
-
+
// 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");
-
+
$commentapi->delete();
-
+
// check to see if we need to rebuild the lastpost information
if ($lastpost['commentid'] == $comment['commentid'])
{
update_lastpost_time($bug);
}
-
+
$message->redirect(T('The comment has been deleted. You will be redirected back to the bug.'), 'showreport.php?bugid=' . $bug['bugid']);
}
{
$message->errorPermission();
}
-
+
if ($bug['initialreport'] == $comment['commentid'])
{
$message->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).'));
}
-
+
$message->confirm(T('Are you sure you want to delete this comment? After you do so, the data <strong>will</strong> be lost forever. We recommend only deleting spam comments and nothing else.'), 'editcomment.php', 'kill', T('Delete Comment'), 'showreport.php?bugid=' . $bug['bugid'], array('commentid' => $comment['commentid']));
}
{
$message->errorPermission();
}
-
+
$commentapi->set('comment', $bugsys->in['comment']);
$commentapi->set('parselinks', $bugsys->in['parselinks']);
$commentapi->set('hidden', $bugsys->in['hidden']);
-
+
if ($bugsys->in['commentid'] == $bug['initialreport'] AND $bugsys->in['hidden'])
{
$message->addError(T('You cannot hide the first comment/initial report of a bug. Instead, hide the entire bug.'));
}
-
+
if (!$message->hasErrors())
{
$commentapi->update();
-
+
// setup logging
require_once('./includes/class_logging.php');
$log = new Logging;
$log->set_bugid($bug['bugid']);
$log->set_commentid($comment['commentid']);
-
+
$log->add_data(true, $commentapi->objdata, array('comment', 'hidden'), false, 'comment');
$log->add_data(false, $commentapi->values, array('comment', 'hidden'), false, 'comment');
{
$message->errorPermission();
}
-
+
$comment['posttime'] = $datef->format($bugsys->options['dateformat'], $comment['dateline']);
if ($comment['userid'])
{
{
$message->errorPermission();
}
-
+
$bugapi->delete();
-
+
$message->redirect(T('The entire bug has been deleted.'), 'index.php');
}
{
$message->errorPermission();
}
-
+
$message->confirm(T('Are you sure you want to delete this bug? Doing so will <strong>destroy</strong> all associated data, including comments, attachments, and votes. We strongly recommend only deleting span records and nothing else as users may wish to go back and look at any bug to check its status.'), 'editreport.php', 'kill', T('Delete Bug Permanently'), 'showreport.php?bugid=' . $bug['bugid'], array('bugid' => $bug['bugid']));
}
{
$message->errorPermission();
}
-
+
$log->add_data(true, $bugapi->objdata, $log->getCommonFields(), true);
-
+
// -------------------------------------------------------------------
// handle automations
if ($bugsys->in['automation'])
{
$commenttext = $bugsys->in['comment'];
}
-
+
$comment = new CommentAPI($bugsys);
$comment->set('bugid', $bugsys->in['bugid']);
$comment->set('userid', $bugsys->userinfo['userid']);
$comment->set('comment', $commenttext);
$comment->set('parselinks', $bugsys->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);
-
+
$bugapi->set('lastposttime', $comment->values['dateline']);
$bugapi->set('lastpostby', $bugsys->userinfo['userid']);
$bugapi->set('lastpostbyname', $bugsys->userinfo['displayname']);
$bugapi->set('hiddenlastposttime', $comment->values['dateline']);
$bugapi->set('hiddenlastpostby', $bugsys->userinfo['userid']);
$bugapi->set('hiddenlastpostbyname', $bugsys->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'])))
{
$bugapi->update();
$message->redirect(T('Your reply has been added to the comment list.'), "showreport.php?bugid=$bug[bugid]");
}
}
-
+
// -------------------------------------------------------------------
- // do update stuff
+ // do update stuff
$dependencies = preg_split('#([^0-9].*?)#', $bugsys->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']))
{
$bugapi->set('summary', $bugsys->in['summary']);
$bugapi->set('duplicateof', $bugsys->in['duplicateof']);
$bugapi->set('dependency', $dependencies);
$bugapi->set('hidden', $bugsys->in['hidden']);
-
+
$product = explode(',', $bugsys->in['product']);
$bugapi->set('product', $product[0]);
$bugapi->set('component', $product[1]);
$bugapi->set('version', $product[2]);
}
-
+
if (can_perform('canchangestatus', $bug['product']))
{
$bugapi->set('priority', $bugsys->in['priority']);
{
$bugapi->set('assignedto', $bugsys->in['assignedto']);
}
-
+
process_custom_fields($bugapi, $message, false);
-
+
// -------------------------------------------------------------------
// 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);
-
+
if (!$message->hasErrors())
{
$bugapi->update();
{
$message->error();
}
-
+
// -------------------------------------------------------------------
// do diff history
$log->update_history();
-
+
$notif->send_bug_changes_notice();
-
+
$notif->finalize();
-
+
$message->redirect(T('Your changes to the bug have been saved.'), "showreport.php?bugid=$bug[bugid]");
}
{
$message->error(T('There are no products set up.'));
}
-
+
foreach (bugdar::$datastore['product'] AS $product)
{
if ($product['parentid'])
$products["$product[productid]"] = $product;
}
}
-
+
foreach (bugdar::$datastore['version'] AS $version)
{
$versions["$version[productid]"]["$version[versionid]"] = $version;
}
-
+
// global versions
if (is_array($versions['0']))
{
eval('$globalversions .= "' . $template->fetch('explain_row') . '";');
}
}
-
+
foreach ($products AS $product)
{
$left = $product['title'];
$right = $product['description'];
$trextra = ' class="altcolor"';
eval('$productlist .= "' . $template->fetch('explain_row') . '";');
-
+
if (is_array($components["$product[productid]"]))
{
foreach ($components["$product[productid]"] AS $component)
}
}
}
-
+
eval('$template->flush("' . $template->fetch('explain_product') . '");');
}
{
$fields["$field[fieldid]"] = $field;
}
-
+
if (is_array(bugdar::$datastore['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') . '";');
-
+
if ($automation['comment'])
{
$left = T('Add Comment');
$right = $automation['comment'];
$trextra = ' class="altcolor"';
-
+
eval('$automations .= "' . $template->fetch('explain_row') . '";');
}
-
+
$trextra = '';
-
+
if (is_array($automation['fieldchanges']['builtin']))
{
foreach ($automation['fieldchanges']['builtin'] AS $name => $value)
eval('$automations .= "' . $template->fetch('explain_row') . '";');
}
}
-
+
if (is_array($automation['fieldchanges']['custom']))
{
foreach ($automation['fieldchanges']['custom'] AS $id => $value)
{
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') . '";');
}
}
}
-
+
eval('$template->flush("' . $template->fetch('explain_automation') . '");');
}
{
$message->errorPermission();
}
-
+
if (!can_perform('cansubscribe', $bug['product']))
{
$message->errorPermission();
}
-
+
if ($db->query_first("SELECT * FROM " . TABLE_PREFIX . "favorite WHERE userid = " . $bugsys->userinfo['userid'] . " AND bugid = " . $bugsys->in['bugid']))
{
$db->query("DELETE FROM " . TABLE_PREFIX . "favorite WHERE userid = " . $bugsys->userinfo['userid'] . " AND bugid = " . $bugsys->in['bugid']);
{
$message->errorPermission();
}
-
+
$favorites = $db->query("
SELECT favorite.bugid, bug.* FROM " . TABLE_PREFIX . "favorite AS favorite
RIGHT JOIN " . TABLE_PREFIX . "bug AS bug
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') . "))" : "") . ")
");
-
+
if ($db->num_rows($favorites) < 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.'));
}
-
+
$sort = new ListSorter('favorite');
-
+
$headers = $sort->constructColumnHeaders(false);
-
+
while ($bug = $db->fetch_array($favorites))
{
$funct->exec_swap_bg('altcolor', '');
$bug = ProcessBugDataForDisplay($bug, $funct->bgcolour);
$bugs .= $sort->constructRow($bug);
}
-
+
eval('$template->flush("' . $template->fetch('favorites') . '");');
}
*/
if (!defined('REQ_AUTO'))
-{
+{
/**
* Auto-increasing value
*/
define('REQ_AUTO', -1);
-
+
/**
* Set by a cusotm set_*() function
*/
define('REQ_SET', 2);
-
+
/**
* Index for cleaning type
*/
define('F_TYPE', 0);
-
+
/**
* Index for requirement type
*/
define('F_REQ', 1);
-
+
/**
* Index for verification type
*/
define('F_VERIFY', 2);
-
+
/**
* Index for relation
*/
define('F_RELATION', 3);
-
+
/**
* Relation index for file name, relative to ISSO->apppath
*/
define('F_RELATION_FILE', 0);
-
+
/**
* Relation index for class name
*/
define('F_RELATION_CLASS', 1);
-
+
/**
* Relation index for field-link alternate name
*/
* @copyright Copyright (c)2002 - [#]year[#], Blue Static
* @version $Revision$
* @package ISSO
-*
+*
*/
class API
{
* @access protected
*/
var $registry = null;
-
+
/**
* Fields: used for verification and sanitization
* NAME => array(TYPE, REQUIRED, VERIFY METHOD (:self for self-named method), RELATION => array(FILE, CLASS IN FILE, ALTERNATE FIELD NAME))
* @access protected
*/
var $fields = array();
-
+
/**
* Values array: sanitized and verified field values
* @var array
* @access public
*/
var $values = array();
-
+
/**
* Fields that were manually set with set(), not by using set_existing()
* @var array
* @access private
*/
var $setfields = array();
-
+
/**
* An array of all of the processed relations on an object
* @var array
* @access public
*/
var $relations = array();
-
+
/**
* WHERE condition
* @var string
* @access private
*/
var $condition = '';
-
+
/**
* The object table row; a fetched row that represents this instance
* @var array
* @access public
*/
var $objdata = array();
-
+
/**
* Insert ID from the insert() command
* @var integer
* @access public
*/
var $insertid = 0;
-
+
/**
* Pre- and post-action method stoppers
* @var array
* @access public
*/
var $norunners = array();
-
+
/**
* The relations to execute on
* @var array
* @access public
*/
var $dorelations = array('fetch');
-
+
/**
* Error list that has been generated
* @var array
* @access private
*/
var $errors = array();
-
+
// ###################################################################
/**
* Constructor: cannot instantiate class directly
{
trigger_error('Cannot instantiate the API module directly', E_USER_ERROR);
}
-
+
if (!is_object($registry))
{
trigger_error('The passed registry is not an object', E_USER_ERROR);
}
-
+
$this->registry =& $registry;
}
-
+
// ###################################################################
/**
* (PHP 4) Constructor
{
$this->__construct($registry);
}
-
+
// ###################################################################
/**
* Constructs an error for the error handler to receive
function error($message)
{
$this->errors[] = $message;
-
+
// we want to explicitly specify silence
if (APIError() == 'silent')
{
return;
}
-
+
if (!is_callable(APIError()))
{
trigger_error('No APIError() handler has been set', E_USER_WARNING);
}
-
+
call_user_func(APIError(), $message);
}
-
+
// ###################################################################
/**
* Returns the error list. This is because we don't want people mucking
{
return array();
}
-
+
return $this->errors;
}
-
+
// ###################################################################
/**
* Sets a value, sanitizes it, and verifies it
trigger_error('Field `' . $field . '` is not valid', E_USER_WARNING);
return;
}
-
+
$this->values["$field"] = ($doclean ? $this->registry->clean($value, $this->fields["$field"][F_TYPE]) : $value);
-
+
$this->setfields["$field"] = $field;
-
+
if (isset($this->fields["$field"][F_VERIFY]) AND $doverify)
{
if ($this->fields["$field"][F_VERIFY] == ':self')
{
$verify = $this->{$this->fields["$field"][F_VERIFY]}($field);
}
-
+
if ($verify !== true)
{
if ($verify === false)
}
}
}
-
+
// ###################################################################
/**
* Sets the condition to use in the WHERE clause; if not passed, then
if (is_array($condition) AND sizeof($condition) > 0)
{
$this->condition = '';
-
+
foreach ($condition AS $field)
{
if (!$this->values["$field"])
trigger_error('The specified field `' . $field . '` for the condition could not be found as it is not set', E_USER_WARNING);
continue;
}
-
+
$condbits[] = "$field = " . $this->prepare_field_for_sql($field);
}
$this->condition = implode(' AND ', $condbits);
{
$this->condition = $condition;
}
- else
+ else
{
foreach ($this->fields AS $name => $options)
{
trigger_error('Cannot determine condition from the REQ_AUTO field because it is not set', E_USER_WARNING);
continue;
}
-
+
$this->condition = "$name = " . $this->prepare_field_for_sql($name);
}
}
-
+
if ($this->condition == '')
{
trigger_error('No REQ_AUTO fields are present and therefore the condition cannot be created', E_USER_WARNING);
}
}
}
-
+
// ###################################################################
/**
* Sets existing data into $values where it's not already present
{
return;
}
-
+
$this->fetch();
-
+
foreach ($this->objdata AS $field => $value)
{
if (!isset($this->values["$field"]))
$this->values["$field"] = $value;
}
}
-
+
$run = true;
}
-
+
// ###################################################################
/**
* Fetches a record based on the condition
{
trigger_error('Condition is empty: cannot fetch', E_USER_ERROR);
}
-
+
$this->run_action_method('pre_fetch');
-
+
$result = $this->registry->modules[ISSO_DB_LAYER]->query_first("SELECT * FROM {$this->prefix}{$this->table} WHERE {$this->condition}");
if (!$result)
{
$this->error(T('No records were returned'));
return;
}
-
+
$this->run_action_method('post_fetch');
-
+
$this->objdata = $result;
-
+
if ($populate)
{
foreach ($this->objdata AS $key => $value)
}
}
}
-
- $this->call_relations('fetch');
+
+ $this->call_relations('fetch');
}
-
+
// ###################################################################
/**
* Inserts a record in the database
function insert()
{
$this->verify();
-
+
$this->run_action_method('pre_insert');
-
+
foreach ($this->setfields AS $field)
{
$fields[] = $field;
$values[] = $this->prepare_field_for_sql($field);
}
-
+
$this->registry->modules[ISSO_DB_LAYER]->query("INSERT INTO {$this->prefix}{$this->table} (" . implode(',', $fields) . ") VALUES (" . implode(',', $values) . ")");
-
+
if (strcasecmp(ISSO_DB_LAYER, 'DB_PostgreSQL') == 0)
{
foreach ($this->fields AS $field => $info)
break;
}
}
-
+
$this->insertid = $this->registry->modules[ISSO_DB_LAYER]->insert_id($this->prefix . $this->table, $autofield);
}
else
{
$this->insertid = $this->registry->modules[ISSO_DB_LAYER]->insert_id();
}
-
+
$this->run_action_method('post_insert');
}
-
+
// ###################################################################
/**
* Updates a record in the database using the data in $vaues
}
$this->run_action_method('pre_update');
-
+
foreach ($this->setfields AS $field)
{
$updates[] = "$field = " . $this->prepare_field_for_sql($field);
}
$updates = implode(', ', $updates);
-
+
$this->registry->modules[ISSO_DB_LAYER]->query("UPDATE {$this->prefix}{$this->table} SET $updates WHERE {$this->condition}");
-
+
$this->run_action_method('post_update');
}
-
+
// ###################################################################
/**
* Deletes a record
{
trigger_error('Condition is empty: cannot delete', E_USER_ERROR);
}
-
+
if ($runset)
{
$this->set_existing();
}
-
+
$this->run_action_method('pre_delete');
-
+
$this->registry->modules[ISSO_DB_LAYER]->query("DELETE FROM {$this->prefix}{$this->table} WHERE {$this->condition}");
-
+
$this->run_action_method('post_delete');
}
-
+
// ###################################################################
/**
* Verifies that all required fields are set
}
}
}
-
+
// ###################################################################
/**
* Runs a pre- or post-action method for database commands
{
return;
}
-
+
$actmethod = (method_exists($this, $method) ? $this->$method() : '');
}
-
+
// ###################################################################
/**
* Determines if it's safe to run a relation; if so, it will return
{
return;
}
-
+
foreach ($this->fields AS $field => $info)
{
$value = (isset($this->values["$field"]) ? $this->values["$field"] : $this->objdata["$field"]);
{
continue;
}
-
+
if (!file_exists($this->registry->getAppPath() . $info[F_RELATION][F_RELATION_FILE]))
{
trigger_error("Could not load the relation file for field '$field'");
}
-
+
require_once($this->registry->getAppPath() . $info[F_RELATION][F_RELATION_FILE]);
-
+
$this->relations["$field"] = new $info[F_RELATION][F_RELATION_CLASS]($this->registry);
$this->relations["$field"]->set(($info[F_RELATION][F_RELATION_ALTFIELD] ? $info[F_RELATION][F_RELATION_ALTFIELD] : $field), $value);
$this->relations["$field"]->set_condition();
$this->relations["$field"]->$method();
}
}
-
+
// ###################################################################
/**
* Prepares a value for use in a SQL query; it encases and escapes
function prepare_field_for_sql($name)
{
$type = $this->fields["$name"][F_TYPE];
-
+
if ($type == TYPE_NOCLEAN OR $type == TYPE_STR OR $type == TYPE_STRUN)
{
return "'" . $this->registry->db->escape_string($this->values["$name"]) . "'";
return $this->values["$name"];
}
}
-
+
// ###################################################################
/**
* Verify field: not a zero value
{
return sprintf(T('The field "%1$s" cannot be zero'), $field);
}
-
+
return true;
}
-
+
// ###################################################################
/**
* Verify field: not empty
{
return sprintf(T('The field "%1$s" cannot be empty'), $field);
}
-
+
return true;
}
}
function APIError($new = null)
{
static $caller, $prev;
-
+
if ($new === -1)
{
$caller = $prev;
$prev = $caller;
$caller = $new;
}
-
+
return $caller;
}
* @copyright Copyright (c)2002 - [#]year[#], Blue Static
* @version $Revision$
* @package ISSO
-*
+*
*/
class Date
{
* @access private
*/
var $registry = null;
-
+
/**
* User timezone offset
* @var integer
* @access public
*/
var $usertz = 0;
-
+
/**
* Server's timezone offset; this is set using fetch_offset()
* @var integer
* @access private
*/
var $servertz = 0;
-
+
/**
* Total offset timezone; this is set using fetch_offset()
* @var integer
* @access private
*/
var $offsettz = 0;
-
+
/**
* Offset in seconds; this is set using fetch_offset()
* @var integer
* @access private
*/
var $offset = 0;
-
+
// ###################################################################
/**
* Constructor: sets the server's timezone
function __construct(&$registry)
{
$this->registry =& $registry;
-
+
$this->servertz = date('Z', TIMENOW) / 3600;
}
-
+
// ###################################################################
/**
* (PHP 4) Constructor
{
$this->__construct($registry);
}
-
+
// ###################################################################
/**
* Sets the user timezone variable
{
$this->usertz = $tz;
}
-
+
// ###################################################################
/**
* Gets the user timezone variable
{
return $this->usertz;
}
-
+
// ###################################################################
/**
* Computes the total offset, taking into account all the various
$this->offsettz = $this->servertz - $this->usertz;
$this->offset = $this->offsettz * 3600;
}
-
+
// ###################################################################
/**
* Formats a UNIX timestamp to a certain date format in the proper time
{
$timestamp -= $this->offset;
}
-
+
return date($format, $timestamp);
}
-
+
// ###################################################################
/**
* Fetches an array of timezones for a <select> list
function fetch_timezone_list()
{
$opt = array();
-
+
$opt['-12'] = T('(GMT - 12:00) Enitwetok, Kwajalien');
$opt['-11'] = T('(GMT - 11:00) Midway Island, Samoa');
$opt['-10'] = T('(GMT - 10:00) Hawaii');
$opt['10'] = T('(GMT + 10:00) Guam, Papua New Guinea, Sydney');
$opt['11'] = T('(GMT + 11:00) Magadan, New Caledonia, Solomon Islands');
$opt['12'] = T('(GMT + 12:00) Auckland, Wellington, Fiji');
-
+
return $opt;
}
}
// ###################################################################
$data = '<tr valign="middle">
- <td class="alt1">
+ <td class="alt1">
<span style="float: right; display: inline" class="smallfont">
1 <if condition="$show[\'edit\']">
2 <if condition="$show[\'receive\']">
/3 </if>
/1 </if>
</span>
-
+
<if condition="$iteminfo[\'url\']"><a href="$iteminfo[url]" target="_blank">$iteminfo[name]</a><else />$iteminfo[name]</if>
</td>
<td class="alt2">$iteminfo[price]</td>
* @access private
*/
var $registry = null;
-
+
/**
* The path that is used to set cookies
* @var string
* @access private
*/
var $cookiepath = '/';
-
+
/**
* The domain used for cookie setting
* @var string
* @access private
*/
var $cookiedom = '';
-
+
/**
* The time it takes for a cookie to expire
* @var integer
* @access private
*/
var $cookieexp = 900;
-
+
/**
* State of the current background colour during alternation
* @var string
* @access public
*/
var $bgcolour = '';
-
+
// ###################################################################
/**
* Constructor
{
$this->registry =& $registry;
}
-
+
// ###################################################################
/**
* (PHP 4) Constructor
{
$this->__construct($registry);
}
-
+
// ###################################################################
/**
* Sets the cookie path
{
$this->cookiepath = $path;
}
-
+
// ###################################################################
/**
* Gets the cookie path
{
return $this->cookiepath;
}
-
+
// ###################################################################
/**
* Sets the cookie domain
{
$this->cookiedom = $domain;
}
-
+
// ###################################################################
/**
* Gets the cookie domain
{
return $this->cookiedom;
}
-
+
// ###################################################################
/**
* Sets the cookie expiration time
{
$this->cookieexp = $exp;
}
-
+
// ###################################################################
/**
* Gets the cookie expiration time
{
return $this->cookieexp;
}
-
+
// ###################################################################
/**
* Sets a cookie with a friendly interface
{
$expire = time() + $this->cookieexp;
}
-
+
setcookie($name, $value, $expire, $this->cookiepath, $this->cookiedom);
}
}
-
+
// ###################################################################
/**
* Alternate between two background colours
function exec_swap_bg($class1 = 'alt1', $class2 = 'alt2')
{
static $count;
-
+
$this->bgcolour = ($count % 2) ? $class1 : $class2;
$count++;
}
-
+
// ###################################################################
/**
* Force-download a file by sending application/octetstream
{
$mime = 'application/octet-stream';
}
-
+
header("Content-Type: $mime");
header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Content-Disposition: attachment; filename="' . $name . '"');
header('Content-length: ' . strlen($file));
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
-
+
print($file);
-
+
if ($exit)
{
exit;
}
}
-
+
// ###################################################################
/**
* Verify that an email address is valid via regex
return false;
}
}
-
+
// ###################################################################
/**
* Check a browser's user agent against a pre-determined list
$useragent = strtolower($_SERVER['HTTP_USER_AGENT']);
$browser = array();
$matches = array();
-
+
// -------------------------------------------------------------------
// -- Opera
// -------------------------------------------------------------------
$browser['opera'] = $matches[1];
}
}
-
+
// -------------------------------------------------------------------
// -- Mac browser
// -------------------------------------------------------------------
{
$browser['mac'] = true;
}
-
+
// -------------------------------------------------------------------
// -- Internet explorer
// -------------------------------------------------------------------
$browser['ie'] = $matches[1];
}
}
-
+
// -------------------------------------------------------------------
// -- Safari
// -------------------------------------------------------------------
$browser['safari'] = $matches[1];
}
}
-
+
// -------------------------------------------------------------------
// -- Konqueror
// -------------------------------------------------------------------
$browser['konqueror'] = $matches[1];
}
}
-
+
// -------------------------------------------------------------------
// -- Mozilla
// -------------------------------------------------------------------
{
$browser['mozilla'] = $matches[1];
}
-
+
// -------------------------------------------------------------------
// -- Firefox
// -------------------------------------------------------------------
$browser['firefox'] = $matches[3];
}
}
-
+
// -------------------------------------------------------------------
// -- Netscape
// -------------------------------------------------------------------
$browser['netscape'] = $matches[2];
}
}
-
+
// -------------------------------------------------------------------
// -- Camino
// -------------------------------------------------------------------
}
}
}
-
+
if (isset($browser["$check"]))
{
if ($version)
return false;
}
}
-
+
// ###################################################################
/**
* Generates a random string of random length (unless otherwise
// Gimme a length!
$length = rand(20, 65);
}
-
+
// Number of ints in our salt
$intcount = rand(1, intval($length / 2));
-
+
// Number of chars
$charcount = $length - $intcount;
-
+
// Upper-case chars
$upperchars = rand(1, intval($charcount / 2));
-
+
// Lower-case chars
$lowerchars = $charcount - $upperchars;
-
+
// Generate ints
for ($i = 0; $i < $intcount; $i++)
{
$string[ mt_rand() ] = rand(0, 9);
}
-
+
// Generate upper chars
for ($i = 0; $i < $upperchars; $i++)
{
$string[ mt_rand() ] = chr(rand(65, 90));
}
-
+
// Generate lower chars
for ($i = 0; $i < $lowerchars; $i++)
{
$string[ mt_rand() ] = chr(rand(97, 122));
}
-
+
// Sort the chars by thier random assignment
ksort($string);
-
+
// Flatten the array
$return = '';
foreach ($string AS $char)
{
$return .= $char;
}
-
+
return $return;
}
-
+
// ###################################################################
/**
* Sets the current array position to be the specified key. This
}
return current($array);
}
-
+
// ###################################################################
/**
* Calculates the microtime difference by taking a given microtime and
list ($endtime['micro'], $endtime['sec']) = explode(' ', $mtend);
return ($endtime['micro'] + $endtime['sec']) - ($starttime['micro'] + $starttime['sec']);
}
-
+
// ###################################################################
/**
* Fetches the extension of a file by extracting everything after the
{
return strval(end(explode('.', $filename)));
}
-
+
// ###################################################################
/**
* Gets the maximum file size for attachment uploading, as specified by
return 10 * 1048576;
}
}
-
+
// ###################################################################
/**
* Scans a specified directory path and returns an array of all the
function scandir($path, $recurse = true, $ignoredot = true, $ignorecvs = true, $basepath = '', $unset = 1)
{
static $filelist;
-
+
if ($unset)
{
$filelist = array();
}
-
+
if (substr($path, (strlen($path) - 1), 1) != '/')
{
$path .= '/';
}
-
+
if ($handle = opendir($path))
{
while (($file = readdir($handle)) !== false)
}
return $filelist;
}
-
+
// ###################################################################
/**
* Changes line breaks into one format
$text = str_replace("\n", $convert_to, $text);
return $text;
}
-
+
// ###################################################################
/**
* Removes all empty() [by PHP's standards] elements in an array. This
* @copyright Copyright (c)2002 - [#]year[#], Blue Static
* @version $Revision$
* @package ISSO
-*
+*
*/
class Graph_Pie
{
* @access private
*/
var $registry = null;
-
+
/**
* Graphing data set; 2D array of
* array(NAME, PERCENT, COLOR)
* @access private
*/
var $dataset = array();
-
+
/**
* Image resource
* @var resource
* @access private
*/
var $image = null;
-
+
/**
* The dimensions of the image
* @var array
* @access private
*/
var $dimensions = array('width' => 550, 'height' => 350);
-
+
/**
* Add a legend to the graph
* @var bool
* @access private
*/
var $legend = true;
-
+
/**
* Title of the graph
* @var string
* @access private
*/
var $title = 'ISSO Pie Chart';
-
+
// ###################################################################
/**
* Constructor
function __construct(&$registry)
{
$this->registry =& $registry;
-
+
$this->set_scale(0);
}
-
+
// ###################################################################
/**
* (PHP 4) Constructor
{
$this->__construct($registry);
}
-
+
// ###################################################################
/**
* Graphs the actual graph and returns a byte stream
$colours['black'] = imagecolorallocate($this->image, 0, 0, 0);
$colours['white'] = imagecolorallocate($this->image, 255, 255, 255);
$colours['grey'] = imagecolorallocate($this->image, 121, 121, 123);
-
+
$graphpadding = 10;
$graphspacing = 4;
$diameter = $this->dimensions['height'] - (5 * $graphpadding);
$radius = $diameter / 2;
$graphstart = $graphpadding + imagefontheight(5) + $graphpadding;
$legendbox = 10;
-
+
// fill background
imagefill($this->image, 0, 0, $colours['white']);
-
+
// title the chart
imagestring($this->image, 5, ($this->dimensions['width'] - (imagefontwidth(5) * strlen($this->title))) / 2, $graphpadding, $this->title, $colours['black']);
-
+
$center = array(
'x' => ($this->legend ? ($radius + $graphpadding) : ($this->dimensions['width'] / 2)),
'y' => ($this->dimensions['height'] / 2) + $graphpadding
);
-
+
// draw a border
imageline($this->image, 0, 0, 0, $this->dimensions['height'], $colours['black']); // left
imageline($this->image, 0, $this->dimensions['height'] - 1, $this->dimensions['width'], $this->dimensions['height'] - 1, $colours['black']); // bottom
imageline($this->image, $this->dimensions['width'] - 1, 0, $this->dimensions['width'] - 1, $this->dimensions['height'], $colours['black']); // right
imageline($this->image, 0, 0, $this->dimensions['width'], 0, $colours['black']); // top
-
+
$legx = (2 * $graphpadding) + $diameter;
-
+
$lastdeg = 0;
$boxoffset = 0;
foreach ($this->dataset AS $plot)
imagefilledarc($this->image, $center['x'], $center['y'], $diameter, $diameter, $lastdeg, $deg + $lastdeg, $plot[2], IMG_ARC_PIE);
imagefilledarc($this->image, $center['x'], $center['y'], $diameter, $diameter, $lastdeg, $deg + $lastdeg, $colours['grey'], IMG_ARC_EDGED | IMG_ARC_NOFILL);
$lastdeg += $deg;
-
+
if ($this->legend)
{
$box = array(
$legx + 1 + $graphspacing + $legendbox, $graphstart + 1 + $graphspacing + $boxoffset // top right
);
imagefilledpolygon($this->image, $box, 4, $plot[2]);
-
+
imagestring($this->image, 2, ($legx + 1 + $graphspacing + $legendbox + $graphspacing), ($graphstart + $graphspacing + $boxoffset), $plot[0] . " ($plot[1]%)", $colours['black']);
-
+
$boxoffset += $graphspacing + $legendbox;
}
}
-
+
// draw the ellipse (do here so it cleans up the arc edges)
imageellipse($this->image, $center['x'], $center['y'], $diameter, $diameter, $colours['grey']);
-
+
// do the legend
if ($this->legend)
{
imageline($this->image, $legx, $legy, $this->dimensions['width'] - $graphpadding, $legy, $colours['black']); // bottom
imageline($this->image, $this->dimensions['width'] - $graphpadding, $graphstart, $this->dimensions['width'] - $graphpadding, $legy, $colours['black']); // right
}
-
+
ob_start();
imagepng($this->image);
$data = ob_get_contents();
}
ob_clean();
ob_end_clean();
-
+
return $data;
}
-
+
// ###################################################################
/**
* Sets the width and height by using scale factors of 550x350; you
{
$this->dimensions['width'] = 550;
$this->dimensions['height'] = 350;
-
+
if ($scale > 0)
{
$this->dimensions['width'] *= $scale;
$this->dimensions['width'] /= $scale;
$this->dimensions['height'] /= $scale;
}
-
+
if (!is_null($this->image))
{
imagedestroy($this->image);
}
-
+
$this->image = imagecreate($this->dimensions['width'], $this->dimensions['height']);
}
-
+
// ###################################################################
/**
* Sets whether or not a legend is created for the graph
{
$this->legend = (bool)$yesno;
}
-
+
// ###################################################################
/**
* Sets the title of the chart to be drawn above the graph
{
$this->title = $title;
}
-
+
// ###################################################################
/**
* Adds an entry to the data set without specifying a colour to add.
{
$this->dataset[] = array($name, intval($percent), $this->fetch_colour());
}
-
+
// ###################################################################
/**
* Adds an entry ot the data set with specifying a colour. This works
{
$this->dataset[] = array($name, intval($percent), imagecolorallocate($this->image, $colour[0], $colour[1], $colour[2]));
}
-
+
// ###################################################################
/**
* Fetches a colour from the allocated colour list and returns the value
array(45, 130, 195)
);
static $allocated = 0;
-
+
$colour = $colourlist["$allocated"];
$allocated++;
-
+
return imagecolorallocate($this->image, $colour[0], $colour[1], $colour[2]);
}
}
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title><?php echo $GLOBALS['isso:callback']->getApplication(); ?> Installer</title>
-
+
<style type="text/css">
<!--
-<?php echo $css; ?>
+<?php echo $css; ?>
//-->
</style>
</head>
/**
* Creates the end of the page and the "Next" button. The "Next" button
* reqires that STOP_MARK be defined to be the total number of steps,
-* ACTIVE_SITE to be the page to link to for the next button, and
+* ACTIVE_SITE to be the page to link to for the next button, and
* STOP_LINK to be an <a> for when all the steps have been reached.
*
* @access public
echo '<div class="buttonlink"><a href="' . ACTIVE_SITE . '?mark=' . ($GLOBALS['isso:callback']->in['mark'] + 1) . '">Next Step</a></div>';
}
}
-
+
echo '
</body>
</html>';
-
+
exit;
}
* @copyright Copyright (c)2002 - [#]year[#], Blue Static
* @version $Revision$
* @package ISSO
-*
+*
*/
class ISSO
{
* @access private
*/
var $sourcepath = '';
-
+
/**
* Path of the current application
* @var string
* @access private
*/
var $apppath = '';
-
+
/**
* Web path used to get the web location of the installation of ISSO; only used for Printer module
* @var string
* @access private
*/
var $webpath = '';
-
+
/**
* Name of the current application
* @var string
* @access private
*/
var $application = '';
-
+
/**
* Version of the current application
* @var string
* @access private
*/
var $appversion = '';
-
+
/**
* Whether debug mode is on or off
* @var bool
* @access private
*/
var $debug = false;
-
+
/**
* List of all active debug messages
* @var array
* @access private
*/
var $debuginfo = array();
-
+
/**
* List of loaded modules
* @var array
* @access private
*/
var $modules = array();
-
+
/**
* An array of sanitized variables that have been cleaned for HTML tag openers and double quotes
* @var array
* @access public
*/
var $in = array();
-
+
/**
* If we are running with magic_quotes_gpc on or off
* @var int
* @access private
*/
var $magicquotes = 0;
-
+
// ###################################################################
/**
* Constructor
function __construct()
{
$GLOBALS['isso:callback'] = null;
-
+
// error reporting
set_error_handler(array(&$this, '_error_handler'));
-
+
// magic quotes
$this->magicquotes = get_magic_quotes_gpc();
set_magic_quotes_runtime(0);
-
+
// some debug info that's always useful
$this->debug('magic_quotes_gpc = ' . $this->magicquotes);
$this->debug('register_globals = ' . ini_get('register_globals'));
-
+
// attempt to set the sourcepath
$path = call_user_func('debug_backtrace');
$this->setSourcePath(str_replace('kernel.php', '', $path[0]['file']));
-
+
// start input sanitize using variable_order GPC
if (!defined('ISSO_NO_INPUT_SANITIZE'))
{
$this->exec_sanitize_data();
}
-
+
if (defined('ISSO_CHECK_POST_REFERER'))
{
$this->exec_referer_check();
}
}
-
+
// ###################################################################
/**
* (PHP 4) Constructor
{
$this->__construct();
}
-
+
// ###################################################################
/**
* Sets the sourcepath
{
$this->sourcepath = $this->fetch_sourcepath($path);
}
-
+
// ###################################################################
/**
* Gets the sourcepath
{
return $this->sourcepath;
}
-
+
// ###################################################################
/**
* Sets the apppath
{
$this->apppath = $this->fetch_sourcepath($path);
}
-
+
// ###################################################################
/**
* Gets the apppath
{
return $this->apppath;
}
-
+
// ###################################################################
/**
* Sets the webpath
{
$this->webpath = $this->fetch_sourcepath($path);
}
-
+
// ###################################################################
/**
* Gets the webpath
{
return $this->webpath;
}
-
+
// ###################################################################
/**
* Sets the applicaiton
{
$this->application = $app;
}
-
+
// ###################################################################
/**
* Gets the application
{
return $this->application;
}
-
+
// ###################################################################
/**
* Sets the appverison
{
$this->appversion = $version;
}
-
+
// ###################################################################
/**
* Gets the appversion
{
return $this->appversion;
}
-
+
// ###################################################################
/**
* Sets debug mode
{
$this->debug = $debug;
}
-
+
// ###################################################################
/**
* Gets debug mode state
{
return $this->debug;
}
-
+
// ###################################################################
/**
* Prepares a path for being set as the sourcepath
}
return $source;
}
-
+
// ###################################################################
/**
* Loads a framework module
$GLOBALS['isso:callback'] =& $this;
$this->modules['isso'] =& $this;
}
-
+
if ($this->is_loaded($framework))
{
return $this->modules["$framework"];
}
-
+
if ($this->sourcepath == '')
{
trigger_error('Invalid sourcepath specified', E_USER_ERROR);
}
-
+
if (file_exists($this->sourcepath . $framework . '.php'))
{
require_once($this->sourcepath . $framework . '.php');
{
trigger_error('Could not find the framework ' . $this->sourcepath . $framework . '.php', E_USER_ERROR);
}
-
+
if ($asobject === null)
{
return;
}
-
+
if (isset($this->$asobject))
{
trigger_error('Cannot instantiate framework `' . $framework . '` into `' . $asobject . '`', E_USER_ERROR);
}
-
+
$this->$asobject = new $framework($this);
-
+
$this->modules["$framework"] =& $this->$asobject;
-
+
if ($globalize)
{
$GLOBALS["$asobject"] =& $this->$asobject;
}
-
+
// allow for init_as_package to link
if (method_exists($this->modules["$framework"], 'init_as_package'))
{
$this->modules[ $this->modules["$framework"]->init_as_package() ] =& $this->modules["$framework"];
}
-
+
return $this->$asobject;
}
-
+
// ###################################################################
/**
* Prints a list of all currently loaded framework modules
{
$module = $object->init_as_package() . " - ($module)";
}
-
+
$modules[] = $module;
}
$this->message('Loaded Modules', $output, 1);
}
}
-
+
// ###################################################################
/**
* Verifies to see if a framework has been loaded
return false;
}
}
-
+
// ###################################################################
/**
* Prints an ISSO message
$color = '#669900';
$font = '#000000';
break;
-
+
// Warning
case 2:
$prefix = 'Warning';
$color = '#003399';
$font = '#FFFFFF';
break;
-
+
case 3:
$prefix = 'Error';
$color = '#990000';
$font = '#EFEFEF';
break;
}
-
+
$backtrace = debug_backtrace();
array_shift($backtrace);
-
+
if (isset($backtrace[0]) AND $backtrace[0]['function'] == '_error_handler')
{
array_shift($backtrace);
}
-
+
$trace = $this->format_debug_trace($backtrace);
-
+
$output = "\n<br />\n<table cellpadding=\"4\" cellspacing=\"1\" border=\"0\" width=\"$width\" style=\"background-color: $color; color: black; font-family: Verdana, sans-serif; font-size: 12px;\">";
$output .= "\n<tr style=\"color: $font; text-align: left\">\n\t<td><strong>$prefix: $title</strong></td>\n</tr>";
$output .= "\n<tr style=\"background-color: #FFFFFF; text-align: left\">\n\t<td>$message</td>\n</tr>";
$output .= (($stack AND $GLOBALS['isso:callback']->debug) ? "\n<tr style=\"background-color: #FFFFFF; text-align: left\">\n\t<td><strong>Debug Stack:</strong> <pre>" . implode("\n", $trace) . "</pre></td>\n</tr>" : '');
$output .= "\n</table>\n<br />\n";
-
+
if ($return)
{
return $output;
print($output);
}
}
-
+
// ###################################################################
/**
* Prepares a debug_backtrace() array for output to the browser by
$args = '';
$file = $step['file'] . ':' . $step['line'];
$funct = (isset($step['class']) ? $step['class'] . '::' . $step['function'] : $step['function']);
-
+
if (isset($step['args']) AND is_array($step['args']))
{
// we need to do this so we don't get "Array to string conversion" notices
}
$args = implode(', ', $step['args']);
}
-
- $trace[] = "#$i $funct($args) called at [$file]";
+
+ $trace[] = "#$i $funct($args) called at [$file]";
}
-
+
return $trace;
}
-
+
// ###################################################################
/**
* Custom error handler for ISSO; only handle E_WARNING, E_NOTICE,
function _error_handler($errno, $errstr, $errfile, $errline, $errcontext)
{
$level = ini_get('error_reporting');
-
+
switch ($errno)
{
// Fatal
return;
}
break;
-
+
// Error
case E_USER_WARNING:
case E_WARNING:
return;
}
break;
-
+
// Warning
case E_USER_NOTICE:
case E_NOTICE:
}
break;
}
-
+
$errstr .= " in <strong>$errfile</strong> on line <strong>$errline</strong>";
$errstr = str_replace(array(getcwd(), dirname(getcwd())), '', $errstr);
-
+
$this->message($title, $errstr, $mode);
-
+
if ($errno == E_USER_ERROR)
{
exit;
}
}
-
+
// ###################################################################
/**
* Creates a table that explains the error reporting levels and their
'E_ALL' => E_ALL,
'E_STRICT' => 2048
);
-
+
$table = '<table cellspacing="0" cellpadding="2" border="0">';
-
+
foreach ($levels AS $name => $value)
{
$table .= '
<td>' . (ini_get('error_reporting') & $value) . '</td>
</tr>';
}
-
+
$table .= '
</table>';
-
+
$this->message('Error Reporting', $table, 1);
}
-
+
// ###################################################################
/**
* Logs a debug message for verbose output
{
$this->debuginfo[] = $message;
}
-
+
// ###################################################################
/**
* Recursive XSS cleaner
}
return $data;
}
-
+
// ###################################################################
/**
* Simple way to protect against HTML attacks with Unicode support
return str_replace(array('<', '>', '"'), array('<', '>', '"'), $text);
}
}
-
+
// ###################################################################
/**
* Unicode-safe entity encoding system; similar to sanitize()
$text = $this->sanitize($text);
return $text;
}
-
+
// ###################################################################
/**
* Takes text that has been processed for HTML and unsanitizes it
{
return str_replace(array('<', '>', '"'), array('<', '>', '"'), $text);
}
-
+
// ###################################################################
/**
* Smart addslashes() that only applies itself it the Magic Quotes GPC
return addslashes($str);
}
}
-
+
// ###################################################################
/**
* Runs through all of the input data and sanitizes it.
{
$this->in = $this->_sanitize_input_recursive(array_merge($_GET, $_POST, $_COOKIE));
}
-
+
// ###################################################################
/**
* Sanitize function for something other than a string (which
$this->input_clean($varname, $type);
}
}
-
+
// ###################################################################
/**
* Sanitize function that does a single variable as oppoesd to an array
{
$this->in["$varname"] = $this->clean(null, $type);
}
-
+
return $this->in["$varname"];
}
-
+
// ###################################################################
/**
* Runs ISSO->escape() on a variable on ISSO->in[]. This is just a
return $this->escape(null);
}
}
-
+
// ###################################################################
/**
* Cleaning function that does the work for input_clean(); this is
{
return $this->clean_array($value, $type);
}
-
+
if ($type == TYPE_INT)
{
$value = intval($value);
{
trigger_error('Invalid clean type `' . $type . '` specified', E_USER_ERROR);
}
-
+
return $value;
}
-
+
// ###################################################################
/**
* Recursion function for ISSO->clean()
{
$array["$key"] = $this->clean($value, $type);
}
-
+
return $array;
}
-
+
// ###################################################################
/**
* Checks to see if a POST refer is actually from us
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
$host = ($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_ENV['HTTP_HOST'];
-
+
if ($host AND $_SERVER['HTTP_REFERER'])
{
$parts = parse_url($_SERVER['HTTP_REFERER']);
$ourhost = $parts['host'] . (isset($parts['port']) ? ":$parts[port]" : '');
-
+
if ($ourhost != $host)
{
trigger_error('No external hosts are allowed to POST to this application', E_USER_ERROR);
}
}
}
-
+
// ###################################################################
/**
* Constructs a debug information box that contains various debugging
function construct_debug_block($dotemplates)
{
$debug = '';
-
+
if ($this->debug)
{
$debug = "\n<ul>";
-
+
// templates
if ($dotemplates)
{
}
$usage[] = $name . " ($count)";
}
-
+
$sizeof = sizeof($this->modules['template']->uncached);
if ($sizeof > 0)
{
$debug .= "\n\t<li><strong style=\"color: red\">Uncached Template(s):</strong> $sizeof ( " . implode(' ', $optlist) . " )</li>";
}
}
-
+
// source control
$scinfo = 'Not Under Source Control';
if (defined('SVN'))
{
$scinfo = constant('SVN');
-
+
if (preg_match('#\$Id:?\s*\$#', $scinfo))
{
$scinfo = 'Not Under Source Control';
$scinfo = preg_replace('#\$' . 'Id: (.+?) ([0-9].+?) [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}(.+?) (.+?) \$#', '\\1 - SVN \\2', $scinfo);
}
}
-
- $scinfo = trim($scinfo);
+
+ $scinfo = trim($scinfo);
$debug .= "\n\t<li><strong>Source Control:</strong> $scinfo</li>";
-
+
// query information
if (is_object($this->modules[ISSO_DB_LAYER]))
{
$debug .= "\n\t<li><strong>Total Queries:</strong> " . sizeof($this->modules[ISSO_DB_LAYER]->history) . " (<a href=\"" . $this->sanitize($_SERVER['REQUEST_URI']) . ((strpos($_SERVER['REQUEST_URI'], '?') !== false) ? '&query=1' : '?query=1') . "\">?</a>)</li>";
-
+
$queries = $this->modules[ISSO_DB_LAYER]->history;
$querydebug = "<br />\n" . '<table cellpadding="4" cellspacing="1" border="0" align="center" width="30%" style="background-color: rgb(60, 60, 60); color: white">' . "\n\t" . '<tr><td><strong>Query Debug</strong></td></tr>';
foreach ($queries AS $query)
$querydebug .= "\n\t\t<td>";
$querydebug .= "\n\t\t\t$query[query]\n\n\t\t\t<div style=\"font-size: 9px;\">($query[time])</div>\n<!--\n" . implode("\n", $query[trace]) . "\n-->\n\t\t</td>\n\t</tr>";
}
-
+
$querydebug .= "\n</table>\n\n\n";
}
-
+
// total execution time
if (defined('ISSO_MT_START'))
{
$this->load('functions', 'functions');
$debug .= "\n\t<li><strong>Total Execution Time:</strong> " . round($this->modules['functions']->fetch_microtime_diff(ISSO_MT_START), 10) . "</li>";
}
-
+
// debug notices
$debug .= "\n\t<li>\n\t\t<select>\n\t\t\t<option>Debug Notices (" . sizeof($this->debuginfo) . ")</option>";
foreach ((array)$this->debuginfo AS $msg)
$debug .= "\n\t\t\t<option>--- $msg</option>";
}
$debug .= "\n\t\t</select>\n\t</li>";
-
+
// loaded modules
$modules = $this->show_modules(true);
$debug .= "\n\t<li>\n\t\t<select>\n\t\t\t<option>Loaded Modules (" . sizeof($modules) . ")</option>";
$debug .= "\n\t\t\t<option>--- $mod</option>";
}
$debug .= "\n\t\t</select>\n\t</li>";
-
+
// template usage
if ($dotemplates)
{
}
$debug .= "\n\t\t</select>\n\t</li>";
}
-
+
$debug .= "\n</ul>";
-
+
$debug = "\n\n<!-- dev debug -->\n<div align=\"center\">\n\n<hr />\n" . $this->message('Debug Information', $debug, 1, true, false) . "\n</div>$querydebug\n<!-- / dev debug -->\n\n";
}
-
+
return $debug;
}
}
* @copyright Copyright (c)2002 - [#]year[#], Blue Static
* @version $Revision$
* @package ISSO
-*
+*
*/
class Mail
{
* @access private
*/
var $registry = null;
-
+
/**
* The subject of the message
* @var string
* @access private
*/
var $subject = '';
-
+
/**
* Body plain-text of the message
* @var string
* @access private
*/
var $bodytext = '';
-
+
/**
* HTML multi-part body of the message
* @var string
* @access private
*/
var $bodyhtml = '';
-
+
/**
* The message sender's email address
* @var string
* @access private
*/
var $from = '';
-
+
/**
* The message sender's display name
* @var string
* @access private
*/
var $fromname = '';
-
+
/**
* Additional message headers
* @var string
* @access private
*/
var $headers = '';
-
+
/**
* Whether to send the message as HTML or plain-text
* @var bool
* @access private
*/
var $sendhtml = false;
-
+
/**
* The new line delimiter used in the message
* @var string
* @access private
*/
var $delim = "\n";
-
+
/**
* Character set used to send messages with
* @var string
* @access public
*/
var $charset = 'utf-8'; // should we be using iso-8859-1 ?
-
+
// ###################################################################
/**
* Constructor
{
$this->registry =& $registry;
}
-
+
// ###################################################################
/**
* (PHP 4) Constructor
{
$this->__construct($registry);
}
-
+
// ###################################################################
/**
* Sets the subject
{
$this->subject = $subject;
}
-
+
// ###################################################################
/**
* Sets the body text (required)
{
$this->bodytext = $body;
}
-
+
// ###################################################################
/**
* Sets the HTML body (optional)
{
$this->bodyhtml = $body;
}
-
+
// ###################################################################
/**
* Sets the from address
{
$this->from = $address;
}
-
+
// ###################################################################
/**
* Sets the from display name
{
$this->fromname = $name;
}
-
+
// ###################################################################
/**
* Sets any additional headers
{
$this->headers = $headers;
}
-
+
// ###################################################################
/**
* Sets the character set to send the email in
{
$this->charset = $charset;
}
-
+
// ###################################################################
/**
* Sends an email to the specified address with the specified
trigger_error('You need to specify an email address', E_USER_ERROR);
return false;
}
-
+
// make sure we have a mailer
// TODO - add support for SMTP
if (!@ini_get('sendmail_path'))
$this->registry->debug("email: no sendmail -> not sending");
return false;
}
-
+
// sort out the to addresses
$address = $this->_fetch_first_line($address);
$address = trim($this->registry->unsanitize($address));
$name = trim($this->registry->unsanitize($name));
$name = $this->_encodeHeaderValue($name);
$tostring = ($name == null ? $address : "\"$name\" <$address>");
-
+
// sanitize the from field
$from = $this->_fetch_first_line($this->from);
$from = trim($this->registry->unsanitize($from));
-
+
// sanitize the from name
$fromname = $this->_fetch_first_line($this->fromname);
$fromname = ($fromname == '' ? $from : trim($this->registry->unsanitize($fromname)));
$fromname = $this->_encodeHeaderValue($this->fromname);
-
+
// sanitize the subject
$subject = $this->_fetch_first_line($this->subject);
$subject = trim($this->registry->unsanitize($subject));
$subject = $this->_encodeHeaderValue($subject);
-
+
// sanitize the body
$bodytext = $this->registry->modules['functions']->convert_line_breaks($this->bodytext, $this->delim);
$bodytext = trim($this->registry->unsanitize($bodytext, true));
-
+
// attach additional headers
$headers = $this->registry->modules['functions']->convert_line_breaks($this->headers, $this->delim);
$headers .= ((!preg_match("#{$this->delim}$#", $headers) AND $headers != '') ? "\n" : '') . "From: \"{$fromname}\" <{$from}>" . $this->delim;
$headers .= "Return-Path: {$from}" . $this->delim;
$headers .= "X-Mailer: ISSO Mail Framework \$Revision$" . $this->delim;
$headers .= "MIME-Version: 1.0" . $this->delim;
-
+
// see if we need to use mime/multipart
if ($sendhtml AND !empty($bodyhtml) == true)
{
$boundary = 'ISSO-MULTIPART-' . $this->registry->modules['functions']->rand(10);
$headers .= "Content-Type: multipart/alternative; boundary=\"$boundary\"" . $this->delim;
-
+
$bodyhtml = $this->registry->modules['functions']->convert_line_breaks($this->bodyhtml, $this->delim);
-
+
// first part of the message (plaintext)
$body = "--$boundary" . $this->delim;
$body .= "Content-Type: text/plain; charset=\"" . $this->charset . "\"" . $this->delim;
$body .= "Content-Transfer-Encoding: 8bit" . $this->delim . $this->delim;
$body .= $bodytext . $this->delim;
-
+
// add some space between the parts
$body .= $this->delim . $this->delim . $this->delim;
-
+
// second part (html)
$body .= "--$boundary" . $this->delim;
$body .= "Content-Type: text/html; charset=\"" . $this->charset . "\"" . $this->delim;
$body = $bodytext;
}
$headers .= "Content-Transfer-Encoding: 8bit" . $this->delim;
-
+
$headers = trim($headers);
-
+
// attempt to send the mail!
if (mail($tostring, $subject, $body, $headers, "-f {$from}"))
{
$this->registry->debug("email: error sending to $address");
}
}
-
+
// ###################################################################
/**
* Fetches the first line of a string
$broken = explode("\n", $string);
return $broken[0];
}
-
+
// ###################################################################
/**
* Encodes a header value (to name, fron name, subject, etc.) according
{
return $text;
}
-
+
// perform this on non-ASCII characters; excluding _ and = because we want them to be encoded as they have
// different meanings in mail messages
$text = preg_replace('#([^a-zA-Z0-9\+\-\*!/])#e', '"=" . strtoupper(dechex(ord("\\1")))', $text);
$text = str_replace('=20', '_' , $text);
-
+
return '=?' . $this->charset . '?q?' . $text . '?=';
}
}
* @copyright Copyright (c)2002 - [#]year[#], Blue Static
* @version $Revision$
* @package ISSO
-*
+*
*/
class Pagination
{
* @access private
*/
var $page;
-
+
/**
* Per-page value
* @var integer
* @access private
*/
var $perpage;
-
+
/**
* Number of page links
* @var integer
* @access private
*/
var $pagelinks;
-
+
/**
* Total number of results
* @var integer
* @access private
*/
var $total;
-
+
/**
* Total number of pages
* @var integer
* @access private
*/
var $pagecount;
-
+
/**
* Name of page variable
* @var array
* @access private
*/
var $pagevar;
-
+
/**
* Name of per-page variable
* @var integer
* @access private
*/
var $perpagevar;
-
+
/**
* Maximum number of per-page results
* @var integer
* @access private
*/
var $maxperpage = 100;
-
+
/**
* Default number of per-page results
* @var integer
* @access private
*/
var $defaultperpage = 20;
-
+
/**
* The processing callback function for individual pagenav bits
* @var string
* @access private
*/
var $bitprocessor = ':undefined:';
-
+
/**
* The processing callback function for the entire pagenav system
* @var string
* @access private
*/
var $pagenavprocessor = ':undefined:';
-
+
// ###################################################################
/**
* Constructor
{
$this->registry =& $registry;
}
-
+
// ###################################################################
/**
* (PHP 4) Constructor
{
$this->__construct($registry);
}
-
+
// ###################################################################
/**
* Callback function for the processing of an indivdual page. Needs
{
$this->bitprocessor = $callback;
}
-
+
// ###################################################################
/**
* Callback function for the processing the entire page navigator. Needs
{
$this->pagenavprocessor = $callback;
}
-
+
// ###################################################################
/**
* Returns the current page number
{
return $this->page;
}
-
+
// ###################################################################
/**
* Returns the current perpage value
{
return $this->perpage;
}
-
+
// ###################################################################
/**
* Sets total
{
$this->total = $total;
}
-
+
// ###################################################################
/**
* Returns the number of pages to be in the navigator
{
return $this->pagecount;
}
-
+
// ###################################################################
/**
* Sets pagelinks
{
$this->pagelinks = $pagelinks;
}
-
+
// ###################################################################
/**
* Sets pagevar
{
$this->pagevar = $pagevar;
}
-
+
// ###################################################################
/**
* Sets perpagevar
{
$this->perpagevar = $perpagevar;
}
-
+
// ###################################################################
/**
* Sets maxperpage
{
$this->maxperpage = $maxperpage;
}
-
+
// ###################################################################
/**
* Sets defaultperpage
{
$this->defaultperpage = $defaultperpage;
}
-
-
+
+
// ###################################################################
/**
* Takes all of the information from the set() functions and then
$this->perpage = $this->registry->clean($this->perpage, TYPE_INT);
}
-
+
// ###################################################################
/**
* Takes the variables and splits up the pages
$this->pagelinks = $this->pagecount;
}
}
-
+
// ###################################################################
/**
* Returns the lower limit of the pages
{
$page = $this->page;
}
-
+
$limit = $page * $this->perpage;
-
+
if ($page < 1)
{
$page = 1;
$page = $this->pagecount - 1;
$limit = $this->total;
}
-
+
if ($limit < 0)
{
return 0;
return $limit;
}
}
-
+
// ###################################################################
/**
* Constructs the page navigator
function constructPageNav($baselink)
{
global $bugsys;
-
+
// handle base link
if (strpos($baselink, '?') === false)
{
{
$baselink .= '&';
}
-
+
// first page number in page nav
$startpage = $this->page - $this->pagelinks;
if ($startpage < 1)
{
$startpage = 1;
}
-
+
// last page number in page nav
$endpage = $this->page + $this->pagelinks;
if ($endpage > $this->pagecount)
{
$endpage = $this->pagecount;
}
-
+
// prev page in page nav
$prevpage = $this->page - 1;
if ($prevpage < 1)
{
$prevpage = 1;
}
-
+
// next page in page nav
$nextpage = $this->page + 1;
if ($nextpage > $this->pagecount)
{
$nextpage = $this->pagecount;
}
-
+
// show the prev page
$show['prev'] = true;
if ($this->page == $startpage)
{
$show['prev'] = false;
}
-
+
// show the next page
$show['next'] = true;
if ($this->page == $endpage)
{
$show['next'] = false;
}
-
+
// show the first page
$show['first'] = false;
if ($startpage > 1)
{
$show['first'] = true;
}
-
+
// show the last page
$show['last'] = false;
if ($endpage < $this->pagecount)
{
$show['last'] = true;
}
-
+
// construct the page bits
$bits = '';
$call = $this->bitprocessor;
{
$nolink = false;
}
-
+
$bits .= $call($baselink, $nolink, $i, $this);
}
-
+
$call = $this->pagenavprocessor;
return $call($baselink, $nextpage, $prevpage, $show, $bits, $this);
}
body
{
color: rgb(96, 106, 90);
-
+
background-color: rgb(232, 255, 198);
-
+
padding: 15px;
}
.tcat
{
color: rgb(30, 35, 46);
-
+
background-color: rgb(109, 187, 45);
}
td.thead, .thead td, .alt3
{
color: rgb(45, 45, 45);
-
+
font-weight: bold;
font-size: 11px;
-
+
background-color: rgb(165, 165, 165);
}
.alt1
{
color: rgb(41, 63, 91);
-
+
background-color: rgb(237, 245, 230);
}
.alt2
{
color: rgb(41, 63, 91);
-
+
background-color: rgb(255, 255, 255);
}
.tfoot
{
color: rgb(55, 55, 55);
-
+
background-color: rgb(64, 64, 64);
}
{
font-family: tahoma, verdana, geneva, arial, helvetica, sans-serif;
font-size: 11px;
-
+
text-indent: 5px;
-
+
margin: 3px 1px 1px 1px;
}
.button
{
color: rgb(0, 0, 0);
-
+
font-family: tahoma, verdana, geneva, arial, helvetica, sans-serif;
font-size: 11px;
font-weight: bold;
-
+
margin: 3px 1px 1px 1px;
}
#toplinks
{
float: right;
-
+
font-size: 14px;
}
#contentbody
{
padding: 5px;
-
+
background-color: rgb(255, 255, 255);
-
+
border-color: rgb(124, 128, 135);
border-width: 1px;
border-style: solid;
-
+
color: rgb(55, 55, 55);
-
+
width: 100%;
}
#tabbar
{
height: 35px;
-
+
padding-left: 10px;
-
+
margin-top: 10px;
margin-bottom: -14px;
}
{
font-weight: bold;
color: rgb(122, 151, 101);
-
+
text-transform: uppercase;
text-decoration: none;
-
+
padding: 8px 0px 8px 0px;
margin: 0px;
-
+
background-image: url({$GLOBALS['isso:callback']->webpath}images/tabs.gif);
background-repeat: no-repeat;
background-position: 0% -35px;
{
height: 33px;
width: 100%;
-
+
padding: 8px 15px 8px 15px;
-
+
background-image: url({$GLOBALS['isso:callback']->webpath}images/tabs-ends.gif);
background-repeat: no-repeat;
background-position: 100% -35px;
#tabbar #focustab, #tabbar #focustab a:hover
{
color: rgb(64, 64, 64);
-
+
background-position: 0% 0px;
-
+
padding: 8px 0px 9px 0px;
}
#tabbar #focustab span
{
background-position: 100% 0px;
-
+
padding-bottom: 9px;
}
#tabbar a:hover
{
background-position: 0% -70px;
-
+
color: rgb(143, 236, 9);
}
#mainbody
{
width: 80%;
-
+
vertical-align: top;
-
+
padding: 5px 5px 5px 0px;
}
#menu
{
width: 20%;
-
+
padding: 15px;
-
+
vertical-align: top;
}
#menu ul
{
list-style: none;
-
+
padding: 0px;
margin: 0px;
}
#menu li span
{
display: block;
-
+
padding: 2px 2px 2px 7px;
margin-top: 1px;
-
+
background-color: rgb(208, 208, 208);
}
font-weight: bold;
text-transform: uppercase;
color: rgb(255, 255, 255);
-
+
padding: 3px;
-
+
background-color: rgb(96, 106, 90);
}
#menu li.focus span
{
background-color: rgb(182, 216, 154);
-
+
text-decoration: underline;
}
* @copyright Copyright (c)2002 - [#]year[#], Blue Static
* @version $Revision$
* @package ISSO
-*
+*
*/
class Printer
{
* @access private
*/
var $registry = null;
-
+
/**
* Realm that we are operating in (displayed in the <title>)
* @var string
* @access private
*/
var $realm = '[UNDEFINED REALM]';
-
+
/**
* CSS to place in the page
* @var string
* @access private
*/
var $css = '';
-
+
/**
* Extra code to place
* @var sring
* @access private
*/
var $code = '';
-
+
/**
* Page-start hooko
* @var string
* @access private
*/
var $page_start_hook = ':=NO METHOD=:';
-
+
/**
* Language information array: ('langcode' =>, 'direction' =>, 'charset' =>)
* @var array
* @access private
*/
var $language = array('langcode' => 'en_US', 'direction' => 'ltr', 'charset' => 'utf-8');
-
+
// ###################################################################
/**
* Constructor
{
$this->registry =& $registry;
}
-
+
// ###################################################################
/**
* (PHP 4) Constructor
{
$this->__construct($registry);
}
-
+
// ###################################################################
/**
* Sets the realm
{
$this->realm = $realm;
}
-
+
// ###################################################################
/**
* Gets the realm
{
return $this->realm;
}
-
+
// ###################################################################
/**
* Gets the language array information
* @return array Language array
*/
function getLanguageInformation()
- {
+ {
return $this->language;
}
-
+
// ###################################################################
/**
* Sets the language array information
* @param array Language array
*/
function setLanguageInformation($lang)
- {
+ {
$this->language = $lang;
}
-
+
// ###################################################################
/**
* Creates a redirect to another page; constructs the header and footer
function redirect($location, $message = null, $postvars = array())
{
$timeout = 10 * 200;
-
+
if ($postvars)
{
$js = <<<JS
<script type="text/javascript">
<!--
var timeout = $timeout;
-
+
if (timeout > 0)
{
setTimeout("redirect()", $timeout);
{
document.forms.postvars.submit();
}
-
+
//-->
</script>
JS;
<script type="text/javascript">
<!--
var timeout = $timeout;
-
+
if (timeout > 0)
{
setTimeout("redirect()", $timeout);
{
redirect();
}
-
+
function redirect()
{
window.location = "$location";
</script>
JS;
}
-
+
if (!defined('ISSO_PRINTER_NO_NAVIGATION'))
{
define('ISSO_PRINTER_NO_NAVIGATION', 1);
}
-
+
$this->page_start(T('Redirect'));
-
+
if ($postvars)
{
$this->form_start($location, null, false, 'postvars');
-
+
foreach ($postvars AS $key => $value)
{
$this->form_hidden_field($key, $value);
}
-
+
$this->form_end();
}
-
+
$redir = sprintf(T('Please wait to be redirected. If you are not redirected in a few seconds, click <a href="%1$s">here</a>.'), $location);
$override = false;
if ($message == null)
$showmessage .= "\n<p>" . $redir . "</p>";
$override = true;
}
-
+
$this->page_message(T('Redirect'), $showmessage, $override);
-
+
$this->page_code($js);
-
+
$this->page_end();
}
-
+
// ###################################################################
/**
* Throws a fatal error; constructs the header and footer
{
define('ISSO_PRINTER_NO_NAVIGATION', 1);
}
-
+
$this->page_start(T('Error'));
$this->page_message(T('Error'), $message);
$this->page_end();
-
+
exit;
}
-
+
// ###################################################################
/**
* Outputs the header of the page: doctype, <html>, <head>, <title>,
{
ob_start();
}
-
+
if (defined('ISSO_PRINTER_DONE_HEADER') AND constant('ISSO_PRINTER_DONE_HEADER'))
{
return;
}
-
+
$title = sprintf(T('%1$s - %2$s - %3$s'), $this->registry->getApplication(), $this->realm, $actiontitle);
-
+
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
echo "<html xml:lang=\"" . $this->language['langcode'] . "\" lang=\"" . $this->language['langcode'] . "\" dir=\"" . $this->language['direction'] . "\">\n<head>";
echo "\n\t<title>$title</title>";
echo $this->code;
echo ($extra ? "\n$extra" : '');
echo "\n</head>\n<body" . ($pageclass != null ? " class=\"$pageclass\"" : '') . ($onload ? " onload=\"$onload\"" : '') . ">\n";
-
+
if ($this->registry->is_loaded('printer_navigation') AND (!defined('ISSO_PRINTER_NO_NAVIGATION') OR (defined('ISSO_PRINTER_NO_NAVIGATION') AND constant('ISSO_PRINTER_NO_NAVIGATION') != true)))
{
echo $this->registry->modules['printer_navigation']->generate_header_html();
}
-
+
if (!defined('ISSO_PRINTER_DONE_HEADER'))
{
define('ISSO_PRINTER_DONE_HEADER', 1);
}
}
-
+
// ###################################################################
/**
* Links CSS to the page from a given relative path
{
$this->css .= "\n\t<link rel=\"stylesheet\" href=\"$path\" />";
}
-
+
// ###################################################################
/**
* Imbeds actual CSS information into the page in <style> tags
$css = trim($css);
$this->css .= "\n\t<style type=\"text/css\">\n\t<!--\n" . $css . "\n\t//-->\n\t</style>";
}
-
+
// ###################################################################
/**
* Places raw HTML code directly into the documet at the current
$this->code .= "\n\n$code\n\n";
}
}
-
+
// ###################################################################
/**
* A block function that produces a table with a message in it. This
$this->row_span(($overridemessage ? $message : "<blockquote>$message</blockquote>"), ':swap:', 'left', 1);
$this->table_end();
}
-
+
// ###################################################################
/**
* Produces an entire page layout that asks the user whether or not
{
define('ISSO_PRINTER_NO_NAVIGATION', 1);
}
-
+
$this->page_start(T('Confirm'));
-
+
$this->form_start($location, $action);
foreach ($params AS $key => $value)
{
$this->form_hidden_field($key, $value);
}
-
+
$this->table_start(true, '75%');
$this->table_head(T('Confirm'), 1);
$this->row_span("<blockquote>$message</blockquote>", ':swap:', 'left', 1);
$this->row_submit('<input type="button" class="button" name="no" value=" ' . T('No') . ' " onclick="history.back(1); return false;" />', T('Yes'), '');
$this->table_end();
-
+
$this->form_end();
-
+
$this->page_end();
}
-
+
// ###################################################################
/**
* Closes the HTML document structure an adds the copyright; this also
{
ob_clean();
ob_end_clean();
-
+
if (is_array($this->registry->modules[ISSO_DB_LAYER]->history))
{
foreach ($this->registry->modules[ISSO_DB_LAYER]->history AS $query)
}
exit;
}
-
+
if ($this->registry->is_loaded('printer_navigation') AND (!defined('ISSO_PRINTER_NO_NAVIGATION') OR (defined('ISSO_PRINTER_NO_NAVIGATION') AND constant('ISSO_PRINTER_NO_NAVIGATION') != true)))
{
echo $this->registry->modules['printer_navigation']->generate_footer_html();
}
-
+
$copyright = "\n<br />\n<p align=\"center\" class=\"copyright\">\n\t<a href=\"http://www.bluestatic.org\" target=\"_blank\">" . $this->registry->getApplication() . ' ' . $this->registry->getAppVersion() . ", ©2002 - " . date('Y') . " Blue Static</a>\n</p>";
-
+
if (!defined('ISSO_PRINTER_HIDE_SETUP'))
{
echo "\n$copyright";
echo $this->registry->construct_debug_block(false);
}
-
+
echo "\n\n</body>\n</html>";
-
+
exit;
}
-
+
// -------------------------------------------------------------------
-
+
// ###################################################################
/**
* Opens a <table> tag with styling
{
echo '<br />';
}
-
+
echo "\n<table cellpadding=\"4\" cellspacing=\"1\" border=\"0\" align=\"center\" width=\"$width\" class=\"tborder\">\n";
}
-
+
// ###################################################################
/**
* Adds a table row that is sued to head the entire table
{
echo "<tr>\n\t<td class=\"tcat\" align=\"center\" colspan=\"$colspan\">" . (($strong) ? "<strong>$title</strong>" : $title) . "</td>\n</tr>\n";
}
-
+
// ###################################################################
/**
* Creates column headings; useful for a grid-style page. This uses a
if (is_array($columnarray))
{
$render = "<tr valign=\"top\" align=\"center\">\n";
-
+
foreach ($columnarray AS $header)
{
$render .= "\t<td class=\"thead\" align=\"center\">$header</td>\n";
}
-
+
$render .= "</tr>\n";
-
+
echo $render;
}
}
-
+
// ###################################################################
/**
* Closes a <table> tag
{
echo "\n</table>\n";
}
-
+
// -------------------------------------------------------------------
-
+
// ###################################################################
/**
* Starts a <form> tag and adds the DO hidden input field
function form_start($action, $do, $enctype = false, $name = 'inputform', $submitmethod = 'post')
{
echo "\n<!-- input form -->\n<form name=\"$name\" action=\"$action\"" . (($enctype) ? " enctype=\"$enctype\"" : '') . " method=\"$submitmethod\">\n";
-
+
if ($do !== null)
{
$this->form_hidden_field('do', $do);
}
}
-
+
// ###################################################################
/**
* Adds a hidden field at the current location
{
echo "<input type=\"hidden\" name=\"$name\" value=\"$value\" />\n";
}
-
+
// ###################################################################
/**
* Closes a <form> tag
{
echo "</form>\n<!-- / input form -->\n";
}
-
+
// -------------------------------------------------------------------
-
+
// ###################################################################
/**
* Creates a table row that spans an entire row; this is used to divide
$is_style_element = false;
}
}
-
+
echo "\n<tr>\n\t<td ". (($is_style_element) ? "style=\"$style\"" : "class=\"$row_class\"") . " colspan=\"$colspan\" align=\"$align\">$text</td>\n</tr>";
}
-
+
// ###################################################################
/**
* Creates a table row that has more than two columns; this is used in
function row_multi_item($row_array)
{
$this->registry->modules['functions']->exec_swap_bg();
-
+
foreach ($row_array AS $item => $align)
{
$row_data["$align"][] = $item;
}
-
+
echo "<tr valign=\"top\">";
-
+
foreach ($row_data AS $align_key => $item_array)
{
if ($align_key == 'c')
{
$align = 'right';
}
-
+
foreach ($item_array AS $value)
{
echo "\n\t<td class=\"{$this->registry->modules['functions']->bgcolour}\" align=\"$align\">$value</td>";
}
}
-
+
echo "\n</tr>\n";
}
-
+
// ###################################################################
/**
* Generic row creation function that has two columns: label and value;
function row_text($label, $value = ' ', $valign = 'top', $colspan = 2, $class = -1)
{
global $IS_SETTINGS;
-
+
if ($class == -1)
{
if (!$IS_SETTINGS)
else
{
$row_class = $class;
- }
-
+ }
+
echo "<tr valign=\"$valign\">";
echo "\n\t<td class=\"$row_class\">$label</td>";
echo "\n\t<td class=\"$row_class\" colspan=\"" . ($colspan - 1) . "\">$value</td>";
-
+
echo "\n</tr>\n";
}
-
+
// ###################################################################
/**
* Creates a table row with an <input> text field as the value column
{
$this->row_text($label, "<input type=\"" . (($password) ? 'password' : 'text') . "\" class=\"input\" name=\"$name\" value=\"$value\" size=\"$size\" " . (($length) ? "maxlength=\"$length\" " : '') . "/>", $lalign, $colspan);
}
-
+
// ###################################################################
/**
* Creates a table row with a <textarea> as the value column
{
$this->row_text($label, "<textarea name=\"$name\" class=\"" . (($code) ? 'code' : 'input') . "\" rows=\"$rows\" cols=\"$cols\"" . (($style) ? ' style="' . $style . '"' : '') . ">$value</textarea>", 'top', $colspan);
}
-
+
// ###################################################################
/**
* Creates a table row with the tfoot class
{
echo $this->row_span($data, 'tfoot', 'center', $colspan);
}
-
+
// ###################################################################
/**
* Creates a tfoot table row with submit buttons
{
$submit = " $submit ";
}
-
+
if ($reset === ':reset:')
{
$reset = " " . T('Reset') . " ";
{
$reset = (($reset) ? " $reset " : '');
}
-
+
$output = "\n\t\t<input type=\"submit\" class=\"button\" name=\"__submit__\" value=\"$submit\" accesskey=\"s\" />";
$output .= ($reset ? "\n\t\t<input type=\"reset\" class=\"button\" name=\"__reset__\" value=\"$reset\" accesskey=\"r\" />" : '');
$output .= ($extra ? "\n\t\t$extra" : '');
$output .= "\n\t";
$this->row_tfoot($output, $colspan);
}
-
+
// ###################################################################
/**
* Creates an upload row; you need to specify some other paramaters in
{
$this->row_text($label, "<input type=\"file\" class=\"button\" name=\"$name\" size=\"35\" />", 'top', $colspan);
}
-
+
// ###################################################################
/**
* Adds a name-value pair to an array that is constructed into a
function list_item($name, $value, $selected = false)
{
global $listitem;
-
+
$listitem["$value"] = array('name' => $name, 'selected' => $selected);
}
-
+
// ###################################################################
/**
* Assembles a <select> table row from list_item() items
function row_list($label, $name, $is_jump = false, $colspan = 2)
{
global $listitem;
-
+
foreach ($listitem AS $value => $option)
{
- $optionlist .= "\n\t<option value=\"$value\"" . ($option['selected'] == true ? ' selected="selected"' : '') . ">$option[name]</option>";
+ $optionlist .= "\n\t<option value=\"$value\"" . ($option['selected'] == true ? ' selected="selected"' : '') . ">$option[name]</option>";
}
-
+
$listitem = array();
-
+
$this->row_text($label, "\n<select class=\"button\" name=\"$name\"" . (($is_jump) ? " onchange=\"this.form.submit();\"" : '') . ">$optionlist\n</select>" . (($is_jump) ? "\n<input type=\"submit\" class=\"button\" value=\" " . T('Go') . " \" accesskey=\"g\" />" : '') . "\n", $colspan);
}
-
+
// ###################################################################
/**
* Assembles a list of checkboxes from list_item() items
function row_checkbox($label, $name, $colspan = 2)
{
global $listitem;
-
+
foreach ($listitem AS $value => $box)
{
$optionlist[] = "\n\t<input type=\"checkbox\" class=\"button\" name=\"{$name}[]\" value=\"$value\"" . ($box['selected'] == true ? ' checked="checked"' : '') . " /> $box[name]";
}
-
+
$listitem = array();
-
+
$this->row_text($label, "\n" . implode('<br />', $optionlist) . "\n", $colspan);
}
-
+
// ###################################################################
/**
* Creates a row with two radio buttons: yes and now
* @copyright Copyright (c)2002 - [#]year[#], Blue Static
* @version $Revision$
* @package ISSO
-*
+*
*/
class Printer_CSS
{
* @access private
*/
var $registry = null;
-
+
/**
* CSS block list
* @var array
* @access private
*/
var $descriptors = array();
-
+
/**
* Master data set
* @var array
* @access private
*/
var $masterdata = array();
-
+
/**
* Cutomized data set
* @var array
* @access private
*/
var $customdata = array();
-
+
/**
* Valid properties that can be used in CSS
* @var array
'font-family' => 'font_family',
'text-decoration' => 'text_decoration'
);
-
+
/**
* Hook ran in fetch_modified_link; takes three params: $descriptor, $property, $name
* @var string
* @access private
*/
var $fetch_modified_link_hook = ':=NO METHOD=:';
-
+
/**
* Module fields
* @var array
var $fields = array(
'fetch_modified_link_hook' => array(REQ_YES, null, false)
);
-
+
// ###################################################################
/**
* Constructor
{
$this->registry =& $registry;
}
-
+
// ###################################################################
/**
* (PHP 4) Constructor
{
$this->__construct($registry);
}
-
+
// ###################################################################
/**
* Sets an ISSO field
{
$this->registry->do_set($name, $value, 'printer_css');
}
-
+
// ###################################################################
/**
* Gets an ISSO field
{
return $this->registry->do_get($fieldname, 'printer_css');
}
-
+
// ###################################################################
/**
* Adds a CSS information block to the array for later use
trigger_error('The descriptor `' . $descriptor . '` already exists', E_USER_WARNING);
return;
}
-
+
$this->descriptors["$descriptor"] = array(
'title' => $title,
'descriptor' => $descriptor,
'dolink' => $dolink
);
}
-
+
// ###################################################################
/**
* Sets a master data key for a given descriptor and property
{
$this->masterdata["$descriptor"]["$property"] = $value;
}
-
+
// ###################################################################
/**
* Sets a custom data key for a given descriptor and property
{
$this->customdata["$descriptor"]["$property"] = $value;
}
-
+
// ###################################################################
/**
* Generates the HTML needed to output the CSS editing blocks; this is
function generate_blocks()
{
$print =& $this->registry->modules['printer'];
-
+
$lang = array(
'standard_css_attributes' => T('Standard CSS Attributes'),
'extra_css_attributes' => T('Extra CSS Attributes'),
-
+
'links_normal' => T('Normal CSS Links'),
'links_visited' => T('Visited CSS Links'),
'links_hover' => T('Hover CSS Links'),
-
+
'background' => T('Background'),
'font_color' => T('Font Color'),
'font_style' => T('Font Style'),
'font_size' => T('Font Size'),
'font_family' => T('Font Family'),
-
+
'text_decoration' => T('Text Decoration'),
-
+
'css_selector' => T('CSS Selector'),
'save_css' => T('Save CSS')
);
-
+
foreach ($this->descriptors AS $descriptor)
{
$value = array();
$status = array();
-
+
$desc = $descriptor['descriptor'];
-
+
$print->table_start();
$print->table_head($descriptor['title']);
-
+
foreach ($this->properties AS $prop => $name)
{
$value["$name"] = $this->fetch_value($descriptor['descriptor'], $prop);
$status["$name"] = $this->fetch_modified_status($descriptor['descriptor'], $prop);
}
-
+
$value['extra'] = $this->fetch_value($descriptor['descriptor'], 'extra');
$html = "<table cellspacing=\"0\" cellpadding=\"4\" border=\"0\" width=\"100%\">
<td width=\"50%\">
<fieldset>
<legend><strong>$lang[standard_css_attributes]</strong></legend>
-
+
<table cellspacing=\"0\" cellpadding=\"2\" border=\"0\" width=\"100%\">
<tr>
<td width=\"45%\">" . $this->fetch_modified_link($desc, 'background', $lang['background']) . "</td>
</table>
</fieldset>
</td>
-
+
<td>
<fieldset style=\"height: 115px\">
<legend><strong>" . $this->fetch_modified_link($desc, 'extra', $lang['extra_css_attributes']) . "</strong></legend>
$status["{$selname}_{$name}"] = $this->fetch_modified_status($descriptor['descriptor'] . ' ' . $sel, $prop);
}
}
-
+
$html .= "
<table cellspacing=\"0\" cellpadding=\"4\" border=\"0\" width=\"100%\">
<td width=\"33%\">
<fieldset>
<legend><strong>$lang[links_normal]</strong></legend>
-
+
<table cellspacing=\"0\" cellpadding=\"2\" border=\"0\" width=\"100%\">
<tr>
<td width=\"45%\">" . $this->fetch_modified_link($desc . ' a:link', 'background', $lang['background']) . "</td>
</table>
</fieldset>
</td>
-
+
<td width=\"33%\">
<fieldset>
<legend><strong>$lang[links_visited]</strong></legend>
-
+
<table cellspacing=\"0\" cellpadding=\"2\" border=\"0\" width=\"100%\">
<tr>
<td width=\"45%\">" . $this->fetch_modified_link($desc . ' a:visited', 'background', $lang['background']) . "</td>
</table>
</fieldset>
</td>
-
+
<td width=\"33%\">
<fieldset>
<legend><strong>$lang[links_hover]</strong></legend>
-
+
<table cellspacing=\"0\" cellpadding=\"2\" border=\"0\" width=\"100%\">
<tr>
<td width=\"45%\">" . $this->fetch_modified_link($desc . ' a:hover', 'background', $lang['background']) . "</td>
</tr>
</table>";
}
-
+
$print->row_span($html, 'alt2', 'left', 1);
-
+
$print->row_span('
<div class="alt1" style="border: inset 1px; padding: 2px 5px 2px 5px; float: left">' . $lang['css_selector'] . ': <code>' . $descriptor['descriptor'] . '</code></div>
<input type="submit" name="submit" value="' . $lang['save_css'] . '" class="button" />', 'tfoot', 'right', 1);
-
+
$print->table_end();
}
}
-
+
// ###################################################################
/**
* Returns the value of a given descriptor and property by comparing
return $this->customdata["$descriptor"]["$property"];
}
}
-
+
// ###################################################################
/**
* Returns the state modified state (false for untouched and true
{
return true;
}
-
+
return false;
}
-
+
// ###################################################################
/**
* Fetches a link that shows a revert link for a given property
function fetch_modified_link($descriptor, $property, $name)
{
$status = $this->fetch_modified_status($descriptor, $property);
-
+
if ($status)
{
if (is_callable($this->fetch_modified_link_hook))
return $name;
}
}
-
+
// ###################################################################
/**
* Generates an array of queries that should be run on your database to
- * update CSS changes. All of the queries have sprintf() markers that
+ * update CSS changes. All of the queries have sprintf() markers that
* need to be evaluated:
*
* %1$s - Database table
function generate_change_query($data)
{
$queries[0] = '--- RESERVED FOR LATER USE ---';
-
+
$deletes = array();
-
+
foreach ($this->descriptors AS $descriptor => $opts)
{
$dolink = $opts['dolink'];
-
+
if ($dolink)
{
$loops = array('', ' a:link', ' a:visited', ' a:hover');
{
$loops = array('');
}
-
+
foreach ($loops AS $sel)
{
foreach ($data["$descriptor$sel"] AS $prop => $value)
}
}
}
-
+
if (sizeof($deletes) < 1)
{
$queries[0] = '##';
{
$queries[0] = "DELETE FROM %1\$s WHERE styleid = %6\$d AND ((" . implode(') OR (', $deletes) . "))";
}
-
+
return $queries;
}
-
+
// ###################################################################
/**
* Wrapper for $this->registry->modules[ISSO_DB_LAYER]->escape_string()
{
return $this->registry->modules[ISSO_DB_LAYER]->escape_string($string);
}
-
+
// ###################################################################
/**
* Generates a linkable/usable CSS stylehseet content file; this can
function generate_css_output()
{
$data = array();
-
+
foreach ($this->descriptors AS $descriptor => $opts)
{
$dolink = $opts['dolink'];
-
+
if ($dolink)
{
$loops = array('', ' a:link', ' a:visited', ' a:hover');
{
$loops = array('');
}
-
+
foreach ($loops AS $sel)
{
foreach ($this->masterdata["$descriptor$sel"] AS $prop => $value)
}
}
}
-
+
$output = '/* CSS Style Sheet (generated by ISSO.Printer.CSS $Revision$) */';
-
+
foreach ($data AS $selector => $props)
{
$output .= "\n\n$selector\n{";
$output .= str_replace('"', '"', "\n\t$name: $value;");
}
}
-
+
if ($props['extra'])
{
$extra = explode("\n", $this->registry->modules['functions']->convert_line_breaks($props['extra']));
-
+
foreach ($extra AS $prop)
{
$output .= "\n\t$prop";
}
}
-
+
$output .= "\n}";
}
-
+
return $output;
}
}
* @copyright Copyright (c)2002 - [#]year[#], Blue Static
* @version $Revision$
* @package ISSO
-*
+*
*/
class Printer_Navigation
{
* @access private
*/
var $registry = null;
-
+
/**
* Global links that are used for admin home, logout, etc.
* @var array
* @access private
*/
var $toplinks = array();
-
+
/**
* Navigational tabs: array(text, url)
* @var array
* @access private
*/
var $tabs = array();
-
+
/**
* Sections: text
* @var array
* @access private
*/
var $sections = array();
-
+
/**
* Links: array(text, url)
* @var array
* @access private
*/
var $links = array();
-
+
/**
* Array of scopes to set focus to key
* @var array
* @access private
*/
var $focus = array('tab' => null, 'link' => null);
-
+
// ###################################################################
/**
* Constructor
{
$this->registry =& $registry;
}
-
+
// ###################################################################
/**
* (PHP 4) Constructor
{
$this->__construct($registry);
}
-
+
// ###################################################################
/**
* Adds a global link to the array; these cannot be removed once added
{
$this->toplinks["$href"] = $text;
}
-
+
// ###################################################################
/**
- * Adds to the structure array. The following is the global structure
+ * Adds to the structure array. The following is the global structure
* of the array, but you can specify any entry point. When you add onto
* the structure, it will go at the bottom
* array(
$this->links["$parent"]["$key"] = array($text, $url);
}
}
-
+
// ###################################################################
/**
* Sets the focus for either a tab or link
trigger_error('Printer_Navigation::set_focus() only allows setting of focus for tab and link scopes', E_USER_ERROR);
}
}
-
+
// ###################################################################
/**
* Generates the header HTML that is called in ISSO.Printer->page_start()
function generate_header_html()
{
$output = '<!-- navigation start -->' . "\n\n";
-
+
// -------------------------------------------------------------------
-
+
$output2 = array();
foreach ($this->toplinks AS $href => $text)
{
$output2[] = '<a href="' . $href . '">' . $text . '</a>';
}
-
+
$language = $this->registry->modules['printer']->getLanguageInformation();
-
+
$output .= "\n" . '<div id="toplinks" style="float: ' . ($language['direction'] == 'rtl' ? 'left' : 'right') . '">';
$output .= "\n\t" . '<div>' . $this->registry->getApplication() . ' ' . $this->registry->modules['printer']->getRealm() . '</div>';
$output .= "\n\t" . '<div id="toplinks-links">' . implode(' • ', $output2) . '</div>';
$output .= "\n" . '</div>';
-
+
// -------------------------------------------------------------------
-
+
$output .= "\n\n" . '<div id="wrapper">';
-
+
// -------------------------------------------------------------------
-
+
$output .= "\n" . '<div id="tabbar">';
foreach ($this->tabs AS $key => $content)
{
{
$link .= ' id="focustab"';
}
-
+
$link .= '><span>' . $content[0] . '</span></a>';
-
+
$output .= $link;
}
$output .= "\n" . '</div>';
-
+
// -------------------------------------------------------------------
-
+
$output .= "\n\n" . '<table id="contentbody" cellspacing="0" cellpadding="0" border="0">';
$output .= "\n" . '<tr>';
-
+
// -------------------------------------------------------------------
-
+
$output .= "\n" . '<td id="menu">';
foreach ((array)$this->sections[ $this->focus['tab'] ] AS $key => $text)
{
$output .= "\n" . '</ul>' . "\n";
}
$output .= "\n" . '</td>';
-
+
// -------------------------------------------------------------------
-
+
$output .= "\n" . '<td id="mainbody">';
$output .= "\n\n" . '<!-- main content body -->' . "\n";
-
+
return $output;
}
-
+
// ###################################################################
/**
* Generates the HTML that is inserted in ISSO.Printer->page_end() that
function generate_footer_html()
{
$output = '';
-
+
$output .= "\n" . '<!-- / main content body -->' . "\n";
-
+
$output .= "\n" . '</td>';
$output .= "\n" . '</tr>';
-
+
$output .= "\n\n" . '</table>';
-
+
$output .= "\n\n" . '</div>';
-
+
return $output;
}
}
* @copyright Copyright (c)2002 - [#]year[#], Blue Static
* @version $Revision$
* @package ISSO
-*
+*
*/
class Template
{
* @access private
*/
var $registry = null;
-
+
/**
* Name of the database table templates are in
* @var string
* @access private
*/
var $tablename = '';
-
+
/**
* Name of the table column template names are in
* @var string
* @access private
*/
var $namecolumn = '';
-
+
/**
* Name of the table column templates are in
* @var string
* @access private
*/
var $datacolumn = '';
-
+
/**
* Additional WHERE clauses for the template fetch SQL
* @var string
* @access private
*/
var $extrawhere = '';
-
+
/**
* The name of the function phrases are fetched with
* @var string
* @access private
*/
var $langcall = 'gettext';
-
+
/**
* The name of the function phrases are sprintf() parsed with
* @var string
* @access private
*/
var $langconst = 'sprintf';
-
+
/**
* Array of pre-compiled templates that are stored to decrease server load
* @var array
* @access private
*/
var $cache = array();
-
+
/**
* A list of the number of times each template has been used
* @var array
* @access private
*/
var $usage = array();
-
+
/**
* A list of templates that weren't cached, but are still used
* @var array
* @access private
*/
var $uncached = array();
-
+
/**
* Whether or not the page has been flush()'d already
* @var bool
* @access private
*/
var $doneflush = false;
-
+
/**
* The name of a function that is called before template parsing of phrases and conditionals occurs
* @var string
* @access private
*/
var $pre_parse_hook = ':=NO METHOD=:';
-
+
// ###################################################################
/**
* Constructor
{
$this->registry =& $registry;
}
-
+
// ###################################################################
/**
* (PHP 4) Constructor
{
$this->__construct($registry);
}
-
+
// ###################################################################
/**
* Initializes the class and all subclasses under a common package name
{
return 'template';
}
-
+
// ###################################################################
/**
* Sets tablename
{
$this->tablename = $name;
}
-
+
// ###################################################################
/**
* Sets namecolumn
{
$this->namecolumn = $name;
}
-
+
// ###################################################################
/**
* Sets datacolumn
{
$this->datacolumn = $name;
}
-
+
// ###################################################################
/**
* Sets extrawhere
{
$this->extrawhere = $sql;
}
-
+
// ###################################################################
/**
* Sets the pre-parse hook
{
$this->pre_parse_hook = $name;
}
-
+
// ###################################################################
/**
* Takes an array of template names, loads them, and then stores a
}
}
}
-
+
// ###################################################################
/**
* Loads a template from the cache or the _load function and stores the
$template = $this->_load($name);
$template = $this->_parse($template);
}
-
+
if (!isset($this->usage["$name"]))
{
$this->usage["$name"] = 0;
}
-
+
$this->usage["$name"]++;
-
+
return $template;
}
-
+
// ###################################################################
/**
* Output a template fully compiled to the browser
function flush($template)
{
ob_start();
-
+
if (empty($template))
{
trigger_error('There was no output to print', E_USER_ERROR);
exit;
}
-
+
if ($this->registry->debug AND isset($_GET['query']))
{
if (is_array($this->registry->modules[ISSO_DB_LAYER]->history))
}
exit;
}
-
+
if ($this->doneflush)
{
trigger_error('A template has already been sent to the output buffer', E_USER_ERROR);
exit;
}
-
+
$template = str_replace('</body>', $this->registry->construct_debug_block(true) . '</body>', $template);
print($template);
}
-
+
// ###################################################################
/**
* Loads an additional template from the database
exit;
}
}
-
+
// ###################################################################
/**
* A wrapper for all the parsing functions and compiling functins
function _parse($template)
{
$template = str_replace('"', '\"', $template);
-
+
if (function_exists($this->pre_parse_hook))
{
$template = call_user_func($this->pre_parse_hook, $template);
}
-
+
$template = $this->_parse_phrases($template);
$template = $this->_parse_conditionals($template);
return $template;
}
-
+
// ###################################################################
/**
* Prepares language and locale information inside templates
$tag_start = '<lang ';
$tag_start_end = '\">';
$tag_end = '</lang>';
-
+
$location_start = -1;
$location_end = -1;
-
+
while (1)
{
// Find the start language object tag
{
break;
}
-
+
// Find the end tag
$location_end = strpos($template, $tag_end, $location_end + strlen($tag_end));
if ($location_end === false)
{
break;
}
-
+
// Extract the language object
$phrase_bunch = substr($template, $location_start, ($location_end + strlen($tag_end)) - $location_start);
-
+
// Find the close to the opening <lang>
$close_of_open = strpos($phrase_bunch, $tag_start_end);
if ($close_of_open === false)
{
break;
}
-
+
// Extract the opening tag so it can be parsed
$init_tag = substr($phrase_bunch, 0, ($close_of_open + strlen($tag_start_end)));
$init_tag = str_replace($tag_start, '', $init_tag);
$init_tag = substr($init_tag, 0, strlen($init_tag) - 1);
-
+
// Get the args out of the tag
$args = preg_split('#([0-9].*?)=#', $init_tag);
foreach ($args AS $arg)
$arglist[] = $arg;
}
}
-
+
// Just get the phrase name
$phrase_name = preg_replace('#<lang(.*?)>(.*?)</lang>#i', '$2', $phrase_bunch);
-
+
// Wrap the parsed data into the build function
$function_wrap = '" . ' . $this->langconst . '("' . /*str_replace(array('\"', "'"), array('"', "\'"),*/ $phrase_name/*)*/ . '", "' . implode('", "', $arglist) . '") . "';
-
+
// Replace the fully-parsed string back into the template
$template = substr_replace($template, $function_wrap, $location_start, $location_end + strlen($tag_end) - $location_start);
-
+
unset($arglist);
}
-
+
// Process the empty phrase objects -- do this now so we don't have to worry about it when we're parsing later
$template = preg_replace('#\{@\\\"(.*?)\\\"\}#ise', '$this->_phrase_string(\'$1\')', $template);
-
+
return $template;
}
-
+
// ###################################################################
/**
* Turns a localized phrase tag into a function call
{
return '" . ' . $this->langcall . '(\'' . str_replace(array('\\\"', "'"), array('"', "\'"), $text) . '\') . "';
}
-
+
// ###################################################################
/**
* Parser for in-line template conditionals
$tag_start_end = '\">';
$tag_else = '<else />';
$tag_end = '</if>';
-
+
// tag stack
$stack = array();
-
+
// the information about the current active tag
$tag_full = array();
$parsed = array();
-
+
// start at 0
$offset = 0;
-
+
while (1)
{
if (strpos($template, $tag_start) === false)
{
break;
}
-
+
for ($i = $offset; $i < strlen($template); $i++)
{
// we've found ourselves a conditional!
array_pop($stack);
continue;
}
-
+
// calculate the position of the end tag
$tag_full['posf'] = $i + strlen($tag_end) - 1;
-
+
// extract the entire conditional from the template
$fullspread = substr($template, $tag_full['posi'], $tag_full['posf'] - $tag_full['posi'] + 1);
-
+
// remove the beginning tag
$conditional = substr($fullspread, strlen($tag_start));
-
+
// find the end of the expression
$temp_end = strpos($conditional, $tag_start_end);
-
+
// save the expression
$parsed[0] = stripslashes(substr($conditional, 0, $temp_end));
-
+
// remove the expression from the conditional
$conditional = substr($conditional, strlen($parsed[0]) + strlen($tag_start_end));
-
+
// remove the tailing end tag
$conditional = substr($conditional, 0, strlen($conditional) - strlen($tag_end));
-
+
// handle the else
if (isset($tag_full['else']))
{
// now relative to the start of the <if>
$relpos = $tag_full['else'] - $tag_full['posi'];
-
+
// calculate the length of the expression and opening tag
$length = strlen($parsed[0]) + strlen($tag_start) + strlen($tag_start_end);
-
+
// relative to the start of iftrue
$elsepos = $relpos - $length;
-
+
$parsed[1] = substr($conditional, 0, $elsepos);
$parsed[2] = substr($conditional, $elsepos + strlen($tag_else));
}
$parsed[2] = '';
}
#var_dump($parsed);
-
+
// final parsed output
$parsed = '" . ((' . stripslashes($parsed[0]) . ') ? "' . $parsed[1] . '" : "' . $parsed[2] . '") . "';
-
+
// replace the conditional
$template = str_replace($fullspread, $parsed, $template);
-
+
// reset the parser
$offset = $tag_full['posi'] + strlen($tag_start) + strlen($tag_start_end);
$tag_full = array();
* @copyright Copyright (c)2002 - [#]year[#], Blue Static
* @version $Revision$
* @package ISSO
-*
+*
*/
class Template_FS extends Template
{
* @access private
*/
var $templatedir = '';
-
+
/**
* The extension all the template files have
* @var string
* @access private
*/
var $extension = 'tpl';
-
+
/**
* The database table name for the template cache
* @var string
* @access private
*/
var $dbCacheTable = null;
-
+
// ###################################################################
/**
* Constructor
{
$this->registry =& $registry;
}
-
+
// ###################################################################
/**
* (PHP 4) Constructor
{
$this->__construct($registry);
}
-
+
// ###################################################################
/**
* Sets the template directory
{
$this->templatedir = $this->registry->fetch_sourcepath($path);
}
-
+
// ###################################################################
/**
* Sets the file extension
{
$this->extension = $ext;
}
-
+
// ###################################################################
/**
* Sets the name of the table to access for the datbase cache
{
$this->dbCacheTable = $table;
}
-
+
// ###################################################################
/**
* Takes an array of template names, loads them, and then stores a
}
}
}
-
+
// ###################################################################
/**
* Loads a template from the file system from the specified
* @copyright Copyright (c)2002 - [#]year[#], Blue Static
* @version $Revision$
* @package ISSO
-*
+*
*/
class XML
{
* @access private
*/
var $registry = null;
-
+
/**
* Parser resource
* @var integer
* @access private
*/
var $parser = null;
-
+
/**
* An array of function names that are to be executed for each tag name (name => function)
* @var array()
* @access private
*/
var $taghandler = array();
-
+
/**
* Current CDATA value
* @var string
* @access private
*/
var $cdata = '';
-
+
/**
* Tag stack of all open nodes
* @var array
* @access private
*/
var $stack = array();
-
+
/**
* Node list for all open tag attributes
* @var array
* @access private
*/
var $attribs = array();
-
+
/**
* Resulting parsed array
* @var array
* @access private
*/
var $result = array();
-
+
// ###################################################################
/**
* Constructor
{
$this->registry =& $registry;
}
-
+
// ###################################################################
/**
* (PHP 4) Constructor
{
$this->__construct($registry);
}
-
+
// ###################################################################
/**
* Parse an XML file
$this->attribs = array();
$this->result = array();
$this->cdata = '';
-
+
if ($utf8)
{
$this->parser = xml_parser_create('UTF-8');
{
$this->parser = xml_parser_create('ISO-8859-1');
}
-
+
// create a new parser
xml_set_object($this->parser, $this);
xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
xml_set_element_handler($this->parser, 'handle_tag_start', 'handle_tag_end');
xml_set_character_data_handler($this->parser, 'handle_cdata');
-
+
$this->attach_node($this->result);
-
+
// parse the data and check for errors
if (!xml_parse($this->parser, $data))
{
trigger_error("XML Error: $error[string] at line $error[line] colunn $error[column]", E_USER_ERROR);
exit;
}
-
+
// destroy the parser
xml_parser_free($this->parser);
-
+
// done... send the results back
return $this->result;
}
-
+
// ###################################################################
/**
* Process the opening location of an XML tag
{
// we need to keep track of indicies to monitor the last key in $this->attribs
static $index;
-
+
// trim attributes
array_walk($attrs, 'trim');
unset($this->attribs["$name"]);
$this->attribs["$name"][0] = $tmp;
}
-
+
// create a new child node
$this->attribs["$name"][ $index["$name"] ] = (array)$attrs;
$this->attach_node($this->attribs["$name"][ $index["$name"] ]);
$index["$name"] = 1;
}
}
-
+
// ###################################################################
/**
* Process XML CDATA
{
$this->cdata .= $data;
}
-
+
// ###################################################################
/**
* Process the closing of an XML tag
{
$this->attribs['value'] = $this->cdata;
}
-
+
$this->cdata = '';
-
+
// remove the node
$this->detach_node();
}
-
+
// ###################################################################
/**
* Shifts the node tree
{
// create a new node
$this->stack[ sizeof($this->stack) ] =& $node;
-
+
// new attributes to work with
$this->attribs =& $node;
}
-
+
// ###################################################################
/**
* Unshifts the node tree
{
// drop the newest node
unset($this->stack[ sizeof($this->stack) - 1 ]);
-
+
// assign the attributes to the next newest node
$this->attribs =& $this->stack[ sizeof($this->stack) - 1 ];
}
-
+
// ###################################################################
/**
* Unless a node has multiple children, there will not be a numerical
'username_display',
'help_link'
);
-
+
$start = microtime();
-
+
$template->cache(array_merge($globaltemplates, (array)$fetchtemplates));
-
+
$bugsys->debug('time for tpl cache: ' . $funct->fetch_microtime_diff($start));
-
+
eval('$header = "' . $template->fetch('header') . '";');
eval('$doctype = "' . $template->fetch('doctype') . '";');
eval('$headinclude = "' . $template->fetch('headinclude') . '";');
* @copyright Copyright (c)2002 - 2007, Blue Static
* @version $Revision$
* @package Bugdar
-*
+*
*/
class AttachmentAPI extends API
{
'userid' => array(TYPE_UINT, REQ_YES, null, array('includes/api_user.php', 'UserAPI')),
'obsolete' => array(TYPE_BOOL, REQ_NO)
);
-
+
/**
* Database table
* @var string
* @access private
*/
var $table = 'attachment';
-
+
/**
* Table prefix
* @var string
* @access private
*/
var $prefix = TABLE_PREFIX;
-
+
// ###################################################################
/**
* Set field: dateline
* @copyright Copyright (c)2002 - 2007, Blue Static
* @version $Revision$
* @package Bugdar
-*
+*
*/
class AutomationAPI extends API
{
'fieldchanges' => array(TYPE_NONE, REQ_YES, ':self'),
'comment' => array(TYPE_STR, REQ_NO)
);
-
+
/**
* Table
* @var string
* @access private
*/
var $table = 'automation';
-
+
/**
* Table prefix
* @var string
* @access private
*/
var $prefix = TABLE_PREFIX;
-
+
// ###################################################################
/**
* Post-insert
{
build_automations();
}
-
+
// ###################################################################
/**
* Post-update
{
build_automations();
}
-
+
// ###################################################################
/**
* Post-delete
{
build_automations();
}
-
+
// ###################################################################
/**
* Verify: fieldchanges
{
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)
{
return T('You need to specify some fields to change.');
}
-
+
$this->values['fieldchanges'] = serialize($this->values['fieldchanges']);
-
+
return true;
}
}
* @copyright Copyright (c)2002 - 2007, Blue Static
* @version $Revision$
* @package Bugdar
-*
+*
*/
class BugAPI extends API
{
'hiddenlastpostby' => array(TYPE_UINT, REQ_NO),
'hiddenlastpostbyname' => array(TYPE_STR, REQ_NO)
);
-
+
/**
* Database table
* @var string
* @access private
*/
var $table = 'bug';
-
+
/**
* Table prefix
* @var string
* @access private
*/
var $prefix = TABLE_PREFIX;
-
+
// ###################################################################
/**
* Subclassed set() that will intercept any custom fields and handle
{
$this->fields["$field"] = array(TYPE_STR, REQ_NO);
}
-
+
// TODO - (r1524) one day we can change this back to call_user_func_array(array($this, 'parent::set'), func_get_args())
parent::set($field, $value, $doclean, $doverify);
}
-
+
// ###################################################################
/**
* Set field: dateline
{
$this->set('dateline', time());
}
-
+
// ###################################################################
/**
* Post-insert
{
$this->registry->db->query("INSERT INTO " . TABLE_PREFIX . "vote (bugid, votefor, voteagainst) VALUES (" . $this->insertid . ", 0, 0)");
}
-
+
// ###################################################################
/**
* Post-delete
$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']);
}
-
+
// ###################################################################
/**
* Verify: product
{
return $nozero;
}
-
+
if (!$this->registry->datastore['product'][ $this->values['product'] ])
{
return false;
}
return true;
}
-
+
// ###################################################################
/**
* Verify: componentid
}
return true;
}
-
+
// ###################################################################
/**
* Verify: versionid
{
return $nozero;
}
-
+
if (!$this->registry->datastore['version'][ $this->values['version'] ])
{
return false;
}
return true;
}
-
+
// ###################################################################
/**
* Verify: priority
}
return true;
}
-
+
// ###################################################################
/**
* Verify: severity
}
return true;
}
-
+
// ###################################################################
/**
* Verify: status
}
return true;
}
-
+
// ###################################################################
/**
* Verify: resolution
}
return true;
}
-
+
// ###################################################################
/**
* Verify: assignedto
* @copyright Copyright (c)2002 - 2007, Blue Static
* @version $Revision$
* @package Bugdar
-*
+*
*/
class CommentAPI extends API
{
'comment_parsed' => array(TYPE_NONE, REQ_SET),
'hidden' => array(TYPE_BOOL, REQ_NO)
);
-
+
/**
* Database table
* @var string
* @access private
*/
var $table = 'comment';
-
+
/**
* Table prefix
* @var string
* @access private
*/
var $prefix = TABLE_PREFIX;
-
+
// ###################################################################
/**
* Set field: dateline
{
$this->set('dateline', time());
}
-
+
// ###################################################################
/**
* Set field: comment_parsed
$comment = preg_replace('#bug://((report|problem)/)?([0-9]*)#i', '<a href="showreport.php?bugid=\3">bug \3</a>', $comment);
$comment = preg_replace('#(https?://|www\.)\S+#i', '<a href="\0">\0</a>', $comment);
}
-
+
if ($this->registry->options['allowhtml'])
{
$this->set('comment_parsed', nl2br($this->registry->unsanitize($comment)));
$this->set('comment_parsed', nl2br($comment));
}
}
-
+
// ###################################################################
/**
* Pre-update
{
$this->set_comment_parsed();
}
-
+
// ###################################################################
/**
* Pre-delete
* @copyright Copyright (c)2002 - 2007, Blue Static
* @version $Revision$
* @package Bugdar
-*
+*
*/
class FieldAPI extends API
{
'usedefault' => array(TYPE_BOOL, REQ_NO),
'maxlength' => array(TYPE_UINT, REQ_NO)
);
-
+
/**
* Database table
* @var string
* @access private
*/
var $table = 'bugfield';
-
+
/**
* Table prefix
* @var string
* @access private
*/
var $prefix = TABLE_PREFIX;
-
+
// ###################################################################
/**
* A static method that is used to return an array of all the allowed
'input_checkbox' => T('Checkbox Flag'),
'select_single' => T('Drop-Down Menu'),
);
-
+
if ($type == null)
{
return $types;
return $types["$type"];
}
}
-
+
// ###################################################################
/**
* Post-insert
{
build_user_help();
}
-
+
// ###################################################################
/**
* Post-update
{
build_user_help();
}
-
+
// ###################################################################
/**
* Post-delete
$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");
-
+
build_user_help();
}
-
+
// ###################################################################
/**
* Verify: type
}
return true;
}
-
+
// ###################################################################
/**
* Verify: selects
}
}
}
-
+
return true;
}
}
* @copyright Copyright (c)2002 - 2007, Blue Static
* @version $Revision$
* @package Bugdar
-*
+*
*/
class LanguageAPI extends API
{
'userselect' => array(TYPE_BOOL, REQ_NO),
'langcode' => array(TYPE_STR, REQ_YES)
);
-
+
/**
* Table
* @var string
* @access private
*/
var $table = 'language';
-
+
/**
* Table prefix
* @var string
* @access private
*/
var $prefix = TABLE_PREFIX;
-
+
// ###################################################################
/**
* Post-insert
{
build_languages();
}
-
+
// ###################################################################
/**
* Post-update
{
build_languages();
}
-
+
// ###################################################################
/**
* Pre-delete
{
$this->error(T('At least one language needs to be present. Deleting this language would violate that.'));
}
-
+
if ($this->registry->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.'));
}
}
-
+
// ###################################################################
/**
* Post-delete
{
build_languages();
}
-
+
// ###################################################################
/**
* Verify: direction
* @copyright Copyright (c)2002 - 2007, Blue Static
* @version $Revision$
* @package Bugdar
-*
+*
*/
class PriorityAPI extends API
{
'priority' => array(TYPE_STR, REQ_YES, 'verify_noempty'),
'displayorder' => array(TYPE_INT, REQ_NO)
);
-
+
/**
* Database table
* @var string
* @access private
*/
var $table = 'priority';
-
+
/**
* Table prefix
* @var string
* @access private
*/
var $prefix = TABLE_PREFIX;
-
+
// ###################################################################
/**
* Post-insert
{
build_priorities();
}
-
+
// ###################################################################
/**
* Post-update
{
build_priorities();
}
-
+
// ###################################################################
/**
* Post-delete
* @copyright Copyright (c)2002 - 2007, Blue Static
* @version $Revision$
* @package Bugdar
-*
+*
*/
class ResolutionAPI extends API
{
'resolution' => array(TYPE_STR, REQ_YES, 'verify_noempty'),
'displayorder' => array(TYPE_INT, REQ_NO)
);
-
+
/**
* Database table
* @var string
* @access private
*/
var $table = 'resolution';
-
+
/**
* Table prefix
* @var string
* @access private
*/
var $prefix = TABLE_PREFIX;
-
+
// ###################################################################
/**
* Post-insert
{
build_resolutions();
}
-
+
// ###################################################################
/**
* Post-update
{
build_resolutions();
}
-
+
// ###################################################################
/**
* Post-delete
* @copyright Copyright (c)2002 - 2007, Blue Static
* @version $Revision$
* @package Bugdar
-*
+*
*/
class SeverityAPI extends API
{
'severity' => array(TYPE_STR, REQ_YES, 'verify_noempty'),
'displayorder' => array(TYPE_INT, REQ_NO)
);
-
+
/**
* Database table
* @var string
* @access private
*/
var $table = 'severity';
-
+
/**
* Table prefix
* @var string
* @access private
*/
var $prefix = TABLE_PREFIX;
-
+
// ###################################################################
/**
* Post-insert
{
build_severities();
}
-
+
// ###################################################################
/**
* Post-update
{
build_severities();
}
-
+
// ###################################################################
/**
* Post-delete
* @copyright Copyright (c)2002 - 2007, Blue Static
* @version $Revision$
* @package Bugdar
-*
+*
*/
class StatusAPI extends API
{
'color' => array(TYPE_STR, REQ_NO),
'displayorder' => array(TYPE_INT, REQ_NO)
);
-
+
/**
* Database table
* @var string
* @access private
*/
var $table = 'status';
-
+
/**
* Table prefix
* @var string
* @access private
*/
var $prefix = TABLE_PREFIX;
-
+
// ###################################################################
/**
* Post-insert
{
build_statuses();
}
-
+
// ###################################################################
/**
* Post-update
{
build_statuses();
}
-
+
// ###################################################################
/**
* Post-delete
* @copyright Copyright (c)2002 - 2007, Blue Static
* @version $Revision$
* @package Bugdar
-*
+*
*/
class UserAPI extends API
{
'columnoptions' => array(TYPE_STR, REQ_NO, ':self'),
'authid' => array(TYPE_STR, REQ_NO)
);
-
+
/**
* Database table
* @var string
* @access private
*/
var $table = 'user';
-
+
/**
* Table prefix
* @var string
* @access private
*/
var $prefix = TABLE_PREFIX;
-
+
// ###################################################################
/**
* Set field: salt
{
$this->set('salt', $this->registry->funct->rand(array(1, 15)));
}
-
+
// ###################################################################
/**
* Set field: authkey
{
$this->set('authkey', $this->registry->funct->rand());
}
-
+
// ###################################################################
/**
* Pre-insert
{
$this->set('password', md5(md5($this->values['password']) . md5($this->values['salt'])));
}
-
+
// ###################################################################
/**
* Post-insert
");
build_assignedto();
}
-
+
// ###################################################################
/**
* Verify: email
{
return $ne;
}
-
+
if (!$this->registry->funct->is_valid_email($this->values['email']))
{
return T('The specified email is invalid.');
}
return true;
}
-
+
// ###################################################################
/**
* Verify: displayname
{
return $ne;
}
-
+
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)))
{
return T('That display name is already in use by another user.');
}
return true;
}
-
+
// ###################################################################
/**
* Verify: usergroupid
}
return true;
}
-
+
// ###################################################################
/**
* Verify: groupids
$groups = explode(',', $this->values['groupids']);
}
$groups = $this->registry->funct->array_strip_empty($groups);
-
+
foreach ($groups AS $group)
{
if (!isset($this->registry->datastore['usergroup']["$group"]))
return false;
}
}
-
+
$this->values['groupids'] = implode(',', $groups);
-
+
return true;
}
-
+
// ###################################################################
/**
* Pre-update
{
$this->set_condition();
$this->fetch();
-
+
if ($this->values['password'] == '')
{
$this->set('password', $this->objdata['password']);
$this->set('password', md5(md5($this->values['password']) . md5($this->objdata['salt'])));
}
}
-
+
// ###################################################################
/**
* Post-update
$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");
}
-
+
if (isset($this->values['displayname']) OR isset($this->values['email']))
{
build_assignedto();
}
}
-
+
// ###################################################################
/**
* Pre-delete
{
$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']);
}
}
}
-
+
// ###################################################################
/**
* Post-delete
$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']);
-
+
build_assignedto();
}
-
+
// ###################################################################
/**
* Verify: hidestatuses
{
$this->set('hidestatuses', implode(',', $this->values['hidestatuses']));
}
-
+
return true;
}
-
+
// ###################################################################
/**
* Verify: defaultsortkey
{
return false;
}
-
+
return true;
}
-
+
// ###################################################################
/**
* Verify: defaultsortas
{
return false;
}
-
+
return true;
}
-
+
// ###################################################################
/**
* Verify: columnoptions
* @copyright Copyright (c)2002 - 2007, Blue Static
* @version $Revision$
* @package Bugdar
-*
+*
*/
class UsergroupAPI extends API
{
'displaytitle' => array(TYPE_STR, REQ_NO),
'permissions' => array(TYPE_UINT, REQ_NO)
);
-
+
/**
* Database table
* @var string
* @access private
*/
var $table = 'usergroup';
-
+
/**
* Table prefix
* @var string
* @access private
*/
var $prefix = TABLE_PREFIX;
-
+
// ###################################################################
/**
* Post-insert
{
build_usergroups();
}
-
+
// ###################################################################
/**
* Post-update
build_usergroups();
build_assignedto();
}
-
+
// ###################################################################
/**
* Pre-delete
return T('You can\'t delete a default usergroup.');
}
}
-
+
// ###################################################################
/**
* Post-delete
* @copyright Copyright (c)2002 - 2007, Blue Static
* @version $Revision$
* @package Bugdar
-*
+*
*/
class UserHelpAPI extends API
{
'title' => array(TYPE_STR, REQ_YES, 'verify_noempty'),
'body' => array(TYPE_STR, REQ_YES)
);
-
+
/**
* Database table
* @var string
* @access private
*/
var $table = 'fieldhelp';
-
+
/**
* Table prefix
* @var string
* @access private
*/
var $prefix = TABLE_PREFIX;
-
+
// ###################################################################
/**
* A static function that returns an array of all the keystrings that
'columnorder'
);
}
-
+
// ###################################################################
/**
* Pre-insert
{
if (($err = $this->verify_keystring()) !== true)
{
- $this->error($err);
+ $this->error($err);
}
}
-
+
// ###################################################################
/**
* Post-insert
{
build_user_help();
}
-
+
// ###################################################################
/**
* Post-update
{
build_user_help();
}
-
+
// ###################################################################
/**
* Pre-delete
* @access private
*/
function pre_delete()
- {
+ {
if (in_array($this->values['keystring'], UserHelpAPI::not_able_to_delete()))
{
return false;
}
return true;
}
-
+
// ###################################################################
/**
* Post-delete
{
build_user_help();
}
-
+
// ###################################################################
/**
* Verify: keystring
{
return $ne;
}
-
+
if (preg_match('#[^a-z0-9_]#', $this->values['keystring']))
{
return T('The unique key can only contain lowercase letters, underscores, and numbers.');
}
-
+
if ($this->registry->db->query_first("SELECT * FROM " . TABLE_PREFIX . "fieldhelp WHERE keystring = '" . $this->registry->escape($this->values['keystring']) . "'"))
{
return T('The unique key must be unique.');
}
-
+
return true;
}
}
* @var object
*/
var $authDb;
-
+
/**
* The database connection to the BUGDAR database
* @var object
*/
var $db;
-
+
/**
* The Bugdar registry
* @var object
*/
var $registry;
-
+
/**
* Array of user data from the AUTHENTICATION database
* @var array
*/
var $authUser;
-
+
/**
* Array of user data from the BUGDAR database
* @var array
*/
var $bugdarUser;
-
+
/**
* Mapping of Bugdar fields to authentication database fields; these will be synced between databases upon login.
* AT THE VERY MINIMUM, YOU MUST MAP THESE FIELDS:
'displayname' => null,
'email' => null,
);
-
+
// ###################################################################
/**
* Constructor
function __construct()
{
global $bugsys;
-
+
$this->registry =& $bugsys;
$this->db =& $bugsys->db;
-
+
$this->registry->debug('authentication system: ' . get_class($this));
-
+
$this->_setupDatabase();
}
-
+
// ###################################################################
/**
* (PHP 4) Constructor
{
$this->__construct();
}
-
+
// ###################################################################
/**
* Returns the information array for the Bugdar user. This must be
{
return $this->bugdarUser;
}
-
+
// ###################################################################
/**
* Sets up the database to authenticate against. You can create a new
{
// connect to the DB
$this->authDb = new DB_MySQL($this->registry);
-
+
include 'includes/auth/config.php';
$this->authDb->connect(
$config['auth']['dbServer'],
false
);
}
-
+
// ###################################################################
/**
* Returns the sanitized value of the user ID or unique identifier
* found in the cookie of an already-authenticated user.
*/
function _fetchCookieUniqueId() {}
-
+
// ###################################################################
/**
* Returns the sanitized value of the authentication key or cookie-safe
* password found in the cookies of an already-authenticated user.
*/
function _fetchCookiePassword() {}
-
+
// ###################################################################
/**
* Returns an array of user data fetched using the user information
* the authentication information, but only fetching it.
*/
function _fetchUserUsingCookies() {}
-
+
// ###################################################################
/**
* Returns TRUE if the cookie data values are valid in the data array
* returned from _fetchUserUsingCookies(), and FALSE if they are not.
*/
function _verifyCookieData() {}
-
+
// ###################################################################
/**
* Authenticates the user using cookie data. You shouldn't need to
{
return false;
}
-
+
$this->authUser = $this->_fetchUserUsingCookies();
if (!$this->authUser)
{
$this->authUser = null;
return false;
}
-
+
if ($this->_verifyCookieData())
{
$this->_setCookies(true);
return false;
}
}
-
+
// ###################################################################
/**
* Returns an array with the authentication user information, found
* by the unique login identifier passed to the function.
*/
function _fetchUserWithIdentifier($string) {}
-
+
// ###################################################################
/**
* Verifies that the authUser's password matches the plain-text password
* the plaintext to the hashed password and the result of the comparison.
*/
function _verifyLoginUser($password) {}
-
+
// ###################################################################
/**
* Authenticates a user at login from two keys: an identifier and
function authenticateLogin($string, $password, $sticky = false)
{
$this->authUser = $this->_fetchUserWithIdentifier($string);
-
+
if (!$this->authUser)
{
$this->authUser = null;
return false;
}
-
+
if ($this->_verifyLoginUser($password))
{
$this->_setCookies($sticky);
return false;
}
}
-
+
// ###################################################################
/**
* Returns the BUGDAR user array from the data in the AUTHENTICATION user
}
return $user;
}
-
+
// ###################################################################
/**
* Creates a Bugdar user with the authentication details specified in
function _createBugdarUser()
{
$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'] ]) . "'"))
{
$user->set('authid', $this->authUser[ $this->fieldMap['authid'] ]);
$user->update();
$user->fetch();
-
+
return $user->objdata;
}
else
$user->set('usergroupid', 2);
$user->set('password', $this->registry->funct->rand());
$user->insert();
-
+
return $user->values;
}
}
-
+
// ###################################################################
/**
* Syncs a Bugdar user's fieldMap'ed values to the authentication DB's
$fields = $this->fieldMap;
unset($fields['authid']);
unset($fields['password']);
-
+
$change = false;
-
+
$user = new UserAPI($this->registry);
$user->set('userid', $this->bugdarUser['userid']);
$user->set_condition();
{
$user->update();
}
-
+
return $change;
}
-
+
// ###################################################################
/**
* Responsible for unsetting all authentication cookies because they
* are invalid
*/
function clearCookies() {}
-
+
// ###################################################################
/**
* Sets the authentication cookies; this is done both at login and
{
$this->authDb = &$this->db;
}
-
+
// ###################################################################
function _fetchCookieUniqueId()
{
return $this->registry->input_clean(COOKIE_PREFIX . 'userid', TYPE_UINT);
}
-
+
// ###################################################################
function _fetchCookiePassword()
{
return $this->registry->in[COOKIE_PREFIX . 'authkey'];
}
-
+
// ###################################################################
function _fetchUserUsingCookies()
{
return $this->db->query_first("SELECT * FROM " . TABLE_PREFIX . "user WHERE userid = " . $this->_fetchCookieUniqueId());
}
-
+
// ###################################################################
function _verifyCookieData()
{
return ($this->authUser['authkey'] == $this->_fetchCookiePassword());
}
-
+
// ###################################################################
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);
}
-
+
// ###################################################################
function clearCookies()
{
$this->registry->funct->cookie(COOKIE_PREFIX . 'userid');
$this->registry->funct->cookie(COOKIE_PREFIX . 'authkey');
}
-
+
// ###################################################################
function _fetchBugdarUserFromAuthUser()
{
return $this->authUser;
}
-
+
// ###################################################################
function _fetchUserWithIdentifier($email)
{
return $this->authDb->query_first("SELECT * FROM " . TABLE_PREFIX . "user WHERE email = '" . $this->authDb->escape_string($email) . "'");
}
-
+
// ###################################################################
function _verifyLoginUser($password)
{
return ($this->authUser['password'] == md5(md5($password) . md5($this->authUser['salt'])));
}
-
+
// ###################################################################
function _syncBugdarUser() {}
}
'displayname' => 'name',
'email' => 'mail',
);
-
+
/**
* The cookie name to use for Drupal. Leaving this NULL will get it from session_name()
*/
function _setupDatabase()
{
parent::_setupDatabase();
-
+
// check and see if we need to call session_name()
include 'includes/auth/config.php';
$this->cookieName = $config['auth']['Drupal']['cookieName'];
$this->cookieName = ($this->cookieName == null ? session_name() : $this->cookieName);
}
-
+
// ###################################################################
function _fetchCookieUniqueId()
{
return $this->registry->in[ $this->cookieName ];
}
-
+
// ###################################################################
function _fetchCookiePassword()
{
return true;
}
-
+
// ###################################################################
function _fetchUserUsingCookies()
{
}
return $this->authDb->query_first("SELECT * FROM users WHERE uid = " . $session['uid']);
}
-
+
// ###################################################################
function _verifyCookieData()
{
return ($this->_fetchUserUsingCookies() != false);
}
-
+
// ###################################################################
function _fetchUserWithIdentifier($string)
{
return $this->authDb->query_first("SELECT * FROM users WHERE name = '" . $this->authDb->escape_string($string) . "'");
}
-
+
// ###################################################################
function _verifyLoginUser($password)
{
$this->registry->funct->cookie($this->cookieName);
$this->authDb->query("DELETE FROM sessions WHERE sid = '" . $this->authDb->escape_string($this->_fetchCookieUniqueId()) . "'");
}
-
+
// ###################################################################
function _setCookies($permanent = false)
{
'displayname' => 'name',
'email' => 'email'
);
-
+
/**
* IPB2 table prefix
* @var string
*/
var $tablePrefix;
-
+
/**
* Cookie prefix
* @var string
*/
var $cookiePrefix;
-
+
// ###################################################################
function _setupDatabase()
{
parent::_setupDatabase();
-
+
include 'includes/auth/config.php';
$this->tablePrefix = $config['auth']['IPB2']['tablePrefix'];
$this->cookiePrefix = $config['auth']['IPB2']['cookiePrefix'];
}
-
+
// ###################################################################
function _fetchCookieUniqueId()
{
return $this->registry->input_clean($this->cookiePrefix . 'member_id', TYPE_UINT);
}
-
+
// ###################################################################
function _fetchCookiePassword()
{
return $this->registry->in[$this->cookiePrefix . 'pass_hash'];
}
-
+
// ###################################################################
function _fetchUserUsingCookies()
{
return $this->authDb->query_first("SELECT * FROM {$this->tablePrefix}members WHERE id = " . $this->_fetchCookieUniqueId());
}
-
+
// ###################################################################
function _verifyCookieData()
{
return ($this->_fetchCookiePassword() == $this->authUser['member_login_key']);
}
-
+
// ###################################################################
function _fetchUserWithIdentifier($username)
{
return $this->authDb->query_first("SELECT * FROM {$this->tablePrefix}members WHERE name = '" . $this->authDb->escape_string($username) . "'");
}
-
+
// ###################################################################
function _verifyLoginUser($password)
{
$cvg = $this->authDb->query_first("SELECT * FROM {$this->tablePrefix}members_converge WHERE converge_email = '" . $this->authUser['email'] . "'");
return (md5(md5($cvg['converge_pass_salt']) . md5($password)) == $cvg['converge_pass_hash']);
}
-
+
// ###################################################################
function clearCookies()
{
$this->authDb->query("DELETE FROM {$this->tablePrefix}sessions WHERE id = '" . $this->authDb->escape_string($this->registry->in[$this->cookiePrefix . 'session_id']) . "'");
$this->registry->funct->cookie($this->cookiePrefix . 'session_id');
}
-
+
// ###################################################################
function _setCookies($sticky = false)
{
$this->registry->funct->cookie($this->cookiePrefix . 'member_id', $this->authUser['id']);
$this->registry->funct->cookie($this->cookiePrefix . 'pass_hash', $this->authUser['member_login_key']);
-
+
include 'includes/auth/config.php';
$ip = explode('.', $_SERVER['REMOTE_ADDR']);
$stronghold = md5(md5($this->authUser['id'] . '-' . $ip[0] . '-' . $ip[1] . '-' . $this->authUser['member_login_key']) . md5($config['auth']['dbPassword'] . $config['auth']['dbUser']));
$this->registry->funct->cookie($this->cookiePrefix . 'ipb_stronghold', $stronghold);
-
+
$this->registry->funct->cookie($this->cookiePrefix . 'session_id');
}
}
'displayname' => 'username',
'email' => 'user_email'
);
-
+
/**
* Database table prefix
* @var string
*/
var $phpBBTablePrefix = 'phpbb2_';
-
+
/**
* The cookie name that is set in phpBB -> Administration -> General Admin -> Configuration -> Cookie Settings -> Cookie Name
* @var string
*/
var $cookieName = 'phpbb2mysql';
-
+
// ###################################################################
function _setupDatabase()
{
parent::_setupDatabase();
-
+
include 'includes/auth/config.php';
$this->phpBBTablePrefix = $config['auth']['phpBB2']['tablePrefix'];
$this->cookieName = $config['auth']['phpBB2']['cookieName'];
}
-
+
// ###################################################################
function _fetchCookieUniqueId()
{
$val = $this->registry->in[$this->cookieName . '_sid'];
return (!$val ? -1 : $val); // hack so we don't do stupid things but can still create a session
}
-
+
// ###################################################################
function _fetchCookiePassword()
{
return true;
}
-
+
// ###################################################################
function _fetchUserUsingCookies()
{
return $this->authDb->query_first("SELECT * FROM {$this->phpBBTablePrefix}users WHERE user_id = " . $session['session_user_id']);
}
}
-
+
// ###################################################################
function _verifyCookieData()
{
return ($this->_fetchUserUsingCookies() != false);
}
-
+
// ###################################################################
function _fetchUserWithIdentifier($string)
{
return $this->authDb->query_first("SELECT * FROM {$this->phpBBTablePrefix}users WHERE username = '" . $this->authDb->escape_string($string) . "'");
}
-
+
// ###################################################################
function _verifyLoginUser($password)
{
$this->registry->funct->cookie($this->cookieName . '_sid');
$this->authDb->query("DELETE FROM {$this->phpBBTablePrefix}sessions WHERE session_id = '" . $this->authDb->escape_string($this->_fetchCookieUniqueId()) . "'");
}
-
+
// ###################################################################
function _setCookies($permanent = false)
{
'$sid', " . $this->authUser['user_id'] . ", " . time() . ", " . time() . ", 1
)"
);
-
+
$this->authDb->query("UPDATE {$this->phpBBTablePrefix}users SET user_session_time = " . time() . ", user_lastvisit = " . time() . " WHERE user_id = " . $this->authUser['user_id']);
}
}
* @var string
*/
var $licenseKey = 'LXXXXXXX';
-
+
/**
* The table prefix for all of vBulletin's tables
* @var string
*/
var $vBTablePrefix = '';
-
+
/**
* Fields that map Bugdar fields to vBulletin fields
* @var string
'timezone' => 'timezoneoffset',
'displayname' => 'username'
);
-
+
// ###################################################################
function _setupDatabase()
{
parent::_setupDatabase();
-
+
include 'includes/auth/config.php';
$this->licenseKey = $config['auth']['vBulletin3']['licenseKey'];
$this->vBTablePrefix = $config['auth']['vBulletin3']['tablePrefix'];
}
-
+
// ###################################################################
function _fetchCookieUniqueId()
{
return $this->registry->input_clean('bbuserid', TYPE_UINT);
}
-
+
// ###################################################################
function _fetchCookiePassword()
{
return $this->registry->in['bbpassword'];
}
-
+
// ###################################################################
function _fetchUserUsingCookies()
{
return $this->authDb->query_first("SELECT * FROM {$this->vBTablePrefix}user WHERE userid = " . $this->_fetchCookieUniqueId());
}
-
+
// ###################################################################
function _verifyCookieData()
{
return (md5($this->authUser['password'] . $this->licenseKey) == $this->_fetchCookiePassword());
}
-
+
// ###################################################################
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);
}
-
+
// ###################################################################
function clearCookies()
{
{
return $this->authDb->query_first("SELECT * FROM {$this->vBTablePrefix}user WHERE username = '" . $this->authDb->escape_string($username) . "'");
}
-
+
// ###################################################################
function _verifyLoginUser($password)
{
* @copyright Copyright (c)2002 - 2007, Blue Static
* @version $Revision$
* @package Bugdar
-*
+*
*/
class NavLinks
{
function optionsPages()
{
global $navigator;
-
+
$navigator->add_component('section', 'options-pages', 'options', T('Options'), null);
$navigator->add_component('link', 'options-pages-home', 'options-pages', T('Home'), 'index.php');
$navigator->add_component('link', 'options-pages-settings', 'options-pages', T('Bugdar Settings'), 'setting.php');
$navigator->add_component('link', 'options-pages-languages', 'options-pages', T('Languages'), 'language.php');
$navigator->add_component('link', 'options-pages-userhelp', 'options-pages', T('User Help Items'), 'userhelp.php');
}
-
+
// ###################################################################
/**
* Adding a new language
function languagesAdd()
{
global $navigator;
-
+
$navigator->add_component('section', 'options-languages', 'options', T('Languages'), null);
$navigator->add_component('link', 'options-languages-add', 'options-languages', T('Add New Language'), 'language.php?do=add');
}
-
+
// ###################################################################
/**
* Edit a language
function languagesEdit($id)
{
global $navigator;
-
+
NavLinks::languagesAdd();
$navigator->add_component('link', 'options-languages-edit', 'options-languages', T('Edit Language'), 'language.php?do=edit&languageid=' . $id);
$navigator->add_component('link', 'options-languages-delete', 'options-languages', T('Delete'), 'language.php?do=delete&languageid=' . $id);
}
-
+
// ###################################################################
/**
* Adding a new user help item
function userhelpAdd()
{
global $navigator;
-
+
$navigator->add_component('section', 'options-userhelp', 'options', T('User Help Items'), null);
$navigator->add_component('link', 'options-userhelp-add', 'options-userhelp', T('Add New Item'), 'userhelp.php?do=add');
}
-
+
// ###################################################################
/**
* Adding a new product
function productsAdd()
{
global $navigator;
-
+
$navigator->add_component('section', 'products', 'products', T('Products'), null);
$navigator->add_component('link', 'products-manage', 'products', T('Manage Products'), 'product.php');
$navigator->add_component('link', 'products-add', 'products', T('Add New Product'), 'product.php?do=addproduct');
}
-
+
// ###################################################################
/**
* Editing a product
function productsEdit($id)
{
global $navigator;
-
+
NavLinks::productsAdd();
$navigator->add_component('section', 'products-edit', 'products', T('Edit Product'), null);
$navigator->add_component('link', 'products-edit', 'products-edit', T('Edit Product'), 'product.php?do=editproduct&productid=' . $id);
$navigator->add_component('link', 'products-edit-version', 'products-edit', T('Add New Version'), 'product.php?do=addversion&productid=' . $id);
$navigator->add_component('link', 'products-edit-delete', 'products-edit', T('Delete Product'), 'product.php?do=deleteproduct&productid=' . $id);
}
-
+
// ###################################################################
/**
* Fields tab pages
function fieldsPages()
{
global $navigator;
-
+
$navigator->add_component('section', 'fields-pages', 'fields', T('Fields'), null);
$navigator->add_component('link', 'fields-pages-fields', 'fields-pages', T('Custom Fields'), 'field.php');
$navigator->add_component('link', 'fields-pages-priorities', 'fields-pages', T('Priorities'), 'priority.php');
$navigator->add_component('link', 'fields-pages-statuses', 'fields-pages', T('Statuses'), 'status.php');
$navigator->add_component('link', 'fields-pages-automations', 'fields-pages', T('Automations'), 'automation.php');
}
-
+
// ###################################################################
/**
* Adding an new custom field
function fieldsAdd()
{
global $navigator;
-
+
$navigator->add_component('section', 'fields', 'fields', T('Custom Fields'), null);
$navigator->add_component('link', 'fields-add', 'fields', T('Add New Custom Field'), 'field.php?do=add');
}
-
+
// ###################################################################
/**
* Edit a custom field
function fieldsEdit($id)
{
global $navigator;
-
+
NavLinks::fieldsAdd();
$navigator->add_component('link', 'fields-delete', 'fields', T('Delete'), 'field.php?do=delete&fieldid=' . $id);
}
-
+
// ###################################################################
/**
* Adding an new priority
function prioritiesAdd()
{
global $navigator;
-
+
$navigator->add_component('section', 'priorities', 'fields', T('Priorities'), null);
$navigator->add_component('link', 'priorities-add', 'priorities', T('Add New Priority'), 'priority.php?do=add');
}
-
+
// ###################################################################
/**
* Edit a priority
function prioritiesEdit($id)
{
global $navigator;
-
+
NavLinks::prioritiesAdd();
$navigator->add_component('link', 'priorities-delete', 'priorities', T('Delete'), 'priority.php?do=delete&priorityid=' . $id);
}
-
+
// ###################################################################
/**
* Adding an new resolution
function resolutionsAdd()
{
global $navigator;
-
+
$navigator->add_component('section', 'resolutions', 'fields', T('Resolutions'), null);
$navigator->add_component('link', 'resolutions-add', 'resolutions', T('Add New Resolution'), 'resolution.php?do=add');
}
-
+
// ###################################################################
/**
* Edit a resolution
function resolutionsEdit($id)
{
global $navigator;
-
+
NavLinks::resolutionsAdd();
$navigator->add_component('link', 'resolutions-delete', 'resolutions', T('Delete'), 'resolution.php?do=delete&resolutionid=' . $id);
}
-
+
// ###################################################################
/**
* Adding an new severity
function severitiesAdd()
{
global $navigator;
-
+
$navigator->add_component('section', 'severities', 'fields', T('Severities'), null);
$navigator->add_component('link', 'severities-add', 'severities', T('Add New Severity'), 'severity.php?do=add');
}
-
+
// ###################################################################
/**
* Edit a severity
function severitiesEdit($id)
{
global $navigator;
-
+
NavLinks::severitiesAdd();
$navigator->add_component('link', 'severities-delete', 'severities', T('Delete'), 'severity.php?do=delete&severityid=' . $id);
}
-
+
// ###################################################################
/**
* Adding an new status
function statusesAdd()
{
global $navigator;
-
+
$navigator->add_component('section', 'statuses', 'fields', T('Severities'), null);
$navigator->add_component('link', 'statuses-add', 'statuses', T('Add New Status'), 'status.php?do=add');
}
-
+
// ###################################################################
/**
* Edit a status
function statusesEdit($id)
{
global $navigator;
-
+
NavLinks::statusesAdd();
$navigator->add_component('link', 'statuses-delete', 'statuses', T('Delete'), 'status.php?do=delete&statusid=' . $id);
}
-
+
// ###################################################################
/**
* Adding an new automation
function automationsAdd()
{
global $navigator;
-
+
$navigator->add_component('section', 'automations', 'fields', T('Automations'), null);
$navigator->add_component('link', 'automations-add', 'automations', T('Add New Automation'), 'automation.php?do=add');
}
-
+
// ###################################################################
/**
* Edit an automation
function automationsEdit($id)
{
global $navigator;
-
+
NavLinks::automationsAdd();
$navigator->add_component('link', 'automations-delete', 'automations', T('Delete'), 'automation.php?do=delete&actionid=' . $id);
}
-
+
// ###################################################################
/**
* User tab pages
function usersPages()
{
global $navigator;
-
+
$navigator->add_component('section', 'users-pages', 'users', T('Users & Permissions'), null);
$navigator->add_component('link', 'users-pages-users', 'users-pages', T('Users'), 'user.php');
$navigator->add_component('link', 'users-pages-usergroups', 'users-pages', T('Usergroups'), 'usergroup.php');
$navigator->add_component('link', 'users-pages-permissions', 'users-pages', T('Product-Level Permissions'), 'permission.php');
$navigator->add_component('link', 'users-pages-purge', 'users-pages', T('Purge Inactive Users'), 'purge_inactive.php');
}
-
+
// ###################################################################
/**
* Add a new user
function usersAdd()
{
global $navigator;
-
+
$navigator->add_component('section', 'users', 'users', T('Users'), null);
$navigator->add_component('link', 'users-showall', 'users', T('Show All Users'), 'user.php?do=showall');
$navigator->add_component('link', 'users-add', 'users', T('Add New User'), 'user.php?do=add');
}
-
+
// ###################################################################
/**
* Edit a user
function usersEdit($id)
{
global $navigator;
-
+
NavLinks::usersAdd();
$navigator->add_component('link', 'users-delete', 'users', T('Delete'), 'user.php?do=delete&userid=' . $id);
}
-
+
// ###################################################################
/**
* Add a new usergroup
function usergroupsAdd()
{
global $navigator;
-
+
$navigator->add_component('section', 'usergroups', 'users', T('Usergroups'), null);
$navigator->add_component('link', 'usergroups-add', 'usergroups', T('Add New Usergroup'), 'usergroup.php?do=add');
$navigator->add_component('link', 'usergroups-approve', 'usergroups', T('Moderate Awaiting Users'), 'usergroup.php?do=approve');
}
-
+
// ###################################################################
/**
* Edit a usergroup
function usergroupsEdit($id)
{
global $navigator;
-
+
NavLinks::usergroupsAdd();
$navigator->add_component('link', 'usergroups-delete', 'usergroups', T('Delete'), 'usergroup.php?do=delete&userid=' . $id);
}
* @copyright Copyright (c)2002 - 2007, Blue Static
* @version $Revision$
* @package Bugdar
-*
+*
*/
class API_Error_Handler
{
* @access private
*/
var $object = null;
-
+
// ###################################################################
/**
* Constructor: set the actionable object
{
$this->object =& $obj;
}
-
+
// ###################################################################
/**
* The user-end cumulative reporter requires that the class be
{
$this->object->addError($error);
}
-
+
// ###################################################################
/**
* This calls the simple ISSO.Printer error message for the
* @copyright Copyright (c)2002 - 2007, Blue Static
* @version $Revision$
* @package Bugdar
-*
+*
*/
class Logging
{
* @access private
*/
var $bugid = 0;
-
+
/**
* Attachment ID
* @var integer
* @access private
*/
var $attachmentid = 0;
-
+
/**
* Comment ID
* @var integer
* @access private
*/
var $commentid = 0;
-
+
/**
* The original data to compare against
* @var array
* @access private
*/
var $original = array();
-
+
/**
* Modified data
* @var array
* @access private
*/
var $modified = array();
-
+
/**
* Compared/diff'd data
* @var array
* @access private
*/
var $compared = array();
-
+
// ###################################################################
/**
* Sets the bug ID for the current logging instance
global $bugsys;
$this->bugid = $bugsys->clean($id, TYPE_UINT);
}
-
+
// ###################################################################
/**
* Sets the attachment ID for the current logging instance
global $bugsys;
$this->attachmentid = $bugsys->clean($id, TYPE_UINT);
}
-
+
// ###################################################################
/**
* Sets the current comment ID to be logged
global $bugsys;
$this->commentid = $bugsys->clean($id, TYPE_UINT);
}
-
+
// ###################################################################
/**
* Assigns data into the $this->original or $this->modified array based
{
$array = ($orig ? 'original' : 'modified');
$prefix .= '.';
-
+
if ($exclude == false)
{
foreach ($fields AS $fname => $fdisplay)
{
$fname = $fdisplay;
}
-
+
$this->{$array}["$prefix$fdisplay"] = array('name' => $fname, 'value' => $data["$fname"]);
}
}
}
}
}
-
+
// ###################################################################
/**
* Populates the $this->compared array as a diff between the original
}
}
}
-
+
// ###################################################################
/**
* Runs $this->compare_arrays() and then takes the result and prepares
function update_history()
{
global $bugsys;
-
+
$this->compare_arrays();
-
+
foreach ($this->compared AS $field => $values)
{
$bugsys->db->query("
");
}
}
-
+
// ###################################################################
/**
* Returns an array of the fields commonly ignored
* @access private
*/
var $errors = array();
-
+
/**
* The processed text for a compound error
* @var string
* @access private
*/
var $errorBox = '';
-
+
// ###################################################################
/**
* Adds an error to the cumulative error list
{
$this->errors[] = $message;
}
-
+
// ###################################################################
/**
* Returns TRUE if there are any errors from addError(), and FALSE if
{
return false;
}
-
+
$this->errorBox = "\n\n<ol style=\"list-style-type: decimal\">";
foreach ($this->errors AS $err)
{
$this->errorBox .= "\n\t<li>" . $err . "</li>";
}
$this->errorBox .= "\n</ol>";
-
+
return true;
}
-
+
// ###################################################################
/**
* Throws an actual error. If an error text is passed, it takes
{
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') . '");');
exit;
}
-
+
// ###################################################################
/**
* Throws a common no-permission error
{
$this->error(T('You do not have permission to access this page. If you think that this is an error, please contact an administrator.'));
}
-
+
// ###################################################################
/**
* Performs a front-end redirect by either header or <meta>
{
global $bugsys;
global $doctype, $header, $headinclude, $footer, $focus, $show, $stylevar;
-
+
if ($bugsys->options['redirectheaders'])
{
header("Location: $url");
exit;
}
-
+
eval('$bugsys->template->flush("' . $bugsys->template->fetch('std_redirect') . '");');
exit;
}
-
+
// ###################################################################
/**
* Displays a fatal warning/notice that is usually not an error
{
global $bugsys;
global $doctype, $header, $headinclude, $footer, $focus, $show, $stylevar;
-
+
eval('$bugsys->template->flush("' . $bugsys->template->fetch('std_message') . '");');
exit;
}
-
+
// ###################################################################
/**
* Displays a standard message template with extra confirm data on it
{
global $bugsys;
global $doctype, $header, $headinclude, $footer, $focus, $show, $stylevar;
-
+
$show['confirm'] = true;
-
+
foreach ($arrextra AS $name => $value)
{
$extra .= '<input type="hidden" name="' . $name . '" value="' . $value . '" />' . "\n";
}
-
+
eval('$bugsys->template->flush("' . $bugsys->template->fetch('std_message') . '");');
exit;
}
* @var string
*/
var $filename;
-
+
/**
* The file pointer of the MO file
* @var resource
*/
var $file = null;
-
+
/**
* Is the MO file a big endian one?
* @var boolean
*/
var $bigEndian = false;
-
+
/**
* The string table as an array
* @var array
*/
var $strings = array();
-
+
/**
* Creates a new MOReader given a path to a MO file
*/
$this->filename = $filename;
$this->_loadFile();
}
-
+
/**
* Returns the translated string for T, or the original if none exists
- *
+ *
* @param string Native string to look up a translation for
*
* @return string
}
return $this->strings[$str];
}
-
+
/**
* Reads $size number of bytes
- *
+ *
* @param integer Number of bytes to read
*
* @return string
return unpack('V' . $size, $stream);
}
}
-
+
/**
* Lodas the MO data information into the stirng table
*/
function _loadFile()
{
global $bugsys;
-
+
$this->file = @fopen($this->filename, 'r');
if (!$this->file)
{
$bugsys->debug("could not open MO file {$this->filename}");
return;
}
-
+
// read the magic number
$stream = $this->_readBytes(1);
$stream = dechex($stream[1]);
{
trigger_error('Invalid MO file format');
}
-
+
// read the revision (unused in MOs)
$this->_readBytes(1);
-
+
// read the number of strings
$count = $this->_readBytes(1);
$count = $count[1];
-
+
// get the start positions of the original and translated tables
$offsetO = $this->_readBytes(1);
$offsetT = $this->_readBytes(1);
-
+
fseek($this->file, $offsetO[1]);
$tableO = $this->_readBytes(2 * $count);
fseek($this->file, $offsetT[1]);
$tableT = $this->_readBytes(2 * $count);
-
+
for ($i = 0; $i < $count; $i++)
{
if ($tableO[$i * 2 + 1] > 0)
fseek($this->file, $tableO[$i * 2 + 2]);
$O = fread($this->file, $tableO[$i * 2 + 1]);
}
-
+
if ($tableT[$i * 2 + 1] > 0)
{
fseek($this->file, $tableT[$i * 2 + 2]);
$this->strings[$O] = fread($this->file, $tableT[$i * 2 + 1]);
}
}
-
+
fclose($this->file);
}
}
/**
* Notification Center
*
-* This class determines which emails need to be sent out based on user
+* 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)2002 - 2007, Blue Static
* @version $Revision$
* @package Bugdar
-*
+*
*/
class NotificationCenter
{
* @access private
*/
var $bug = array();
-
+
/**
* Original bug data
* @var array
* @access private
*/
var $original = array();
-
+
/**
* Modified bug data
* @var array
* @access private
*/
var $modified = array();
-
+
/**
* Global bugsys registry
* @var object
* @access private
*/
var $registry = null;
-
+
/**
* Role list: a list of user IDs with their relations to the bug
* @var array
'voter' => array(),
'commenter' => array()
);
-
+
/**
* User cache list
* @var array
* @access private
*/
var $users = array();
-
+
/**
* A list of notices per-user that are combined together in NotificationCenter::finalize()
* @var array
* @access private
*/
var $notices = array();
-
+
// ###################################################################
/**
* Constructor: set database objects
function __construct()
{
global $bugsys;
-
+
$this->registry =& $bugsys;
}
-
+
// ###################################################################
/**
* (PHP 4) Constructor
{
$this->__construct();
}
-
+
// ###################################################################
/**
* Sets the bug data so that all methods in this class have access to
{
$this->bug = $original;
}
-
+
$this->original = $original;
$this->modified = $modified;
-
+
$this->roles['-notapplicable-'] = (sizeof($modified) > 0 ? array($original['assignedto'], $modified['assignedto']) : array($original['assignedto']));
$this->roles['reporter'] = array($original['userid']);
$this->roles['assignee'][] = (sizeof($modified) > 0 ? $modified['assignedto'] : $original['assignedto']);
-
+
$this->fetch_user_cache();
}
-
+
// ###################################################################
/**
* Fetches all the users who could be related to the bug and sticks
{
$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))
{
$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));
$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))
{
$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));
-
+
if (is_array($masterids) AND sizeof($masterids) > 0)
{
$userinfo = $this->registry->db->query("
}
}
}
-
+
// ###################################################################
/**
* Sends the appropriate emails for changes to bugs. This function
{
return;
}
-
+
// fields with custom mask information
if ($this->original['assignedto'] != $this->modified['assignedto'])
{
{
$this->notice_duplicates_change($this->original['duplicates'], $this->modified['duplicates']);
}
-
+
// other standard fields that don't have custom masks
if ($this->original['severity'] != $this->modified['severity'])
{
{
$this->notice_pcv_change(array($this->original['product'], $this->original['component'], $this->original['version']), array($this->modified['product'], $this->modified['component'], $this->modified['version']));
}
-
+
$dofields = array(
'summary' => -1,
'dependency' => -1,
}
}
}
-
+
// ###################################################################
/**
* Sends an email to the specified user ID that they are no longer the
$this->notices["$userid"][] = $part;
}
}
-
+
// ###################################################################
/**
* Informs the user that they have been made the assignee of the bug.
$this->notices["$userid"][] = $email;
}
}
-
+
// ###################################################################
/**
* Sends a message to inform users that the status has changed.
$this->notices["$user[userid]"][] = $email;
}
}
-
+
// ###################################################################
/**
* Sends an email to inform users that the resolution has changed.
$this->notices["$user[userid]"][] = $email;
}
}
-
+
// ###################################################################
/**
* Informs users that the duplicates list has changed.
$this->notices["$user[userid]"][] = $email;
}
}
-
+
// ###################################################################
/**
* Sends an email to inform users that the severity has changed.
$this->notices["$user[userid]"][] = $email;
}
}
-
+
// ###################################################################
/**
* Informs users that the priority changed.
$this->notices["$user[userid]"][] = $email;
}
}
-
+
// ###################################################################
/**
* Sends an email telling users that the product, component, or version
function notice_pcv_change($old, $new)
{
$userlist = $this->fetch_users_with_on_bit('otherfield');
-
+
$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'];
-
+
foreach ($userlist AS $userid => $user)
{
eval('$email = "' . $this->registry->template->fetch(FetchEmailPath('notice_product.part', $this->_localeFromUserId($userid))) . '";');
$this->notices["$user[userid]"][] = $email;
}
}
-
+
// ###################################################################
/**
* Sends the appropriate users information about a new comment being
{
$user = construct_user_display($this->registry->userinfo, false);
$date = $this->registry->modules['date']->format($this->registry->options['dateformat'], $comment['dateline']);
-
+
eval('$email = "' . $this->registry->template->fetch(FetchEmailPath('notice_comment.part', $this->_localeFromUserId($userid))) . '";');
$this->notices["$userid"][] = $email;
}
}
-
+
// ###################################################################
/**
* A notice for an individual field changing.
$this->notices["$user[userid]"][] = $email;
}
}
-
+
// ###################################################################
/**
* Sends appropriate users a notice when a new attachment has been
{
$user = construct_user_display($this->registry->userinfo, false);
$obsoletes = implode(', ', (array)$obsolete);
-
+
eval('$email = "' . $this->registry->template->fetch(FetchEmailPath('notice_attachment.part', $this->_localeFromUserId($userid))) . '";');
$this->notices["$userid"][] = $email;
}
}
-
+
// ###################################################################
/**
* Sends a new bug notification notice to all those who have the option
$this->users["$userInfo[userid]"]['options']["$userInfo[relation]"] = $userInfo['mask'];
}
}
-
+
// ###################################################################
/**
* Generates an array of users who have a given email notification flag
function fetch_users_with_on_bit($bitname)
{
$idlist = array();
-
+
foreach ($this->users AS $user)
{
foreach ($this->registry->emailoptions['relations'] AS $name => $bit)
}
}
}
-
+
$masters = array_unique($idlist);
-
+
$return = array();
foreach ($masters AS $userid)
{
$return["$userid"] =& $this->users["$userid"];
}
-
+
return $return;
}
-
+
// ###################################################################
/**
* Compiles and sends the actual emails to users.
$this->registry->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");
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']);
-
+
if (!empty($this->users["$userid"]['email']))
{
$this->registry->mail->send($this->users["$userid"]['email'], $this->users["$userid"]['displayname']);
}
}
}
-
+
// ###################################################################
/**
* Returns the locale name from a given user ID
* @copyright Copyright (c)2002 - 2007, Blue Static
* @version $Revision$
* @package Bugdar
-*
+*
*/
class ListSorter
{
* @access private
*/
var $registry;
-
+
/**
* Page name
* @var string
* @access public
*/
var $page = '';
-
+
/**
* Current sort key
* @var string
* @access private
*/
var $sortkey = '';
-
+
/**
* Current sort direction
* @var string
* @access private
*/
var $direction = '';
-
+
/**
* Column array for table heads
* @var array
*/
var $columns;
-
+
// ###################################################################
/**
* Constructor: set the page name
$this->page = $page;
$this->process_incoming();
}
-
+
// ###################################################################
/**
* Processes the incoming variables and then sets all the sort order
{
$this->sortkey = (isset($this->registry->userinfo['defaultsortkey']) ? $this->registry->userinfo['defaultsortkey'] : $this->registry->options['defaultsortkey']);
}
-
+
$this->direction = $this->registry->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']);
}
}
-
+
// ###################################################################
/**
* Fetch a SQL query to gather bugs with the sort filters applied
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']) . ")" : "");
-
+
// remap the sort keys to be actual SQL fields
$querykeys = array(
'bugid' => 'bugid',
'lastpost' => (can_perform('canviewhidden') ? "lastposttime" : "hiddenlastposttime"),
'assignedto'=> 'assignedto'
);
-
+
switch ($this->sortkey)
{
case 'bugid':
SELECT bug.*, vote.votefor, vote.voteagainst FROM " . TABLE_PREFIX . "bug AS bug
LEFT JOIN " . TABLE_PREFIX . "vote AS vote
ON (bug.bugid = vote.bugid)
- WHERE $basewhere" .
+ WHERE $basewhere" .
(is_array($where) ? "
AND " . implode("\nAND ", $where) : "") . "
ORDER BY " . $querykeys[ $this->sortkey ] . " " . strtoupper($this->direction) . ($this->sortkey != 'lastpost' ? ", " . $querykeys['lastpost'] . " " . strtoupper($this->direction) : "") . ($limit ? "
ON (bug.$key = $key.{$key}id)
LEFT JOIN " . TABLE_PREFIX . "vote AS vote
ON (bug.bugid = vote.bugid)
- WHERE $basewhere" .
+ WHERE $basewhere" .
(is_array($where) ? "
AND " . implode("\nAND ", $where) : "") . "
ORDER BY $key.displayorder " . strtoupper($this->direction) . ", bug.$querykeys[lastpost] " . strtoupper($this->direction) . ($limit ? "
SELECT bug.*, vote.votefor, vote.voteagainst FROM " . TABLE_PREFIX . "bug AS bug
LEFT JOIN " . TABLE_PREFIX . "vote AS vote
ON (bug.bugid = vote.bugid)
- WHERE $basewhere" .
+ 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 ? "
LIMIT $limit" : "");
break;
}
-
+
return $query;
}
-
+
// ###################################################################
/**
* Returns the display text for a given sort order key
function fetch_by_text($key)
{
global $lang;
-
+
$keys = array(
'lastpost' => T('Last Post Time'),
'bugid' => T('Bug ID'),
'votes' => T('Votes'),
'assignedto' => T('Assigned To')
);
-
+
if ($key === false)
{
return $keys;
return $keys["$key"];
}
}
-
+
// ###################################################################
/**
* Returns the display text for a given sort order direction
function fetch_as_text($key)
{
global $lang;
-
+
$keys = array(
'desc' => T('Descending'),
'asc' => T('Ascending')
);
-
+
if ($key === false)
{
return $keys;
return $keys["$key"];
}
}
-
+
// ###################################################################
/**
* Returns a multi-dimensional array with sort by keys indexing arrays
{
$return["$key"] = array('image' => ($this->sortkey == $key ? $this->fetch_sort_image() : ''), 'href' => $this->fetch_sort_link($key, $params, true));
}
-
+
return $return;
}
-
+
// ###################################################################
/**
* Returns the entire <img> tag for the sort arrow
{
return '<img src="templates/images/arrow_' . $this->fetch_sort_direction() . '.gif" alt="" style="vertical-align: top; border: none" />';
}
-
+
// ###################################################################
/**
* Returns the href value for an <a> tag by generating all the necessary
{
$params .= '&';
}
-
+
return $this->page . '.php?' . $params . 'by=' . $key . '&as=' . (($this->sortkey == $key AND $highlight) ? $this->fetch_opposite_sort_direction() . '" class="select' : $this->fetch_sort_direction());
}
-
+
// ###################################################################
/**
* Returns the OPPOSITE direction to sort when you click on a link
* @return string Either asc or desc
*/
function fetch_opposite_sort_direction()
- {
+ {
if ($this->direction == 'asc')
{
return 'desc';
return 'asc';
}
}
-
+
// ###################################################################
/**
* Returns the current sorted direction for the image path
* @return string Either asc or desc
*/
function fetch_sort_direction()
- {
+ {
return $this->direction;
}
-
+
// ###################################################################
/**
* Returns the HTML code for bug listing table column headers
function constructColumnHeaders($sortable, $params = null)
{
$this->_processColumns();
-
+
$output = '';
foreach ($this->columns AS $columns)
{
$name = implode(' / ', $build);
eval('$output .= "' . $this->registry->template->fetch('list_head') . '";');
}
-
+
return $output;
}
-
+
// ###################################################################
/**
* Returns the HTML code for a row of data for the bug listing
function constructRow($bug, $params = null)
{
global $bugsys;
-
+
$this->_processColumns();
-
+
foreach ($this->columns AS $columns)
{
if (sizeof($columns) > 1)
}
$fields .= "\n\t<td>$data</td>";
}
-
+
eval('$output = "' . $this->registry->template->fetch('trackerhome_bits') . '";');
return $output;
}
-
+
// ###################################################################
/**
* Handler for special-case column data
return $open . $bug["$column"] . $close;
}
}
-
+
// ###################################################################
/**
* Sets up $this->columns so that the data can be processed more
{
return;
}
-
+
$array = (($this->registry->userinfo['userid'] AND is_array($this->registry->userinfo['columnoptions'])) ? $this->registry->userinfo['columnoptions'] : $this->registry->options['columnoptions']);
-
+
foreach ($array AS $column => $position)
{
if ($position > 0)
$this->columns["$position"][] = $column;
}
}
-
+
ksort($this->columns);
}
}
function construct_option_select($name, $array, $selected = 0, $valuekey = '', $labelkey = '', $includenil = false, $multiple = false)
{
global $bugsys;
-
+
if ($multiple)
{
$selected = explode(',', $selected);
}
-
+
// if we're not working on a boolean false, we use it for the value (allows -1 and 0)
if ($includenil !== false)
{
function construct_user_display($userinfo, $html = true)
{
global $bugsys;
-
+
if (!$userinfo['userid'])
{
$userinfo['displayname'] = T('Guest');
$userinfo['showemail'] = false;
}
-
+
if ($html)
{
eval('$username = "' . $bugsys->template->fetch('username_display') . '";');
$username = $userinfo['displayname'];
}
}
-
+
return $username;
}
function can_perform($bitmask, $productid = 0, $userinfo = null)
{
global $bugsys;
-
+
// masks that aren't product-specific
static $inspecific = array(
'cansearch',
'canadmingroups',
'canadmintools'
);
-
+
if ($userinfo == null)
{
$userinfo =& $bugsys->userinfo;
}
-
+
$permissions =& bugdar::$datastore['permission'];
-
+
if (!isset($bugsys->permissions["$bitmask"]))
{
trigger_error('Invalid bitmask "' . $bitmask . '" specified for can_perform() [includes/functions.php]', E_USER_WARNING);
}
-
+
if (!$userinfo['permissions'])
{
$userinfo['permissions'] = FetchUserPermissions($userinfo);
}
-
+
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"]));
-
+
foreach ($userinfo['groupids'] AS $group)
{
if (isset($permissions["$group"]["$productid"]))
$bugsys->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"]);
}
function construct_datastore_select($datastore, $labelname, $valuename, $selectedvalue = 0, $includeblank = false, $adminmode = false)
{
global $bugsys;
-
+
if ($adminmode)
{
global $admin;
}
-
+
$select = '';
-
+
if ($includeblank === true OR $includeblank !== false)
{
$newval = ($inclueblank === true ? '' : $includeblank);
eval('$select .= "' . $bugsys->template->fetch('selectoption') . '";');
}
}
-
+
foreach (bugdar::$datastore["$datastore"] AS $item)
{
$label = $item["$labelname"];
$value = $item["$valuename"];
$selected = (($value == $selectedvalue OR (is_array($selectedvalue) AND in_array($value, $selectedvalue))) ? true : false);
-
+
if ($adminmode)
{
$admin->list_item($label, $value, $selected);
eval('$select .= "' . $bugsys->template->fetch('selectoption') . '";');
}
}
-
+
if (!$adminmode)
{
return $select;
{
global $bugsys;
static $fields;
-
+
if (!is_array($fields))
{
$fields = array();
$fields["$field[fieldid]"] = $field;
}
}
-
+
$fieldbits = array();
-
+
foreach ($fields AS $field)
{
if ($nodefault)
{
$field['defaultvalue'] = '';
}
-
+
if (!is_null($bug["custom$field[fieldid]"]))
{
$bugsys->debug("not null: $field[fieldid]");
{
$value = $field['defaultvalue'];
}
-
+
if ($ignore21mask AND $field['mask'] != 0)
{
$field['mask'] = 2;
}
-
+
if ($field['mask'] == 2)
{
switch ($field['type'])
case 'input_text':
eval('$tempfield = "' . $bugsys->template->fetch('bugfield_input_text') . '";');
break;
-
+
case 'input_checkbox':
$selected = ($value ? ' checked="checked"' : '');
eval('$tempfield = "' . $bugsys->template->fetch('bugfield_input_checkbox') . '";');
break;
-
+
case 'select_single':
$selects = unserialize($field['selects']);
$value = trim($value);
-
+
$options = '';
-
+
// this overrides $field['usedefault'] because required fields will no longer have
// blank values as options
// TODO document above comment in the ACP
}
eval('$options .= "' . $bugsys->template->fetch('bugfield_select_single_option') . '";');
}
-
+
foreach ($selects AS $id => $select)
{
$selected = '';
{
$value = $bug["custom$field[fieldid]"];
}
-
+
if ($field['type'] == 'input_checkbox')
{
$value = ($value ? 'True' : 'False');
}
$fieldbits[] = $tempfield;
}
-
+
return $fieldbits;
}
function process_custom_fields(&$bugapi, &$msg, $errorbox = false, $searchMode = false)
{
global $bugsys;
-
+
if (!$inputdata)
{
$inputdata =& $bugsys->in;
}
-
+
$fields = $bugsys->db->query("
SELECT bugfield.*, MAX(permission.mask) AS mask
FROM " . TABLE_PREFIX . "bugfield AS bugfield
while ($field = $bugsys->db->fetch_array($fields))
{
$fieldname = "custom$field[fieldid]";
-
+
if ($field['type'] == 'input_checkbox')
{
if ($searchMode AND intval($inputdata["$fieldname"]) == 0)
$temp = unserialize($field['selects']);
$inputdata[$fieldname] = $temp[intval($inputdata["$fieldname"])] . ''; // make it a string so isset() doesn't catch
}
-
+
// field data wasn't passed, so skip it
if (!isset($inputdata["$fieldname"]))
{
continue;
}
-
+
if ($field['required'] AND empty($inputdata["$fieldname"]) AND !$searchMode)
{
$errorlist[] = sprintf(T('The field "%1$s" is a required.'), $field['name']);
continue;
}
-
+
if (!empty($field['regexmatch']))
{
if (!preg_match('#' . str_replace('#', '\#', $field['regexmatch']) . '#si', $inputdata["$fieldname"]))
continue;
}
}
-
+
if (isset($inputdata["$fieldname"]))
{
if ($field['type'] == 'input_text')
}
continue;
}
-
+
$bugapi->set($fieldname, trim($inputdata["$fieldname"]));
}
}
}
-
+
if ($errorlist)
{
if ($errorbox)
function fetch_on_bits($mask, $userinfo = null)
{
global $bugsys;
-
+
if ($userinfo == null)
{
$userinfo =& $bugsys->userinfo;
}
-
+
$onbits = array();
-
+
$usergroupid = $userinfo['usergroupid'];
FetchUserPermissions($userinfo); // get the groups
$groups = $userinfo['groupids'];
$groups[] = $usergroupid;
-
+
// product-inspecific work
if (is_array(bugdar::$datastore['product']))
{
}
}
}
-
+
// bits set explicitly by products
$explicit = array();
-
+
// product specific work
foreach ($groups AS $groupid)
{
}
}
}
-
+
// SQL queries would become very unhappy if we didn't do this
if (sizeof($onbits) < 1)
{
$onbits = array(0);
}
-
+
return implode(',', $onbits);
}
}
// ###################### Start fetch_help_link ######################
-// returns a prepared link to insert into templates that opens up a
+// returns a prepared link to insert into templates that opens up a
// help popup in the user-end
function fetch_help_link($topic)
{
function fetch_guest_user()
{
global $bugsys;
-
+
return array(
'usergroupid' => 1,
'groupids' => array(),
{
$userinfo = $bugsys->userinfo;
}
-
+
$bugsys->debug("checking permissions for $userinfo[userid] on bug $bug[bugid]");
-
+
$bugsys->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']));
-
+
$bugsys->debug('*** END PERMISSIONS CHECK ***');
if (!can_perform('canviewbugs', $bug['product'], $userinfo)) {
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'] ? bugdar::$datastore['status']["$bug[status]"]['color'] : $color);
$bug['product'] = bugdar::$datastore['product']["$bug[product]"]['title'];
$bug['version'] = bugdar::$datastore['version']["$bug[version]"]['version'];
$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']);
-
+
return $bug;
}
function LoadPaginationFramework()
{
global $bugsys;
-
+
$bugsys->load('pagination', 'pagination', true);
$bugsys->pagination->setDefaultPerPage($bugsys->options['defaultpp']);
$bugsys->pagination->setMaxPerPage($bugsys->options['maxpp']);
function FetchUserPermissions(&$user)
{
global $bugsys;
-
+
$perms = (int)bugdar::$datastore['usergroup']["$user[usergroupid]"]['permissions'];
if (!is_array($user['groupids']))
{
$user['groupids'] = explode(',', $bugsys->userinfo['groupids']);
}
$user['groupids'] = $bugsys->funct->array_strip_empty($user['groupids']);
-
+
foreach ($user['groupids'] AS $group)
{
$perms |= (int)bugdar::$datastore['usergroup']["$group"]['permissions'];
}
-
+
return $perms;
}
function build_languages()
{
global $bugsys;
-
+
$languages = $bugsys->db->query("SELECT * FROM " . TABLE_PREFIX . "language");
while ($language = $bugsys->db->fetch_array($languages))
{
$tempstore["$language[languageid]"] = $language;
}
-
+
$bugsys->db->query("
### replacing the language cache ###
REPLACE INTO " . TABLE_PREFIX . "datastore (title, data)
function build_settings()
{
global $bugsys;
-
+
$settings = $bugsys->db->query("SELECT * FROM " . TABLE_PREFIX . "setting");
while ($setting = $bugsys->db->fetch_array($settings))
{
$options["$setting[varname]"] = $setting['value'];
}
-
+
$bugsys->db->query("
### replacing the setting cache ###
REPLACE INTO " . TABLE_PREFIX . "datastore (title, data)
VALUES ('setting', '" . $bugsys->escape(serialize($options)) . "')"
);
-
+
bugdar::$datastore['setting'] = $options;
}
function build_usergroups()
{
global $bugsys;
-
+
$usergroups = $bugsys->db->query("SELECT * FROM " . TABLE_PREFIX . "usergroup");
while ($usergroup = $bugsys->db->fetch_array($usergroups))
{
$groups["$usergroup[usergroupid]"] = $usergroup;
}
-
+
$bugsys->db->query("
### replacing usergroup cache ###
REPLACE INTO " . TABLE_PREFIX . "datastore (title, data)
VALUES ('usergroup', '" . $bugsys->escape(serialize($groups)) . "')"
);
-
+
bugdar::$datastore['usergroup'] = $groups;
}
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))
{
$tempstore["$status[statusid]"] = $status;
}
-
+
$bugsys->db->query("
### replacing status cache ###
REPLACE INTO " . TABLE_PREFIX . "datastore (title, data)
VALUES ('status', '" . $bugsys->escape(serialize($tempstore)) . "')"
);
-
+
bugdar::$datastore['status'] = $tempstore;
}
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))
{
$tempstore["$severity[severityid]"] = $severity;
}
-
+
$bugsys->db->query("
### replacing severity cache ###
REPLACE INTO " . TABLE_PREFIX . "datastore (title, data)
VALUES ('severity', '" . $bugsys->escape(serialize($tempstore)) . "')"
);
-
+
bugdar::$datastore['severity'] = $tempstore;
}
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))
{
$tempstore["$priority[priorityid]"] = $priority;
}
-
+
$bugsys->db->query("
### replacing priority cache ###
REPLACE INTO " . TABLE_PREFIX . "datastore (title, data)
VALUES ('priority', '" . $bugsys->escape(serialize($tempstore)) . "')"
);
-
+
bugdar::$datastore['priority'] = $tempstore;
}
function build_assignedto()
{
global $bugsys;
-
+
// determine the groups that are assignable
$ids = $exprs = array();
foreach (bugdar::$datastore['usergroup'] AS $id => $group)
$exprs[] = "FIND_IN_SET($id, groupids)";
}
}
-
+
$ids = implode(',', $ids);
$exprs = implode(' OR ', $exprs);
$users = $bugsys->db->query("
{
$devs["$user[userid]"] = $user;
}
-
+
$bugsys->db->query("
### replacing developer / assign to cache ###
REPLACE INTO " . TABLE_PREFIX . "datastore (title, data)
VALUES ('assignto', '" . $bugsys->escape(serialize($devs)) . "')"
);
-
+
bugdar::$datastore['assignto'] = $devs;
}
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))
{
$tempstore["$resolution[resolutionid]"] = $resolution;
}
-
+
$bugsys->db->query("
### replacing resolution cache ###
REPLACE INTO " . TABLE_PREFIX . "datastore (title, data)
VALUES ('resolution', '" . $bugsys->escape(serialize($tempstore)) . "')"
);
-
+
bugdar::$datastore['resolution'] = $tempstore;
}
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))
{
$tempstore["$version[versionid]"] = $version;
}
-
+
$bugsys->db->query("
### replacing version cache ###
REPLACE INTO " . TABLE_PREFIX . "datastore (title, data)
VALUES ('version', '" . $bugsys->escape(serialize($tempstore)) . "')"
);
-
+
bugdar::$datastore['version'] = $tempstore;
}
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))
{
$tempstore['product']["$product[productid]"] = $product;
}
}
-
+
$bugsys->db->query("
### replacing product / component cache ###
REPLACE INTO " . TABLE_PREFIX . "datastore (title, data)
('product', '" . $bugsys->escape(serialize($tempstore['product'])) . "'),
('component', '" . $bugsys->escape(serialize($tempstore['component'])) . "')"
);
-
+
bugdar::$datastore['product'] = $tempstore['product'];
bugdar::$datastore['component'] = $tempstore['component'];
}
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))
{
$tempstore["$permission[usergroupid]"]["$permission[productid]"] = $permission['mask'];
}
-
+
$bugsys->db->query("
### replacing permissions cache ###
REPLACE INTO " . TABLE_PREFIX . "datastore (title, data)
VALUES ('permission', '" . $bugsys->escape(serialize($tempstore)) . "')"
);
-
+
bugdar::$datastore['permission'] = $tempstore;
}
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))
{
$actions["$automation[actionid]"] = $automation;
}
-
+
$bugsys->db->query("
### replacing automation cache ###
REPLACE INTO " . TABLE_PREFIX . "datastore (title, data)
VALUES ('automation', '" . $bugsys->escape(serialize($actions)) . "')"
);
-
+
bugdar::$datastore['automation'] = $actions;
}
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))
{
$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))
{
$help["$field[keystring]"] = $field;
}
-
+
$bugsys->db->query("
### replacing user help cache ###
REPLACE INTO " . TABLE_PREFIX . "datastore (title, data)
VALUES ('help', '" . $bugsys->escape(serialize($help)) . "')"
);
-
+
bugdar::$datastore['help'] = $help;
}
function ConstructProductSelect($action = 'canviewbugs', $select = null, $obsolete = true)
{
global $bugsys;
-
+
$output = '';
-
+
// index all of the components by parent and ID
$components = array();
if (is_array(bugdar::$datastore['component']))
$components["$prod[parentid]"]["$id"] = $prod;
}
}
-
+
// these are products
foreach (bugdar::$datastore['product'] AS $productid => $product)
{
{
continue;
}
-
+
if ($versions = ConstructVersionSelect($productid, $select, $obsolete))
{
$output .= ConstructOptionGroup($product['title'], $versions);
}
-
+
// these are components
if ($components["$productid"])
{
}
}
}
-
+
return $output;
}
function ConstructVersionSelect($productid, $select, $obsolete)
{
global $bugsys;
-
+
$product = bugdar::$datastore['product']["$productid"];
$component = null;
-
+
$build = '';
-
+
// this is a component
if ($product == null)
{
$component = bugdar::$datastore['component']["$productid"];
$product = bugdar::$datastore['product']["$component[parentid]"];
}
-
+
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)))
eval('$build .= "' . $bugsys->template->fetch('selectoption') . '";');
}
}
-
+
return $build;
}
function fetch_user_language()
{
global $bugsys;
-
+
if ($bugsys->userinfo['userid'])
{
$languageid = $bugsys->userinfo['languageid'];
$language = bugdar::$datastore['language']["$languageid"];
}
-
+
if (!$languageid AND is_array(bugdar::$datastore['language']))
{
foreach (bugdar::$datastore['language'] AS $language)
}
}
}
-
+
$lang['id'] = $language['languageid'];
$lang['charset'] = $language['charset'];
$lang['direction'] = $language['direction'];
$lang['langcode'] = $language['langcode'];
-
+
return $lang;
}
{
global $bugsys;
static $mo;
-
+
if ($mo === null)
{
require_once './includes/class_mo.php';
while ($bug = $db->fetch_array($bugs_fetch))
{
- $funct->exec_swap_bg('altcolor', '');
+ $funct->exec_swap_bg('altcolor', '');
$bug = ProcessBugDataForDisplay($bug, $funct->bgcolour);
$bugs .= $sort->constructRow($bug);
}
function PrintContinue($step)
{
global $admin;
-
+
$admin->form_start('convert_database_charset.php', 'convert');
$admin->form_hidden_field('step', $step);
echo "\n<input type=\"submit\" value=\" Continue → \" name=\"__submit__\" />";
if ($bugsys->in['step'] == 0)
{
$collation = $db->query_first("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>';
-
+
echo '<h3>Please back up your database before continuing! While this script is tested and should be safe, it is better to be cautious.</h3>';
-
+
PrintContinue(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>';
-
+
$admin->table_start();
$admin->table_head('Column Preservation');
$admin->table_column_head(array('Table', 'Column'));
-
+
// get rid of indices that are strings
$db->showerrors = false;
$db->query("ALTER TABLE " . TABLE_PREFIX . "bug DROP INDEX summary");
$db->query("ALTER TABLE " . TABLE_PREFIX . "language DROP INDEX languagecode");
$db->query("ALTER TABLE " . TABLE_PREFIX . "language DROP INDEX langcode");
$db->showerrors = true;
-
+
$tables = $db->query("SHOW TABLES");
while ($table = $db->fetch_array($tables, false))
{
}
}
}
-
+
$admin->table_end();
echo '<h1>Convert Database Character Set</h1>';
echo '<p>This step changes the database\'s character set.</p>';
-
+
require './includes/config.php';
$db->query("ALTER DATABASE $database COLLATE " . TARGET);
echo '<h1>Convert Table Character Set</h1>';
echo '<p>This converts each table\'s character set and collation.</p>';
-
+
$admin->table_start();
$admin->table_head('Table Conversion');
$admin->table_column_head(array('Table Name', 'Result'));
-
+
$tables = $db->query("SHOW TABLES");
while ($table = $db->fetch_array($tables, false))
{
$db->query("ALTER TABLE $table[0] COLLATE " . TARGET);
$admin->row_text($table[0], 'Good');
}
-
+
$admin->table_end();
echo '<h1>Convert Table Columns</h1>';
echo '<p>This converts all the table columns that are stored with a character set.</p>';
-
+
$admin->table_start();
$admin->table_head('Column Conversion');
$admin->table_column_head(array('Table', 'Column'));
-
+
foreach ($columnConversions AS $table => $columns)
{
foreach ($columns AS $column => $type)
$admin->row_text($table, $column);
}
}
-
+
foreach ($primaryKeys AS $table => $field)
{
$db->query("ALTER TABLE $table ADD PRIMARY KEY ($field)");
}
-
+
$db->query("ALTER TABLE " . TABLE_PREFIX . "bug ADD FULLTEXT(summary)");
$db->query("ALTER TABLE " . TABLE_PREFIX . "comment ADD FULLTEXT(comment)");
$db->query("ALTER TABLE " . TABLE_PREFIX . "language ADD UNIQUE(langcode)");
-
+
$admin->table_end();
-
+
PrintContinue(2);
}
<strong>MySQL Privileges:</strong>
<ul>
<?php
-
+
$db->showerrors = false;
-
+
$pf = $tests[] = ($db->query("CREATE TABLE install_check (col1 VARCHAR(255) NULL);") ? 'pass' : 'fail');
echo "\n\t<li class=\"$pf\">CREATE TABLE</li>";
-
+
$pf = $tests[] = ($db->query("INSERT INTO install_check (col1) VALUES ('example')") ? 'pass' : 'fail');
echo "\n\t<li class=\"$pf\">INSERT</li>";
-
+
$pf = $tests[] = ($db->query("UPDATE install_check SET col1 = 'example2'") ? 'pass' : 'fail');
echo "\n\t<li class=\"$pf\">UPDATE</li>";
-
+
$pf = $tests[] = ($db->query("SELECT * FROM install_check") ? 'pass' : 'fail');
echo "\n\t<li class=\"$pf\">SELECT</li>";
-
+
$pf = $tests[] = ($db->query("DELETE FROM install_check WHERE col1 = 'example2'") ? 'pass' : 'fail');
echo "\n\t<li class=\"$pf\">DELETE</li>";
-
+
$pf = $tests[] = ($db->query("ALTER TABLE install_check ADD col3 BOOL") ? 'pass' : 'fail');
echo "\n\t<li class=\"$pf\">ALTER</li>";
-
+
$pf = $tests[] = ($db->query("ALTER TABLE install_check ADD INDEX (col1)") ? 'pass' : 'fail');
echo "\n\t<li class=\"$pf\">ALTER ADD INDEX</li>";
-
+
$pf = $tests[] = ($db->query("REPLACE INTO install_check (col1) VALUES ('example3')") ? 'pass' : 'fail');
echo "\n\t<li class=\"$pf\">REPLACE</li>";
-
+
$pf = $tests[] = ($db->query("OPTIMIZE TABLE install_check") ? 'pass' : 'fail');
echo "\n\t<li class=\"$pf\">OPTIMIZE</li>";
-
+
$pf = $tests[] = ($db->query("DROP TABLE install_check") ? 'pass' : 'fail');
echo "\n\t<li class=\"$pf\">DROP TABLE</li>";
-
+
echo "\n</ul>";
-
+
$valcount = array_count_values($tests);
if ($valcount['fail'] > 0)
{
<p>This step will load the tables into your database so the rest of the installation can proceed forward.</p>
<?php
-
+
require './includes/config.php';
$db->query("ALTER DATABASE $database COLLATE $COLLATION");
-
+
require_once('./install/schema.php');
-
+
foreach ($schema AS $table => $query)
{
$db->query($query);
<p>Default table data for usergroups, statuses, priorities, and other various options are being loaded. This will allow you to use Bugdar with minimal setup.</p>
<?php
-
+
require_once('./install/default_data.php');
-
+
foreach ($data AS $table => $records)
{
foreach ($records AS $record)
$fields[] = $field;
$values[] = addslashes($value);
}
-
+
$db->query("INSERT INTO " . TABLE_PREFIX . "$table (" . implode(',', $fields) . ") VALUES ('" . implode("', '", $values) . "')");
}
-
+
echo 'Populating table ' . $table . '<br />' . "\n";
}
-
+
$db->query("INSERT INTO " . TABLE_PREFIX . "language (title, langcode, charset, direction, userselect) VALUES ('English (US)', 'en_US', 'utf-8', 'ltr', 1)");
echo 'Inserting default language<br />' . "\n";
}
<p>Default settings are being loaded into the system.</p>
<?php
-
+
require_once('./install/settings.php');
-
+
foreach ($settings AS $key => $value)
{
$db->query("INSERT INTO " . TABLE_PREFIX . "setting (varname, value) VALUES ('" . $key . "', '" . $db->escape_string($value) . "')");
}
-
+
echo 'Settings loaded...';
}
<p>In order to make Bugdar as efficient as possible, the system caches the portions of data it can. This reduces the load of your server without compromising usability. Currently the caches are being built.</p>
<?php
-
+
require_once('./includes/permissions.php');
-
+
build_settings();
echo "Cached settings<br />\n";
-
+
build_usergroups();
echo "Cached usergroups<br />\n";
-
+
build_statuses();
echo "Cached statuses<br />\n";
-
+
build_priorities();
echo "Cached priorities<br />\n";
-
+
build_severities();
echo "Cached severities<br />\n";
-
+
build_assignedto();
echo "Cached assignable users/developers<br />\n";
-
+
build_resolutions();
echo "Cached resolutions<br />\n";
-
+
build_products();
echo "Cached products<br />\n";
-
+
build_versions();
echo "Cached versions<br />\n";
-
+
build_languages();
echo "Cached languages<br />\n";
-
+
build_user_help();
echo "Cached user help documentation<br />\n";
}
</form>
<?php
-
+
$db->query("UPDATE " . TABLE_PREFIX . "setting SET value = '" . $bugsys->input_escape('trackertitle') . "' WHERE varname = 'trackertitle'");
$db->query("UPDATE " . TABLE_PREFIX . "setting SET value = '" . $bugsys->input_escape('trackerurl') . "' WHERE varname = 'trackerurl'");
$db->query("UPDATE " . TABLE_PREFIX . "setting SET value = '" . $bugsys->input_escape('webmasteremail') . "' WHERE varname = 'webmasteremail'");
-
+
build_settings();
-
+
page_end(false);
}
<p>Your new user has been added.</p>
<?php
-
+
require_once('./includes/api_user.php');
-
+
// we need to do this here because build_assignedto() uses this data and we don't have it loaded in
// 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']);
if (!isset($bugsys->in['next']))
{
$db->showerrors = false;
-
+
$version = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "setting WHERE varname = 'trackerversion'");
$version = $version['value'];
-
+
if ($version == '[#]version[#]')
{
header('Location: upgrade16.php');
exit;
}
-
+
if (!$version)
{
die('You have done something to your database and this script cannot determine Bugdar\'s version... or you have no upgrade to perform...');
}
-
+
if ($bugsys->versions["$version"] == -1)
{
page_start();
-
+
echo "<h1>Bugdar Upgrade System</h1>\n\n";
-
+
echo "<p>Your Bugdar installation is up-to-date!</p>\n\n";
-
+
page_end(false);
}
else
{
header("Location: upgrade.php?next=$version");
}
-
+
$db->showerrors = true;
}
{
die('Bugdar is up-to-date already');
}
-
+
header("Location: upgrade" . $bugsys->versions[ $bugsys->in['next'] ] . ".php");
}
<p>This step finishes the upgrade by inreasing your version number.</p>
<?php
-
+
$db->query("UPDATE " . TABLE_PREFIX . "setting SET value = '1.0.1' WHERE varname = 'trackerversion'");
-
+
build_settings();
?>
<p>This step finishes the upgrade by inreasing your version number.</p>
<?php
-
+
$db->query("UPDATE " . TABLE_PREFIX . "setting SET value = '1.1.5' WHERE varname = 'trackerversion'");
-
+
build_settings();
-
+
?>
... done.
<p>There are a few minor changes made to Bugdar's database schema that need to be propagated.</p>
<?php
-
+
$db->query("ALTER TABLE " . TABLE_PREFIX . "comment ADD parselinks BOOL NULL");
echo "Adding comment.parselinks to add an option to parse links in comments<br />\n";
-
+
$db->query("ALTER TABLE " . TABLE_PREFIX . "user ADD columnoptions TEXT NULL");
echo "Adding user.columnoptions to allow for custom column sorting<br />\n";
$db->query("ALTER TABLE " . TABLE_PREFIX . "product CHANGE componentmother parentid INT UNSIGNED NULL");
echo "Renaming product.componentmother to product.parentid<br />\n";
-
+
$db->query("ALTER TABLE " . TABLE_PREFIX . "version ADD obsolete BOOL NULL");
echo "Adding version.obsolete so products cannot be filed against certain versions<br />\n";
-
+
$db->query("ALTER TABLE " . TABLE_PREFIX . "user ADD authid VARCHAR(255) NULL");
echo "Adding user.authid for the Authentication API<br />\n";
-
+
echo "... done<br />\n";
}
<p>To support saved searches, a few major modifications need to be performed on the search table.</p>
<?php
-
+
$db->query("ALTER TABLE " . TABLE_PREFIX . "search DROP PRIMARY KEY");
echo "Dropping current primary key<br />\n";
-
+
$db->query("ALTER TABLE " . TABLE_PREFIX . "search ADD searchid INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY");
echo "Adding search.searchid as a new primary key<br />\n";
-
+
$db->query("ALTER TABLE " . TABLE_PREFIX . "search ADD name VARCHAR(250) NULL");
echo "Adding search.name to allow naming of searches<br />\n";
-
+
$db->query("DELETE FROM " . TABLE_PREFIX . "search");
echo "Clearing out all the old searches<br />\n";
-
+
echo "... done<br />\n";
}
{
// create the database field
$db->query("ALTER TABLE " . TABLE_PREFIX . "bug ADD custom$field[fieldid] MEDIUMTEXT NULL");
-
+
echo "Migrating custom$field[fieldid]";
// update all the data
}
echo "done<br />\n";
}
-
+
echo ".... all done<br />\n";
}
$db->query("DROP TABLE " . TABLE_PREFIX . "bugvaluefill");
echo "Dropping the old storage system for custom field data<br />";
-
+
$db->query("
CREATE TABLE " . TABLE_PREFIX . "passwordreset
(
- activatorid VARCHAR(250) NOT NULL,
- userid INT NOT NULL,
+ activatorid VARCHAR(250) NOT NULL,
+ userid INT NOT NULL,
dateline INT NOT NULL,
PRIMARY KEY (activatorid)
)
");
echo "Creating passwordreset table to create a 'lost password' functionality<br />\n";
-
+
$db->query("
CREATE TABLE " . TABLE_PREFIX . "adminsession
(
- sessionid VARCHAR(250) NOT NULL,
- userid INT UNSIGNED NOT NULL,
+ sessionid VARCHAR(250) NOT NULL,
+ userid INT UNSIGNED NOT NULL,
dateline INT UNSIGNED NOT NULL,
PRIMARY KEY (sessionid)
)
");
echo "Creating adminsession table to greatly improve the admin control panel security<br />\n";
-
+
$db->query("
CREATE TABLE " . TABLE_PREFIX . "template
(
)
");
echo "Creating template table to cache templates in the database to greatly inprove speed<br />\n";
-
+
echo "... done<br />\n";
}
<p>This step finishes the upgrade by inreasing your version number.</p>
<?php
-
+
$db->query("UPDATE " . TABLE_PREFIX . "setting SET value = '1.2.0 Beta 1' WHERE varname = 'trackerversion'");
$db->query("REPLACE INTO " . TABLE_PREFIX . "setting (varname, value) VALUES ('authmethod', 'default')");
$db->query("REPLACE INTO " . TABLE_PREFIX . "setting (varname, value) VALUES ('columnoptions', '" . $db->escape_string('a:12:{s:5:"bugid";s:1:"1";s:7:"summary";s:1:"2";s:8:"reporter";s:1:"2";s:7:"product";s:1:"3";s:9:"component";s:1:"0";s:7:"version";s:1:"3";s:6:"status";s:1:"4";s:10:"resolution";s:1:"4";s:8:"priority";s:1:"5";s:8:"severity";s:1:"5";s:8:"lastpost";s:1:"6";s:5:"votes";s:1:"0";}') . "')");
$db->query("REPLACE INTO " . TABLE_PREFIX . "fieldhelp (keystring, title, body) VALUES ('columnorder', 'Custom Column Ordering', 'You can change the ordering and display of columns on the bug list using these settings. Any column with a position value of "0" will not be displayed in the list. Columns are positioned in the grid with the lowest numbered column starting at the far-left. If columns share a position number, they will be placed in the same column position.')");
-
+
build_user_help();
build_settings();
-
+
?>
... done.
<p>This step finishes the upgrade by inreasing your version number.</p>
<?php
-
+
$db->query("UPDATE " . TABLE_PREFIX . "setting SET value = '1.2.0 Beta 2' WHERE varname = 'trackerversion'");
-
+
build_settings();
-
+
?>
... done.
$db->query("ALTER TABLE " . TABLE_PREFIX . "user ADD groupids TEXT NULL");
echo "Adding user.groupids<br />\n";
}
-
+
build_usergroups();
build_statuses();
build_priorities();
build_versions();
build_languages();
build_user_help();
-
+
if ($db->query("SELECT * FROM " . TABLE_PREFIX . "component"))
{
$db->query("DROP TABLE " . TABLE_PREFIX . "component");
<p>This step finishes the upgrade by inreasing your version number.</p>
<?php
-
+
$db->query("UPDATE " . TABLE_PREFIX . "setting SET value = '1.2.0 Beta 3' WHERE varname = 'trackerversion'");
-
+
build_settings();
-
+
?>
... done.
<p>This step finishes the upgrade by inreasing your version number.</p>
<?php
-
+
$db->query("UPDATE " . TABLE_PREFIX . "setting SET value = '1.2.0 Release Candidate 1' WHERE varname = 'trackerversion'");
-
+
build_settings();
-
+
?>
... done.
<p>This step finishes the upgrade by inreasing your version number.</p>
<?php
-
+
$db->query("UPDATE " . TABLE_PREFIX . "setting SET value = '1.2.0' WHERE varname = 'trackerversion'");
-
+
build_settings();
-
+
?>
... done.
<p>This step finishes the upgrade by inreasing your version number.</p>
<?php
-
+
$db->query("UPDATE " . TABLE_PREFIX . "setting SET value = '1.2.1' WHERE varname = 'trackerversion'");
-
+
build_settings();
-
+
?>
... done.
<p>This step finishes the upgrade by inreasing your version number.</p>
<?php
-
+
$db->query("UPDATE " . TABLE_PREFIX . "setting SET value = '1.2.2' WHERE varname = 'trackerversion'");
-
+
build_settings();
-
+
?>
... done.
<p>Making minor schema changes so that permission mask fields are large enough for the high integer values.</p>
<?php
-
+
$db->query("ALTER TABLE " . TABLE_PREFIX . "bugfieldpermission CHANGE mask mask int unsigned NOT NULL DEFAULT 0");
$db->query("ALTER TABLE " . TABLE_PREFIX . "permission CHANGE mask mask int unsigned NOT NULL DEFAULT 0");
}
<p>This step finishes the upgrade by inreasing your version number.</p>
<?php
-
+
$db->query("UPDATE " . TABLE_PREFIX . "setting SET value = '1.2.3' WHERE varname = 'trackerversion'");
-
+
build_settings();
-
+
?>
... done.
<p>This step finishes the upgrade by inreasing your version number.</p>
<?php
-
+
$db->query("UPDATE " . TABLE_PREFIX . "setting SET value = '1.2.4' WHERE varname = 'trackerversion'");
-
+
build_settings();
-
+
?>
... done.
{
?>
<h1>Major Table Changes</h1>
-
+
<p>Major table additions and deletions are being performed on your database.</p>
<?php
-
+
$db->query("
CREATE TABLE " . TABLE_PREFIX . "useremail
(
mask int unsigned not null
)
");
-
+
echo "Adding the useremail table to store email preferences<br />\n";
$db->query("DROP TABLE " . TABLE_PREFIX . "dependency");
-
+
echo "Dropping the unused dependency table (this was never used and was from a 1.0.0 pre-release version, so data has been lost)<br />\n";
}
{
?>
<h1>User Table Changes</h1>
-
+
<p>Changes are now being done on the user table.</p>
<?php
-
+
$db->query("ALTER TABLE " . TABLE_PREFIX . "user ADD usedst BOOL NOT NULL");
-
+
echo "Adding user.usedst, a daylight savings time option<br />\n";
$db->query("ALTER TABLE " . TABLE_PREFIX . "user ADD hidestatuses mediumtext NOT NULL");
-
+
echo "Adding user.hidestatuses to allow users to opt to not display certain statuses<br />\n";
-
+
$db->query("ALTER TABLE " . TABLE_PREFIX . "user ADD defaultsortkey varchar(50) NULL");
$db->query("ALTER TABLE " . TABLE_PREFIX . "user ADD defaultsortas varchar(10) NULL");
-
+
echo "Adding user.defaultsortkey and user.defaultsortas for bug list sorting options<br />\n";
}
{
?>
<h1>Minor Table Changes</h1>
-
+
<p>Minor, miscellaneous modifications are now being performed on database tables.</p>
<?php
-
+
$db->query("DELETE FROM " . TABLE_PREFIX . "search");
-
+
echo "Clearing the search table because new features make changes to the way data is stored in this table<br />\n";
$db->query("ALTER TABLE " . TABLE_PREFIX . "search ADD resultcount INT(10) NULL");
-
+
echo "Adding search.resultcount as an internal counter for search features<br />\n";
-
+
$db->query("ALTER TABLE " . TABLE_PREFIX . "bug CHANGE productid product INT(10) UNSIGNED NOT NULL DEFAULT '0'");
-
+
echo "Renaming bug.productid to bug.product<br />\n";
$db->query("ALTER TABLE " . TABLE_PREFIX . "bug CHANGE componentid component INT(10) UNSIGNED NOT NULL DEFAULT '0'");
-
+
echo "Renaming bug.componentid to bug.component<br />\n";
$db->query("ALTER TABLE " . TABLE_PREFIX . "bug CHANGE versionid version INT(10) UNSIGNED NOT NULL DEFAULT '0'");
-
+
echo "Renaming bug.versionid to bug.version<br />\n";
}
{
?>
<h1>Caching User Data in Bug Table</h1>
-
+
<p>To decrease load times and complex queries, user information is now stored in the bug table. This step will add additional fields for this data and then will populate those same fields.</p>
<?php
-
+
$db->query("ALTER TABLE " . TABLE_PREFIX . "bug ADD username varchar(255) NOT NULL");
$db->query("ALTER TABLE " . TABLE_PREFIX . "bug ADD lastpostbyname varchar(255) NOT NULL");
$db->query("ALTER TABLE " . TABLE_PREFIX . "bug ADD hiddenlastpostbyname varchar(255) NOT NULL");
-
+
echo "Adding bug.username, bug.lastpostbyname, and bug.hiddenlastpostbyname to store cached user name data<br />\n";
-
+
echo "Caching bug data";
-
+
$userlist = array();
$users = $db->query("SELECT userid, displayname FROM " . TABLE_PREFIX . "user");
while ($user = $db->fetch_array($users))
{
$userlist["$user[userid]"] = $user['displayname'];
}
-
+
$bugs = $db->query("SELECT * FROM " . TABLE_PREFIX . "bug");
while ($bug = $db->fetch_array($bugs))
{
");
echo ".";
}
-
+
echo " done<br />\n";
}
{
?>
<h1>Updating Old History Items</h1>
-
+
<p>In Bugdar 1.1.0, the bug history feature has been improved significantly. To bring old history messages up to date, processing has to be done. Please wait while historical records are updated.</p>
<?php
-
+
echo "Updating historical records";
-
+
$history = $db->query("SELECT * FROM " . TABLE_PREFIX . "history");
while ($log = $db->fetch_array($history))
{
}
echo ".";
}
-
+
echo " done<br />\n";
}
<p>In Bugdar 1.1.0, users can receive email notifications on various bug events. We are now setting the default email settings for all users.</p>
<?php
-
+
echo "Setting email options";
-
+
$users = $db->query("SELECT userid FROM " . TABLE_PREFIX . "user");
while ($user = $db->fetch_array($users))
{
");
echo ".";
}
-
+
echo " done<br />\n";
}
<p>This step finishes the upgrade by inreasing your version number and then updating other settings.</p>
<?php
-
+
require_once('./includes/settings.php');
-
+
$db->query("UPDATE " . TABLE_PREFIX . "setting SET value = '1.1.0 Beta 1' WHERE varname = 'trackerversion'");
-
+
$db->query("INSERT INTO " . TABLE_PREFIX . "setting (varname, value) VALUES ('syndicateditems', '" . $settings['general']['syndicateditems'][1] . "')");
$db->query("INSERT INTO " . TABLE_PREFIX . "setting (varname, value) VALUES ('hidestatuses', '" . $settings['display']['hidestatuses'][1] . "')");
$db->query("INSERT INTO " . TABLE_PREFIX . "setting (varname, value) VALUES ('defaultsortkey', '" . $settings['display']['defaultsortkey'][1] . "')");
$db->query("INSERT INTO " . TABLE_PREFIX . "setting (varname, value) VALUES ('defaultsortas', '" . $settings['display']['defaultsortas'][1] . "')");
-
+
build_settings();
-
+
?>
... done.
{
?>
<h1>Language System Updates</h1>
-
+
<p>In Bugdar 1.1.0 Beta 2, the language system was changed to use Gettext. These schema changes reflect that change.</p>
<?php
-
+
$db->query("DROP TABLE " . TABLE_PREFIX . "localization");
-
+
echo "Dropping the strings cache table<br />\n";
-
+
$db->query("ALTER TABLE " . TABLE_PREFIX . "language DROP filename");
-
+
echo "Dropping language.filename<br />\n";
-
+
$db->query("ALTER TABLE " . TABLE_PREFIX . "language CHANGE languagecode langcode VARCHAR(5) NOT NULL");
-
+
echo "Adding language.langcode for the Gettext language code<br />\n";
-
+
$db->query("ALTER TABLE " . TABLE_PREFIX . "language DROP debug");
-
+
echo "Dropping language.debug as language debug mode no longer exists<br />\n";
-
+
$db->query("UPDATE " . TABLE_PREFIX . "language SET langcode = 'en_US' WHERE languageid = 1");
-
+
echo "Setting the correct langcode for English (US)<br />\n";
}
{
?>
<h1>English US Changes</h1>
-
+
<p>These changes bring the schema into English (US) compliance.</p>
<?php
-
+
$db->query("ALTER TABLE " . TABLE_PREFIX . "favourite RENAME " . TABLE_PREFIX . "favorite");
-
+
echo "Renaming table 'favourite' to 'favorite'<br />\n";
$db->query("ALTER TABLE " . TABLE_PREFIX . "user CHANGE showcolours showcolors BOOL NULL");
-
+
echo "Renaming user.showcolours to user.showcolors<br />\n";
}
{
?>
<h1>Adding New Permission Mask</h1>
-
+
<p>Bugdar 1.1.0 Beta 2 introduces a new permission called "canviewownhidden" which enables users to view hidden bugs that they reported. This is being turned on for registered users, developers, and administrators.</p>
<?php
-
+
$db->query("UPDATE " . TABLE_PREFIX . "usergroup SET permissions = permissions + 33554432 WHERE usergroupid IN (2, 5, 6)");
-
+
echo "Increased permission levels<br />\n";
}
<p>This step finishes the upgrade by inreasing your version number.</p>
<?php
-
+
$db->query("UPDATE " . TABLE_PREFIX . "setting SET value = '1.1.0 Beta 2' WHERE varname = 'trackerversion'");
-
+
build_settings();
-
+
?>
... done.
<p>This step finishes the upgrade by inreasing your version number.</p>
<?php
-
+
$db->query("UPDATE " . TABLE_PREFIX . "setting SET value = '1.1.0 Release Candidate 1' WHERE varname = 'trackerversion'");
-
+
build_settings();
-
+
?>
... done.
{
?>
<h1>Rename Automatic Actions</h1>
-
+
<p>Simply for aesthetic's sake, we've ranamed "Automatic Actions" to "Automations." This does all the necessary database changes to make that rename work internally.</p>
<?php
-
+
$db->query("ALTER TABLE " . TABLE_PREFIX . "autoaction RENAME " . TABLE_PREFIX . "automation");
echo "Renaming datbase table<br />\n";
-
+
$db->query("DELETE FROM " . TABLE_PREFIX . "datastore WHERE title = 'autoaction'");
echo "Clearing old datastore information<br />\n";
-
+
build_automations();
echo "Rebuilding the automations cahce<br />\n";
-
+
$topic = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "fieldhelp WHERE keystring = 'newreply'");
if (md5($topic['body']) == '7e1154340454ca6d8f8ba47aab057c23')
{
<p>This step finishes the upgrade by inreasing your version number.</p>
<?php
-
+
$db->query("UPDATE " . TABLE_PREFIX . "setting SET value = '1.1.0' WHERE varname = 'trackerversion'");
-
+
build_settings();
-
+
?>
... done.
<p>This step finishes the upgrade by inreasing your version number.</p>
<?php
-
+
$db->query("UPDATE " . TABLE_PREFIX . "setting SET value = '1.1.1' WHERE varname = 'trackerversion'");
-
+
build_settings();
-
+
?>
... done.
<p>This step finishes the upgrade by inreasing your version number.</p>
<?php
-
+
$db->query("UPDATE " . TABLE_PREFIX . "setting SET value = '1.1.2' WHERE varname = 'trackerversion'");
-
+
build_settings();
-
+
?>
... done.
<p>This step finishes the upgrade by inreasing your version number.</p>
<?php
-
+
$db->query("UPDATE " . TABLE_PREFIX . "setting SET value = '1.1.3' WHERE varname = 'trackerversion'");
-
+
build_settings();
-
+
?>
... done.
<p>Changing the storage type of the time zone field from INT to FLOAT to fix a bug.</p>
<?php
-
+
$db->query("ALTER TABLE " . TABLE_PREFIX . "user CHANGE timezone timezone float(4) NOT NULL DEFAULT 0");
-
+
echo "... done<br />\n";
}
<p>This step finishes the upgrade by inreasing your version number.</p>
<?php
-
+
$db->query("UPDATE " . TABLE_PREFIX . "setting SET value = '1.1.4' WHERE varname = 'trackerversion'");
-
+
build_settings();
-
+
?>
... done.
{
$keeplogin = 0;
}
-
+
if ($_SERVER['HTTP_REFERER'] AND !$_POST['goindex'])
{
$url = $_SERVER['HTTP_REFERER'];
{
$url = 'index.php';
}
-
+
if ($auth->authenticateLogin($bugsys->in['email'], $bugsys->in['password'], $keeplogin))
{
if ($_POST['do'] == 'cplogin')
// ###################################################################
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->fetch();
-
+
if ($message->hasErrors())
{
$show['lostpwerror'] = true;
{
$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', bugdar::$datastore['language'][$user->objdata['languageid']]['langcode'])) . '";');
$email = $bugsys->xml->parse($email);
-
+
$mail->setSubject($email['email']['subject']['value']);
$mail->setBodyText($email['email']['bodyText']['value']);
-
+
$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']));
}
}
{
// remove old activators
$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') . "'");
if (!$activation)
{
$message->error(L_INVALID_ID);
}
-
+
$user = new UserAPI($bugsys);
$user->set('userid', $activation['userid']);
$user->set_condition();
-
+
if ($bugsys->in['fix_password'] != $bugsys->in['confirm_password'])
{
$message->addError(T('The passwords you entered do not patch.'));
{
$message->addError(T('Your new password cannot be empty.'));
}
-
+
$user->set('password', $bugsys->in['fix_password']);
-
+
if (!$message->hasErrors())
{
// remove old other activators for this user
$db->query("DELETE FROM " . TABLE_PREFIX . "passwordreset WHERE userid = " . $activation['userid']);
-
+
$user->update();
$message->redirect(T('Your password has been changed successfully. You will now be redirected to the login page.'), 'login.php');
}
{
// remove old activators
$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') . "'");
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') . '");');
}
{
$bug = new BugAPI($bugsys);
$comment = new CommentAPI($bugsys);
-
+
$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']);
-
+
$comment->set('userid', $bugsys->userinfo['userid']);
$comment->set('comment', $bugsys->in['comment']);
$comment->set('parselinks', $bugsys->in['parselinks']);
-
+
// -------------------------------------------------------------------
// check permissions on various input values
if (!can_perform('canchangestatus', $bugsys->in['product']))
// assigned person is not a dev or a valid user
$bug->set('assignedto', $bugsys->in['assignedto']);
}
-
+
$product = explode(',', $bugsys->in['product']);
$bug->set('product', $product[0]);
$bug->set('component', $product[1]);
$bug->set('version', $product[2]);
-
+
process_custom_fields($bug, $message, true);
-
+
if (!$message->hasErrors())
{
$bug->insert();
-
+
$comment->set('bugid', $bug->insertid);
$comment->insert();
-
+
$notif->send_new_bug_notice($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->set('bugid', $comment->values['bugid']);
$bug->set('hiddenlastpostby', $bugsys->userinfo['userid']);
$bug->set('hiddenlastpostbyname', $bugsys->userinfo['displayname']);
$bug->update();
-
+
$notif->set_bug_data($bug->objdata);
-
+
$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'));
}
else
{
$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']));
$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']));
}
-
+
$show['assign'] = can_perform('canassign');
-
+
if (can_perform('canassign'))
{
foreach (bugdar::$datastore['assignto'] AS $dev)
eval('$select[dev] .= "' . $template->fetch('selectoption') . '";');
}
}
-
+
// custom fields
- $fields = construct_custom_fields($bugsys->in, true);
+ $fields = construct_custom_fields($bugsys->in, true);
$i = 0;
foreach ($fields AS $field)
{
}
$i++;
}
-
+
$productSelect = ConstructProductSelect('cansubmitbugs', $bugsys->in['product'], false);
-
+
$reporter = construct_user_display($bugsys->userinfo);
-
+
eval('$template->flush("' . $template->fetch('newreport') . '");');
}
{
$message->error(T('Sorry, you are already registered.'));
}
-
+
if (!$bugsys->options['allownewreg'])
{
$message->error(T('Sorry, we don\'t allow new registrations.'));
{
$message->addError(T('The emails you entered do not match.'));
}
-
+
if ($bugsys->in['password'] != $bugsys->in['confirmpassword'])
{
$message->addError(T('The passwords you entered did not match.'));
}
-
+
if ($bugsys->options['verifyemail'])
{
$usergroupid = 3;
$usergroupid = 2;
}
}
-
+
$user = new UserAPI($bugsys);
$user->set('email', $bugsys->in['email']);
$user->set('displayname', $bugsys->in['displayname']);
$user->set('languageid', $bugsys->in['languageid']);
$user->set('timezone', $bugsys->options['defaulttimezone']);
$user->set('usergroupid', $usergroupid);
-
+
if (!$message->hasErrors())
{
$user->insert();
-
+
$userid = $user->insertid;
-
+
// Verify email address
if ($usergroupid == 3)
{
$activationid = $funct->rand(25);
-
+
$db->query("INSERT INTO " . TABLE_PREFIX . "useractivation (userid, activator, dateline, usergroupid) VALUES ($userid, '$activationid', " . TIMENOW . ", 2)");
-
+
eval('$email = "' . $template->fetch(FetchEmailPath('activateaccount.xml', bugdar::$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']);
-
+
$message->message(T('You now need to activate your account via email.'));
}
else if ($usergroupid == 4 OR $usergroupid == 2)
$mail->setBodyText($email['email']['bodyText']['value']);
$mail->send($bugsys->in['email'], $bugsys->in['displayname']);
}
-
+
if ($usergroupid == 4)
{
$message->message(T('Your account is pending approval.'));
{
$message->error(T('Sorry, you are already registered.'));
}
-
+
if (!$bugsys->options['allownewreg'])
{
$message->error(T('Sorry, we don\'t allow new registrations.'));
$selected = ($value == $bugsys->in['languageid']);
eval('$opts .= "' . $template->fetch('selectoption') . '";');
}
-
+
eval('$template->flush("' . $template->fetch('register') . '");');
}
$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']);
-
+
if ($bugsys->options['sendwelcomemail'])
{
$displayName = $user['displayname'];
$mail->setBodyText($email['email']['bodyText']['value']);
$mail->send($user['email'], $user['displayname']);
}
-
+
$message->message(T('Your account is now activated and you can now login.'));
}
else
{
$newsearch = true;
}
-
+
if ($cachedsearch)
{
$show['cached'] = true;
{
$search = $cachedsearch;
$_POST['do'] = 'results';
- }
+ }
}
else
{
$newsearch = true;
}
-
+
if ($newsearch)
{
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(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);
+ $fields = construct_custom_fields(null, true, false, true);
$i = 0;
foreach ($fields AS $field)
{
}
$i++;
}
-
+
// -------------------------------------------------------------------
- // built-in fields
+ // built-in fields
$select['severity'] = construct_datastore_select('severity', 'severity', 'severityid');
$select['priority'] = construct_datastore_select('priority', 'priority', 'priorityid');
$select['status'] = construct_datastore_select('status', 'status', 'statusid');
$select['resolution'] = construct_datastore_select('resolution', 'resolution', 'resolutionid');
-
+
$searches = '';
if ($bugsys->userinfo['userid'])
{
eval('$searches .= "' . $template->fetch('selectoption') . '";');
}
}
-
+
$select['dev'] = '';
foreach (bugdar::$datastore['assignto'] AS $dev)
{
$label = construct_user_display($dev, false);
eval('$select[dev] .= "' . $template->fetch('selectoption') . '";');
}
-
+
eval('$template->flush("' . $template->fetch('search') . '");');
}
}
if ($bugsys->in['summary'])
{
$keywords = preg_split('#\s+#', $bugsys->in['summary']);
-
+
// TODO - need to have some str to bool conversions
-
+
foreach ($keywords AS $word)
{
if (strlen($word) < SEARCH_WORD_MIN)
{
continue;
}
-
+
$word = str_replace("'", "\'", $word);
if ($bugsys->in['mode'] == MODE_ALL)
{
{
$querybuild['text'] .= " $word";
}
-
+
if (!preg_match('#-(.+?)#', trim($word)))
{
$hilight .= " $word";
}
}
-
+
$hilight = preg_replace('#[^0-9a-zA-Z_ ]#', '', $hilight);
$hilight = trim($hilight);
$hilight = preg_replace('#\s#', '+', $hilight);
-
+
$temp = trim($querybuild['text']);
-
+
if ($bugsys->in['mode'] == MODE_ALL OR $bugsys->in['mode'] == MODE_RAW)
{
$bool_flag = ' IN BOOLEAN MODE';
}
-
+
$querybuild['text'] = "AND\n\t\t\t(\n\t\t\t\tMATCH (bug.summary) AGAINST ('$temp'$bool_flag)\n\t\t\t\tOR MATCH (comment.comment) AGAINST ('$temp'$bool_flag)\n\t\t\t)";
}
-
+
// -------------------------------------------------------------------
// reporter
if ($bugsys->in['reporter'])
$querybuild['reporter'] = "AND bug.userid = $user[userid] OR comment.userid = $user[userid]";
}
}
-
+
// -------------------------------------------------------------------
// product/component/version stuff
if (is_array($bugsys->in['product']))
}
$querybuild['pcv'] = "AND bug.product IN (" . implode(',', $products) . ") AND bug.component IN (" . implode(',', $components) . ") AND bug.version IN (" . implode(',', $versions) . ")";
}
-
+
// -------------------------------------------------------------------
// severity, priority, status, resolution, assignedto
-
+
// severity
if ($bugsys->in['severity'])
{
$bugsys->input_clean('severity', TYPE_UINT);
$querybuild['severity'] = "AND bug.severity IN (" . implode(',', $bugsys->in['severity']) . ")";
}
-
+
// priority
if ($bugsys->in['priority'])
{
$bugsys->input_clean('priority', TYPE_UINT);
$querybuild['priority'] = "AND bug.priority IN (" . implode(',', $bugsys->in['priority']) . ")";
}
-
+
// status
if ($bugsys->in['status'])
{
$bugsys->input_clean('status', TYPE_UINT);
$querybuild['status'] = "AND bug.status IN (" . implode(',', $bugsys->in['status']) . ")";
}
-
+
// resolution
if ($bugsys->in['resolution'])
{
$bugsys->input_clean('resolution', TYPE_UINT);
$querybuild['resolution'] = "AND bug.resolution IN (" . implode(',', $bugsys->in['resolution']) . ")";
}
-
+
// assignment
if ($bugsys->in['assignedto'])
{
$bugsys->input_clean('assignedto', TYPE_UINT);
$querybuild['assignedto'] = "AND bug.assignedto IN (" . implode(',', $bugsys->in['assignedto']) . ")";
}
-
+
// -------------------------------------------------------------------
// date
if ($bugsys->in['date'])
$dateline = time() - ($bugsys->input_clean('date', TYPE_INT) * 3600);
$querybuild['date'] = "AND bug.dateline >= $dateline";
}
-
+
// -------------------------------------------------------------------
// favorites
$bugsys->input_clean('favorite', TYPE_INT);
}
$querybuild['favorites'] = "AND bug.bugid " . ($bugsys->in['favorite'] > 0 ? "IN" : "NOT IN") . " (" . implode(', ', $ids) . ")";
}
-
+
// -------------------------------------------------------------------
// sort by
$sortby = array('bugid', 'severity', 'priority', 'status', 'resolution', 'dateline');
{
$sortclause = '';
}
-
+
// -------------------------------------------------------------------
// custom fields
$fields_fetch = $bugsys->db->query("
}
}
}
-
+
// -------------------------------------------------------------------
// have to search something
if (sizeof($querybuild) < 1)
{
$message->error(sprintf(T('You have to enter some criteria to search for. Note that words less than %1$d characters are ignored by the search engine (and some other very common words, too).'), SEARCH_WORD_MIN));
}
-
+
// -------------------------------------------------------------------
// do the search
-
+
$search = $db->query("
SELECT bug.*, comment.commentid
FROM " . TABLE_PREFIX . "bug AS bug
GROUP BY bug.bugid
$sortclause
");
-
+
$numrows = $db->num_rows($search);
-
+
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))
{
$ids[] = $result['bugid'];
$results[] = $result;
}
-
+
if ($bugsys->userinfo['userid'] AND !$cachedsearch AND !$bugsys->in['rerun'])
{
$db->query("DELETE FROM " . TABLE_PREFIX . "search WHERE userid = " . $bugsys->userinfo['userid'] . " AND name IS NULL");
}
-
+
// store the search params
$params = $bugsys->in;
foreach ($_COOKIE AS $key => $value)
{
unset($params["$key"]);
}
-
+
if ($cachedsearch)
{
$search = $cachedsearch;
);
$search = array('searchid' => $db->insert_id(), 'ids' => implode(',', $ids), 'orderby' => $sortclause, 'hilight' => $hilight, 'resultcount' => sizeof($results));
}
-
+
$_POST['do'] = 'results';
}
{
$message->errorPermission();
}
-
+
$productSelect = ConstructProductSelect();
-
+
$show['update'] = true;
-
+
// -------------------------------------------------------------------
// custom fields
- $fields = construct_custom_fields(null, true, false, true);
+ $fields = construct_custom_fields(null, true, false, true);
$i = 0;
foreach ($fields AS $field)
{
}
$i++;
}
-
+
// -------------------------------------------------------------------
- // built-in fields
+ // built-in fields
$select['severity'] = construct_datastore_select('severity', 'severity', 'severityid', 0, 0);
$select['priority'] = construct_datastore_select('priority', 'priority', 'priorityid', 0, 0);
$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 = '';
$label = construct_user_display($dev, false);
eval('$select[dev] .= "' . $template->fetch('selectoption') . '";');
}
-
+
eval('$template->flush("' . $template->fetch('search_update') . '");');
}
{
$message->errorPermission();
}
-
+
// find all the bugs that we can edit
$bugs = $db->query("
SELECT * FROM " . TABLE_PREFIX . "bug
{
continue;
}
-
+
$api = new BugApi($bugsys);
$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);
$api->set('component', $product[1]);
$api->set('version', $product[2]);
}
-
+
process_custom_fields($api, $message, false, true);
-
+
$log->add_data(false, $api->values, $log->getCommonFields(), true);
-
+
$api->update();
$log->update_history();
}
-
+
$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->error(T('The search results are trying to export are invalid. Please start over <a href="search.php?new=1">here</a> and try again.'));
}
-
+
if (!$search)
{
$message->error(T('Your search has expired because it is older than one hour. Please start over <a href="search.php?new=1">here</a>.'));
}
-
+
$bugs = $db->query("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid IN ($search[ids]) $search[orderby]");
-
+
$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'] . '">';
while ($bug = $db->fetch_array($bugs))
{
$xml .= "\n\t<bug>";
-
+
$bug = ProcessBugDataForDisplay($bug);
-
+
$xml .= "\n\t\t<id>" . $bug['bugid'] . "</id>";
$xml .= "\n\t\t<dateReported>" . $datef->format('r', $bug['dateline']) . "</dateReported>";
if ($bug['userid'])
$xml .= "\n\t\t<resolution>" . $bug['resolution'] . "</resolution>";
$xml .= "\n\t\t<severity>" . $bug['severity'] . "</severity>";
$xml .= "\n\t\t<priority>" . $bug['priority'] . "</priority>";
-
+
$xml .= "\n\t</bug>";
}
-
+
$xml .= "\n</bugdarExport>";
-
+
$funct->download_file($xml, T('bugdar-search-' . $search['searchid'] . '.xml'), true);
}
{
$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']);
{
$message->errorPermission();
}
-
+
eval('$template->flush("' . $template->fetch('search_save') . '");');
}
// ###################################################################
if ($_POST['do'] == 'results')
-{
+{
if (!$search['ids'])
{
$message->error(T('No bugs matched your search criteria. Please <a href="search.php?new=1">try again</a> with different search requirements.'));
}
-
+
$searchid = $search['searchid'];
$hilight = $search['hilight'];
-
+
LoadPaginationFramework();
$pagination->setTotal($search['resultcount']);
$pagination->splitPages();
-
+
$sort = new ListSorter('search');
-
+
$show['save'] = ($bugsys->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))
$bug = ProcessBugDataForDisplay($bug, $funct->bgcolour);
$bugs .= $sort->constructRow($bug, "&hilight=$hilight");
}
-
+
$columnHeads = $sort->constructColumnHeaders(false);
$show['pagenav'] = ($pagination->getPageCount() > 1);
$pagenav = $pagination->constructPageNav('search.php?searchid=' . $searchid);
-
+
eval('$template->flush("' . $template->fetch('search_results') . '");');
}
$error = L_INVALID_ID;
}
}
-
+
eval('$template->flush("' . $template->fetch('quicksearch') . '");');
exit;
}
if ($show['edit'])
{
$select['severity'] = construct_datastore_select('severity', 'severity', 'severityid', $bug['severity']);
-
+
$show['changestatus'] = (can_perform('canchangestatus', $bug['product']) ? true : false);
if (can_perform('canchangestatus', $bug['product']))
{
$select['priority'] = construct_datastore_select('priority', 'priority', 'priorityid', $bug['priority']);
$select['status'] = construct_datastore_select('status', 'status', 'statusid', $bug['status']);
- $select['resolution'] = construct_datastore_select('resolution', 'resolution', 'resolutionid', $bug['resolution']);
+ $select['resolution'] = construct_datastore_select('resolution', 'resolution', 'resolutionid', $bug['resolution']);
}
else
{
$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(bugdar::$datastore['assignto']))
{
eval('$select[dev] .= "' . $template->fetch('selectoption') . '";');
}
}
-
+
$productSelect = ConstructProductSelect('canviewbugs', "$bug[product],$bug[component],$bug[version]");
-
+
if ($bug['duplicateof'])
{
$duplicate = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = $bug[duplicateof]");
}
-
+
if ($bug['dependency'])
{
$depends = array();
}
$dependencies = implode(' ', $depends);
}
-
+
$select['automations'] = '';
$show['automations'] = false;
if (is_array(bugdar::$datastore['automation']))
$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 = 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]");
-
+
$dupelist = array();
$duplicates = $db->query("SELECT bugid, summary FROM " . TABLE_PREFIX . "bug WHERE duplicateof = $bug[bugid]");
while ($duplicate = $db->fetch_array($duplicates))
$dupelist[] = "<a href=\"showreport.php?bugid=$duplicate[bugid]\" target=\"_blank\">$duplicate[summary]</a>";
}
$dupelist = implode(', ', $dupelist);
-
+
if ($bug['dependency'])
{
$depends = array();
WHERE attachment.bugid = $bug[bugid]
ORDER BY attachment.dateline"
);
-
+
$attaches = false;
while ($attachment = $db->fetch_array($attachments_fetch))
{
$attachment['user'] = construct_user_display($attachment, false);
eval('$attachments .= "' . $template->fetch('showreport_attachment') . '";');
}
-
+
$show['attachments'] = (!$show['putattachments'] AND !$attaches) ? false : true;
}
$comment['posttime'] = $datef->format($bugsys->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']));
-
+
$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']);
-
+
if (is_array($hilight))
{
foreach ($hilight AS $id => $find)
$comment['comment_parsed'] = preg_replace($find, $replace, $comment['comment_parsed']);
}
}
-
+
eval('$temp = "' . $template->fetch('showreport_comment') . '";');
if ($description == null)
{
<td><strong>' . T('Severity') . ':</strong></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'] . '"/>
</entry>';
-
+
$lastupdated = $bug["$timestamp"];
}
<title>' . sprintf(T('%1$s Syndication Feed'), $bugsys->options['trackertitle']) . '</title>
<link href="' . $bugsys->options['trackerurl'] . '"/>
<updated>' . gmdate('Y-m-d\TH:i:s\Z', $lastupdated) . '</updated>
-
+
<!-- entries -->
';
echo $syndicate;
-
+
echo '
<!-- / entries -->
{
$message->errorPermission();
}
-
+
$db->query("DELETE FROM " . TABLE_PREFIX . "search WHERE searchid = " . $bugsys->in['searchid']);
-
+
$message->redirect(T('This saved search has been removed from your list.'), 'userctrl.php');
}
{
$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']));
}
// ###################################################################
if ($_POST['do'] == 'update')
-{
+{
// -------------------------------------------------------------------
// authentication
if (!empty($bugsys->in['password_change']) OR !empty($bugsys->in['email_change']))
}
}
}
-
+
// -------------------------------------------------------------------
// email validation
if (!empty($bugsys->in['email_change']))
{
$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'])
{
$message->addError(T('Your email and confirm email addresses do not match'));
}
-
+
$userapi->set('email', $bugsys->in['email_change']);
}
-
+
// -------------------------------------------------------------------
// password validation
if (!empty($bugsys->in['password_change']))
$message->addError(T('Your password and confirm password do not match'));
}
}
-
+
$userapi->set('password', $bugsys->in['password_change']);
}
-
+
$userapi->set('displayname', $bugsys->in['displayname']);
$userapi->set('showemail', $bugsys->in['showemail']);
$userapi->set('showcolors', $bugsys->in['showcolors']);
$userapi->set('defaultsortkey', $bugsys->in['defaultsortkey']);
$userapi->set('defaultsortas', $bugsys->in['defaultsortas']);
$userapi->set('columnoptions', $bugsys->input_clean('columnoptions', TYPE_UINT));
-
+
// -------------------------------------------------------------------
// copy fields
$userinfo['displayname'] = $bugsys->in['displayname'];
$userinfo['defaultsorkey'] = $bugsys->in['defaultsorkey'];
$userinfo['defaultsortas'] = $bugsys->in['defaultsortas'];
$userinfo['columnoptions'] = $bugsys->in['columnoptions'];
-
+
$email = $bugsys->in['email_change'];
$email_confirm = $bugsys->in['email_confirm'];
-
+
// -------------------------------------------------------------------
// error handling
if ($message->hasErrors())
else
{
$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("INSERT INTO " . TABLE_PREFIX . "useremail (userid, relation, mask) VALUES (" . $bugsys->userinfo['userid'] . ", $relation, $bitmask)");
}
}
-
+
$message->redirect(T('The changes to your account have been made.'), 'userctrl.php');
}
}
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(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)
{
$selected = ($value == $userinfo['timezone']);
eval('$tzselect .= "' . $template->fetch('selectoption') . '";');
}
-
+
$checked = array();
if (!is_array($bugsys->in['emailopts']))
{
}
}
}
-
+
$columns = array();
$columnOptions = '';
if (!is_array($bugsys->in['columnoptions']))
eval('$columnOptions .= "' . $template->fetch('userctrl_column') . '";');
}
}
-
+
// searches
$searches = '';
$searchesFetch = $db->query("SELECT * FROM " . TABLE_PREFIX . "search WHERE name IS NOT NULL AND userid = " . $bugsys->userinfo['userid']);
{
eval('$searches .= "' . $template->fetch('userctrl_search') . '";');
}
-
+
eval('$template->flush("' . $template->fetch('userctrl') . '");');
}
{
$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]");
-
+
if (!check_bug_permissions($bug))
{
$message->errorPermission();
}
-
+
if (!can_perform('canvote', $bug['product']))
{
$message->errorPermission();
}
-
+
if (!$bug)
{
$message->error(L_INVALID_ID);
}
-
+
if ($vote['uservote'])
{
$message->error(T('You have already voted on this bug.'));
}
-
+
// handle userids
$userids = $vote['userids'];
if ($bugsys->userinfo['userid'])
$userids = $bugsys->userinfo['userid'];
}
}
-
+
$uservote = $bugsys->input_clean('vote', TYPE_INT);
-
+
$votefor = $vote['votefor'];
$voteagainst = $vote['voteagainst'];
-
+
if ($uservote > 0)
{
$votefor++;
{
$message->error(T('You need to specify whether you want to vote for or against this bug.'));
}
-
+
$db->query("UPDATE " . TABLE_PREFIX . "vote SET userids = '$userids', votefor = $votefor, voteagainst = $voteagainst WHERE bugid = $bug[bugid]");
$message->redirect(T('Your vote has been added.'), "showreport.php?bugid=$bug[bugid]");