Example #1
0
 public static function file($value, $inline = true, $name = '')
 {
     $size = strlen($value);
     $instance = new MFile(array('size' => $size));
     $instance->setValue($value);
     $instance->saveToCache($inline, $name);
     return $instance;
 }
Example #2
0
 public function __construct(MFile $file)
 {
     parent::__construct();
     if ($this->ajax->isEmpty()) {
         $this->ajax->setId($file->getName());
         $this->ajax->setType('file');
         $this->ajax->setData($this->page->window);
     }
     $this->content = $this->ajax->returnData();
 }
 /**
  * Creates a new model parse error exception instance
  *
  * @param MFile $modelFile The file that caused the parse error
  * @param MString|null $description The description of the error
  * @param MException|null $previous The previous exception that cause this error to
  * happen
  *
  * @return MModelParseErrorException The new exception instance
  */
 public function __construct(MFile $modelFile, MString $description = null, MException $previous = null)
 {
     $d = $description;
     if ($d == null) {
         $d = Sf("Model Parse Error on file [%s]", $modelFile->path()->stringValue());
     } else {
         $d = $d->stringByAppendingString(Sf("\nModel file: [%s]", $modelFile->path()->stringValue()));
     }
     parent::__construct($d, MException::MODEL_PARSE_ERROR_EXCEPTION_CODE, $previous);
     $this->modelFile = $modelFile;
 }
	public function postflight(){	
		define('_FM_COM', 'com_profiles');
		if(!defined('DS')) define('DS',DIRECTORY_SEPARATOR);	
		
		$lang = JFactory::getLanguage();
		define('_MY_LANGUAGE',$lang->getTag());
		define('_CLOSE_HREF','index.php');
			
		$ABSOLUTE_URI = (getenv('HTTPS') == 'on') ? substr_replace( str_replace("http://", "https://", JURI::base() ), '', -1, 1) : substr_replace(JURI::base(), '', -1, 1) . "/";
		define('_FM_ABSOLUTE_URI',$ABSOLUTE_URI);
		define('_FM_HOME_URL', "index.php?option="._FM_COM."&format=raw");
		define('_FM_HOME_FOLDER','components/'._FM_COM.'/filemanager');
		define('_FM_HOME_DIR', JPATH_ROOT . '/administrator/components/'._FM_COM.'/filemanager');
		define('_FM_LANGUAGE_DIR', _FM_HOME_DIR. DS.'languages');
		define('_FM_COOKIE_EXPIRE', time()+60*60*24*60);
		// Define Peer
		define('_FM_PEER','joomla');
			
		require_once _FM_HOME_DIR . DS . 'classes'.DS.'file.php';
		require_once _FM_HOME_DIR . DS . 'classes'.DS.'text.php';
		require_once _FM_HOME_DIR . DS .'includes'.DS.'version.php';
		
		$infoTemplates = _FM_HOME_DIR . DS ."languages" . DS . "info";
		
		$infoPath = $infoTemplates . DS . _MY_LANGUAGE . ".php" ;
		if(!MFile::is($infoPath)){
			$infoPath = $infoTemplates . DS . "en-GB.php";
		}
		
		$isWelcome = 1;
		$jed = null;
		$version=null;
		require_once $infoPath;
		
	}  //EOF install
Example #5
0
 function _default()
 {
     $heap = '{ "textEdit": {';
     $textEdit = MFile::parseData(_FM_HOME_DIR . DS . "data" . DS . "stextedit.ini", true, false);
     //All editable text based file extensions
     $count = 0;
     foreach ($textEdit as $key => $value) {
         $count++;
         $heap .= '"' . $key . '":"' . $value . '",';
     }
     $heap .= '"length": ' . $count . ' }, ' . "\n";
     //All playable files and routing to the player task
     $count = 0;
     $heap .= '"players": {';
     $players = MFile::parseData(_FM_HOME_DIR . DS . "data" . DS . "players.ini", true, false);
     foreach ($players as $key => $value) {
         $count++;
         $heap .= '"' . $key . '":"' . $value . '",';
     }
     $heap .= '"length": ' . $count . ' }, ' . "\n";
     // All compressors allowed
     $heap .= '"package": ["zip"] ' . "\n";
     // Close Main Object
     $heap .= "}";
     //Output
     $this->view->add2Content($heap);
 }
Example #6
0
 public function extract($archive, $destination, $options = array())
 {
     // Initialise variables.
     $this->_data = null;
     $this->_metadata = null;
     if (!($this->_data = MFile::read($archive))) {
         $this->set('error.message', 'Unable to read archive');
         return MError::raiseWarning(100, $this->get('error.message'));
     }
     if (!$this->_getTarInfo($this->_data)) {
         return MError::raiseWarning(100, $this->get('error.message'));
     }
     for ($i = 0, $n = count($this->_metadata); $i < $n; $i++) {
         $type = strtolower($this->_metadata[$i]['type']);
         if ($type == 'file' || $type == 'unix file') {
             $buffer = $this->_metadata[$i]['data'];
             $path = MPath::clean($destination . '/' . $this->_metadata[$i]['name']);
             // Make sure the destination folder exists
             if (!MFolder::create(dirname($path))) {
                 $this->set('error.message', 'Unable to create destination');
                 return MError::raiseWarning(100, $this->get('error.message'));
             }
             if (MFile::write($path, $buffer) === false) {
                 $this->set('error.message', 'Unable to write entry');
                 return MError::raiseWarning(100, $this->get('error.message'));
             }
         }
     }
     return true;
 }
Example #7
0
	/**
	 * 
	 * @param string $ext	the extension of the file
	 * @param int|bool $isBigIcon	path is big icons or small icons
	 */
	public static function _($ext = "default", $isBigIcon = 0){
		$ext = strtolower(trim($ext));
		$path = $isBigIcon ? _FM_HOME_DIR.DS."images".DS."bigicons".DS : _FM_HOME_DIR.DS."images".DS."icons".DS;
		$uri = $isBigIcon ? _FM_HOME_FOLDER.'/images/bigicons/' : _FM_HOME_FOLDER.'/images/icons/';
		$iconName = (isset(self::$lookUp->$ext)) ? self::$lookUp->$ext : $ext;
		$iconName = MFile::is($path.$iconName . ".png") ? $iconName : "default";
		return $uri . $iconName . ".png";
	}	
Example #8
0
 public function extract($archive, $destination, $options = array())
 {
     // Initialise variables.
     $this->_data = null;
     if (!extension_loaded('bz2')) {
         $this->set('error.message', MText::_('MLIB_FILESYSTEM_BZIP_NOT_SUPPORTED'));
         return MError::raiseWarning(100, $this->get('error.message'));
     }
     if (!isset($options['use_streams']) || $options['use_streams'] == false) {
         // Old style: read the whole file and then parse it
         if (!($this->_data = MFile::read($archive))) {
             $this->set('error.message', 'Unable to read archive');
             return MError::raiseWarning(100, $this->get('error.message'));
         }
         $buffer = bzdecompress($this->_data);
         unset($this->_data);
         if (empty($buffer)) {
             $this->set('error.message', 'Unable to decompress data');
             return MError::raiseWarning(100, $this->get('error.message'));
         }
         if (MFile::write($destination, $buffer) === false) {
             $this->set('error.message', 'Unable to write archive');
             return MError::raiseWarning(100, $this->get('error.message'));
         }
     } else {
         // New style! streams!
         $input = MFactory::getStream();
         $input->set('processingmethod', 'bz');
         // use bzip
         if (!$input->open($archive)) {
             $this->set('error.message', MText::_('MLIB_FILESYSTEM_BZIP_UNABLE_TO_READ'));
             return MError::raiseWarning(100, $this->get('error.message'));
         }
         $output = MFactory::getStream();
         if (!$output->open($destination, 'w')) {
             $this->set('error.message', MText::_('MLIB_FILESYSTEM_BZIP_UNABLE_TO_WRITE'));
             $input->close();
             // close the previous file
             return MError::raiseWarning(100, $this->get('error.message'));
         }
         do {
             $this->_data = $input->read($input->get('chunksize', 8196));
             if ($this->_data) {
                 if (!$output->write($this->_data)) {
                     $this->set('error.message', MText::_('MLIB_FILESYSTEM_BZIP_UNABLE_TO_WRITE_FILE'));
                     return MError::raiseWarning(100, $this->get('error.message'));
                 }
             }
         } while ($this->_data);
         $output->close();
         $input->close();
     }
     return true;
 }
Example #9
0
 public static function path($path, $return = null)
 {
     if (!$path) {
         return $return;
     }
     if (@get_magic_quotes_gpc()) {
         $path = stripslashes($path);
         $path = strip_tags($path);
     }
     if (!MFile::isSubDir($path, $GLOBALS['folderAccess'])) {
         return $return;
     }
     return $path;
 }
Example #10
0
 public function _default()
 {
     $infoTemplates = _FM_HOME_FOLDER . DS . "languages" . DS . "info";
     $infoPath = $infoTemplates . DS . _MY_LANGUAGE . ".php";
     if (!MFile::is($infoPath)) {
         $infoPath = $infoTemplates . DS . "en-GB.php";
     }
     $jed = "http://extensions.joomla.org/extensions/extension/core-enhancements/file-management/profiles";
     // 		$jed = null;
     $render = MTemplater::get($infoPath, array("jed" => $jed, "version" => "http://info.mad4media.com/?package=profiles&lang=" . _MY_LANGUAGE));
     $this->view->slot("jed", $jed);
     $this->view->add2Menu("");
     $this->view->add2Content($render);
 }
Example #11
0
 protected function getOptions()
 {
     // Initialize variables.
     $options = array();
     // Initialize some field attributes.
     $filter = (string) $this->element['filter'];
     $exclude = (string) $this->element['exclude'];
     $stripExt = (string) $this->element['stripext'];
     $hideNone = (string) $this->element['hide_none'];
     $hideDefault = (string) $this->element['hide_default'];
     // Get the path in which to search for file options.
     $path = (string) $this->element['directory'];
     if (!is_dir($path)) {
         $path = MPATH_ROOT . '/' . $path;
     }
     // Prepend some default options based on field attributes.
     if (!$hideNone) {
         $options[] = MHtml::_('select.option', '-1', MText::alt('MOPTION_DO_NOT_USE', preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)));
     }
     if (!$hideDefault) {
         $options[] = MHtml::_('select.option', '', MText::alt('MOPTION_USE_DEFAULT', preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)));
     }
     // Get a list of files in the search path with the given filter.
     $files = MFolder::files($path, $filter);
     // Build the options list from the list of files.
     if (is_array($files)) {
         foreach ($files as $file) {
             // Check to see if the file is in the exclude mask.
             if ($exclude) {
                 if (preg_match(chr(1) . $exclude . chr(1), $file)) {
                     continue;
                 }
             }
             // If the extension is to be stripped, do it.
             if ($stripExt) {
                 $file = MFile::stripExt($file);
             }
             $options[] = MHtml::_('select.option', $file, $file);
         }
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Example #12
0
    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>
			');
        }
    }
Example #13
0
 public static function includeScope($scopeName = null)
 {
     $scopeName = strtolower(trim($scopeName));
     if (!$scopeName) {
         return false;
     }
     $tag = _MY_LANGUAGE;
     // Tag security
     $tag = (string) preg_replace('/[^A-Za-z-]/i', '', $tag);
     $path = _FM_LANGUAGE_DIR;
     if (!file_exists($path . DS . strtolower($scopeName) . "." . $tag . ".ini")) {
         $tag = "en-GB";
     }
     $englishTextArray = MFile::parseData($path . DS . strtolower($scopeName) . ".en-GB.ini");
     $currentTextArray = MFile::parseData($path . DS . strtolower($scopeName) . "." . $tag . ".ini");
     if ($currentTextArray) {
         $newTextArray = array_merge($englishTextArray, $currentTextArray);
         self::$scope[$scopeName] = $newTextArray;
         return true;
     } else {
         self::$scope[$scopeName] = $englishTextArray;
         return false;
     }
 }
 /**
  * 
  *
  * @return MFileInputStream
  */
 public function __construct(MFile $file)
 {
     parent::__construct();
     $this->file = $file;
     $this->handle = fopen($file->path()->stringValue(), 'r');
 }
Example #15
0
//CUSTOMPLACEHOLDER
//CUSTOMPLACEHOLDER2

defined('_JEXEC') or die;


if(isset($_REQUEST["selectedFiles"])){
	if(is_array($_REQUEST["selectedFiles"])){

		foreach($_REQUEST["selectedFiles"] as & $item){
			$item = trim( MRequest::filter( urldecode($item), MREQUEST_CLEANPATH));
		}

	}else{
		$_REQUEST["selectedFiles"] = array();
	}
}


$checkPaths = array("dir","destination");

foreach($checkPaths as $variable){
	$evalPath = _START_FOLDER . stripslashes(MRequest::clean($variable,null));
	if(!MFile::isSubDir($evalPath,$GLOBALS['folderAccess']) && $evalPath !=null){
		die("No Access!");
	}
}


?>
Example #16
0
 function zip()
 {
     global $dir;
     if (!MRights::can("zip")) {
         $this->view->authError("zip");
         return;
     }
     $zipName = MRequest::clean("zipname", null);
     $zipName = stripEnd(".zip", $zipName);
     $zipName = stripEnd(".ZIP", $zipName);
     if ($zipName) {
         $zipName .= ".zip";
     } else {
         $zipName = "archive_" . date("Y-m-d-H-i") . ".zip";
     }
     $archive = new PclZip(_FM_TMP_DIR . DS . $zipName);
     $selectedFiles = $_REQUEST["selectedFiles"];
     $error = null;
     $status = $archive->add($dir, PCLZIP_OPT_REMOVE_PATH, $dir);
     if (file_exists($dir . DS . $zipName)) {
         $error = MText::_("archive_exists");
         MFile::remove(_FM_TMP_DIR . DS . $zipName);
     } else {
         MFile::move(_FM_TMP_DIR . DS . $zipName, $dir);
     }
     foreach ($status as $item) {
         if ($item['status'] != "ok" && $item['status'] != "filtered") {
             $error .= ' - <b>' . $item['stored_filename'] . ":</b> " . MText::_($item['status']) . '<br>';
         }
     }
     if ($error) {
         $this->view->add2Content("_fmError" . $error);
     } else {
         $this->view->add2Content("ok");
     }
 }
Example #17
0
 function _default()
 {
     global $dir;
     $this->authAndDie("open");
     MFile::send2Browser($dir);
 }
Example #18
0
 public function convertToPHPValue($value, $type)
 {
     if ($type == 'date') {
         return \Manager::Date($value);
     } elseif ($type == 'timestamp') {
         return \Manager::Timestamp($value);
     } elseif ($type == 'currency') {
         return \Manager::currency($value);
     } elseif ($type == 'cnpj') {
         return \MCNPJ::create($value);
     } elseif ($type == 'cpf') {
         return \MCPF::create($value);
     } elseif ($type == 'blob') {
         if ($value) {
             $value = base64_decode($value);
         }
         $value = \MFile::file($value);
         return $value;
     } else {
         return $value;
     }
 }
Example #19
0
 function chmod()
 {
     if (!MRights::can("chmod")) {
         $this->popupError("chmod");
         return;
     }
     $mode = MRequest::int('chmod', null);
     if (!$mode) {
         $error = MText::_("no_mode_set");
         $this->view->add2Content('<script noCache="1">newDarkenPopup(\'error\',mText.error,\'' . $error . '\',500,250);</script>');
         $this->view->add2Content(fmGetFiles());
         return false;
     }
     $this->view->add2Content('<div style="display:none;">' . md5(uniqid()) . '</div>');
     $selectedFiles = $_REQUEST["selectedFiles"];
     $error = null;
     foreach ($selectedFiles as $selectedFile) {
         $selectedFile = _START_FOLDER . urldecode($selectedFile);
         $selectedFile = MValidate::path($selectedFile);
         $info = MFile::info($selectedFile);
         $status = MFile::chmod($selectedFile, $mode);
         if (!$status) {
             $error .= "File: <b>" . $info->baseName . "</b> " . MText::_("mode_cannot_change") . "<br>";
         }
     }
     if ($error) {
         $this->view->add2Content('<script noCache="1">newDarkenPopup(\'error\',mText.error,\'' . $error . '\',500,250);</script>');
     }
     $this->view->add2Content(fmGetFiles());
 }
Example #20
0
 public function load($fileName = null)
 {
     if ($fileName && $this->endsWith($fileName, ".php") && MFile::isFile($fileName)) {
         try {
             $fetch = @file_get_contents($fileName);
             if ($fetch) {
                 $split = explode("/*SPLIT", $fetch);
                 if (sizeof($split) == 2) {
                     $data = str_replace("\n", "", trim($split[1]));
                     @$this->unserialize($data);
                 }
             }
         } catch (Exception $e) {
             return false;
         }
         return true;
     } else {
         return false;
     }
 }
Example #21
0
 public function __construct($id = null)
 {
     $this->path = _FM_HOME_DIR . DS . "data" . DS . "rights" . DS;
     if (!isset(self::$tree)) {
         self::$tree = MPeer::getUserGroups($this);
         self::$user = MPeer::getUser();
     }
     if ($id !== null && MFile::isFile($this->path . "rf" . $id . ".php")) {
         $this->load($id);
     } else {
         $this->createClean($id);
     }
     if ($id !== null && $id > -1) {
         $this->rootFolderId = (int) $id;
     }
     $this->calculate($id);
 }
Example #22
0
 public function open($filename, $mode = 'r', $use_include_path = false, $context = null, $use_prefix = false, $relative = false, $detectprocessingmode = false)
 {
     $filename = $this->_getFilename($filename, $mode, $use_prefix, $relative);
     if (!$filename) {
         $this->setError(MText::_('MLIB_FILESYSTEM_ERROR_STREAMS_FILENAME'));
         return false;
     }
     $this->filename = $filename;
     $this->_openmode = $mode;
     $url = parse_url($filename);
     $retval = false;
     if (isset($url['scheme'])) {
         // If we're dealing with a Moomla! stream, load it
         if (MFilesystemHelper::isMiwiStream($url['scheme'])) {
             require_once dirname(__FILE__) . '/streams/' . $url['scheme'] . '.php';
         }
         // We have a scheme! force the method to be f
         $this->processingmethod = 'f';
     } elseif ($detectprocessingmode) {
         $ext = strtolower(MFile::getExt($this->filename));
         switch ($ext) {
             case 'tgz':
             case 'gz':
             case 'gzip':
                 $this->processingmethod = 'gz';
                 break;
             case 'tbz2':
             case 'bz2':
             case 'bzip2':
                 $this->processingmethod = 'bz';
                 break;
             default:
                 $this->processingmethod = 'f';
                 break;
         }
     }
     // Capture PHP errors
     $php_errormsg = 'Error Unknown whilst opening a file';
     $track_errors = ini_get('track_errors');
     ini_set('track_errors', true);
     // Decide which context to use:
     switch ($this->processingmethod) {
         // gzip doesn't support contexts or streams
         case 'gz':
             $this->_fh = gzopen($filename, $mode, $use_include_path);
             break;
             // bzip2 is much like gzip except it doesn't use the include path
         // bzip2 is much like gzip except it doesn't use the include path
         case 'bz':
             $this->_fh = bzopen($filename, $mode);
             break;
             // fopen can handle streams
         // fopen can handle streams
         case 'f':
         default:
             // One supplied at open; overrides everything
             if ($context) {
                 $this->_fh = fopen($filename, $mode, $use_include_path, $context);
             } elseif ($this->_context) {
                 $this->_fh = fopen($filename, $mode, $use_include_path, $this->_context);
             } else {
                 $this->_fh = fopen($filename, $mode, $use_include_path);
             }
             break;
     }
     if (!$this->_fh) {
         $this->setError($php_errormsg);
     } else {
         $retval = true;
     }
     // Restore error tracking to what it was before
     ini_set('track_errors', $track_errors);
     // Return the result
     return $retval;
 }
Example #23
0
 /**
  * 
  *
  * @return bool
  */
 public static function fileExists($filePath)
 {
     MAssertTypes('string', $filePath);
     $file = new MFile(S($filePath));
     return $file->exists();
 }
Example #24
0
function getMimeType($file){
		global $mimeTypes;
		$info = MFile::info($file);
		$ext = $info->extension;
		$mime = $mimeTypes->$ext;
		return $mime;
	}//EOF getType
Example #25
0
 public function deleteLangs()
 {
     # Admin
     $admin_lang_dir = MPATH_WP_CNT . '/miwi/languages/admin';
     if (MFolder::exists($admin_lang_dir)) {
         $lang_folders = MFolder::folders($admin_lang_dir);
         foreach ($lang_folders as $lang_folder) {
             $files = MFolder::files($admin_lang_dir . '/' . $lang_folder);
             foreach ($files as $file) {
                 if (strpos($file, $this->context) !== false) {
                     MFile::delete($admin_lang_dir . '/' . $lang_folder . '/' . $file);
                 }
             }
         }
     }
     # Site
     $site_lang_dir = MPATH_WP_CNT . '/miwi/languages/site';
     if (MFolder::exists($site_lang_dir)) {
         $lang_folders = MFolder::folders($site_lang_dir);
         foreach ($lang_folders as $lang_folder) {
             $files = MFolder::files($site_lang_dir . '/' . $lang_folder);
             foreach ($files as $file) {
                 if (strpos($file, $this->context) !== false) {
                     MFile::delete($site_lang_dir . '/' . $lang_folder . '/' . $file);
                 }
             }
         }
     }
 }
Example #26
0
 function deleterootfolder()
 {
     $id = MRequest::int("id", -1);
     if ($id > -1) {
         $roots = MRoots::getInstance();
         $before = "ID: " . $id . "<br>" . $roots;
         if ($roots->get($id) !== false) {
             $roots->delete($id);
             if (!_FM_IS_DEMO) {
                 $roots->save();
             }
             if (MFile::is(_FM_HOME_DIR . DS . "data" . DS . "rights" . DS . "rf" . $id . ".php")) {
                 MFile::remove(_FM_HOME_DIR . DS . "data" . DS . "rights" . DS . "rf" . $id . ".php", 1);
             }
         }
     }
     $demoAdvice = _FM_IS_DEMO ? MSaved::url() : '';
     MPeer::redirect(MURL::_("rootsandrights", null, null) . $demoAdvice);
 }
Example #27
0
	public static function save(){
		$path = _FM_HOME_DIR . DS."data" . DS . "diagnostic_log.php";
		$buffer = '<?PHP die(); /**'."\n";
		foreach(self::$params as $key => $value){
			$buffer .= $key . "\t" . $value . "\n";
		}
		$buffer .= "*/";
		return @MFile::writeData($path,$buffer);
	}
Example #28
0
    function object()
    {
        if (!MRights::can("open")) {
            return $this->_noAuth("open");
        }
        //video
        global $dir;
        $info = MFile::info($dir);
        $this->view->add2Content('<center>
		        <object align="middle"  type="' . getMimeType($dir) . '" data="' . MURL::_("xhrvideo", urlencode(str_replace(_START_FOLDER, "", $dir))) . '" width="750px" height="450px">
				</object></center>');
    }
Example #29
0
} else {
    die("No such folder found!");
}
define('_ROOTFOLDERID', (int) $GLOBALS['currentMainFolder']);
// Prepaired for further versions of Profiles
define("_FM_USE_FTP", false);
$mimeTypes = MFile::parseData(_FM_HOME_DIR . DS . "data" . DS . "suffix.ini", true, false);
$GLOBALS['mimeTypes'] = $mimeTypes;
//Task
$task = trim(MRequest::cmd('task'));
$GLOBALS['task'] = $task;
//View
$view = trim(MRequest::cmd('view', 'default'));
$GLOBALS['view'] = $view;
//Check if this is a first time call
if (!MFile::is(_FM_HOME_DIR . DS . "data" . DS . "diagnostic_log.php")) {
    $view = 'diagnostics';
    $GLOBALS['view'] = $view;
}
//Check root only views
$rootOnlyViews = array("rootsandrights", "config", "diagnostics");
if (in_array($view, $rootOnlyViews) && !MRights::userIsRoot() && !_FM_IS_DEMO) {
    ob_start();
    include "templates" . DS . "noaccess.php";
    $dieOut = ob_get_clean();
    ob_get_clean();
    die($dieOut);
}
//File
$file = MRequest::clean('file');
$file = urldecode(myStripSlashes($file));
Example #30
0
 public function menu()
 {
     MFactory::getLanguage()->load('com_' . $this->context, MPATH_ADMINISTRATOR);
     $title = $this->title;
     if (empty($this->title)) {
         $title = MText::_('COM_' . strtoupper($this->context));
     }
     mimport('framework.filesystem.file');
     $img = '';
     if (MFile::exists(MPATH_WP_PLG . '/' . $this->context . '/admin/assets/images/icon-16-' . $this->context . '.png')) {
         $img = plugins_url($this->context . '/admin/assets/images/icon-16-' . $this->context . '.png');
     }
     add_menu_page($title, $title, 'manage_options', $this->context, array($this, 'display'), $img, $this->menu_id);
     if ($this->has_config == true) {
         add_submenu_page($this->context, MText::_('COM_' . strtoupper($this->context) . '_CPANEL_CONFIGURATION'), MText::_('COM_' . strtoupper($this->context) . '_CPANEL_CONFIGURATION'), 'manage_options', MRoute::_('index.php?option=com_' . $this->context . '&view=config'));
     }
     $toolbar_file = MPATH_WP_PLG . '/' . $this->context . '/admin/toolbar.php';
     if (file_exists($toolbar_file)) {
         require_once $toolbar_file;
     }
     if (!empty($views)) {
         foreach ($views as $key => $val) {
             if (empty($key)) {
                 continue;
             }
             add_submenu_page($this->context, $val, $val, 'manage_options', MRoute::_('index.php?option=com_' . $this->context . $key));
         }
     }
 }