1+ <?php
2+ /*
3+ * Copyright 2005-2016 OCSInventory-NG/OCSInventory-ocsreports contributors.
4+ * See the Contributors file for more details about them.
5+ *
6+ * This file is part of OCSInventory-NG/OCSInventory-ocsreports.
7+ *
8+ * OCSInventory-NG/OCSInventory-ocsreports is free software: you can redistribute
9+ * it and/or modify it under the terms of the GNU General Public License as
10+ * published by the Free Software Foundation, either version 2 of the License,
11+ * or (at your option) any later version.
12+ *
13+ * OCSInventory-NG/OCSInventory-ocsreports is distributed in the hope that it
14+ * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
15+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+ * GNU General Public License for more details.
17+ *
18+ * You should have received a copy of the GNU General Public License
19+ * along with OCSInventory-NG/OCSInventory-ocsreports. if not, write to the
20+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21+ * MA 02110-1301, USA.
22+ */
23+
24+ if (AJAX ) {
25+ parse_str ($ protectedPost ['ocs ' ]['0 ' ], $ params );
26+ $ protectedPost += $ params ;
27+
28+ ob_start ();
29+ }
30+
31+ require_once 'require/extensions/ExtensionManager.php ' ;
32+ require_once 'require/extensions/ExtensionCommon.php ' ;
33+
34+ printEnTete ($ l ->g (7008 ));
35+
36+ ?>
37+ <div class="container">
38+ <div class="col col-md-12">
39+ <?php
40+
41+ $ extMgr = new ExtensionManager ();
42+ if ($ extMgr ->checkPrerequisites ()){
43+ $ extMgr ->checkInstallableExtensions ();
44+
45+ if (empty ($ extMgr ->installableExtensionsList )){
46+ msg_warning ($ l ->g (7014 ));
47+ }else {
48+ echo open_form ("PluginInstall " , '' , '' , 'form-horizontal ' );
49+ ?>
50+ <div class="form-group">
51+ <div class="col col-sm-5 col-sm-offset-3">
52+ <select class="form-control" name="extensions">
53+ <?php
54+ foreach ($ extMgr ->installableExtensionsList as $ key => $ value ) {
55+ echo "<option value= $ value > $ value</option> " ;
56+ }
57+ ?>
58+ </select>
59+ </div>
60+ <div class="col col-sm-2">
61+ <input type="submit" class="form-control btn btn-success" value="Install">
62+ </div>
63+ </div>
64+ <?php
65+ echo close_form ();
66+ }
67+
68+ }else {
69+ msg_warning ($ l ->g (7014 ));
70+ }
71+
72+ ?>
73+ </div>
74+ </div>
75+ <?php
76+
77+ if (!AJAX ) {
78+ if (isset ($ protectedPost ['extensions ' ])){
79+ $ extMgr ->installExtension ($ protectedPost ['extensions ' ]);
80+ }
81+
82+ if (isset ($ protectedPost ['SUP_PROF ' ])){
83+ $ extMgr ->deleteExtension ($ protectedPost ['SUP_PROF ' ]);
84+ }
85+ }
86+
87+ // Plugins Tab
88+ printEnTete ($ l ->g (7009 ));
89+ $ form_name = "show_all_extensions " ;
90+ $ table_name = $ form_name ;
91+ $ tab_options = $ protectedPost ;
92+ $ tab_options ['form_name ' ] = $ form_name ;
93+ $ tab_options ['table_name ' ] = $ table_name ;
94+ echo open_form ($ form_name , '' , '' , 'form-horizontal ' );
95+
96+ $ list_fields = array ('ID ' => 'id ' ,
97+ $ l ->g (7002 ) => 'name ' ,
98+ $ l ->g (53 ) => 'description ' ,
99+ $ l ->g (7003 ) => 'version ' ,
100+ $ l ->g (7005 ) => 'author ' ,
101+ $ l ->g (7004 ) => 'licence '
102+ );
103+
104+ $ tab_options ['FILTRE ' ] = array_flip ($ list_fields );
105+ $ tab_options ['FILTRE ' ]['NAME ' ] = $ l ->g (49 );
106+ asort ($ tab_options ['FILTRE ' ]);
107+ $ list_fields ['SUP ' ] = 'ID ' ;
108+ $ list_col_cant_del = array ('SUP ' => 'SUP ' );
109+ $ default_fields = array ($ l ->g (7002 ) => $ l ->g (7002 ), $ l ->g (7003 ) => $ l ->g (7003 ), $ l ->g (7004 ) => $ l ->g (7005 ), $ l ->g (7006 ), $ l ->g (7006 ));
110+ $ sql = prepare_sql_tab ($ list_fields , $ list_col_cant_del );
111+ $ tab_options ['ARG_SQL ' ] = $ sql ['ARG ' ];
112+ $ queryDetails = $ sql ['SQL ' ] . ",ID from extensions " ;
113+ $ tab_options ['LBL_POPUP ' ]['SUP ' ] = $ l ->g (7007 ) . " " ;
114+ $ tab_options ['LBL ' ]['SUP ' ] = $ l ->g (122 );
115+ $ tab_options ['LIEN_CHAMP ' ]['NAME ' ] = 'ID ' ;
116+ $ tab_options ['LBL ' ]['NAME ' ] = $ l ->g (49 );
117+ ajaxtab_entete_fixe ($ list_fields , $ default_fields , $ tab_options , $ list_col_cant_del );
118+ echo close_form ();
119+
120+ if (AJAX ) {
121+ ob_end_clean ();
122+ tab_req ($ list_fields , $ default_fields , $ list_col_cant_del , $ queryDetails , $ tab_options );
123+ }
0 commit comments