diff options
author | 2009-07-24 11:33:04 -0400 | |
---|---|---|
committer | 2009-07-24 11:33:04 -0400 | |
commit | 3b8dc0e7e38fd3470e3d2c2fa51a2a7c20d02499 (patch) | |
tree | 5d5860981deaa4a66174418b975e528f5703a490 | |
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
-rwxr-xr-x | backend/backend.php | 2 | ||||
-rw-r--r-- | backend/functions/url.php | 6 | ||||
-rw-r--r-- | frontend/include/setup.php | 11 | ||||
-rw-r--r-- | frontend/js/url.js.php | 2 | ||||
-rw-r--r-- | frontend/pages/404.php | 7 | ||||
-rw-r--r-- | shared/config.php | 2 | ||||
-rw-r--r-- | shared/functions/load_config.php | 2 | ||||
-rw-r--r-- | shared/functions/url.php (renamed from frontend/functions/url.php) | 10 | ||||
-rw-r--r-- | shared/include/defaults.php | 1 |
9 files changed, 14 insertions, 29 deletions
diff --git a/backend/backend.php b/backend/backend.php index 3e85c90..4939dc1 100755 --- a/backend/backend.php +++ b/backend/backend.php @@ -95,7 +95,7 @@ while (true) { $key=randstring(30); $opt=new sql_buildopt($build->id, 'uploadkey', $key); $opt->write(); - $c=curl_init($conf['frontend_location'].'/backend/upload_image'); + $c=curl_init(url('backend/upload_image')); curl_setopt($c, CURLOPT_POST, 1); curl_setopt($c, CURLOPT_POSTFIELDS, array( 'build' => $build->id, diff --git a/backend/functions/url.php b/backend/functions/url.php deleted file mode 100644 index 7aae32f..0000000 --- a/backend/functions/url.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php -// FIXME TODO this needs to actually do something productive -function url($url) { - return 'http://soc/'.$url; -} -?> diff --git a/frontend/include/setup.php b/frontend/include/setup.php index 6e9e9e9..2239c6c 100644 --- a/frontend/include/setup.php +++ b/frontend/include/setup.php @@ -12,21 +12,12 @@ $S=array_merge($S, array( 'head_scripts' => array(), 'debug' => null, 'debugrow' => 0, - 'root' => null, 'cookie_dir' => null, 'start' => microtime(true), 'sql' => null )); unset($_REQUEST['req'], $_GET['req']); -if (isset($conf['rootDir'])) { // What on Earth is going on here? - $cDir=substr($cDir, strpos($cDir, '/', 8)); // Cuts the http://, the domain name - $S['cookie_dir']=$cDir.'/'; - $S['root']=$conf['rootDir']; -} else { - $cDir=dirname($_SERVER['PHP_SELF']); // We're assumed to always be running /index.php - $S['cookie_dir']=$cDir; - $S['root']=rtrim('http://'.$_SERVER['HTTP_HOST'].($_SERVER['SERVER_PORT']==(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']?443:80)?'':':'.$_SERVER['SERVER_PORT']).$cDir, '/'); -} +$S['cookie_dir']=substr($conf['url'], strpos($conf['url'], '/', 8)).'/'; require_once(SHARED.'/include/dbinit.php'); if (isset($_COOKIE[$conf['cookiename']])) { $cookie=$_COOKIE[$conf['cookiename']]; diff --git a/frontend/js/url.js.php b/frontend/js/url.js.php index 358a0df..a1b2b93 100644 --- a/frontend/js/url.js.php +++ b/frontend/js/url.js.php @@ -1,5 +1,5 @@ <?php // vim:filetype=javascript // Equivalent to php function of the same name ?> function url (relative) { - return "<?php echo $S['root'] ?>/"+relative; + return "<?php echo $conf['url'] ?>/"+relative; } diff --git a/frontend/pages/404.php b/frontend/pages/404.php index e19c818..ffc3b79 100644 --- a/frontend/pages/404.php +++ b/frontend/pages/404.php @@ -1,11 +1,10 @@ <?php function init_404() { - global $S; - $S['title']='404: Not Found'; header('HTTP/1.0 404 Not Found', true, 404); + return array('title' => '404: Not Found'); } function body_404() { - global $S; - echo print_error('Page Not Found!','The page you are trying to reach, <i>'.$S['root'].'/'.$S['request'].'</i> does not exist.'); + global $S, $conf; + echo print_error('Page Not Found!','The page you are trying to reach, <i>'.$conf['url'].'/'.$S['request'].'</i> does not exist.'); } ?> 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/frontend/functions/url.php b/shared/functions/url.php index 2cac083..f2ff5ba 100644 --- a/frontend/functions/url.php +++ b/shared/functions/url.php @@ -1,23 +1,23 @@ <?php // Makes all URLs absolute function url($url='') { - global $conf, $S; + global $conf; if (strlen($url) == 0) { - return $S['root'].($conf['mod_rewrite']?'':'/index.php'); + return $conf['url'].($conf['mod_rewrite']?'':'/index.php'); } elseif (substr($url, 0, 7) == 'http://') { return $url; } if ($conf['mod_rewrite']) { - return $S['root'].'/'.$url; + return $conf['url'].'/'.$url; } else { if (strpos($url, '?')) { $q=substr($url, strpos($url, '?')+1); $url=substr($url, 0, strpos($url, '?')); } if (strlen($url)) { - return $S['root'].'/index.php?req='.$url.(isset($q)?'&'.$q:''); + return $conf['url'].'/index.php?req='.$url.(isset($q)?'&'.$q:''); } else { - return $S['root'].'/index.php?'.$q; + 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']; |