public function __construct() { $this->path = _FM_HOME_DIR . DS . "data" . DS . "roots.php"; $data = MDO::instance(); if (MFile::isFile($this->path)) { $data->load($this->path); } else { $data->set("counter", 0); $data->set("folders", array()); } $this->data = $data; }
/** * @return stdClass * * Returns a stdClass object with: * stdClass->error (an error array for each config name; empty if no errors) * stdClass->data (an MDO object with the fetched data) * */ public function request() { $obj = MDO::instance(); $err = array(); foreach ($this->defaults as $config) { $name = $config[0]; $default = $config[1]; $request = isset($config[2]) ? $config[2] : "clean"; $validate = isset($config[3]) ? $config[3] : null; $value = MRequest::_($request, $name, $default); if ($validate) { $valid = MValidate::_($validate, $value); if (!$valid) { $err[$name] = MText::_("validate_" . $validate); } } $obj->set($name, $value); } //EOF foreach $return = new stdClass(); $return->error = $err; $return->data = $obj; return $return; }
public function load($rootFolderId = null) { $rootFolderId = $rootFolderId === null || $rootFolderId < 0 ? $this->rootFolderId : (int) $rootFolderId; if (!$this->isRights($rootFolderId)) { self::$rights[$rootFolderId] = MDO::instance(); } self::$rights[$rootFolderId]->load($this->path . "rf" . $rootFolderId . ".php"); return true; }
<?php /** * @package Profiles * @subpackage filemanger * @copyright Copyright (C) 2013 - 2013 Mad4Media - Dipl. Informatiker(FH) Fahrettin Kutyol. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * @license Libraries can be under a different license in other environments * @license Media files owned and created by Mad4Media such as * @license Javascript / CSS / Shockwave or Images are licensed under GFML (GPL Friendly Media License). See GFML.txt. * @license 3rd party scripts are under the license of the copyright holder. See source header or license text file which is included in the appropriate folders * @version 1.0 * @link http://www.mad4media.de * Creation date 2013/02 */ //CUSTOMPLACEHOLDER //CUSTOMPLACEHOLDER2 defined('_JEXEC') or die; $fallback = MDO::instance(); $fallback->set("name",_FM_NO_FOLDER_FALLBACK_NAME); $fallback->set("path",_FM_NO_FOLDER_FALLBACK_PATH); $roots->set(null,$fallback); $roots->save();
/** * @return MDO */ protected function _fetchData() { $names = $this->getVarNames(); $data = new stdClass(); $data->isError = false; $data->name = MRequest::clean("name", null); $data->nameError = ""; $data->path = str_replace("\\", "/", MRequest::clean("path", null)); $data->pathError = ""; if (!$data->name) { $data->nameError .= MRightsHelper::wrapError(MText::_("error_noname")); } // Just validate if not in demo mode if (!_FM_IS_DEMO) { if (!$data->path) { $data->pathError .= MRightsHelper::wrapError(MText::_("error_nopath")); } else { if (!MFile::isDir($data->path)) { $data->pathError .= MRightsHelper::wrapError(MText::_("error_pathnofolder")); } } } //EOF is not demo foreach ($names as $name) { $errVar = strtolower($name) . "Error"; $data->isError = $data->isError || (bool) $data->{$errVar}; } return MDO::instance(null, $data); }