PluginProbe
WebTotem Security / 1.0
WebTotem Security v1.0
3.0.2 3.0.1 3.0.0 trunk 1.0 1.1 1.2 1.3 1.3.1 1.3.2 1.3.3 2.0 2.1 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.1 2.2.2 2.2.3 All 110 releases
← All changes | services.php +15 -22 2.1.21.0 View file →
@@ -38,9 +38,9 @@
38 38 WTSEC_LIBRARY_WT::changeStatus($status['config_id'],$uid);
39 39 wtsec_app()->set($_service.'_status',"start");
40 40 break;
41 41 case $_service . "_stop":
42 -// WTSEC_LIBRARY_WT::changeStatus($status['config_id'],$uid);
42 + WTSEC_LIBRARY_WT::changeStatus($status['config_id'],$uid);
43 43 wtsec_app()->set($_service.'_status',"stop");
44 44 break;
45 45 case $_service . "_connect":
46 46 $file = wtsec_getInstalledFile($_service);
@@ -75,24 +75,17 @@
75 75 }
76 76
77 77 function wtsec_checkStatus($id, $service)
78 78 {
79 - $service = ucfirst(strtolower($service));
80 - $is_active = null;
81 - $config_id = null;
82 79 $result = WTSEC_LIBRARY_WT::checkStatus($id,$service);
83 - $data = $result['data']['auth']['viewer']['sites']['one']['configs'];
84 - foreach ($data as &$cfg){
85 - if(!empty($cfg)){
86 - $is_active = $cfg['isActive'];
87 - $config_id = $cfg['id'];
88 - }
80 + $data = $result['data'][strtolower($service) . 'ServiceChecks'][0];
81 + $is_active = (boolean)$data['config']['isActive'];
82 + $config_id = $data['config']['id'];
83 + $status = $data['status'];
84 + if ($status == -300 && $is_active) {
85 + wtsec_app()->set($service . '_connected_' . $id, false);
89 86 }
90 -
91 - if ($is_active === false) {
92 - wtsec_app()->set($service . '_connected_' . $id, true);
93 - }
94 - return ['active' => $is_active, 'config_id' => $config_id];
87 + return ['active' => $is_active, 'status' => $status, 'config_id' => $config_id];
95 88 }
96 89
97 90
98 91
@@ -98,9 +91,9 @@
98 91
99 92 function wtsec_generateFile($id, $service)
100 93 {
101 94 $result = WTSEC_LIBRARY_WT::generateFile($id,$service);
102 - $name = $result['data']['auth']['agents']['generate']['agentName'];
95 + $name = $result['data']['generateAgent']['agentName'] . '.' . strtolower($service) . '.php';
103 96 $file = WTSEC_LIBRARY_WT::requestURL(WTSEC_FILE_URL . '/' . $name);
104 97 if(empty($file)){
105 98 $file = WTSEC_LIBRARY_WT::requestURL(WTSEC_FILE_URL . '/' . $name);
106 99 }
@@ -109,9 +102,9 @@
109 102
110 103 function wtsec_serviceConnect($id, $service,$domain = '')
111 104 {
112 105 $result = WTSEC_LIBRARY_WT::serviceConnect($id,$service);
113 - $status = isset($result['errors']) && !isset($result['data']['auth']['agents']['check']) ? false : true;
106 + $status = (isset($result['errors']) || isset($result['data']['checkAgent']['lockFor']) || (isset($result['data']['checkAgent']['installed']) && $result['data']['checkAgent']['installed'] === false)) ? false : true;
114 107 if (!$status) {
115 108 WTSEC_LIBRARY_Session::setNotification("warning",WTSEC_LIBRARY_Localization::lmsg('unable_to_connect_to_service', ['service' => $service,'site' => $domain]));
116 109 }
117 110 return $status;
@@ -120,9 +113,9 @@
120 113
121 114 function wtsec_servicePing($service,$domain = '')
122 115 {
123 116 if($domain == NULL) return false;
124 - if(stripos($domain,"http") === false){
117 + if(mb_stripos($domain,"http") === false){
125 118 $domain = "http://".$domain;
126 119 }
127 120 $args = [
128 121 'timeout' => '10',
@@ -177,21 +170,21 @@
177 170 $url = $domain.'/'.$installedFile['file'];
178 171 }
179 172 $connected = wtsec_servicePing($service,$url);
180 173 if (!$connected) {
181 - $disable_uninstall = false;
174 + $disable_uninstall = true;
182 175 $cmd = $_service . '_connect';
183 176 $buttons[] = ['place' => 'first','button' => wtsec_button(WTSEC_LIBRARY_Localization::lmsg('connect'),$first_class."ww-button--success"),'cmd' => $cmd];
184 177 } else {
185 178 if ($runned) {
186 179 $cmd = $_service . '_stop';
187 -// $buttons[] = ['place' => 'second','button' => wtsec_button(WTSEC_LIBRARY_Localization::lmsg('stop'),"ww-button--primary"),'cmd' => $cmd];
180 + $buttons[] = ['place' => 'second','button' => wtsec_button(WTSEC_LIBRARY_Localization::lmsg('stop'),"ww-button--primary"),'cmd' => $cmd];
188 181 } else {
189 182 $cmd = $_service . '_start';
190 -// $buttons[] = ['place' => 'second','button' => wtsec_button(WTSEC_LIBRARY_Localization::lmsg('run'),"ww-button--primary"),'cmd' => $cmd];
183 + $buttons[] = ['place' => 'second','button' => wtsec_button(WTSEC_LIBRARY_Localization::lmsg('run'),"ww-button--primary"),'cmd' => $cmd];
191 184 }
192 185 }
193 - if(!$disable_uninstall){
186 + if(!$disable_uninstall && !$runned){
194 187 $cmd = $_service . '_uninstall';
195 188 $buttons[] = ['place' => 'first','button' => wtsec_button(WTSEC_LIBRARY_Localization::lmsg('uninstall'),$first_class."ww-button--attention"),'cmd' => $cmd];
196 189 }
197 190 }