function getContent($action, $params, $sfl_dirlocation, $sfl_basepath, $sfl_maxfiles, $sfl_userlocation, $sfl_file) { $retVal = "false"; // We should alsways get directory through Ajax call, userlocation only at initial call $sfl_userlocation = ""; switch ($action) { case "delete": //$retVal = "<div style=\"text-align: left\">"; // Just send the information text back! $retVal = ModSimpleFileListerHelperv10::deleteFile($params, $sfl_file); //$retVal .= "</div>"; break; case "next" || "prev" || "dir" || "sort": $retVal = "<div style=\"text-align: left\">"; $retVal .= ModSimpleFileListerHelperv10::getDirContents($params, $sfl_dirlocation, $sfl_basepath, $sfl_maxfiles, $sfl_userlocation); $retVal .= "</div>"; break; default: $retVal = "Action missing"; break; } $app = JFactory::getApplication(); echo $retVal; $app->close(); }
} // Check that either default dir or user dir is present in the given dir. If not set it to default if (strpos($_GET["sflDir"], $sfl_dirlocation) === false && strpos($_GET["sflDir"], $sfl_userlocation) === false) { // Add warning txt? } else { $sfl_dirlocation = $_GET["sflDir"]; } } if (strpos($sfl_dirlocation, "../") !== false) { $sfl_dirlocation = $params->get('sfl_dirlocation', '.' . DIRECTORY_SEPARATOR . 'images'); } if (strlen($sfl_dirlocation) == 0) { $sfl_dirlocation = $sfl_userlocation; } $sfl_file = ""; $session->set('sfl_currentdir', $sfl_dirlocation); if ($_GET["sflaction"] === "delete") { $sfl_file = $_GET["sflDelete"]; } if ($_GET["sflaction"] === "sort" && isset($_GET["sflSort"])) { $session->set('sfl_sort', $_GET["sflSort"]); } echo SFLAjaxServlet::getContent($_GET["sflaction"], $params, $sfl_dirlocation, $sfl_basepath, $sfl_maxfiles, $sfl_userlocation, $sfl_file); } else { // include the helper file require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'helper.php'; $results = ''; $results .= ModSimpleFileListerHelperv10::getFileList($params, $sfl_dirlocation, $sfl_basepath, $sfl_maxfiles, $sfl_userlocation); // include the template for display require JModuleHelper::getLayoutPath('mod_simplefilelisterv' . $sfl_version); }