예제 #1
0
 public function minify($cacheFile = null, $dir = null)
 {
     if ($dir === null) {
         $dir = dirname($_SERVER['SCRIPT_FILENAME']);
     }
     // MODIFICATION TIME FILES
     $mtFiles = array(__FILE__, $_SERVER['SCRIPT_FILENAME'], "conf/config.php");
     // GET SOURCE CODE FILES
     $files = dir::content($dir, array('types' => "file", 'pattern' => '/^.*\\.' . $this->type . '$/'));
     // GET NEWEST MODIFICATION TIME
     $mtime = 0;
     foreach (array_merge($mtFiles, $files) as $file) {
         $fmtime = filemtime($file);
         if ($fmtime > $mtime) {
             $mtime = $fmtime;
         }
     }
     $header = "Content-Type: {$this->mime[$this->type]}";
     // GET SOURCE CODE FROM CLIENT HTTP CACHE IF EXISTS
     httpCache::checkMTime($mtime, $header);
     // OUTPUT SOURCE CODE
     header($header);
     // GET SOURCE CODE FROM SERVER-SIDE CACHE
     if ($cacheFile !== null && file_exists($cacheFile) && (filemtime($cacheFile) >= $mtime || !is_writable($cacheFile))) {
         // with its distribution content
         readfile($cacheFile);
         die;
     }
     // MINIFY AND JOIN SOURCE CODE
     $source = "";
     foreach ($files as $file) {
         if (strlen($this->minCmd) && substr($file, 4, 1) != "_") {
             $cmd = str_replace("{file}", $file, $this->minCmd);
             $source .= `{$cmd}`;
         } else {
             $source .= file_get_contents($file);
         }
     }
     // UPDATE SERVER-SIDE CACHE
     if ($cacheFile !== null && (is_writable($cacheFile) || !file_exists($cacheFile) && dir::isWritable(dirname($cacheFile)))) {
         file_put_contents($cacheFile, $source);
         touch($cacheFile, $mtime);
     }
     // OUTPUT SOURCE CODE
     echo $source;
 }
예제 #2
0
 *    @author Pavel Tzonkov <*****@*****.**>
 * @copyright 2010-2014 KCFinder Project
 *   @license http://opensource.org/licenses/GPL-3.0 GPLv3
 *   @license http://opensource.org/licenses/LGPL-3.0 LGPLv3
 *      @link http://kcfinder.sunhater.com
 */
namespace kcfinder;

require "core/autoload.php";
if (!isset($_GET['lng']) || $_GET['lng'] == 'en' || $_GET['lng'] != basename($_GET['lng']) || !is_file("lang/" . $_GET['lng'] . ".php")) {
    header("Content-Type: text/javascript");
    die;
}
$file = "lang/" . $_GET['lng'] . ".php";
$mtime = @filemtime($file);
if ($mtime) {
    httpCache::checkMTime($mtime, "Content-Type: text/javascript");
}
require $file;
header("Content-Type: text/javascript");
echo "_.labels={";
$i = 0;
foreach ($lang as $english => $native) {
    if (substr($english, 0, 1) != "_") {
        echo "'" . text::jsValue($english) . "':\"" . text::jsValue($native) . "\"";
        if (++$i < count($lang)) {
            echo ",";
        }
    }
}
echo "}";
예제 #3
0
 protected function act_thumb()
 {
     $this->getDir($this->get['dir'], true);
     if (!isset($this->get['file']) || !isset($this->get['dir'])) {
         $this->sendDefaultThumb();
     }
     $file = $this->get['file'];
     if (basename($file) != $file) {
         $this->sendDefaultThumb();
     }
     $file = "{$this->thumbsDir}/{$this->type}/{$this->get['dir']}/{$file}";
     if (!is_file($file) || !is_readable($file)) {
         $file = "{$this->config['uploadDir']}/{$this->type}/{$this->get['dir']}/" . basename($file);
         if (!is_file($file) || !is_readable($file)) {
             $this->sendDefaultThumb($file);
         }
         $image = new gd($file);
         if ($image->init_error) {
             $this->sendDefaultThumb($file);
         }
         $browsable = array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG);
         if (in_array($image->type, $browsable) && $image->get_width() <= $this->config['thumbWidth'] && $image->get_height() <= $this->config['thumbHeight']) {
             $type = $image->type == IMAGETYPE_GIF ? "gif" : ($image->type == IMAGETYPE_PNG ? "png" : "jpeg");
             $type = "image/{$type}";
             httpCache::file($file, $type);
         } else {
             $this->sendDefaultThumb($file);
         }
     }
     httpCache::file($file, "image/jpeg");
 }
예제 #4
0
파일: css.php 프로젝트: alejandrozepeda/gvm
/** This file is part of KCFinder project
 *
 *      @desc Base CSS definitions
 *   @package KCFinder
 *   @version 2.21
 *    @author Pavel Tzonkov <*****@*****.**>
 * @copyright 2010 KCFinder Project
 *   @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
 *   @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
 *      @link http://kcfinder.sunhater.com
 */
require "core/autoload.php";
$mtime = @filemtime(__FILE__);
if ($mtime) {
    httpCache::checkMTime($mtime);
}
$browser = new browser();
$config = $browser->config;
ob_start();
?>
html, body {
overflow: hidden;
}

body, form, th, td {
margin: 0;
padding: 0;
}

a {
예제 #5
0
파일: browser.php 프로젝트: Fess7/evolution
 protected function act_thumb()
 {
     $this->getDir($this->get['dir'], true);
     if (!isset($this->get['file']) || !isset($this->get['dir'])) {
         $this->sendDefaultThumb();
     }
     $file = $this->get['file'];
     if (basename($file) != $file) {
         $this->sendDefaultThumb();
     }
     $file = "{$this->thumbsDir}/{$this->type}/{$this->get['dir']}/{$file}";
     if (!is_file($file) || !is_readable($file)) {
         $file = "{$this->config['uploadDir']}/{$this->type}/{$this->get['dir']}/" . basename($file);
         if (!is_file($file) || !is_readable($file)) {
             $this->sendDefaultThumb($file);
         }
         $image = image::factory($this->imageDriver, $file);
         if ($image->initError) {
             $this->sendDefaultThumb($file);
         }
         list($tmp, $tmp, $type) = getimagesize($file);
         if (in_array($type, array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG)) && $image->width <= $this->config['thumbWidth'] && $image->height <= $this->config['thumbHeight']) {
             $mime = $type == IMAGETYPE_GIF ? "gif" : ($type == IMAGETYPE_PNG ? "png" : "jpeg");
             $mime = "image/{$mime}";
             httpCache::file($file, $mime);
         } else {
             $this->sendDefaultThumb($file);
         }
     }
     httpCache::file($file, "image/jpeg");
 }
예제 #6
0
 protected function act_thumb()
 {
     if (!isset($_GET['file']) || !isset($_GET['dir']) || !$this->checkFilename($_GET['file'])) {
         $this->sendDefaultThumb();
     }
     $dir = $this->getDir();
     $file = "{$this->thumbsTypeDir}/{$_GET['dir']}/{$_GET['file']}";
     // Create thumbnail
     if (!is_file($file) || !is_readable($file)) {
         $file = "{$dir}/{$_GET['file']}";
         if (!is_file($file) || !is_readable($file)) {
             $this->sendDefaultThumb($file);
         }
         $image = image::factory($this->imageDriver, $file);
         if ($image->initError) {
             $this->sendDefaultThumb($file);
         }
         $img = new fastImage($file);
         $type = $img->getType();
         $img->close();
         if (in_array($type, array("gif", "jpeg", "png")) && $image->width <= $this->config['thumbWidth'] && $image->height <= $this->config['thumbHeight']) {
             $mime = "image/{$type}";
             httpCache::file($file, $mime);
         } else {
             $this->sendDefaultThumb($file);
         }
         // Get type from already-existing thumbnail
     } else {
         $img = new fastImage($file);
         $type = $img->getType();
         $img->close();
     }
     httpCache::file($file, "image/{$type}");
 }
예제 #7
0
파일: index.php 프로젝트: r-kitaev/limb
<?php

/** This file is part of KCFinder project
 *
 * @desc Join all JavaScript files in current directory
 * @package KCFinder
 * @version {version}
 * @author Pavel Tzonkov <*****@*****.**>
 * @copyright 2010 KCFinder Project
 * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
 * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
 * @link http://kcfinder.sunhater.com
 */
require "../../lib/helper_httpCache.php";
$files = glob("*.js");
foreach ($files as $file) {
    $fmtime = filemtime($file);
    if (!isset($mtime) || $fmtime > $mtime) {
        $mtime = $fmtime;
    }
}
httpCache::checkMTime($mtime);
header("Content-Type: text/javascript");
ob_start();
foreach ($files as $file) {
    require $file;
}
httpCache::content(ob_get_clean(), $mtime);