Example #1
0
 /**
  * Executes the current command
  *
  * @param use Symfony\Component\Console\Input\InputInterface $input
  * @param use Symfony\Component\Console\Input\OutputIterface $output
  *
  * @return null|int null or 0 if everything went fine, or an error code
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $filename = getbase() . '/crunz.yml';
     if (file_exists($filename)) {
         $output->writeln('<comment>The configuration file already exists.</comment>');
         exit;
     }
     $src = __DIR__ . '/../../../crunz.yml';
     if (copy($src, $filename)) {
         $output->writeln('<info>The configuration file was generated successfully.</info>');
         exit;
     }
     $output->writeln('<comment>There was a problem when generating the file.</comment>');
     exit;
 }
Example #2
0
<?php

set_time_limit(0);
include 'func.php';
$rootdir = getbase($_GET['base']);
if (($dir = safepath($rootdir, $_GET['dir'])) === false) {
    redirect('index.php');
}
$hash = mkhash($rootdir . $dir);
$thash = $_GET['base'] . '-' . $hash;
$hash = $_GET['base'] . '/' . $hash;
$path = rtrim(joinpath($rootdir, $dir), '/');
$apath = explode('/', $path);
$bdir = array_pop($apath);
chdir(r(implode('/', $apath)));
$zfile = $bdir . '.7z';
#header('Content-type: application/x-zip-compressed');
#header('Content-Disposition: attachment; filename*=utf-8"'.preg_replace('![\\/?]!i','',$zfile).'"');
$cmd = $CFG['sevenzip'] . ' a -t7z ' . escapeshellarg($CFG['cachedir'] . $zfile) . ' ' . escapeshellarg(r($bdir));
exe($cmd);
redirect($CFG['cacheurl'] . $zfile);
#passthru($cmd);
Example #3
0
if ($rootdir) {
    $t = renderdir($rootdir, $_GET['dir']);
    echo '<div style="font-size:10pt;">';
    echo mklink(getbasename($_GET['base']), $t['dir']);
    echo '</div>';
    if (!empty($t['index'])) {
        echo '<div style="border:solid 1px #f00; background:#dff; padding:2px; font-size:10pt; text-align:center;">這個資料夾內有幾個網頁,<a href="' . urlenc($t['index']) . '" style="color:#00f;">這裡</a>可能是首頁</div>';
    }
    if (strlen(rtrim($t['dir'], '/\\')) > 0) {
        #		echo mkitem('[上一層]','Parent','Parent','<a href="javascript:history.back();">','images/pdir.gif',null,null);
        #		echo mkitem('[上一層]','Parent','Parent','<a href="index.php?base='.$_GET['base'].'&dir='.urlencode($dir.'..').'">','images/pdir.gif',null,null);
    }
    echo $t['html'];
} else {
    foreach ($base as $k => $v) {
        getbase($k);
        echo mkitem($v[0], $v[0], $v[0], '<a href="index.php?base=' . $k . '">', 'images/dir.gif', istoday($v[1]), ($dz = udirsize($v[1])) > 0 ? '<br /><a style="float:right;" href="pack.php?base=' . $k . '"><img alt="Pack n Download" title="下載這個資料夾 - ' . fsize($dz) . '" src="images/pack.gif" /></a>' : '');
    }
}
?>
<script type="text/javascript">
$('a[name="pack"]').each(function(){
	$(this).parent().hover(function(){
		$(this).children('a[name="pack"]').css('visibility','visible')
	},function(){
		$(this).children('a[name="pack"]').css('visibility','hidden')
	})
})
function loadimg(){
	var c=0;
	$('img[thumb="true"]').each(function(){
Example #4
0
<?php

include 'func.php';
chdir($sysroot);
foreach ($base as $b) {
    $rootdir = getbase($b[0]);
    udirsize($rootdir);
}
Example #5
0
<?php

ignore_user_abort(true);
set_time_limit(0);
include 'func.php';
$job = file_get_contents('php://stdin');
$job = unserialize($job);
$rootdir = getbase($job['base']);
$file = $job['file'];
$hash = mkhash($rootdir . $file);
$thash = $job['base'] . '-' . $hash;
$hash = $job['base'] . '/' . $hash;
$size = $job['size'];
if (mylocked($thash)) {
    exit;
}
if (!ufile_exists($CFG['cachedir'] . $job['base'])) {
    umkdir($CFG['cachedir'] . $job['base']);
}
if (isvideo($file)) {
    if (newer($rootdir . $file, $CFG['cachedir'] . $hash . '.mp4') || newer($rootdir . $file, $CFG['cachedir'] . $hash . '_L.jpg') || newer($rootdir . $file, $CFG['cachedir'] . $hash . '_' . $size . '.jpg')) {
        mylock($thash) || exit;
        if (newer($rootdir . $file, $CFG['cachedir'] . $hash . '.mp4')) {
            $cmd1 = $CFG['ffmpeg'] . ' -y -i ' . escapeshellarg(r($rootdir . $file)) . ' -acodec libfaac -ab 96 -bufsize 500k -maxrate 500k -vcodec libx264 -vpre fast -crf 22 -threads 0 ' . escapeshellarg($CFG['tempdir'] . $thash . '.mp4');
            exe($cmd1);
            rmtry($CFG['cachedir'] . $hash . '.mp4');
            rmtry($CFG['cachedir'] . $hash . '_L.jpg');
            rmtry($CFG['cachedir'] . $hash . '_' . $size . '.jpg');
            $cmd2 = $CFG['yamdi'] . ' -i ' . escapeshellarg($CFG['tempdir'] . $thash . '.mp4') . ' -o ' . escapeshellarg($CFG['cachedir'] . $hash . '.mp4');
            exe($cmd2);
            if (!file_exists($CFG['cachedir'] . $hash . '.mp4')) {
Example #6
0
<?php

include 'func.php';
$gmc = new Gearmanclient();
$gmc->addServer();
$todo = array();
foreach ($base as $b) {
    $todo[] = array($b[0], '');
}
while (count($todo)) {
    list($b, $p) = array_shift($todo);
    #	echo $b.$p."\n";
    $rootdir = getbase($b);
    $fp = pathjoin($rootdir, $p);
    if (uis_dir($fp)) {
        $fs = uscandir($fp);
        foreach ($fs as $f) {
            if ($f == '.' || $f == '..') {
                continue;
            }
            $todo[] = array($b, pathjoin($p, $f));
        }
        continue;
    }
    $hash = mkhash($fp);
    $hash = $b . '/' . $hash;
    $size = $CFG['thumb_size'];
    if (isimage($fp)) {
        $t1 = $CFG['cachedir'] . $hash . '_' . $size . '.jpg';
        if (!newer($fp, $t1)) {
            touch($t1, filemtime($t1), $_now);