@ -14,137 +14,36 @@ $fmgmap = $_POST['fmgmap'];
if ($fmgmap == 'dir_upl')
if ($fmgmap == 'dir_upl')
{
{
$gmfmen = '<?php
$gmfmen = '
error_reporting(E_ALL); // Set E_ALL for debuging
<?php
if (function_exists("date_default_timezone_set")) {
error_reporting(0);
date_default_timezone_set("Europe/Moscow");
define("BASE_DIR", str_replace("\\\", "/", dirname(dirname(dirname(dirname(dirname(__FILE__)))))));
}
include_once "../../../../inc/init.php";
include_once dirname(__FILE__).DIRECTORY_SEPARATOR."elFinderConnector.class.php";
if (! check_permission("mediapool_finder"))
include_once dirname(__FILE__).DIRECTORY_SEPARATOR."elFinder.class.php";
{
include_once dirname(__FILE__).DIRECTORY_SEPARATOR."elFinderVolumeDriver.class.php";
header("Location:/index.php");
include_once dirname(__FILE__).DIRECTORY_SEPARATOR."elFinderVolumeLocalFileSystem.class.php";
exit;
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
require "./autoload.php";
elFinder::$netDrivers["ftp"] = "FTP";
function access($attr, $path, $data, $volume) {
function access($attr, $path, $data, $volume) {
return strpos(basename($path), ".") === 0
return strpos(basename($path), ".") === 0
? !($attr == "read" || $attr == "write")
? !($attr == "read" || $attr == "write")
: $attr == "read" || $attr == "write";
: null;
}
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(
$opts = array(
"locale" => "en_US.UTF-8",
"bind" => array(
"mkdir mkfile rename duplicate upload rm paste" => array(new elFinderSimpleLogger(), "write"),
),
"debug" => true,
"roots" => array(
"roots" => array(
array(
array(
// "id" => "x5",
"driver" => "LocalFileSystem",
"driver" => "LocalFileSystem", // driver for accessing file system (REQUIRED)
"path" => "../../../../" . UPLOAD_DIR,
"path" => "../../../../".UPLOAD_DIR, // path to files (REQUIRED)
"URL" => "/".UPLOAD_DIR."/",
"URL" => "/".UPLOAD_DIR."/", // URL to files (REQUIRED)
"uploadOrder" => array("deny", "allow"),
"alias" => UPLOAD_DIR,
"disabled" => array(),
"acceptedName" => "validName",
"acceptedName" => "validName",
"uploadAllow" => array("all"),
"uploadAllow" => array("all"),
"uploadDeny" => array("all"),
"uploadDeny" => array("all"),
"uploadOrder" => "deny,allow",
"uploadOverwrite" => false,
"uploadOverwrite" => false,
"uploadMaxSize" => "128m",
"uploadMaxSize" => "256m",
"copyOverwrite" => false,
"accessControl" => "access",
"copyJoin" => true,
"mimeDetect" => "internal",
"tmbCrop" => false,
"imgLib" => "gd",
"utf8fix" => true,
"attributes" => array(
"attributes" => array(
array(
array(
"pattern" => "/^\/\./",
"pattern" => "/^\/\./",
@ -179,27 +78,12 @@ $opts = array(
"write" => false,
"write" => false,
"locked" => false,
"locked" => false,
"hidden" => true
"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));
$connector = new elFinderConnector(new elFinder($opts), true);
$connector->run();
$connector->run();
?>';
?>';
@ -215,136 +99,34 @@ $connector->run();
if ($fmgmap == 'dir_uplgmi')
if ($fmgmap == 'dir_uplgmi')
{
{
$gmfmen = '<?php
$gmfmen = '<?php
error_reporting(E_ALL); // Set E_ALL for debuging
error_reporting(0);
if (function_exists("date_default_timezone_set")) {
define("BASE_DIR", str_replace("\\\", "/", dirname(dirname(dirname(dirname(dirname(__FILE__)))))));
date_default_timezone_set("Europe/Moscow");
include_once "../../../../inc/init.php";
}
if (! check_permission("mediapool_finder"))
include_once dirname(__FILE__).DIRECTORY_SEPARATOR."elFinderConnector.class.php";
{
include_once dirname(__FILE__).DIRECTORY_SEPARATOR."elFinder.class.php";
header("Location:/index.php");
include_once dirname(__FILE__).DIRECTORY_SEPARATOR."elFinderVolumeDriver.class.php";
exit;
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
require "./autoload.php";
elFinder::$netDrivers["ftp"] = "FTP";
function access($attr, $path, $data, $volume) {
function access($attr, $path, $data, $volume) {
return strpos(basename($path), ".") === 0
return strpos(basename($path), ".") === 0
? !($attr == "read" || $attr == "write")
? !($attr == "read" || $attr == "write")
: $attr == "read" || $attr == "write";
: null;
}
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(
$opts = array(
"locale" => "en_US.UTF-8",
"bind" => array(
"mkdir mkfile rename duplicate upload rm paste" => array(new elFinderSimpleLogger(), "write"),
),
"debug" => true,
"roots" => array(
"roots" => array(
array(
array(
// "id" => "x5",
"driver" => "LocalFileSystem",
"driver" => "LocalFileSystem", // driver for accessing file system (REQUIRED)
"path" => "../../../../" . UPLOAD_DIR,
"path" => "../../../../".UPLOAD_DIR, // path to files (REQUIRED)
"URL" => "/".UPLOAD_DIR."/",
"URL" => "/".UPLOAD_DIR."/", // URL to files (REQUIRED)
"uploadOrder" => array("deny", "allow"),
"alias" => UPLOAD_DIR,
"disabled" => array(),
"acceptedName" => "validName",
"acceptedName" => "validName",
"uploadAllow" => array("all"),
"uploadAllow" => array("all"),
"uploadDeny" => array("all"),
"uploadDeny" => array("all"),
"uploadOrder" => "deny,allow",
"uploadOverwrite" => false,
"uploadOverwrite" => false,
"uploadMaxSize" => "128m",
"uploadMaxSize" => "256m",
"copyOverwrite" => false,
"accessControl" => "access",
"copyJoin" => true,
"mimeDetect" => "internal",
"tmbCrop" => false,
"imgLib" => "gd",
"utf8fix" => true,
"attributes" => array(
"attributes" => array(
array(
array(
"pattern" => "/^\/\./",
"pattern" => "/^\/\./",
@ -379,42 +161,20 @@ $opts = array(
"write" => false,
"write" => false,
"locked" => false,
"locked" => false,
"hidden" => true
"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(
array(
// "id" => "x5",
"driver" => "LocalFileSystem",
"driver" => "LocalFileSystem", // driver for accessing file system (REQUIRED)
"path" => "../../../../modules/gmap/images",
"path" => "../../../../modules/gmap/images", // path to files (REQUIRED)
"URL" => "/modules/gmap/images/",
"URL" => "/modules/gmap/images/", // URL to files (REQUIRED)
"uploadOrder" => array("deny", "allow"),
"alias" => "modules/gmap/images",
"disabled" => array(),
"acceptedName" => "validName",
"acceptedName" => "validName",
"uploadAllow" => array("all"),
"uploadAllow" => array("all"),
"uploadDeny" => array("all"),
"uploadDeny" => array("all"),
"uploadOrder" => "deny,allow",
"uploadOverwrite" => false,
"uploadOverwrite" => false,
"uploadMaxSize" => "128m",
"uploadMaxSize" => "256m",
"copyOverwrite" => false,
"accessControl" => "access",
"copyJoin" => true,
"mimeDetect" => "internal",
"tmbCrop" => false,
"imgLib" => "gd",
"utf8fix" => true,
"attributes" => array(
"attributes" => array(
array(
array(
"pattern" => "/^\/\./",
"pattern" => "/^\/\./",
@ -449,30 +209,14 @@ $opts = array(
"write" => false,
"write" => false,
"locked" => false,
"locked" => false,
"hidden" => true
"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));
$connector = new elFinderConnector(new elFinder($opts), true);
$connector->run();
$connector->run();
?>';
?>';
$gfo = fopen(BASE_DIR . "/lib/redactor/elfinder/php/connector_module_gmap.php", "w");
$gfo = fopen(BASE_DIR . "/lib/redactor/elfinder/php/connector_module_gmap.php", "w");
flock($gfo,2);
flock($gfo,2);
fwrite($gfo, $gmfmen);
fwrite($gfo, $gmfmen);