2 /*=====================================================================*\
3 || ###################################################################
5 || # Copyright (c)2004-2009 Blue Static
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version 2 of the License.
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
22 $fetchtemplates = array(
26 require_once('./global.php');
27 require_once('./includes/class_sort.php');
28 require_once('./includes/functions_datastore.php');
30 if (!can_perform('canadmintools'))
35 // ###################################################################
37 if (empty($_REQUEST['do']))
39 $_REQUEST['do'] = 'modify';
42 // ###################################################################
44 if ($_POST['do'] == 'update')
47 foreach ($input->in
['settings'] as $varname => $value)
51 if ($varname == 'columnoptions')
53 $value = serialize($value);
57 $value = implode(',', $value);
61 $updates[] = "('" . $input->escape($varname) . "', '" . $input->escape($value) . "')";
64 $db->query("REPLACE INTO " . TABLE_PREFIX
. "setting (varname, value) VALUES " . implode(',', $updates));
68 admin_flash_redirect('settings.php', 'All the settings have been updated successfully.');
71 // ###################################################################
73 if ($_REQUEST['do'] == 'modify')
75 $admin = new BSTemplate('settings');
78 $methods = BSFunctions
::scan_directory('./includes/auth/');
79 $admin->vars
['authmethods'] = '';
80 foreach ($methods AS $path)
82 if (preg_match('#auth_(.*)\.php#', $path, $matches))
84 $admin->vars
['authmethods'] .= '<option value="' . $matches[1] . '"' . ($matches[1] == bugdar
::$options['authmethod'] ?
' selected="selected"' : '') . '>' . ucwords(str_replace('_', ' ', $matches[1])) . '</option>';
88 $admin->evaluate()->flush();
91 // ###################################################################
93 * Helper function for the bugdar::$options['columnoptions'] setting
95 * @return string Setting HTML code
97 function ConstructColumnOptionsSetting()
101 require_once('./includes/class_sort.php');
103 $array = (bugdar
::$options['columnoptions'] == null ?
array('bugid' => 1, 'summary' => 2, 'userid' => 2, 'product' => 3, 'version' => 3, 'component' => 0, 'status' => 4, 'resolution' => 4, 'priority' => 5, 'severity' => 5, 'lastpost' => 6, 'votes' => 0) : bugdar
::$options['columnoptions']);
105 $return = '<table cellspacing="2" cellpadding="1" border="0">';
106 foreach (ListSorter
::fetch_by_text(false
, false
) AS $column => $name)
108 $return .= '<tr><td><strong>' . $name . '</strong></td><td><input type="text" name="setting[columnoptions][' . $column . ']" size="2" maxlength="2" class="input" value="' . intval($array["$column"]) . '" /></td></tr>';
110 $return .= '</table>';