Example #1
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);
    }
    $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;
}
Example #2
0
<?php

error_reporting(E_ALL ^ E_NOTICE);
require "Include_Security.php";
require "Include_Mimetype.php";
$filepath = @$_GET["FP"];
if (substr($filepath, strlen($filepath) - 1) != "/") {
    $filepath = $filepath . "/";
}
if (@$_FILES["file"]["size"] > 0) {
    $filetype = @$_GET["Type"];
    $contentType = $_FILES["file"]["type"];
    $filesize = $_FILES["file"]["size"];
    $filename = $_FILES["file"]["name"];
    $filemimetype = FindType(GetExtension($filename));
    $filemimetype2 = FindType2(GetExtension($filename));
    // echo $filemimetype;
    $C_MaxSize;
    switch (strtolower($filetype)) {
        case "image":
            $C_MaxSize = $MaxImageSize;
            $Filter_Array = explode(",", strtolower($ImageFilters));
            break;
        case "flash":
            $C_MaxSize = $MaxFlashSize;
            $Filter_Array = array(".swf", ".flv");
            break;
        case "media":
            $C_MaxSize = $MaxMediaSize;
            $Filter_Array = explode(",", strtolower($MediaFilters));
            break;
Example #3
0
 }
 if (str_contains($filepath, $C_Path)) {
 } else {
     print "The area you are attempting to access is forbidden";
     exit;
 }
 $uploader = new PhpUploader();
 $guidlist = explode("/", $fileguidlist);
 foreach ($guidlist as $fileguid) {
     //$contentType=$_FILES["file"]["type"];
     $mvcfile = $uploader->GetUploadedFile($fileguid);
     if (!$mvcfile) {
         continue;
     }
     $filesize = $mvcfile->FileSize;
     $filemimetype = FindType(GetExtension($mvcfile->FilePath));
     $filemimetype2 = FindType2(GetExtension($mvcfile->FilePath));
     $Is_valid = false;
     if (!in_array(strtolower(GetExtension($mvcfile->FileName)), $Filter_Array)) {
         echo "<span style='font-family: MS Sans Serif; font-size: 9pt; color:red'><b>File format not allowed! Please contact site administrator. </b></span><br><br>";
         echo "<span><a style=\"font-family: MS Sans Serif; font-size: 9pt; vertical-align: top;\" href=\"upload.php?" . $setting . "&FP=" . $_GET["FP"] . "&Type=" . $_GET["Type"] . "\">Upload a new file</a></span>";
         return;
     }
     $C_MaxSize = GetMaxSize($C_MaxSize);
     if ($filesize > $C_MaxSize * 1024) {
         echo "<span style='font-family: MS Sans Serif; font-size: 9pt; color:red'><b>File size (" . FormatSize($filesize) . ") exceeds the maximum size allowed. </b></span><br><br>";
         echo "<span><a style=\"font-family: MS Sans Serif; font-size: 9pt; vertical-align: top;\" href=\"upload.php?" . $setting . "&FP=" . $_GET["FP"] . "&Type=" . $_GET["Type"] . "\">Upload a new file</a></span>";
         return;
     }
 }
 foreach ($guidlist as $fileguid) {
Example #4
0
function FindObject($Database, $IncludeName, $Name)
{
    if ($Object = FindClass($Database, $IncludeName, $Name)) {
        return array('type' => 'class', 'data' => $Object);
    }
    if ($Object = FindFunction($Database, $IncludeName, $Name)) {
        return array('type' => 'function', 'data' => $Object);
    }
    if ($Object = FindEnum($Database, $IncludeName, $Name)) {
        return array('type' => 'enum', 'data' => $Object);
    }
    if ($Object = FindType($Database, $IncludeName, $Name)) {
        return array('type' => 'type', 'data' => $Object);
    }
    return NULL;
}