Update of /cvsroot/openfirst/base/includes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29550/includes
Modified Files:
globals.php
Added Files:
functions.php
Log Message:
Better Directory support
--- NEW FILE: functions.php ---
<?php
/*
* openFIRST.base - includes/functions.php
*
* Copyright (C) 2003,
* openFIRST Project
* Original Author: Jamie Bliss <ja...@op...>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
// Purpose: Provide global functions to openFIRST
/** Replaces standard vars in config text.
* Currently includes $BasePath, $fBasePath,
* $StylePath, $fStylePath, $ModPath, and $fModPath.
*/
function replaceVariables($text, $ModuleDir = false) {
if ($ModuleDir === false) {
global $CurrentModule;
if (is_object($CurrentModule)) $ModuleDir == $CurrentModule->getDir();
}
global $BasePath, $fBasePath, $StylePath, $fStylePath;
$find = array('$BasePath',
'$fBasePath',
'$StylePath',
'$fStylePath',
'$ModPath',
'$fModPath'
);
$replace = array($BasePath,
$fBasePath,
$StylePath,
$fStylePath,
"$BasePath/$ModuleDir",
"$fBasePath/$ModuleDir"
);
return str_ireplace($find, $replace, $text);
}
?>
Index: globals.php
===================================================================
RCS file: /cvsroot/openfirst/base/includes/globals.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** globals.php 27 May 2005 16:07:51 -0000 1.5
--- globals.php 27 May 2005 16:33:03 -0000 1.6
***************
*** 61,64 ****
--- 61,65 ----
unset($configdir);
+ require_once('functions.php');
require_once('dbase.php');
require_once('auth.php');
***************
*** 123,133 ****
// Declare important variables so that headers can pick them up and preview them
! $adminnav = str_ireplace(array('$BasePath', '$StylePath'),
! array($BasePath, $StylePath),
! $adminnavigation)." <a href='http://bugzilla.openfirst.org'>Report Bug</a>";
!
! $subnav = str_ireplace(array('$BasePath', '$StylePath'),
! array($BasePath, $StylePath),
! $modulenavigation);
} else {
--- 124,129 ----
// Declare important variables so that headers can pick them up and preview them
! $adminnav = replaceVariables($adminnavigation.' <a href="http://bugzilla.openfirst.org/">Report Bug</a>', $dir);
! $subnav = replaceVariables($modulenavigation, $dir);
} else {
|