Projet

Général

Profil

Paste
Statistiques
| Branche: | Révision:

ryxeo-glpi-git / inc / config.class.php @ b67d8923

Historique | Voir | Annoter | Télécharger (40,4 ko)

1
<?php
2
/*
3
 * @version $Id: config.class.php 7763 2009-01-06 18:44:50Z moyo $
4
 -------------------------------------------------------------------------
5
 GLPI - Gestionnaire Libre de Parc Informatique
6
 Copyright (C) 2003-2009 by the INDEPNET Development Team.
7

8
 http://indepnet.net/   http://glpi-project.org
9
 -------------------------------------------------------------------------
10

11
 LICENSE
12

13
 This file is part of GLPI.
14

15
 GLPI is free software; you can redistribute it and/or modify
16
 it under the terms of the GNU General Public License as published by
17
 the Free Software Foundation; either version 2 of the License, or
18
 (at your option) any later version.
19

20
 GLPI is distributed in the hope that it will be useful,
21
 but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
 GNU General Public License for more details.
24

25
 You should have received a copy of the GNU General Public License
26
 along with GLPI; if not, write to the Free Software
27
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
28
 --------------------------------------------------------------------------
29
 */
30

    
31
// ----------------------------------------------------------------------
32
// Original Author of file:
33
// Purpose of file:
34
// ----------------------------------------------------------------------
35

    
36
if (!defined('GLPI_ROOT')){
37
        die("Sorry. You can't access directly to this file");
38
        }
39

    
40
/// Config class 
41
class Config extends CommonDBTM {
42

    
43
        /**
44
         * Constructor 
45
        **/
46
        function Config () {
47
                $this->table="glpi_config";
48
                $this->type=-1;
49
        }
50
        /**
51
         * Prepare input datas for updating the item 
52
         *
53
         *@param $input datas used to update the item
54
         * 
55
         *@return the modified $input array
56
         * 
57
        **/
58
        function prepareInputForUpdate($input) {
59
                if (isset($input["smtp_password"])&&empty($input["smtp_password"]))
60
                        unset($input["smtp_password"]);
61
                if (isset($input["proxy_password"])&&empty($input["proxy_password"]))
62
                        unset($input["proxy_password"]);
63

    
64
                if (isset($input["planning_begin"]))
65
                        $input["planning_begin"]=$input["planning_begin"].":00:00";
66
                if (isset($input["planning_end"]))
67
                        $input["planning_end"]=$input["planning_end"].":00:00";
68

    
69

    
70
                // Manage DB Slave process
71
                if (isset($input['_dbslave_status'])){
72
                        $already_active=isDBSlaveActive();
73
                        if ($input['_dbslave_status']&&!$already_active){
74
                                createDBSlaveConfig();
75
                        } else {
76
                                saveDBSlaveConf($input["_dbreplicate_dbhost"],$input["_dbreplicate_dbuser"],$input["_dbreplicate_dbpassword"],$input["_dbreplicate_dbdefault"]);
77
                        }
78
                        if (!$input['_dbslave_status']&&$already_active){
79
                                deleteDBSlaveConfig();
80
                        }
81

    
82
                }
83

    
84

    
85
                return $input;
86
        }
87

    
88
        /**
89
         * Actions done after the UPDATE of the item in the database
90
         *
91
         *@param $input datas used to update the item
92
         *@param $updates array of the updated fields
93
         *@param $history store changes history ?
94
         * 
95
        **/
96
        function post_updateItem($input,$updates,$history=1) {
97
                global $CACHE_CFG;
98
                if (count($updates)){
99
                        cleanCache(); 
100
                }
101
        }
102
        /**
103
         * Print the config form
104
         *
105
         *@param $target filename : where to go when done.
106
         * 
107
         *@return Nothing (display) 
108
         * 
109
        **/        
110
        function showForm($target) {
111
        
112
                global $DB, $LANG, $CFG_GLPI, $DBSlave;
113
        
114
                if (!haveRight("config", "w"))
115
                        return false;
116

    
117
                echo "<form name='form' action=\"$target\" method=\"post\">";
118
                echo "<input type='hidden' name='ID' value='" . $CFG_GLPI["ID"] . "'>";
119
        
120
                echo "<div id='barre_onglets'><ul id='onglet'>";
121
                echo "<li ";
122
                if ($_SESSION['glpi_configgen'] == 1) {
123
                        echo "class='actif'";
124
                }
125
                echo "><a href='$target?onglet=1'>" . $LANG["setup"][70] . "</a></li>";
126
                echo "<li ";
127
                if ($_SESSION['glpi_configgen'] == 2) {
128
                        echo "class='actif'";
129
                }
130
                echo "><a href='$target?onglet=2'>" . $LANG["setup"][119] . "</a></li>";
131

    
132
                echo "<li ";
133
                if ($_SESSION['glpi_configgen'] == 3) {
134
                        echo "class='actif'";
135
                }
136
                echo "><a href='$target?onglet=3'>" . $LANG["setup"][184] . "</a></li>";
137

    
138
                echo "<li ";
139
                if ($_SESSION['glpi_configgen'] == 4) {
140
                        echo "class='actif'";
141
                }
142
                echo "><a href='$target?onglet=4'>" . $LANG["connect"][0] . "</a></li>";
143

    
144
                echo "<li ";
145
                if ($_SESSION['glpi_configgen'] == 5) {
146
                        echo "class='actif'";
147
                }
148
                echo "><a href='$target?onglet=5'>" . $LANG["setup"][800] . "</a></li>";
149

    
150
                echo "</ul></div>";
151

    
152
                echo "<div class='center'><table class='tab_cadre_fixe'>";
153
                switch ($_SESSION['glpi_configgen']){
154
                        // MAIN CONFIG
155
                        case 1 :
156

    
157
                                echo "<tr><th colspan='4'>" . $LANG["setup"][70] . "</th></tr>";
158
                        
159
                                $default_language = $CFG_GLPI["default_language"];
160
                                echo "<tr class='tab_bg_2'><td class='center'>" . $LANG["setup"][113] . " </td><td>";
161
                                dropdownLanguages("default_language", $CFG_GLPI["default_language"]);
162
                        
163
                                echo "</td>"; 
164
                                
165
                                echo "<td class='center'> " . $LANG["setup"][183] . " </td><td>";
166
                                dropdownYesNo("use_cache", $CFG_GLPI["use_cache"]);
167
                                echo "</td>";
168
                                
169
                        
170
                                echo "<tr class='tab_bg_2'><td class='center'>" . $LANG["setup"][102] . " </td><td><select name=\"event_loglevel\">";
171
                                $level = $CFG_GLPI["event_loglevel"];
172
                                echo "<option value=\"1\"";
173
                                if ($level == 1) {
174
                                        echo " selected";
175
                                }
176
                                echo ">" . $LANG["setup"][103] . " </option>";
177
                                echo "<option value=\"2\"";
178
                                if ($level == 2) {
179
                                        echo " selected";
180
                                }
181
                                echo ">" . $LANG["setup"][104] . "</option>";
182
                                echo "<option value=\"3\"";
183
                                if ($level == 3) {
184
                                        echo " selected";
185
                                }
186
                                echo ">" . $LANG["setup"][105] . "</option>";
187
                                echo "<option value=\"4\"";
188
                                if ($level == 4) {
189
                                        echo " selected";
190
                                }
191
                                echo ">" . $LANG["setup"][106] . " </option>";
192
                                echo "<option value=\"5\"";
193
                                if ($level == 5) {
194
                                        echo " selected";
195
                                }
196
                                echo ">" . $LANG["setup"][107] . "</option>";
197
                                echo "</select></td>";
198
                        
199
                                echo "<td class='center'>" . $LANG["setup"][109] . " </td><td><input type=\"text\" name=\"expire_events\" value=\"" . $CFG_GLPI["expire_events"] . "\"></td></tr>";
200
                        
201
                                echo "<tr class='tab_bg_2'>";
202
                        
203
                                echo "<td class='center'>" . $LANG["setup"][138] . " </td><td><select name=\"debug\">";
204
                                echo "<option value=\"" . NORMAL_MODE . "\" " . ($CFG_GLPI["debug"] == NORMAL_MODE ? " selected " : "") . " >" . $LANG["setup"][135] . " </option>";
205
                                echo "<option value=\"" . TRANSLATION_MODE . "\" " . ($CFG_GLPI["debug"] == TRANSLATION_MODE ? " selected " : "") . " >" . $LANG["setup"][136] . " </option>";
206
                                echo "<option value=\"" . DEBUG_MODE . "\" " . ($CFG_GLPI["debug"] == DEBUG_MODE ? " selected " : "") . " >" . $LANG["setup"][137] . " </option>";
207
                                echo "<option value=\"" . DEMO_MODE . "\" " . ($CFG_GLPI["debug"] == DEMO_MODE ? " selected " : "") . " >" . $LANG["setup"][141] . " </option>";
208
                                echo "</select></td>";
209
        
210
                                echo "<td class='center'> " . $LANG["setup"][185] . " </td><td>";
211
                                dropdownYesNo("use_errorlog", $CFG_GLPI["use_errorlog"]);
212
                                echo "</td></tr>";                                                                
213
        
214
                                echo "<tr class='tab_bg_2'>";
215
                                echo "<td class='center'> " . $LANG["setup"][186] . " </td><td>";
216
                                dropdownGMT("glpi_timezone", $CFG_GLPI["glpi_timezone"]);
217
                                echo "</td><td colspan='2'></td></tr>";                                                                
218
                                                                        
219
                                echo "<tr class='tab_bg_1'><td colspan='4' align='center'><strong>" . $LANG["setup"][10] . "</strong></td></tr>";
220
                        
221
                                echo "<tr class='tab_bg_2'><td class='center'>" . $LANG["setup"][115] . "</td><td>";
222
                                dropdownInteger('cartridges_alarm', $CFG_GLPI["cartridges_alarm"], -1, 100);
223
                                echo "</td>";
224
                        
225
                                echo "<td class='center'>" . $LANG["setup"][221] . "</td><td>";
226
                                showCalendarForm("form", "date_fiscale", $CFG_GLPI["date_fiscale"]);
227
                                echo "</td></tr>";
228

    
229
                                echo "<tr class='tab_bg_2'><td class='center'>" . $LANG["setup"][360] . "</td><td>";
230
                                $tab=array(0=>$LANG["common"][59],1=>$LANG["entity"][8]);
231
                                dropdownArrayValues('autoname_entity', $tab,$CFG_GLPI["autoname_entity"]);
232
                                echo "</td>";
233
                        
234
                                echo "<td class='center'>&nbsp;</td><td>";
235
                                echo "&nbsp;";
236
                                echo "</td></tr>";
237
                        
238
                                echo "<tr class='tab_bg_1'><td colspan='4' align='center'><strong>" . $LANG["title"][24] . "</strong></td></tr>";
239
                                                
240
                                echo "<tr class='tab_bg_2'><td class='center'> " . $LANG["setup"][116] . " </td><td>";
241
                                dropdownYesNo("auto_assign", $CFG_GLPI["auto_assign"]);
242
                                echo "</td>";
243

    
244
                                echo "<td class='center'>" . $LANG["setup"][405] . "</td><td>";
245
                                dropdownYesNo("followup_on_update_ticket", $CFG_GLPI["followup_on_update_ticket"]);
246
                                echo "</td></tr>";
247
                        
248
                                echo "<tr class='tab_bg_2'><td class='center'>" . $LANG["tracking"][37] . "</td><td>";
249
                                dropdownYesNo("keep_tracking_on_delete", $CFG_GLPI["keep_tracking_on_delete"]);
250
                                echo "</td>";
251
                                echo "<td class='center'>" . $LANG["setup"][409] . "</td><td>";
252
                                dropdownValue("glpi_dropdown_rubdocs","default_rubdoc_tracking",$CFG_GLPI["default_rubdoc_tracking"]);
253
                                echo "</td></tr>";
254

    
255
                        
256
                                echo "<tr class='tab_bg_1'><td colspan='4' align='center'><strong>" . $LANG["common"][41] . "</strong></td></tr>";
257
                        
258
                                echo "<tr class='tab_bg_2'><td class='center'>" . $LANG["setup"][246] . " (" . $LANG["common"][44] . ")</td><td>";
259
                                dropdownContractAlerting("contract_alerts", $CFG_GLPI["contract_alerts"]);
260
                                echo "</td>";
261
                        
262
                                echo "<td class='center'>" . $LANG["setup"][247] . " (" . $LANG["common"][44] . ")</td><td>";
263
                                echo "<select name=\"infocom_alerts\">";
264
                                echo "<option value=\"0\" " . ($CFG_GLPI["infocom_alerts"] == 0 ? " selected " : "") . " >-----</option>";
265
                                echo "<option value=\"" . pow(2, ALERT_END) . "\" " . ($CFG_GLPI["infocom_alerts"] == pow(2, ALERT_END) ? " selected " : "") . " >" . $LANG["financial"][80] . " </option>";
266
                                echo "</select>";
267
                                echo "</td></tr>";
268
                        
269
                                echo "<tr class='tab_bg_1'><td colspan='4' align='center'><strong>" . $LANG["setup"][306] . "</strong></td></tr>";
270
                        
271
                                echo "<tr class='tab_bg_2'><td class='center'>" . $LANG["setup"][306] . " </td><td><select name=\"auto_update_check\">";
272
                                $check = $CFG_GLPI["auto_update_check"];
273
                                echo "<option value=\"0\" " . ($check == 0 ? " selected" : "") . ">" . $LANG["setup"][307] . " </option>";
274
                                echo "<option value=\"7\" " . ($check == 7 ? " selected" : "") . ">" . $LANG["setup"][308] . " </option>";
275
                                echo "<option value=\"30\" " . ($check == 30 ? " selected" : "") . ">" . $LANG["setup"][309] . " </option>";
276
                                echo "</select></td><td colspan='2'>&nbsp;</td></tr>";
277
                        
278
                                echo "<tr class='tab_bg_2'><td class='center'>" . $LANG["setup"][401] . " </td><td><input type=\"text\" name=\"proxy_name\" value=\"" . $CFG_GLPI["proxy_name"] . "\"></td>";
279
                                echo "<td class='center'>" . $LANG["setup"][402] . " </td><td><input type=\"text\" name=\"proxy_port\" value=\"" . $CFG_GLPI["proxy_port"] . "\"></td></tr>";
280
                        
281
                                echo "<tr class='tab_bg_2'><td class='center'>" . $LANG["setup"][403] . " </td><td><input type=\"text\" name=\"proxy_user\" value=\"" . $CFG_GLPI["proxy_user"] . "\"></td>";
282
                                echo "<td class='center'>" . $LANG["setup"][404] . " </td><td><input type=\"password\" name=\"proxy_password\" value=\"\"></td></tr>";
283

    
284
                                echo "<tr class='tab_bg_1'><td colspan='4' align='center'><strong>" . $LANG["rulesengine"][77] . "</strong></td></tr>";
285
                                echo "<tr class='tab_bg_2'><td class='center'>" . $LANG["rulesengine"][86] . " </td><td>";
286
                                dropdownValue("glpi_dropdown_software_category","category_on_software_delete",$CFG_GLPI["category_on_software_delete"]);                                
287
                                echo "</td><td class='center' colspan='2'></td></tr>";
288
                        
289
                                break;
290
                        // DISPLAY CONFIG
291
                        case 2 :
292
                
293
                                // Needed for list_limit
294
                                echo "<tr><th colspan='4'>" . $LANG["setup"][119] . "</th></tr>";
295
                        
296
                                echo "<tr class='tab_bg_2'><td class='center'>" . $LANG["setup"][128] . " </td><td><select name=\"dateformat\">";
297
                                echo "<option value=\"0\"";
298
                                if ($CFG_GLPI["dateformat"] == 0) {
299
                                        echo " selected";
300
                                }
301
                                echo ">YYYY-MM-DD</option>";
302
                                echo "<option value=\"1\"";
303
                                if ($CFG_GLPI["dateformat"] == 1) {
304
                                        echo " selected";
305
                                }
306
                                echo ">DD-MM-YYYY</option>";
307
                                echo "</select></td>";
308
                                
309
                                echo "<td class='center'>" . $LANG["setup"][150] . " </td><td><select name=\"numberformat\">";
310
                                echo "<option value=\"0\"";
311
                                if ($CFG_GLPI["numberformat"] == 0) {
312
                                        echo " selected";
313
                                }
314
                                echo ">1 234.56</option>";
315
                                echo "<option value=\"1\"";
316
                                if ($CFG_GLPI["numberformat"] == 1) {
317
                                        echo " selected";
318
                                }
319
                                echo ">1,234.56</option>";
320
                                echo "<option value=\"2\"";
321
                                if ($CFG_GLPI["numberformat"] == 2) {
322
                                        echo " selected";
323
                                }
324
                                echo ">1 234,56</option>";
325
                                echo "</select></td></tr>";
326
                                
327
                                echo "<tr class='tab_bg_2'><td class='center'>" . $LANG["setup"][149] . " </td><td>";
328
                                dropdownInteger("decimal_number",$CFG_GLPI["decimal_number"],1,4);
329
                                echo "</td>";
330
                                
331
                                echo "<td class='center'>" . $LANG["setup"][148] . "</td><td>";
332
                                echo "<select name='time_step'>";
333
                                $steps = array (
334
                                        5,
335
                                        10,
336
                                        15,
337
                                        20,
338
                                        30,
339
                                        60
340
                                );
341
                                foreach ($steps as $step) {
342
                                        echo "<option value='$step'" . ($CFG_GLPI["time_step"] == $step ? " selected " : "") . ">$step</option>";
343
                                }
344
                                echo "</select>&nbsp;" . $LANG["job"][22];
345
                                echo "</td></tr>";
346
                        
347
                                echo "<tr class='tab_bg_2'><td class='center'>" . $LANG["setup"][129] . " </td><td>";
348
                                dropdownYesNo("view_ID", $CFG_GLPI["view_ID"]);
349
                                echo "</td>";
350
                                
351
                                $plan_begin = split(":", $CFG_GLPI["planning_begin"]);
352
                                $plan_end = split(":", $CFG_GLPI["planning_end"]);
353
                                echo "<td class='center'>" . $LANG["setup"][223] . "</td><td>";
354
                                dropdownInteger('planning_begin', $plan_begin[0], 0, 24);
355
                                echo "&nbsp;->&nbsp;";
356
                                dropdownInteger('planning_end', $plan_end[0], 0, 24);
357
                                echo " </td></tr>";
358
                        
359
                                echo "<tr class='tab_bg_2'><td class='center'>" . $LANG["setup"][112] . "</td><td><input size='10' type=\"text\" name=\"cut\" value=\"" . $CFG_GLPI["cut"] . "\"></td>";
360
                        
361
                                echo "<td class='center'>" . $LANG["setup"][131] . "</td><td>";
362
                                dropdownInteger('dropdown_limit', $CFG_GLPI["dropdown_limit"], 20, 100);
363
                                echo "</td></tr>";
364

    
365
                                echo "<tr class='tab_bg_2'><td class='center'>" . $LANG["setup"][132] . "</td><td>";
366
                                dropdownYesNo('flat_dropdowntree', $CFG_GLPI["flat_dropdowntree"]);
367
                                echo "</td>";
368
                        
369
                                echo "<td class='center'>" . $LANG["setup"][108] . "</td><td><input size='10' type=\"text\" name=\"num_of_events\" value=\"" . $CFG_GLPI["num_of_events"] . "\">";
370
                                echo "</td></tr>";
371

    
372
                                echo "<tr class='tab_bg_2'><td class='center'>" . $LANG["setup"][130] . " </td><td><select name=\"nextprev_item\">";
373
                                $nextprev_item = $CFG_GLPI["nextprev_item"];
374
                                echo "<option value=\"ID\"";
375
                                if ($nextprev_item == "ID") {
376
                                        echo " selected";
377
                                }
378
                                echo ">" . $LANG["common"][2] . " </option>";
379
                                echo "<option value=\"name\"";
380
                                if ($nextprev_item == "name") {
381
                                        echo " selected";
382
                                }
383
                                echo ">" . $LANG["common"][16] . "</option>";
384
                                echo "</select></td>";
385
                                echo "<td colspan='2'>&nbsp;</td>";
386
                                echo "</tr>";
387

    
388
                        
389
                                echo "<tr class='tab_bg_1'><td colspan='4' align='center'><strong>" . $LANG["setup"][111] . "</strong></td></tr>";
390

    
391
                                echo "<tr class='tab_bg_2'>";
392
                                echo "<td class='center'>" . $LANG["common"][44]."</td><td>";
393
                                dropdownInteger("list_limit",$CFG_GLPI["list_limit"],5,200,5);
394
                                
395
                                echo "</td><td class='center'>" . $LANG["common"][58] . "</td><td>";
396
                                dropdownInteger("list_limit_max",$CFG_GLPI["list_limit_max"],5,200,5);
397

    
398
                                echo "</td></tr>";
399

    
400
                                echo "<tr class='tab_bg_1'><td colspan='4' align='center'><strong>" . $LANG["title"][24] . "</strong></td></tr>";
401
                        
402
                                echo "<tr class='tab_bg_2'><td class='center'> " . $LANG["setup"][110] . " </td><td>";
403
                                dropdownYesNo("jobs_at_login", $CFG_GLPI["jobs_at_login"]);
404
                                echo " </td><td colspan='2'>&nbsp;</td></tr>";
405
                        
406
                                echo "<tr class='tab_bg_2'><td class='center'>" . $LANG["setup"][114] . "</td><td colspan='3'>";
407
                                echo "<table><tr>";
408
                                echo "<td bgcolor='" . $CFG_GLPI["priority_1"] . "'>1:<input type=\"text\" name=\"priority_1\" size='7' value=\"" . $CFG_GLPI["priority_1"] . "\"></td>";
409
                                echo "<td bgcolor='" . $CFG_GLPI["priority_2"] . "'>2:<input type=\"text\" name=\"priority_2\" size='7' value=\"" . $CFG_GLPI["priority_2"] . "\"></td>";
410
                                echo "<td bgcolor='" . $CFG_GLPI["priority_3"] . "'>3:<input type=\"text\" name=\"priority_3\" size='7' value=\"" . $CFG_GLPI["priority_3"] . "\"></td>";
411
                                echo "<td bgcolor='" . $CFG_GLPI["priority_4"] . "'>4:<input type=\"text\" name=\"priority_4\" size='7' value=\"" . $CFG_GLPI["priority_4"] . "\"></td>";
412
                                echo "<td bgcolor='" . $CFG_GLPI["priority_5"] . "'>5:<input type=\"text\" name=\"priority_5\" size='7' value=\"" . $CFG_GLPI["priority_5"] . "\"></td>";
413
                                echo "</tr></table>";
414
                                echo "</td></tr>";
415
                        
416
                                echo "<tr class='tab_bg_1'><td colspan='4' align='center'><strong>" . $LANG["setup"][147] . "</strong></td></tr>";
417
                        
418
                                echo "<tr class='tab_bg_2'><td class='center'>" . $LANG["setup"][120] . " </td><td>";
419
                                dropdownYesNo("use_ajax", $CFG_GLPI["use_ajax"]);
420
                                echo "</td>";
421
                        
422
                                echo "<td class='center'>" . $LANG["setup"][127] . " </td><td>";
423
                                dropdownYesNo("ajax_autocompletion", $CFG_GLPI["ajax_autocompletion"]);
424
                                echo "</td></tr>";
425
                        
426
                                echo "<tr class='tab_bg_2'><td class='center'>" . $LANG["setup"][121] . "</td><td><input type=\"text\" size='1' name=\"ajax_wildcard\" value=\"" . $CFG_GLPI["ajax_wildcard"] . "\"></td>";
427
                        
428
                                echo "<td class='center'>" . $LANG["setup"][122] . "</td><td>";
429
                                dropdownInteger('dropdown_max', $CFG_GLPI["dropdown_max"], 0, 200);
430
                                echo "</td></tr>";
431
                        
432
                                echo "<tr class='tab_bg_2'><td class='center'>" . $LANG["setup"][123] . "</td><td>";
433
                                dropdownInteger('ajax_limit_count', $CFG_GLPI["ajax_limit_count"], 0, 200);
434
                                echo "</td><td colspan='2'>&nbsp;</td></tr>";
435

    
436
                                echo "<tr class='tab_bg_1'><td colspan='4' align='center'><strong>" . $LANG["softwarecategories"][5] . "</strong></td></tr>";
437
                                echo "<tr class='tab_bg_2'><td class='center'>" . $LANG["softwarecategories"][4]."</td><td>";
438
                                $expand[0]=$LANG["softwarecategories"][1];
439
                                $expand[1]=$LANG["softwarecategories"][2];
440
                                dropdownArrayValues("expand_soft_categorized",$expand,$CFG_GLPI["expand_soft_categorized"]);
441
                                
442
                                echo "</td><td class='center'>" . $LANG["softwarecategories"][3] . "</td><td>";
443
                                dropdownArrayValues("expand_soft_not_categorized",$expand,$CFG_GLPI["expand_soft_not_categorized"]);
444

    
445
                                echo "</td></tr>";
446

    
447

    
448
                                echo "<tr class='tab_bg_1'><td colspan='4' align='center'><strong>" . $LANG["setup"][406] . "</strong></td></tr>";
449

    
450
                                echo "<tr class='tab_bg_2'><td class='center'> " . $LANG["setup"][118] . " </td><td colspan='3' align='center'>";
451
                                echo "<textarea cols='70' rows='4' name='text_login' >";
452
                                echo $CFG_GLPI["text_login"];
453
                                echo "</textarea>";
454
                                echo "</td></tr>";
455
                                echo "<tr class='tab_bg_2'><td class='center'>" . $LANG["setup"][407] . "</td><td> <input size='30' type=\"text\" name=\"helpdeskhelp_url\" value=\"" . $CFG_GLPI["helpdeskhelp_url"] . "\"></td>";
456
                                echo "<td class='center'>" . $LANG["setup"][408] . "</td><td> <input size='30' type=\"text\" name=\"centralhelp_url\" value=\"" . $CFG_GLPI["centralhelp_url"] . "\"></td></tr>";
457

    
458
                        break;
459
                        // RESTRICTIONS CONFIG
460
                        case 3:
461
                                                                
462
                                echo "<tr><th colspan='4'>" . $LANG["setup"][270] . "</th></tr>";
463
                        
464
                                echo "<tr class='tab_bg_2'>";
465
                                echo "<td class='center'> " . $LANG["setup"][271] . " </td><td>";        adminManagementDropdown("monitors_management_restrict",$CFG_GLPI["monitors_management_restrict"]);        
466
                                echo "</td><td class='center'> " . $LANG["setup"][272] . " </td><td>";                
467
                                adminManagementDropdown("peripherals_management_restrict",$CFG_GLPI["peripherals_management_restrict"]);                                
468
                                echo "</td></tr>";
469
                                
470
                                echo "<tr class='tab_bg_2'>";
471
                                echo "<td class='center'> " . $LANG["setup"][273] . " </td><td>";
472
                                adminManagementDropdown("phones_management_restrict",$CFG_GLPI["phones_management_restrict"]);
473
                                echo "</td><td class='center'> " . $LANG["setup"][275] . " </td><td>";                
474
                                adminManagementDropdown("printers_management_restrict",$CFG_GLPI["printers_management_restrict"]);
475
                                echo "</td></tr>";
476

    
477
                                echo "<tr class='tab_bg_2'>";
478
                                echo "<td class='center'> " . $LANG["setup"][276] . " </td><td>";
479
                                adminManagementDropdown("licenses_management_restrict",$CFG_GLPI["licenses_management_restrict"],1);                                
480
                                echo "</td><td class='center'>".$LANG["setup"][277]."</td><td>";
481
                                dropdownYesNo("license_deglobalisation",$CFG_GLPI["license_deglobalisation"]);
482
                                echo"</td></tr>";
483

    
484
                                echo "<tr><th colspan='2'>" . $LANG["setup"][134]. "</th><th colspan='2'></th></tr>";
485

    
486
                                echo "<tr class='tab_bg_2'><td class='center'> " . $LANG["setup"][133] . " </td><td>";
487
                                dropdownYesNo("ocs_mode", $CFG_GLPI["ocs_mode"]);
488
                                echo "</td><td class='center'colspan='2'></tr>";
489

    
490
                                echo "<tr><th colspan='2'>" . $LANG["login"][10] . "</th><th colspan='2'>".$LANG["Menu"][20]."</th></tr>";
491
                                echo "<tr class='tab_bg_2'><td class='center'> " . $LANG["setup"][124] . " </td><td>";
492
                                dropdownYesNo("auto_add_users", $CFG_GLPI["auto_add_users"]);
493
                                echo "</td>";
494
                                
495
                                echo "<td class='center'> " . $LANG["setup"][117] . " </td><td>";
496
                                dropdownYesNo("public_faq", $CFG_GLPI["public_faq"]);
497
                                echo " </td></tr>";
498

    
499
                                echo "<tr><th colspan='4' align='center'>" . $LANG["Menu"][31]. "</th></tr>";
500

    
501
                                echo "<tr class='tab_bg_2'><td class='center'> " . $LANG["setup"][219] . " </td><td>";
502
                                dropdownYesNo("permit_helpdesk", $CFG_GLPI["permit_helpdesk"]);
503
                                echo "</td><td class='center'>" . $LANG["setup"][610] . "</td><td>";
504
                                dropdownYesNo("ticket_title_mandatory", $CFG_GLPI["ticket_title_mandatory"]);
505
                                echo "</td></tr>";
506

    
507
                                echo "<tr class='tab_bg_2'><td class='center'> " . $LANG["setup"][611] . " </td><td>";
508
                                dropdownYesNo("ticket_content_mandatory", $CFG_GLPI["ticket_content_mandatory"]);
509
                                echo "</td><td class='center'>" . $LANG["setup"][612] . "</td><td>";
510
                                dropdownYesNo("ticket_category_mandatory", $CFG_GLPI["ticket_category_mandatory"]);
511
                                echo "</td></tr>";
512
                                echo "<tr class='tab_bg_2'><td class='center'> " . $LANG["mailgate"][7] . " </td><td>";
513
                                echo "<input type=\"text\" size='15' name=\"mailgate_filesize_max\" value=\"" . $CFG_GLPI["mailgate_filesize_max"] . "\">&nbsp;".$LANG["mailgate"][8]." - ".getSize($CFG_GLPI["mailgate_filesize_max"]);
514
                                echo "</td><td class='center' colspan='2'>&nbsp;";
515
                                echo "</td></tr>";
516
                        
517
                        break;
518
                        // CONNECTIONS
519
                        case 4:
520
                                                                
521
                                echo "<tr><th colspan='4'>" . $LANG["setup"][280]. " (" . $LANG["peripherals"][32] . ")</th></tr>";
522

    
523
                                echo "<tr><th>&nbsp;</th><th>" . $LANG["setup"][281] . "</th><th>" . $LANG["setup"][282] . "</th><th>&nbsp;</th></tr>";
524

    
525
                                echo "<tr class='tab_bg_2'><td class='center'> " . $LANG["common"][18] . " </td><td>" . $LANG["setup"][283] . ":&nbsp;";
526
                                dropdownYesNo("autoupdate_link_contact", $CFG_GLPI["autoupdate_link_contact"]);
527
                                echo "</td><td>" . $LANG["setup"][284] . ":&nbsp;";
528
                                dropdownYesNo("autoclean_link_contact", $CFG_GLPI["autoclean_link_contact"]);
529
                                echo "</td><td>&nbsp;</td></tr>";
530
                                
531
                                echo "<tr class='tab_bg_2'><td class='center'> " . $LANG["common"][34] . " </td><td>" . $LANG["setup"][283] . ":&nbsp;";
532
                                dropdownYesNo("autoupdate_link_user", $CFG_GLPI["autoupdate_link_user"]);
533
                                echo "</td><td>" . $LANG["setup"][284] . ":&nbsp;";
534
                                dropdownYesNo("autoclean_link_user", $CFG_GLPI["autoclean_link_user"]);
535
                                echo " </td><td>&nbsp;</td></tr>";
536

    
537
                                echo "<tr class='tab_bg_2'><td class='center'> " . $LANG["common"][35] . " </td><td>" . $LANG["setup"][283] . ":&nbsp;";
538
                                dropdownYesNo("autoupdate_link_group", $CFG_GLPI["autoupdate_link_group"]);
539
                                echo "</td><td>" . $LANG["setup"][284] . ":&nbsp;";
540
                                dropdownYesNo("autoclean_link_group", $CFG_GLPI["autoclean_link_group"]);
541
                                echo "</td><td>&nbsp;</td></tr>";
542
                                
543
                                echo "<tr class='tab_bg_2'><td class='center'> " . $LANG["common"][15] . " </td><td>" . $LANG["setup"][283] . ":&nbsp;";
544
                                dropdownYesNo("autoupdate_link_location", $CFG_GLPI["autoupdate_link_location"]);
545
                                echo "</td><td>" . $LANG["setup"][284] . ":&nbsp;";
546
                                dropdownYesNo("autoclean_link_location", $CFG_GLPI["autoclean_link_location"]);
547
                                echo " </td><td>&nbsp;</td></tr>";
548
                                                                                                                                        
549
                                echo "<tr class='tab_bg_2'><td class='center'> " . $LANG["state"][0] . " </td><td>";
550
                                dropdownStateBehaviour("autoupdate_link_state", $LANG["setup"][197], $CFG_GLPI["autoupdate_link_state"]);
551
                                echo "</td><td>";
552
                                dropdownStateBehaviour("autoclean_link_state", $LANG["setup"][196], $CFG_GLPI["autoclean_link_state"]);
553
                                echo " </td><td>&nbsp;</td></tr>";
554

    
555
                        break;
556
                        // MySQL Replicat
557
                        case 5 :
558
                                $active = isDBSlaveActive();
559
                        
560
                                echo "<tr class='tab_bg_2'><th colspan='4'>" . $LANG["setup"][800] . "</th></tr>";
561
                
562
                                echo "<tr class='tab_bg_2'><td class='center'> " . $LANG["setup"][801] . " </td><td>";
563
                                dropdownYesNo("_dbslave_status", $active);
564
                                echo " </td><td  colspan='2'></td></tr>";
565
                
566
                                if ($active){
567
                                        
568
                                        $DBSlave = getDBSlaveConf();
569

    
570
                                        echo "<tr class='tab_bg_2'><td class='center'>" . $LANG["install"][30] . " </td><td><input type=\"text\" name=\"_dbreplicate_dbhost\" size='40' value=\"" . $DBSlave->dbhost . "\"></td>";
571
                                        echo "<td class='center'>" . $LANG["setup"][802] . "</td><td>";
572
                                        echo "<input type=\"text\" name=\"_dbreplicate_dbdefault\" value=\"" . $DBSlave->dbdefault . "\">";
573
                                        echo "</td></tr>";
574
                
575
                                        echo "<tr class='tab_bg_2'><td class='center'>" . $LANG["install"][31] . "</td><td>";
576
                                        echo "<input type=\"text\" name=\"_dbreplicate_dbuser\" value=\"" . $DBSlave->dbuser . "\">";
577
                                        echo "<td class='center'>" . $LANG["install"][32] . "</td><td>";
578
                                        echo "<input type=\"password\" name=\"_dbreplicate_dbpassword\" value=\"" . $DBSlave->dbpassword . "\">";
579
                                        echo "</td></tr>";
580
                
581
                                        echo "<tr class='tab_bg_2'><th colspan='4'>" . $LANG["setup"][704] . "</th></tr>";
582
                
583
                                        echo "<tr class='tab_bg_2'><td class='center'> " . $LANG["setup"][804] . " </td><td>";
584
                                        dropdownYesNo("dbreplicate_notify_desynchronization", $CFG_GLPI["dbreplicate_notify_desynchronization"]);
585
                                        echo " </td>";
586
                
587
                                        echo "<td class='center'> " . $LANG["setup"][806] . " </td><td>";
588
                                        echo "<input type=\"text\" name=\"dbreplicate_maxdelay\" size='8' value=\"" . $CFG_GLPI["dbreplicate_maxdelay"] . "\">";
589
                                        echo "&nbsp;" . $LANG["stats"][34]."</td></tr>";
590
                
591
                                        echo "<tr class='tab_bg_2'><td class='center'> " . $LANG["setup"][203] . " </td><td colspan='3'>";
592
                                        echo "<input type=\"text\" size='50' name=\"dbreplicate_email\" value=\"" . $CFG_GLPI["dbreplicate_email"] . "\">";
593
                                        echo "</td></tr>";
594
                
595
                
596
                                        echo "<tr class='tab_bg_2'>";                        
597
                                        if ($DBSlave->connected && !$DB->isSlave()) {
598
                                                echo "<td colspan='4' align='center'>" . $LANG["setup"][803] . " : ";
599
                                                echo timestampToString(getReplicateDelay(),1);
600
                                                echo "</td>";
601
                                        } else
602
                                                echo "<td colspan='4'></td>";
603
                
604
                                        echo "</tr>";
605
                
606
                                }
607
                
608
                        break;
609
                } // swicth onglet
610
                echo "<tr class='tab_bg_2'><td colspan='4' align='center'><input type=\"submit\" name=\"update\" class=\"submit\" value=\"" . $LANG["buttons"][2] . "\" ></td></tr>";
611
                echo "</table></div>";
612
                echo "</form>";
613

    
614
        }
615

    
616

    
617
        /**
618
         * Print the mailing config form
619
         *
620
         *@param $target filename : where to go when done. 
621
         * 
622
         *@return Nothing (display) 
623
         * 
624
        **/
625
        function showFormMailing($target) {
626
        
627
                global $DB, $LANG, $CFG_GLPI;
628
        
629
                if (!haveRight("config", "w"))
630
                        return false;
631
        
632
                echo "<form action=\"$target\" method=\"post\">";
633
                echo "<input type='hidden' name='ID' value='" . $CFG_GLPI["ID"] . "'>";
634
        
635
                echo "<div id='barre_onglets'><ul id='onglet'>";
636

    
637
                $onglets=array(1=>$LANG["common"][12],
638
                                2=>$LANG["setup"][240],
639
                                3=>$LANG["setup"][242]);
640
                foreach ($onglets as $key => $val){
641
                        echo "<li ";
642
                        if ($_SESSION['glpi_mailconfig'] == $key) {
643
                                echo "class='actif'";
644
                        }
645
                        echo "><a href='$target?onglet=$key'>$val</a></li>";
646
                }
647
                echo "</ul></div>";
648
        
649
                switch ($_SESSION['glpi_mailconfig']){
650
                        case 1:
651
                        echo "<div class='center'><table class='tab_cadre_fixe'><tr><th colspan='2'>" . $LANG["setup"][201] . "</th></tr>";
652
        
653
                        echo "<tr class='tab_bg_2'><td >" . $LANG["setup"][202] . "</td><td>";
654
                        dropdownYesNo("mailing", $CFG_GLPI["mailing"]);
655
                        echo "</td></tr>";
656
        
657
                        echo "<tr class='tab_bg_2'><td >" . $LANG["setup"][203] . "</td><td> <input type=\"text\" name=\"admin_email\" size='40' value=\"" . $CFG_GLPI["admin_email"] . "\">";
658
                        if (!isValidEmail($CFG_GLPI["admin_email"])){
659
                                echo "<span class='red'>&nbsp;".$LANG["mailing"][110]."</span>";
660
                        }
661
                        echo " </td></tr>";
662

    
663
                        echo "<tr class='tab_bg_2'><td >" . $LANG["setup"][207] . "</td><td> <input type=\"text\" name=\"admin_reply\" size='40' value=\"" . $CFG_GLPI["admin_reply"] . "\">";
664
                        if (!isValidEmail($CFG_GLPI["admin_reply"])){
665
                                echo "<span class='red'>&nbsp;".$LANG["mailing"][110]."</span>";
666
                        }
667
                        echo " </td></tr>";
668
        
669
                        echo "<tr class='tab_bg_2'><td >" . $LANG["setup"][204] . "</td><td><textarea   cols='60' rows='3'  name=\"mailing_signature\" >".$CFG_GLPI["mailing_signature"]."</textarea></td></tr>";
670
        
671
                        echo "<tr class='tab_bg_2'><td >" . $LANG["setup"][226] . "</td><td>";
672
                        dropdownYesNo("url_in_mail", $CFG_GLPI["url_in_mail"]);
673
                        echo "</td></tr>";
674
        
675
                        echo "<tr class='tab_bg_2'><td >" . $LANG["setup"][227] . "</td><td> <input type=\"text\" name=\"url_base\" size='40' value=\"" . $CFG_GLPI["url_base"] . "\"> </td></tr>";
676
        
677
                        if (!function_exists('mail')) {
678
                                echo "<tr class='tab_bg_2'><td align='center' colspan='2'><span class='red'>" . $LANG["setup"][217] . " : </span><span>" . $LANG["setup"][218] . "</span></td></tr>";
679
                        }
680
        
681
                        echo "<tr class='tab_bg_2'><td >" . $LANG["setup"][231] . "</td><td>&nbsp; ";
682
        
683
                        if (!function_exists('mail')) { // if mail php disabled we forced SMTP usage 
684
                                echo $LANG["choice"][1] . "  &nbsp;<input type=\"radio\" name=\"smtp_mode\" value=\"1\" checked >";
685
                        } else {
686
                                dropdownYesNo("smtp_mode", $CFG_GLPI["smtp_mode"]);
687
                        }
688
                        echo "</td></tr>";
689
        
690
                        echo "<tr class='tab_bg_2'><td >" . $LANG["setup"][232] . "</td><td> <input type=\"text\" name=\"smtp_host\" size='40' value=\"" . $CFG_GLPI["smtp_host"] . "\"> </td></tr>";
691
        
692
                        echo "<tr class='tab_bg_2'><td >" . $LANG["setup"][233] . "</td><td> <input type=\"text\" name=\"smtp_port\" size='40' value=\"" . $CFG_GLPI["smtp_port"] . "\"> </td></tr>";
693
        
694
                        echo "<tr class='tab_bg_2'><td >" . $LANG["setup"][234] . "</td><td> <input type=\"text\" name=\"smtp_username\" size='40' value=\"" . $CFG_GLPI["smtp_username"] . "\"> </td></tr>";
695
        
696
                        echo "<tr class='tab_bg_2'><td >" . $LANG["setup"][235] . "</td><td> <input type=\"password\" name=\"smtp_password\" size='40' value=\"\"> </td></tr>";
697
        
698
                        echo "<tr class='tab_bg_2'><td >" . $LANG["setup"][245] . " " . $LANG["setup"][244] . "</td><td>";
699
                        echo "<select name='cartridges_alert'> ";
700
                        echo "<option value='0' " . ($CFG_GLPI["cartridges_alert"] == 0 ? "selected" : "") . " >" . $LANG["setup"][307] . "</option>";
701
                        echo "<option value='" . DAY_TIMESTAMP . "' " . ($CFG_GLPI["cartridges_alert"] == DAY_TIMESTAMP ? "selected" : "") . " >" . $LANG["reservation"][29] . "</option>";
702
                        echo "<option value='" . WEEK_TIMESTAMP . "' " . ($CFG_GLPI["cartridges_alert"] == WEEK_TIMESTAMP ? "selected" : "") . " >" . $LANG["setup"][308] . "</option>";
703
                        echo "<option value='" . MONTH_TIMESTAMP . "' " . ($CFG_GLPI["cartridges_alert"] == MONTH_TIMESTAMP ? "selected" : "") . " >" . $LANG["setup"][309] . "</option>";
704
                        echo "</select>";
705
                        echo "</td></tr>";
706
        
707
                        echo "<tr class='tab_bg_2'><td >" . $LANG["setup"][245] . " " . $LANG["setup"][243] . "</td><td>";
708
                        echo "<select name='consumables_alert'> ";
709
                        echo "<option value='0' " . ($CFG_GLPI["consumables_alert"] == 0 ? "selected" : "") . " >" . $LANG["setup"][307] . "</option>";
710
                        echo "<option value='" . DAY_TIMESTAMP . "' " . ($CFG_GLPI["cartridges_alert"] == DAY_TIMESTAMP ? "selected" : "") . " >" . $LANG["reservation"][29] . "</option>";
711
                        echo "<option value='" . WEEK_TIMESTAMP . "' " . ($CFG_GLPI["consumables_alert"] == WEEK_TIMESTAMP ? "selected" : "") . " >" . $LANG["setup"][308] . "</option>";
712
                        echo "<option value='" . MONTH_TIMESTAMP . "' " . ($CFG_GLPI["consumables_alert"] == MONTH_TIMESTAMP ? "selected" : "") . " >" . $LANG["setup"][309] . "</option>";
713
                        echo "</select>";
714
                        echo "</td></tr>";
715

    
716
                        echo "<tr class='tab_bg_2'><td >" . $LANG["setup"][264] . "</td><td>";
717
                        dropdownYesNo("licenses_alert", $CFG_GLPI["licenses_alert"]);
718
                        echo "</td></tr>";
719
        
720
                        echo "<tr class='tab_bg_2'><td align='center' colspan='2'>";
721
                        echo "<input type=\"submit\" name=\"update_mailing\" class=\"submit\" value=\"" . $LANG["buttons"][2] . "\" >";
722
                        echo "</td></tr>";
723
        
724
                        echo "</table>";
725
                        echo "</div>";
726
                        echo "</form>";
727
                        echo "<form action=\"$target\" method=\"post\">";
728
                        echo "<div class='center'><table class='tab_cadre_fixe'><tr><th colspan='2'>" . $LANG["setup"][229] . "</th></tr>";
729
                        echo "<tr class='tab_bg_2'>";
730
                        echo "<td class='center'>";
731
                        echo "<input class=\"submit\" type=\"submit\" name=\"test_smtp_send\" value=\"" . $LANG["buttons"][2] . "\">";
732
                        echo " </td></tr></table></div>";
733
                break;
734
                case 2:
735
                        $profiles[USER_MAILING_TYPE . "_" . ADMIN_MAILING] = $LANG["setup"][237];
736
                        $profiles[USER_MAILING_TYPE . "_" . ADMIN_ENTITY_MAILING] = $LANG["setup"][237]." ".$LANG["entity"][0];
737
                        $profiles[USER_MAILING_TYPE . "_" . TECH_MAILING] = $LANG["common"][10];
738
                        $profiles[USER_MAILING_TYPE . "_" . AUTHOR_MAILING] = $LANG["job"][4];
739
                        $profiles[USER_MAILING_TYPE . "_" . RECIPIENT_MAILING] = $LANG["job"][3];
740
                        $profiles[USER_MAILING_TYPE . "_" . USER_MAILING] = $LANG["common"][34] . " " . $LANG["common"][1];
741
                        $profiles[USER_MAILING_TYPE . "_" . ASSIGN_MAILING] = $LANG["setup"][239];
742
                        $profiles[USER_MAILING_TYPE . "_" . ASSIGN_ENT_MAILING] = $LANG["financial"][26];
743
                        $profiles[USER_MAILING_TYPE . "_" . ASSIGN_GROUP_MAILING] = $LANG["setup"][248];
744
                        $profiles[USER_MAILING_TYPE . "_" . SUPERVISOR_ASSIGN_GROUP_MAILING] = $LANG["common"][64]." ".$LANG["setup"][248];
745
                        $profiles[USER_MAILING_TYPE . "_" . SUPERVISOR_AUTHOR_GROUP_MAILING] = $LANG["common"][64]." ".$LANG["setup"][249];
746
                                
747
                                
748
                        asort($profiles);
749

    
750
                        $query = "SELECT ID, name FROM glpi_profiles order by name";
751
                        $result = $DB->query($query);
752
                        while ($data = $DB->fetch_assoc($result)){
753
                                $profiles[PROFILE_MAILING_TYPE ."_" . $data["ID"]] = $LANG["profiles"][22] . " " . $data["name"];
754
                        }
755

    
756
                        $query = "SELECT ID, name FROM glpi_groups order by name";
757
                        $result = $DB->query($query);
758
                        while ($data = $DB->fetch_assoc($result)){
759
                                $profiles[GROUP_MAILING_TYPE ."_" . $data["ID"]] = $LANG["common"][35] . " " . $data["name"];
760
                        }
761
        
762
                        echo "<div class='center'>";
763
                        echo "<input type='hidden' name='update_notifications' value='1'>";
764
                        // ADMIN
765
                        echo "<table class='tab_cadre_fixe'>";
766
                        echo "<tr><th colspan='3'>" . $LANG["setup"][211] . "</th></tr>";
767
                        echo "<tr class='tab_bg_2'>";
768
                        showFormMailingType("new", $profiles);
769
                        echo "</tr>";
770
                        echo "<tr><th colspan='3'>" . $LANG["setup"][212] . "</th></tr>";
771
                        echo "<tr class='tab_bg_1'>";
772
                        showFormMailingType("followup", $profiles);
773
                        echo "</tr>";
774
                        echo "<tr class='tab_bg_2'><th colspan='3'>" . $LANG["setup"][213] . "</th></tr>";
775
                        echo "<tr class='tab_bg_2'>";
776
                        showFormMailingType("finish", $profiles);
777
                        echo "</tr>";
778
                        echo "<tr class='tab_bg_2'><th colspan='3'>" . $LANG["setup"][230] . "</th></tr>";
779
                        echo "<tr class='tab_bg_1'>";
780
                        $profiles[USER_MAILING_TYPE . "_" . OLD_ASSIGN_MAILING] = $LANG["setup"][236];
781
                        ksort($profiles);
782
                        showFormMailingType("update", $profiles);
783
                        unset ($profiles[USER_MAILING_TYPE . "_" . OLD_ASSIGN_MAILING]);
784
                        echo "</tr>";
785
        
786
                        echo "<tr class='tab_bg_2'><th colspan='3'>" . $LANG["setup"][225] . "</th></tr>";
787
                        echo "<tr class='tab_bg_2'>";
788
                        unset ($profiles[USER_MAILING_TYPE . "_" . ASSIGN_MAILING]);
789
                        unset ($profiles[USER_MAILING_TYPE . "_" . ASSIGN_ENT_MAILING]);
790
                        unset ($profiles[USER_MAILING_TYPE . "_" . ASSIGN_GROUP_MAILING]);
791
                        unset ($profiles[USER_MAILING_TYPE . "_" . SUPERVISOR_ASSIGN_GROUP_MAILING]);
792
                        unset ($profiles[USER_MAILING_TYPE . "_" . SUPERVISOR_AUTHOR_GROUP_MAILING]);
793
                        unset ($profiles[USER_MAILING_TYPE . "_" . RECIPIENT_MAILING]);
794

    
795
                        showFormMailingType("resa", $profiles);
796
                        echo "</tr>";
797
        
798
                        echo "</table>";
799
                        echo "</div>";
800
                break;
801
                case 3:
802
                        $profiles[USER_MAILING_TYPE . "_" . ADMIN_MAILING] = $LANG["setup"][237];
803
                        $profiles[USER_MAILING_TYPE . "_" . ADMIN_ENTITY_MAILING] = $LANG["setup"][237]." ".$LANG["entity"][0];
804
                        $query = "SELECT ID, name FROM glpi_profiles order by name";
805
                        $result = $DB->query($query);
806
                        while ($data = $DB->fetch_assoc($result)){
807
                                $profiles[PROFILE_MAILING_TYPE ."_" . $data["ID"]] = $LANG["profiles"][22] . " " . $data["name"];
808
                        }
809
        
810
                        $query = "SELECT ID, name FROM glpi_groups order by name";
811
                        $result = $DB->query($query);
812
                        while ($data = $DB->fetch_assoc($result)){
813
                                $profiles[GROUP_MAILING_TYPE ."_" . $data["ID"]] = $LANG["common"][35] . " " . $data["name"];
814
                        }
815
        
816
                        ksort($profiles);
817
                        echo "<div class='center'>";
818
                        echo "<input type='hidden' name='update_notifications' value='1'>";
819
                        // ADMIN
820
                        echo "<table class='tab_cadre_fixe'>";
821
                        echo "<tr><th colspan='3'>" . $LANG["setup"][243]."&nbsp;&nbsp;";
822
                        echo "<input class=\"submit\" type=\"submit\" name=\"test_cron_consumables\" value=\"" . $LANG["buttons"][50] . "\">";
823
                        echo "</th></tr>";
824
                        echo "<tr class='tab_bg_2'>";
825
                        showFormMailingType("alertconsumable", $profiles);
826
                        echo "</tr>";
827

    
828
                        echo "<tr><th colspan='3'>" . $LANG["setup"][244]."&nbsp;&nbsp;";
829
                        echo "<input class=\"submit\" type=\"submit\" name=\"test_cron_cartridges\" value=\"" . $LANG["buttons"][50] . "\">";
830
                        echo "</th></tr>";
831
                        echo "<tr class='tab_bg_1'>";
832
                        showFormMailingType("alertcartridge", $profiles);
833
                        echo "</tr>";
834
                        echo "<tr><th colspan='3'>" . $LANG["setup"][246]."&nbsp;&nbsp;";
835
                        echo "<input class=\"submit\" type=\"submit\" name=\"test_cron_contracts\" value=\"" . $LANG["buttons"][50] . "\">";
836
                        echo "</th></tr>";
837
                        echo "<tr class='tab_bg_2'>";
838
                        showFormMailingType("alertcontract", $profiles);
839
                        echo "</tr>";
840
                        echo "<tr><th colspan='3'>" . $LANG["setup"][247]."&nbsp;&nbsp;";
841
                        echo "<input class=\"submit\" type=\"submit\" name=\"test_cron_infocoms\" value=\"" . $LANG["buttons"][50] . "\">";
842
                        echo "</th></tr>";
843
                        echo "<tr class='tab_bg_1'>";
844
                        showFormMailingType("alertinfocom", $profiles);
845
                        echo "</tr>";
846
                        echo "<tr><th colspan='3'>" . $LANG["setup"][264]."&nbsp;&nbsp;";
847
                        echo "<input class=\"submit\" type=\"submit\" name=\"test_cron_softwares\" value=\"" . $LANG["buttons"][50] . "\">";
848
                        echo "</th></tr>";
849
                        echo "<tr class='tab_bg_1'>";
850
                        showFormMailingType("alertlicense", $profiles);
851
                        echo "</tr>";
852

    
853
                        echo "</table>";
854
                        echo "</div>";
855
                break;
856
        
857
                }
858
                echo "</form>";
859
        
860
        }
861

    
862
}
863

    
864
/// OCS Config class
865
class ConfigOCS extends CommonDBTM {
866

    
867
        /**
868
         * Constructor
869
        **/
870
        function ConfigOCS () {
871
                $this->table="glpi_ocs_config";
872
                $this->type=-1;
873
        }
874

    
875
        /**
876
         * Prepare input datas for updating the item
877
         *
878
         *@param $input datas used to update the item 
879
         * 
880
         *@return the modified $input array
881
         * 
882
        **/
883
        function prepareInputForUpdate($input) {
884
                if (isset($input["ocs_db_passwd"])&&!empty($input["ocs_db_passwd"])){
885
                        $input["ocs_db_passwd"]=rawurlencode(stripslashes($input["ocs_db_passwd"]));
886
                } else {
887
                        unset($input["ocs_db_passwd"]);
888
                }
889

    
890
                if (isset($input["import_ip"])){
891
                        $input["checksum"]=0;
892

    
893
                        if ($input["import_ip"]) $input["checksum"]|= pow(2,NETWORKS_FL);
894
                        if ($input["import_device_ports"]) $input["checksum"]|= pow(2,PORTS_FL);
895
                        if ($input["import_device_modems"]) $input["checksum"]|= pow(2,MODEMS_FL);
896
                        if ($input["import_device_drives"]) $input["checksum"]|= pow(2,STORAGES_FL);
897
                        if ($input["import_device_sound"]) $input["checksum"]|= pow(2,SOUNDS_FL);
898
                        if ($input["import_device_gfxcard"]) $input["checksum"]|= pow(2,VIDEOS_FL);
899
                        if ($input["import_device_iface"]) $input["checksum"]|= pow(2,NETWORKS_FL);
900
                        if ($input["import_device_hdd"]) $input["checksum"]|= pow(2,STORAGES_FL);
901
                        if ($input["import_device_memory"]) $input["checksum"]|= pow(2,MEMORIES_FL);
902
                        if (        $input["import_device_processor"]
903
                                        ||$input["import_general_contact"]
904
                                        ||$input["import_general_comments"]
905
                                        ||$input["import_general_domain"]
906
                                        ||$input["import_general_os"]
907
                                        ||$input["import_general_name"]) $input["checksum"]|= pow(2,HARDWARE_FL);
908
                        if (        $input["import_general_enterprise"]
909
                                        ||$input["import_general_type"]
910
                                        ||$input["import_general_model"]
911
                                        ||$input["import_general_serial"]) $input["checksum"]|= pow(2,BIOS_FL);
912
                        if ($input["import_printer"]) $input["checksum"]|= pow(2,PRINTERS_FL);
913
                        if ($input["import_software"]) $input["checksum"]|= pow(2,SOFTWARES_FL);
914
                        if ($input["import_monitor"]) $input["checksum"]|= pow(2,MONITORS_FL);
915
                        if ($input["import_periph"]) $input["checksum"]|= pow(2,INPUTS_FL);
916
                }
917

    
918
                return $input;
919
        }
920
        /**
921
         * Actions done after the UPDATE of the item in the database
922
         *
923
         *@param $input datas used to update the item
924
         *@param $updates array of the updated fields
925
         *@param $history store changes history ? 
926
         * 
927
        **/
928
        function post_updateItem($input,$updates,$history=1) {
929
                global $CACHE_CFG;
930
                if (count($updates)){
931
                        $CACHE_CFG->remove("CFG_OCSGLPI_".$input["ID"],"GLPI_CFG",true);
932
                }
933
        }
934

    
935
}
936

    
937
?>
Redmine Appliance - Powered by TurnKey Linux