Subversion Repositories oidplus

Rev

Rev 1288 | Rev 1302 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1288 Rev 1293
Line 36... Line 36...
36
         *
36
         *
37
         */
37
         */
38
        /*private*/ const QUERY_GET_OIDINFO_DATA_V1  = '1.3.6.1.4.1.37476.2.5.2.1.6.1';
38
        /*private*/ const QUERY_GET_OIDINFO_DATA_V1  = '1.3.6.1.4.1.37476.2.5.2.1.6.1';
39
 
39
 
40
        /**
40
        /**
41
         * @param string $actionID
-
 
42
         * @param array $params
41
         * @param array $params
43
         * @return array
42
         * @return array
44
         * @throws OIDplusException
43
         * @throws OIDplusException
45
         */
44
         */
46
        public function action(string $actionID, array $params): array {
45
        private function action_ImportXml(array $params): array {
47
 
-
 
48
                if ($actionID == 'import_xml_file') {
-
 
49
                        if (!OIDplus::authUtils()->isAdminLoggedIn()) {
46
                if (!OIDplus::authUtils()->isAdminLoggedIn()) {
50
                                throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), null,401);
47
                        throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), null,401);
51
                        }
48
                }
52
 
49
 
53
                        if (!isset($_FILES['userfile'])) {
50
                if (!isset($_FILES['userfile'])) {
Line 76... Line 73...
76
                                        "count_already_existing" => $count_already_existing,
73
                                "count_already_existing" => $count_already_existing,
77
                                        "count_errors" => $count_errors,
74
                                "count_errors" => $count_errors,
78
                                        "count_warnings" => $count_warnings
75
                                "count_warnings" => $count_warnings
79
                                );
76
                        );
80
                        }
77
                }
-
 
78
        }
-
 
79
 
-
 
80
        /**
-
 
81
         * @param array $params
-
 
82
         * @return array
-
 
83
         * @throws OIDplusException
-
 
84
         */
81
                } else if ($actionID == 'import_oidinfo_oid') {
85
        private function action_ImportOidInfo(array $params): array {
82
                        if (!OIDplus::authUtils()->isAdminLoggedIn()) {
86
                if (!OIDplus::authUtils()->isAdminLoggedIn()) {
83
                                throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), null, 401);
87
                        throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), null, 401);
84
                        }
88
                }
85
 
89
 
86
                        _CheckParamExists($params, 'oid');
90
                _CheckParamExists($params, 'oid');
Line 158... Line 162...
158
                        } else if ($count_imported_oids <> 1) {
162
                } else if ($count_imported_oids <> 1) {
159
                                return array("status" => -1, "error" => _L('Imported %1, but expected to import 1',$count_imported_oids));
163
                        return array("status" => -1, "error" => _L('Imported %1, but expected to import 1',$count_imported_oids));
160
                        } else {
164
                } else {
161
                                return array("status" => 0);
165
                        return array("status" => 0);
162
                        }
166
                }
-
 
167
        }
-
 
168
 
-
 
169
        /**
-
 
170
         * @param string $actionID
-
 
171
         * @param array $params
-
 
172
         * @return array
-
 
173
         * @throws OIDplusException
-
 
174
         */
-
 
175
        public function action(string $actionID, array $params): array {
-
 
176
                if ($actionID == 'import_xml_file') {
-
 
177
                        return $this->action_ImportXml($params);
-
 
178
                } else if ($actionID == 'import_oidinfo_oid') {
-
 
179
                        return $this->action_ImportOidInfo($params);
163
                } else {
180
                } else {
164
                        return parent::action($actionID, $params);
181
                        return parent::action($actionID, $params);
165
                }
182
                }
166
        }
183
        }
167
 
184