|
From: Benjamin C. <bc...@us...> - 2002-09-13 18:13:28
|
Update of /cvsroot/phpbt/phpbt
In directory usw-pr-cvs1:/tmp/cvs-serv14495
Modified Files:
include.php install.php
Log Message:
Attempt to use included pear.
Index: include.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/include.php,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -r1.121 -r1.122
--- include.php 18 Jul 2002 13:02:14 -0000 1.121
+++ include.php 13 Sep 2002 18:13:25 -0000 1.122
@@ -22,7 +22,7 @@
// ------------------------------------------------------------------------
// $Id$
-ini_set("magic_quotes_runtime", 0);
+ini_set("magic_quotes_runtime", 0);
if (!@include('config.php')) {
header("Location: install.php");
@@ -37,6 +37,7 @@
include ('inc/functions.php');
// PEAR::DB
+chdir('inc/pear'); // Drop down to the pear directory to include pear stuff
require_once('DB.php');
$dsn = array(
'phptype' => DB_TYPE,
@@ -52,17 +53,18 @@
$db->setOption('optimize', 'portability');
$db->setFetchMode(DB_FETCHMODE_ASSOC);
$db->setErrorHandling(PEAR_ERROR_CALLBACK, "handle_db_error");
+chdir('../..'); // Come back up from the pear directory
// Set up the configuration variables
$rs = $db->query('select varname, varvalue from '.TBL_CONFIGURATION);
while (list($k, $v) = $rs->fetchRow(DB_FETCHMODE_ORDERED)) {
define($k, $v);
}
-define('OPEN_BUG_STATUSES', join(', ', array(BUG_UNCONFIRMED, BUG_PROMOTED,
+define('OPEN_BUG_STATUSES', join(', ', array(BUG_UNCONFIRMED, BUG_PROMOTED,
BUG_ASSIGNED, BUG_REOPENED)));
require_once ('inc/db/'.DB_TYPE.'.php');
-
+
// Localization - include the file with the desired language
include 'languages/'.LANGUAGE.'.php';
@@ -98,7 +100,7 @@
'browser_string' => 'Browser',
'close_date' => 'Closed Date'
);
-
+
$default_db_fields = array('bug_id', 'title', 'reporter', 'owner',
'severity_name', 'priority', 'status_name', 'resolution_name');
@@ -115,15 +117,15 @@
error_reporting(E_ALL ^ E_NOTICE); // Clobber Smarty warnings
return Smarty::fetch($_smarty_tpl_file, $_smarty_cache_id, $_smarty_compile_id, $_smarty_display);
}
-
+
function wrap($template, $title = '') {
global $TITLE, $_gv, $_pv;
-
+
$this->assign(array(
'content_template' => $template,
'page_title' => isset($TITLE[$title]) ? $TITLE[$title] : $title
));
-
+
// Use a popup wrap?
if ((isset($_gv['use_js']) and $_gv['use_js']) or
(isset($_pv['use_js']) and $_pv['use_js'])) {
@@ -143,6 +145,7 @@
$t->template_dir = 'templates/'.THEME.'/';
$t->compile_dir = 'c_templates';
$t->config_dir = '.';
+$t->use_sub_dirs = false;
$t->register_function('build_select', 'build_select');
$t->register_function('project_js', 'build_project_js');
$t->register_modifier('date', 'bt_date');
@@ -203,14 +206,14 @@
setcookie('phpbt_user');
}
}
-
+
}
if (!empty($u)) {
- list($owner_open, $owner_closed) =
- $db->getRow(sprintf($QUERY['include-template-owner'], $u),
+ list($owner_open, $owner_closed) =
+ $db->getRow(sprintf($QUERY['include-template-owner'], $u),
DB_FETCHMODE_ORDERED);
- list($reporter_open, $reporter_closed) =
+ list($reporter_open, $reporter_closed) =
$db->getRow(sprintf($QUERY['include-template-reporter'], $u),
DB_FETCHMODE_ORDERED);
$t->assign(array(
@@ -233,11 +236,11 @@
// Check to see if we have projects that shouldn't be visible to the user
$restricted_projects = '0';
if (!$perm->have_perm('Admin')) {
- $viewable_projects = delimit_list(',',
+ $viewable_projects = delimit_list(',',
$db->getCol("select project_id from ".TBL_PROJECT_GROUP.
" where group_id in (".delimit_list(',', $_sv['group_ids']).")"));
$viewable_projects = $viewable_projects ? $viewable_projects : '0';
- $matching_projects = delimit_list(',',
+ $matching_projects = delimit_list(',',
$db->getCol("select project_id from ".TBL_PROJECT_GROUP.
" where project_id not in ($viewable_projects) group by project_id"));
if ($matching_projects) {
Index: install.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/install.php,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- install.php 29 Jul 2002 12:26:18 -0000 1.30
+++ install.php 13 Sep 2002 18:13:25 -0000 1.31
@@ -59,7 +59,7 @@
'mysql' => 'MySQL',
'oci8' => 'Oracle 8.1.x',
'pgsql' => 'PostgreSQL');
-
+
ini_set("magic_quotes_runtime", 0); // runtime quotes will kill the included sql
if (!empty($_pv)) {
@@ -97,7 +97,7 @@
'/TBL_DATABASE/' => $_pv['tbl_prefix'].'database_server',
'/TBL_SITE/' => $_pv['tbl_prefix'].'site',
'/OPTION_ADMIN_EMAIL/' => $_pv['admin_login'],
- '/OPTION_ADMIN_PASS/' => $_pv['encrypt_pass'] ? md5($_pv['admin_pass'])
+ '/OPTION_ADMIN_PASS/' => $_pv['encrypt_pass'] ? md5($_pv['admin_pass'])
: $_pv['admin_pass'],
'/OPTION_PHPBT_EMAIL/' => $_pv['phpbt_email'],
'/OPTION_ENCRYPT_PASS/' => $_pv['encrypt_pass'],
@@ -113,13 +113,13 @@
function build_select($params) {
global $db_types;
-
+
extract($params);
$text = '';
foreach ($db_types as $val => $item) {
if ($selected == $val and $selected != '') $sel = ' selected';
- else $sel = '';
- $text .= "<option value=\"$val\"$sel>$item</option>";
+ else $sel = '';
+ $text .= "<option value=\"$val\"$sel>$item</option>";
}
echo $text;
}
@@ -141,16 +141,17 @@
// Smarty
$patterns[] = '{smarty_path}';
$replacements[] = SMARTY_PATH;
-
+
$contents = join('', file('config-dist.php'));
return str_replace($patterns, $replacements, $contents);
-
+
}
function create_tables() {
global $_pv, $tables;
-
+
// PEAR::DB
+ chdir('inc/pear'); // Drop down to the pear directory to include pear stuff
require_once('DB.php');
$dsn = array(
'phptype' => $_pv['db_type'],
@@ -160,22 +161,24 @@
'password' => $_pv['db_pass']
);
$db = DB::Connect($dsn);
- // Simple error checking on returned DB object to check connection to db
- if(get_class($db)=='db_error') {
- die('<br><br>
- <div align="center">The installation script could not connect to the database (' . $_pv['db_database'] .
- ') on the host (' . $_pv['db_host'] . ') using the specified username and password.
- <br>
- Please check these details are correct and that the database already exists then retry.
- </div>
- <br>'.$db->message.'<br>'.$db->userinfo);
- }
+ chdir('../..'); // Come back up from the pear directory
+
+ // Simple error checking on returned DB object to check connection to db
+ if(get_class($db)=='db_error') {
+ die('<br><br>
+ <div align="center">The installation script could not connect to the database (' . $_pv['db_database'] .
+ ') on the host (' . $_pv['db_host'] . ') using the specified username and password.
+ <br>
+ Please check these details are correct and that the database already exists then retry.
+ </div>
+ <br>'.$db->message.'<br>'.$db->userinfo);
+ }
$db->setOption('optimize', 'portability');
$q_temp_ary = file('schemas/'.$_pv['db_type'].'.in');
- $queries = preg_replace(array_keys($tables), array_values($tables),
+ $queries = preg_replace(array_keys($tables), array_values($tables),
$q_temp_ary);
$do_query = '';
foreach ($queries as $query) {
@@ -192,7 +195,7 @@
function check_vars() {
global $_pv;
-
+
$error = '';
if (!$_pv['db_host'] = trim($_pv['db_host'])) {
$error = 'Please enter the host name for your database server';
@@ -213,7 +216,7 @@
} elseif ($_pv['admin_pass'] != $_pv['admin_pass2']) {
$error = 'The admin passwords don\'t match';
}
-
+
if (!empty($error)) {
show_front($error);
return false;
@@ -246,14 +249,14 @@
function show_finished() {
global $t, $_pv;
-
+
$t->assign('login', $_pv['admin_login']);
$t->display('install-complete.html');
}
function show_front($error = '') {
global $t, $_pv, $select, $HTTP_SERVER_VARS;
-
+
$t->assign($_pv);
$t->assign('error', $error);
$t->assign('default_email', 'phpbt@'.$HTTP_SERVER_VARS['SERVER_NAME']);
|