function popup() { $path_decrypted = base64_decode($_GET["path"]); $path_text = $path_decrypted; $md = md5($path_decrypted); $key = auditd::KeyAudited($path_decrypted); if ($key != null) { $enabled = 1; if ($key != $md) { $path_text = auditd::GetPath($key); } } $enable = Paragraphe_switch_img("{enable_watch_this_directory}", "{auditd_explain}", "WatchDogThis", $enabled); $page = CurrentPageName(); $html = "\n\t\n\t<div style='margin:3px;font-weight:bold;text-align:right;padding:3px;border-bottom:1px solid #D61919'><code style='color:#D61919'>{path}:{$path_text}</code></div>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td valign='top' width=1% style='border-right:5px solid #CCCCCC'>\n\t\t\t<img src='img/folder-watch-128.png' id='audit-picture'>\n\t\t</td>\n\t\t<td valign='top' width=99% style='padding:8px'>\n\t\t{$enable}\n\t\t<div style='text-align:right'><hr>" . button("{apply}", "SaveAuditConfig()") . "</div>\n\t\t</tr>\n\t</table>\n<script>\n\t\tvar x_SaveAuditConfig=function (obj) {\n\t\t \ttext=obj.responseText;\n\t\t \t\n\t\t \tif(text.length>0){\n\t\t \t\talert(text);\n\t\t \t\tdocument.getElementById('audit-picture').src='img/folder-watch-128.png';\n\t\t \t\treturn;\n\t\t\t\t}\n\t\t\tRefreshFolder('{$path_decrypted}','{$_GET["id"]}');\n\t\t\tYahooWin4Hide();\n\t\t\t\n\t\t\t}\n\t\t\n\n\t\t\n\t\tfunction SaveAuditConfig(){\n\t\t\tdocument.getElementById('audit-picture').src='img/wait_verybig.gif';\n\t var XHR = new XHRConnection();\n\t XHR.appendData('path','{$_GET["path"]}');\n\t XHR.appendData('key','{$key}');\n\t XHR.appendData('WatchDogThis',document.getElementById('WatchDogThis').value);\n\t XHR.sendAndLoad('{$page}', 'GET',x_SaveAuditConfig);\n\t\t\t}\n</script>\n\t\n\t"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html); }
function events_list() { $tpl = new templates(); $q = new mysql(); $aud = new auditd(); $page = CurrentPageName(); if ($_GET["n"] == null) { $_GET["n"] = 0; } if ($_GET["n"] < 0) { $_GET["n"] = 0; } $limit = $_GET["n"] * 250; if ($_GET["f"] != null) { $filename_decoded = addslashes(base64_decode($_GET["f"])); $filename = " AND `file`='{$filename_decoded}'"; } if ($_GET["a"] != null) { $action = $_GET["a"]; $action_sql = " AND `syscall`='{$action}'"; } if ($_GET["search"] != null) { $search = str_replace("*", "%", $_GET["search"]); $filename = " AND `file` LIKE '{$search}'"; } $sql = "SELECT * FROM auditd_files WHERE `key_path`='{$_GET["key"]}' {$filename}{$action_sql} ORDER BY `time` DESC LIMIT {$limit},250"; $results = $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { echo "<H3>{$sql} {$q->mysql_error}</H3>"; return; } $path = basename($aud->GetPath($_GET["key"])); $html = "\n\t\n<strong style='margin-bottom:5px'><a href=\"javascript:LoadAjax('eventsAuditD','{$page}?events-list=yes&key={$_GET["key"]}');\">{$path}</a> » {$filename_decoded} | </strong>\t<hr>\n<input type='hidden' id='fileToSearch' value='{$_GET["f"]}'>\n<input type='hidden' id='ActionToSearch' value='{$_GET["a"]}'>\n\n<table cellspacing='0' cellpadding='0' border='0' class='tableView'>\n<thead class='thead'>\n\t<tr>\n\t<th>{time}</th>\n\t<th>{file}</th>\n\t<th> </th>\n\t<th>{action}</th>\n\t<th> </th>\n\t<th>{members}</th>\n\t\n\t</tr>\n</thead>"; while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { if ($classtr == "oddRow") { $classtr = null; } else { $classtr = "oddRow"; } $fu = base64_encode($ligne["file"]); $futext = basename($ligne["file"]); $time = str_replace(date('Y') . "-", "", $ligne["time"]); $html = $html . "\n\t\t<tr class={$classtr}>\n\t\t\t<td width=1% nowrap style='height:auto'>{$time}</td>\n\t\t\t<td width=99% style='height:auto'><strong>{$ligne["file"]}</td>\n\t\t\t<td width=1% nowrap style='height:auto'>" . imgtootltip("tree_loupe.gif", "{filter}:{filename}<hr>{$futext}<hr>", "AuditdByFile('{$fu}')") . "</td>\n\t\t\t<td width=1% align=center style='height:auto'><strong>{{$ligne["syscall"]}}</strong></td>\n\t\t\t<td width=1% nowrap style='height:auto'>" . imgtootltip("tree_loupe.gif", "{filter}:{action}<hr>{$ligne["syscall"]}<hr>", "AuditdByAction('{$ligne["syscall"]}')") . "</td>\n\t\t\t<td width=1% align=center style='height:auto'><strong>{$ligne["uid"]}:{$ligne["gid"]}</strong></td>\n\t\t</tr>\n\t\t"; } $html = $html . "</table>"; $next = $_GET["n"] + 1; $back = $_GET["n"] - 1; $button_next = button("{next}", "LoadAjax('eventsAuditD','{$page}?events-list=yes&key={$_GET["key"]}&f={$_GET["f"]}&n={$next}&search={$_GET["search"]}');"); $button_back = button("{back}", "LoadAjax('eventsAuditD','{$page}?events-list=yes&key={$_GET["key"]}&f={$_GET["f"]}&n={$back}&search={$_GET["search"]}');"); $html = $html . "<table style='width:100%'>\n<tr>\n\t<td align='left' width=50%>{$button_back}</td>\n\t<td align='right' width=50%>{$button_next}</td>\n</tr>\n</table>"; echo $tpl->_ENGINE_parse_body($html); }