/[scire]/webgli/configfiles.php
Gentoo

Contents of /webgli/configfiles.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 38 - (show annotations) (download)
Mon Apr 17 03:31:29 2006 UTC (11 years, 9 months ago) by agaffney
File size: 3320 byte(s)
configfiles.php cleanup to not need intermediary vars
1 <?php
2 include('webgliIP.php');
3 include('webgliUtility.php');
4
5 include('Smarty.class.php');
6 $smarty = new Smarty;
7 #phpinfo();
8 $smarty->template_dir = './templates';
9 $smarty->compile_dir = './templates_c';
10 $smarty->cache_dir = './cache';
11 $smarty->config_dir = './configs';
12
13 $ip = new InstallProfile();
14 $ip->parse('test.xml');
15 $etc_files = $ip->get("etc_files");
16
17 #var_dump($etc_files);
18 $error_msg = "";
19
20 if ($_POST['SaveConfigFiles']) {
21 if(!array_key_exists("conf.d/keymaps", $etc_files)) {
22 if($_POST['keymap'] || $_POST['windowkeys'] || $_POST['ext_keymap']) {
23 $etc_files['conf.d/keymaps'] = array();
24 }
25 }
26 if(!array_key_exists("conf.d/consolefont", $etc_files)) {
27 if($_POST['font']) {
28 $etc_files['conf.d/consolefont'] = array();
29 }
30 }
31 if(!array_key_exists("conf.d/clock", $etc_files)) {
32 if($_POST['clock']) {
33 $etc_files['conf.d/clock'] = array();
34 }
35 }
36 if(!array_key_exists("rc.conf", $etc_files)) {
37 if($_POST['editor'] || $_POST['disp_manager'] || $_POST['xsession']) {
38 $etc_files['rc.conf'] = array();
39 }
40 }
41 if($_POST['keymap']) $etc_files['conf.d/keymaps']['KEYMAP'] = $_POST['keymap'];
42 if($_POST['windowkeys']) $etc_files['conf.d/keymaps']['SET_WINDOWSKEYS'] = $_POST['windowkeys'];
43 if($_POST['ext_keymap']) $etc_files['conf.d/keymaps']['EXTENDED_KEYMAPS'] = $_POST['ext_keymap'];
44 if($_POST['font']) $etc_files['conf.d/consolefont']['CONSOLEFONT'] = $_POST['font'];
45 if($_POST['clock']) $etc_files['conf.d/clock']['CLOCK'] = $_POST['clock'];
46 if($_POST['editor']) $etc_files['rc.conf']['EDITOR'] = $_POST['editor'];
47 if($_POST['disp_manager']) $etc_files['rc.conf']['DISPLAYMANAGER'] = $_POST['disp_manager'];
48 if($_POST['xsession']) $etc_files['rc.conf']['XSESSION'] = $_POST['xsession'];
49 # var_dump($etc_files);
50 $ip->set("etc_files", $etc_files);
51 file_put_contents('test.xml', $ip->serialize()); #PHP 5 only
52
53 if(!$error_msg) {
54 $error_msg = "Values saved successfully";
55 }
56 }
57
58 if (array_key_exists("conf.d/clock", $etc_files) and $etc_files['conf.d/clock']['CLOCK']) {
59 $smarty->assign('clock', $etc_files['conf.d/clock']['CLOCK']);
60 }
61 if (array_key_exists("conf.d/keymaps", $etc_files)) {
62 if ($etc_files['conf.d/keymaps']['KEYMAP']) {
63 $smarty->assign('keymap',$etc_files['conf.d/keymaps']['KEYMAP']);
64 }
65 if ($etc_files['conf.d/keymaps']['SET_WINDOWSKEYS']) {
66 $smarty->assign('windowkeys',$etc_files['conf.d/keymaps']['SET_WINDOWSKEYS']);
67 }
68 if ($etc_files['conf.d/keymaps']['EXTENDED_KEYMAPS']) {
69 $smarty->assign('ext_keymap',$etc_files['conf.d/keymaps']['EXTENDED_KEYMAPS']);
70 }
71 }
72 if (array_key_exists("conf.d/consolefont", $etc_files) and $etc_files['conf.d/consolefont']['CONSOLEFONT']) {
73 $smarty->assign('font',$etc_files['conf.d/consolefont']['CONSOLEFONT']);
74 }
75 if (array_key_exists("rc.conf", $etc_files)) {
76 if ($etc_files['rc.conf']['EDITOR']) {
77 $smarty->assign('editor',$etc_files['rc.conf']['EDITOR']);
78 }
79 if ($etc_files['rc.conf']['DISPLAYMANAGER']) {
80 $smarty->assign('disp_manager',$etc_files['rc.conf']['DISPLAYMANAGER']);
81 }
82 if ($etc_files['rc.conf']['XSESSION']) {
83 $smarty->assign('xsession',$etc_files['rc.conf']['XSESSION']);
84 }
85 }
86
87 $keymap_list = generate_keymap_list();
88 $font_list = generate_consolefont_list();
89 $smarty->assign('keymap_list', $keymap_list);
90 $smarty->assign('font_list',$font_list);
91
92 $smarty->display('configfiles.tpl');
93 ?>

  ViewVC Help
Powered by ViewVC 1.1.20