コード例 #1
0
ファイル: browse_Document.php プロジェクト: propagit/skfest
function Showbrowse_Img($spec)
{
    extract($GLOBALS);
    $s = "";
    $directory = ServerMapPath($spec);
    // if the path has a slash at the end we remove it here
    if (substr($directory, -1) == '/') {
        $directory = substr($directory, 0, -1);
    }
    $s = $s . "<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\" valign=\"top\" id=\"FoldersAndFiles\" style=\"width:100%\" class=sortable>";
    $s = $s . "<tr onMouseOver=\"row_over(this)\" onMouseOut=\"row_out(this)\" bgcolor=\"#f0f0f0\">";
    $s = $s . "<td width=16 nowrap><img src=\"../Images/refresh.gif\" title=\"refresh\" onclick=\"parent.Refresh('" . $folpath . "');\" onMouseOver=\"parent.CuteEditor_ColorPicker_ButtonOver(this);\" style=\"VERTICAL-ALIGN: middle\"></td>";
    $s = $s . "<td width=\"220\" Class=\"filelistHeadCol\"><b>Name</b></td>";
    $s = $s . "<td width=50 nowrap Class=\"filelistHeadCol\"><b>Size</b></td>";
    $s = $s . "<td width=50 nowrap Class=\"filelistHeadCol\"><b>Modified</b></td>";
    //  $s=$s."<td width=50 nowrap Class=\"filelistHeadCol\"><b>Created</b></td>";
    $s = $s . "<td width=15 nowrap Class=\"filelistHeadCol\"><b>Attributes</b></td>";
    $s = $s . "<td width=50 nowrap Class=\"filelistHeadCol\"><b>Type</b></td>";
    if ($AllowDelete == "true") {
        $s = $s . "<td nowrap></td>";
    }
    if ($AllowRename == "true") {
        $s = $s . "<td nowrap></td>";
    }
    if ($AllowDelete == "true") {
        $s = $s . "<td nowrap></td>";
    }
    $s = $s . "</tr>";
    $s = $s . "<tr onMouseOver=\"row_over(this)\" onMouseOut=\"row_out(this)\" onclick=\"Editor_upfolder();\">";
    $s = $s . "<td><img src=\"../Images/parentfolder.gif\" title=\"Go up one level\" style=\"VERTICAL-ALIGN: middle\"></td>";
    $s = $s . "<td>...</td>";
    $s = $s . "<td></td>";
    $s = $s . "<td></td>";
    $s = $s . "<td></td>";
    $s = $s . "<td></td>";
    if ($AllowDelete == "true") {
        $s = $s . "<td nowrap></td>";
    }
    if ($AllowRename == "true") {
        $s = $s . "<td nowrap></td>";
    }
    if ($AllowDelete == "true") {
        $s = $s . "<td nowrap></td>";
    }
    $s = $s . "</tr>";
    $dirlist = array();
    $filelist = array();
    // we open the directory
    if ($f = opendir($directory)) {
        while (($file = readdir($f)) !== false) {
            if ($file != "." && $file != "..") {
                $path = $directory . '/' . $file;
                if (is_file($path)) {
                    $filelist[] = $file;
                } elseif (is_dir($path)) {
                    $dirlist[] = $file;
                }
            }
        }
        closedir($f);
    }
    if ($dirlist) {
        asort($dirlist);
        while (list($key, $file) = each($dirlist)) {
            $file_stat = ServerMapPath($current_Path . $folpath . $file);
            $lastmod = date("m/d/Y", filemtime($file_stat));
            $p;
            if (!(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')) {
                $p = show_perms(fileperms($file_stat));
            } else {
                $p = base_convert(fileperms($file_stat), 10, 8);
                $p = substr($p, strlen($p) - 3);
            }
            //add the html for the folders
            $str_openfolderEvent = "onclick=\"parent.SetUpload_FolderPath('" . $current_Path . $folpath . $file . "');location.href='browse_Document.php?" . $setting . "&loc=" . $folpath . $file . "&Theme=" . $Theme . "&DP=" . $current_Path . "';\"";
            $s = $s . "<tr onMouseOver=\"row_over(this)\" onMouseOut=\"row_out(this)\">";
            $s = $s . "<td " . $str_openfolderEvent . "><img vspace=\"0\" hspace=\"0\" src=\"../Images/closedfolder.gif\" style=\"VERTICAL-ALIGN: middle\"></td>" . "\r\n";
            $s = $s . "<td valign=\"top\" style=\"cursor:pointer\" " . $str_openfolderEvent . ">" . "\r\n";
            $s = $s . $file . "&nbsp;&nbsp;</td>" . "\r\n";
            $s = $s . "<td nowrap style=\"cursor:pointer;\"></td>";
            $s = $s . "<td nowrap>" . $lastmod . "</td>";
            //	    $s=$s."<td nowrap>".$lastmod."</td>";
            $s = $s . "<td nowrap>" . $p . "</td>";
            $s = $s . "<td nowrap>Directory</td>";
            if ($AllowDelete == "true") {
                $s = $s . "<td nowrap style=\"cursor:pointer; border:1px\" ><img vspace=\"0\" hspace=\"0\" src=\"../Images/delete.gif\" onclick=\"deletefolder('" . $current_Path . $folpath . $file . "')\" title=\"Delete\"></td>";
            }
            if ($AllowRename == "true") {
                $s = $s . "<td nowrap style=\"cursor:pointer; border:1px\" ><img vspace=\"0\" hspace=\"0\" src=\"../Images/edit.gif\" title=\"Rename\" onclick=\"renamefolder('" . $current_Path . $folpath . $file . "')\"></td>";
            }
            if ($AllowDelete == "true") {
                $s = $s . "<td ></td>";
            }
            $s = $s . "</tr>" . "\r\n";
        }
    }
    if ($filelist) {
        asort($filelist);
        while (list($key, $file) = each($filelist)) {
            if (ValidImage($file)) {
                $file_stat = stat(ServerMapPath($current_Path . $folpath . $file));
                $size = FormatSize($file_stat[7]);
                $lastmod = date("m/d/Y", $file_stat[10]);
                //$created = date("m/d/Y",$file_stat[8]);
                //add the html for the folders
                $p;
                if (!(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')) {
                    $p = show_perms(fileperms(ServerMapPath($current_Path . $folpath . $file)));
                } else {
                    $p = base_convert(fileperms(ServerMapPath($current_Path . $folpath . $file)), 10, 8);
                    $p = substr($p, strlen($p) - 3);
                }
                $f_Tooltip = "";
                $f_Tooltip = $f_Tooltip . "<nobr>Name: " . $file . "</nobr><br>";
                $f_Tooltip = $f_Tooltip . "<nobr>Size: " . $size . "</nobr><br>";
                $f_Tooltip = $f_Tooltip . "<nobr>Date modified: " . $lastmod . "</nobr><br>";
                $f_Tooltip = $f_Tooltip . "<nobr>Attributes: " . $p . "</nobr><br>";
                $s = $s . "<tr onclick=\"parent.row_click('" . $current_Path . $folpath . $file . "','" . $f_Tooltip . "'); \" onMouseOver=\"row_over(this)\" onMouseOut=\"row_out(this)\">";
                $s = $s . "<td><img vspace=\"0\" hspace=\"0\" src=\"../Images/" . strtolower(substr(strrchr($file, '.'), 1)) . ".gif\" style=\"VERTICAL-ALIGN: middle\"></td>" . "\r\n";
                $s = $s . "<td valign=\"top\" style=\"cursor:pointer\" >" . "\r\n";
                $s = $s . $file . "&nbsp;&nbsp;</td>" . "\r\n";
                $s = $s . "<td nowrap style=\"cursor:pointer;\">" . $size . "</td>";
                $s = $s . "<td nowrap>" . $lastmod . "</td>";
                //	    $s=$s."<td nowrap>".$created."</td>";
                $s = $s . "<td nowrap>" . $p . "</td>";
                $s = $s . "<td nowrap>" . FindType(GetExtension($file)) . "</td>";
                if ($AllowDelete == "true") {
                    $s = $s . "<td nowrap style=\"cursor:pointer; border:1px\" ><img vspace=\"0\" hspace=\"0\" src=\"../Images/delete.gif\" onclick=\"deletefile('" . $current_Path . $folpath . $file . "')\" title=\"Delete\"></td>";
                }
                if ($AllowRename == "true") {
                    $s = $s . "<td nowrap style=\"cursor:pointer; border:1px\" ><img vspace=\"0\" hspace=\"0\" src=\"../Images/edit.gif\" title=\"Rename\" onclick=\"renamefile('" . $current_Path . $folpath . $file . "','{$file}')\"></td>";
                }
                if ($AllowDelete == "true") {
                    $s = $s . "<td nowrap style=\"cursor:pointer; border:1px\" ><img vspace=\"0\" hspace=\"0\" src=\"../Images/download.gif\" onclick=\"downloadfile('" . $current_Path . $folpath . $file . "')\" title=\"Download\"></td>";
                }
                $s = $s . "</tr>" . "\r\n";
            }
        }
    }
    $s = $s . "</table>";
    return $s;
}
コード例 #2
0
ファイル: browse_Media.php プロジェクト: propagit/skfest
function Showbrowse_Img($spec)
{
    extract($GLOBALS);
    $s = "";
    $directory = ServerMapPath($spec);
    // if the path has a slash at the end we remove it here
    if (substr($directory, -1) == '/') {
        $directory = substr($directory, 0, -1);
    }
    $s = $s . "<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\" valign=\"top\" id=\"FoldersAndFiles\" style=\"width:100%\" class=sortable>";
    $s = $s . "<tr onMouseOver=\"row_over(this)\" onMouseOut=\"row_out(this)\" bgcolor=\"#f0f0f0\">";
    $s = $s . "<td width=16 nowrap><img src=\"../Images/refresh.gif\" title=\"refresh\" onclick=\"parent.Refresh('" . $folpath . "');\" onMouseOver=\"parent.CuteEditor_ColorPicker_ButtonOver(this);\" style=\"VERTICAL-ALIGN: middle\"></td>";
    $s = $s . "<td width=\"60%\" Class=\"filelistHeadCol\"><b>Name</b></td>";
    $s = $s . "<td nowrap Class=\"filelistHeadCol\"><b>Size</b></td>";
    if ($AllowDelete == "true") {
        $s = $s . "<td nowrap></td>";
    }
    if ($AllowRename == "true") {
        $s = $s . "<td nowrap></td>";
    }
    $s = $s . "</tr>";
    $s = $s . "<tr onMouseOver=\"row_over(this)\" onMouseOut=\"row_out(this)\" onclick=\"Editor_upfolder();\">";
    $s = $s . "<td><img src=\"../Images/parentfolder.gif\" title=\"Go up one level\" style=\"VERTICAL-ALIGN: middle\"></td>";
    $s = $s . "<td>...</td>";
    $s = $s . "<td></td>";
    if ($AllowDelete == "true") {
        $s = $s . "<td nowrap></td>";
    }
    if ($AllowRename == "true") {
        $s = $s . "<td nowrap></td>";
    }
    $s = $s . "</tr>";
    $dirlist = array();
    $filelist = array();
    // we open the directory
    if ($f = opendir($directory)) {
        while (($file = readdir($f)) !== false) {
            if ($file != "." && $file != "..") {
                $path = $directory . '/' . $file;
                if (is_file($path)) {
                    $filelist[] = $file;
                } elseif (is_dir($path)) {
                    $dirlist[] = $file;
                }
            }
        }
        closedir($f);
    }
    if ($dirlist) {
        asort($dirlist);
        while (list($key, $file) = each($dirlist)) {
            //add the html for the folders
            $str_openfolderEvent = "onclick=\"parent.SetUpload_FolderPath('" . $current_Path . $folpath . $file . "');location.href='browse_Media.php?" . $setting . "&loc=" . $folpath . $file . "&MP=" . $current_Path . "';\"";
            $s = $s . "<tr onMouseOver=\"row_over(this)\" onMouseOut=\"row_out(this)\">";
            $s = $s . "<td " . $str_openfolderEvent . "><img vspace=\"0\" hspace=\"0\" src=\"../Images/closedfolder.gif\" style=\"VERTICAL-ALIGN: middle\"></td>" . "\r\n";
            $s = $s . "<td valign=\"top\" style=\"cursor:pointer\" " . $str_openfolderEvent . ">" . "\r\n";
            $s = $s . $file . "&nbsp;&nbsp;</td>" . "\r\n";
            $s = $s . "<td nowrap style=\"cursor:pointer;\" " . $str_openfolderEvent . "></td>";
            if ($AllowDelete == "true") {
                $s = $s . "<td nowrap style=\"cursor:pointer; border:1px\" ><img vspace=\"0\" hspace=\"0\" src=\"../Images/delete.gif\" onclick=\"deletefolder('" . $current_Path . $folpath . $file . "')\" title=\"Delete\"></td>";
            }
            if ($AllowRename == "true") {
                $s = $s . "<td nowrap style=\"cursor:pointer; border:1px\" ><img vspace=\"0\" hspace=\"0\" src=\"../Images/edit.gif\" title=\"Rename\" onclick=\"renamefolder('" . $current_Path . $folpath . $file . "')\"></td>";
            }
            $s = $s . "</tr>" . "\r\n";
        }
    }
    if ($filelist) {
        asort($filelist);
        while (list($key, $file) = each($filelist)) {
            if (ValidImage($file)) {
                //add the html for the folders
                $s = $s . "<tr onclick=\"parent.row_click('" . $current_Path . $folpath . $file . "'); \" onMouseOver=\"row_over(this)\" onMouseOut=\"row_out(this)\">";
                $s = $s . "<td><img vspace=\"0\" hspace=\"0\" src=\"../Images/" . GetExtension($file) . ".gif\" style=\"VERTICAL-ALIGN: middle\"></td>" . "\r\n";
                $s = $s . "<td valign=\"top\" style=\"cursor:pointer\" >" . "\r\n";
                $s = $s . $file . "&nbsp;&nbsp;</td>" . "\r\n";
                $s = $s . "<td nowrap style=\"cursor:pointer;\">" . FormatSize(filesize($directory . '/' . $file)) . "</td>";
                if ($AllowDelete == "true") {
                    $s = $s . "<td nowrap style=\"cursor:pointer; border:1px\" ><img vspace=\"0\" hspace=\"0\" src=\"../Images/delete.gif\" onclick=\"deletefile('" . $current_Path . $folpath . $file . "')\" title=\"Delete\"></td>";
                }
                if ($AllowRename == "true") {
                    $s = $s . "<td nowrap style=\"cursor:pointer; border:1px\" ><img vspace=\"0\" hspace=\"0\" src=\"../Images/edit.gif\" title=\"Rename\" onclick=\"renamefile('" . $current_Path . $folpath . $file . "','{$file}')\"></td>";
                }
                $s = $s . "</tr>" . "\r\n";
            }
        }
    }
    $s = $s . "</table>";
    return $s;
}
コード例 #3
0
function Showbrowse_Img($spec)
{
    extract($GLOBALS);
    $s = "";
    $directory = ServerMapPath($spec);
    // if the path has a slash at the end we remove it here
    if (substr($directory, -1) == '/') {
        $directory = substr($directory, 0, -1);
    }
    $dirlist = array();
    $imglist = array();
    // we open the directory
    if ($f = opendir($directory)) {
        while (($file = readdir($f)) !== false) {
            if ($file != "." && $file != "..") {
                $path = $directory . '/' . $file;
                if (is_file($path)) {
                    if (ValidImage($file)) {
                        $imglist[] = $file;
                    }
                } elseif (is_dir($path)) {
                    $dirlist[] = $file;
                }
            }
        }
        closedir($f);
    }
    if ($dirlist) {
        $s = $s . "<div style='overflow: auto; HEIGHT: 120px;'>";
        $s = $s . "<table border='0' cellspacing='0' cellpadding='1' width='100%' align='center' valign='top'>";
        asort($dirlist);
        while (list($key, $file) = each($dirlist)) {
            //add the html for the folders
            $str_openfolderEvent = "onclick=\"parent.SetUpload_imagePath('" . $current_Path . $folpath . $file . "');location.href='browse_Img_gallery.php?" . $setting . "&loc=" . $folpath . $file . "&Theme=" . $Theme . "&GP=" . $current_Path . "';\"";
            $s = $s . "<tr>";
            $s = $s . "<td " . $str_openfolderEvent . "><img vspace=\"0\" hspace=\"0\" src=\"../Images/closedfolder.gif\" style=\"VERTICAL-ALIGN: middle\">&nbsp;" . "\r\n";
            $s = $s . $file . "&nbsp;&nbsp;</td>" . "\r\n";
            $s = $s . "<td nowrap style=\"cursor:pointer;\" " . $str_openfolderEvent . "></td>";
            $s = $s . "</tr>" . "\r\n";
        }
        $s = $s . "</table></div>";
    }
    $imgcnt = sizeof($imglist);
    $max_per_page = TABLE_COLS * TABLE_ROWS;
    $currpage = isset($_GET['page']) ? (int) $_GET['page'] : 1;
    // set index of page's first image in image list array
    $first_image_index = ($currpage - 1) * $max_per_page;
    // set index of page's last image in image list array
    $last_image_index = $imgcnt < $currpage * $max_per_page ? $last_image_index = $imgcnt : $currpage * $max_per_page;
    $s = $s . "<div style='HEIGHT: 280px;'><table width='100%' CellSpacing='0' valign='top'>";
    // loop control var
    $column_cnt = 1;
    // loop through current page images
    for ($i = $first_image_index; $i < $last_image_index; $i++) {
        # build path to thumb
        $thumburl = $current_Path . $folpath . $imglist[$i];
        $size = getimagesize(ServerMapPath($thumburl));
        $height = $size[1];
        $width = $size[0];
        if ($width > 80) {
            $width = 80;
            $percent = $size[0] / $width;
            $height = (int) ($size[1] / $percent);
        }
        if ($height > 64) {
            $height = 64;
            $percent = $size[1] / $height;
            $width = (int) ($size[0] / $percent);
        }
        $p;
        if (!(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')) {
            $p = show_perms(fileperms(ServerMapPath($thumburl)));
        } else {
            $p = base_convert(fileperms(ServerMapPath($thumburl)), 10, 8);
            $p = substr($p, strlen($p) - 3);
        }
        $file_stat = stat(ServerMapPath($thumburl));
        $filesize = FormatSize($file_stat[7]);
        $lastmod = date("m/d/Y", $file_stat[10]);
        $f_Tooltip = "";
        $f_Tooltip = $f_Tooltip . "<nobr>Name: " . $imglist[$i] . "</nobr><br>";
        $f_Tooltip = $f_Tooltip . "<nobr>Size: " . $filesize . "</nobr><br>";
        $f_Tooltip = $f_Tooltip . "<nobr>Width: " . $size[0] . "</nobr><br>";
        $f_Tooltip = $f_Tooltip . "<nobr>Height: " . $size[1] . "</nobr><br>";
        $f_Tooltip = $f_Tooltip . "<nobr>Date modified: " . $lastmod . "</nobr><br>";
        $f_Tooltip = $f_Tooltip . "<nobr>Attributes: " . $p . "</nobr><br>";
        // insert row tag if this is the first column
        if ($column_cnt == 1) {
            $s .= "<tr>\n";
        }
        // insert thumbnail, and surrounding html
        $s .= "<td>";
        $s .= "<img src=\"{$thumburl}\" border=\"0\" width=\"" . $width . "\" height=\"" . $height . "\" onclick=\"parent.insert(this.src)\"";
        $s .= " onMouseover=\"Check(this,1); showTooltip('" . $f_Tooltip . "', this, event);\"";
        $s .= " onMouseout=\"Check(this,0); delayhidetip()\" ";
        $s .= " style=\"BORDER: white 1px solid\" align=\"center\"/>";
        $s .= "</td>\n";
        if ($column_cnt == TABLE_COLS) {
            $s .= "</tr>\n\n";
            $column_cnt = 1;
        } else {
            $column_cnt++;
        }
    }
    $s = $s . "</table></div>";
    $pagecnt = (int) (($imgcnt - 1) / (TABLE_COLS * TABLE_ROWS)) + 1;
    $self = $_SERVER['PHP_SELF'];
    $s = $s . "<center>";
    // Show paging indicator if multiple pages:
    $s = $s . "Pages:&nbsp;";
    if ($currpage > 1) {
        $s = $s . "<a href=\"" . $self . "?" . $setting . "&Theme=" . $Theme . "&GP=" . $current_Path . $folpath . "&page=" . ($currpage - 1) . "\">&lt;&lt; Prev</a>&nbsp;";
    }
    // You can also show page numbers:
    for ($I = 1; $I <= $pagecnt; $I = $I + 1) {
        if ($I == $currpage) {
            $s = $s . $I . "&nbsp;";
        } else {
            $s = $s . "<a href=\"" . $self . "?" . $setting . "&Theme=" . $Theme . "&GP=" . $current_Path . $folpath . "&page=" . $I . "\">" . $I . "</a>&nbsp;";
        }
    }
    if ($currpage < $pagecnt) {
        $s = $s . "<a href=\"?" . $setting . "&Theme=" . $Theme . "&GP=" . $current_Path . $folpath . "&page=" . ($currpage + 1) . "\">Next &gt;&gt;</a>";
    }
    $s = $s . "</center>";
    return $s;
}