| @@ -135,11 +135,9 @@ | ||
| 135 | 135 | $config_id = $cfg['id']; |
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - if ($is_active === false) { | |
| 140 | - wtsec_app()->set($service . '_connected_' . $id, true); | |
| 141 | - } | |
| 139 | + | |
| 142 | 140 | return ['active' => $is_active, 'config_id' => $config_id]; |
| 143 | 141 | } |
| 144 | 142 | |
| 145 | 143 | function wtsec_generateFile($id, $service) |
| @@ -210,8 +208,68 @@ | ||
| 210 | 208 | return false; |
| 211 | 209 | } |
| 212 | 210 | } |
| 213 | 211 | |
| 212 | + | |
| 213 | +function wtsec_AVLogsData($logs){ | |
| 214 | + foreach ($logs as $key => $log){ | |
| 215 | + $log = $log['node']; | |
| 216 | + $log['filePath'] = urldecode($log['filePath']); | |
| 217 | + $log['text'] = (strlen($log['filePath']) > 40) ? substr($log['filePath'],0,40).'...' : $log['filePath']; | |
| 218 | + $log['time'] = convertToCurrentTime($log['time']); | |
| 219 | + $log['class_path'] = ''; | |
| 220 | + $log['class_info'] = ''; | |
| 221 | + | |
| 222 | + if ($log['event'] === 'modified') { | |
| 223 | + $log['info'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.info.normal"); | |
| 224 | + $log['class_path'] = "wtotem_file-table__td_changed"; | |
| 225 | + $log['class_info'] = "wtotem_file-table__td_normal"; | |
| 226 | + $log['description'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.status.changed"); | |
| 227 | + } elseif ($log['event'] === 'quarantine') { | |
| 228 | + $log['info'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.info.backdoor_virus"); | |
| 229 | + $log['class_path'] = "wtotem_file-table__td_changed"; | |
| 230 | + $log['class_info'] = "wtotem_file-table__td_normal"; | |
| 231 | + $log['description'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.status.quarantine"); | |
| 232 | + } elseif ($log['event'] === 'infected') { | |
| 233 | + $log['info'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.info.backdoor_virus"); | |
| 234 | + $log['class_path'] = "wtotem_file-table__td_critical"; | |
| 235 | + $log['class_info'] = "wtotem_file-table__td_critical"; | |
| 236 | + $log['description'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.status.infected"); | |
| 237 | + } elseif ($log['event'] === 'deleted') { | |
| 238 | + $log['info'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.info.deleted"); | |
| 239 | + $log['description'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.status.deleted"); | |
| 240 | + }elseif ($log['event'] === 'new'){ | |
| 241 | + $log['info'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.info.normal"); | |
| 242 | + $log['description'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.status.new"); | |
| 243 | + }elseif ($log['event'] === 'scanned'){ | |
| 244 | + $log['info'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.info.normal"); | |
| 245 | + $log['description'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.status.scanned"); | |
| 246 | + }else{ | |
| 247 | + $log['info'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.status.error"); | |
| 248 | + $log['description'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.status.error"); | |
| 249 | + } | |
| 250 | + | |
| 251 | + $logs[$key]['node'] = $log; | |
| 252 | + } | |
| 253 | + return $logs; | |
| 254 | +} | |
| 255 | + | |
| 256 | +function wtsec_getConfigs($host_id) | |
| 257 | +{ | |
| 258 | + $config = WTSEC_LIBRARY_WT::getConfigs($host_id); | |
| 259 | + return wtsec_arrayIndex($config['data']['auth']['viewer']['sites']['one']['configs'], 'service'); | |
| 260 | +} | |
| 261 | + | |
| 262 | +function wtsec_arrayIndex($array, $key){ | |
| 263 | + $newArray = []; | |
| 264 | + foreach ($array as $item){ | |
| 265 | + if(array_key_exists($key,$item)){ | |
| 266 | + $newArray[$item[$key]] = $item; | |
| 267 | + } | |
| 268 | + } | |
| 269 | + return $newArray; | |
| 270 | +} | |
| 271 | + | |
| 214 | 272 | function wtsec_button($label = '', $class = '') |
| 215 | 273 | { |
| 216 | 274 | return '<button class="ww-button ' . $class . '">' . $label . '</button>'; |
| 217 | 275 | } |
| @@ -282,5 +340,14 @@ | ||
| 282 | 340 | |
| 283 | 341 | function wtsec_getInstalledFile($service) |
| 284 | 342 | { |
| 285 | 343 | return wtsec_app()->get($service . "_installed_file"); |
| 286 | -} | |
| 344 | +} | |
| 345 | + | |
| 346 | +function wtsec_DeleteAm(){ | |
| 347 | + $host = WTSEC_LIBRARY_WT::getOwnSite(); | |
| 348 | + if(!empty($host)) { | |
| 349 | + WTSEC_LIBRARY_WT::deleteAm($host['id']); | |
| 350 | + return true; | |
| 351 | + } | |
| 352 | + return false; | |
| 353 | +} | |