foreach ($disk['partitions'] as $partition) { foreach (render_partition($disk, $partition) as $l) { echo str_replace("__SHOW__", count($disk['partitions']) > 1 ? "display:none;" : "display:none;", $l); } } } $odd = $odd == "odd" ? "even" : "odd"; } } else { echo "<tr><td colspan='12' style='text-align:center;font-weight:bold;'>No unassigned disks available.</td></tr>"; } echo "</tbody></table>"; # SAMBA // goto endSAMBA; // $echo(get_samba_mounts()); $samba_mounts = get_samba_mounts(); echo "<div id='smb_tab' class='show-complete'>"; echo "<div id='title'><span class='left'><img src='/plugins/dynamix/icons/smbsettings.png' class='icon'>SMB Mounts</span></div>"; echo "<table class='samba_mounts custom_head'><thead><tr><td>Device</td><td>Source</td><td>Mount point</td><td></TD><td>Size</td><td>Used</td><td>Free</td><td>Auto mount</td><td>Script</td><td>Remove</td></tr></thead>"; echo "<tbody>"; if (count($samba_mounts)) { $odd = "odd"; foreach ($samba_mounts as $mount) { $mounted = is_mounted($mount['device']); $is_alive = trim(exec("ping -c 1 -W 1 {$mount[ip]} >/dev/null 2>&1; echo \$?")) == 0 ? TRUE : FALSE; echo "<tr class='{$odd}'>"; printf("<td><img src='/webGui/images/%s'> smb</td>", $is_alive ? "green-on.png" : "green-blink.png"); echo "<td><div><i class='glyphicon glyphicon-globe hdd'></i><span style='margin:4px;'></span>{$mount[device]}</div></td>"; if ($mounted) { echo "<td><i class='glyphicon glyphicon-save hdd'></i><span style='margin:4px;'><a href='/Shares/Browse?dir={$mount[mountpoint]}' target='_blank'>{$mount[mountpoint]}</a></td>"; } else {
function reload_shares() { // Disk mounts foreach (get_unasigned_disks() as $name => $disk) { foreach ($disk['partitions'] as $p) { if (is_mounted(realpath($p), true)) { $info = get_partition_info($p); $attrs = isset($_ENV['DEVTYPE']) ? get_udev_info($device, $_ENV, $reload) : get_udev_info($device, NULL, $reload); if (config_shared($info['serial'], $info['part'], strpos($attrs['DEVPATH'], "usb"))) { unassigned_log("Reloading shared dir '{$info[target]}'."); unassigned_log("Removing old config..."); rm_smb_share($info['target'], $info['label']); rm_nfs_share($info['target']); unassigned_log("Adding new config..."); add_smb_share($info['mountpoint'], $info['label']); add_nfs_share($info['mountpoint']); } } } } // SMB Mounts foreach (get_samba_mounts() as $name => $info) { if (is_mounted($info['device'])) { unassigned_log("Reloading shared dir '{$info[mountpoint]}'."); unassigned_log("Removing old config..."); rm_smb_share($info['mountpoint'], $info['device']); add_smb_share($info['mountpoint'], $info['device']); } } // Iso File Mounts foreach (get_iso_mounts() as $name => $info) { if (is_mounted($info['device'])) { unassigned_log("Reloading shared dir '{$info[mountpoint]}'."); unassigned_log("Removing old config..."); rm_smb_share($info['mountpoint'], $info['device']); rm_nfs_share($info['mountpoint']); add_smb_share($info['mountpoint'], $info['device']); add_nfs_share($info['mountpoint']); } } }