function save() { if (!MRights::can("edit")) { return $this->_noAuth("edit"); } global $dir; $is_close = MRequest::int("close", 0); $info = MFile::info($dir); $content = MRequest::raw("content"); $sid = MRequest::int("sid", null); MFile::writeData($dir, $content); if ($is_close) { $this->view->content('<script noCache="1"> _Delayed500(function(){ _LoadTo("' . MURL::_("xhrfiles", MURL::safePath($info->dirName)) . '", "splitInnerRight", function() { parseAll(_("splitInnerRight")); evalButtons();}); }); closePopup("Edit' . $sid . '");</script>'); } else { $this->_default(); $this->view->add2Content(' <div id="mSavedAdvice" class="savedAdvice"><div>' . MText::_("saved") . '</div></div> <script noCache="1" type="text/javascript"> dojo.addOnLoad(function(){ var node = dojo.byId("mSavedAdvice"); dojo.style(node,{opacity: 0}); _fx.fadeOpacity(node,300,0,1,function(){ setTimeout(function(){ var node = dojo.byId("mSavedAdvice"); dojo.style(node,{opacity: 1}); _fx.fadeOpacity(node,400,1,0,function(){ _removeNode(dojo.byId("mSavedAdvice")); }); },2000); }); }); </script> '); } }
function unzip() { global $dir, $file; if (!MRights::can("unzip")) { $this->popupError("unzip"); return; } $firstCount = MFile::countDir($dir); $file = _START_FOLDER . urldecode($file); $info = MFile::info($file); $archive = new PclZip($file); $status = $archive->extract(PCLZIP_OPT_PATH, $dir); $error = ""; foreach ($status as $item) { if ($item['status'] != "ok") { $error .= ' - <b>' . $item['stored_filename'] . ":</b> " . MText::_($item['status']) . '<br>'; } } if ($error != "") { $error = 'newDarkenPopup(\'error\',mText.error,\'' . $error . '\',500,250);'; } $secondCount = MFile::countDir($dir); $refresh = ""; if ($secondCount > $firstCount) { $refresh = 'refreshFolder("' . MURL::safePath($dir) . '"); '; } $this->view->add2Content('<div style="display:none;">' . md5(uniqid()) . '</div>'); $this->view->add2Content(fmGetFiles()); $this->view->add2Content('<script noCache="1">' . $refresh . $error . '</script>'); }
<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> <?php $rows = (int) MConfig::instance()->get("max_upload_fields",6); for($t=0;$t<$rows;$t++){ ?> <tr> <td valign="top" align="left"> <input type="file" name="files[]"
public function _default() { global $dir; $this->view->add2Content('<iframe src="' . MURL::_("xhrupload", MURL::safePath($dir), "iframe") . '" style="border:none; width:100%;height:300px;" frameborder="0" ></iframe>'); }
function fmGetFolders(){ global $dir; $output =""; if(!$dir) $dir = _START_FOLDER; $dirs = MFile::getDir($dir,false); $isDir = (sizeof($dirs)>0)? true:false; if($isDir){ $firstInfo = MFile::info($dir); foreach($dirs as $d){ $isSub = (MFile::hasSubDir($d->fileName))? 'plus':'spacer'; $wp =""; if( ! $d->isWritable){ $wp = '<span class=\'writeProtected\'>'.MText::_("write_protected")."</span>"; } $finfo = MText::_('folderpermission')." ".$d->mode.'<br>'.MText::_('owner').": ".$d->owner.'<br>'.$wp; $output .= '<li><div class="'.$isSub.'" droppable="folders" ></div><a href="'.MURL::_("xhrfiles",MURL::safePath($d->fileName)).'" class="closed" finfo="'.$finfo.'" url="'.MURL::safePath($d->fileName).'" chmod="'.$d->mode.'"><span>'.$d->baseName.'</span></a>'; $output .= '<ul id="off" dummy="1"></ul></li>'."\n"; }//EOF foreach }//EOF isDir return $output; }//EOF gmGetFolders
<head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Mad4Media File Manager</title> <link href="<?php echo _FM_HOME_FOLDER; ?>/css/window.css" rel="stylesheet" type="text/css" /> <link href="<?php echo _FM_HOME_FOLDER; ?>/css/environment.css" rel="stylesheet" type="text/css" /> </head> <body> <div class="windowWrap windowWrapOuter"> <div style="padding: 10px;"> <?php if(!$error):?> <span style="font-weight:bold; font-size: 24px; color:green;"> <?php echo MText::_("uploadsuccess");?> </span> <?php else:?> <span style="font-weight:bold; font-size: 24px; color:red;"> <?php echo MText::_("uploaderror");?> </span> <?php endif;?> <p><?php echo MText::_("destfolder") . ": ". ( str_replace(_START_FOLDER, "", $dir) ); ?></p> <?php if($error):?> <span style="font-weight:bold; font-size: 24px; color:red;"><?php echo MText::_("error");?></span> <p><?php echo($error);?></p> <?php endif;?> <br/><br/> <a href="<?php echo MURL::_("xhrupload",MURL::safePath($dir),"iframe"); ?>" onclick="javascript: return true;" style="width:120px; text-align:center;" class="askButton" href=""><?php echo MText::_("furtheruploads"); ?></a> </div> </div> <script>parent.filesRefresh(); //setTimeout( function(){parent.promptFadeOut()},1000);</script> </body> </html>