Contents of /alx-src/branches/alx-web-070/plugin.php
Parent Directory | Revision Log
Revision 2704 -
(show annotations)
(download)
Tue Jul 12 15:03:34 2011 UTC (13 years, 2 months ago) by niro
Original Path: alx-src/branches/alx-web-060/plugin.php
File size: 4482 byte(s)
Tue Jul 12 15:03:34 2011 UTC (13 years, 2 months ago) by niro
Original Path: alx-src/branches/alx-web-060/plugin.php
File size: 4482 byte(s)
-added plugin support
1 | <? |
2 | include('include/basesql.php'); |
3 | |
4 | $configure = sqlfirst('SELECT configflag FROM cfg_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 | |
21 | |
22 | // GGF. SPEICHERN |
23 | if($_POST['do_upl']) |
24 | { |
25 | function postarr($prefix) |
26 | { |
27 | $prefix.='_'; |
28 | $prelen = strlen($prefix); |
29 | |
30 | $arr = array(); |
31 | foreach($_POST as $k=>$v) |
32 | if((substr($k,0,$prelen)==$prefix) && ($v!='KEEPPASS')) |
33 | $arr[substr($k,$prelen)] = stripslashes($v); |
34 | |
35 | return $arr; |
36 | } |
37 | |
38 | foreach($tabs as $k=>$t) |
39 | { |
40 | echo "DEBUG: id->'".$id."'"; |
41 | echo "DEBUG: k->'".$k."'"; |
42 | echo "DEBUG: t->'".$t."'"; |
43 | mysql_query('UPDATE '.$t.' SET '.updatestr(postarr($t)).' WHERE serial='.$id); |
44 | } |
45 | } |
46 | |
47 | // EINLESEN DER DATEN AUS SQL-TABELLEN |
48 | foreach($tabs as $k=>$t) |
49 | { |
50 | $data[$t] = sqlfirst('SELECT * FROM '.$t.' WHERE serial='.$id); |
51 | } |
52 | |
53 | // ANZEIGEN |
54 | |
55 | function parsearr($name, $arr, $del=false, $wireless=false) |
56 | { |
57 | global $drop; |
58 | global $id; |
59 | |
60 | $parts = explode('_',$name); $helpfile='help.php?page='.$parts[1]; |
61 | echo '<br>'.$name.':'; |
62 | echo '<table class="keytab">'; |
63 | |
64 | foreach($arr as $k=>$v) |
65 | { |
66 | |
67 | $d = $drop[$name.'_'.$k]; if($d==null) $d = $drop[$k]; |
68 | $k2 = $k; |
69 | |
70 | if(is_array($d)) |
71 | { |
72 | echo '<tr><td class="key">'.$k2.'</td><td>= <select style="width:144px" name="'.$name.'_'.$k.'">'; |
73 | foreach($d as $di) if($v==$di) echo '<option selected>'.$di; else echo '<option>'.$di; |
74 | echo '</select></td></tr>'; |
75 | } |
76 | else if($d=='hidden') echo '<tr><td colspan=2><input type=hidden name="'.$name.'_'.$k.'" value="'.$v.'"></td></tr>'; |
77 | else if($d=='1') echo '<tr><td colspan=2><input type=hidden name="'.$name.'_'.$k.'" value="1"></td></tr>'; |
78 | 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>'; |
79 | 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>'; |
80 | 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>'; |
81 | else if($d=='show') echo '<tr><td class="key">'.$k2.'</td><td>= <b>'.$v.'</b></td></tr>'; |
82 | else if($d=='showtime') echo '<tr><td class="key">'.$k2.'</td><td>= <b>'.date('d.m.y - H:i:s', $v).'</b></td></tr>'; |
83 | 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>'; |
84 | 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>'; |
85 | 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>'; |
86 | else if($d!='ignore') echo '<tr><td class="key">'.$k2.'</td><td>= <input style="width:144px" name="'.$name.'_'.$k.'" value="'.$v.'"></td></tr>'; |
87 | } |
88 | echo '</table>'; |
89 | } |
90 | |
91 | ?><head> |
92 | <title>ALX Plugin Config</title> |
93 | <style> |
94 | body,table { font-family:Tahoma; font-size:10pt } |
95 | a { color:#000000; text-decoration:none; } |
96 | .key { width:85px } |
97 | .keytab, input, textarea, select, option { font-size:8pt; font-family:Tahoma } |
98 | .but { font-size:10pt; font-family:Tahoma; height:23px } |
99 | </style> |
100 | </script> |
101 | </head> |
102 | |
103 | <body><? |
104 | |
105 | echo '<form action="plugin.php" method="post" onreset="return confirm(\'UNDO CHANGES?\')">'; |
106 | echo '<input type=hidden name="do_upl" value="1">'; |
107 | echo '<input type=hidden name="id" value="'.$id.'">'; |
108 | echo '<input type=hidden name="plugin" value="'.$plugin.'">'; |
109 | |
110 | // ANZEIGEN => NON-MULTI TABELLEN |
111 | echo '<table><tr><td valign=top width="300">'; |
112 | |
113 | echo '<b style="font-size:6pt">'; |
114 | echo '</b><br><br>'; |
115 | foreach($tabs as $k=>$t) parsearr($t, $data[$t]); |
116 | |
117 | // ANZEIGEN => NAVI |
118 | echo '</td><td valign=top>'; |
119 | echo '<img src="pics/logo2.jpg"><br><br>'; |
120 | echo '<input class="but" type=submit value="SAVE" style="width:150px"><br><br>'; |
121 | echo '</td></tr></table>'; |
122 | echo '</form>'; |
123 | } |
124 | ?> |
125 |