[Openfirst-cvscommit] base/config dbase.php,1.18,1.19 first.php,1.49,1.50 globals.php,1.5,1.6 global
Brought to you by:
xtimg
From: Astronouth7303 <ast...@us...> - 2005-03-13 01:43:54
|
Update of /cvsroot/openfirst/base/config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16813/config Modified Files: dbase.php first.php globals.php globals.tpl Log Message: -Added ofirst_dbcreate() -Fixed some errors -Corrected bug in globals.tpl Index: first.php =================================================================== RCS file: /cvsroot/openfirst/base/config/first.php,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** first.php 13 Mar 2005 01:33:45 -0000 1.49 --- first.php 13 Mar 2005 01:43:41 -0000 1.50 *************** *** 48,64 **** } ofirst_dbcreate("$sqlserver","$sqluser","$sqlpassword", $sqldatabase); ! ofirst_dbconnect("$sqlserver","$sqluser","$sqlpassword"); ! ofirst_select_db($sqldatabase); ! ! ofirst_dbquery("CREATE TABLE `ofirst_config` ( ! `modulename` varchar(25) NOT NULL default '', ! `showonmenu` tinyint(1) default NULL, ! `active` tinyint(1) default NULL, ! `adminnavigation` text, ! `modulenavigation` text, ! `includes` text, ! PRIMARY KEY (`modulename`) ! )"); ! echo ofirst_dberror(); function GetVarValue($var) { --- 48,52 ---- } ofirst_dbcreate("$sqlserver","$sqluser","$sqlpassword", $sqldatabase); ! echo 'DB/tables creation error: '.ofirst_dberror(); function GetVarValue($var) { Index: dbase.php =================================================================== RCS file: /cvsroot/openfirst/base/config/dbase.php,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** dbase.php 13 Mar 2005 01:25:21 -0000 1.18 --- dbase.php 13 Mar 2005 01:43:41 -0000 1.19 *************** *** 26,30 **** // without having to be completely rewritten or released as two // different versions. ! $lastquery; if(isset($dbasetype) == false) { $dbasetype = "mysql"; } --- 26,30 ---- // without having to be completely rewritten or released as two // different versions. ! $lastquery = ''; if(isset($dbasetype) == false) { $dbasetype = "mysql"; } *************** *** 271,273 **** --- 271,290 ---- } } + + function ofirst_dbcreate($sqlserver, $sqluser, $sqlpassword, $sqldatabase) { + /* Create database if it does not already exist */ + ofirst_dbconnect("$sqlserver","$sqluser","$sqlpassword"); + ofirst_dbquery("CREATE DATABASE IF NOT EXISTS $sqldatabase;"); + ofirst_select_db($sqldatabase); + + ofirst_dbquery("CREATE TABLE `ofirst_config` ( + `modulename` varchar(25) NOT NULL default '', + `showonmenu` tinyint(1) default NULL, + `active` tinyint(1) default NULL, + `adminnavigation` text, + `modulenavigation` text, + `includes` text, + PRIMARY KEY (`modulename`) + )"); + } ?> Index: globals.tpl =================================================================== RCS file: /cvsroot/openfirst/base/config/globals.tpl,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** globals.tpl 13 Mar 2005 01:27:50 -0000 1.3 --- globals.tpl 13 Mar 2005 01:43:42 -0000 1.4 *************** *** 45,49 **** $mailfrom = %BOTMAIL%; $basepath = %BASEPATH%; ! $fbasepath = %FBASEPATH; // Determine what module the user is viewing --- 45,49 ---- $mailfrom = %BOTMAIL%; $basepath = %BASEPATH%; ! $fbasepath = %FBASEPATH%; // Determine what module the user is viewing Index: globals.php =================================================================== RCS file: /cvsroot/openfirst/base/config/globals.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** globals.php 13 Mar 2005 01:19:58 -0000 1.5 --- globals.php 13 Mar 2005 01:43:42 -0000 1.6 *************** *** 1,15 **** <?php /* ! * openFIRST globals.php ! * This is a placeholder file. It will be recreated ! * by first.php when you first access and configure ! * your OpenFIRST portal software. ! */ ! if(file_exists("../config/first.php")) { ! header("Location: ../config/first.php"); ! } elseif(file_exists("config/first.php")) { ! header("Location: config/first.php"); ! } elseif(file_exists("../../config/first.php")) { ! header("Location: ../../config/first.php"); } ! ?> \ No newline at end of file --- 1,119 ---- <?php /* ! * openFIRST base configuration file ! * This file has been automatically generated by first.php. ! * it contains the basic configuration options required to ! * operate the OpenFIRST web portal software. Note, that ! * most configuration options are now stored in the MySQL ! * database, in the ofirst_config table. ! */ ! $dbasetype = 'mysql'; ! $ostype = 'windows'; ! if ($ostype == "windows") { ! ini_set("include_path", ini_get("include_path") . ";../config/;."); ! } else { ! ini_set("include_path", ini_get("include_path") . ":../config/:."); } ! include_once('dbase.php'); ! ! $encryption = 'md5'; ! ! $title = 'Astro73'; ! $version = 'CVS'; ! $sqlserver = 'localhost'; ! $sqluser = 'root'; ! $sqlpassword = ''; ! $sqldatabase = 'of_release'; ! if(function_exists("ofirst_dbconnect") == false) { ! die("Your version of PHP has not been compiled with SQL support, therefore the openFIRST web portal system cannot run on this system. Please contact your system administrator to request SQL support for your version of PHP."); ! } ! ! $sqlconnection = ofirst_dbconnect("$sqlserver","$sqluser","$sqlpassword"); ! ! if($peardb) { ! $sqlconnection = ofirst_select_db($sqldatabase); ! } else { ! ofirst_select_db($sqldatabase); ! } ! ! $pass_save_disabled=true; ! $regenabled=true; ! $home = 'http://astro73/openfirst'; ! $header = 'D:/XAMPP/htdocs/openFIRST/config/headers.php'; ! $footer = 'D:/XAMPP/htdocs/openFIRST/config/footers.php'; ! $mailnotify = 'admin@astro73'; ! $mailfrom = 'openfirst@astro73'; ! $basepath = '/openfirst'; ! $fbasepath = %FBASEPATH; ! ! // Determine what module the user is viewing ! ! $currentmodule = str_replace($basepath, "", $_SERVER["SCRIPT_NAME"]); ! $currentmodule = substr($currentmodule, 1, strpos($currentmodule, "/", 2) - 1); ! ! #FIXME: Use $fbasepath instead of getcwd() ! session_start(); ! include('auth.php'); ! if(function_exists("glob")) { ! // Include the functions using glob(); ! if(is_readable(getcwd() . "/../config/functions/")) { ! foreach (glob(getcwd() . "/../config/functions/*.php") as $filename) { ! include($filename); ! } ! } elseif (is_readable(getcwd() . "/../../config/functions/")) { ! foreach (glob(getcwd() . "/../../config/functions/*.php") as $filename) { ! include($filename); ! } ! } ! } else { ! // Include the functions without using glob(); ! } ! ! $headers = ""; ! ! $incl = ofirst_dbquery("SELECT * FROM ofirst_config"); ! ! // If there is no error then run the module add feature ! if(ofirst_dberrno() == 0) { ! // Begin to loop through modules from the databaes ! while($module = ofirst_dbfetch_object($incl)) { ! // Check if the value is try, if it is then run an include ! if( (bool) $module->active == true) { ! // Check if there are includes that need to be included ! if(! $module->includes == ""){ ! // If the list is not empty then explode the value and put it into inclist ! $inclist = explode(",",$module->includes); ! // This is to remove an error that you have if you don't check if there are more then 2 ! if(count($inclist) >= 2){ ! ! // Loop through the inclist and add them according to their paths ! foreach($inclist As $inc){ ! include("$fbasepath/$module->modulename/$inc"); ! } ! } else { ! // If there is only 1 include available then use this line to include it instead ! include("$fbasepath/$module->modulename/$module->includes"); ! } ! } ! ! // If the module has requested to be shown on the menu then add it ! if( (bool) $module->showonmenu == true) { ! // If it is the current module then color the item ! if ($currentmodule == $module->modulename){ ! $headers .= " » <font color='red'><u><a class='menu' href='$basepath/$module->modulename'>".ucwords($module->modulename)."</a></u></font> |"; ! ! // Declare important variables so that headers can pick them up and preview them ! ! $adminnav = str_replace("\$basepath", $basepath, $module->adminnavigation) . " <a href='http://bugzilla.openfirst.org'>Report Bug</a>"; ! $subnav = str_replace("\$basepath", $basepath, $module->modulenavigation); ! ! } else { ! $headers .= " » <a class='menu' href='$basepath/$module->modulename'>".ucwords($module->modulename)."</a> |"; ! } ! } ! } ! } ! } ! ! session_write_close(); ! ?> |