コード例 #1
0
             $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);
         }
         echo "<td><div><i class='glyphicon glyphicon-cd hdd'></i><span style='margin:4px;'></span>{$devname}</div></td>";
         if ($mounted) {
             echo "<td><i class='glyphicon glyphicon-save hdd'></i><span style='margin:4px;'><a title='Browse Iso File Share.' href='/Shares/Browse?dir={$mount[mountpoint]}'>{$mount[mountpoint]}</a></td>";
         } else {
             $mount_point = basename($mount[mountpoint]);
コード例 #2
0
ファイル: lib.php プロジェクト: dlandon/unassigned.devices
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']);
        }
    }
}