From d3da989d3e2d2cb03cdc4bd2e23783f716ef5035 Mon Sep 17 00:00:00 2001 From: Eudyptula Date: Tue, 4 Aug 2009 17:58:55 -0400 Subject: Widespread cleanup - moved $conf, $death into $S; $S is given as arg to init_x() and body_x(); $request removed in favor of $_REQUEST; query() replaces $S[pdo]->query(); etc. --- backend/backend.php | 24 ++++---- backend/functions/get_pkgdirs.php | 6 +- backend/modules/gentoo_catalyst/build.php | 71 ----------------------- backend/modules/gentoo_catalyst/catalyst.conf | 79 -------------------------- backend/modules/gentoo_catalyst/catalystrc | 6 -- backend/modules/gentoo_portage/base-system.php | 2 +- backend/modules/gentoo_portage/build.php | 4 +- backend/modules/gentoo_portage/packages.php | 4 +- backend/modules/gentoo_portage/setup.php | 4 +- depend | 7 +-- frontend/classes/forms.php | 32 +++++------ frontend/classes/pdo.php | 8 --- frontend/classes/wizard.php | 12 ++-- frontend/css/debug.css | 2 +- frontend/css/general.css | 2 +- frontend/functions/onshutdown.php | 14 ++--- frontend/functions/r_stripslashes.php | 3 +- frontend/include/error_handling.php | 8 +-- frontend/include/footer.php | 6 +- frontend/include/header.php | 16 +++--- frontend/include/setup.php | 17 +++--- frontend/index.php | 13 ++--- frontend/js/ajax.js.php | 10 ++-- frontend/js/debug.js.php | 2 +- frontend/js/url.js.php | 2 +- frontend/modules/gentoo/step1.php | 2 +- frontend/modules/gentoo/step2.php | 2 +- frontend/modules/gentoo/step3.php | 4 +- frontend/modules/gentoo_catalyst.info.alpha | 4 -- frontend/pages/404.php | 5 +- frontend/pages/builds/delete.php | 10 ++-- frontend/pages/builds/download.php | 10 ++-- frontend/pages/builds/history.php | 12 ++-- frontend/pages/builds/index.php | 8 +-- frontend/pages/builds/log.php | 14 ++--- frontend/pages/builds/task.php | 22 ++++--- frontend/pages/configurations/manager.php | 18 +++--- frontend/pages/configurations/status.php | 10 ++-- frontend/pages/configurations/wizard.php | 29 +++++----- frontend/pages/invite.php | 16 +++--- frontend/pages/login.php | 20 +++---- frontend/pages/logout.php | 9 ++- frontend/pages/passthrough.php | 40 +++++++------ frontend/pages/register.php | 36 ++++++------ frontend/pages/stylesheet.php | 4 +- frontend/pages/upload.php | 9 ++- frontend/pages/welcome.php | 12 ++-- gentoo_setup.php | 4 +- lib/bkisofs-cli.c | 8 ++- pkglist.php | 3 +- setup.php | 18 +++--- shared/classes/0sql_row_obj.php | 2 - shared/classes/1conf_build_common.php | 4 +- shared/classes/build.php | 16 +++--- shared/classes/configuration.php | 3 +- shared/classes/gentoo_package.php | 2 +- shared/classes/gentoo_profile.php | 16 +++--- shared/classes/registrationtoken.php | 2 +- shared/classes/session.php | 10 ++-- shared/classes/task.php | 2 +- shared/classes/validate.php | 4 +- shared/functions/debug.php | 4 +- shared/functions/get_timezones.php | 8 +-- shared/functions/load_config.php | 2 +- shared/functions/query.php | 8 +++ shared/functions/url.php | 12 ++-- shared/functions/xhtmlemail.php | 6 +- shared/include/dbinit.php | 5 +- shared/include/includes.php | 1 + todo | 3 +- update_gentoo_profiles.php | 5 +- update_sql_classes.php | 3 +- 72 files changed, 297 insertions(+), 504 deletions(-) delete mode 100644 backend/modules/gentoo_catalyst/build.php delete mode 100644 backend/modules/gentoo_catalyst/catalyst.conf delete mode 100644 backend/modules/gentoo_catalyst/catalystrc delete mode 100644 frontend/classes/pdo.php delete mode 100644 frontend/modules/gentoo_catalyst.info.alpha create mode 100644 shared/functions/query.php diff --git a/backend/backend.php b/backend/backend.php index 343be9f..5090c63 100755 --- a/backend/backend.php +++ b/backend/backend.php @@ -8,7 +8,7 @@ if (isset($opts['f'])) { case -1: die("Failed to fork"); case 0: - $conf['debug']=false; + $S['conf']['debug']=false; break; default: die(); @@ -49,19 +49,19 @@ declare(ticks=1); require_once(SHARED.'/include/dbinit.php'); while (true) { // TODO check first for builds that need to be resumed (and figure out how to resume things) - $S['pdo']->query('LOCK TABLES `builds` WRITE'); - $r=$S['pdo']->query('SELECT * FROM `builds` WHERE `status`=-128 ORDER BY `ctime` ASC LIMIT 1'); + query('LOCK TABLES `builds` WRITE'); + $r=query('SELECT * FROM `builds` WHERE `status`=-128 ORDER BY `ctime` ASC LIMIT 1'); if ($r->rowCount()) { $build=new sql_build($r->fetch(PDO::FETCH_ASSOC)); $build->start=time(); $build->status=-1; $build->write(); - $S['pdo']->query('UNLOCK TABLES'); + query('UNLOCK TABLES'); debug('Starting build id='.$build->id); $file=null; try { - if ($conf['split_setup']) { - $opt=new sql_buildopt($build->id, 'backend', $conf['backend_id']); + if ($S['conf']['split_setup']) { + $opt=new sql_buildopt($build->id, 'backend', $S['conf']['backend_id']); $opt->write(); unset($opt); } @@ -75,7 +75,7 @@ while (true) { require_once(BACKEND."/bundlers/{$opts['bundler']}.php"); $proc='bundle_'.$opts['bundler']; $file=$proc($image, $workdir, $opts); - if (!$conf['debug']) { + if (!$S['conf']['debug']) { execute_command('Delete work directory', 'rm -rf "'.$workdir.'"'); } } catch (Exception $e) { @@ -83,13 +83,13 @@ while (true) { log_msg('Caught exception: '.$e->getMessage()); $build->status=126; $owner=$build->get_owner(); - xhtmlemail('"'.$owner->name.'" <'.$owner->email.'>', null, $conf['title'].' build failed', 'Your build has failed. You can find more information at id").'">'.url("build/$build->id").''); + xhtmlemail('"'.$owner->name.'" <'.$owner->email.'>', null, $S['conf']['title'].' build failed', 'Your build has failed. You can find more information at id").'">'.url("build/$build->id").''); } $build->finish=time(); debug('Finished with build id='.$build->id); if (isset($file)) { debug("Completed build successfully"); - if ($conf['split_setup']) { + if ($S['conf']['split_setup']) { $build->status=-127; $build->write(); $key=randstring(30); @@ -104,7 +104,7 @@ while (true) { )); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); $result=curl_exec($c); - if ($conf['debug'] && is_string($result)) { + if ($S['conf']['debug'] && is_string($result)) { debug($result); } if ($result === false || strpos($result, 'Upload successful') === false) { @@ -120,12 +120,12 @@ while (true) { $ext=substr($base, strpos($base, '.')); rename($file, COMPLETED.'/build-'.$build->id.$ext); } - xhtmlemail('"'.$owner->name.'" <'.$owner->email.'>', null, $conf['title'].' build finished', 'Your build has completed successfully. You can find more information and download the completed image at id").'">'.url("build/$build->id").''); + xhtmlemail('"'.$owner->name.'" <'.$owner->email.'>', null, $S['conf']['title'].' build finished', 'Your build has completed successfully. You can find more information and download the completed image at id").'">'.url("build/$build->id").''); } $build->write(); unset($build); } else { - $S['pdo']->query('UNLOCK TABLES'); + query('UNLOCK TABLES'); } // log_msg('Sleeping...', false); sleep(5); diff --git a/backend/functions/get_pkgdirs.php b/backend/functions/get_pkgdirs.php index 1f39420..b441f38 100644 --- a/backend/functions/get_pkgdirs.php +++ b/backend/functions/get_pkgdirs.php @@ -1,12 +1,12 @@ get_headers(); - $arch=explode(' ', $headers['accept_keywords']); - $arch=$arch[0]; - if (substr($arch, 0, 1) == '~') - $arch=substr($arch, 1); -// $C=$W.'/config_root'; - makedirs('catalyst_tmp', 'snapshot_cache'); - $catalyst=array( - 'digests' => '', - 'contents' => '', - 'distdir' => '', - // 'envscript' => '', - 'hash_function' => 'crc32', - 'options' => 'pkgcache metadata_overlay seedcache snapcache', - 'portdir' => $conf['portdir'], - 'sharedir' => '/usr/lib/catalyst', // This may not work on all systems - 'snapshotcache' => "$W/snapshot_cache", - 'storedir' => "$W/catalyst_tmp" - ); - $ctc=fopen("$W/catalyst.conf", 'w'); - foreach ($catalyst as $name => $val) { - fputs($ctc, "$name=\"$val\"\n"); - } - fclose($ctc); - // TODO - stages 1-3 first, only do stage4 if we have extra packages to install - $spec=array( - 'subarch' => $arch, - 'version_stamp' => gmdate('Ymd-His'), - 'target' => 'stage4', - 'rel_type' => 'default', - 'profile' => $headers['profile'], - 'snapshot' => gmdate('Ymd'), - 'source_subpath' => 'default', // FIXME - 'portage_confdir' => '', - 'portage_overlay' => '', - 'pkgcache_path' => "$W/pkgcache", - 'kerncache_path' => '', - 'stage4/use' => $headers['use'], - 'stage4/packages' => $opts['install_packages'], - 'stage4/fsscript' => '', - 'stage4/splash_theme' => '', - 'stage4/gk_mainargs' => '', - 'stage4/linuxrc' => '', - 'stage4/motd' => '', -// 'stage4/modblacklist' => '8139cp', // Not recognized by catalyst - 'stage4/rcadd' => '', - 'stage4/rcdel' => '', - 'stage4/root_overlay' => '', - 'stage4/xinitrc' => '', - 'stage4/users' => '', - 'boot/kernel' => '', - 'stage4/unmerge' => '', - 'stage4/empty' => '/var/tmp /var/cache /var/db /var/empty /var/lock /var/log /var/run /var/spool /var/state /tmp /usr/portage /usr/share/man /usr/share/info /usr/share/unimaps /usr/include /usr/share/zoneinfo /usr/share/dict /usr/share/doc /usr/share/ss /usr/share/state /usr/share/texinfo /usr/lib/python2.2 /usr/lib/portage /usr/share/gettext /usr/share/i18n /usr/share/rfc /usr/lib/X11/config /usr/lib/X11/etc /usr/lib/X11/doc /usr/src /usr/share/doc /usr/share/man /root/.ccache /etc/cron.daily /etc/cron.hourly /etc/cron.monthly /etc/cron.weekly /etc/logrotate.d /etc/rsync /usr/lib/awk /usr/lib/ccache /usr/lib/gcc-config /usr/lib/nfs /usr/local /usr/diet/include /usr/diet/man /usr/share/consolefonts/partialfonts /usr/share/consoletrans /usr/share/emacs /usr/share/gcc-data /usr/share/genkernel /etc/splash/gentoo /etc/splash/emergence /usr/share/gnuconfig /usr/share/lcms /usr/share/locale /etc/skel', - 'stage4/rm' => '/lib/*.a /usr/lib/*.a /usr/lib/gcc-lib/*/*/libgcj* /etc/dispatch-conf.conf /etc/etc-update.conf /etc/*- /etc/issue* /etc/make.conf /etc/man.conf /etc/*.old /root/.viminfo /usr/sbin/fb* /usr/sbin/fsck.cramfs /usr/sbin/fsck.minix /usr/sbin/mkfs.minix /usr/sbin/mkfs.bfs /usr/sbin/mkfs.cramfs /lib/security/pam_access.so /lib/security/pam_chroot.so /lib/security/pam_debug.so /lib/security/pam_ftp.so /lib/security/pam_issue.so /lib/security/pam_mail.so /lib/security/pam_motd.so /lib/security/pam_mkhomedir.so /lib/security/pam_postgresok.so /lib/security/pam_rhosts_auth.so /lib/security/pam_userdb.so /usr/share/consolefonts/1* /usr/share/consolefonts/7* /usr/share/consolefonts/8* /usr/share/consolefonts/9* /usr/share/consolefonts/A* /usr/share/consolefonts/C* /usr/share/consolefonts/E* /usr/share/consolefonts/G* /usr/share/consolefonts/L* /usr/share/consolefonts/M* /usr/share/consolefonts/R* /usr/share/consolefonts/a* /usr/share/consolefonts/c* /usr/share/consolefonts/dr* /usr/share/consolefonts/g* /usr/share/consolefonts/i* /usr/share/consolefonts/k* /usr/share/consolefonts/l* /usr/share/consolefonts/r* /usr/share/consolefonts/s* /usr/share/consolefonts/t* /usr/share/consolefonts/v* /etc/splash/livecd-2006.1/16* /etc/splash/livecd-2006.1/12* /etc/splash/livecd-2006.1/6* /etc/splash/livecd-2006.1/8* /etc/splash/livecd-2006.1/images/silent-16* /etc/splash/livecd-2006.1/images/silent-12* /etc/splash/livecd-2006.1/images/silent-6* /etc/splash/livecd-2006.1/images/silent-8* /etc/splash/livecd-2006.1/images/verbose-16* /etc/splash/livecd-2006.1/images/verbose-12* /etc/splash/livecd-2006.1/images/verbose-6* /etc/splash/livecd-2006.1/images/verbose-8* /etc/make.conf.example /etc/make.globals /etc/resolv.conf' - ); - $specfile=fopen("$W/stage4.spec", 'w'); - foreach ($spec as $name => $val) { - if (strlen($val)) - fputs($specfile, "$name: $val\n"); - } - fclose($specfile); - $pkgdir=$spec['pkgcache_path'].'/'.$spec['rel_type'].'/'.$spec['target'].'-'.$spec['version_stamp']; - makedir(dirname($pkgdir)); - symlink($pkgdir, $profile->pkgdir); - execute_command('Running Catalyst for build stage 4', "catalyst -c '$W/catalyst.conf' -f '$W/stage4.spec'"); -} -?> diff --git a/backend/modules/gentoo_catalyst/catalyst.conf b/backend/modules/gentoo_catalyst/catalyst.conf deleted file mode 100644 index ba5505b..0000000 --- a/backend/modules/gentoo_catalyst/catalyst.conf +++ /dev/null @@ -1,79 +0,0 @@ -# /etc/catalyst/catalyst.conf - -# Simple desriptions of catalyst settings. Please refer to the online -# documentation for more information. - -# Creates a .DIGESTS file containing the hash output from any of the supported -# options below. Adding them all may take a long time. -# Supported options: sha1, sha224, ripemd128, ripemd320, sha384, crc32, -# ripemd256, sha256, sha512, ripemd160, md5 -digests="md5 sha1" - -# Creates a .CONTENTS file listing the contents of the file. Pick from any of -# the supported options below: -# auto - strongly recommended -# tar-tv - does 'tar tvf FILE' -# tar-tvz - does 'tar tvzf FILE' -# tar-tvy - does 'tar tvyf FILE' -# isoinfo-l - does 'isoinfo -l -i FILE' -# isoinfo-f - does 'isoinfo -f -i FILE' -# 'isoinfo-f' is the only option not chosen by the automatic algorithm. -# If this variable is empty, no .CONTENTS will be generated at all. -contents="auto" - -# distdir specifies where your distfiles are located. This setting should -# work fine for most default installations. -distdir="/usr/portage/distfiles" - -# envscript allows users to set options such as http proxies, MAKEOPTS, -# GENTOO_MIRRORS, or any other environment variables needed for building. -# The envscript file sets environment variables like so: -# export FOO="bar" -envscript="/etc/catalyst/catalystrc" - -# Internal hash function catalyst should use for things like autoresume, -# seedcache, etc. The default and fastest is crc32. You should not ever need -# to change this unless your OS does not support it. -# Supported options: sha1, sha224, ripemd128, ripemd320, sha384, crc32, -# ripemd256, sha256, sha512, ripemd160, md5 -hash_function="crc32" - -# options set different build-time options for catalyst. Some examples are: -# autoresume = Attempt to resume a failed build, clear the autoresume flags with -# the -a option to the catalyst cmdline. -p will clear the autoresume flags -# as well as your pkgcache and kerncache -# ( This option is not fully tested, bug reports welcome ) -# ccache = enables build time ccache support (highly recommended) -# distcc = enable distcc support for building. You have to set distcc_hosts in -# your spec file. -# icecream = enables icecream compiler cluster support for building -# kerncache = keeps a tbz2 of your built kernel and modules (useful if your -# build stops in livecd-stage2) -# metadata_overlay = enabled the metadata_overlay cache module in portage, which -# uses the in-tree metadata -# pkgcache = keeps a tbz2 of every built package (useful if your build stops -# prematurely) -# seedcache = use the build output of a previous target if it exists to speed up -# the copy -# snapcache = cache the snapshot so that it can be bind-mounted into the chroot. -# WARNING: moving parts of the portage tree from within fsscript *will* break -# your cache. The cache is unlinked before any empty or rm processing, though. -# -# (These options can be used together) -options="autoresume kerncache metadata_overlay pkgcache seedcache snapcache" - -# portdir specifies the source portage tree used by the snapshot target. -portdir="/usr/portage" - -# sharedir specifies where all of the catalyst runtime executables are. Most -# users do not need to change this. -sharedir="/usr/lib64/catalyst" - -# snapshot_cache specifies where the snapshots will be cached to if snapcache is -# enabled in the options. -snapshot_cache="/var/tmp/catalyst/snapshot_cache" - -# storedir specifies where catalyst will store everything that it builds, and -# also where it will put its temporary files and caches. -storedir="/var/tmp/catalyst" - diff --git a/backend/modules/gentoo_catalyst/catalystrc b/backend/modules/gentoo_catalyst/catalystrc deleted file mode 100644 index 581772d..0000000 --- a/backend/modules/gentoo_catalyst/catalystrc +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -# This is an example catalystrc. As such, it doesn't actually *do* anything. - -# Uncomment the following to increase the number of threads used to compile. -# export MAKEOPTS="-j16" - diff --git a/backend/modules/gentoo_portage/base-system.php b/backend/modules/gentoo_portage/base-system.php index 35dc91e..a940c87 100644 --- a/backend/modules/gentoo_portage/base-system.php +++ b/backend/modules/gentoo_portage/base-system.php @@ -8,7 +8,7 @@ if ($opts['basesystem'] == 'manual' && $opts['prunepkgs']) { throw_exception('Base system autoprune not implemented - need package list'); $keep=explode(' ', $keep_pkgs); $remove=array(); - $r=$S['pdo']->query('SELECT * FROM `gentoo_basepkgs` WHERE `profile`='.$profile->id); + $r=query('SELECT * FROM `gentoo_basepkgs` WHERE `profile`='.$profile->id); while ($pkg=$r->fetch(PDO::FETCH_ASSOC)) { $pkg=$pkg['pkg']; if (($i=array_search($pkg, $keep)) === false) diff --git a/backend/modules/gentoo_portage/build.php b/backend/modules/gentoo_portage/build.php index aef8bde..5c1a1fd 100644 --- a/backend/modules/gentoo_portage/build.php +++ b/backend/modules/gentoo_portage/build.php @@ -2,13 +2,13 @@ require_once(dirname(__FILE__).'/packages.php'); // __DIR__ 5.3.0 // This is the main function that carries out a build from start to finish function gentoo_portage_build(&$build, &$opts, &$W) { - global $conf; + global $S; $profile=new sql_gentoo_profile($opts['profile']); $headers=$profile->get_headers(); $I="$W/image"; $extra=explode(' ', $opts['options']); require(dirname(__FILE__).'/setup.php'); // __DIR__ in 5.3.0 - if ($conf['debug']) + if ($S['conf']['debug']) execute_command_with_env('Log portage setup', 'emerge --info', $prtg_cfgrt); require(dirname(__FILE__).'/base-system.php'); // __DIR__ 5.3.0 if (in_array('pruneinit', $extra)) diff --git a/backend/modules/gentoo_portage/packages.php b/backend/modules/gentoo_portage/packages.php index 234186c..cfbb71d 100644 --- a/backend/modules/gentoo_portage/packages.php +++ b/backend/modules/gentoo_portage/packages.php @@ -1,7 +1,7 @@ .", symlink('.', "$C/etc")); $makeconf=array( - 'pkgdir' => $conf['pkgdir_root'].'/'.$profile->pkgdir, + 'pkgdir' => $S['conf']['pkgdir_root'].'/'.$profile->pkgdir, 'chost' => $headers['chost'], 'accept_keywords' => $headers['accept_keywords'], 'root' => $I, @@ -18,7 +18,7 @@ foreach ($makeconf as $name => $val) unset($makeconf); log_status('Writing '.$C.'/make.conf', file_put_contents($C.'/etc/make.conf', $contents)); unset($contents); -log_status('Making make.profile symlink to '.$conf['portdir'].'/profiles/'.$headers['profile'], symlink($conf['portdir'].'/profiles/'.$headers['profile'], $C.'/etc/make.profile')); +log_status('Making make.profile symlink to '.$S['conf']['portdir'].'/profiles/'.$headers['profile'], symlink($S['conf']['portdir'].'/profiles/'.$headers['profile'], $C.'/etc/make.profile')); global $prtg_cfgrt; $prtg_cfgrt=array('PORTAGE_CONFIGROOT' => $C); end_internal_task(0); diff --git a/depend b/depend index 95bc518..faf9cff 100644 --- a/depend +++ b/depend @@ -1,7 +1,6 @@ >=dev-lang/php-5.2.2 USE=pdo hash pcntl pcre cli pdo mysqli apache2 curl ctype reflection -sys-apps/fakeroot ? +>=virtual/mysql-5 sys-apps/portage # In case you use paludis -www-servers/apache APACHE2_MODULES=rewrite? -sys-fs/squashfs-tools(-4.0?) +www-servers/apache APACHE2_MODULES=rewrite +>=sys-fs/squashfs-tools-4 JFFS2: sys-fs/mtd-utils -EXT2: sys-fs/genext2fs diff --git a/frontend/classes/forms.php b/frontend/classes/forms.php index 39843e9..daa95cf 100644 --- a/frontend/classes/forms.php +++ b/frontend/classes/forms.php @@ -10,8 +10,7 @@ abstract class form_element { echo "$this->label: "; } public function process() { - global $request; - return isset($request[$this->htmlname])?$request[$this->htmlname]:false; + return isset($_REQUEST[$this->htmlname])?$_REQUEST[$this->htmlname]:false; } public function verify($val) { return $val !== false; @@ -47,10 +46,9 @@ class select extends form_element { echo "
\n"; } public function process() { - global $request; $vals=array_keys($this->options); - if (isset($request[$this->htmlname]) && is_numeric($request[$this->htmlname]) && isset($vals[$request[$this->htmlname]])) { - return $vals[$request[$this->htmlname]]; + if (isset($_REQUEST[$this->htmlname]) && is_numeric($_REQUEST[$this->htmlname]) && isset($vals[$_REQUEST[$this->htmlname]])) { + return $vals[$_REQUEST[$this->htmlname]]; } else return false; } public function verify($val) { @@ -90,11 +88,10 @@ class checkbox_array extends form_element { } } public function process() { - global $request; $val=array(); - if (isset($request[$this->htmlname])) { + if (isset($_REQUEST[$this->htmlname])) { $vals=array_keys($this->array); - foreach ($request[$this->htmlname] as $i => $null) { + foreach ($_REQUEST[$this->htmlname] as $i => $null) { $val[]=$vals[$i]; } } @@ -122,9 +119,9 @@ class checkbox_array extends form_element { class layered_checkbox_array extends checkbox_array { private $depth=0, $path_delims=array('', '/', '-'); function __construct($htmlname, $label, &$array, $delim=' ', $metadata) { - parent::__construct($htmlname, $label, &$array, $delim); + parent::__construct($htmlname, $label, $array, $delim); $this->metadata=$metadata; - for ($i=current(&$array); is_array($i); $i=current($i)) $this->depth++; + for ($i=current($array); is_array($i); $i=current($i)) $this->depth++; global $S; if (!in_array('lca', $S['scripts'])) { $S['scripts'][]='lca'; @@ -153,7 +150,7 @@ class layered_checkbox_array extends checkbox_array { } private function r_output(&$array, $depth=0, $path=null, $name=null) { static $uid=0, $ucid=0; - $conf=&$this->metadata[0]; + $S['conf']=&$this->metadata[0]; if ($depth == 0) { $search=$autosize=0; for ($i=1; $imetadata); $i++) { @@ -166,18 +163,18 @@ class layered_checkbox_array extends checkbox_array { } } if ($search) { - if (!isset($conf['id'])) { - $conf['id']=self::b36($uid++); + if (!isset($S['conf']['id'])) { + $S['conf']['id']=self::b36($uid++); } - echo 'Search: Clear Show checked
'."\n"; + echo 'Search: Clear Show checked
'."\n"; } - echo '
'."\n"; + echo '
'."\n"; foreach ($array as $name => &$val) { $this->r_output($val, $depth+1, $name, $name); $uid++; } echo '

No results

'; - echo "\n"; + echo "\n"; } else { $meta=$this->metadata[$depth]; if (isset($meta['tag'])) { @@ -214,8 +211,7 @@ class layered_checkbox_array extends checkbox_array { } else { $meta=$this->metadata[$depth]; if (isset($meta['checkbox'])) { - global $request; - if (isset($request[$this->htmlname][self::b36($ucid)])) { + if (isset($_REQUEST[$this->htmlname][self::b36($ucid)])) { $r[]=$this->format_label($array, $meta['checkbox'], $path, $name); } $ucid++; diff --git a/frontend/classes/pdo.php b/frontend/classes/pdo.php deleted file mode 100644 index daf71ba..0000000 --- a/frontend/classes/pdo.php +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/frontend/classes/wizard.php b/frontend/classes/wizard.php index 4d0d7b7..de37e72 100644 --- a/frontend/classes/wizard.php +++ b/frontend/classes/wizard.php @@ -1,6 +1,6 @@ configuration=&$c; $this->module=new module($c->module); @@ -16,13 +16,13 @@ class wizard_step { $this->next=isset($next)?$next:($this->step == $this->module->numsteps?null:$step+1); } public function output($rw=true) { - global $conf; + global $S; echo "
step\">"; if ($rw) echo '
Status'; if ($rw) { echo '

Step '.$this->step.': '.$this->title."

\n"; - $scale=$conf['progressbar_width']/$this->module->numsteps; + $scale=$S['conf']['progressbar_width']/$this->module->numsteps; echo '
'."\n"; $this->echo_buttons(); } @@ -43,8 +43,7 @@ class wizard_step { echo '
'."\n"; } public function process() { - global $request; - if (!isset($request['wizard_submit'][$this->step])) { + if (!isset($_REQUEST['wizard_submit'][$this->step])) { return $this->step; } $result=$this->next; @@ -91,9 +90,6 @@ class wizard_step { private function layered_checkbox_array($optname, $htmlname, $label, &$array, $delim=' ', $metadata) { $this->data[]=array(new layered_checkbox_array($htmlname, $label, $array, $delim, $metadata), $optname); } - private function query($q) { - return $GLOBALS['S']['pdo']->query($q); - } private function set_opt($opt, $val) { return $this->configuration->set_opt($opt, $val); } diff --git a/frontend/css/debug.css b/frontend/css/debug.css index 38c6774..7f49bd5 100644 --- a/frontend/css/debug.css +++ b/frontend/css/debug.css @@ -1,4 +1,4 @@ - + div#debug { font-family: monospace; background-color: white; diff --git a/frontend/css/general.css b/frontend/css/general.css index df0d3a6..4638de5 100644 --- a/frontend/css/general.css +++ b/frontend/css/general.css @@ -104,7 +104,7 @@ hr { .pointer { cursor: pointer; } - + html { margin-bottom: 2em; } diff --git a/frontend/functions/onshutdown.php b/frontend/functions/onshutdown.php index 60c2cb4..f144275 100644 --- a/frontend/functions/onshutdown.php +++ b/frontend/functions/onshutdown.php @@ -1,17 +1,17 @@ '.$death.''; + } elseif (isset($S['conf']) && isset($S) && is_array($S) && isset($_REQUEST) && isset($_REQUEST['ajax'])) { + if (isset($S['death'])) { + echo ''.$S['death'].''; } - if ($conf['debug']) { + if ($S['conf']['debug']) { foreach ($S['debug'] as $row) { list($type, $text)=$row; echo ''; diff --git a/frontend/functions/r_stripslashes.php b/frontend/functions/r_stripslashes.php index 8d6dccb..a0679f0 100644 --- a/frontend/functions/r_stripslashes.php +++ b/frontend/functions/r_stripslashes.php @@ -3,11 +3,10 @@ function r_stripslashes(&$array) { debug('r_stripslashes', print_r($array, true)); foreach ($array as $key => $value) { if (is_array($value)) { - $array[$key]=r_stripslashes($value); + r_stripslashes($value); } elseif (is_string($value)) { $array[$key]=stripslashes($value); } } - return $array; } ?> diff --git a/frontend/include/error_handling.php b/frontend/include/error_handling.php index 82f6122..5f616ee 100644 --- a/frontend/include/error_handling.php +++ b/frontend/include/error_handling.php @@ -1,12 +1,12 @@ getTrace() as $t) { $trace[]=''.$t['function'].'('.htmlentities(implode(', ', $t['args'])).') at '.$t['file'].' line '.$t['line'].'
'; } $trace=implode(' from
', $trace); - $death.=print_error('Uncaught '.get_class($e).': '.$e->getMessage(), 'Thrown at:
'.$trace); + $S['death'].=print_error('Uncaught '.get_class($e).': '.$e->getMessage(), 'Thrown at:
'.$trace); } set_exception_handler('exception_handler'); // Directly copied from PHP Manual -> Language Reference -> Predefined Exceptions -> ErrorException @@ -14,7 +14,7 @@ function exception_error_handler($errno, $errstr, $errfile, $errline ) { if ((error_reporting() & $errno) == 0) { // Don't report errors that aren't supposed to be reported return; } - global $death; + global $S; $errtypes=array( E_ERROR => 'Fatal Error', E_WARNING => 'Warning', @@ -54,7 +54,7 @@ function exception_error_handler($errno, $errstr, $errfile, $errline ) { } $trace.='from '.(isset($t['function'])?(isset($t['class'])?$t['class'].$t['type']:'').$t['function'].''.(isset($t['args'])?'('.htmlentities(implode(', ', $t['args'])).')':''):(isset($t['args'])?'Included file(s) '.implode(', ', $t['args']):'')).(isset($t['file'])?' at '.$t['file'].''.(isset($t['line'])?' line '.$t['line'].'':''):'').'
'; } - $death.=print_error($type, $errstr.'
'.$trace); + $S['death'].=print_error($type, $errstr.'
'.$trace); } set_error_handler("exception_error_handler"); ?> diff --git a/frontend/include/footer.php b/frontend/include/footer.php index 96ba9b9..9b42bcc 100644 --- a/frontend/include/footer.php +++ b/frontend/include/footer.php @@ -1,19 +1,19 @@
'."\n"; } echo /*'© Eitan Mosenkis '.date('Y').*/'
'; -if ($conf['debug']) { +if ($S['conf']['debug']) { echo '
Debug ('.$S['debugrow'].') [Clear] [X]
'./*$state->debug.*/'
'."\n"; echo '