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); }
function SambaInfos($path, $elements) { $path = utf8_encode($path); if (!is_object($GLOBALS["USERMENUS"])) { $users = new usersMenus(); $GLOBALS["USERMENUS"] = $users; } else { $users = $GLOBALS["USERMENUS"]; } if (!is_object($GLOBALS["SMBCLASS"])) { $smb = new samba(); $GLOBALS["SMBCLASS"] = $smb; } else { $smb = $GLOBALS["SMBCLASS"]; } if (substr($path, strlen($path) - 1, 1) == '/') { $path = substr($path, 0, strlen($path) - 1); } include_once "/usr/share/artica-postfix/framework/class.unix.inc"; $unix = new unix(); $sock = new sockets(); $ShareProperties_grey = "<img src='img/folder-granted-properties-48-grey.png'>"; $nfs_grey = "<img src='img/folder-granted-add-48-nfs-grey.png'>"; $share_rsync_properties_grey = "<img src='img/folder-granted-properties-rsync-48-grey.png'>"; $backup_grey = "<img src='img/48-backup-grey.png'>"; $acls_grey = "<img src='img/folder-acls-48-grey.png'>"; $ShareProperties = $ShareProperties_grey; $nfs = $nfs_grey; $share_rsync_properties = $share_rsync_properties_grey; $backup = $backup_grey; $acls = $acls_grey; $q = new mysql(); $path_encoded = base64_encode($path); $sql = "SELECT COUNT(ID) AS tcount FROM backup_schedules"; $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); $schedules_number = $ligne["tcount"]; if ($users->GLUSTER_INSTALLED) { $path_md5 = md5($path); $cluster = imgtootltip('48-cluster.png', '{path_in_cluster}', "Loadjs('gluster.path.php?path={$path_encoded}')"); if (isclustered($path_md5)) { $cluster = imgtootltip('48-delete-cluster.png', '{remove_path_in_cluster}', "Loadjs('gluster.path.php?del-path={$path_encoded}')"); } } if ($users->NFS_SERVER_INSTALLED) { $nfs = imgtootltip('folder-granted-add-48-nfs.png', '{share_this_NFS}', "NFSShare2('{$path}')"); } if ($users->SAMBA_INSTALLED) { $shareit = imgtootltip('folder-granted-add-48.png', '{share_this}', "CFSShare('{$path}')"); if ($smb->main_shared_folders[$path] != null) { $path_to_js = urlencode($smb->main_shared_folders[$path]); $txt = "<div style='padding:2px;margin:5px;border:1px solid #CCCCCC'>{FOLDER_IS_SHARED}</div>"; $removeShare = imgtootltip('folder-granted-remove-48.png', '{delete_share}', "CFSUnShare('{$path_to_js}','{$path}')"); $ShareProperties = imgtootltip('folder-granted-properties-48.png', '{privileges_settings}', "FolderProp('{$path_to_js}')"); $shareit = $removeShare; } } if ($sock->GET_INFO("RsyncDaemonEnable") == 1) { $share_rsync = imgtootltip('folder-granted-add-rsync-48.png', '{share_this_rsync}', "RsyncShare('{$path}')"); include_once dirname(__FILE__) . "/ressources/class.rsync.inc"; $rsync = new rsyncd_conf(); if (is_array($rsync->main_array["{$path}"])) { $share_rsync = imgtootltip('folder-granted-remove-rsync-48.png', '{unshare_this_rsync}', "UnshareRsync('{$path}')"); $share_rsync_properties = imgtootltip('folder-granted-properties-rsync-48.png', '{share_this_rsync}', "RsyncShare('{$path}')"); } } if ($schedules_number > 0) { $backup = imgtootltip('48-backup.png', '{backup_this_directory}', "Loadjs('backup.tasks.php?FOLDER_BACKUP={$path_encoded}')"); } $id = md5($id); $parent = str_replace("/" . basename($path), "", $path); $parent_id = md5($parent); $addfolder = imgtootltip('folder-48-add.png', '{add_sub_folder}', "CreateSubFolder('{$path}')"); $delfolder = imgtootltip('folder-delete-48.png', '{del_sub_folder}', "DeleteSubFolder('{$path}','{$parent}','{$parent_id}')"); $folder_refresh = imgtootltip('folder-refresh-48.png', '{refresh}', "RefreshFolder('{$path}','{$id}')"); $acls = imgtootltip('folder-acls-48.png', '{acls_directory}', "Loadjs('samba.acls.php?path={$path_encoded}')"); $upload = imgtootltip('folder-upload-48.png', '{upload_a_file}', "FileUpload('{$path_encoded}')"); $auditd_grey = imgtootltip('folder-watch-48-grey.png', '{audit_this_directory}', "Loadjs('audit.directory.php?path={$path_encoded}&id={$id}')"); $deduplication_grey = imgtootltip('folder-dedup-48-add-grey.png', '{mount_has_deduplication_folder}'); $deduplication_js = "Loadjs('system.file.deduplication.php?tree-path={$path_encoded}&id={$id}')"; if ($users->APP_AUDITD_INSTALLED) { $img = "folder-watch-48-add.png"; $au = new auditd(); if ($au->KeyAudited($path) != null) { $img = "folder-watch-48-del.png"; } $auditd = imgtootltip($img, '{audit_this_directory}', "Loadjs('audit.directory.php?path={$path_encoded}&id={$id}')"); } else { $auditd = $auditd_grey; } if ($unix->IsProtectedDirectory($path)) { $delfolder = imgtootltip('folder-delete-48-grey.png', '{del_sub_folder}', ""); $addfolder = imgtootltip('folder-48-add-grey.png', '{add_sub_folder}', ""); $acls = $acls_grey; $auditd = $auditd_grey; } if ($GLOBALS["USERMENUS"]->deduplication_installed) { $mounted = unserialize(base64_decode($sock->getFrameWork("cmd.php?lessfs-mounts=yes"))); $deduplication = imgtootltip('folder-dedup-48-add.png', '{mount_has_deduplication_folder}', $deduplication_js); if ($mounted[$path]) { $delfolder = imgtootltip('folder-delete-48-grey.png', '{del_sub_folder}', ""); $deduplication = $deduplication_grey; } } if ($elements > 0) { $deduplication = $deduplication_grey; } if ($users->IfIsAnuser()) { $removeShare = null; $ShareProperties = $ShareProperties_grey; $shareit = null; $nfs = $nfs_grey; $acls = $acls_grey; $auditd = $auditd_grey; $deduplication = $deduplication_grey; $share_rsync = null; $share_rsync_properties = $share_rsync_properties_grey; $cluster = null; $ct = new user($_SESSION["uid"]); if ($ct->homeDirectory == $path) { $delfolder = imgtootltip('folder-delete-48-grey.png', '{del_sub_folder}', ""); } } if ($backup == null) { $backup = $acls; $acls = " "; } if ($_GET["select-file"] != null) { $removeShare = null; $ShareProperties = $ShareProperties_grey; $shareit = null; $nfs = $nfs_grey; $acls = $acls_grey; $share_rsync = null; $share_rsync_properties = $share_rsync_properties_grey; $backup = $upload; $addfolder = null; $delfolder = null; $cluster = null; $auditd = null; $deduplication = null; } $tr[] = $addfolder; $tr[] = $delfolder; $tr[] = $backup; $tr[] = $folder_refresh; $tr[] = $shareit; $tr[] = $ShareProperties; $tr[] = $nfs; $tr[] = $acls; $tr[] = $share_rsync; $tr[] = $share_rsync_properties; $tr[] = $auditd; $tr[] = $cluster; $tr[] = $deduplication; $tables[] = "<table style='width:130px'><tr>"; $t = 0; while (list($key, $line) = each($tr)) { $line = trim($line); if ($line == null) { continue; } $t = $t + 1; $tables[] = "<td valign='top'>{$line}</td>"; if ($t == 2) { $t = 0; $tables[] = "</tr><tr>"; } } if ($t < 2) { for ($i = 0; $i <= $t; $i++) { $tables[] = "<td valign='top'> </td>"; } } $html = $txt . implode("\n", $tables) . "</table>\n<input type='hidden' id='RefreshSambaTreeFolderHidden_path' value='{$path}'>\n<input type='hidden' id='RefreshSambaTreeFolderHidden_id' value='{$id}'>\n"; $tpl = new templates(); return $tpl->_ENGINE_parse_body($html, "samba.index.php"); }