function tryindex($fs, $dir) { global $CFG, $RTI; $bdir = basedir($dir); $index_file = ''; $ifile = pathjoin($CFG['cachedir'], $RTI['base'], sha1($dir) . '.idx'); if (isarchive() && ($index_file = @file_get_contents($ifile)) !== false) { return $index_file; } else { foreach ($fs as $f) { if (!isweb($f)) { continue; } if (empty($index_file)) { $index_file = $f; } elseif (preg_match('/^index/i', $f)) { if (preg_match('/^index/i', $index_file)) { if (strlen(getname($f)) < strlen(getname($index_file))) { $index_file = $f; } } else { $index_file = $f; } } elseif (preg_match('/^default/i', $f)) { if (preg_match('/^default/i', $index_file)) { if (strlen(getname($f)) < strlen(getname($index_file))) { $index_file = $f; } } elseif (!preg_match('/^index/i', $index_file)) { $index_file = $f; } } elseif (levenshtein($bdir, $f) < levenshtein($bdir, $index_file) && !preg_match('/^index/i', $index_file) && !preg_match('/^default/i', $index_file)) { $index_file = $f; } } if (isarchive()) { if (!ufile_exists($CFG['cachedir'] . $RTI['base'])) { umkdir($CFG['cachedir'] . $RTI['base']); } file_put_contents($ifile, $index_file); } return $index_file; } }
<?php include 'func.php'; $rootdir = getbase($_GET['base']); if (($file = safepath($rootdir, $_GET['file'])) === false) { redirect('index.php'); } if (!ufile_exists($rootdir . $file)) { header('HTTP/1.0 404 Not Found'); die; } ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link href="common.css" rel="stylesheet" type="text/css" /> <link href="<?php echo $CFG['gcpurl']; ?> prettify.css" type="text/css" rel="stylesheet" /> <script type="text/javascript" src="<?php echo $CFG['gcpurl']; ?> prettify.js"></script> </head> <body onload="prettyPrint()"> <div style="font-size:10pt;"><?php echo mklink($_GET['base'], $_GET['file']); ?> </div> <pre class="prettyprint"><?php
<?php include 'func.php'; $rootdir = getbase($_GET['base']); if (($file = safepath($rootdir, $_GET['file'])) === false) { die; } $hash = $_GET['base'] . '/' . mkhash($rootdir . $file); if (ufile_exists($CFG['cachedir'] . $hash . '.pdf')) { redirect('http://docs.google.com/viewer?url=' . urlencode($CFG['url'] . $CFG['cacheurl'] . $hash . '.pdf?time=' . ufiletime($CFG['cachedir'] . $hash . '.pdf'))); }
<?php include 'func.php'; $rootdir = getbase($_GET['base']); if (($file = safepath($rootdir, $_GET['file'])) === false) { die; } $hash = $_GET['base'] . '/' . mkhash($rootdir . $file); if (isvideo($file)) { $ext = 'mp4'; } elseif (isaudio($file)) { $ext = 'mp3'; } if (ufile_exists($CFG['cachedir'] . $hash . '.' . $ext)) { ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link href="common.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="flowplayer/example/flowplayer-3.2.6.min.js"></script> </head> <body><!-- <?php echo $hash; ?> --> <div style="font-size:10pt;"><?php echo mklink(getbasename($_GET['base']), $file); ?> </div> <center> <span id="player" style="display:block;width:640px;height:480px"></span>
} $cmd = $CFG['imagemagick_convert'] . ' -quality 70 -geometry ' . $size . ' ' . escapeshellarg($CFG['tempdir'] . $thash . '.bmp') . ' ' . escapeshellarg($CFG['tempdir'] . $thash . '.jpg'); exe($cmd); rmtry($CFG['tempdir'] . $thash . '.bmp'); if (ufile_exists($CFG['tempdir'] . $thash . '.jpg')) { ucopy($CFG['tempdir'] . $thash . '.jpg', $CFG['cachedir'] . $hash . '_' . $size . '.jpg'); touch($CFG['cachedir'] . $hash . '_' . $size . '.jpg', ufiletime($rootdir . $file), $_now); uunlink($CFG['tempdir'] . $thash . '.jpg'); } myunlock($thash); } } elseif (isweb($file)) { if (newer($rootdir . $file, $CFG['cachedir'] . $hash . '_' . $size . '.jpg')) { mylock($thash) || exit; if (!ufile_exists($CFG['tempdir'] . $thash . '.png')) { while (ufile_exists($CFG['tempdir'] . 'firefox.lock')) { sleep(rand(5, 15)); } utouch($CFG['tempdir'] . 'firefox' . '.lock'); file_put_contents($CFG['tempdir'] . 'firefox' . '.lock', $thash); $cmd = $firefox . ' -no-remote -profile ' . escapeshellarg($ffprofile) . ' -saveimage ' . escapeshellarg('file:///' . r(urealpath($rootdir . $file))) . ' -savedelay 100 -witdh 1024'; #logger($cmd); exe($cmd); ucopy($ffdownload . 'shot.png', $CFG['tempdir'] . $thash . '.png'); uunlink($ffdownload . 'shot.png'); uunlink($CFG['tempdir'] . 'firefox' . '.lock'); $cmd = $imagemagick_identify . ' -format "%wx%h" ' . escapeshellarg($CFG['tempdir'] . $thash . '.png'); list($w, $h) = explode('x', trim(exe($cmd))); $A4 = 297 / 210; if ($h / $w > $A4) { $h = intval($w * $A4);