Contents of /alx-src/branches/alx-web-060/plugin.php
Parent Directory | Revision Log
Revision 3517 -
(show annotations)
(download)
Fri Apr 20 09:27:56 2012 UTC (12 years, 5 months ago) by niro
File size: 5000 byte(s)
Fri Apr 20 09:27:56 2012 UTC (12 years, 5 months ago) by niro
File size: 5000 byte(s)
-removed debug messages
1 | <? |
2 | include('include/basesql.php'); |
3 | |
4 | $configure = sqlfirst('SELECT configflag FROM avail_plugins WHERE plugin="'.$plugin.'"'); |
5 | if( $configure[configflag] != '1' ) |
6 | { |
7 | echo 'Plugin "'.$plugin.'" needs no configuration'; |
8 | } |
9 | else |
10 | { |
11 | $plugintable = 'plugin_'.$plugin; |
12 | $tabs = array($plugintable); |
13 | $data = array(); |
14 | |
15 | |
16 | // FELD-DEFINITIONEN (ARRAY=>DROPDOWN / HIDDEN / IGNORE / 1 / BOLD / PASSWORD / SHOW / SHOWTIME / MONITORID) |
17 | $drop = array(); |
18 | $drop['id'] = 'hidden'; |
19 | $drop['serial'] = 'ignore'; |
20 | if (file_exists('include/plugins/'.$plugin.'.php')) |
21 | { |
22 | include('include/plugins/'.$plugin.'.php'); |
23 | } |
24 | |
25 | // GGF. NEUEN DATENSATZ EINF.GEN |
26 | if(isset($_POST['do_add'])) |
27 | { |
28 | list($bla,$what) = explode(' ',$_POST['do_add']); |
29 | if($what=='CONFIG') sqladd($plugintable, array('serial'=>$id)); |
30 | } |
31 | |
32 | // GGF. SPEICHERN |
33 | if($_POST['do_upl']) |
34 | { |
35 | function postarr($prefix) |
36 | { |
37 | $prefix.='_'; |
38 | $prelen = strlen($prefix); |
39 | |
40 | $arr = array(); |
41 | foreach($_POST as $k=>$v) |
42 | if((substr($k,0,$prelen)==$prefix) && ($v!='KEEPPASS')) |
43 | $arr[substr($k,$prelen)] = stripslashes($v); |
44 | |
45 | return $arr; |
46 | } |
47 | |
48 | foreach($tabs as $k=>$t) |
49 | { |
50 | mysql_query('UPDATE '.$t.' SET '.updatestr(postarr($t)).' WHERE serial='.$id); |
51 | } |
52 | } |
53 | |
54 | // EINLESEN DER DATEN AUS SQL-TABELLEN |
55 | foreach($tabs as $k=>$t) |
56 | { |
57 | $data[$t] = sqlfirst('SELECT * FROM '.$t.' WHERE serial='.$id); |
58 | } |
59 | |
60 | $plugininfo = sqlfirst('SELECT * FROM '.$plugintable.' WHERE serial='.$id); |
61 | if ($plugininfo['serial'] == NULL ) |
62 | { |
63 | $showconfigadd = 1; |
64 | } else { |
65 | $showconfigadd = 0; |
66 | } |
67 | |
68 | |
69 | // ANZEIGEN |
70 | |
71 | function parsearr($name, $arr, $del=false, $wireless=false) |
72 | { |
73 | global $drop; |
74 | global $id; |
75 | |
76 | $parts = explode('_',$name); $helpfile='help.php?page='.$parts[1]; |
77 | echo '<br>'.$name.':'; |
78 | echo '<table class="keytab">'; |
79 | |
80 | foreach($arr as $k=>$v) |
81 | { |
82 | |
83 | $d = $drop[$name.'_'.$k]; if($d==null) $d = $drop[$k]; |
84 | $k2 = $k; |
85 | |
86 | if(is_array($d)) |
87 | { |
88 | echo '<tr><td class="key">'.$k2.'</td><td>= <select style="width:144px" name="'.$name.'_'.$k.'">'; |
89 | foreach($d as $di) if($v==$di) echo '<option selected>'.$di; else echo '<option>'.$di; |
90 | echo '</select></td></tr>'; |
91 | } |
92 | else if($d=='hidden') echo '<tr><td colspan=2><input type=hidden name="'.$name.'_'.$k.'" value="'.$v.'"></td></tr>'; |
93 | else if($d=='1') echo '<tr><td colspan=2><input type=hidden name="'.$name.'_'.$k.'" value="1"></td></tr>'; |
94 | else if($d=='monitorid') echo '<tr><td class="key">'.$k2.'</td><td>= <input type=button style="width:24px" onclick="window.open(\'monitor.php?id='.$id.'\', \'MonitorWin\', \'width=350,height=200\')" value="..."></td>'; |
95 | else if($d=='bold') echo '<tr><td class="key">'.$k2.'</td><td>= <input style="width:144px;font-weight:bold" name="'.$name.'_'.$k.'" value="'.$v.'"></td></tr>'; |
96 | else if($d=='filename') echo '<tr><td class="key">filename</td><td>= <input style="width:144px;font-weight:bold" name="'.$name.'_'.$k.'" value="'.$v.'"></td></tr>'; |
97 | else if($d=='show') echo '<tr><td class="key">'.$k2.'</td><td>= <b>'.$v.'</b></td></tr>'; |
98 | else if($d=='showtime') echo '<tr><td class="key">'.$k2.'</td><td>= <b>'.date('d.m.y - H:i:s', $v).'</b></td></tr>'; |
99 | else if($d=='password' && $v=='') echo '<tr><td class="key">'.$k2.'</td><td>= <input type=password style="width:144px" name="'.$name.'_'.$k.'" value=""></td></tr>'; |
100 | else if($d=='password') echo '<tr><td class="key">'.$k2.'</td><td>= <input type=password style="width:144px" name="'.$name.'_'.$k.'" value="KEEPPASS"></td></tr>'; |
101 | else if($d=='txt') echo '<tr><td colspan=2><textarea style="width:240px; background-color:#d5e5ff" rows=4 name="'.$name.'_'.$k.'">'.$v.'</textarea></td></tr>'; |
102 | else if($d!='ignore') echo '<tr><td class="key">'.$k2.'</td><td>= <input style="width:144px" name="'.$name.'_'.$k.'" value="'.$v.'"></td></tr>'; |
103 | } |
104 | echo '</table>'; |
105 | } |
106 | |
107 | ?><head> |
108 | <title>ALX Plugin Config</title> |
109 | <style> |
110 | body,table { font-family:Tahoma; font-size:10pt } |
111 | a { color:#000000; text-decoration:none; } |
112 | .key { width:85px } |
113 | .keytab, input, textarea, select, option { font-size:8pt; font-family:Tahoma } |
114 | .but { font-size:10pt; font-family:Tahoma; height:23px } |
115 | </style> |
116 | </script> |
117 | </head> |
118 | |
119 | <body><? |
120 | |
121 | echo '<form action="plugin.php" method="post" onreset="return confirm(\'UNDO CHANGES?\')">'; |
122 | echo '<input type=hidden name="do_upl" value="1">'; |
123 | echo '<input type=hidden name="id" value="'.$id.'">'; |
124 | echo '<input type=hidden name="plugin" value="'.$plugin.'">'; |
125 | |
126 | // ANZEIGEN => NON-MULTI TABELLEN |
127 | echo '<table><tr><td valign=top width="300">'; |
128 | |
129 | echo '<b style="font-size:6pt">'; |
130 | echo '</b><br><br>'; |
131 | foreach($tabs as $k=>$t) parsearr($t, $data[$t]); |
132 | |
133 | // ANZEIGEN => NAVI |
134 | echo '</td><td valign=top>'; |
135 | echo '<img src="pics/logo2.jpg"><br><br>'; |
136 | if ( $showconfigadd == "1" ) echo '<input class="but" type=submit name="do_add" value="SAVE+ADD CONFIG" style="width:150px"><br>'; |
137 | else echo '<input class="but" type=submit value="SAVE" style="width:150px"><br><br>'; |
138 | echo '</td></tr></table>'; |
139 | echo '</form>'; |
140 | } |
141 | ?> |
142 |