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); }
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!"); } }
function render() { if ($this->template) { §(MTemplater::get($this->template, $this->slots)); } else { if (isset($this->slots['content'])) { §($this->slots['content']); } } }