unset($_REQUEST['form']); unset($_REQUEST['applicationid']); } } else { if ($_REQUEST['go'] == 'delete') { /* group operations */ $go_result = true; $applications = get_request('applications', array()); DBstart(); $sql = 'SELECT a.applicationid, a.name, a.hostid ' . ' FROM applications a' . ' WHERE ' . DBin_node('a.applicationid') . ' AND ' . DBcondition('a.applicationid', $applications); $db_applications = DBselect($sql); while ($db_app = DBfetch($db_applications)) { if (!isset($applications[$db_app['applicationid']])) { continue; } $go_result &= (bool) CApplication::delete($db_app['applicationid']); if ($go_result) { $host = get_host_by_hostid($db_app['hostid']); add_audit(AUDIT_ACTION_DELETE, AUDIT_RESOURCE_APPLICATION, 'Application [' . $db_app['name'] . '] from host [' . $host['host'] . ']'); } } $go_result = DBend($go_result); show_messages($go_result, S_APPLICATION_DELETED, S_CANNOT_DELETE_APPLICATION); } else { if (str_in_array($_REQUEST['go'], array('activate', 'disable'))) { /* group operations */ $go_result = true; $applications = get_request('applications', array()); DBstart(); foreach ($applications as $id => $appid) { $sql = 'SELECT ia.itemid,i.hostid,i.key_' . ' FROM items_applications ia ' . ' LEFT JOIN items i ON ia.itemid=i.itemid ' . ' WHERE ia.applicationid=' . $appid . ' AND i.hostid=' . $_REQUEST['hostid'] . ' AND i.type<>9' . ' AND ' . DBin_node('ia.applicationid');