$protocol = $mount['protocol'] == "NFS" ? "nfs" : "smb";
         printf("<td><img src='/webGui/images/%s'>%s</td>", $is_alive ? "green-on.png" : "green-blink.png", $protocol);
         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 title='Browse Remote SMB/NFS Share.' href='/Shares/Browse?dir={$mount[mountpoint]}'>{$mount[mountpoint]}</a></td>";
         } else {
             $mount_point = basename($mount[mountpoint]);
             echo "<td><form title='Click to change Remote SMB/NFS Mount Point.' method='POST' action='/plugins/{$plugin}/UnassignedDevices.php?action=change_samba_mountpoint&device={$mount[device]}' target='progressFrame' style='display:inline;margin:0;padding:0;'>\n\t\t\t\t\t<i class='glyphicon glyphicon-save hdd'></i><span style='margin:4px;'></span><span class='text exec'><a>{$mount[mountpoint]}</a></span>\n\t\t\t\t\t<input class='input' type='text' name='mountpoint' value='{$mount_point}' hidden />\n\t\t\t\t\t</form></td>";
         }
         echo "<td><span style='width:auto;text-align:right;'>" . ($mounted ? "<button type='button' style='padding:2px 7px 2px 7px;' onclick=\"disk_op(this, 'umount','{$mount[device]}');\"><i class='glyphicon glyphicon-export'></i> Unmount</button>" : "<button type='button' style='padding:2px 7px 2px 7px;' onclick=\"disk_op(this, 'mount','{$mount[device]}');\"><i class='glyphicon glyphicon-import'></i>  Mount</button>") . "</span></td>";
         echo $mounted ? "<td><i class='glyphicon glyphicon-remove hdd'></i></td>" : "<td><a class='exec' style='color:#CC0000;font-weight:bold;' onclick='remove_samba_config(\"{$mount[device]}\");' title='Remove Remote SMB/NFS Share.'> <i class='glyphicon glyphicon-remove hdd'></i></a></td>";
         echo "<td><span>" . my_scale($mount['size'], $unit) . " {$unit}</span></td>";
         echo render_used_and_free($mount);
         echo "<td title='Turn on to Mount Device when Array is Started.'><input type='checkbox' class='samba_automount' device='{$mount[device]}' " . ($mount['automount'] ? 'checked' : '') . "></td>";
         echo "<td><a title='View SMB/NFS Share Log.' href='/Main/ViewLog?d=" . urlencode($mount['device']) . "&l=" . urlencode(basename($mount['mountpoint'])) . "'><img src='/plugins/{$plugin}/icons/view_log.png' style='cursor:pointer;width:16px;'></a></td>";
         echo "<td><a title='Edit Remote SMB/NFS Share Script.' href='/Main/EditScript?d=" . urlencode($mount['device']) . "&l=" . urlencode(basename($mount['mountpoint'])) . "'><img src='/plugins/{$plugin}/icons/edit_script.png' style='cursor:pointer;width:16px;" . (get_samba_config($mount['device'], "command_bg") == "true" ? "" : "opacity: 0.4;") . "'></a></td>";
         echo "</tr>";
         $odd = $odd == "odd" ? "even" : "odd";
     }
 }
 # Iso file Mounts
 $iso_mounts = get_iso_mounts();
 if (count($iso_mounts)) {
     foreach ($iso_mounts as $mount) {
         $mounted = is_mounted($mount['device']);
         $is_alive = is_file($mount['file']);
         echo "<tr class='{$odd}'>";
         printf("<td><img src='/webGui/images/%s'>iso</td>", $is_alive ? "green-on.png" : "green-blink.png");
         $devname = $mount['device'];
         if (strlen($devname) > 50) {
             $devname = substr($devname, 0, 10) . "<strong>...</strong>" . basename($devname);
     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 {
             echo "<td><form method='POST' action='/plugins/{$plugin}/UnassignedDevices.php?action=change_samba_mountpoint&device={$mount[device]}' target='progressFrame' style='display:inline;margin:0;padding:0;'>\n          <i class='glyphicon glyphicon-save hdd'></i><span style='margin:4px;'></span><span class='text exec'><a>{$mount[mountpoint]}</a></span>\n          <input class='input' type='text' name='mountpoint' value='{$mount[mountpoint]}' hidden />\n          </form></td>";
         }
         echo "<td><span style='width:auto;text-align:right;'>" . ($mounted ? "<button type='button' style='padding:2px 7px 2px 7px;' onclick=\"usb_mount('/usr/local/sbin/unassigned_umount {$mount[device]}');\"><i class='glyphicon glyphicon-export'></i> Unmount</button>" : "<button type='button' style='padding:2px 7px 2px 7px;' onclick=\"usb_mount('/usr/local/sbin/unassigned_mount {$mount[device]}');\"><i class='glyphicon glyphicon-import'></i>  Mount</button>") . "</span></td>";
         echo "<td><span>" . my_scale($mount['size'], $unit) . " {$unit}</span></td>";
         echo render_used_and_free($mount);
         echo "<td><input type='checkbox' class='samba_automount' device='{$mount[device]}' " . ($mount['automount'] ? 'checked' : '') . "></td>";
         echo "<td><a href='/Main/EditScript?d=" . urlencode($mount['device']) . "&l=" . urlencode(basename($mount['mountpoint'])) . "'><img src='/webGui/images/default.png' style='cursor:pointer;width:16px;" . (get_samba_config($mount['device'], "command") ? "" : "opacity: 0.4;") . "'></a></td>";
         echo $mounted ? "<td><i class='glyphicon glyphicon-remove hdd'></i></td>" : "<td><a class='exec' style='color:#CC0000;font-weight:bold;' onclick='remove_samba_config(\"{$mount[device]}\");' title='Remove SMB mount'> <i class='glyphicon glyphicon-remove hdd'></i></a></td></tr>";
         $odd = $odd == "odd" ? "even" : "odd";
     }
 } else {
     echo "<tr><td colspan='12' style='text-align:center;font-weight:bold;'>No SMB mounts configured.</td></tr>";
 }
 echo "</tbody></table><button type='button' onclick='add_samba();'>Add SMB mount</button></div>";
 endSAMBA:
 $config_file = $GLOBALS["paths"]["config_file"];
 $config = is_file($config_file) ? @parse_ini_file($config_file, true) : array();
 $disks_serials = array();
 foreach ($disks as $disk) {
     $disks_serials[] = $disk['partitions'][0]['serial'];
 }
 $ct = "";
Exemplo n.º 3
0
function is_samba_automount($sn)
{
    $auto = get_samba_config($sn, "automount");
    return $auto ? $auto == "yes" ? TRUE : FALSE : TRUE;
}