示例#1
0
function print_table($dir, $list, $allow)
{
    // print table of files
    global $dir_up;
    if (!is_array($list)) {
        return;
    }
    if ($dir != "" || strstr($dir, _QUIXPLORER_PATH)) {
        echo "<tr class=\"row1\">\n\t  \t\t\t<td>&nbsp;</td>\n\t  \t\t\t<td valign=\"baseline\">\n\t  \t\t\t\t<a href=\"" . make_link("list", $dir_up, NULL) . "\">\n\t  \t\t\t\t<img border=\"0\" width=\"22\" height=\"22\" align=\"absmiddle\" src=\"" . _QUIXPLORER_URL . "/images/_up.png\" alt=\"" . $GLOBALS["messages"]["uplink"] . "\" title=\"" . $GLOBALS["messages"]["uplink"] . "\"/>&nbsp;&nbsp;..</a>\n\t  \t\t\t</td>\n\t  \t\t\t<td>&nbsp;</td>\n\t  \t\t\t<td>&nbsp;</td>\n\t  \t\t\t<td>&nbsp;</td>\n\t  \t\t\t<td>&nbsp;</td>\n\t  \t\t\t<td>&nbsp;</td>";
        if (extension_loaded("posix")) {
            echo "<td>&nbsp;</td>";
        }
        echo "</tr>";
    }
    $i = 0;
    $toggle = false;
    while (list($item, $info) = each($list)) {
        // link to dir / file
        if (is_array($info)) {
            $abs_item = $info;
            if (extension_loaded('posix')) {
                $user_info = posix_getpwnam($info['user']);
                $file_info['uid'] = $user_info['uid'];
                $file_info['gid'] = $user_info['gid'];
            }
        } else {
            $abs_item = get_abs_item($dir, $item);
            $file_info = @stat($abs_item);
        }
        $is_writable = @$GLOBALS['jx_File']->is_writable($abs_item);
        $is_chmodable = @$GLOBALS['jx_File']->is_chmodable($abs_item);
        $is_readable = @$GLOBALS['jx_File']->is_readable($abs_item);
        $is_deletable = @$GLOBALS['jx_File']->is_deletable($abs_item);
        $target = "";
        $extra = "";
        if (@$GLOBALS['jx_File']->is_link($abs_item)) {
            $extra = " -> " . @readlink($abs_item);
        }
        if (@get_is_dir($abs_item, '')) {
            $link = make_link("list", get_rel_item($dir, $item), NULL);
        } else {
            if (get_is_editable($abs_item) && $is_writable) {
                $link = make_link('edit', $dir, $item);
            } elseif ($is_readable) {
                if (strstr(get_abs_dir($dir), $GLOBALS['mosConfig_absolute_path']) && !$GLOBALS['jx_File']->is_link($abs_item)) {
                    $link = $GLOBALS["home_url"] . "/" . get_rel_item($dir, $item);
                    $target = '_blank';
                } else {
                    $link = make_link('download', $dir, $item);
                }
            }
        }
        if (jx_isIE()) {
            echo '<tr onmouseover="style.backgroundColor=\'#D8ECFF\';" onmouseout="style.backgroundColor=\'#EAECEE\';" bgcolor=\'#EAECEE\'>';
        } else {
            $toggle = $toggle ? '1' : '0';
            echo "<tr class=\"row{$toggle}\">";
            $toggle = !$toggle;
        }
        echo "<td><input type=\"checkbox\" id=\"item_{$i}\" name=\"selitems[]\" value=\"";
        echo urlencode($item) . "\" onclick=\"javascript:Toggle(this);\" /></td>\n";
        // Icon + Link
        echo "<td nowrap=\"nowrap\" align=\"left\">";
        if ($is_readable) {
            echo "<a href=\"" . $link . "\" target=\"" . $target . "\">";
        }
        //else echo "<<>";
        echo "<img border=\"0\" width=\"22\" height=\"22\" ";
        echo "align=\"absmiddle\" src=\"" . _QUIXPLORER_URL . "/images/" . get_mime_type($abs_item, "img") . "\" alt=\"\" />&nbsp;";
        $s_item = $item;
        if (strlen($s_item) > 50) {
            $s_item = substr($s_item, 0, 47) . "...";
        }
        echo htmlspecialchars($s_item . $extra);
        if ($is_readable) {
            echo "</a>";
            // ...$extra...
        }
        echo "</td>\n";
        // Size
        echo "<td>" . parse_file_size(get_file_size($abs_item)) . "</td>\n";
        // type
        echo "<td>" . get_mime_type($abs_item, "type") . "</td>\n";
        // modified
        echo "<td>" . parse_file_date(get_file_date($abs_item)) . "</td>\n";
        // permissions
        echo "<td>";
        if ($allow && $is_chmodable) {
            echo "<a href=\"" . make_link("chmod", $dir, $item) . "\" title=\"";
            echo $GLOBALS["messages"]["permlink"] . "\">";
        }
        $perms = get_file_perms($abs_item);
        if (strlen($perms) > 3) {
            $perms = substr($perms, 2);
        }
        echo '<strong>' . $perms . '</strong><br />' . parse_file_type($dir, $item) . parse_file_perms($perms);
        if ($allow && $is_chmodable) {
            echo "</a>";
        }
        echo "</td>\n";
        // Owner
        error_reporting(E_ALL);
        if (extension_loaded("posix")) {
            echo "<td>\n";
            $user_info = posix_getpwuid($file_info["uid"]);
            $group_info = posix_getgrgid($file_info["gid"]);
            echo $user_info["name"] . " (" . $file_info["uid"] . ") /<br/>";
            echo $group_info["name"] . " (" . $file_info["gid"] . ")";
            echo "</td>\n";
        }
        // actions
        echo "<td style=\"white-space:nowrap;\">\n";
        // Rename
        // A file that could be deleted can also be renamed
        if ($allow && $is_deletable) {
            echo "<a href=\"" . make_link("rename", $dir, $item) . "\">";
            echo "<img border=\"0\" width=\"22\" height=\"22\" ";
            echo "src=\"" . _QUIXPLORER_URL . "/images/_rename.gif\" alt=\"" . $GLOBALS["messages"]["renamelink"] . "\" title=\"";
            echo $GLOBALS["messages"]["renamelink"] . "\" /></a>\n";
        } else {
            echo "<img border=\"0\" width=\"22\" height=\"22\" ";
            echo "src=\"" . _QUIXPLORER_URL . "/images/_rename_.gif\" alt=\"" . $GLOBALS["messages"]["renamelink"] . "\" title=\"";
            echo $GLOBALS["messages"]["renamelink"] . "\" />\n";
        }
        // EDIT
        if (get_is_editable($abs_item)) {
            if ($allow && $is_writable) {
                echo "<a href=\"" . make_link("edit", $dir, $item) . "\">";
                echo "<img border=\"0\" width=\"22\" height=\"22\" ";
                echo "src=\"" . _QUIXPLORER_URL . "/images/_edit.png\" alt=\"" . $GLOBALS["messages"]["editlink"] . "\" title=\"";
                echo $GLOBALS["messages"]["editlink"] . "\" /></a>\n";
            } else {
                echo "<img border=\"0\" width=\"22\" height=\"22\" ";
                echo "src=\"" . _QUIXPLORER_URL . "/images/_edit_.png\" alt=\"" . $GLOBALS["messages"]["editlink"] . "\" title=\"";
                echo $GLOBALS["messages"]["editlink"] . "\" />\n";
            }
        } else {
            // Extract Link
            if (jx_isArchive($item) && !jx_isFTPMode()) {
                echo "<a ";
                echo "onclick=\"javascript: ClearAll();if( confirm('" . $GLOBALS["messages"]["extract_warning"] . "') ) { return true } else { return false;}\" ";
                echo "href=\"" . make_link("extract", $dir, $item) . "\" title=\"" . $GLOBALS["messages"]["extractlink"] . "\">";
                echo "<img border=\"0\" width=\"22\" height=\"20\" ";
                echo "src=\"" . _QUIXPLORER_URL . "/images/_extract.png\" alt=\"" . $GLOBALS["messages"]["extractlink"];
                echo "\" title=\"" . $GLOBALS["messages"]["extractlink"] . "\" /></a>\n";
            } else {
                echo "<img border=\"0\" width=\"16\" height=\"16\" ";
                echo "src=\"" . _QUIXPLORER_URL . "/images/_.gif\" alt=\"\" />\n";
            }
        }
        // VIEW
        if (get_is_editable($abs_item) && $GLOBALS['jx_File']->is_readable($abs_item) && get_is_file($abs_item)) {
            $link = str_replace('/index2.php', '/index3.php', make_link("view", $dir, $item));
            $status = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=750,height=580,directories=no,location=no,screenX=100,screenY=100';
            echo "<a href=\"" . $link . "\" onclick=\"window.open('{$link}','win2','{$status}'); return false;\" title=\"" . $GLOBALS["messages"]["viewlink"] . "\">";
            echo "<img border=\"0\" width=\"22\" height=\"22\" ";
            echo "src=\"" . _QUIXPLORER_URL . "/images/src.gif\" alt=\"" . $GLOBALS["messages"]["viewlink"] . "\" /></a>\n";
        }
        // DOWNLOAD / Extract
        if (get_is_file($abs_item)) {
            if ($allow) {
                echo "<a href=\"" . make_link("download", $dir, $item) . "\" title=\"" . $GLOBALS["messages"]["downlink"] . "\">";
                echo "<img border=\"0\" width=\"22\" height=\"22\" ";
                echo "src=\"" . _QUIXPLORER_URL . "/images/_download.png\" alt=\"" . $GLOBALS["messages"]["downlink"];
                echo "\" title=\"" . $GLOBALS["messages"]["downlink"] . "\" /></a>\n";
            } else {
                if (!$allow) {
                    echo "<td><img border=\"0\" width=\"22\" height=\"22\" ";
                    echo "src=\"" . _QUIXPLORER_URL . "/images/_download_.png\" alt=\"" . $GLOBALS["messages"]["downlink"];
                    echo "\" title=\"" . $GLOBALS["messages"]["downlink"] . "\" />\n";
                }
            }
        } else {
            echo "<img border=\"0\" width=\"16\" height=\"16\" ";
            echo "src=\"" . _QUIXPLORER_URL . "/images/_.gif\" alt=\"\" />\n";
        }
        // DELETE
        if (get_is_file($abs_item)) {
            if ($allow && $GLOBALS['jx_File']->is_deletable($abs_item)) {
                $confirm_msg = sprintf($GLOBALS["messages"]["confirm_delete_file"], $item);
                echo "<a name=\"link_item_{$i}\" href=\"#link_item_{$i}\" title=\"" . $GLOBALS["messages"]["dellink"] . "\" \n\t\t\t\tonclick=\"javascript: ClearAll(); getElementById('item_{$i}').checked = true; if( confirm('" . $confirm_msg . "') ) { document.selform.do_action.value='delete'; document.selform.submit(); } else {  getElementById('item_{$i}').checked = false; return false;}\">";
                echo "<img border=\"0\" width=\"22\" height=\"22\" ";
                echo "src=\"" . _QUIXPLORER_URL . "/images/_delete.gif\" alt=\"" . $GLOBALS["messages"]["dellink"];
                echo "\" title=\"" . $GLOBALS["messages"]["dellink"] . "\" /></a>\n";
            } else {
                echo "<img border=\"0\" width=\"22\" height=\"22\" ";
                echo "src=\"" . _QUIXPLORER_URL . "/images/_delete_.gif\" alt=\"" . $GLOBALS["messages"]["dellink"];
                echo "\" title=\"" . $GLOBALS["messages"]["dellink"] . "\" />\n";
            }
        } else {
            echo "<img border=\"0\" width=\"16\" height=\"16\" ";
            echo "src=\"" . _QUIXPLORER_URL . "/images/_.gif\" alt=\"\" />\n";
        }
        echo "</td></tr>\n";
        $i++;
    }
}
示例#2
0
function print_table($dir, $list, $allow)
{
    // print table of files
    if (!is_array($list)) {
        return;
    }
    while (list($item, ) = each($list)) {
        // link to dir / file
        $abs_item = get_abs_item($dir, $item);
        $target = "";
        //$extra="";
        //if(is_link($abs_item)) $extra=" -> ".@readlink($abs_item);
        if (is_dir($abs_item)) {
            $link = make_link("list", get_rel_item($dir, $item), NULL);
        } else {
            //if(get_is_editable($dir,$item) || get_is_image($dir,$item)) {
            $link = $GLOBALS["home_url"] . "/" . get_rel_item($dir, $item);
            $target = "_blank";
        }
        //else $link = "";
        echo "<TR class=\"rowdata\"><TD><INPUT TYPE=\"checkbox\" name=\"selitems[]\" value=\"";
        echo htmlspecialchars($item) . "\" onclick=\"javascript:Toggle(this);\"></TD>\n";
        // Icon + Link
        echo "<TD nowrap>";
        if (get_is_dir($dir, $item)) {
            /*if($link!="") */
            echo "<A HREF=\"" . $link . "\" TARGET=\"" . $target . "\">";
            //else echo "<A>";
        }
        echo "<IMG border=\"0\" width=\"16\" height=\"16\" ";
        echo "align=\"ABSMIDDLE\" src=\"_img/" . get_mime_type($dir, $item, "img") . "\" ALT=\"\">&nbsp;";
        $s_item = $item;
        if (strlen($s_item) > 50) {
            $s_item = substr($s_item, 0, 47) . "...";
        }
        echo htmlspecialchars($s_item);
        if (get_is_dir($dir, $item)) {
            echo "</A>";
        }
        echo "</TD>\n";
        // ...$extra...
        // Size
        echo "<TD>" . parse_file_size(get_file_size($dir, $item)) . "</TD>\n";
        // Type
        echo "<TD>" . get_mime_type($dir, $item, "type") . "</TD>\n";
        // Modified
        echo "<TD>" . parse_file_date(get_file_date($dir, $item)) . "</TD>\n";
        // Permissions
        echo "<TD>";
        if ($allow) {
            echo "<A HREF=\"" . make_link("chmod", $dir, $item) . "\" TITLE=\"";
            echo $GLOBALS["messages"]["permlink"] . "\">";
        }
        echo parse_file_type($dir, $item) . parse_file_perms(get_file_perms($dir, $item));
        if ($allow) {
            echo "</A>";
        }
        echo "</TD>\n";
        // Actions
        echo "<TD>\n<TABLE>\n";
        // EDIT
        if (get_is_editable($dir, $item)) {
            if ($allow) {
                echo "<TD><A HREF=\"" . make_link("edit", $dir, $item) . "\">";
                echo "<IMG border=\"0\" width=\"16\" height=\"16\" align=\"ABSMIDDLE\" ";
                echo "src=\"_img/_edit.gif\" ALT=\"" . $GLOBALS["messages"]["editlink"] . "\" TITLE=\"";
                echo $GLOBALS["messages"]["editlink"] . "\"></A></TD>\n";
            } else {
                echo "<TD><IMG border=\"0\" width=\"16\" height=\"16\" align=\"ABSMIDDLE\" ";
                echo "src=\"_img/_edit_.gif\" ALT=\"" . $GLOBALS["messages"]["editlink"] . "\" TITLE=\"";
                echo $GLOBALS["messages"]["editlink"] . "\"></TD>\n";
            }
        } else {
            echo "<TD><IMG border=\"0\" width=\"16\" height=\"16\" align=\"ABSMIDDLE\" ";
            echo "src=\"_img/_.gif\" ALT=\"\"></TD>\n";
        }
        // DOWNLOAD
        if (get_is_file($dir, $item)) {
            if ($GLOBALS["display_file_download_icon"]) {
                if ($allow) {
                    echo "<TD><A HREF=\"" . make_link("download", $dir, $item) . "\">";
                    echo "<IMG border=\"0\" width=\"16\" height=\"16\" align=\"ABSMIDDLE\" ";
                    echo "src=\"_img/_download.gif\" ALT=\"" . $GLOBALS["messages"]["downlink"];
                    echo "\" TITLE=\"" . $GLOBALS["messages"]["downlink"] . "\"></A></TD>\n";
                } else {
                    if (!$allow) {
                        echo "<TD><IMG border=\"0\" width=\"16\" height=\"16\" align=\"ABSMIDDLE\" ";
                        echo "src=\"_img/_download_.gif\" ALT=\"" . $GLOBALS["messages"]["downlink"];
                        echo "\" TITLE=\"" . $GLOBALS["messages"]["downlink"] . "\"></TD>\n";
                    }
                }
            }
        } else {
            echo "<TD><IMG border=\"0\" width=\"16\" height=\"16\" align=\"ABSMIDDLE\" ";
            echo "src=\"_img/_.gif\" ALT=\"\"></TD>\n";
        }
        echo "</TABLE>\n</TD></TR>\n";
    }
}
示例#3
0
function print_table($dir, $list)
{
    if (!is_array($list)) {
        return;
    }
    while (list($item, ) = each($list)) {
        // link to dir / file
        $abs_item = get_abs_item($dir, $item);
        $target = "";
        //$extra="";
        //if(is_link($abs_item)) $extra=" -> ".@readlink($abs_item);
        if (is_dir($abs_item)) {
            $link = make_link("list", get_rel_item($dir, $item), NULL);
        } else {
            //if(get_is_editable($dir,$item) || get_is_image($dir,$item)) {
            //?? CK Hier wird kuenftig immer mit dem download-Link gearbeitet, damit
            //?? CK die Leute links klicken koennen
            //?? CK			$link = $GLOBALS["home_url"]."/".get_rel_item($dir, $item);
            $link = make_link("download", $dir, $item);
            $target = "_blank";
        }
        //else $link = "";
        echo "<TR class=\"rowdata\"><TD><INPUT TYPE=\"checkbox\" name=\"selitems[]\" value=\"";
        echo htmlspecialchars($item) . "\" onclick=\"javascript:Toggle(this);\"></TD>\n";
        // Icon + Link
        echo "<TD nowrap>";
        if (permissions_grant($dir, $item, "read")) {
            echo "<A HREF=\"" . $link . "\">";
        }
        //else echo "<A>";
        echo "<IMG border=\"0\" width=\"16\" height=\"16\" ";
        echo "align=\"ABSMIDDLE\" src=\"_img/" . get_mime_type($dir, $item, "img") . "\" ALT=\"\">&nbsp;";
        $s_item = $item;
        if (strlen($s_item) > 50) {
            $s_item = substr($s_item, 0, 47) . "...";
        }
        echo htmlspecialchars($s_item);
        if (permissions_grant($dir, $item, "read")) {
            echo "</A>";
        }
        echo "</TD>\n";
        // ...$extra...
        // Size
        echo "<TD>" . parse_file_size(get_file_size($dir, $item)) . "</TD>\n";
        // Type
        echo "<TD>" . get_mime_type($dir, $item, "type") . "</TD>\n";
        // Modified
        echo "<TD>" . parse_file_date(get_file_date($dir, $item)) . "</TD>\n";
        // Permissions
        echo "<TD>";
        if (permissions_grant($dir, NULL, "change")) {
            echo "<A HREF=\"" . make_link("chmod", $dir, $item) . "\" TITLE=\"";
            echo $GLOBALS["messages"]["permlink"] . "\">";
        }
        echo parse_file_type($dir, $item) . parse_file_perms(get_file_perms($dir, $item));
        if (permissions_grant($dir, NULL, "change")) {
            echo "</A>";
        }
        echo "</TD>\n";
        // Actions
        echo "<TD>\n<TABLE>\n";
        // EDIT
        if (get_is_editable($dir, $item)) {
            _print_link("edit", permissions_grant($dir, $item, "change"), $dir, $item);
        } else {
            echo "<TD><IMG border=\"0\" width=\"16\" height=\"16\" align=\"ABSMIDDLE\" ";
            echo "src=\"_img/_.gif\" ALT=\"\"></TD>\n";
        }
        // DOWNLOAD
        if (get_is_file($dir, $item)) {
            _print_link("download", permissions_grant($dir, $item, "read"), $dir, $item);
        } else {
            echo "<TD><IMG border=\"0\" width=\"16\" height=\"16\" align=\"ABSMIDDLE\" ";
            echo "src=\"_img/_.gif\" ALT=\"\"></TD>\n";
        }
        echo "</TABLE>\n</TD></TR>\n";
    }
}
示例#4
0
/**
 print table of files
*/
function print_table($dir, $list)
{
    if (!is_array($list)) {
        return;
    }
    while (list($item) = each($list)) {
        // link to dir / file
        $abs_item = get_abs_item($dir, $item);
        $target = "";
        if (is_dir($abs_item)) {
            $link = make_link("list", get_rel_item($dir, $item), NULL);
        } else {
            $link = make_link("download", $dir, $item);
            $target = "_blank";
        }
        echo "<TR class=\"rowdata\"><TD><INPUT TYPE=\"checkbox\" name=\"selitems[]\" value=\"";
        echo htmlspecialchars($item) . "\" onclick=\"javascript:Toggle(this);\"></TD>\n";
        // Icon + Link
        echo "<TD nowrap>";
        if (permissions_grant($dir, $item, "read")) {
            echo "<A HREF=\"" . $link . "\">";
        }
        //else echo "<A>";
        echo "<IMG border=\"0\" width=\"16\" height=\"16\" ";
        echo "align=\"ABSMIDDLE\" src=\"_img/" . get_mime_type($dir, $item, "img") . "\" ALT=\"\">&nbsp;";
        $s_item = $item;
        if (strlen($s_item) > 50) {
            $s_item = substr($s_item, 0, 47) . "...";
        }
        echo htmlspecialchars($s_item);
        if (permissions_grant($dir, $item, "read")) {
            echo "</A>";
        }
        echo "</TD>\n";
        // ...$extra...
        // Size
        echo '<TD>' . parse_file_size(get_file_size($dir, $item)) . sprintf("%10s", "&nbsp;") . "</TD>\n";
        // Type
        echo "<td>" . _get_link_info($dir, $item, "type") . "</td>\n";
        // Modified
        echo "<TD>" . parse_file_date(get_file_date($dir, $item)) . "</TD>\n";
        // Permissions
        echo "<TD>";
        if (permissions_grant($dir, NULL, "change")) {
            echo "<A HREF=\"" . make_link("chmod", $dir, $item) . "\" TITLE=\"";
            echo $GLOBALS["messages"]["permlink"] . "\">";
        }
        echo parse_file_type($dir, $item) . parse_file_perms(get_file_perms($dir, $item));
        if (permissions_grant($dir, NULL, "change")) {
            echo "</A>";
        }
        echo "</TD>\n";
        // Actions
        echo "<TD>\n<TABLE>\n";
        // EDIT
        if (get_is_editable($dir, $item)) {
            _print_link("edit", permissions_grant($dir, $item, "change"), $dir, $item);
        } else {
            // UNZIP
            if (get_is_unzipable($dir, $item)) {
                _print_link("unzip", permissions_grant($dir, $item, "create"), $dir, $item);
            } else {
                echo "<TD><IMG border=\"0\" width=\"16\" height=\"16\" align=\"ABSMIDDLE\" ";
                echo "src=\"" . $GLOBALS["baricons"]["none"] . "\" ALT=\"\"></TD>\n";
            }
        }
        // DOWNLOAD
        if (get_is_file($dir, $item)) {
            _print_link("download", permissions_grant($dir, $item, "read"), $dir, $item);
        } else {
            echo "<TD><IMG border=\"0\" width=\"16\" height=\"16\" align=\"ABSMIDDLE\" ";
            echo "src=\"" . $GLOBALS["baricons"]["none"] . "\" ALT=\"\"></TD>\n";
        }
        echo "</TABLE>\n</TD></TR>\n";
    }
}