Esempio n. 1
0
function folder_delete()
{
    $path = base64_decode($_GET["folder-remove"]);
    $unix = new unix();
    if ($unix->IsProtectedDirectory($path)) {
        echo "<articadatascgi>" . base64_encode($path . " -> {failed} {protected}") . "</articadatascgi>";
        exit;
    }
    writelogs_framework("path={$path}", __FUNCTION__, __FILE__, __LINE__);
    shell_exec($unix->find_program("rm") . " -rf \"{$path}\"");
}
Esempio n. 2
0
function buildconf()
{
    $sock = new sockets();
    $unix = new unix();
    $SargOutputDir = $sock->GET_INFO("SargOutputDir");
    if ($SargOutputDir == null) {
        $SargOutputDir = "/var/www/html/squid-reports";
    }
    if ($unix->IsProtectedDirectory($SargOutputDir, true)) {
        $sock->SET_INFO("SargOutputDir", "/var/www/html/squid-reports");
        $SargOutputDir = "/var/www/html/squid-reports";
    }
    if (!is_file("/etc/artica-postfix/old_SargOutputDir")) {
        @file_put_contents("/etc/artica-postfix/old_SargOutputDir", $SargOutputDir);
    }
    if ($SargOutputDir == "/usr/share/artica-postfix/squid") {
        $SargOutputDir = "/var/www/html/squid-reports";
        $sock->SET_INFO("SargOutputDir", "/var/www/html/squid-reports");
    }
    if ($SargOutputDir != "/usr/share/artica-postfix/squid") {
        @mkdir("{$SargOutputDir}", 0755, true);
        if (is_dir("/usr/share/artica-postfix/squid")) {
            $cp = $unix->find_program("cp");
            $rm = $unix->find_program("rm");
            shell_exec("{$cp} -rf /usr/share/artica-postfix/squid/* \"{$SargOutputDir}/\"");
            shell_exec("{$rm} -rf \"/usr/share/artica-postfix/squid\"");
            @rmdir("/usr/share/artica-postfix/squid");
        }
    }
    $old_SargOutputDir = @file_get_contents("/etc/artica-postfix/old_SargOutputDir");
    if ($old_SargOutputDir != $SargOutputDir) {
        @mkdir("{$SargOutputDir}", 0755, true);
        if (is_dir($old_SargOutputDir)) {
            $cp = $unix->find_program("cp");
            $rm = $unix->find_program("rm");
            shell_exec("{$cp} -rf \"{$old_SargOutputDir}/*\" \"{$SargOutputDir}/\"");
            if (!$unix->IsProtectedDirectory($old_SargOutputDir, true)) {
                shell_exec("{$rm} -rf \"{$old_SargOutputDir}\"");
                @rmdir($old_SargOutputDir);
            }
            if (!is_dir($old_SargOutputDir)) {
                @file_put_contents("/etc/artica-postfix/old_SargOutputDir", $SargOutputDir);
            }
        } else {
            @file_put_contents("/etc/artica-postfix/old_SargOutputDir", $SargOutputDir);
        }
    }
    events("Output dir: {$SargOutputDir}");
    $SargConfig = unserialize(base64_decode($sock->GET_INFO("SargConfig")));
    $SargConfig = SargDefault($SargConfig);
    if ($SargConfig["lastlog"] == 0) {
        $SargConfig["lastlog"] = 90;
    }
    $SargConfig["lastlog"] * 24;
    $conf[] = "language {$SargConfig["language"]}";
    $conf[] = "graphs {$SargConfig["graphs"]}";
    $conf[] = "title \"{$SargConfig["title"]}\"";
    $conf[] = "topsites_num {$SargConfig["topsites_num"]}";
    $conf[] = "topuser_num {$SargConfig["topuser_num"]}";
    $conf[] = "report_type {$SargConfig["report_type"]}";
    $conf[] = "topsites_sort_order CONNECT {$SargConfig["topsites_sort_order"]}";
    $conf[] = "index_sort_order {$SargConfig["index_sort_order"]}";
    $conf[] = "resolve_ip {$SargConfig["resolve_ip"]}";
    $conf[] = "user_ip {$SargConfig["user_ip"]}";
    $conf[] = "exclude_hosts /etc/squid3/sarg.hosts";
    $conf[] = "date_format {$SargConfig["date_format"]}";
    $conf[] = "records_without_userid {$SargConfig["records_without_userid"]}";
    $conf[] = "long_url {$SargConfig["long_url"]}";
    $conf[] = "lastlog {$SargConfig["lastlog"]}";
    $conf[] = "index yes";
    $conf[] = "index_tree file";
    $conf[] = "overwrite_report yes";
    $conf[] = "mail_utility mail";
    $conf[] = "hostalias /etc/squid3/sarg-aliases";
    $conf[] = "exclude_codes /etc/squid3/sarg-exclude_codes";
    $conf[] = "temporary_dir /tmp";
    $conf[] = "date_time_by bytes";
    $conf[] = "show_sarg_info no";
    $conf[] = "show_sarg_logo no";
    $conf[] = "external_css_file /sarg.css";
    $conf[] = "ulimit none";
    $conf[] = "squid24 off";
    $conf[] = "output_dir {$SargOutputDir}";
    $conf[] = "logo_image /logo.gif";
    $conf[] = "image_size 160 58";
    $conf[] = "access_log /var/log/squid/access.log";
    $conf[] = "realtime_access_log_lines 5000";
    $conf[] = "graph_days_bytes_bar_color orange";
    $conf[] = "";
    add_defaults();
    $q = new mysql_squid_builder();
    $sql = "SELECT *  FROM sarg_aliases ORDER BY `pattern`";
    $results = $q->QUERY_SQL($sql);
    $a = array();
    while ($ligne = mysql_fetch_assoc($results)) {
        $zline = "{$ligne["pattern"]}";
        if ($ligne["group"] != null) {
            $zline = $zline . " {$ligne["group"]}";
        }
        if (trim($ligne["replace"] == null)) {
            $ligne["replace"] = str_replace("*.", "", $ligne["pattern"]);
            $zline = $zline . ": {$ligne["replace"]}";
        }
        $a[] = $zline;
    }
    file_put_contents("/etc/squid3/sarg-aliases", @implode("\n", $a));
    file_put_contents("/etc/squid3/sarg.conf", @implode("\n", $conf));
    file_put_contents("/etc/squid3/sarg-configured-1.8.012202.conf", @implode("\n", $conf));
    echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, sarg.conf done\n";
    events("/etc/squid3/sarg.conf done");
    $ips = array();
    $ips[] = "127.0.0.1";
    $excluescodes[] = "NONE/400";
    $excluescodes[] = "NONE/411";
    $excluescodes[] = "TCP_DENIED/407";
    $excluescodes[] = "TCP_DENIED/403";
    $excluescodes[] = "TCP_DENIED/400";
    $excluescodes[] = "TCP_DENIED/401";
    $excluescodes[] = "TCP_DENIED/411";
    $excluescodes[] = "TCP_MEM_HIT/200";
    $excluescodes[] = "TCP_MEM_HIT/302";
    $excluescodes[] = "TCP_REFRESH_HIT/200";
    $excluescodes[] = "TCP_REFRESH_HIT/304";
    $excluescodes[] = "TCP_NEGATIVE_HIT/404";
    $excluescodes[] = "TCP_IMS_HIT/304";
    $excluescodes[] = "TCP_IMS_HIT/200";
    $excluescodes[] = "TCP_HIT/200";
    $excluescodes[] = "TCP_HIT/302";
    @file_put_contents("/etc/squid3/sarg-exclude_codes", @implode("\n", $excluescodes));
    @file_put_contents("/etc/squid3/sarg.hosts", @implode("\n", $ips));
    echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, sarg.hosts done\n";
    // $sock=new sockets();$SargOutputDir=$sock->GET_INFO("SargOutputDir");if($SargOutputDir==null){$SargOutputDir="/usr/share/artica-postfix/squid";}
    $unix = new unix();
    $lighttpd_user = $unix->APACHE_SRC_ACCOUNT();
    $squidbin = $unix->LOCATE_SQUID_BIN();
    echo "Starting......: " . date("H:i:s") . " Apache user: {$lighttpd_user}\n";
    @chown("{$SargOutputDir}/sarg.css", $lighttpd_user);
    echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, sarg.css done\n";
    $nice = EXEC_NICE();
    $unix = new unix();
    $sarg_bin = $unix->find_program("sarg");
    $squidbin = $unix->find_program("squid");
    $nohup = $unix->find_program("nohup");
    $php5 = $unix->LOCATE_PHP5_BIN();
    if (!is_file($squidbin)) {
        $squidbin = $unix->find_program("squid3");
    }
    if (!is_file($sarg_bin)) {
        sarg_admin_events("Fatal, unable to locate sarg binary, aborting...", __FUNCTION__, __FILE__, __LINE__, "sarg");
        return;
    }
    unset($f);
    $f[] = "#!/bin/sh";
    $f[] = "export LC_ALL=C";
    $f[] = "{$nice} {$php5} " . __FILE__ . " --exec-daily >/dev/null 2>&1";
    $f[] = "";
    @file_put_contents("/etc/cron.daily/0sarg.sh", @implode("\n", $f));
    @chmod("/etc/cron.daily/0sarg.sh", 0755);
    events("cron.daily done");
    echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, cron cron.daily done\n";
    unset($f);
    $f[] = "#!/bin/sh";
    $f[] = "export LC_ALL=C";
    $f[] = "{$nice} {$php5} " . __FILE__ . " --exec-hourly >/dev/null 2>&1";
    $f[] = "";
    @file_put_contents("/etc/cron.hourly/0sarg.sh", @implode("\n", $f));
    echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, cron cron.hourly done\n";
    @chmod("/etc/cron.hourly/0sarg.sh", 0755);
    events("cron.hourly done");
    unset($f);
    $f[] = "#!/bin/sh";
    $f[] = "export LC_ALL=C";
    $f[] = "{$nice} {$php5} " . __FILE__ . " --exec-monthly >/dev/null 2>&1";
    $f[] = "";
    @file_put_contents("/etc/cron.monthly/0sarg.sh", @implode("\n", $f));
    echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, cron cron.monthly done\n";
    @chmod("/etc/cron.monthly/sarg.sh", 0755);
    events("cron.monthly done");
    unset($f);
    $f[] = "#!/bin/sh";
    $f[] = "export LC_ALL=C";
    $f[] = "{$nice} {$php5} " . __FILE__ . " --exec-weekly >/dev/null 2>&1";
    $f[] = "";
    @file_put_contents("/etc/cron.weekly/0sarg.sh", @implode("\n", $f));
    echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, cron cron.weekly done\n";
    @chmod("/etc/cron.weekly/0sarg.sh", 0755);
    events("cron.weekly done");
    unset($f);
    echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, " . __FUNCTION__ . " done\n";
}
Esempio n. 3
0
function folder_delete()
{
    $path = base64_decode($_GET["folder-remove"]);
    $path = utf8_encode($path);
    $unix = new unix();
    if ($_GET["emergency"] != "yes") {
        if ($unix->IsProtectedDirectory($path)) {
            echo "<articadatascgi>" . base64_encode($path . " -> {failed} {protected}") . "</articadatascgi>";
            exit;
        }
    }
    writelogs_framework("path={$path}", __FUNCTION__, __FILE__, __LINE__);
    if (!is_dir($path)) {
        writelogs_framework("{$path} no such directory", __FUNCTION__, __FILE__, __LINE__);
        return;
    }
    $cmd = $unix->find_program("rm") . " -rf \"{$path}\"";
    writelogs_framework("{$cmd}", __FUNCTION__, __FILE__, __LINE__);
    shell_exec($cmd);
}
Esempio n. 4
0
function delete_cache()
{
    $directory = base64_decode($_GET["delete-cache"]);
    if (trim($directory) == null) {
        return;
    }
    if (!is_dir($directory)) {
        return;
    }
    $unix = new unix();
    if ($unix->IsProtectedDirectory($directory, true)) {
        return;
    }
    $rm = $unix->find_program("rm");
    $nohup = $unix->find_program("nohup");
    shell_exec("{$nohup} {$rm} -rf \"{$directory}\" >/dev/null 2>&1 &");
}
Esempio n. 5
0
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 = "&nbsp;";
    }
    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'>&nbsp;</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");
}
Esempio n. 6
0
function SambaInfos($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);
    }
    $unix = new unix();
    $sock = new sockets();
    $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->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) {
            $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('{$smb->main_shared_folders[$path]}','{$path}')");
            $ShareProperties = imgtootltip('folder-granted-properties-48.png', '{privileges_settings}', "FolderProp('{$smb->main_shared_folders[$path]}')");
            $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}')");
    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 = null;
    }
    if ($users->IfIsAnuser()) {
        $removeShare = null;
        $ShareProperties = null;
        $shareit = null;
        $nfs = null;
        $acls = null;
        $share_rsync = null;
        $share_rsync_properties = 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 = "&nbsp;";
    }
    if ($_GET["select-file"] != null) {
        $removeShare = null;
        $ShareProperties = null;
        $shareit = null;
        $nfs = null;
        $acls = null;
        $share_rsync = null;
        $share_rsync_properties = null;
        $backup = $upload;
        $addfolder = null;
        $delfolder = null;
    }
    $html = "\n{$txt}\n<table style='width:130px'>\n\t\t<tr>\n\t\t\t<td width=1% valign='top'>{$addfolder}</td>\n\t\t\t<td width=1% valign='top'>{$delfolder}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td width=1% valign='top'>{$backup}</td>\n\t\t\t<td width=1% valign='top'>{$folder_refresh}</td>\n\t\t</tr>\n\t\t<tr>\t\n\t\t\t<td width=1% valign='top'>{$shareit}</td>\n\t\t\t<td width=1% valign='top'>{$ShareProperties}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>{$nfs}</td>\n\t\t\t<td width=1% valign='top'>{$acls}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td width=1% valign='top'>{$share_rsync}</td>\n\t\t\t<td width=1% valign='top'>{$share_rsync_properties}</td>\n\t\t</tr>\t\t\n\t</table>";
    $tpl = new templates();
    return $tpl->_ENGINE_parse_body($html, "samba.index.php");
}