diff options
author | 2009-07-24 11:33:04 -0400 | |
---|---|---|
committer | 2009-07-24 11:33:04 -0400 | |
commit | 3b8dc0e7e38fd3470e3d2c2fa51a2a7c20d02499 (patch) | |
tree | 5d5860981deaa4a66174418b975e528f5703a490 /shared | |
parent | Broke log viewer into segments, added build deletion (diff) | |
download | ingenue-3b8dc0e7e38fd3470e3d2c2fa51a2a7c20d02499.tar.gz ingenue-3b8dc0e7e38fd3470e3d2c2fa51a2a7c20d02499.tar.bz2 ingenue-3b8dc0e7e38fd3470e3d2c2fa51a2a7c20d02499.zip |
Require manually-configured URL - backend needs it anyway
Diffstat (limited to 'shared')
-rw-r--r-- | shared/config.php | 2 | ||||
-rw-r--r-- | shared/functions/load_config.php | 2 | ||||
-rw-r--r-- | shared/functions/url.php | 24 | ||||
-rw-r--r-- | shared/include/defaults.php | 1 |
4 files changed, 27 insertions, 2 deletions
diff --git a/shared/config.php b/shared/config.php index 4461c67..62a1c4d 100644 --- a/shared/config.php +++ b/shared/config.php @@ -1,6 +1,7 @@ <?php // Default values are commented // $title='Ingenue'; // Used in <title> and in emails +$url='http://soc'; // The base address of the frontend installation // $sqlhost='localhost'; // MySQL server $sqluser='soc'; // MySQL username $sqlpass='socpassword'; // MySQL password @@ -24,6 +25,5 @@ $split_setup=true; // Whether the frontend and backend are running on different $pkgdir_root='/home/eitan/soc/tinderbox'; // The directory to recursively search for pkgdirs (Backend only) // $emerge_default_opts='-v --color=y'; // Options to add to all emerge commands // $portdir='/usr/portage'; // The directory conatining the portage tree to use (/usr/portage unless you have a reason to think otherwise) -$frontend_location='http://soc'; // The base address of the frontend installation $backend_id='red'; // A name or other way of identifying this backend as opposed to other backends working for the same frontend TODO use gethostname() by default in 5.3.0 ?> diff --git a/shared/functions/load_config.php b/shared/functions/load_config.php index ac660f7..eb07879 100644 --- a/shared/functions/load_config.php +++ b/shared/functions/load_config.php @@ -3,7 +3,7 @@ function load_config() { require(SHARED.'/include/defaults.php'); require(SHARED.'/config.php'); $modules=explode(' ', $modules); - foreach (explode(' ', 'title sqlhost sqluser sqlpass sqldb debug modules bundlers cookiename sessionlength mod_rewrite timezone_root emailfrom check_email_dns split_setup registration invite logview_max progressbar_width pkgdir_root emerge_default_opts portdir frontend_location backend_id') as $var) { + foreach (explode(' ', 'title url sqlhost sqluser sqlpass sqldb debug modules bundlers cookiename sessionlength mod_rewrite timezone_root emailfrom check_email_dns split_setup registration invite logview_max progressbar_width pkgdir_root emerge_default_opts portdir backend_id') as $var) { if (isset($$var)) { $GLOBALS['conf'][$var]=$$var; } diff --git a/shared/functions/url.php b/shared/functions/url.php new file mode 100644 index 0000000..f2ff5ba --- /dev/null +++ b/shared/functions/url.php @@ -0,0 +1,24 @@ +<?php +// Makes all URLs absolute +function url($url='') { + global $conf; + if (strlen($url) == 0) { + return $conf['url'].($conf['mod_rewrite']?'':'/index.php'); + } elseif (substr($url, 0, 7) == 'http://') { + return $url; + } + if ($conf['mod_rewrite']) { + return $conf['url'].'/'.$url; + } else { + if (strpos($url, '?')) { + $q=substr($url, strpos($url, '?')+1); + $url=substr($url, 0, strpos($url, '?')); + } + if (strlen($url)) { + return $conf['url'].'/index.php?req='.$url.(isset($q)?'&'.$q:''); + } else { + return $conf['url'].'/index.php?'.$q; + } + } +} +?> diff --git a/shared/include/defaults.php b/shared/include/defaults.php index b384257..4e93a7a 100644 --- a/shared/include/defaults.php +++ b/shared/include/defaults.php @@ -1,5 +1,6 @@ <?php $title='Ingenue'; +$url='http://localhost'; $sqlhost='localhost'; $sqluser=posix_getpwuid(posix_geteuid()); $sqluser=$sqluser['name']; |