diff options
author | Eudyptula <eitan@mosenkis.net> | 2009-08-06 19:12:48 -0400 |
---|---|---|
committer | Eudyptula <eitan@mosenkis.net> | 2009-08-06 19:12:48 -0400 |
commit | ed4e6670c58817a6dece1a5531f683445dfedb84 (patch) | |
tree | c8e13990de43d86adcd1262dcb6c22d98bfe1915 /frontend | |
parent | Added more package sets, created status document from Gentoo install guide, u... (diff) | |
download | ingenue-ed4e6670c58817a6dece1a5531f683445dfedb84.tar.gz ingenue-ed4e6670c58817a6dece1a5531f683445dfedb84.tar.bz2 ingenue-ed4e6670c58817a6dece1a5531f683445dfedb84.zip |
Numerous backend bugs fixed; use portage snapshot if available; frontend figures out its own URL; choose hostname; timezone config file set up; Fix setup.php; etc.
Diffstat (limited to 'frontend')
-rw-r--r-- | frontend/classes/forms.php | 2 | ||||
-rw-r--r-- | frontend/include/constants.php | 19 | ||||
-rw-r--r-- | frontend/include/setup.php | 7 | ||||
-rw-r--r-- | frontend/index.php | 1 | ||||
-rw-r--r-- | frontend/modules/gentoo/step2.php | 4 | ||||
-rw-r--r-- | frontend/modules/gentoo/step3.php | 2 | ||||
-rw-r--r-- | frontend/pages/builds/delete.php | 8 | ||||
-rw-r--r-- | frontend/pages/builds/download.php | 1 |
8 files changed, 18 insertions, 26 deletions
diff --git a/frontend/classes/forms.php b/frontend/classes/forms.php index daa95cf..6e5b43e 100644 --- a/frontend/classes/forms.php +++ b/frontend/classes/forms.php @@ -7,7 +7,7 @@ abstract class form_element { $this->label=htmlentities($label); } public function output($rw=true, $val=false) { - echo "$this->label: "; + echo "<b>$this->label:</b> "; } public function process() { return isset($_REQUEST[$this->htmlname])?$_REQUEST[$this->htmlname]:false; diff --git a/frontend/include/constants.php b/frontend/include/constants.php deleted file mode 100644 index fb16d89..0000000 --- a/frontend/include/constants.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php -define('RECIPE_CATEGORY', 'r'); -define('DISH_CATEGORY', 'd'); -define('INGREDIENT_CATEGORY', 'i'); -define('FAVORITE_RECIPE', 'R'); -define('FAVORITE_DISH', 'D'); -define('FAVORITE_MEAL', 'M'); -define('FAVORITE_TIP', 'T'); -define('FAVORITE_INGREDIENT', 'I'); -define('MODE_SET', 'set'); -define('MODE_WHERE', 'where'); -define('TYPE_CATEGORY', 'c'); -define('TYPE_RECIPE', 'r'); -define('TYPE_IMAGE', 'p'); -define('TYPE_USER', 'u'); -define('TYPE_DISH', 'd'); -define('TYPE_INGREDIENT', 'i'); -define('USER_TITLES', 'Mr. Mrs. Ms. Dr. Rabbi Rav Rabbi Dr. Rav Dr.'); -?> diff --git a/frontend/include/setup.php b/frontend/include/setup.php index 825d759..8c70af4 100644 --- a/frontend/include/setup.php +++ b/frontend/include/setup.php @@ -18,7 +18,12 @@ $S=array_merge($S, array( 'sql' => null )); unset($_REQUEST['req'], $_GET['req']); -$S['cookie_dir']=substr($S['conf']['url'], strpos($S['conf']['url'], '/', 8)).'/'; +$S['url']=rtrim('http://'.$_SERVER['HTTP_HOST'].($_SERVER['SERVER_PORT']==(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']?443:80)?'':':'.$_SERVER['SERVER_PORT']).dirname($_SERVER['PHP_SELF']), '/'); +if (($i=strpos($S['url'], '/', 8)) === false) + $S['cookie_dir']='/'; +else + $S['cookie_dir']=substr($S['url'], $i).'/'; +unset($i); require_once(SHARED.'/include/dbinit.php'); if (isset($_COOKIE[$S['conf']['cookiename']])) { $cookie=$_COOKIE[$S['conf']['cookiename']]; diff --git a/frontend/index.php b/frontend/index.php index 1c1ea7d..0fdfa17 100644 --- a/frontend/index.php +++ b/frontend/index.php @@ -3,7 +3,6 @@ define('E_DEFAULT', error_reporting(E_ALL|E_STRICT)); require_once('../shared/include/includes.php'); require_once('include/error_handling.php'); register_shutdown_function('onshutdown', realpath('include/footer.php'), realpath('include/header.php')); // Needed to ensure that errors are printed -require_once('include/constants.php'); require_once('include/setup.php'); if (get_magic_quotes_gpc()) r_stripslashes($_REQUEST); $routing=fopen('routing.csv', 'r'); diff --git a/frontend/modules/gentoo/step2.php b/frontend/modules/gentoo/step2.php index 1800255..7fa5456 100644 --- a/frontend/modules/gentoo/step2.php +++ b/frontend/modules/gentoo/step2.php @@ -1,8 +1,8 @@ <?php global $S; $profile=new sql_gentoo_profile($this->get_opt('profile')); -$this->checkbox_array('options', 'options', 'Configuration options', array('timezone' => 'Select timezone', 'dev-manager' => 'Select /dev manager', 'pruneinit' => 'Remove enabled-by-default init scripts')); -$this->select('basesystem', 'basesystem', 'Base system', array('stage3' => 'Stage3 Tarball', 'autoprune' => 'Remove all non-vital packages', 'manual' => 'Manually select packages to remove from stage3')); +$this->checkbox_array('options', 'options', 'Configuration options', array('timezone' => 'Select timezone', 'hostname' => 'Choose hostname', 'dev-manager' => 'Select /dev manager', 'pruneinit' => 'Remove enabled-by-default init scripts', 'portage' => 'Install portage snapshot and configure portage')); +$this->select('basesystem', 'basesystem', 'Base system', array('stage3' => 'Stage3 Tarball', /*'autoprune' => 'Remove all non-vital packages',*/ 'manual' => 'Manually select packages to remove from stage3')); $pkgsets=array(); $r=query('SELECT * FROM `gentoo_pkgsets` WHERE `profile`='.$profile->id); while ($pkgset=$r->fetch(PDO::FETCH_ASSOC)) { diff --git a/frontend/modules/gentoo/step3.php b/frontend/modules/gentoo/step3.php index 7074049..6af5b2e 100644 --- a/frontend/modules/gentoo/step3.php +++ b/frontend/modules/gentoo/step3.php @@ -3,6 +3,8 @@ global $S; $opts=explode(' ', $this->get_opt('options')); if (in_array('timezone', $opts)) $this->select('timezone', 'timezone', 'Timezone', get_timezones()); +if (in_array('hostname', $opts)) + $this->text_input('hostname', 'hostname', 'Hostname'); if (in_array('dev-manager', $opts)) $this->select('dev-manager', 'dev-manager', '/dev Manager', array('udev' => 'udev', 'static-dev' => 'Static /dev')); $profile=new sql_gentoo_profile($this->get_opt('profile')); diff --git a/frontend/pages/builds/delete.php b/frontend/pages/builds/delete.php index 51aa9cf..5ff1d9a 100644 --- a/frontend/pages/builds/delete.php +++ b/frontend/pages/builds/delete.php @@ -9,10 +9,14 @@ function init_builds_delete(&$S) { return array('title' => 'Delete Build'); } function body_builds_delete(&$S) { - if ($S['build']->status >= 0 || $S['build']->status == -128) { + if ($S['build']->status >= 0 || $S['build']->status == INGENUE_BUILD_QUEUED) { $S['build']->delete(); echo print_success('Build deleted.'); + } elseif ($S['build']->status != INGENUE_BUILD_CANCEL) { + $S['build']->status=INGENUE_BUILD_CANCEL; + $S['build']->write(); + echo print_success('Build queued for cancellation.'); } else - echo print_error('Cannot delete build while it is being built.'); + echo print_error('This build is already queued for cancellation.'); } ?> diff --git a/frontend/pages/builds/download.php b/frontend/pages/builds/download.php index 411efbf..759b5c4 100644 --- a/frontend/pages/builds/download.php +++ b/frontend/pages/builds/download.php @@ -41,6 +41,7 @@ function init_builds_download(&$S) { header('Content-Disposition: attachment; filename="'.(isset($build->name) && strlen($build->name)?str_replace('"', '\"', $build->name):'ingenue-'.$build->id).$ext); } function body_builds_download(&$S) { + ob_end_flush(); // At least in 5.3, we get a 500 Internal Server Error without this readfile($S['builds_download']['file']); // Log the download to db after sending data so hopefully HEAD requests won't artificially inflate the # of dls $S['builds_download']['dl']->write(); |