You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
491 lines
14 KiB
491 lines
14 KiB
8 years ago
|
<?php
|
||
|
ob_start();
|
||
|
ob_implicit_flush(0);
|
||
|
define('BASE_DIR', str_replace("\\", "/", dirname(dirname(dirname(__FILE__)))));
|
||
|
require_once(BASE_DIR . '/inc/init.php');
|
||
|
if (! check_permission('adminpanel'))
|
||
|
{
|
||
|
header('Location:/index.php');
|
||
|
exit;
|
||
|
}
|
||
|
|
||
|
$fmgmap = $_POST['fmgmap'];
|
||
|
|
||
|
if ($fmgmap == 'dir_upl')
|
||
|
{
|
||
|
|
||
|
$gmfmen = '<?php
|
||
|
error_reporting(E_ALL); // Set E_ALL for debuging
|
||
|
if (function_exists("date_default_timezone_set")) {
|
||
|
date_default_timezone_set("Europe/Moscow");
|
||
|
}
|
||
|
include_once dirname(__FILE__).DIRECTORY_SEPARATOR."elFinderConnector.class.php";
|
||
|
include_once dirname(__FILE__).DIRECTORY_SEPARATOR."elFinder.class.php";
|
||
|
include_once dirname(__FILE__).DIRECTORY_SEPARATOR."elFinderVolumeDriver.class.php";
|
||
|
include_once dirname(__FILE__).DIRECTORY_SEPARATOR."elFinderVolumeLocalFileSystem.class.php";
|
||
|
include_once dirname(__FILE__).DIRECTORY_SEPARATOR."elFinderVolumeMySQL.class.php";
|
||
|
include_once "../../../../inc/config.php";
|
||
|
include_once "../../../../inc/config.inc.php";
|
||
|
function debug($o) {
|
||
|
echo "<pre>";
|
||
|
print_r($o);
|
||
|
}
|
||
|
function logger($cmd, $voumes, $result) {
|
||
|
$log = $cmd.": [".date("d.m H:s")."] ".$voumes[0]->id()." ";
|
||
|
|
||
|
if (isset($voumes[1])) {
|
||
|
$log .= $voumes[1]->id()." ";
|
||
|
}
|
||
|
switch ($cmd) {
|
||
|
case "mkdir":
|
||
|
case "mkfile":
|
||
|
case "upload":
|
||
|
$log .= $result["added"][0]["name"];
|
||
|
break;
|
||
|
case "rename":
|
||
|
$log .= "from ".$result["removedDetails"][0]["name"]." to ".$result["added"][0]["name"];
|
||
|
break;
|
||
|
case "duplicate":
|
||
|
$log .= "src: ".$result["src"]["name"]." copy: ".$result["added"][0]["name"];
|
||
|
break;
|
||
|
case "rm":
|
||
|
$log .= $result["removedDetails"][0]["name"];
|
||
|
break;
|
||
|
default:
|
||
|
$log = "";
|
||
|
}
|
||
|
if ($log && is_dir("../../../../cache/redactor") || @mkdir("../../../../cache/redactor")) {
|
||
|
$fp = fopen("../../../../cache/redactor/log.txt", "a");
|
||
|
if ($fp) {
|
||
|
fwrite($fp, $log."\n");
|
||
|
fclose($fp);
|
||
|
}
|
||
|
}
|
||
|
return $result;
|
||
|
}
|
||
|
class elFinderSimpleLogger {
|
||
|
public function write($cmd, $voumes, $result) {
|
||
|
$log = $cmd.": [".date("d.m H:s")."] ".$voumes[0]->id()." ";
|
||
|
|
||
|
if (isset($voumes[1])) {
|
||
|
$log .= $voumes[1]->id()." ";
|
||
|
}
|
||
|
switch ($cmd) {
|
||
|
case "mkdir":
|
||
|
case "mkfile":
|
||
|
case "upload":
|
||
|
case "paste":
|
||
|
$log .= $result["added"][0]["name"];
|
||
|
break;
|
||
|
case "rename":
|
||
|
$log .= "from ".$result["removedDetails"][0]["name"]." to ".$result["added"][0]["name"];
|
||
|
break;
|
||
|
case "duplicate":
|
||
|
$log .= "src: ".$result["src"]["name"]." copy: ".$result["added"][0]["name"];
|
||
|
break;
|
||
|
case "rm":
|
||
|
$log .= $result["removedDetails"][0]["name"];
|
||
|
break;
|
||
|
default:
|
||
|
$log = "";
|
||
|
}
|
||
|
if ($log && is_dir("../../../../cache/redactor") || @mkdir("../../../../cache/redactor")) {
|
||
|
$fp = fopen("../../../../cache/redactor/log.txt", "a");
|
||
|
if ($fp) {
|
||
|
fwrite($fp, $log."\n");
|
||
|
fclose($fp);
|
||
|
}
|
||
|
}
|
||
|
return $result;
|
||
|
}
|
||
|
} // END class
|
||
|
function access($attr, $path, $data, $volume) {
|
||
|
return strpos(basename($path), ".") === 0
|
||
|
? !($attr == "read" || $attr == "write")
|
||
|
: $attr == "read" || $attr == "write";
|
||
|
}
|
||
|
class elFinderTestACL {
|
||
|
public function fsAccess($attr, $path, $data, $volume) {
|
||
|
|
||
|
if ($volume->name() == "localfilesystem") {
|
||
|
return strpos(basename($path), ".") === 0
|
||
|
? !($attr == "read" || $attr == "write")
|
||
|
: $attr == "read" || $attr == "write";
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
$acl = new elFinderTestACL();
|
||
|
function validName($name) {
|
||
|
return strpos($name, ".") !== 0;
|
||
|
}
|
||
|
$opts = array(
|
||
|
"locale" => "en_US.UTF-8",
|
||
|
"bind" => array(
|
||
|
"mkdir mkfile rename duplicate upload rm paste" => array(new elFinderSimpleLogger(), "write"),
|
||
|
),
|
||
|
"debug" => true,
|
||
|
"roots" => array(
|
||
|
array(
|
||
|
// "id" => "x5",
|
||
|
"driver" => "LocalFileSystem", // driver for accessing file system (REQUIRED)
|
||
|
"path" => "../../../../".UPLOAD_DIR, // path to files (REQUIRED)
|
||
|
"URL" => "/".UPLOAD_DIR."/", // URL to files (REQUIRED)
|
||
|
"alias" => UPLOAD_DIR,
|
||
|
"disabled" => array(),
|
||
|
"acceptedName" => "validName",
|
||
|
"uploadAllow" => array("all"),
|
||
|
"uploadDeny" => array("all"),
|
||
|
"uploadOrder" => "deny,allow",
|
||
|
"uploadOverwrite" => false,
|
||
|
"uploadMaxSize" => "128m",
|
||
|
"copyOverwrite" => false,
|
||
|
"copyJoin" => true,
|
||
|
"mimeDetect" => "internal",
|
||
|
"tmbCrop" => false,
|
||
|
"imgLib" => "gd",
|
||
|
"utf8fix" => true,
|
||
|
"attributes" => array(
|
||
|
array(
|
||
|
"pattern" => "/^\/\./",
|
||
|
"read" => false,
|
||
|
"write" => false,
|
||
|
"hidden" => true,
|
||
|
"locked" => true
|
||
|
),
|
||
|
array(
|
||
|
"pattern" => "/.tmb/",
|
||
|
"read" => false,
|
||
|
"write" => false,
|
||
|
"hidden" => true,
|
||
|
"locked" => false
|
||
|
),
|
||
|
array(
|
||
|
"pattern" => "/\.php$/",
|
||
|
"read" => false,
|
||
|
"write" => false,
|
||
|
"hidden" => true,
|
||
|
"locked" => false
|
||
|
),
|
||
|
array(
|
||
|
"pattern" => "/.quarantine/",
|
||
|
"read" => false,
|
||
|
"write" => false,
|
||
|
"hidden" => true,
|
||
|
"locked" => false
|
||
|
),
|
||
|
array(
|
||
|
"pattern" => "/\.htaccess$/",
|
||
|
"write" => false,
|
||
|
"locked" => false,
|
||
|
"hidden" => true
|
||
|
),
|
||
|
array(
|
||
|
"pattern" => "/.uploader/",
|
||
|
"read" => false,
|
||
|
"write" => false,
|
||
|
"hidden" => true,
|
||
|
"locked" => false
|
||
|
),
|
||
|
array(
|
||
|
"pattern" => "/.temp/",
|
||
|
"read" => false,
|
||
|
"write" => false,
|
||
|
"hidden" => true,
|
||
|
"locked" => false
|
||
|
)
|
||
|
),
|
||
|
)
|
||
|
)
|
||
|
);
|
||
|
header("Access-Control-Allow-Origin: *");
|
||
|
$connector = new elFinderConnector(new elFinder($opts), true);
|
||
|
$connector->run();
|
||
|
?>';
|
||
|
|
||
|
$gfo = fopen(BASE_DIR . "/lib/redactor/elfinder/php/connector_module_gmap.php", "w");
|
||
|
flock($gfo,2);
|
||
|
fwrite($gfo, $gmfmen);
|
||
|
flock($gfo,3);
|
||
|
fclose($gfo);
|
||
|
chmod(BASE_DIR . "/lib/redactor/elfinder/php/connector_module_gmap.php", 0755);
|
||
|
|
||
|
}
|
||
|
|
||
|
if ($fmgmap == 'dir_uplgmi')
|
||
|
{
|
||
|
$gmfmen = '<?php
|
||
|
error_reporting(E_ALL); // Set E_ALL for debuging
|
||
|
if (function_exists("date_default_timezone_set")) {
|
||
|
date_default_timezone_set("Europe/Moscow");
|
||
|
}
|
||
|
include_once dirname(__FILE__).DIRECTORY_SEPARATOR."elFinderConnector.class.php";
|
||
|
include_once dirname(__FILE__).DIRECTORY_SEPARATOR."elFinder.class.php";
|
||
|
include_once dirname(__FILE__).DIRECTORY_SEPARATOR."elFinderVolumeDriver.class.php";
|
||
|
include_once dirname(__FILE__).DIRECTORY_SEPARATOR."elFinderVolumeLocalFileSystem.class.php";
|
||
|
include_once dirname(__FILE__).DIRECTORY_SEPARATOR."elFinderVolumeMySQL.class.php";
|
||
|
include_once "../../../../inc/config.php";
|
||
|
include_once "../../../../inc/config.inc.php";
|
||
|
function debug($o) {
|
||
|
echo "<pre>";
|
||
|
print_r($o);
|
||
|
}
|
||
|
function logger($cmd, $voumes, $result) {
|
||
|
$log = $cmd.": [".date("d.m H:s")."] ".$voumes[0]->id()." ";
|
||
|
|
||
|
if (isset($voumes[1])) {
|
||
|
$log .= $voumes[1]->id()." ";
|
||
|
}
|
||
|
switch ($cmd) {
|
||
|
case "mkdir":
|
||
|
case "mkfile":
|
||
|
case "upload":
|
||
|
$log .= $result["added"][0]["name"];
|
||
|
break;
|
||
|
case "rename":
|
||
|
$log .= "from ".$result["removedDetails"][0]["name"]." to ".$result["added"][0]["name"];
|
||
|
break;
|
||
|
case "duplicate":
|
||
|
$log .= "src: ".$result["src"]["name"]." copy: ".$result["added"][0]["name"];
|
||
|
break;
|
||
|
case "rm":
|
||
|
$log .= $result["removedDetails"][0]["name"];
|
||
|
break;
|
||
|
default:
|
||
|
$log = "";
|
||
|
}
|
||
|
if ($log && is_dir("../../../../cache/redactor") || @mkdir("../../../../cache/redactor")) {
|
||
|
$fp = fopen("../../../../cache/redactor/log.txt", "a");
|
||
|
if ($fp) {
|
||
|
fwrite($fp, $log."\n");
|
||
|
fclose($fp);
|
||
|
}
|
||
|
}
|
||
|
return $result;
|
||
|
}
|
||
|
class elFinderSimpleLogger {
|
||
|
public function write($cmd, $voumes, $result) {
|
||
|
$log = $cmd.": [".date("d.m H:s")."] ".$voumes[0]->id()." ";
|
||
|
|
||
|
if (isset($voumes[1])) {
|
||
|
$log .= $voumes[1]->id()." ";
|
||
|
}
|
||
|
switch ($cmd) {
|
||
|
case "mkdir":
|
||
|
case "mkfile":
|
||
|
case "upload":
|
||
|
case "paste":
|
||
|
$log .= $result["added"][0]["name"];
|
||
|
break;
|
||
|
case "rename":
|
||
|
$log .= "from ".$result["removedDetails"][0]["name"]." to ".$result["added"][0]["name"];
|
||
|
break;
|
||
|
case "duplicate":
|
||
|
$log .= "src: ".$result["src"]["name"]." copy: ".$result["added"][0]["name"];
|
||
|
break;
|
||
|
case "rm":
|
||
|
$log .= $result["removedDetails"][0]["name"];
|
||
|
break;
|
||
|
default:
|
||
|
$log = "";
|
||
|
}
|
||
|
if ($log && is_dir("../../../../cache/redactor") || @mkdir("../../../../cache/redactor")) {
|
||
|
$fp = fopen("../../../../cache/redactor/log.txt", "a");
|
||
|
if ($fp) {
|
||
|
fwrite($fp, $log."\n");
|
||
|
fclose($fp);
|
||
|
}
|
||
|
}
|
||
|
return $result;
|
||
|
}
|
||
|
} // END class
|
||
|
function access($attr, $path, $data, $volume) {
|
||
|
return strpos(basename($path), ".") === 0
|
||
|
? !($attr == "read" || $attr == "write")
|
||
|
: $attr == "read" || $attr == "write";
|
||
|
}
|
||
|
class elFinderTestACL {
|
||
|
public function fsAccess($attr, $path, $data, $volume) {
|
||
|
|
||
|
if ($volume->name() == "localfilesystem") {
|
||
|
return strpos(basename($path), ".") === 0
|
||
|
? !($attr == "read" || $attr == "write")
|
||
|
: $attr == "read" || $attr == "write";
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
$acl = new elFinderTestACL();
|
||
|
function validName($name) {
|
||
|
return strpos($name, ".") !== 0;
|
||
|
}
|
||
|
$opts = array(
|
||
|
"locale" => "en_US.UTF-8",
|
||
|
"bind" => array(
|
||
|
"mkdir mkfile rename duplicate upload rm paste" => array(new elFinderSimpleLogger(), "write"),
|
||
|
),
|
||
|
"debug" => true,
|
||
|
"roots" => array(
|
||
|
array(
|
||
|
// "id" => "x5",
|
||
|
"driver" => "LocalFileSystem", // driver for accessing file system (REQUIRED)
|
||
|
"path" => "../../../../".UPLOAD_DIR, // path to files (REQUIRED)
|
||
|
"URL" => "/".UPLOAD_DIR."/", // URL to files (REQUIRED)
|
||
|
"alias" => UPLOAD_DIR,
|
||
|
"disabled" => array(),
|
||
|
"acceptedName" => "validName",
|
||
|
"uploadAllow" => array("all"),
|
||
|
"uploadDeny" => array("all"),
|
||
|
"uploadOrder" => "deny,allow",
|
||
|
"uploadOverwrite" => false,
|
||
|
"uploadMaxSize" => "128m",
|
||
|
"copyOverwrite" => false,
|
||
|
"copyJoin" => true,
|
||
|
"mimeDetect" => "internal",
|
||
|
"tmbCrop" => false,
|
||
|
"imgLib" => "gd",
|
||
|
"utf8fix" => true,
|
||
|
"attributes" => array(
|
||
|
array(
|
||
|
"pattern" => "/^\/\./",
|
||
|
"read" => false,
|
||
|
"write" => false,
|
||
|
"hidden" => true,
|
||
|
"locked" => true
|
||
|
),
|
||
|
array(
|
||
|
"pattern" => "/.tmb/",
|
||
|
"read" => false,
|
||
|
"write" => false,
|
||
|
"hidden" => true,
|
||
|
"locked" => false
|
||
|
),
|
||
|
array(
|
||
|
"pattern" => "/\.php$/",
|
||
|
"read" => false,
|
||
|
"write" => false,
|
||
|
"hidden" => true,
|
||
|
"locked" => false
|
||
|
),
|
||
|
array(
|
||
|
"pattern" => "/.quarantine/",
|
||
|
"read" => false,
|
||
|
"write" => false,
|
||
|
"hidden" => true,
|
||
|
"locked" => false
|
||
|
),
|
||
|
array(
|
||
|
"pattern" => "/\.htaccess$/",
|
||
|
"write" => false,
|
||
|
"locked" => false,
|
||
|
"hidden" => true
|
||
|
),
|
||
|
array(
|
||
|
"pattern" => "/.uploader/",
|
||
|
"read" => false,
|
||
|
"write" => false,
|
||
|
"hidden" => true,
|
||
|
"locked" => false
|
||
|
),
|
||
|
array(
|
||
|
"pattern" => "/.temp/",
|
||
|
"read" => false,
|
||
|
"write" => false,
|
||
|
"hidden" => true,
|
||
|
"locked" => false
|
||
|
)
|
||
|
),
|
||
|
),
|
||
|
array(
|
||
|
// "id" => "x5",
|
||
|
"driver" => "LocalFileSystem", // driver for accessing file system (REQUIRED)
|
||
|
"path" => "../../../../modules/gmap/images", // path to files (REQUIRED)
|
||
|
"URL" => "/modules/gmap/images/", // URL to files (REQUIRED)
|
||
|
"alias" => "modules/gmap/images",
|
||
|
"disabled" => array(),
|
||
|
"acceptedName" => "validName",
|
||
|
"uploadAllow" => array("all"),
|
||
|
"uploadDeny" => array("all"),
|
||
|
"uploadOrder" => "deny,allow",
|
||
|
"uploadOverwrite" => false,
|
||
|
"uploadMaxSize" => "128m",
|
||
|
"copyOverwrite" => false,
|
||
|
"copyJoin" => true,
|
||
|
"mimeDetect" => "internal",
|
||
|
"tmbCrop" => false,
|
||
|
"imgLib" => "gd",
|
||
|
"utf8fix" => true,
|
||
|
"attributes" => array(
|
||
|
array(
|
||
|
"pattern" => "/^\/\./",
|
||
|
"read" => false,
|
||
|
"write" => false,
|
||
|
"hidden" => true,
|
||
|
"locked" => true
|
||
|
),
|
||
|
array(
|
||
|
"pattern" => "/.tmb/",
|
||
|
"read" => false,
|
||
|
"write" => false,
|
||
|
"hidden" => true,
|
||
|
"locked" => false
|
||
|
),
|
||
|
array(
|
||
|
"pattern" => "/\.php$/",
|
||
|
"read" => false,
|
||
|
"write" => false,
|
||
|
"hidden" => true,
|
||
|
"locked" => false
|
||
|
),
|
||
|
array(
|
||
|
"pattern" => "/.quarantine/",
|
||
|
"read" => false,
|
||
|
"write" => false,
|
||
|
"hidden" => true,
|
||
|
"locked" => false
|
||
|
),
|
||
|
array(
|
||
|
"pattern" => "/\.htaccess$/",
|
||
|
"write" => false,
|
||
|
"locked" => false,
|
||
|
"hidden" => true
|
||
|
),
|
||
|
array(
|
||
|
"pattern" => "/.uploader/",
|
||
|
"read" => false,
|
||
|
"write" => false,
|
||
|
"hidden" => true,
|
||
|
"locked" => false
|
||
|
),
|
||
|
array(
|
||
|
"pattern" => "/.temp/",
|
||
|
"read" => false,
|
||
|
"write" => false,
|
||
|
"hidden" => true,
|
||
|
"locked" => false
|
||
|
)
|
||
|
),
|
||
|
),
|
||
|
)
|
||
|
);
|
||
|
header("Access-Control-Allow-Origin: *");
|
||
|
$connector = new elFinderConnector(new elFinder($opts), true);
|
||
|
$connector->run();
|
||
|
?>';
|
||
|
|
||
|
$gfo = fopen(BASE_DIR . "/lib/redactor/elfinder/php/connector_module_gmap.php", "w");
|
||
|
flock($gfo,2);
|
||
|
fwrite($gfo, $gmfmen);
|
||
|
flock($gfo,3);
|
||
|
fclose($gfo);
|
||
|
chmod(BASE_DIR . "/lib/redactor/elfinder/php/connector_module_gmap.php", 0755);
|
||
|
}
|
||
|
|
||
|
if ($fmgmap != 'dir_upl' || $fmgmap != 'dir_uplgmi')
|
||
|
{
|
||
|
header('Location:/index.php');
|
||
|
exit;
|
||
|
}
|
||
|
|
||
|
|
||
|
?>
|