Exemplo n.º 1
0
                if (!is_file($tsrc . $file)) {
                    continue;
                }
                $list[$name][] = Path::pretty($tsrc . $file);
            }
        } else {
            $list[$name][] = Path::pretty($tsrc);
        }
        return $r;
    });
}
$data = array('list' => array());
$errors = array();
foreach ($list as $name => $files) {
    foreach ($files as $file) {
        $ext = Path::getExt($file);
        if ($ext != 'php') {
            continue;
        }
        $finfo = Load::srcInfo($file);
        $text = Load::loadTEXT($file . '?type=auto');
        if (strlen($text) > 1000) {
            $res = array('title' => $name . ' ' . $finfo['name'], 'result' => 0, 'msg' => 'Слишком длинный текст', 'class' => 'bg-warning');
        } else {
            $res = Load::json_decode($text, true);
            if (!is_array($res)) {
                $res = array('result' => 0, 'msg' => 'Некорректный json ' . print_r($res, true));
            }
        }
        $res['src'] = $finfo['src'];
        $res['name'] = $finfo['file'];
Exemplo n.º 2
0
    $cachetime = 0;
}
$time = filemtime(Path::theme($isrc));
if ($re || $time > $cachetime) {
    $execute = true;
}
if (!$execute) {
    $ans = Load::loadJSON($cachesrc);
    $ans['data'] = Load::loadTEXT($cachesrc . '.data');
    if (!$ans['data']) {
        $execute = true;
    }
}
if ($execute) {
    //$data = Cache::exec(array($isrc), __FILE__, function ($src, $ignoremark, $mark, $default, $getorig, $w, $h, $crop, $top, $gray, $re) use ($isrc) {
    $ext = Path::getExt($src);
    if (in_array($ext, array('docx', 'mht'))) {
        die("docx, mht TODO");
        /*
        	TODO: Смотрим подключён ли плагин files для того чтобы достать картинку и файла
        */
        $default = true;
        $src = Imager::noImage('-imager/noimage.png');
    }
    $src = Imager::tofs($src);
    $type = Imager::getType($src);
    /*
    	if (!is_null($ignoremark)) {
    		//Метку ignore может выставить только администратор
    		//На файлы с такой меткой водяной знак никогда не ставится
    		$info = imager_makeInfo($src);
Exemplo n.º 3
0
 public static function getReal($src)
 {
     //php
     $conf = static::$conf;
     $p = explode('?', $src, 2);
     $path = $p[0];
     $query = $p[1];
     if (!$query) {
         return Path::theme($src);
     }
     if (!$path) {
         return static::getReal($query);
     } elseif (preg_match("/imager\\/p\$/", $path)) {
         $p = explode('&', $query);
         $obj = array();
         for ($i = 0, $l = sizeof($p); $i < $l; ++$i) {
             $b = explode('=', $p[$i], 2);
             $obj[$b[0]] = $b[1];
         }
         $src = $obj['src'];
         $ext = Path::getExt($src);
         if ($ext == 'php') {
             return static::getReal($obj['src']);
         } else {
             return Path::theme($src);
         }
     }
 }