function main_disks_discover() { $users = new usersMenus(); $Disks = $users->disks_size; $page = CurrentPageName(); $sock = new sockets(); $dd = new harddrive(); $ArticaDBPath = $sock->GET_INFO("ArticaDBPath"); if ($ArticaDBPath == null) { $ArticaDBPath = "/opt/articatech"; } $arrayDisks = $dd->getDiskList(); $html = "<tr>"; if (is_array($arrayDisks)) { $count = 0; $tr = null; while (list($disk, $ARRAY_FINAL) = each($arrayDisks)) { $content = null; $path = $ARRAY_FINAL["MOUNTED"]; if ($path == "/boot") { continue; } if ($path == "{$ArticaDBPath}") { continue; } if ($path == "/usr/share/artica-postfix") { continue; } if (isset($already[$path])) { continue; } if ($path == null) { continue; } $already[$path] = true; $size = $ARRAY_FINAL["SIZE"]; $label = $ARRAY_FINAL["LABEL"]; if ($size == null) { continue; } $pourc = $ARRAY_FINAL["POURC"]; $js = "Loadjs('SambaBrowse.php?jdisk={$disk}&mounted={$path}&t={$_GET["t"]}&homeDirectory={$_GET["homeDirectory"]}&no-shares={$_GET["no-shares"]}&field={$_GET["field"]}&protocol={$_GET["protocol"]}&no-hidden={$_GET["no-hidden"]}&functionAfter={$_GET["functionAfter"]}')"; $disk_name = $disk; if (preg_match("#mapper\\/.+?\\-(.+)#", $disk_name, $re)) { $disk_name = $re[1]; } if (preg_match("#([0-9]+)\\s+MB#", $size, $re)) { $size = $size * 1000; $size = FormatBytes($size); $size = str_replace(" ", " ", $size); } $dirname = basename($path); $bandwith_color = "#5DD13D"; if ($pourc > 70) { $bandwith_color = "#F59C44"; } if ($pourc > 95) { $bandwith_color = "#D32D2D"; } $count = $count + 1; if ($count == 2) { $tr = "</tr><tr>"; $count = 0; } else { $tr = null; } $content = "({$size} - {$pourc}% {used})<br><strong>{$path}</strong><br><strong>{$label}</strong>\n\t\t\t\t\t<br><div style='margin-top:-10px'>" . pourcentage_basic($pourc, $bandwith_color, $size) . "</div>"; $FINALDISKS[] = Paragraphe32("noacco:{$disk_name}", "{$content}", $js, "48-hd.png"); } } if (is_array($added_disks_array)) { while (list($disk, $path) = each($added_disks_array)) { $js = "Loadjs('SambaBrowse.php?jdisk={$disk}&mounted={$path}&t={$_GET["t"]}&homeDirectory={$_GET["homeDirectory"]}&no-shares={$_GET["no-shares"]}&field={$_GET["field"]}&protocol={$_GET["protocol"]}&no-hidden={&functionAfter={$_GET["functionAfter"]}}')"; $delete = imgtootltip("ed_delete.gif", "{delete} {$disk}...", "DeleteHiddenDisk('{$disk}')"); $FINALDISKS[] = Paragraphe32("noacco:{$disk}", "{$disk}<br>", $js, "48-hd.png", 220); } } if ($_GET["field"] != null) { $js = "Loadjs('autofs.wizard.php?field={$_GET["field"]}')"; $FINALDISKS[] = Paragraphe32("remote_connection", "remote_connection_wizard_text", $js, "folder-granted-properties-48.png", 220); } $finalfinal = CompileTr3($FINALDISKS); $add_disk = Paragraphe("64-hd-plus.png", "{invisible_disk}", "{add_invisible_disk_text}", "javascript:Loadjs('{$page}?hidden-add=yes')"); $html = "\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td style='width:100%'><div style='font-size:18px'>{select_disk}</div></td>\n\t\t<td>\n\t<table style='width:5%'>\n\t<tr>\n\t\t<td width=1%>" . imgtootltip("32-hd-plus.png", "{add_invisible_disk_text}", "Loadjs('{$page}?hidden-add=yes')") . "</td>\n\t\t<td width=99% nowrap><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('{$page}?hidden-add=yes')\" style='font-size:14px;text-decoration:underline'>{invisible_disk}</a></td>\n\t</tr>\n\t</table>\n\t</td>\n\t</tr>\n\t</table>\n{$finalfinal}\n\t\n\t\n\t"; $tpl = new templates(); return $tpl->_ENGINE_parse_body($html, 'fileshares.index.php'); }
function main_disks_discover() { $users = new usersMenus(); $Disks = $users->disks_size; $page = CurrentPageName(); $sock = new sockets(); $dd = new harddrive(); $arrayDisks = $dd->getDiskList(); $html = "<tr>"; if (is_array($arrayDisks)) { $count = 0; $tr = null; while (list($disk, $ARRAY_FINAL) = each($arrayDisks)) { $path = $ARRAY_FINAL["MOUNTED"]; if (isset($already[$path])) { continue; } if ($path == null) { continue; } $already[$path] = true; $size = $ARRAY_FINAL["SIZE"]; if ($size == null) { continue; } $pourc = $ARRAY_FINAL["POURC"]; $js = "Loadjs('SambaBrowse.php?jdisk={$disk}&mounted={$path}&t={$_GET["t"]}&homeDirectory={$_GET["homeDirectory"]}&no-shares={$_GET["no-shares"]}&field={$_GET["field"]}&protocol={$_GET["protocol"]}&no-hidden={$_GET["no-hidden"]}')"; $disk_name = $disk; if (preg_match("#mapper\\/.+?\\-(.+)#", $disk_name, $re)) { $disk_name = $re[1]; } $count = $count + 1; if ($count == 2) { $tr = "</tr><tr>"; $count = 0; } else { $tr = null; } $html = $html . "\n\t\t\t\t\t{$tr}\n\t\t\t\t\t<td width=50% valign='top'>" . Paragraphe32("noacco:{$disk_name}", "({$size} - {$pourc}% {used})", $js, "48-hd.png") . "</td>\n\t\t\t\t\t"; } } if (is_array($added_disks_array)) { while (list($disk, $path) = each($added_disks_array)) { $js = "Loadjs('SambaBrowse.php?jdisk={$disk}&mounted={$path}&t={$_GET["t"]}&homeDirectory={$_GET["homeDirectory"]}&no-shares={$_GET["no-shares"]}&field={$_GET["field"]}&protocol={$_GET["protocol"]}&no-hidden={$_GET["no-hidden"]}')"; $delete = imgtootltip("ed_delete.gif", "{delete} {$disk}...", "DeleteHiddenDisk('{$disk}')"); $count = $count + 1; if ($count == 2) { $tr = "</tr><tr>"; $count = 0; } else { $tr = null; } $html = $html . "\n\t\t\t\t\t{$tr}\n\t\t\t\t\t<td width=50% valign='top'>\n\t\t\t\t\t\t<table style='width:150px'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td align='right' valign='top' width=1%>{$delete}</td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t" . Paragraphe32("noacco:{$disk}", "{$disk}<br>", $js, "48-hd.png", 150) . "</td>\n\t\t\t\t\t\t\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t\t</td>"; } } $add_disk = Paragraphe("64-hd-plus.png", "{invisible_disk}", "{add_invisible_disk_text}", "javascript:Loadjs('{$page}?hidden-add=yes')"); $html = "<div style='font-size:15px'>{select_disk}</div><br>\n\t<table style='width:100%'>\n\t<tr>\n\t<td valign='top'>\n\t\t<table style='width:100%'>\n\t\t\t\t{$html}\n\t\t\t</tr>\n\t\t</table>\n\t</td>\n\t<td valign='top'>{$add_disk}\n\t</td>\n\t</tr>\n\t</table>\n\t\n\t"; $tpl = new templates(); return $tpl->_ENGINE_parse_body($html, 'fileshares.index.php'); }
function browseFolder() { $root = base64_decode($_GET["startpath"]); writelogs("Checking: {$root} \"{$_GET["root"]}\"", __FUNCTION__, __FILE__, __LINE__); $tpl = new templates(); $used = $tpl->javascript_parse_text("{used}"); $f[] = "["; if ($root == "disks" && $_GET["root"] == "source") { $harddrive = new harddrive(); $disks = $harddrive->getDiskList(); while (list($disk, $ARRAY_FINAL) = each($disks)) { $acc = array(); if (Folders_interdis($ARRAY_FINAL["MOUNTED"])) { continue; } $path = base64_encode($ARRAY_FINAL["MOUNTED"]); $size = $ARRAY_FINAL["SIZE"]; $pourc = $ARRAY_FINAL["POURC"]; $pathencurl = urlencode($path); $acc[] = "{"; $acc[] = "\t\"text\": \"{$disk} {$size} {$pourc}% {$used}\","; $acc[] = "\t\"classes\": \"disk\","; $acc[] = "\t\"id\": \"{$path}\","; $acc[] = "\t\"click\": \"BrowserExpand('{$pathencurl}')\","; $acc[] = "\t\"hasChildren\": true"; $acc[] = "}"; $accolades[] = @implode("\n", $acc); } $f[] = @implode(",", $accolades); $f[] = "]"; echo @implode("\n", $f); return; } if ($_GET["root"] == "source") { $_GET["root"] = base64_encode($root); } $sock = new sockets(); $_GET["root"] = base64_decode($_GET["root"]); $_GET["root"] = str_replace("//", "/", $_GET["root"]); $mount_point = $_GET["root"]; writelogs("Checking: \"{$_GET["root"]}\"", __FUNCTION__, __FILE__, __LINE__); $start_root = urlencode($_GET["root"]); $datas = unserialize(base64_decode($sock->getFrameWork("cmd.php?dirdirEncoded={$start_root}"))); if (is_array($datas)) { ksort($datas); while (list($num, $val) = each($datas)) { if (Folders_interdis($num)) { continue; } $num = basename($num); $path = "{$mount_point}/{$num}"; $path = str_replace("//", "/", $path); $pathenc = base64_encode($path); $pathencurl = urlencode($pathenc); $acc = array(); $acc[] = "{"; $acc[] = "\t\"text\": \"{$num}\","; $acc[] = "\t\"classes\": \"folder\","; $acc[] = "\t\"id\": \"{$pathenc}\","; $acc[] = "\t\"hasChildren\": true,"; $acc[] = "\t\"click\": \"BrowserExpand('{$pathencurl}')\""; $acc[] = "}"; $accolades[] = @implode("\n", $acc); } $f[] = @implode(",", $accolades); $f[] = "]"; echo @implode("\n", $f); return; } else { writelogs("Checking: dirdir={$start_root} not an array", __FUNCTION__, __FILE__, __LINE__); } echo "[]"; }