public function getFolderAccess() { $obj = new stdClass(); $obj->count = 0; $obj->names = array(); $obj->paths = array(); $o = $this->data->get("folders", array()); foreach ($o as $key => $mdo) { if (MRights::can("use", (int) $key)) { $obj->count++; $path = $mdo->get("path", null); $name = $mdo->get("name", null); if (!$name) { $name = basename($path); } $obj->names[$key] = $name; $obj->paths[$key] = $path; } } return $obj; }
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; }
public static function instance($nameOrData = null, $data = null) { if (!self::$namespace) { self::$namespace = array(); } $obj = null; if (is_string($nameOrData) && trim($nameOrData)) { self::$namespace[trim($nameOrData)] = new self($data); self::$namespace[trim($nameOrData)]->id($nameOrData); return self::$namespace[trim($nameOrData)]; } elseif ($nameOrData === null) { $obj = new self($data); } else { $obj = new self($nameOrData); } $obj->id(); return $obj; }
<?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();
/** * * @param MDO $data * @param int $id */ public static function rootsMask($data = null, $id = -1){ $disabled = _FM_IS_DEMO ? ' disabled="disabled"' : ''; $c = new MContainer(); // $c->add('ID: '.$id); $c->add('<div class="mMaskHeading"><span>'); if($id === null || $id <0){ $c->add(MText::_("addnewroot")); }else{ $c->add(MText::_("rootfolderconfig") .": ".$data->get("name") ); } $c->add('</span></div><div style="padding:10px;">'); $c->add('<label>'.MText::_("title").'</label>'); $c->add('<div class="mSpacer"></div>'); $c->add(MForms::field("name",$data->get("name"),80,'','class="mRootsTitle" ')); $c->add($data->get("nameError", "")); $c->add('<div class="mSpacer"></div>'); $c->add('<label>'.MText::_("path").'</label>'); $c->add('<div class="mSpacer"></div>'); $path = _FM_IS_DEMO ? MText::_("notfordemo") : $data->get("path"); $c->add(MForms::field("path",$path ,null,'','class="mRootsPath"'. $disabled)); $c->add($data->get("pathError", "")); $c->add('<div class="clr"></div>'); $c->add('</div>'); return self::form($c->get(),null,array("id"=>$id)); }
/** * @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); }
public function save() { return $this->data->save($this->path); }