Exemple #1
0
 public function upload()
 {
     if (!MRights::can("upload")) {
         return $this->_noAuth("upload");
     }
     global $dir;
     $maxSize = MRoots::getMaxUploadSize();
     $maxSizeFormatted = MRoots::getMaxUploadSize(1);
     $files = $_FILES['files'];
     if (!$files) {
         $this->iframe(MText::_("up_too_large"));
         return null;
     }
     // Get the number of upload fields
     $rows = (int) MConfig::instance()->get("max_upload_fields", 6);
     // Check if empty
     $isEmpty = true;
     for ($t = 0; $t < $rows; $t++) {
         if (!empty($files["name"][$t])) {
             $isEmpty = false;
             break;
         }
     }
     $error = !$isEmpty ? null : MText::_("nouploadfilesselected");
     for ($t = 0; $t < $rows; $t++) {
         if (!empty($files["name"][$t])) {
             if ($files['size'][$t] <= $maxSize) {
                 $fileName = $dir . DS . $files['name'][$t];
                 $upload = move_uploaded_file($files['tmp_name'][$t], $fileName);
                 if (!$upload) {
                     $error .= MText::_("couldntupload") . ": " . $files['name'][$t] . "<br>";
                 } else {
                     if (isset($_REQUEST["unzip"][$t]) && !empty($_REQUEST["unzip"][$t])) {
                         $archive = new PclZip($fileName);
                         $status = $archive->extract(PCLZIP_OPT_PATH, $dir);
                         foreach ($status as $item) {
                             if ($item['status'] != "ok") {
                                 $error .= ' - <b>' . $item['stored_filename'] . ":</b> " . MText::_($item['status']) . '<br>';
                             }
                         }
                         //EOF foreach status
                         //Remove archive
                         MFile::remove($fileName);
                     }
                 }
             } else {
                 $error .= MText::_("couldntupload") . ": " . $files['name'][$t] . " -> " . MText::_("filetoolarge") . " " . $maxSizeFormatted . "<br>";
             }
         }
     }
     $template = null;
     if (file_exists(_FM_HOME_DIR . DS . 'templates' . DS . "afterupload.php")) {
         $template = _FM_HOME_DIR . DS . 'templates' . DS . "afterupload.php";
         $arg = array("dir" => $dir, "error" => $error);
         $this->view->add2Content(MTemplater::get($template, $arg));
     } else {
         $this->view->add2Content("Error: No after upload template!");
     }
 }
Exemple #2
0
        if (file_exists($_path)) {
            require_once $_path;
        }
    }
}
// include the general peer
includePeer("general");
require_once 'includes' . DS . 'functions.php';
require_once 'classes' . DS . 'file.php';
require_once 'classes' . DS . 'mdo.php';
require_once 'classes' . DS . 'config.php';
// Init config
$cfg = MConfig::instance();
require_once 'classes' . DS . 'rights.php';
require_once 'classes' . DS . 'roots.php';
$roots = MRoots::getInstance();
if ($roots->getCount() == 0) {
    require_once 'includes' . DS . 'nofolders.php';
}
MRights::loadAll();
// Defining the demo mode
define('_FM_IS_DEMO', (bool) $cfg->get("is_demo", false) && !MRights::userIsRoot() ? true : false);
require_once 'classes' . DS . 'object.php';
require_once 'classes' . DS . 'container.php';
require_once 'classes' . DS . 'view.php';
require_once 'classes' . DS . 'task.php';
require_once 'includes' . DS . 'version.php';
require_once 'includes' . DS . 'saved.php';
require_once 'includes' . DS . 'helpers.php';
require_once 'includes' . DS . 'icons.php';
require_once 'includes' . DS . 'filesystem.php';
Exemple #3
0
 public static function loadAll()
 {
     static $loaded;
     if (isset($loaded)) {
         return true;
     }
     $loaded = 1;
     $roots = MRoots::getInstance();
     $rootIds = $roots->getKeys();
     foreach ($rootIds as $id) {
         self::getInstance($id);
     }
     return true;
 }
 function rights()
 {
     $id = MRequest::int("id", null);
     $isSend = MRequest::int("send", 0);
     if ($isSend) {
         return $this->_rightsSave($id);
     }
     $this->view->slot("beforemenu", MRightsHelper::rootsMenuHeading());
     $roots = MRoots::getInstance();
     $this->view->slot("rootscount", $roots->getCount());
     $getFirst = 0;
     if ($id === null || !is_int($id) || $id < 0) {
         $getFirst = 1;
     } else {
         $rootFolder = $roots->get($id);
         if ($rootFolder === false) {
             $getFirst = 1;
         }
     }
     if ($getFirst) {
         $arr = $roots->getFirst();
         $id = $arr[0];
         $rootFolder = $arr[1];
     }
     $this->view->slot("rootfolderid", $id);
     $this->view->add2Menu(MRightsHelper::rootsMenu($roots->get(), $id, "rights"));
     $rights = MRights::getInstance($id);
     $content = MRightsHelper::form(MRightsHelper::rights($rights->getTree(), $id), "rights", array("id" => $id), MRequest::int("grouptab", null));
     // 		$this->view->addPreToContent($rights->getTree());
     $this->view->add2Content(MRightsHelper::rightsWrap($rootFolder->get("name"), $content));
 }
Exemple #5
0
</head>
<body>
<div class="windowWrap windowWrapOuter" style="width:500px; float:left;">
		
		<span style="margin-left: 4px;">
			<img src="<?php echo _FM_HOME_FOLDER; ?>/images/upload.png" / align="top">
			<span class="mTitle"><?php §(MText::_("upload"));?></span>
		</span>
		<br>
		
		<span style="font-size: 14px; margin-left: 4px; font-weight: bold;">
		<?php 
		$destFolder =  trim(str_replace(_START_FOLDER, "", $dir));
		$destFolder = $destFolder ? $destFolder : "";
		§(MText::_("destfolder"));?>: <?php echo '<span style="color: green;">' . MText::_("rootfolder") . '</span>' . $destFolder;?> <br/> <span <?php if($error) echo ' style="color:red;" ' ?>>
		<?php §(MText::_("max_upload"));?>: <?php  echo MRoots::getMaxUploadSize(1);?></span>
		</span>
		<?php 
			// prompt if error
			if($error){
				echo'<span style="color:red;"><br><b>'.$error.'</b></span>';
			}
		
		?>
		<form 
			action="<?php §(MURL::_("xhrupload",MURL::safePath($dir),"upload")); ?>" 
			name="mUploads" 
			enctype="multipart/form-data" 
			method="post">
			
			<table cellpadding="0" cellspacing="2" border="0" style="margin-top:5px;"><tbody>
Exemple #6
0
	$toggleFolderState = isset( $_COOKIE["mtogglefolders"] ) ? (int) $_COOKIE["mtogglefolders"] : 1 ;
	echo $toggleFolderState ? '' : '.mSelectFolder{display:none;}';
?></style>


<script language="javascript" type="text/javascript">
var isSplit = true;
var mTextURL = "<?php echo MURL::_("xhrtext"); ?>";
var mSuffixURL = "<?php echo MURL::_("xhrsuffix"); ?>";
var mainJSRootUri = "<?php echo _FM_HOME_FOLDER; ?>/js/";
var mainImageUri = "<?php echo _FM_HOME_FOLDER; ?>/images/";
var mainRootUri = "<?php echo MURL::_(); ?>";
var defaultWindowWidth = 950;
var defaultEnvironmentTop = 0;
var filesViewState = <?php echo $filesView?>;
var maxUploadSize = <?php  echo MRoots::getMaxUploadSize();?>;
</script>

<script type="text/javascript" src="<?php echo _FM_HOME_FOLDER; ?>/js/dojo.js"
	djConfig="parseOnLoad: true"></script>

<script type="text/javascript" src="<?php echo _FM_HOME_FOLDER; ?>/js/loader.js"></script>	
<script type="text/javascript" src="<?php echo _FM_HOME_FOLDER; ?>/js/text.js"></script>
<script type="text/javascript" src="<?php echo _FM_HOME_FOLDER; ?>/js/rights.js"></script>
<script type="text/javascript" src="<?php echo _FM_HOME_FOLDER; ?>/js/underline.js"></script>
<script type="text/javascript" src="<?php echo _FM_HOME_FOLDER; ?>/js/mooj.js"></script>
<script type="text/javascript" src="<?php echo _FM_HOME_FOLDER; ?>/js/waiting.js"></script>
<script type="text/javascript" src="<?php echo _FM_HOME_FOLDER; ?>/js/info.js"></script>
<script type="text/javascript" src="<?php echo _FM_HOME_FOLDER; ?>/js/xhrupload.js"></script>
<script type="text/javascript" src="<?php echo _FM_HOME_FOLDER; ?>/js/parse.js"></script>
<script type="text/javascript" src="<?php echo _FM_HOME_FOLDER; ?>/js/videojs/video.js"></script>