Exemple #1
0
 public function getPermissions()
 {
     $module = new ModuleService();
     if (!$module->isWritableConfig()) {
         return array();
     }
     $configs = $module->getConfig();
     if (empty($configs['path'])) {
         return array();
     }
     $permissions = array();
     foreach ($configs['path'] as $path) {
         $permissions[$path] = array('type' => '可写', 'bool' => is_writable($path));
     }
     return $permissions;
 }
Exemple #2
0
        $uploadDir = $this->getMainDirectory() . $_GET['module-name'] . '/';
        if (!is_dir($uploadDir)) {
            mkdir($uploadDir);
        }
        $name = Date('YmdHis') . '_' . $name;
        if (move_uploaded_file($tempName, $uploadDir . $name)) {
            return 'File uploaded.';
        } else {
            return 'There was an error uploading the file';
        }
    }
}
require __DIR__ . '/../../Publish/lib/service/ModuleService.php';
$module = new ModuleService();
$upload_path = '../../publishModules/upload/';
if ($module->isWritableConfig()) {
    $configs = $module->getConfig();
    if (isset($configs['path']['upload_path'])) {
        $upload_path = $configs['path']['upload_path'];
    }
}
//Instantiate the class
$bigUpload = new BigUpload($upload_path);
//Set the temporary filename
$tempName = null;
if (isset($_GET['key'])) {
    $tempName = $_GET['key'];
}
if (isset($_POST['key'])) {
    $tempName = $_POST['key'];
}