function getModulePath($module) { static $arrModulePath = array(); if (!isFrameworkInstalled()) { return AUIEO_FRAMEWORK_PATH . "modules/"; } if (!isApplicationInstalled()) { if (file_exists("modules/{$module}")) { return "modules/"; } else { return AUIEO_FRAMEWORK_PATH . "modules/"; } } if (isset($arrModulePath[$module])) { return $arrModulePath[$module]; } $modulePath = getConfigVar("MODULE_PATH"); if (!is_null($modulePath)) { if (file_exists("{$modulePath}{$module}")) { $arrModulePath[$module] = "{$modulePath}"; return $arrModulePath[$module]; } } if (file_exists("modules/{$module}")) { $arrModulePath[$module] = "modules/"; return $arrModulePath[$module]; } if (file_exists(AUIEO_FRAMEWORK_PATH . "modules/{$module}")) { $arrModulePath[$module] = AUIEO_FRAMEWORK_PATH . "modules/"; return $arrModulePath[$module]; } return null; }
protected function processModuleInput(&$arrInputParam, $type = "get") { $retModule = ""; $retAction = ""; $retSwitch = ""; if (isset($arrInputParam["id"])) { $this->id = $arrInputParam["id"]; } if (file_exists("ClsConfig.php") && isset(ClsConfig::$URL_MODULE_PARAM)) { $this->urlModuleParam = ClsConfig::$URL_MODULE_PARAM; } if (file_exists("ClsConfig.php") && isset(ClsConfig::$URL_ACTION_PARAM)) { $this->urlActionParam = ClsConfig::$URL_ACTION_PARAM; } if (file_exists("ClsConfig.php") && isset(ClsConfig::$URL_SWITCH_PARAM)) { $this->urlSwitchParam = ClsConfig::$URL_SWITCH_PARAM; } if (isset($arrInputParam["rand"])) { $arrDecode = getModuleDecode($arrInputParam["rand"]); if (isset($arrDecode[$this->urlModuleParam])) { $this->module = $arrDecode[$this->urlModuleParam]; } if (isset($arrDecode[$this->urlActionParam])) { $this->action = $arrDecode[$this->urlActionParam]; } if (isset($arrDecode["switch"])) { $this->switch = $arrDecode[$this->urlSwitchParam]; } $this->isSubmit = true; } if (isset($arrInputParam[$this->urlModuleParam])) { $this->module = $arrInputParam[$this->urlModuleParam]; } else { } $urlActionParam = $this->urlActionParam; $arrConfigVar = ClsNaanalApplication::getConfigVars($this->module); if (isset($arrConfigVar["url_action_param"])) { $urlActionParam = $arrConfigVar["url_action_param"]; } if (isset($arrInputParam[$urlActionParam])) { $this->action = $arrInputParam[$urlActionParam]; } else { if ($this->id > 0) { if (isset($arrInputParam["issubmit"])) { $this->action = "update"; } else { $this->action = "edit"; } } else { if (isset($arrInputParam["issubmit"])) { $this->action = "insert"; } else { //$this->action="create"; } } } if (isset($arrInputParam["switch"])) { $this->switch = $arrInputParam["switch"]; } else { $this->switch = "default"; } $arrTrimParam = array("page", "action", "formodule"); foreach ($arrTrimParam as $data) { if (isset($arrInputParam[$data])) { if ($data == $this->urlModuleParam || $data == $this->urlActionParam || $data == $this->urlSwitchParam) { continue; } $arrInputParam[$data] = trim($arrInputParam[$data]); $this->otherVar[$data] = $arrInputParam[$data]; } } $requested_entry = _AuieoHook("{$type}_entry"); if ($requested_entry) { $entry = $requested_entry(); if (!is_null($entry)) { $this->entry = $entry; } } $requested_page = _AuieoHook("{$type}_page"); if ($requested_page) { $module = $requested_page(); if (!is_null($module)) { $this->module = $module; } } $requested_action = _AuieoHook("{$type}_action"); if ($requested_action) { $action = $requested_action(); if (!is_null($action)) { $this->action = $action; } } $requested_switch = _AuieoHook("{$type}_switch"); if ($requested_switch) { $switch = $requested_switch(); if (!is_null($switch)) { $this->switch = $switch; } } /** * If framework or application not installed, the user hook will be overridden */ if (!ClsNaanalApplication::isFrameworkInstalled() || !isApplicationInstalled()) { $this->module = "install"; } }
public static function getAbsModulePath($module, $action = "create") { $modulePath = self::__renderModulePath($module); $controller = self::getControllerName($module); $wrapper = self::getWrapperName($module); if ($module == "install") { if (!ClsNaanalApplication::isFrameworkInstalled()) { return "{$modulePath}install/"; } if (!isApplicationInstalled()) { return "{$modulePath}install/"; } } $workplacePath = ClsNaanalApplication::__getWorkplacePath(); if (file_exists("{$modulePath}{$module}")) { $modulePath = "{$modulePath}{$module}/"; } else { if (file_exists(AUIEO_FRAMEWORK_PATH . "{$modulePath}{$module}")) { $modulePath = AUIEO_FRAMEWORK_PATH . "{$modulePath}{$module}/"; } else { if (file_exists("{$workplacePath}{$module}.php") || file_exists("{$workplacePath}{$module}_{$action}.php") || file_exists("{$workplacePath}{$controller}.php") || file_exists("{$workplacePath}{$wrapper}.php")) { $modulePath = $workplacePath; } else { $modulePath = false; } } } return $modulePath; }