Пример #1
0
function list_dir($dir)
{
    echo "<TABLE WIDTH=50% BORDER=0><TR><TH>Type</TH><TH>Filename</TH><TH>Size</TH><TH>MD5</TH></TR>";
    if (is_dir($dir)) {
        $arr = scandir($dir);
        foreach ($arr as $item) {
            if (is_dir($dir . '/' . $item)) {
                if ($item != "." && $item != "..") {
                    echo "<TR><TD>DIR</TD><TD>{$item}</TD></TR>";
                }
            } else {
                $file = $dir . '/' . $item;
                echo "<TR><TD>FILE</TD><TD>{$item}</TD><TD>" . get_filesize(filesize($file)) . "</TD><TD>" . md5_file($file) . "</TD></TR>";
            }
        }
    } else {
        return false;
    }
    echo "</TABLE>";
}
Пример #2
0
function get_img($fn)
{
    $size = GetImageSize($fn);
    echo '<img src="' . $fn . '" ' . $size[3] . ' ALT="' . basename($fn) . '(' . get_filesize($fn) . ')">';
}
Пример #3
0
function get_file($bo_table, $wr_id)
{
    global $g5, $qstr;
    $file['count'] = 0;
    $sql = " select * from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' order by bf_no ";
    $result = sql_query($sql);
    while ($row = sql_fetch_array($result)) {
        $no = $row['bf_no'];
        $file[$no]['href'] = G5_BBS_URL . "/download.php?bo_table={$bo_table}&amp;wr_id={$wr_id}&amp;no={$no}" . $qstr;
        $file[$no]['download'] = $row['bf_download'];
        // 4.00.11 - 파일 path 추가
        $file[$no]['path'] = G5_DATA_URL . '/file/' . $bo_table;
        $file[$no]['size'] = get_filesize($row['bf_filesize']);
        $file[$no]['datetime'] = $row['bf_datetime'];
        $file[$no]['source'] = addslashes($row['bf_source']);
        $file[$no]['bf_content'] = $row['bf_content'];
        $file[$no]['content'] = get_text($row['bf_content']);
        //$file[$no]['view'] = view_file_link($row['bf_file'], $file[$no]['content']);
        $file[$no]['view'] = view_file_link($row['bf_file'], $row['bf_width'], $row['bf_height'], $file[$no]['content']);
        $file[$no]['file'] = $row['bf_file'];
        $file[$no]['image_width'] = $row['bf_width'] ? $row['bf_width'] : 640;
        $file[$no]['image_height'] = $row['bf_height'] ? $row['bf_height'] : 480;
        $file[$no]['image_type'] = $row['bf_type'];
        $file['count']++;
    }
    return $file;
}
Пример #4
0
     echo "<BR/><BR/><center><table width=300>";
     echo "<TR><TD width=44%><img src='images/folder.gif'> <font size=-1 color=#666666>Folder</font></TD>";
     echo "<TD width=56%><img src='images/save.png'> <font size=-1 color=#666666>Download File</font></TD></TR>";
 }
 echo '</TR></table><BR/><BR/>';
 if ($mp3count > 2) {
     echo "<a href='mp3playlist.php?dir=" . urlencode($dir) . "&symlink=" . urlencode($symlink) . "'>Make a playlist of these MP3s</a><BR/><BR/>";
 }
 if ($candownload) {
     if ($symlink) {
         echo "<a href='grabfolder.php?dir=" . htmlentities("{$symbase}&file={$archivename}", ENT_QUOTES) . "'>Grab this folder";
         echo " (" . get_filesize($dirdetails[2]) . ")";
         echo "</a>";
     } else {
         echo "<a href='grabfolder.php?dir=" . htmlentities("{$basedir}{$dir}&file={$archivename}", ENT_QUOTES) . "'>Grab this folder";
         echo " (" . get_filesize($dirdetails[2]) . ")";
         echo "</a>";
     }
 } else {
     if ($reason == 1) {
         if ($dirdetails[2] > 900000000) {
             echo "<font class=body>Folder is too large for direct download</font>";
             echo "<BR/>";
         } else {
             echo "<font class=body>Folder is too large for direct download</font>";
             echo "<BR/>";
         }
     } else {
         echo "<font class=body>Folder contains too many files for direct download</font>";
         echo "<BR/>";
     }
Пример #5
0
function apms_get_file($dir, $pf_id)
{
    global $g5;
    if (!$pf_id) {
        return;
    }
    //파일타입 설정
    switch ($dir) {
        case 'item':
            $pf_dir = 1;
            $dir = 'item';
            $pf_url = G5_SHOP_URL;
            $pf_path = G5_DATA_URL . '/item/' . $pf_id;
            break;
        case 'partner':
            $pf_dir = 2;
            $dir = 'partner';
            $pf_url = G5_ADMIN_URL . '/apms_admin';
            $pf_path = G5_DATA_URL . '/apms/' . $dir;
            break;
        default:
            return;
    }
    $file['count'] = 0;
    $file['torrent'] = 0;
    $sql = " select * from {$g5['apms_file']} where pf_id = '{$pf_id}' and pf_dir = '{$pf_dir}' order by pf_no ";
    $result = sql_query($sql);
    while ($row = sql_fetch_array($result)) {
        $no = $row['pf_no'];
        $file[$no]['id'] = $pf_id;
        $file[$no]['href'] = $pf_url . "/download.php?pf_id={$pf_id}&amp;pf={$pf_dir}&amp;no={$no}";
        $file[$no]['href_view'] = $pf_url . "/view.php?pf_id={$pf_id}&amp;pf={$pf_dir}&amp;no={$no}";
        $file[$no]['path'] = $pf_path;
        $file[$no]['guest_use'] = $row['pf_guest_use'];
        $file[$no]['purchase_use'] = $row['pf_purchase_use'];
        $file[$no]['download'] = $row['pf_download'];
        $file[$no]['download_use'] = $row['pf_download_use'];
        $file[$no]['view'] = $row['pf_view'];
        $file[$no]['view_use'] = $row['pf_view_use'];
        $file[$no]['size'] = get_filesize($row['pf_filesize']);
        $file[$no]['datetime'] = $row['pf_datetime'];
        $file[$no]['source'] = addslashes($row['pf_source']);
        $file[$no]['file'] = $row['pf_file'];
        $file[$no]['image_width'] = $row['pf_width'] ? $row['pf_width'] : 640;
        $file[$no]['image_height'] = $row['pf_height'] ? $row['pf_height'] : 480;
        $file[$no]['image_type'] = $row['pf_type'];
        $file[$no]['ext'] = $row['pf_ext'];
        if ($row['pf_ext'] == "6") {
            $file['torrent']++;
        }
        $file['count']++;
    }
    return $file;
}
Пример #6
0
function doBackup($tables, $OutType, $OutDest, $toBackUp, $UserAgent, $local_backup_path, &$databaseResult, $backupname, $excltables = array(), $dbname)
{
    global $database, $mosConfig_db, $mosConfig_sitename, $version, $option, $task, $mosConfig_dbprefix, $_CONFIG, $mosConfig_user, $mosConfig_password, $mosConfig_host;
    if (!$tables[0]) {
        $databaseResult = LM_DATABASE_MISSING_TABLES;
        return;
    }
    addXLog("Exporting database `{$dbname}`");
    /* Determine the mime type and file extension for the output file */
    if ($OutType == "zip") {
        $filename = $backupname . "-sql" . ".zip";
    } elseif ($OutType == "html") {
        $filename = $backupname . "-sql" . ".html";
    } else {
        $filename = $backupname . "-sql" . ".sql";
    }
    $sqlfile = "{$local_backup_path}/{$filename}";
    addXLog("SQL file setup to: " . $sqlfile);
    @unlink($sqlfile);
    /* Store all the tables we want to back-up in variable $tables[] */
    if ($tables[0] == "all") {
        array_pop($tables);
        $query = mysql_query("SHOW tables");
        while ($row = mysql_fetch_array($query)) {
            $tables_list[] = $row[0];
        }
        $tables = array_merge($tables, $tables_list);
    }
    $newtables = array();
    //if(is_array($excltables))
    foreach ($tables as $key => $value) {
        if (is_array($excltables)) {
            if (!in_array($value, $excltables)) {
                $newtables[] = $value;
            }
        } else {
            $newtables[] = $value;
        }
    }
    addXLog("Exporting tables: ");
    addXLog(implode("\n", $newtables));
    if (sizeof($tables) == sizeof($newtables)) {
        $ex_dump = "";
    } else {
        $ex_dump = @implode(" ", $newtables);
    }
    $tables = $newtables;
    if ($_REQUEST['dbbackup_drop']) {
        $drop = " --add-drop-table";
    } else {
        $drop = "";
    }
    if ($_REQUEST['dbbackup_comp']) {
        $drop .= " --compatible=" . strtolower($_REQUEST['dbbackup_comp']) . " ";
    }
    if ($_CONFIG['sql_mem']) {
        exec($_CONFIG[sqldump] . " -h " . $_CONFIG['mysql_host'] . " -u " . $_CONFIG['mysql_user'] . " -p" . $_CONFIG['mysql_pass'] . " " . $dbname . " > " . $sqlfile . " {$drop} --allow-keywords " . $ex_dump);
        if (get_filesize($sqlfile) > 0) {
            $databaseResult = LM_DATABASE_BACKUP_COMPLETED . ' ( ' . getFileSizeText(get_filesize($sqlfile)) . ' )';
        } else {
            $databaseResult = LM_MSG_BACK_14;
        }
        exec("chmod 777 {$sqlfile}");
        return $sqlfile;
    }
    /*Added some default values for quotes and auto_increment problems*/
    mysql_query("SET SQL_QUOTE_SHOW_CREATE=1;");
    mysql_query("SET sql_mode = 0;");
    if ($_REQUEST['dbbackup_comp']) {
        mysql_query("SET sql_mode=" . $_REQUEST['dbbackup_comp'] . ";");
    }
    /* Store the "Create Tables" SQL in variable $CreateTable[$tblval] */
    if ($toBackUp != "data") {
        foreach ($tables as $tblval) {
            $query = mysql_query("SHOW CREATE table `{$tblval}`");
            $row = mysql_fetch_array($query);
            $CreateTable[$tblval] = $row[1];
        }
    }
    /* Store all the FIELD TYPES being backed-up (text fields need to be delimited) in variable $FieldType*/
    if ($toBackUp != "structure") {
        foreach ($tables as $tblval) {
            $query = mysql_query("SHOW FIELDS FROM `{$tblval}`");
            while ($row = mysql_fetch_row($query)) {
                $fields[] = $row[0];
            }
            foreach ($fields as $field) {
                $FieldType[$tblval][$field->Field] = preg_replace("/[(0-9)]/", '', $field->Type);
            }
        }
    }
    if ($OutDest == "local") {
        $fp = fopen($sqlfile, "w");
        if (!$fp) {
            $databaseResult = LM_DATABASE_BACKUP_FAILED;
            return;
        }
    }
    /* Build the fancy header on the dump file */
    $OutBuffer = "";
    if ($OutType == 'html') {
    } else {
        $OutBuffer .= "#\n";
        $OutBuffer .= "# Powered by XCloner Site Backup\n";
        $OutBuffer .= "# http://www.xcloner.com\n";
        $OutBuffer .= "#\n";
        $OutBuffer .= "# Host: " . $_SERVER['HTTP_HOST'] . "\n";
        $OutBuffer .= "# Generation Time: " . date("M j, Y \\a\\t H:i") . "\n";
        $OutBuffer .= "# Server version: " . getVersion() . "\n";
        $OutBuffer .= "# PHP Version: " . phpversion() . "\n";
        $OutBuffer .= "# Database : `" . $dbname . "`\n# --------------------------------------------------------\n";
    }
    fwrite($fp, $OutBuffer);
    unset($OutBuffer);
    /* Okay, here's the meat & potatoes */
    foreach ($tables as $tblval) {
        if ($toBackUp != "data") {
            if ($OutType == 'html') {
            } else {
                $OutBuffer .= "#\n# Table structure for table `{$tblval}`\n#\n";
                if ($_REQUEST['dbbackup_drop']) {
                    $OutBuffer .= "#\nDROP table IF EXISTS `{$tblval}`;\n";
                }
                $OutBuffer .= $CreateTable[$tblval] . ";\r\n";
            }
        }
        fwrite($fp, $OutBuffer);
        unset($OutBuffer);
        if ($toBackUp != "structure") {
            $OutBuffer .= "#\n# Dumping data for table `{$tblval}`\n#\n";
            $query = @mysql_query("SELECT *  FROM `{$tblval}`");
            while ($row = @mysql_fetch_array($query, MYSQL_ASSOC)) {
                $InsertDump = "INSERT INTO `{$tblval}` VALUES (";
                $arr = $row;
                foreach ($arr as $key => $value) {
                    $value = mysql_real_escape_string($value);
                    $InsertDump .= "'{$value}',";
                    /*else
                      {
                      $InsertDump .= "'$value',";
                      } */
                }
                $OutBuffer .= rtrim($InsertDump, ',') . ");\n";
                fwrite($fp, $OutBuffer);
                unset($OutBuffer);
                $i++;
            }
        }
    }
    if ($OutDest == "local") {
        //fwrite($fp, $OutBuffer);
        fclose($fp);
        @chmod($sqlfile, 0777);
        $databaseResult = LM_DATABASE_BACKUP_COMPLETED . ' ( ' . getFileSizeText(get_filesize($sqlfile)) . ' )';
        return $sqlfile;
    }
}
Пример #7
0
    $pconfig['do_action'] = false;
    $pconfig['action'] = "";
    $pconfig['disk'] = "";
    $pconfig['oldpassphrase'] = "";
    $pconfig['passphrase'] = "";
}
if (isset($_GET['disk'])) {
    $pconfig['disk'] = $_GET['disk'];
}
if (isset($_GET['action'])) {
    $pconfig['action'] = $_GET['action'];
}
if ("backup" === $pconfig['action']) {
    $fn = "/var/tmp/{$geli['name']}.metadata";
    mwexec("/sbin/geli backup {$geli['device'][0]} {$fn}");
    $fs = get_filesize($fn);
    header("Content-Type: application/octet-stream");
    header("Content-Disposition: attachment; filename={$geli['name']}.metadata");
    header("Content-Length: {$fs}");
    readfile($fn);
    unlink($fn);
    exit;
}
if ("restore" === $pconfig['action']) {
    if (is_uploaded_file($_FILES['backupfile']['tmp_name'])) {
        $fn = "/var/tmp/{$geli['name']}.metadata";
        // Move the metadata backup file so PHP won't delete it.
        move_uploaded_file($_FILES['backupfile']['tmp_name'], $fn);
    } else {
        $errormsg = sprintf("%s %s", gettext("Failed to upload file."), $g_file_upload_error[$_FILES['backupfile']['error']]);
    }
Пример #8
0
function getBackupFiles(&$d_arr, &$f_arr, &$s_arr, &$d, &$f)
{
    // ----------------------------------------------------------
    // Routine to list the existing backup files in the Component
    // Backup folder
    // ----------------------------------------------------------
    global $_CONFIG;
    $path = $_CONFIG['clonerPath'];
    # Open possibly available directory
    if (is_dir($path)) {
        if ($handle = opendir($path)) {
            while (false !== ($file = readdir($handle))) {
                # Make sure we don't push parental directories or dotfiles (unix) into the arrays
                if ($file != "." && $file != ".." && $file[0] != ".") {
                    if (is_dir($path . "/" . $file)) {
                        # Create array for directories
                        $d_arr[$d++] = $file;
                    } else {
                        if (strstr($file, '.zip') || strstr($file, '.tgz') || strstr($file, '.tar')) {
                            # Create array for files
                            $f_arr[$f++] = $file;
                        }
                    }
                }
            }
        }
    }
    # Wrap things up if we're in a directory
    if (is_dir($path)) {
        closedir($handle);
    }
    sort($f_arr);
    # Print file list
    for ($i = 0; $i < count($f_arr); $i++) {
        $s_arr[$i] = getFileSizeText(get_filesize($path . "/" . $f_arr[$i]));
    }
}
Пример #9
0
                echo '<B>' . htmlentities(str_replace('.', ' ', basename(substr($filename, 0, strrpos($filename, '.'))))) . '</B><BR/>';
                echo '<BR/>';
                echo $percent . '%<BR/>';
                echo 'Estimated data usage : ' . $totalsize . '<BR/>';
                echo '<BR/>';
                echo '<A HREF="/3gp/wait.php?ticket=' . $ticket . '&refresh=' . $refresh . '">Refresh</A><BR/>';
                echo '<BR/>';
                echo '<A HREF="/Browser">Back to the Browser</a>';
                echo '</center>';
            }
        }
        if ($keyed) {
            echo '<CENTER><BR/>';
            echo '<B>' . htmlentities(str_replace('.', ' ', basename(substr($filename, 0, strrpos($filename, '.'))))) . '<BR/></B>Is Ready!';
            echo '<BR/><BR/><BR/>';
            echo 'Total Size : ' . get_filesize(filesize($tmpfolder . '/publish/' . $ticket . '.3gp'));
            echo '<BR/><BR/><A HREF="rtsp://cerberus.viper-7.com/' . $ticket . '.3gp">Watch Now</A><BR/>';
            echo '<BR/>';
            echo '<A HREF="/Browser">Back to the Browser</a></CENTER><BR/>';
        }
    }
}
?>
	</TD>
</TR>
</TABLE>
								</td>
								<td width=15 background='images/right.jpg'></td>
							</tr>
						</table>
					</td>
Пример #10
0
                return;
            }

            var objTbl;
            var objRow;
            var objCell;
            if (document.getElementById)
                objTbl = document.getElementById("variableFiles");
            else
                objTbl = document.all["variableFiles"];

            objRow = objTbl.insertRow(objTbl.rows.length);
            objCell = objRow.insertCell(0);

            objCell.innerHTML = "<input type='file' id=bf_file_" + flen + " name='bf_file[]' title='파일 용량 <?php 
            echo get_filesize($board[bo_upload_size]);
            ?>
 이하만 업로드 가능' <?php 
            if ($mw_basic['cf_guploader']) {
                echo "multiple";
            }
            ?>
>";

	    /*
	    str = "<input type='file' id=bf_file_" + flen + " name='bf_file[]' title='파일 용량 <?php 
            echo $upload_max_filesize;
            ?>
 이하만 업로드 가능' class=mw_basic_text> ";
	    str+= " <input type='button' value='본문에 넣기' onclick=\"document.getElementById('wr_content').value += '{이미지:" + flen + "}'\"";
	    objCell.innerHTML = str;
Пример #11
0
 unset($errormsg);
 if (0 == strcmp($_POST['Submit'], gettext("Restore configuration"))) {
     $mode = "restore";
 } else {
     if (0 == strcmp($_POST['Submit'], gettext("Download configuration"))) {
         $mode = "download";
     }
 }
 if ($mode) {
     if ($mode === "download") {
         config_lock();
         if (function_exists("date_default_timezone_set") and function_exists("date_default_timezone_get")) {
             @date_default_timezone_set(@date_default_timezone_get());
         }
         $fn = "config-{$config['system']['hostname']}.{$config['system']['domain']}-" . date("YmdHis") . ".xml";
         $fs = get_filesize("{$g['conf_path']}/config.xml");
         header("Content-Type: application/octet-stream");
         header("Content-Disposition: attachment; filename={$fn}");
         header("Content-Length: {$fs}");
         header("Pragma: hack");
         readfile("{$g['conf_path']}/config.xml");
         config_unlock();
         exit;
     } else {
         if ($mode === "restore") {
             if (is_uploaded_file($_FILES['conffile']['tmp_name'])) {
                 // Validate configuration backup
                 if (!validate_xml_config($_FILES['conffile']['tmp_name'], $g['xml_rootobj'])) {
                     $errormsg = sprintf(gettext("The configuration could not be restored. %s"), gettext("Invalid file format."));
                 } else {
                     // Install configuration backup
Пример #12
0
function validate_doc_files(&$h)
{
    global $glob;
    $badfiles = array();
    foreach (preg_split("/,\\s*/", $h['doc_files']) as $file) {
        if ($file) {
            $path = $glob['image_src_path'] . "/" . $file;
            if (file_exists($path)) {
                $size = get_filesize($path);
                if ($size <= 0) {
                    $badfiles[] = "'" . $file . "'";
                }
            } else {
                $badfiles[] = "'" . $file . "'";
            }
        }
    }
    if (count($badfiles) > 0) {
        $h['doc_files_error_message'] = "can't read doc_file(s): " . join(",", $badfiles);
        return false;
    }
    return true;
}
Пример #13
0
 protected function append_enclosure($url)
 {
     if (!($size = get_filesize($url))) {
         $size = "unknown";
     }
     //     $size = 1000;
     switch (strtolower(pathinfo($url, PATHINFO_EXTENSION))) {
         case "jpg":
         case "jpeg":
             $type = "image/jpeg";
             break;
         case "gif":
             $type = "image/gif";
             break;
         case "png":
             $type = "image/png";
             break;
         case "mpeg":
         case "mpg":
         case "mpe":
             $type = "video/mpeg";
             break;
         case "avi":
             $type = "video/x-msvideo";
             break;
         case "mov":
         case "qt":
             $type = "video/quicktime";
             break;
         case "tif":
         case "tiff":
             $type = "image/tiff";
             break;
         case "bmp":
             $type = "image/bmp";
             break;
         case "ppt":
         case "pps":
             $type = "application/powerpoint";
             break;
         case "pdf":
             $type = "application/pdf";
             break;
         case "xls":
             $type = "application/excel";
             break;
         case "zip":
             $type = "application/zip";
             break;
         case "doc":
             $type = "application/msword";
             break;
         case "mp3":
             $type = "audio/mpeg3";
             break;
         case "ogg":
             $type = "audio/ogg";
             break;
         case "wma":
             $type = "audio/x-ms-wma";
             break;
         default:
             //no valid mime type found
             return FALSE;
     }
     return array('url' => $url, 'size' => $size, 'type' => $type);
 }
Пример #14
0
@fwrite($f, "");
@fclose($f);
@chmod($indexfile, 0606);
$file = $_FILES['comment_image'];
$file['name'] = get_safe_filename($file['name']);
$size = @getImageSize($file['tmp_name']);
$mime = array('image/png', 'image/jpeg', 'image/gif');
$exts = array('png', 'jpg', 'gif');
if ($size[0] > $cf_x) {
    alert("가로사이즈가 {$cf_x}px 보다 큽니다.");
}
if ($size[1] > $cf_y) {
    alert("세로사이즈가 {$cf_y}px 보다 큽니다.");
}
if ($file['size'] > $cf_size) {
    alert("파일용량이 " . get_filesize($cf_size) . " 보다 큽니다.");
}
$ext = substr($file['name'], strlen($file['name']) - 3, 3);
if ($image_del) {
    @unlink($dest_file);
}
if (is_uploaded_file($file['tmp_name'])) {
    if (!in_array($size['mime'], $mime)) {
        alert_close("PNG, GIF, JPG 형식의 이미지 파일만 업로드 가능합니다.");
    }
    if (!in_array($ext, $exts)) {
        alert_close("PNG, GIF, JPG 형식의 이미지 파일만 업로드 가능합니다.");
    }
    if (!is_dir($path)) {
        alert_close("{$path} 디렉토리가 존재하지 않습니다.");
    }
Пример #15
0
function output($dir, $list)
{
    $wf = new Workflows();
    $parent = dirname($dir);
    if ($dir != '/') {
        $icon_name = $parent == '/' ? 'HomeFolderIcon.icns' : 'BackwardArrowIcon.icns';
        $wf->result(0, $parent . ($parent == '/' ? '' : '/'), ".. ({$parent})", "Goto parent directory", $GLOBALS["icon_path"] . $icon_name);
    }
    foreach ($list as $index => $entry) {
        $info = pathinfo($entry['name']);
        $path = (substr($dir, -1) == '/' ? $dir : "{$dir}/") . $entry["name"];
        // TODO: need to optimize performance in loop
        if ($entry["flag"] == 'd') {
            $path = "{$path}/";
            $icon = $GLOBALS["icon_path"] . (getCachedItem($path) ? 'DropFolderIcon.icns' : 'GenericFolderIcon.icns');
        } else {
            $icon = array_key_exists('extension', $info) ? "filetype:." . $info['extension'] : $GLOBALS["icon_path"] . 'GenericDocumentIcon.icns';
        }
        $wf->result($index + 1, $path, $entry["name"], ($entry["flag"] == '-' ? get_filesize($entry["size"]) . '. ' : '') . "Last modified: " . $entry["lastmodifieddate"], $icon, $entry["flag"] == '-');
    }
    echo $wf->toxml();
}
Пример #16
0
function log_download($loginfo)
{
    if (!is_array($loginfo)) {
        return;
    }
    $fs = get_filesize($loginfo['logfile']);
    header("Content-Type: application/octet-stream");
    header("Content-Disposition: attachment; filename={$loginfo['filename']}");
    header("Content-Length: {$fs}");
    header("Pragma: hack");
    switch ($loginfo['type']) {
        case "clog":
            exec("/usr/sbin/clog {$loginfo['logfile']}", $content);
            echo implode("\n", $content);
            break;
        case "plain":
            readfile($loginfo['logfile']);
    }
}
Пример #17
0
.ci_button { background-color:#efefef; cursor:pointer; }
.ci_buttons { text-align:center; margin:50px 0 0 0; }
</style>

<div class="ci_title"> ▶ 회원사진등록 </div>

<div class="ci_info">
댓글에 출력되는 사진을 업로드하실 수 있습니다.<br/>
가로 <?php 
echo $cf_x;
?>
px, 세로 <?php 
echo $cf_y;
?>
px 사이즈, <?php 
echo get_filesize($cf_size);
?>
 byte 용량이하의<br/> jpg, gif, png 이미지만 등록해주세요.<br/><br/>

<form method="post" action="mw.comment.image.update.php" enctype="multipart/form-data">
<input type="hidden" name="bo_table" value="<?php 
echo $bo_table;
?>
">
<input type="hidden" name="mb_id" value="<?php 
echo $mb_id;
?>
">
<input type="file" size="30" class="ci_file" name="comment_image"><br/>

<?php 
 function show_all_files($path)
 {
     if (!is_dir($path)) {
         return "No such directory : " . $path;
     }
     chdir($path);
     $output = "";
     $allfiles = $allfolders = array();
     if ($res = opendir($path)) {
         while ($file = readdir($res)) {
             if ($file != '.' && $file != "..") {
                 if (is_dir($file)) {
                     $allfolders[] = $file;
                 } elseif (is_file($file)) {
                     $allfiles[] = $file;
                 }
             }
         }
     }
     array_unshift($allfolders, ".");
     $cur = getcwd();
     chdir("..");
     if (getcwd() != $cur) {
         array_unshift($allfolders, "..");
     }
     chdir($cur);
     natcasesort($allfolders);
     natcasesort($allfiles);
     $cols = array();
     if (is_win()) {
         $cols = array("perms" => "get_fileperms", "modified" => "get_filemtime");
     } else {
         $cols = array("owner" => "get_fileowner", "perms" => "get_fileperms", "modified" => "get_filemtime");
     }
     $totalFiles = count($allfiles);
     $totalFolders = 0;
     $output .= "<table id='xplTable' class='dataView sortable'><thead>";
     $output .= "<tr><th class='col-cbox sorttable_nosort'><div class='cBoxAll'></div></th><th class='col-name'>name</th><th class='col-size'>size</th>";
     foreach ($cols as $k => $v) {
         $output .= "<th class='col-" . $k . "'>" . $k . "</th>";
     }
     $output .= "</tr></thead><tbody>";
     foreach ($allfolders as $d) {
         $cboxException = "";
         if ($d == "." || $d == "..") {
             $action = "actiondot";
             $cboxException = " cBoxException";
         } else {
             $action = "actionfolder";
             $totalFolders++;
         }
         $output .= "\n\t<tr data-path=\"" . html_safe(realpath($d) . DIRECTORY_SEPARATOR) . "\"><td><div class='cBox" . $cboxException . "'></div></td>\n\t<td style='white-space:normal;'><a class='navigate'>[ " . html_safe($d) . " ]</a><span class='" . $action . " floatRight'>action</span></td>\n\t<td>DIR</td>";
         foreach ($cols as $k => $v) {
             $sortable = "";
             if ($k == 'modified') {
                 $sortable = " title='" . filemtime($d) . "'";
             }
             $output .= "<td" . $sortable . ">" . $v($d) . "</td>";
         }
         $output .= "</tr>";
     }
     foreach ($allfiles as $f) {
         $output .= "\n\t<tr data-path=\"" . html_safe(realpath($f)) . "\"><td><div class='cBox'></div></td>\n\t<td style='white-space:normal;'><a class='view'>" . html_safe($f) . "</a><span class='action floatRight'>action</span></td>\n\t<td title='" . filesize($f) . "'>" . get_filesize($f) . "</td>";
         foreach ($cols as $k => $v) {
             $sortable = "";
             if ($k == 'modified') {
                 $sortable = " title='" . filemtime($f) . "'";
             }
             $output .= "<td" . $sortable . ">" . $v($f) . "</td>";
         }
         $output .= "</tr>";
     }
     $output .= "</tbody><tfoot>";
     $colspan = 1 + count($cols);
     $output .= "<tr><td><div class='cBoxAll'></div></td><td>\n\t\t<select id='massAction' class='colSpan'>\n\t\t<option disabled selected>Action</option>\n\t\t<option>cut</option>\n\t\t<option>copy</option>\n\t\t<option>paste</option>\n\t\t<option>delete</option>\n\t\t<option disabled>------------</option>\n\t\t<option>chmod</option>\n\t\t<option>chown</option>\n\t\t<option>touch</option>\n\t\t<option disabled>------------</option>\n\t\t<option>extract (tar)</option>\n\t\t<option>extract (tar.gz)</option>\n\t\t<option>extract (zip)</option>\n\t\t<option disabled>------------</option>\n\t\t<option>compress (tar)</option>\n\t\t<option>compress (tar.gz)</option>\n\t\t<option>compress (zip)</option>\n\t\t<option disabled>------------</option>\n\t\t</select>\n\t\t</td><td colspan='" . $colspan . "'></td></tr>\n\t\t<tr><td></td><td colspan='" . ++$colspan . "'>" . $totalFiles . " file(s), " . $totalFolders . " Folder(s)<span class='xplSelected'></span></td></tr>\n\t\t";
     $output .= "</tfoot></table>";
     return $output;
 }
Пример #19
0
	ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
	(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
	SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

	The views and conclusions contained in the software and documentation are those
	of the authors and should not be interpreted as representing official policies,
	either expressed or implied, of the NAS4Free Project.
*/
require "auth.inc";
require "guiconfig.inc";
$pgtitle = array(gettext("Advanced"), gettext("Execute command"));
if (isset($_POST['submit']) && $_POST['submit'] == gettext("Download") && file_exists($_POST['dlPath'])) {
    session_cache_limiter('public');
    $fd = fopen($_POST['dlPath'], "rb");
    header("Content-Type: application/octet-stream");
    header("Content-Length: " . get_filesize($_POST['dlPath']));
    header("Content-Disposition: attachment; filename=\"" . trim(htmlentities(basename($_POST['dlPath']))) . "\"");
    fpassthru($fd);
    exit;
} else {
    if (isset($_POST['submit']) && $_POST['submit'] == gettext("Upload") && is_uploaded_file($_FILES['ulfile']['tmp_name'])) {
        move_uploaded_file($_FILES['ulfile']['tmp_name'], "/tmp/" . $_FILES['ulfile']['name']);
        $ulmsg = "Uploaded file to /tmp/{$_FILES['ulfile']['name']}";
        unset($_POST['txtCommand']);
    }
}
$pglocalheader = <<<EOD
<style type="text/css">
<!--
pre {
   border: 2px solid #435370;
Пример #20
0
    ?>
<tr><?php 
    if (!READONLY) {
        ?>
<td class="gray"></td><?php 
    }
    ?>
<td class="gray" colspan="5">
<?php 
    _e('Full size:');
    ?>
 <span title="<?php 
    printf(__('%s byte'), $all_files_size);
    ?>
"><?php 
    echo get_filesize($all_files_size);
    ?>
</span>,
<?php 
    _e('files:');
    ?>
 <?php 
    echo $num_files;
    ?>
,
<?php 
    _e('folders:');
    ?>
 <?php 
    echo $num_folders;
    ?>
Пример #21
0
/**
 * 写日志
 * @param string $log   日志信息
 * @param string $type  日志类型 [system|app|...]
 * @param string $level 日志级别
 * @return boolean
 */
function write_log($log, $type = 'default', $level = 'log')
{
    $now_time = date('[y-m-d H:i:s]');
    $now_day = date('Y_m_d');
    // 根据类型设置日志目标位置
    $target = LOG_PATH . strtolower($type) . '/';
    mk_dir($target, 0777);
    if (!is_writable($target)) {
        exit('path can not write!');
    }
    switch ($level) {
        // 分级写日志
        case 'error':
            $target .= 'Error_' . $now_day . '.log';
            break;
        case 'warning':
            $target .= 'Warning_' . $now_day . '.log';
            break;
        case 'debug':
            $target .= 'Debug_' . $now_day . '.log';
            break;
        case 'info':
            $target .= 'Info_' . $now_day . '.log';
            break;
        case 'db':
            $target .= 'Db_' . $now_day . '.log';
            break;
        default:
            $target .= 'Log_' . $now_day . '.log';
            break;
    }
    //检测日志文件大小, 超过配置大小则重命名
    if (file_exists($target) && get_filesize($target) <= 100000) {
        $file_name = substr(basename($target), 0, strrpos(basename($target), '.log')) . '.log';
        rename($target, dirname($target) . '/' . $file_name);
    }
    clearstatcache();
    return error_log("{$now_time} {$log}\n", 3, $target);
}
Пример #22
0
 function get_folder_size($dir)
 {
     $size = 0;
     if ($handle = opendir($dir)) {
         while (false !== ($file = readdir($handle))) {
             if ($file != '.' && $file != '..') {
                 if (is_dir("{$dir}/{$file}")) {
                     $size += $this->get_folder_size("{$dir}/{$file}");
                 } else {
                     $size += @get_filesize("{$dir}/{$file}");
                 }
             }
         }
     }
     return $size;
 }
Пример #23
0
 while (count($log) < 2) {
     fseek($file, filesize($tmpfolder . '/' . $ticket . '.log') - $seek);
     $log = fread($file, 4096);
     $log = split("frame=", $log);
     $seek += 4096;
 }
 fclose($file);
 while (count($log) > 1) {
     array_shift($log);
 }
 $log = 'frame' . trim($log[0]);
 $frame = trim(array_shift(split('fps', array_pop(split('frame=', $log)))));
 $fps = trim(array_shift(split('q', array_pop(split('fps=', $log)))));
 $qual = trim(array_shift(split('size', array_pop(split('q=', $log)))));
 $size = trim(array_shift(split('time', array_pop(split('size=', $log)))));
 $size = get_filesize(substr($size, 0, strlen($size) - 2) * 1024);
 $time = array_shift(split(' ', array_pop(split('time=', $log))));
 $minutes = intval($time / 60);
 $seconds = str_pad(round(intval($time) % 60, 1), 2, '0', STR_PAD_LEFT);
 $subseconds = substr($time - intval($time), strlen($time - intval($time)) - 1, 1);
 $bitrate = trim(array_shift(split(' ', trim(str_replace('=', '', array_pop(split('bitrate', $log)))))));
 if ($quality == 'mobile') {
     echo '<TR><TD><center>' . $ticket . '.3gp</center></TD>';
 } else {
     echo '<TR><TD><center>' . $ticket . '.flv</center></TD>';
 }
 echo '<TD><center>' . ucfirst($quality) . '</center></TD>';
 echo '<TD><center>' . $resolution . '</center></TD>';
 echo '<TD><center>' . $frame . '</center></TD>';
 echo '<TD><center>' . $fps . '</center></TD>';
 echo '<TD><center>' . $qual . '</center></TD>';
Пример #24
0
function contents_dir($current_dir, $directory)
{
    global $index;
    global $font, $direction, $order, $totalsize, $mess, $tablecolor, $lightcolor;
    global $file_out_max_caracters, $normalfontcolor, $phpExt, $hidden_dirs, $showhidden;
    global $comment_max_caracters, $datetimeformat, $logged_user_name;
    global $user_status, $activationcode, $max_filesize_to_mail, $mail_functions_enabled, $timeoffset, $grants;
    $direction = 0;
    $num_row = 0;
    // Read directory
    list($liste, $totalsize) = listing($current_dir);
    if (is_array($liste)) {
        while (list($filename, $mime) = each($liste)) {
            $num_row++;
            if (is_dir("{$current_dir}/{$filename}")) {
                if (eregi($hidden_dirs, $filename) && !$showhidden) {
                    continue;
                }
                $filenameandpath = "index.{$phpExt}?index={$index}&direction={$direction}&order={$order}&directory=";
                if ($directory != '') {
                    $filenameandpath .= "{$directory}/";
                }
                $filenameandpath .= $filename;
            } else {
                $filenameandpath = '';
                if ($directory != '') {
                    $filenameandpath .= "{$directory}/";
                }
                $filenameandpath .= $filename;
            }
            $dir_protegidos = array('Biblioteca', 'Recursos educativos', 'Departamentos');
            $subdir_protegidos = array('Recursos educativos', 'Departamentos');
            echo "    <tr>\n";
            echo "      <td>\n";
            echo "        <img src=\"images/" . get_mimetype_img("{$current_dir}/{$filename}") . "\" width=\"32\" alt=\"\">\n";
            if (is_dir("{$current_dir}/{$filename}")) {
                echo "<a href=\"{$filenameandpath}\">";
            }
            if (strlen($filename) > $file_out_max_caracters) {
                echo htmlspecialchars(substr($filename, 0, $file_out_max_caracters - 4) . '...', ENT_QUOTES, 'ISO-8859-1');
            } else {
                echo htmlspecialchars($filename, ENT_QUOTES, 'ISO-8859-1');
            }
            if (is_dir("{$current_dir}/{$filename}")) {
                echo "</a>";
            }
            echo "        {$content}\n";
            echo "      </td>\n";
            echo "      <td nowrap>\n";
            if ($grants[$user_status][DELALL] || $upl_user == $logged_user_name && $grants[$user_status][DELOWN]) {
                if (!is_dir("{$current_dir}/{$filename}")) {
                    echo "<a href=\"index.{$phpExt}?index={$index}&action=deletefile&filename={$filename}&directory={$directory}\" data-bb=\"confirm-delete\" rel=\"tooltip\" title=\"Eliminar\"><span class=\"fa fa-trash-o fa-lg fa-fw\" alt=\"{$mess['169']}\"></span></a>";
                } else {
                    if ($grants[$user_status][DELALL]) {
                        if (!in_array($filename, $dir_protegidos) && !in_array($directory, $subdir_protegidos) || in_array($directory, $subdir_protegidos) && stristr($_SESSION['cargo'], '1') == TRUE) {
                            echo "<a href=\"index.{$phpExt}?index={$index}&action=deletedir&filename={$filename}&directory={$directory}\" data-bb=\"confirm-delete\" rel=\"tooltip\" title=\"Eliminar\"><span class=\"fa fa-trash-o fa-lg fa-fw\" alt=\"{$mess['169']}\"></span></a>";
                        }
                    }
                }
            }
            if ($grants[$user_status][MODALL] || $upl_user == $logged_user_name && $grants[$user_status][MODOWN]) {
                if (!in_array($filename, $dir_protegidos) && !in_array($directory, $subdir_protegidos)) {
                    // RENOMBRAR
                    echo "<a href=\"#\" data-toggle=\"modal\" data-target=\"#modal_{$num_row}\" rel=\"tooltip\" title=\"Renombrar\"><span class=\"fa fa-edit fa-lg fa-fw\" alt=\"Renombrar\"></span></a>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<div id=\"modal_{$num_row}\" class=\"modal fade\">\n\t\t\t\t\t\t  <div class=\"modal-dialog\">\n\t\t\t\t\t\t  \t<form method=\"post\" action=\"\">\n\t\t\t\t\t\t\t    <div class=\"modal-content\">\n\t\t\t\t\t\t\t      <div class=\"modal-header\">\n\t\t\t\t\t\t\t        <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Cerrar\"><span aria-hidden=\"true\">&times;</span></button>\n\t\t\t\t\t\t\t        <h4 class=\"modal-title\">Renombrar</h4>\n\t\t\t\t\t\t\t      </div>\n\t\t\t\t\t\t\t      <div class=\"modal-body\">\n\t\t\t\t\t\t\t        \t\t\n\t\t\t\t\t        \t\t<input type=\"hidden\" name=\"action\" value=\"rename\">\n\t\t\t\t\t        \t\t<input type=\"hidden\" name=\"directory\" value=\"{$directory}\">\n\t\t\t\t\t        \t\t<input type=\"hidden\" name=\"filename\" value=\"{$filename}\">\n\t\t\t\t\t        \t\t<input type=\"hidden\" name=\"index\" value=\"{$index}\">\n\t\t\t\t\t        \t\t<input type=\"hidden\" name=\"direction\" value=\"{$direction}\">\n\t\t\t\t\t        \t\t\n\t\t\t\t\t\t        \t<div class=\"form-group\">\n\t\t\t\t\t\t        \t\t<label for=\"userfile\">Nuevo nombre</label>\n\t\t\t\t\t        \t\t\t<input type=\"text\" class=\"form-control\" id=\"userfile\" name=\"userfile\" value=\"{$filename}\" maxlenght=\"250\">\n\t\t\t\t\t        \t\t</div>\n\t\t\t\t\t\t\t        \t\n\t\t\t\t\t\t\t      </div>\n\t\t\t\t\t\t\t      <div class=\"modal-footer\">\n\t\t\t\t\t\t\t        <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\">Cancelar</button>\n\t\t\t\t\t\t\t        <button type=\"submit\" class=\"btn btn-primary\">Renombrar</button>\n\t\t\t\t\t\t\t      </div>\n\t\t\t\t\t\t\t    </div><!-- /.modal-content -->\n\t\t\t\t\t\t\t   </form>\n\t\t\t\t\t\t  </div><!-- /.modal-dialog -->\n\t\t\t\t\t\t</div><!-- /.modal -->";
                }
                if (!is_dir("{$current_dir}/{$filename}") || $grants[$user_status][MODALL]) {
                }
            }
            if ($grants[$user_status][DOWNLOAD] && !is_dir("{$current_dir}/{$filename}")) {
                // DESCARGAR ARCHIVO
                echo "<a href=\"index.{$phpExt}?index={$index}&action=downloadfile&filename={$filename}&directory={$directory}\" rel=\"tooltip\" title=\"Descargar\"><span class=\"fa fa-cloud-download fa-lg fa-fw\" alt=\"{$mess['23']}\"></span></a>";
            }
            if ($_GET['index'] == 'privado' && !is_dir("{$current_dir}/{$filename}")) {
                // COMPARTIR ARCHIVO
                if (isset($directory)) {
                    $share_string = urlencode("<br><br>Archivo adjunto:<br><span class=\"fa fa-download fa-fw\"></span> <a href=\"http://" . $_SERVER['SERVER_NAME'] . "/intranet/varios/" . $_SESSION['ide'] . "/{$directory}/{$filename}\" target=\"_blank\">{$filename}</a>");
                } else {
                    $share_string = urlencode("<br><br>Archivo adjunto:<br><span class=\"fa fa-download fa-fw\"></span> <a href=\"http://" . $_SERVER['SERVER_NAME'] . "/intranet/varios/" . $_SESSION['ide'] . "/{$filename}\" target=\"_blank\">{$filename}</a>");
                }
                echo "<a href=\"../admin/mensajes/redactar.php?texto={$share_string}\" rel=\"tooltip\" title=\"Compartir\"><span class=\"fa fa-share-alt fa-lg fa-fw\" alt=\"{$mess['23']}\"></span></a>";
            }
            echo "</td>";
            echo "<td class=\"hidden-xs hidden-sm\" nowrap>";
            echo "<span class=\"text-muted\">";
            // TIPO DE ARCHIVO
            if (is_dir("{$current_dir}/{$filename}")) {
                echo "directorio";
            } else {
                echo get_filesize("{$current_dir}/{$filename}");
            }
            echo "</span>";
            echo "</td>";
            echo "<td class=\"hidden-xs hidden-sm\" nowrap>";
            // FECHA DE MODIFICACIÓN
            $file_modif_time = filemtime("{$current_dir}/{$filename}") - $timeoffset * 3600;
            echo "<span class=\"text-muted\">" . date($datetimeformat, $file_modif_time) . "</span>";
            echo "</td>\n";
            echo "</tr>\n";
        }
    }
}
Пример #25
-1
function apms_get_torrent($attach, $path = '')
{
    global $g5;
    $arr = array();
    $torrent = array();
    if ($path) {
        $j = 0;
        for ($i = 0; $i < count($attach); $i++) {
            if (isset($attach[$i]['source']) && $attach[$i]['source'] && $attach[$i]['view']) {
                continue;
            }
            $ext = apms_get_ext($attach[$i]['source']);
            if ($ext != 'torrent') {
                continue;
            }
            $arr[$j] = $path . '/' . $attach[$i]['file'];
            $j++;
        }
    } else {
        if (!$attach['torrent']) {
            return;
        }
        $j = 0;
        for ($i = 0; $i < count($attach); $i++) {
            if ($attach[$i]['ext'] != "6") {
                continue;
            }
            $arr[$j] = G5_DATA_PATH . '/item/' . $attach[$i]['id'] . '/' . $attach[$i]['file'];
            $j++;
        }
    }
    require_once G5_LIB_PATH . '/apms.torrent.lib.php';
    for ($i = 0; $i < count($arr); $i++) {
        $torrent_file = file_get_contents($arr[$i]);
        $torrent_array = BDecode($torrent_file);
        $torrent_hash = sha1(BEncode($torrent_array['info']));
        $torrent[$i]['name'] = $torrent_array['info']['name'];
        $torrent[$i]['magnet'] = 'magnet:?xt=urn:btih:' . $torrent_hash;
        for ($k = 0; $k < count($torrent_array['announce-list']); $k++) {
            $torrent[$i]['tracker'][$k] = $torrent_array['announce-list'][$k][0];
        }
        $torrent[$i]['comment'] = $torrent_array['comment'];
        $torrent[$i]['date'] = $torrent_array['creation date'];
        $torrent[$i]['is_size'] = $torrent_array['info']['length'] ? true : false;
        if ($torrent[$i]['is_size']) {
            $torrent[$i]['info']['name'] = $torrent_array['info']['name'];
            $torrent[$i]['info']['size'] = get_filesize($torrent_array['info']['length']);
        } else {
            $total_size = 0;
            for ($k = 0; $k < count($torrent_array['info']['files']); $k++) {
                for ($l = 0; $l < count($torrent_array['info']['files'][$k]['path']); $l++) {
                    $torrent[$i]['info']['file'][$k]['name'][$l] = $torrent_array['info']['files'][$k]['path'][$l];
                }
                $torrent[$i]['info']['file'][$k]['size'] = get_filesize($torrent_array['info']['files'][$k]['length']);
                $total_size = $total_size + $torrent_array['info']['files'][$k]['length'];
            }
            $torrent[$i]['info']['total_size'] = get_filesize($total_size);
        }
    }
    return $torrent;
}