* @since 1.0 * @package MammutCMS * @subpackage Module */ class MMModFilearea extends MMModuleBase { public function runIndex(MMRequest $request, MMResponse $response, $activeInstance) { $system = \MCMS\System::getInstance(); $tplfile = __DIR__ . '/_layout_/_default_/' . 'tpl.' . $system->getTarget('action') . '.php'; // define the template file try { $template = new MFCTemplate(); $template->loadTemplate($tplfile); $template->setParam('title', 'User'); $template->setParam('self', $_SERVER['PHP_SELF']); $template->setParam('logoutLink', $_SERVER['PHP_SELF'] . '?mod=' . $activeInstance . '&view=logout'); $template->setParam('instance', $activeInstance); $template->setParam('isUser', !is_null($system->getUserSvc()->getUser())); $errors = array(-1 => 'Invalid login',-2 => 'Invalid password'); $template->setParam('error', !empty($_REQUEST['errno']) ? $errors[$_REQUEST['errno']] : false); $response->setFragment('CONTENT', $template->getDocument()); } catch(MFFileNotFoundException $ex) { $response->setFragment('CONTENT', "file is missing: " . $tplfile); } } public function runGetFile(MMRequest $request, MMResponse $response, $activeInstance) { $system = \MCMS\System::getInstance(); $svc = $system->getUserSvc(); $fid = (int) $_REQUEST['fid']; $row = $db->get_array("SELECT * FROM `{$mod}_file` WHERE `id`='$fid'"); if($row['mirrors'] == '') header("Location: http://localhost/download/{$row['filename']}"); else header("Location: http://alpha/download/{$row['filename']}"); $system['dorender'] = false; $response->setRedirect($activeInstance, 'index', $redirectParam); } } ?>