Skip to content
This repository has been archived by the owner on Feb 23, 2021. It is now read-only.

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sunhater committed Dec 29, 2013
0 parents commit a824294
Show file tree
Hide file tree
Showing 420 changed files with 14,014 additions and 0 deletions.
19 changes: 19 additions & 0 deletions browse.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

/** This file is part of KCFinder project
*
* @desc Browser calling script
* @package KCFinder
* @version 2.52-dev
* @author Pavel Tzonkov <[email protected]>
* @copyright 2010, 2011 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";
$browser = new browser();
$browser->action();

?>
122 changes: 122 additions & 0 deletions config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
<?php

/** This file is part of KCFinder project
*
* @desc Base configuration file
* @package KCFinder
* @version 2.52-dev
* @author Pavel Tzonkov <[email protected]>
* @copyright 2010, 2011 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
*/

// IMPORTANT!!! Do not remove uncommented settings in this file even if
// you are using session configuration.
// See http://kcfinder.sunhater.com/install for setting descriptions

$_CONFIG = array(


// GENERAL SETTINGS

'disabled' => false,
'theme' => "oxygen",
'uploadURL' => "/upload",
'uploadDir' => "",

'types' => array(

// (F)CKEditor types
'files' => "",
'flash' => "swf",
'images' => "*img",

// TinyMCE types
'file' => "",
'media' => "swf flv avi mpg mpeg qt mov wmv asf rm",
'image' => "*img",
),


// IMAGE SETTINGS

'imageDriversPriority' => "imagick gmagick gd",
'jpegQuality' => 90,
'thumbsDir' => ".thumbs",

'maxImageWidth' => 0,
'maxImageHeight' => 0,

'thumbWidth' => 100,
'thumbHeight' => 100,

'watermark' => "",


// DISABLE / ENABLE SETTINGS

'denyZipDownload' => false,
'denyUpdateCheck' => false,
'denyExtensionRename' => false,


// PERMISSION SETTINGS

'dirPerms' => 0755,
'filePerms' => 0644,

'access' => array(

'files' => array(
'upload' => true,
'delete' => true,
'copy' => true,
'move' => true,
'rename' => true
),

'dirs' => array(
'create' => true,
'delete' => true,
'rename' => true
)
),

'deniedExts' => "exe com msi bat php phps phtml php3 php4 cgi pl",


// MISC SETTINGS

'filenameChangeChars' => array(/*
' ' => "_",
':' => "."
*/),

'dirnameChangeChars' => array(/*
' ' => "_",
':' => "."
*/),

'mime_magic' => "",

'cookieDomain' => "",
'cookiePath' => "",
'cookiePrefix' => 'KCFINDER_',


// THE FOLLOWING SETTINGS CANNOT BE OVERRIDED WITH SESSION SETTINGS

'_check4htaccess' => true,
//'_tinyMCEPath' => "/tiny_mce",

'_sessionVar' => &$_SESSION['KCFINDER'],
//'_sessionLifetime' => 30,
//'_sessionDir' => "/full/directory/path",

//'_sessionDomain' => ".mysite.com",
//'_sessionPath' => "/my/path",
);

?>
4 changes: 4 additions & 0 deletions core/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<Files *>
Order allow,deny
Deny from all
</Files>
196 changes: 196 additions & 0 deletions core/autoload.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
<?php

/** This file is part of KCFinder project
*
* @desc This file is included first, before each other
* @package KCFinder
* @version 2.52-dev
* @author Pavel Tzonkov <[email protected]>
* @copyright 2010, 2011 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
*
* This file is the place you can put any code (at the end of the file),
* which will be executed before any other. Suitable for:
* 1. Set PHP ini settings using ini_set()
* 2. Custom session save handler with session_set_save_handler()
* 3. Any custom integration code. If you use any global variables
* here, they can be accessed in config.php via $GLOBALS array.
* It's recommended to use constants instead.
*/


// PHP VERSION CHECK
if (substr(PHP_VERSION, 0, strpos(PHP_VERSION, '.')) < 5)
die("You are using PHP " . PHP_VERSION . " when KCFinder require at least version 5! Some systems has an option to change the active PHP version. Please refer to your hosting provider or upgrade your PHP distribution.");


// SAFE MODE CHECK
if (ini_get("safe_mode"))
die("The \"safe_mode\" PHP ini setting is turned on! You cannot run KCFinder in safe mode.");


// CMS INTEGRATION
if (isset($_GET['cms'])) {
switch ($_GET['cms']) {
case "drupal": require "integration/drupal.php";
}
}


// MAGIC AUTOLOAD CLASSES FUNCTION
function __autoload($class) {
if ($class == "uploader")
require "core/uploader.php";
elseif ($class == "browser")
require "core/browser.php";
elseif (file_exists("core/types/$class.php"))
require "core/types/$class.php";
elseif (file_exists("lib/class_$class.php"))
require "lib/class_$class.php";
elseif (file_exists("lib/helper_$class.php"))
require "lib/helper_$class.php";
}


// json_encode() IMPLEMENTATION IF JSON EXTENSION IS MISSING
if (!function_exists("json_encode")) {

function kcfinder_json_string_encode($string) {
return '"' .
str_replace('/', "\\/",
str_replace("\t", "\\t",
str_replace("\r", "\\r",
str_replace("\n", "\\n",
str_replace('"', "\\\"",
str_replace("\\", "\\\\",
$string)))))) . '"';
}

function json_encode($data) {

if (is_array($data)) {
$ret = array();

// OBJECT
if (array_keys($data) !== range(0, count($data) - 1)) {
foreach ($data as $key => $val)
$ret[] = kcfinder_json_string_encode($key) . ':' . json_encode($val);
return "{" . implode(",", $ret) . "}";

// ARRAY
} else {
foreach ($data as $val)
$ret[] = json_encode($val);
return "[" . implode(",", $ret) . "]";
}

// BOOLEAN OR NULL
} elseif (is_bool($data) || ($data === null))
return ($data === null)
? "null"
: ($data ? "true" : "false");

// FLOAT
elseif (is_float($data))
return rtrim(rtrim(number_format($data, 14, ".", ""), "0"), ".");

// INTEGER
elseif (is_int($data))
return $data;

// STRING
return kcfinder_json_string_encode($data);
}
}


// CUSTOM SESSION SAVE HANDLER CLASS EXAMPLE
//
// Uncomment & edit it if the application you want to integrate with, have
// its own session save handler. It's not even needed to save instances of
// this class in variables. Just add a row:
// new SessionSaveHandler();
// and your handler will rule the sessions ;-)

/*
class SessionSaveHandler {
protected $savePath;
protected $sessionName;
public function __construct() {
session_set_save_handler(
array($this, "open"),
array($this, "close"),
array($this, "read"),
array($this, "write"),
array($this, "destroy"),
array($this, "gc")
);
}
// Open function, this works like a constructor in classes and is
// executed when the session is being opened. The open function expects
// two parameters, where the first is the save path and the second is the
// session name.
public function open($savePath, $sessionName) {
$this->savePath = $savePath;
$this->sessionName = $sessionName;
return true;
}
// Close function, this works like a destructor in classes and is
// executed when the session operation is done.
public function close() {
return true;
}
// Read function must return string value always to make save handler
// work as expected. Return empty string if there is no data to read.
// Return values from other handlers are converted to boolean expression.
// TRUE for success, FALSE for failure.
public function read($id) {
$file = $this->savePath . "/sess_$id";
return (string) @file_get_contents($file);
}
// Write function that is called when session data is to be saved. This
// function expects two parameters: an identifier and the data associated
// with it.
public function write($id, $data) {
$file = $this->savePath . "/sess_$id";
if (false !== ($fp = @fopen($file, "w"))) {
$return = fwrite($fp, $data);
fclose($fp);
return $return;
} else
return false;
}
// The destroy handler, this is executed when a session is destroyed with
// session_destroy() and takes the session id as its only parameter.
public function destroy($id) {
$file = $this->savePath . "/sess_$id";
return @unlink($file);
}
// The garbage collector, this is executed when the session garbage
// collector is executed and takes the max session lifetime as its only
// parameter.
public function gc($maxlifetime) {
foreach (glob($this->savePath . "/sess_*") as $file)
if (filemtime($file) + $maxlifetime < time())
@unlink($file);
return true;
}
}
new SessionSaveHandler();
*/


// PUT YOUR ADDITIONAL CODE HERE

?>
Loading

0 comments on commit a824294

Please sign in to comment.