Changeset 247 for trunk/admin/modules/Elezioni/ele_configurazione.php
- Timestamp:
- Jan 30, 2016, 11:38:54 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/modules/Elezioni/ele_configurazione.php
r240 r247 56 56 if (isset($param['help'])) $help=intval($param['help']); 57 57 58 59 58 60 /******************************************************/ 59 61 /*Funzione di visualizzazione globale */ … … 82 84 echo "<td>"; 83 85 echo "<b>"._TEMA."</b></td>"; 86 verificatema(); //funzione alla fine del file 87 84 88 ########## 89 90 85 91 $resmod = mysql_query("SELECT tema FROM ".$prefix."_ele_temi order by tema", $dbi); 86 92 … … 200 206 201 207 208 function verificatema(){ 209 ############# verifica tema - presenti nella dir temi 210 global $dbi,$prefix; 211 $tlist='';$files=''; 212 $path = "../client/temi"; 213 $handle=opendir($path); 214 while ($file = readdir($handle)) { 215 $tlist .= "$file "; 216 } 217 218 closedir($handle); 219 $tlist = explode(" ", $tlist); 220 sort($tlist); 221 222 for ($i=0; $i < sizeof($tlist); $i++) { 223 if ( (preg_match('/^([_0-9a-zA-Z]+)([_0-9a-zA-Z]{3})$/',$tlist[$i])) ) $files=$tlist[$i]; 224 if($files!=''){ 225 $sql = mysql_query("SELECT id FROM ".$prefix."_ele_temi where tema='$files'", $dbi); 226 list($idwid) = mysql_fetch_row($sql); 227 $id = intval($idwid); 228 if (empty($id)) { // inserisce widget db se non esiste 229 $result = mysql_query("insert into ".$prefix."_ele_temi (id,tema) values ( NULL,'$files')", $dbi); 230 } 231 } 232 233 234 235 236 237 238 239 240 } 241 242 # se non esiste cancella dal db 243 $sql2 = mysql_query("SELECT * FROM ".$prefix."_ele_temi", $dbi); 244 while ($row = mysql_fetch_array($sql2)) { 245 $esi=0; 246 for ($i=0; $i < sizeof($tlist); $i++) { 247 $files=$tlist[$i]; 248 if($row['tema']==$files) $esi=1; 249 } 250 if($esi!=1){ 251 $del=mysql_query("DELETE FROM ".$prefix."_ele_tema WHERE id = '$row[id]'",$dbi); 252 } 253 } 254 255 ################# fine 256 257 } 258 259 260 261 262 202 263 203 264
Note:
See TracChangeset
for help on using the changeset viewer.