diff options
author | Preston Cody <codeman@gentoo.org> | 2006-05-07 19:57:58 +0000 |
---|---|---|
committer | Preston Cody <codeman@gentoo.org> | 2006-05-07 19:57:58 +0000 |
commit | eeaf8661946f2bf0fdf39dc8b850230ab322fda9 (patch) | |
tree | e02ac2a6ceb7538600afb148e341336efe838e12 /webgli | |
parent | return true/false in parse() (diff) | |
download | scire-eeaf8661946f2bf0fdf39dc8b850230ab322fda9.tar.gz scire-eeaf8661946f2bf0fdf39dc8b850230ab322fda9.tar.bz2 scire-eeaf8661946f2bf0fdf39dc8b850230ab322fda9.zip |
adding a lot of webgli screens, some of which are done
the details of the status of webgli is in /webgli/TODO
svn path=/; revision=55
Diffstat (limited to 'webgli')
-rw-r--r-- | webgli/TODO | 27 | ||||
-rw-r--r-- | webgli/bootloader.php | 20 | ||||
-rw-r--r-- | webgli/clientconfig.php | 100 | ||||
-rw-r--r-- | webgli/etc_portage.php | 38 | ||||
-rw-r--r-- | webgli/globaluse.php | 2 | ||||
-rw-r--r-- | webgli/kernel.php | 77 | ||||
-rw-r--r-- | webgli/networkmounts.php | 33 | ||||
-rw-r--r-- | webgli/review.php | 184 | ||||
-rw-r--r-- | webgli/services.php | 51 | ||||
-rw-r--r-- | webgli/stageselection.php | 55 | ||||
-rw-r--r-- | webgli/templates/clientconfig.tpl | 3 | ||||
-rw-r--r-- | webgli/templates/extrapackages.tpl | 2 | ||||
-rw-r--r-- | webgli/templates/globaluse.tpl | 2 | ||||
-rw-r--r-- | webgli/templates/header.tpl | 1 | ||||
-rw-r--r-- | webgli/templates/kernel.tpl | 42 | ||||
-rw-r--r-- | webgli/templates/networkmounts.tpl | 51 | ||||
-rw-r--r-- | webgli/templates/review.tpl | 5 | ||||
-rw-r--r-- | webgli/templates/services.tpl | 26 | ||||
-rw-r--r-- | webgli/templates/stageselection.tpl | 34 | ||||
-rw-r--r-- | webgli/templates/timezone.tpl | 15 | ||||
-rw-r--r-- | webgli/templates_c/%%F7^F7F^F7F34188%%header.tpl.php | 64 | ||||
-rw-r--r-- | webgli/timezone.php | 71 | ||||
-rw-r--r-- | webgli/webgliUtility.php | 16 |
23 files changed, 780 insertions, 139 deletions
diff --git a/webgli/TODO b/webgli/TODO new file mode 100644 index 0000000..0a73f32 --- /dev/null +++ b/webgli/TODO @@ -0,0 +1,27 @@ +for agaffney: + uribrowser + etc_portage value-only saving to etc_files + partitioning section of Review + +Incomplete pages: + Welcome - modes. need to save to session var. + Client Config - needs to load values. new layout + Partitioning - not yet done at all. + URI Browser + Global/local USE - doesn't load/save values + Make.conf - doesn't load. + etc/portage - doesn't save or load. + Bootloader - half done. + Networking - not done at all. + Users + Review - half done. + +Working pages: + Network Mounts - i think. untested. + Stage Selection + Portage Tree + Config Files + Timezone + Daemons + Extra Packages + Services diff --git a/webgli/bootloader.php b/webgli/bootloader.php index 719042d..10a891a 100644 --- a/webgli/bootloader.php +++ b/webgli/bootloader.php @@ -18,24 +18,24 @@ $error_msg = ""; if ($_POST['setbootloader']) { if ($_POST['bootloader']) { - $ip->set("bootloader_pkg",$_POST['bootloader']) or - $error_msg .= "ERROR: Could not set the bootloader pkg!"; + $ip->set("bootloader_pkg",$_POST['bootloader']); + $error_msg .= "ERROR: Could not set the bootloader pkg!"; } if ($_POST['bootmbr']) { - $ip->set("bootloader_mbr",True) or - $error_msg .= "ERROR: Could not set the bootloader MBR flag to TRUE"; + $ip->set("bootloader_mbr",True); + $error_msg .= "ERROR: Could not set the bootloader MBR flag to TRUE"; if ($_POST['boot_drive_choice']) { - $ip->set("boot_device",$_POST['boot_drive_choice']) or - $error_msg .= "ERROR! Could not set the boot device! ".$_POST['boot_drive_choice']; + $ip->set("boot_device",$_POST['boot_drive_choice']); + $error_msg .= "ERROR! Could not set the boot device! ".$_POST['boot_drive_choice']; } } else { - $ip->set("bootloader_mbr",False) or - $error_msg .= "ERROR: Could not set the bootloader MBR flag to FALSE."; + $ip->set("bootloader_mbr",False); + $error_msg .= "ERROR: Could not set the bootloader MBR flag to FALSE."; } if ($_POST['bootargs']) { - $ip->set("bootloader_kernel_args",$_POST['bootargs']) or - $error_msg .= "ERROR: Could not set the bootloader kernel arguments!"; + $ip->set("bootloader_kernel_args",$_POST['bootargs']); + $error_msg .= "ERROR: Could not set the bootloader kernel arguments!"; } if (!$error_msg) { diff --git a/webgli/clientconfig.php b/webgli/clientconfig.php index 12c7713..9f9d578 100644 --- a/webgli/clientconfig.php +++ b/webgli/clientconfig.php @@ -1,5 +1,5 @@ <?php -include('webgliIP.php'); +include('webgliCF.php'); include('webgliUtility.php'); include('Smarty.class.php'); @@ -9,100 +9,110 @@ $smarty->template_dir = './templates'; $smarty->compile_dir = './templates_c'; $smarty->cache_dir = './cache'; $smarty->config_dir = './configs'; +$error_msg = ""; +$cf = new ClientConfiguration(); +$cf->parse('testcc.xml') or $error_msg .= "No configuration could be loaded."; - -$error_msg = ""; if ($_POST['SaveCC']) { if ($_POST['ArchType']) { $error_msg .= "Found an architecture: you submitted " . $_POST['ArchType']. "<BR>\n"; - #shared_info.client_profile.set_architecture_template(None, $_POST['ArchType'], None) - $error_msg .= "ERROR: Could not set the Architecture Template<br>\n"; + $cf->set("architecture_template", $_POST['ArchType']); + #$error_msg .= "ERROR: Could not set the Architecture Template<br>\n"; } if ($_POST['Logfile']) { $error_msg .= "Found a logfile: you submitted " . $_POST['Logfile'] . "<BR>\n"; - #shared_info.client_profile.set_log_file(None, $_POST['Logfile'], None) - $error_msg .= "ERROR: Could not set the Logfile <BR>\n"; + $cf->set("log_file",$_POST['Logfile']); + #$error_msg .= "ERROR: Could not set the Logfile <BR>\n"; } if ($_POST['RootMountPoint']) { $error_msg .= "Found a root mount point: you submitted " . $_POST['RootMountPoint'] . "<BR>\n"; - #shared_info.client_profile.set_root_mount_point(None, $_POST['RootMountPoint'], None) - $error_msg .= "ERROR: Could not set the Root Mount Point<BR>\n"; + $cf->set("root_mount_point",$_POST['RootMountPoint']); + #$error_msg .= "ERROR: Could not set the Root Mount Point<BR>\n"; } if ($_POST['Network_Iface']) { $error_msg .= "Found a network interface: you submitted " . $_POST['Network_Iface'] . "<BR>\n"; - #shared_info.client_profile.set_network_interface(None, $_POST['Network_Iface'], None) - $error_msg .= "ERROR: Could not set the Network Interface<BR>\n"; + $cf->set("network_interface", $_POST['Network_Iface']); + #$error_msg .= "ERROR: Could not set the Network Interface<BR>\n"; } if ($_POST['Network_Type']) { $error_msg .= "Found a Network Type: you submitted " . $_POST['Network_Type'] . "<BR>\n"; - #shared_info.client_profile.set_network_type(None, $_POST['Network_Type'], None) - $error_msg .= "ERROR: Could not set the Network Type<BR>\n"; + $cf->set("network_type", $_POST['Network_Type']); + #$error_msg .= "ERROR: Could not set the Network Type<BR>\n"; } if ($_POST['dhcp_options']) { $error_msg .= "Found DHCP Options. You submitted " . $_POST['dhcp_options'] . "<BR>\n"; - #shared_info.client_profile.set_network_dhcp_options(None, $_POST['dhcp_options'], None) - $error_msg .= "ERROR: Could not set the dhcp options<br>\n"; + $cf->set("network_dhcp_options", $_POST['dhcp_options']); + #$error_msg .= "ERROR: Could not set the dhcp options<br>\n"; } if ($_POST['ip']) { $error_msg .= "Found an IP: you submitted " . $_POST['ip'] . "<BR>\n"; - #shared_info.client_profile.set_network_ip(None, $_POST['ip'], None) - $error_msg .= "ERROR: Could not set the IP<BR>\n"; + $cf->set("network_ip",$_POST['ip']); + #$error_msg .= "ERROR: Could not set the IP<BR>\n"; } if ($_POST['broadcast']) { $error_msg .= "Found an broadcast IP: you submitted " . $_POST['broadcast'] . "<BR>\n"; - #shared_info.client_profile.set_network_broadcast(None, $_POST['broadcast'], None) - $error_msg .= "ERROR: Could not set the broadcast IP<BR>\n"; + $cf->set("network_broadcast", $_POST['broadcast']); + #$error_msg .= "ERROR: Could not set the broadcast IP<BR>\n"; } if ($_POST['netmask']) { $error_msg .= "Found an netmask IP: you submitted " . $_POST['netmask'] . "<BR>\n"; - #shared_info.client_profile.set_network_netmask(None, $_POST['netmask'], None) - $error_msg .= "ERROR: Could not set the netmask IP<BR>\n"; + $cf->set("network_netmask", $_POST['netmask']); + #$error_msg .= "ERROR: Could not set the netmask IP<BR>\n"; } if ($_POST['gateway']) { $error_msg .= "Found an gateway IP: you submitted " . $_POST['gateway'] . "<BR>\n"; - #shared_info.client_profile.set_network_gateway(None, $_POST['gateway'], None) - $error_msg .= "ERROR: Could not set the gateway IP<BR>\n"; + $cf->set("network_gateway",$_POST['gateway']); + #$error_msg .= "ERROR: Could not set the gateway IP<BR>\n"; } if ($_POST['http_proxy']) { $error_msg .= "Found an HTTP Proxy IP: you submitted " . $_POST['http_proxy'] . "<BR>\n"; - #shared_info.client_profile.set_http_proxy(None, $_POST['http_proxy'], None) - $error_msg .= "ERROR: Could not set the HTTP Proxy IP<BR>\n"; + $cf->set("http_proxy", $_POST['http_proxy']); + #$error_msg .= "ERROR: Could not set the HTTP Proxy IP<BR>\n"; } if ($_POST['ftp_proxy']) { $error_msg .= "Found an FTP Proxy IP: you submitted " . $_POST['ftp_proxy'] . "<BR>\n"; - #shared_info.client_profile.set_ftp_proxy(None, $_POST['ftp_proxy'], None) - $error_msg .= "ERROR: Could not set the FTP Proxy IP<BR>\n"; + $cf->set("ftp_proxy", $_POST['ftp_proxy']); + #$error_msg .= "ERROR: Could not set the FTP Proxy IP<BR>\n"; } if ($_POST['rsync_proxy']) { $error_msg .= "Found an RSYNC Proxy IP: you submitted " . $_POST['rsync_proxy'] . "<BR>\n"; - #shared_info.client_profile.set_rsync_proxy(None, $_POST['rsync_proxy'], None) - $error_msg .= "ERROR: Could not set the RSYNC Proxy IP<BR>\n"; + $cf->set("rsync_proxy",$_POST['rsync_proxy']); + #$error_msg .= "ERROR: Could not set the RSYNC Proxy IP<BR>\n"; } + $dns_servers = array(); if ($_POST['dnsserver']) { $error_msg .= "Found an DNS server: you submitted " . $_POST['dnsserver'] . "<BR>\n"; - #shared_info.client_profile.set_dns_servers(None, $_POST['dnsserver'], None) + array_push($dns_servers, $_POST['dnsserver']); + } + if ($_POST['dnsserver2']) { + $error_msg .= "Found an alternate DNS server: you submitted " . $_POST['dnsserver2'] . "<BR>\n"; + array_push($dns_servers, $_POST['dnsserver2']); + } + if ($dns_servers) { + $cf->set("dns_servers", $dns_servers); $error_msg .= "ERROR: Could not set the DNS Server<BR>\n"; } if ($_POST['EnableSSH']) { $error_msg .= "Found an Enable SSH Flag: you set it to " . $_POST['EnableSSH'] . "<BR>\n"; - #shared_info.client_profile.set_enable_ssh(None, $_POST['EnableSSH'], None) - $error_msg .= "ERROR: Could not set the SSH flag<BR>\n"; + $cf->set("enable_ssh", $_POST['EnableSSH']); + #$error_msg .= "ERROR: Could not set the SSH flag<BR>\n"; } if ($_POST['Verbose']) { $error_msg .= "Found an Verbose Mode Flag: you set it to " . $_POST['Verbose'] . "<BR>\n"; - #shared_info.client_profile.set_verbose(None, $_POST['Verbose'], None) - $error_msg .= "ERROR: Could not set the Verbose mode flag<BR>\n"; + $cf->set("verbose", $_POST['Verbose']); + #$error_msg .= "ERROR: Could not set the Verbose mode flag<BR>\n"; } if ($_POST['RootPass1'] and $_POST['RootPass2']) { $error_msg .= "Found a root password1: you submitted " . $_POST['RootPass1'] . "<BR>\n"; $error_msg .= "Found a root password2: you submitted " . $_POST['RootPass2'] . "<BR>\n"; if ($_POST['RootPass1'] == $_POST['RootPass2']) { - #shared_info.client_profile.set_root_passwd(None, GLIUtility.hash_password($_POST['RootPass1']), None) + $error_msg .= "Trying to set the root password. <br>"; + $cf->set("root_passwd",hash_password($_POST['RootPass1'])); $error_msg .= "ERROR: Could not set the root password<BR>\n"; } else { $error_msg .= "ERROR: Passwords DO NOT MATCH!<BR>\n"; @@ -110,17 +120,14 @@ if ($_POST['SaveCC']) { } if ($_POST['Modules']) { $error_msg .= "Found an Additional Module: you submitted " . $_POST['Modules'] . "<BR>\n"; - #shared_info.client_profile.set_kernel_modules(None, $_POST['Modules'], None) - $error_msg .= "ERROR: Could not set the Kernel Modules<BR>\n"; - } - if ($_POST['SaveCCFile']) { - $error_msg .= "Found a filename to save the Client Profile:" . $_POST['SaveCCFile'] . "<BR>\n"; - - #configuration = open($_POST['SaveCCFile'] ,"w") - # configuration.write(shared_info.client_profile.serialize()) - # configuration.close() - # print "Profile saved successfully. Here it is <BR><pre>" . cgi.escape(#shared_info.client_profile.serialize()) . "</pre><br>\n" - $error_msg .= "ERROR: Could not save the profile!<BR>\n"; + $cf->set("kernel_modules", $_POST['Modules']); + #$error_msg .= "ERROR: Could not set the Kernel Modules<BR>\n"; + } + if ($_POST['SaveCC']) { + $error_msg .= "Trying to save the profile. <br>\n"; + #SAVE VALUES + file_put_contents('testcc.xml', $cf->serialize()); #PHP 5 only + #$error_msg .= "ERROR: Could not save the profile!<BR>\n"; } if ($error_msg == "") { $error_msg = "Values saved successfully"; @@ -157,4 +164,5 @@ $modules = list_modules(); $smarty->assign('modules', $modules); $smarty->display('clientconfig.tpl'); + ?> diff --git a/webgli/etc_portage.php b/webgli/etc_portage.php index 36efd0b..b446e3c 100644 --- a/webgli/etc_portage.php +++ b/webgli/etc_portage.php @@ -1,39 +1,47 @@ <?php -#include('webgliIP.php'); +include('webgliIP.php'); include('webgliUtility.php'); include('Smarty.class.php'); $smarty = new Smarty; -#phpinfo(); + $smarty->template_dir = './templates'; $smarty->compile_dir = './templates_c'; $smarty->cache_dir = './cache'; $smarty->config_dir = './configs'; -$error_msg = ""; +$ip = new InstallProfile(); +$ip->parse('test.xml'); -#etc_files = shared_info.install_profile.get_etc_files() +$error_msg = ""; +$etc_files = $ip->get("etc_files"); +$smarty->assign('dynamic', $ip->get("dynamic_stage3")); if ($_POST['save']) { if ( !$_POST['currentfile'] ) { $error_msg .= "ERROR you must select a file to edit!<br>"; - $file = $_POST['currentfile']; - #etc_files[file] = [] - #etc_files[file].append($_POST['filecontents']) - #shared_info.install_profile.set_etc_files(etc_files) } + $file = $_POST['currentfile']; + #if (array_key_exists($file,$etc_files)) { + $etc_files[$file] = $_POST['filecontents']; + #} else { + # $etc_files[$file] = + #etc_files[file].append($_POST['filecontents']) + $ip->set("etc_files",$etc_files); + #SAVE VALUES + file_put_contents('test.xml', $ip->serialize()); #PHP 5 only if ( !$error_msg ) { $error_msg = "Values saved successfully"; } } if ($_POST['fileeditsubmit']) { if ($_POST['editfile']) { $file_to_edit = $_POST['editfile']; $smarty->assign('file_to_edit',$file_to_edit); - #if file_to_edit in etc_files: - #previous_contents = "\n".join(etc_files[file_to_edit]) - #else: - #previous_contents = "" + if (array_key_exists($file_to_edit,$etc_files)) { + $previous_contents = join("\n",$etc_files[$file_to_edit]); + } else { + $previous_contents = ""; + } } - #save value } #get portage file list here @@ -42,8 +50,8 @@ $file_list["portage/package.unmask"] = "A list of packages to unmask."; $file_list["portage/package.keywords"] = "Per-package KEYWORDS (like ACCEPT_KEYWORDS)."; $file_list["portage/package.use"] = "Per-package USE flags."; $smarty->assign('file_list',$file_list); - - +$smarty->assign('error_msg',$error_msg); +$smarty->assign('previous_contents',$previous_contents); $smarty->display('etc_portage.tpl'); ?> diff --git a/webgli/globaluse.php b/webgli/globaluse.php index c1cd99d..8d105dd 100644 --- a/webgli/globaluse.php +++ b/webgli/globaluse.php @@ -13,7 +13,7 @@ $smarty->config_dir = './configs'; $ip = new InstallProfile(); $ip->parse('test.xml'); $etc_files = $ip->get("etc_files"); -$smarty->assign('dynamic',$ip->get("dynamic_stage3"); +$smarty->assign('dynamic',$ip->get("dynamic_stage3")); $error_msg = ""; $global_use_flags = ""; diff --git a/webgli/kernel.php b/webgli/kernel.php new file mode 100644 index 0000000..820d44d --- /dev/null +++ b/webgli/kernel.php @@ -0,0 +1,77 @@ +<?php + +include('webgliIP.php'); +include('webgliUtility.php'); + +include('Smarty.class.php'); +$smarty = new Smarty; + +$smarty->template_dir = './templates'; +$smarty->compile_dir = './templates_c'; +$smarty->cache_dir = './cache'; +$smarty->config_dir = './configs'; + +$ip = new InstallProfile(); +$ip->parse('test.xml'); + +#CHANGE THIS TO A SESSION VAR. +$smarty->assign('advanced',True); + +$error_msg = ""; +print_r($_POST); + +if ($_POST['setkernel']) { + if ($_POST['manualsources']) { + $ip->set("kernel_source_pkg", $_POST['manualsources']); + #$error_msg .= "ERROR: Could not set the kernel sources!" . $_POST['manualsources']; + } + elseif ($_POST['sources']) { + $ip->set("kernel_source_pkg", $_POST['sources']); + #$error_msg .= "ERROR: Could not set the kernel sources!" . $_POST['sources']; + } + + if ($_POST['build_method']) { + $ip->set("kernel_build_method", $_POST['build_method']); + #$error_msg .= "ERROR: Could not set the kernel build method!"; + if ($_POST['configuri']) { + $ip->set("kernel_config_uri", $_POST['configuri']); + # $error_msg .= "ERROR: Could not set the kernel config URI!"; + } + } + + if ($_POST['bootsplash']) { + $ip->set("kernel_bootsplash", $_POST['bootsplash']); + #$error_msg .= "ERROR: Could not set the kernel bootsplash!" . $_POST['bootsplash']; + } + #SAVE VALUES + file_put_contents('test.xml', $ip->serialize()); #PHP 5 only + if (!$error_msg) { + $error_msg = "Values saved successfully"; + } +} + +$sources = $ip->get("kernel_source_pkg"); +$build_method = $ip->get("kernel_build_method"); +$bootsplash = $ip->get("kernel_bootsplash"); +$configuri = $ip->get("kernel_config_uri"); + +$kernels["livecd-kernel"] = array("Livecd Kernel","Use the running kernel (fastest)"); +$kernels["vanilla-sources"] = array("Vanilla (normal)","Normal. The Unaltered Linux Kernel ver 2.6+ (safest) (recommended)"); +$kernels["gentoo-sources"] = array("Gentoo","Gentoo's optimized 2.6+ kernel. (less safe)"); +$kernels["hardened-sources"] = array("Hardened","Hardened sources for the 2.6 kernel tree"); +$kernels["grsec-sources"] = array("grsec","Vanilla sources with grsecurity patches"); +if ($sources == "livecd-kernel" or $sources == "vanilla-sources" or $sources == "gentoo-sources" or $sources == "hardened-sources" or $sources == "grsec-sources") { + $cust_source = False; +} else { + $cust_source = True; +} +$smarty->assign("error_msg", $error_msg); +$smarty->assign("sources", $sources); +$smarty->assign("build_method",$build_method); +$smarty->assign("bootsplash",$bootsplash); +$smarty->assign("configuri",$configuri); +$smarty->assign("kernels",$kernels); +$smarty->assign("cust_source",$cust_source); + +$smarty->display("kernel.tpl"); +?> diff --git a/webgli/networkmounts.php b/webgli/networkmounts.php new file mode 100644 index 0000000..cba721a --- /dev/null +++ b/webgli/networkmounts.php @@ -0,0 +1,33 @@ +<?php + +include('webgliIP.php'); +include('webgliUtility.php'); + +include('Smarty.class.php'); +$smarty = new Smarty; + +$smarty->template_dir = './templates'; +$smarty->compile_dir = './templates_c'; +$smarty->cache_dir = './cache'; +$smarty->config_dir = './configs'; + +$ip = new InstallProfile(); +$ip->parse('test.xml'); + +$error_msg = ""; +$network_mounts = $ip->get("network_mounts"); +# THE PYHTML WAY DID DEEP COPY HERE. +if ($_POST['addnfs']) { + if (!$_POST['hostname']) $error_msg .= "ERROR: Hostname not found."; + if (!$_POST['export']) $error_msg .= "ERROR: Export not found."; + if (!$_POST['mountpoint']) $error_msg .= "ERROR: Mountpoint not found."; + array_push($network_mounts, array('export'=> $_POST['export'], 'host'=> $_POST['hostname'], 'mountopts'=> $_POST['mountopts'], 'mountpoint'=> $_POST['mountpoint'], 'type'=> 'nfs')); + $ip->set("network_mounts",$network_mounts) or + $error_msg .= "ERROR: Could not add network mount."; +} +elseif ($_POST['Search']) { + $error_msg .= "Function not yet implemented! Very sorry about that!"; +} +$smarty->assign('network_mounts',$network_mounts); +$smarty->display('networkmounts.tpl'); +?> diff --git a/webgli/review.php b/webgli/review.php new file mode 100644 index 0000000..f439016 --- /dev/null +++ b/webgli/review.php @@ -0,0 +1,184 @@ +<?php + +include('webgliIP.php'); +include('webgliUtility.php'); + +include('Smarty.class.php'); +$smarty = new Smarty; + +$smarty->template_dir = './templates'; +$smarty->compile_dir = './templates_c'; +$smarty->cache_dir = './cache'; +$smarty->config_dir = './configs'; + +$ip = new InstallProfile(); +$ip->parse('test.xml'); + +$error_msg = ""; +$data = ""; +$data .= "Look carefully at the following settings to check for mistakes.\nThese are the installation settings you have chosen:\n\n"; + +#Partitioning +$data .= "Partitioning: \n Key: Minor, Pri/Ext, Filesystem, MkfsOpts, Mountpoint, MountOpts, Size.\n"; +$devices = $ip->get("partition_tables"); #shared_info.install_profile.get_partition_tables() +$drives = array_keys($devices); +sort($drives); +/* +foreach ($drives as $drive) { + $data .= " Drive: " . $drive . $devices[$drive].get_model() . "\n"; + partlist = devices[drive].get_ordered_partition_list() + tmpparts = devices[drive] #.get_partitions() + for part in partlist: + tmppart = tmpparts[part] + entry = " " + if tmppart.get_type() == "free": + #partschoice = "New" + entry .= _(u" - Unallocated space (") + if tmppart.is_logical(): + entry .= _(u"logical, ") + entry .= str(tmppart.get_mb()) . "MB)" + elif tmppart.get_type() == "extended": + entry .= str(int(tmppart.get_minor())) + entry .= _(u" - Extended Partition (") . str(tmppart.get_mb()) . "MB)" + else: + entry .= str(int(tmppart.get_minor())) . " - " + if tmppart.is_logical(): + entry .= _(u"Logical (") + else: + entry .= _(u"Primary (") + entry .= tmppart.get_type() . ", " + entry .= (tmppart.get_mkfsopts() or "none") . ", " + entry .= (tmppart.get_mountpoint() or "none") . ", " + entry .= (tmppart.get_mountopts() or "none") . ", " + entry .= str(tmppart.get_mb()) . "MB)" + $data .= entry . "\n" + +#Network Mounts: +network_mounts = copy.deepcopy(shared_info.install_profile.get_network_mounts()) +$data .= "\nNetwork Mounts: \n" +for mount in network_mounts: + $data .= " ".mount['host'].":".mount['export']."\n" +*/ +#Install Stage: +$data .= "\nInstall Stage: " . $ip->get("install_stage") . "\n"; +if ($ip->get("dynamic_stage3")) { + $data .= " Tarball will be generated on the fly from the CD.\n"; +} else { + $data .= " Tarball URI: " . $ip->get("stage_tarball_uri") . "\n"; +} + +#Portage Tree Sync Type: +$data .= "\nPortage Tree Sync Type: " . $ip->get("portage_tree_sync_type") . "\n"; +if ( $ip->get("portage_tree_sync_type") == "snapshot") { + $data .= " Portage snapshot URI: " . $ip->get("portage_tree_snapshot_uri") . "\n"; +} + +#Kernel Settings: +$data .= "\nKernel Settings:\n"; +$data .= " Kernel Sources: " . $ip->get("kernel_source_pkg") . "\n"; +if ($ip->get("kernel_source_pkg") != "livecd-kernel") { + $data .= " Kernel Build Method: " . $ip->get("kernel_build_method") . "\n"; + if ( $ip->get("kernel_build_method") == "genkernel") { + $data .= " Kernel Bootsplash Option: " . $ip->get("kernel_bootsplash") . "\n"; + } +} +if ( $ip->get("kernel_config_uri")) { + $data .= " Kernel Configuration URI: " . $ip->get("kernel_config_uri") . "\n"; +} + +#Bootloader Settings: +$data .= "\nBootloader Settings:\n"; +$data .= " Bootloader package: " . $ip->get("boot_loader_pkg") . "\n"; +if ( $ip->get("boot_loader_pkg") != "none") { + $data .= " Install bootloader to MBR: " . $ip->get("boot_loader_mbr") . "\n"; + $data .= " Bootloader kernel arguments: " . $ip->get("bootloader_kernel_args") . "\n"; +} + +#Timezone: +$data .= "\nTimezone: " . $ip->get("time_zone") . "\n"; +/* +#Networking Settings: +$data .= "\nNetworking Settings: \n" +interfaces = shared_info.install_profile.get_network_interfaces() +for iface in interfaces: + if interfaces[iface][0] == 'dhcp': + $data .= " " . iface . _(u": Settings: DHCP. Options: ") . interfaces[iface][1] . "\n" + else: + $data .= " " . iface . _(u"IP: ") . interfaces[iface][0] . _(u" Broadcast: ") . interfaces[iface][1] . _(u" Netmask: ") . interfaces[iface][2] . "\n" +default_gateway = shared_info.install_profile.get_default_gateway() +if default_gateway: + $data .= " Default Gateway: " . default_gateway[0] . "/" . default_gateway[1] . "\n" +$data .= " Hostname: " . shared_info.install_profile.get_hostname() . "\n" +if shared_info.install_profile.get_domainname(): + $data .= " Domainname: " .shared_info.install_profile.get_domainname() . "\n" +if shared_info.install_profile.get_nisdomainname(): + $data .= " NIS Domainname: " .shared_info.install_profile.get_nisdomainname() . "\n" +if shared_info.install_profile.get_dns_servers(): + for dns_server in shared_info.install_profile.get_dns_servers(): + $data .= " DNS Server: " .dns_server . "\n" +if shared_info.install_profile.get_http_proxy(): + $data .= " HTTP Proxy: " .shared_info.install_profile.get_http_proxy() . "\n" +if shared_info.install_profile.get_ftp_proxy(): + $data .= " FTP Proxy: " .shared_info.install_profile.get_ftp_proxy() . "\n" +if shared_info.install_profile.get_rsync_proxy(): + $data .= " RSYNC Proxy: " .shared_info.install_profile.get_rsync_proxy() . "\n" +*/ +#Cron Daemon: +$data .= "\nCron Daemon: " . $ip->get("cron_daemon_pkg") . "\n"; + +#Logger: +$data .= "\nLogging Daemon: " . $ip->get("logging_daemon_pkg") . "\n"; + +#Extra packages: +if ($ip->get("install_packages")) { + $data .= "\nExtra Packages: "; + $data .= explode(' ',$ip->get("install_packages")); + $data .= "\n"; +} + + +#Services: +if ( $ip->get("services")) { + $data .= "\nAdditional Services: "; + $data .= explode(' ',$ip->get("services")); + $data .= "\n"; +} + +#Other Configuration Settings (rc.conf): +#Make.conf Settings: +$data .= "\nConfiguration Files Settings:\n"; +$etc_files = $ip->get("etc_files"); +foreach ($etc_files as $name => $file) { + $data .= " File: $name \n"; + if (is_array($file)) { + foreach ($file as $var => $value) {# name in etc_files[etc_file]: + $data .= " Variable: $var Value: $value\n";# . etc_files[etc_file][name] . "\n" + } + } else { + foreach( $file as $entry) {# entry in etc_files[etc_file]: + $data .= " Value: $entry \n"; + } + } +} + +/* +#Additional Users: +$data .= "\nAdditional Users:\n" +users = {} +for user in shared_info.install_profile.get_users(): + users[user[0]] = (user[0], user[1], user[2], user[3], user[4], user[5], user[6]) +for user in users: + $data .= " Username: " . user + $data .= "\n Group Membership: " . ",".join(users[user][2]) + $data .= "\n Shell: " . users[user][3] + $data .= "\n Home Directory: " . users[user][4] + if users[user][5]: + $data .= "\n User Id: " . users[user][5] + if users[user][6]: + $data .= "\n User Comment: " . users[user][6] +*/ + +$smarty->assign('data', $data); +$smarty->display('review.tpl'); + +?> diff --git a/webgli/services.php b/webgli/services.php new file mode 100644 index 0000000..1826727 --- /dev/null +++ b/webgli/services.php @@ -0,0 +1,51 @@ +<?php + +include('webgliIP.php'); +include('webgliUtility.php'); + +include('Smarty.class.php'); +$smarty = new Smarty; + +$smarty->template_dir = './templates'; +$smarty->compile_dir = './templates_c'; +$smarty->cache_dir = './cache'; +$smarty->config_dir = './configs'; + +$ip = new InstallProfile(); +$ip->parse('test.xml'); + +if ($_POST['saveservices']) { + if ($_POST['servicesmanual']) { + $services = explode(',',$_POST['servicesmanual']); + + } elseif ($_POST['services']) { + $services = $_POST['services']; + } + if ($services) { + $ip->set("services",$services); + #SAVE VALUES + file_put_contents('test.xml', $ip->serialize()); #PHP 5 only + #$error_msg .= "ERROR! Could not set the services list."; + } + if (!$error_msg) $error_msg = "Values saved successfully"; +} +$smarty->assign('services', $ip->get("services")); +# I don't want to do this anymore. $smarty->assign('manualservices', join(',',$ip->get("services"))); + +$choices['alsasound'] = "ALSA Sound Daemon"; +$choices['apache'] = "Common web server (version 1.x)"; +$choices['apache2'] = "Common web server (version 2.x)"; +$choices['distccd'] = "Distributed Compiling System"; +$choices['esound'] = "ESD Sound Daemon"; +$choices['hdparm'] = "Hard Drive Tweaking Utility"; +$choices['local'] = "Run scripts found in /etc/conf.d/local.start"; +$choices['portmap'] = "Port Mapping Service"; +$choices['proftpd'] = "Common FTP server"; +$choices['sshd'] = "SSH Daemon (allows remote logins)"; +$choices['xfs'] = "X Font Server"; +$choices['xdm'] = "X Daemon"; +$smarty->assign('choices',$choices); +$smarty->assign('error_msg',$error_msg); +$smarty->display('services.tpl'); + +?> diff --git a/webgli/stageselection.php b/webgli/stageselection.php new file mode 100644 index 0000000..3027105 --- /dev/null +++ b/webgli/stageselection.php @@ -0,0 +1,55 @@ +<?php + +include('webgliIP.php'); +include('webgliUtility.php'); + +include('Smarty.class.php'); +$smarty = new Smarty; + +$smarty->template_dir = './templates'; +$smarty->compile_dir = './templates_c'; +$smarty->cache_dir = './cache'; +$smarty->config_dir = './configs'; + +$ip = new InstallProfile(); +$ip->parse('test.xml'); + +$error_msg = ""; + +if ($_POST['savestage']) { +# print "YES I CLICKED SAVE<br>" + if ($_POST['stage']) { +# print "YES THERE IS A STAGE<br>" + if ($_POST['stage'] == "3+GRP") { + $_POST['stage'] = "3"; + $ip->set("grp_install", True) or + $error_msg .= "ERROR COULD NOT SET GRP INSTALL"; + } else { + $ip->set("grp_install", False) or + $error_msg .= "ERROR COULD NOT SET GRP INSTALL"; + } + $ip->set("install_stage", $_POST['stage']) or + $error_msg .= "ERROR: could not set the install stage"; + } + if ($_POST['tarballuri']) { + $ip->set("stage_tarball_uri", $_POST['tarballuri']) or + $error_msg .= "ERROR: Could not set the tarball URI"; + if ($_POST['dynamic']) { + $ip->set("dynamic_stage3",True); + $ip->set("portage_tree_sync_type","snapshot"); + // cd_snapshot_uri = GLIUtility.get_cd_snapshot_uri() + $ip->set("portage_tree_snapshot_uri",$cd_snapshot_uri); + } else { + $ip->set("dynamic_stage3",False) or + $error_msg .= "ERROR: Could not set dynamic stage 3.<br>"; + } + } + #SERIALIZE + file_put_contents('test.xml', $ip->serialize()); #PHP 5 only +} +$smarty->assign('stage',$ip->get("install_stage")); +$smarty->assign('grp_install',$ip->get("grp_install")); +$smarty->assign('dynamic',$ip->get("dynamic_stage3")); +$smarty->assign('tarball', $ip->get("stage_tarball_uri")); +$smarty->display('stageselection.tpl'); +?> diff --git a/webgli/templates/clientconfig.tpl b/webgli/templates/clientconfig.tpl index 3b6ca78..78bc855 100644 --- a/webgli/templates/clientconfig.tpl +++ b/webgli/templates/clientconfig.tpl @@ -39,7 +39,8 @@ Enter your Netmask: <input name="netmask" type="text" maxlength="15" value="255.255.255.0"><br> Enter your default gateway: <input name="gateway" type="text" maxlength="15" value=".1"><br> <hr>Info for DHCP Configurations:<br>DHCP Options: <input type="text" name="dhcp_options" > - <hr>Enter a DNS server: <input name="dnsserver" type="text" maxlength="15" value="128.118.25.3"></td> + <hr>Enter a DNS server: <input name="dnsserver" type="text" maxlength="15" value="128.118.25.3"><br> + Alternate DNS server: <input name="dnsserver2" type="text" maxlength="15" value=""></td> </tr> </table> {if $advanced} diff --git a/webgli/templates/extrapackages.tpl b/webgli/templates/extrapackages.tpl index c1d0baa..02e6eb4 100644 --- a/webgli/templates/extrapackages.tpl +++ b/webgli/templates/extrapackages.tpl @@ -9,7 +9,7 @@ {/foreach} {if $error_msg} -<br>{$error_msg}><br><br> +<br>{$error_msg}<br><br> {/if} Your current package list is: { $current_package_list } <table width="100%" border="1"> diff --git a/webgli/templates/globaluse.tpl b/webgli/templates/globaluse.tpl index 0403b6d..a995086 100644 --- a/webgli/templates/globaluse.tpl +++ b/webgli/templates/globaluse.tpl @@ -1,7 +1,7 @@ {include file="header.tpl" title="WebGLI - Global USE Flags", advanced=$advanced} <h2>Configuration Files Settings</h2> <p>Make.conf Settings:</p> -{if $dynamic_stage3} +{if $dynamic} <b>You have selected a dynamic stage3 installation. This setting forbids you from changing your USE flags until after the installation to prevent breaking the stage3 creation process.</b> {else} The installer will now gather information regarding the contents of /etc/make.conf diff --git a/webgli/templates/header.tpl b/webgli/templates/header.tpl index e12f79f..3046784 100644 --- a/webgli/templates/header.tpl +++ b/webgli/templates/header.tpl @@ -1,3 +1,4 @@ +{assign var=advanced value=1} <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>{$title|default:"WebGLI"}</title> diff --git a/webgli/templates/kernel.tpl b/webgli/templates/kernel.tpl new file mode 100644 index 0000000..afb3931 --- /dev/null +++ b/webgli/templates/kernel.tpl @@ -0,0 +1,42 @@ +{include file="header.tpl" title="WebGLI - Daemons", advanced=$advanced} +<h2>Kernel Settings:</h2> +{if $error_msg} +<br>{$error_msg}<br><br> +{/if} +<form name="kernel" method="post" action="" enctype="multipart/form-data"> +<p>Choose which kernel sources to use for your system. If using a previously-made kernel configuration, make sure the sources match the kernel used to create the configuration.</p> +<table width="100%" border="1"> +{foreach item=thissource from=$kernels key=key} + <tr> + <td><input name="sources" type="radio" value="{$key}" {if $sources eq $key} checked {/if}>{$key}</td> + <td>{$thissource[0]}</td> + <td>{$thissource[1]}</td> + </tr> +{/foreach} +{if $advanced} + <tr> + <td><input name="sources" type="radio" value="Other">Other</td> + <td>Specify your own here: <input name="manualsources" type="text" id="manualsources" value="{if $cust_source} {$sources}{/if}"></td> + </tr> +{/if} +</table> +<hr> +{if $advanced} +<table width="507" border="1"> + <tr> + <td colspan="2" scope="col"><p>There are currently two ways the installer can compile a kernel for your new system. You can either provide a previously-made kernel configuration file and use the traditional kernel-compiling procedure (no initrd) or have genkernel automatically create your kernel for you (with initrd).</p> + <p>If you do not have a previously-made kernel configuration, YOU MUST CHOOSE Genkernel. Choose which method you want to use:</p></td> + </tr> + <tr> + <td width="143" scope="col"><input name="build_method" type="radio" value="genkernel" {if $build_method == "genkernel"} checked {/if}>Genkernel</td> + <td width="348" scope="col"><input name="build_method" type="radio" value="custom" {if $build_method == "custom"} checked {/if}>Traditional (requires a config!)</td> + </tr> +</table> +<p><input name="bootsplash" type="checkbox" id="bootsplash" value="True" {if $bootsplash} checked {/if}>Display the bootsplash screen on startup </p><p>If you have a custom kernel configuration, enter its location (otherwise just leave blank): +<input name="configuri" type="text" id="configuri" value="{$configuri}"> +<input name="browseuri" type="button" id="browseuri" value="Browse" onClick="window.open('/webgli/URIBrowser?screen=kernel&baseuri=' + document.kernel.configuri.value, 'uribrowser', 'width=500,height=500,toolbars=no,statusbar=no,menubar=no,scrollbars=yes')"> +</p> +{/if} +<p><input name="setkernel" type="submit" id="setkernel" value="Save Kernel Settings"></p> +</form> +{include file="bottom.tpl"} diff --git a/webgli/templates/networkmounts.tpl b/webgli/templates/networkmounts.tpl new file mode 100644 index 0000000..5e147ee --- /dev/null +++ b/webgli/templates/networkmounts.tpl @@ -0,0 +1,51 @@ +{include file="header.tpl" title="WebGLI - Network Mounts", advanced=$advanced} +</h3>Network Mounts</h3> +{if $error_msg} +<br>{$error_msg}<br><br> +{/if} +If you have any network shares you would like to mount during the install and for your new system, define them here. Select a network mount to edit or add a new mount. Currently GLI only supports NFS mounts. +<form name="netmount" action="" method="POST" enctype="multipart/form-data"> +<p>If you have any network shares you would like to mount during the install and for your new system, define them here. Select a network mount to edit or add a new mount. Currently GLI only supports NFS mounts.</p> +<table width="511" border="1"> + <tr> + <td width="31">Edit</td> + <td width="31">Type</td> + <td width="79">Hostname/IP</td> + <td width="79">Export</td> + <td width="70">Mountpoint</td> + <td width="103">Mount Options </td> + </tr> +{section name=i loop=$network_mounts} <!-- for i,netmount in enumerate(network_mounts): --> + <tr> + <td><input name="edit_nfs" type="radio" id="edit_nfs" value="{$i}">Edit</td> + <td>{$network_mounts[i].type }</td> + <td>{$network_mounts[i].host }</td> + <td>{$network_mounts[i].export }</td> + <td>{$network_mounts[i].mountpoint }</td> + <td>{$network_mounts[i].mountopts }</td> + </tr> +{/section} +</table> +<hr> +<p> </p> +<table width="100%" border="1"> + <tr> + <td><p>Enter the IP/hostname: <input name="hostname" type="text" id="hostname"> <input type="Submit" name="Search" value="Search"></p> + <p>Enter the export name: <input name="export" type="text" id="export"></p> + <p>OR</p> + <p>Choose the export from the list of found exports: <select name="exports" size="1" id="exports"></select></p> + </td> + <td><p>Enter the mountpoint: <input name="mountpoint" type="text" id="mountpoint"></p> + <p>Enter any special mount options: <input name="mountopts" type="text" id="mountopts"></p> + </td> + </tr> + <tr> + <td> </td> + <td><input name="addnfs" type="submit" id="addnfs" value="Add New NFS Mount"></td> + </tr> +</table> +<p> </p> +<p> </p> +<p> </p> +</form> +{include file="bottom.tpl"} diff --git a/webgli/templates/review.tpl b/webgli/templates/review.tpl new file mode 100644 index 0000000..b05dfce --- /dev/null +++ b/webgli/templates/review.tpl @@ -0,0 +1,5 @@ +{include file="header.tpl" title="WebGLI - Review", advanced=$advanced} +<pre> +{$data} +</pre> +{include file="bottom.tpl"} diff --git a/webgli/templates/services.tpl b/webgli/templates/services.tpl new file mode 100644 index 0000000..8d782d9 --- /dev/null +++ b/webgli/templates/services.tpl @@ -0,0 +1,26 @@ +{include file="header.tpl" title="WebGLI - Services", advanced=$advanced} +<h3>Services</h3> +{if $error_msg} +<br>{$error_msg}<br><br> +{/if} +Choose the services you want started on bootup. Note that depending on what packages are selected, some services listed will not exist. +<form name="services" method="post" action="" enctype="multipart/form-data"> +<table border="1"> + <tr> + <td>Activate</td> + <td>Service</td> + <td>Description</td> + </tr> +{foreach from=$choices item=value key=key} + <tr> + <td><input type="checkbox" name="services[]" value="{$key}" {if in_array($key,$services) } checked {/if}></td> + <td>{$key}</td> + <td>{$value}</td> + </tr> +{/foreach} +</table> +<hr>You can also opt to enter your services in a comma-separated list (NOTE Manual list overwrites checked selections!): +<input type="text" name="servicesmanual" value="{$manualservices}"><br> +<input type="submit" name="saveservices" value="Save Services"> +</form> +{include file="bottom.tpl"} diff --git a/webgli/templates/stageselection.tpl b/webgli/templates/stageselection.tpl new file mode 100644 index 0000000..f11eb0a --- /dev/null +++ b/webgli/templates/stageselection.tpl @@ -0,0 +1,34 @@ +{include file="header.tpl" title="WebGLI - Stage Selection", advanced=$advanced} +<h4>Stage selection:</h4> +{if $error_msg } +<br><br>{$error_msg}<br><br> +{/if} +<form name="stage" action="" method="POST" enctype="multipart/form-data"> +<p>Which stage do you want to start at?</p> +<table width="100%" border="1"> + <tr> + <td><input name="stage" type="radio" value="1" {if $stage == 1} checked {/if}>1</td> + <td>Stage1 is used when you want to bootstrap&build from scratch.</td> + </tr> + <tr> + <td><input name="stage" type="radio" value="2" {if $stage == 2} checked {/if}>2</td> + <td>Stage2 is used for building from a bootstrapped semi-compiled state.</td> + </tr> + <tr> + <td><input name="stage" type="radio" value="3" {if ($stage == 3) and (!$grp_install)} checked {/if}>3</td> + <td>Stage3 is a basic system that has been built for you (no compiling).</td> + </tr> + <tr> + <td><input name="stage" type="radio" value="3+GRP" {if ($stage == 3) and $grp_install} checked {/if}>3 + GRP </td> + <td>A Stage3 install but using binaries from the LiveCD when able.</td> + </tr> +</table> +<p> +<input name="dynamic" type="checkbox" id="dynamic" value="true" {if $dynamic} checked {/if}> +Generate a dynamic stage3 on the fly using the files on the LiveCD? (faster for slow Internet connections, slower for fast connections and slow drives) </p> +<p>Stage Tarball URI: <input name="tarballuri" type="text" id="tarballuri" size="90" value="{$tarball}"> or +<input type="button" value="Browse the mirrors for the URL" onClick="window.open('/webgli/URIBrowser?screen=stage&baseuri=' + document.stage.tarballuri.value, 'uribrowser', 'width=500,height=500,toolbars=no,statusbar=no,menubar=no,scrollbars=yes')"> +(requires net connectivity)</p> +<p><input type="submit" name="savestage" value="Save Stage Selection"> +</form> +{include file="bottom.tpl"} diff --git a/webgli/templates/timezone.tpl b/webgli/templates/timezone.tpl new file mode 100644 index 0000000..fc3477d --- /dev/null +++ b/webgli/templates/timezone.tpl @@ -0,0 +1,15 @@ +{include file="header.tpl" title="WebGLI - Timezone Selection", advanced=$advanced} +<h2>Timezone Setup </h2> +{if $error_msg} +<br>{$error_msg}<br><br> +{/if} +Your current timezone is: {$current}<br> +Timezones:<br> +<form name="Timezone" method="post" action="" enctype="multipart/form-data"> +<input type="hidden" name="tzback" value="{$tzback}"><br> +{section name=tz loop=$tzlist} +<a href="timezone.php?zonepath={$zonepath}{$tzlist[tz]}">{$tzlist[tz]}</a><br> +{/section} +<br><input type="submit" name="back" value="Back"> +</form> +{include file="bottom.tpl"} diff --git a/webgli/templates_c/%%F7^F7F^F7F34188%%header.tpl.php b/webgli/templates_c/%%F7^F7F^F7F34188%%header.tpl.php deleted file mode 100644 index c5c3c94..0000000 --- a/webgli/templates_c/%%F7^F7F^F7F34188%%header.tpl.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php /* Smarty version 2.6.13, created on 2006-04-16 21:26:33 - compiled from header.tpl */ ?> -<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php'); -smarty_core_load_plugins(array('plugins' => array(array('modifier', 'default', 'header.tpl', 3, false),)), $this); ?> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> -<title><?php echo ((is_array($_tmp=@$this->_tpl_vars['title'])) ? $this->_run_mod_handler('default', true, $_tmp, 'WebGLI') : smarty_modifier_default($_tmp, 'WebGLI')); ?> -</title> -<link rel="stylesheet" href="webgli.css" type="text/css" /> - <script language="JavaScript" SRC="webgli.js"> - </script> -</head> -<body> - -<table id="layout" width="100%" height="100%" border="0" cellspacing="0" cellpadding="0"> - <tr id="header"> - <td colspan="2"> - <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0"> - <tr> - <td width="50%"> - <img src="images/header_bg.png" border="0" width="100%" height="64"> - </td> - <td> - <img src="images/header.png" alt="Gentoo Linux Installer" border="0" width="400" height="64"> - </td> - <td width="50%"> - <img src="images/header_bg.png" border="0" width="100%" height="64"> - </td> - </tr> - </table> - </td> - </tr> - <tr> - <td valign="top"> - <ul id="steps"> - <li><a class="step" href="/webgli/index.php">Welcome</a></li> - <li><a class="step" href="/webgli/clientconfig.php">Client Config</a></li> - <li><a class="step" href="/webgli/partitioning.php">Partitioning</a></li> - <li><a class="step" href="/webgli/networkmounts.php">Network Mounts</a></li> - <li><a class="step" href="/webgli/stageselection.php">Stage Selection</a></li> - <li><a class="step" href="/webgli/portagetree.php">Portage Tree</a></li> - <li><a class="step" href="/webgli/globaluse.php">Global USE Flags</a></li> - <li><a class="step" href="/webgli/localuse.php">Local USE Flags</a></li> -<?php if ($this->_tpl_vars['advanced']): ?> - <li><a class="step" href="/webgli/makedotconf.php">Make.conf</a></li> - <li><a class="step" href="/webgli/configfiles.php">Config Files</a></li> - <li><a class="step" href="/webgli/etc_portage.php">etc/portage</a></li> -<?php endif; ?> - <li><a class="step" href="/webgli/kernel.php">Kernel</a></li> - <li><a class="step" href="/webgli/bootloader.php">Bootloader</a></li> - <li><a class="step" href="/webgli/timezone.php">Timezone</a></li> - <li><a class="step" href="/webgli/networking.php">Networking</a></li> - <li><a class="step" href="/webgli/daemons.php">Daemons</a></li> - <li><a class="step" href="/webgli/extrapackages.php">Extra Packages</a></li> - <li><a class="step" href="/webgli/services.php">Services</a></li> - <li><a class="step" href="/webgli/users.php">Users</a></li> - <li><a class="step" href="/webgli/review.php">Review</a></li> - </ul> - <ul id="menu"> - <li><a href="/webgli/saveprofile.php">Save Profile</a></li> - <li><a href="/webgli/loadprofile.php">Load Profile</a></li> - </ul> - </td> - <td id="content" width="100%" valign="top">
\ No newline at end of file diff --git a/webgli/timezone.php b/webgli/timezone.php new file mode 100644 index 0000000..4363e92 --- /dev/null +++ b/webgli/timezone.php @@ -0,0 +1,71 @@ +<?php + +include('webgliIP.php'); +include('webgliUtility.php'); + +include('Smarty.class.php'); +$smarty = new Smarty; + +$smarty->template_dir = './templates'; +$smarty->compile_dir = './templates_c'; +$smarty->cache_dir = './cache'; +$smarty->config_dir = './configs'; + +$ip = new InstallProfile(); +$ip->parse('test.xml'); + + +$error_msg = ""; +if ($_GET['zonepath']) { + $zonepath = $_GET['zonepath']; + if (is_dir($zonepath)) { + $zonepath .= "/"; + } + print "I got me a zonepath: $zonepath"; + + if ( substr($zonepath,-1) != '/') { + $ip->set("time_zone",substr($zonepath,20)); + $error_msg .= "Timezone saved.<br>"; + #$error_msg .= "ERROR: Could not set that timezone!"; + #SAVE VALUES + file_put_contents('test.xml', $ip->serialize()); #PHP 5 only + } + +} else { + $zonepath = "/usr/share/zoneinfo/"; +} +if ($_POST['back']) { + $zonepath = $_POST['tzback']; +} + +$smarty->assign('tzback',"/usr/share/zoneinfo/"); +$smarty->assign('zonepath', $zonepath); + +$skiplist = array("zone.tab","iso3166.tab","posixrules", '../', './' ); +if (is_dir($zonepath)) { + $temp_tzlist = scandir($zonepath); #PHP 5 only. + +} else { + $temp_tzlist = array(); +} +$tzlist = array(); +foreach ($temp_tzlist as $tz) { + if (!in_array($tz, $skiplist) ) { + if (is_dir($tz)) { + $tz .= "/"; + } + array_push($tzlist, $tz); + } +} +sort($tzlist); + +#print "TZList: "; +#print_r($tzlist); +#print "Zonepath: "; +#print_r($zonepath); + +$smarty->assign('current',$ip->get("time_zone")); +$smarty->assign('error_msg',$error_msg); +$smarty->assign('tzlist',$tzlist); +$smarty->display('timezone.tpl'); +?> diff --git a/webgli/webgliUtility.php b/webgli/webgliUtility.php index 16fefb9..a3a4057 100644 --- a/webgli/webgliUtility.php +++ b/webgli/webgliUtility.php @@ -1,6 +1,22 @@ <?php #Utility functions for WebGLI +## +# Will take a password and return it hashed in md5 format +# @param password the password to be hashed +function hash_password($password) +{ + $salt = "$1$"; + $chars = "./abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; + for($i=0;$i<=8;$i++) { # in range(0, 8): + $salt .= $chars[rand(0,strlen($chars)-1)]; #chars[random.randint(0, len(chars)-1)] + } + $salt .= "$"; + $passwd_hash = crypt($password, $salt); + + return $passwd_hash; +} + function get_eth_devices() { $eth_devices = system("/sbin/ifconfig -a | grep -e '^[A-Za-z]'| cut -d ' ' -f 1"); |