3030function plugin_addressing_install () {
3131 global $ DB ;
3232
33- include_once (GLPI_ROOT . "/plugins/addressing/inc/profile.class.php " );
33+ include_once (GLPI_ROOT . "/plugins/addressing/inc/profile.class.php " );
3434
3535 $ update = false ;
3636 if (!$ DB ->tableExists ("glpi_plugin_addressing_display " )
37- &&!$ DB ->tableExists ("glpi_plugin_addressing " )
37+ && !$ DB ->tableExists ("glpi_plugin_addressing " )
3838 && !$ DB ->tableExists ("glpi_plugin_addressing_configs " )) {
3939
40- $ DB ->runFile (GLPI_ROOT ."/plugins/addressing/sql/empty-2.7.0.sql " );
40+ $ DB ->runFile (GLPI_ROOT . "/plugins/addressing/sql/empty-2.7.0.sql " );
4141
4242 } else {
4343
4444 if (!$ DB ->tableExists ("glpi_plugin_addressing_profiles " )
4545 && $ DB ->tableExists ("glpi_plugin_addressing_display " )
4646 && !$ DB ->fieldExists ("glpi_plugin_addressing_display " , "ipconf1 " )) {//1.4
4747 $ update = true ;
48- $ DB ->runFile (GLPI_ROOT ."/plugins/addressing/sql/update-1.4.sql " );
48+ $ DB ->runFile (GLPI_ROOT . "/plugins/addressing/sql/update-1.4.sql " );
4949 }
5050
5151 if (!$ DB ->tableExists ("glpi_plugin_addressing " )
5252 && $ DB ->tableExists ("glpi_plugin_addressing_display " )
5353 && $ DB ->fieldExists ("glpi_plugin_addressing_display " , "ipconf1 " )) {
5454 $ update = true ;
55- $ DB ->runFile (GLPI_ROOT ."/plugins/addressing/sql/update-1.5.sql " );
55+ $ DB ->runFile (GLPI_ROOT . "/plugins/addressing/sql/update-1.5.sql " );
5656
5757 }
5858
5959 if ($ DB ->tableExists ("glpi_plugin_addressing_display " )
6060 && !$ DB ->fieldExists ("glpi_plugin_addressing " , "ipdeb " )) {
6161 $ update = true ;
62- $ DB ->runFile (GLPI_ROOT ."/plugins/addressing/sql/update-1.6.sql " );
62+ $ DB ->runFile (GLPI_ROOT . "/plugins/addressing/sql/update-1.6.sql " );
6363
6464 }
6565
6666 if ($ DB ->tableExists ("glpi_plugin_addressing_profiles " )
6767 && $ DB ->fieldExists ("glpi_plugin_addressing_profiles " , "interface " )) {
6868 $ update = true ;
69- $ DB ->runFile (GLPI_ROOT ."/plugins/addressing/sql/update-1.7.0.sql " );
69+ $ DB ->runFile (GLPI_ROOT . "/plugins/addressing/sql/update-1.7.0.sql " );
7070
7171 }
7272
7373 if (!$ DB ->tableExists ("glpi_plugin_addressing_configs " )) {
74- $ DB ->runFile (GLPI_ROOT ."/plugins/addressing/sql/update-1.8.0.sql " );
74+ $ DB ->runFile (GLPI_ROOT . "/plugins/addressing/sql/update-1.8.0.sql " );
7575 $ update = true ;
7676 }
7777
7878 if ($ DB ->tableExists ("glpi_plugin_addressing_profiles " )
7979 && !$ DB ->fieldExists ("glpi_plugin_addressing_profiles " , "use_ping_in_equipment " )) {
80- $ DB ->runFile (GLPI_ROOT ."/plugins/addressing/sql/update-1.9.0.sql " );
80+ $ DB ->runFile (GLPI_ROOT . "/plugins/addressing/sql/update-1.9.0.sql " );
8181 $ update = true ;
8282 }
8383 //Version 2.4.0
8484 if (!$ DB ->tableExists ("glpi_plugin_addressing_filters " )) {
85- $ DB ->runFile (GLPI_ROOT ."/plugins/addressing/sql/update-2.4.0.sql " );
85+ $ DB ->runFile (GLPI_ROOT . "/plugins/addressing/sql/update-2.4.0.sql " );
8686 }
8787
8888 //Version 2.5.0
8989 if (!$ DB ->fieldExists ("glpi_plugin_addressing_addressings " , "locations_id " ) && !$ DB ->fieldExists ("glpi_plugin_addressing_addressings " , "fqdns_id " )) {
90- $ DB ->runFile (GLPI_ROOT ."/plugins/addressing/sql/update-2.5.0.sql " );
90+ $ DB ->runFile (GLPI_ROOT . "/plugins/addressing/sql/update-2.5.0.sql " );
9191 }
9292
9393 }
@@ -97,12 +97,12 @@ function plugin_addressing_install() {
9797 FROM `glpi_plugin_addressing_profiles` " ;
9898 $ result_ = $ DB ->query ($ query_ );
9999
100- if ($ DB ->numrows ($ result_ )> 0 ) {
101- while ($ data= $ DB ->fetch_array ($ result_ )) {
102- $ query = "UPDATE `glpi_plugin_addressing_profiles`
103- SET `profiles_id` = ' ". $ data ["id " ]. "'
104- WHERE `id` = ' ". $ data ["id " ]. "' " ;
105- $ result= $ DB ->query ($ query );
100+ if ($ DB ->numrows ($ result_ ) > 0 ) {
101+ while ($ data = $ DB ->fetchArray ($ result_ )) {
102+ $ query = "UPDATE `glpi_plugin_addressing_profiles`
103+ SET `profiles_id` = ' " . $ data ["id " ] . "'
104+ WHERE `id` = ' " . $ data ["id " ] . "' " ;
105+ $ result = $ DB ->query ($ query );
106106 }
107107 }
108108
@@ -113,10 +113,10 @@ function plugin_addressing_install() {
113113 }
114114
115115 Plugin::migrateItemType ([5000 => 'PluginAddressingAddressing ' ,
116- 5001 => 'PluginAddressingReport ' ],
116+ 5001 => 'PluginAddressingReport ' ],
117117 ["glpi_savedsearches " , "glpi_savedsearches_users " ,
118- "glpi_displaypreferences " , "glpi_documents_items " ,
119- "glpi_infocoms " , "glpi_logs " , "glpi_items_tickets " ]);
118+ "glpi_displaypreferences " , "glpi_documents_items " ,
119+ "glpi_infocoms " , "glpi_logs " , "glpi_items_tickets " ]);
120120
121121 }
122122
@@ -138,13 +138,13 @@ function plugin_addressing_install() {
138138function plugin_addressing_uninstall () {
139139 global $ DB ;
140140
141- include_once (GLPI_ROOT . "/plugins/addressing/inc/profile.class.php " );
142- include_once (GLPI_ROOT . "/plugins/addressing/inc/menu.class.php " );
141+ include_once (GLPI_ROOT . "/plugins/addressing/inc/profile.class.php " );
142+ include_once (GLPI_ROOT . "/plugins/addressing/inc/menu.class.php " );
143143
144144 $ migration = new Migration ("2.5.0 " );
145- $ tables = ["glpi_plugin_addressing_addressings " ,
146- "glpi_plugin_addressing_configs " ,
147- "glpi_plugin_addressing_filters " ];
145+ $ tables = ["glpi_plugin_addressing_addressings " ,
146+ "glpi_plugin_addressing_configs " ,
147+ "glpi_plugin_addressing_filters " ];
148148
149149 foreach ($ tables as $ table ) {
150150 $ migration ->dropTable ($ table );
@@ -183,7 +183,7 @@ function plugin_addressing_getDatabaseRelations() {
183183
184184 if ($ plugin ->isActivated ("addressing " )) {
185185 return ["glpi_networks " => ["glpi_plugin_addressing_addressings " => "networks_id " ],
186- "glpi_entities " => ["glpi_plugin_addressing_addressings " => "entities_id " ]];
186+ "glpi_entities " => ["glpi_plugin_addressing_addressings " => "entities_id " ]];
187187 }
188188 return [];
189189}
@@ -274,9 +274,9 @@ function plugin_addressing_dynamicReport($params) {
274274 $ PluginAddressingAddressing = new PluginAddressingAddressing ();
275275
276276 if ($ params ["item_type " ] == 'PluginAddressingReport '
277- && isset ($ params ["id " ])
278- && isset ($ params ["display_type " ])
279- && $ PluginAddressingAddressing ->getFromDB ($ params ["id " ])) {
277+ && isset ($ params ["id " ])
278+ && isset ($ params ["display_type " ])
279+ && $ PluginAddressingAddressing ->getFromDB ($ params ["id " ])) {
280280
281281 $ PluginAddressingReport = new PluginAddressingReport ();
282282 $ PluginAddressingAddressing ->getFromDB ($ params ['id ' ]);
@@ -286,16 +286,16 @@ function plugin_addressing_dynamicReport($params) {
286286 if ($ addressingFilter ->getFromDB ($ params ['filter ' ])) {
287287 $ ipdeb = sprintf ("%u " , ip2long ($ addressingFilter ->fields ['begin_ip ' ]));
288288 $ ipfin = sprintf ("%u " , ip2long ($ addressingFilter ->fields ['end_ip ' ]));
289- $ result = $ PluginAddressingAddressing ->compute ($ params ["start " ], [ 'ipdeb ' => $ ipdeb ,
290- 'ipfin ' => $ ipfin ,
291- 'entities_id ' => $ addressingFilter ->fields ['entities_id ' ],
292- 'type_filter ' => $ addressingFilter ->fields ['type ' ]]);
289+ $ result = $ PluginAddressingAddressing ->compute ($ params ["start " ], ['ipdeb ' => $ ipdeb ,
290+ 'ipfin ' => $ ipfin ,
291+ 'entities_id ' => $ addressingFilter ->fields ['entities_id ' ],
292+ 'type_filter ' => $ addressingFilter ->fields ['type ' ]]);
293293 }
294294 } else {
295295 $ ipdeb = sprintf ("%u " , ip2long ($ PluginAddressingAddressing ->fields ["begin_ip " ]));
296296 $ ipfin = sprintf ("%u " , ip2long ($ PluginAddressingAddressing ->fields ["end_ip " ]));
297- $ result = $ PluginAddressingAddressing ->compute ($ params ["start " ], [ 'ipdeb ' => $ ipdeb ,
298- 'ipfin ' => $ ipfin ]);
297+ $ result = $ PluginAddressingAddressing ->compute ($ params ["start " ], ['ipdeb ' => $ ipdeb ,
298+ 'ipfin ' => $ ipfin ]);
299299 }
300300 $ PluginAddressingReport ->displayReport ($ result , $ PluginAddressingAddressing );
301301
@@ -316,7 +316,7 @@ function plugin_addressing_dynamicReport($params) {
316316 */
317317function plugin_addressing_addOrderBy ($ itemtype , $ ID , $ order , $ key ) {
318318 if ($ itemtype == "PluginAddressingAddressing "
319- && ($ ID == 1000 || $ ID == 1001 )) {
319+ && ($ ID == 1000 || $ ID == 1001 )) {
320320 return "ORDER BY INET_ATON(ITEM_ $ key) $ order " ;
321321
322322 }
0 commit comments