OSDN Git Service

初回コミット(v2.6.17.1)
[magic3/magic3.git] / scripts / elfinder-2.0 / php / connector.php
1 <?php
2 // ########## Magic3\83A\83N\83Z\83X\90§\8cä(\8aJ\8en) ##########
3 require_once('../../../include/global.php');
4
5 if (!$gAccessManager->loginedByUser()){         // \83\8d\83O\83C\83\93\92\86\82Ì\83\86\81[\83U\82Í\83A\83N\83Z\83X\82ð\8b\96\89Â
6         echo 'Access error: access denied.';
7
8         $gOpeLogManager->writeUserAccess(__METHOD__, '\83t\83@\83C\83\8b\83u\83\89\83E\83U\82Ö\82Ì\95s\90³\82È\83A\83N\83Z\83X\82ð\8c\9f\8fo\82µ\82Ü\82µ\82½\81B\83\8d\83O\83C\83\93\82È\82µ', 3001, '\83A\83N\83Z\83X\82ð\83u\83\8d\83b\83N\82µ\82Ü\82µ\82½\81B');
9         exit(0);
10 }
11 // ########## Magic3\83A\83N\83Z\83X\90§\8cä(\8fI\97¹) ##########
12 //error_reporting(0); // Set E_ALL for debuging
13
14 include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderConnector.class.php';
15 include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinder.class.php';
16 include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeDriver.class.php';
17 include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeLocalFileSystem.class.php';
18 // Required for MySQL storage connector
19 // include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeMySQL.class.php';
20 // Required for FTP connector support
21 // include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeFTP.class.php';
22
23
24 /**
25  * Simple function to demonstrate how to control file access using "accessControl" callback.
26  * This method will disable accessing files/folders starting from '.' (dot)
27  *
28  * @param  string  $attr  attribute name (read|write|locked|hidden)
29  * @param  string  $path  file path relative to volume root directory started with directory separator
30  * @return bool|null
31  **/
32 function access($attr, $path, $data, $volume) {
33         return strpos(basename($path), '.') === 0       // if file/folder begins with '.' (dot)
34                 ? !($attr == 'read' || $attr == 'write')    // set read+write to false, other (locked+hidden) set to true
35                 :  null;                                    // else elFinder decide it itself
36 }
37
38
39 // Documentation for connector options:
40 // https://github.com/Studio-42/elFinder/wiki/Connector-configuration-options
41 $opts = array(
42         // 'debug' => true,
43         'roots' => array(
44                 array(
45                         'driver'        => 'LocalFileSystem',   // driver for accessing file system (REQUIRED)
46 //                      'path'          => '../files/',         // path to files (REQUIRED)
47 //                      'URL'           => dirname($_SERVER['PHP_SELF']) . '/../files/', // URL to files (REQUIRED)
48                         'path'          => $gEnvManager->getResourcePathForUser(),         // path to files (REQUIRED)
49                         'URL'           => $gEnvManager->getRelativeResourcePathToDocumentRootForUser(), // URL to files (REQUIRED)
50                         'accessControl' => 'access'             // disable and hide dot starting files (OPTIONAL)
51                 )
52         )
53 );
54
55 // run elFinder
56 $connector = new elFinderConnector(new elFinder($opts));
57 $connector->run();
58