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 function __construct($module, $action, $id = 0, $arrWhere = array(), $parentModuleID = 0)
 {
     $this->module = $module;
     $this->action = $action;
     $this->arrConfigVar = ClsNaanalApplication::getConfigVars($module);
 }
 protected function renderTemplatePHPPath($module, $action = "create", $switch = "default", $subTemplate = false)
 {
     $modulePath = ClsNaanalApplication::getAbsModulePath($module);
     $path = null;
     if (file_exists($modulePath . "{$action}/{$switch}.php")) {
         $path = $modulePath . "{$action}/";
     } else {
         if (file_exists($modulePath . "{$action}.php")) {
             $path = $modulePath;
         }
     }
     if (isset(ClsConfig::$TEMPLATE_PHP_PATH) && !empty(ClsConfig::$TEMPLATE_PHP_PATH)) {
         if (file_exists(ClsConfig::$TEMPLATE_PHP_PATH . "{$module}/{$action}/{$switch}.php")) {
             $path = ClsConfig::$TEMPLATE_PHP_PATH . "{$module}/{$action}/";
         } else {
             if (file_exists(ClsConfig::$TEMPLATE_PHP_PATH . "{$module}/{$action}.php")) {
                 $path = ClsConfig::$TEMPLATE_PHP_PATH . "{$module}/";
             }
         }
     }
     return $path;
 }
 public static function &getInstance()
 {
     $args = func_get_args();
     $module = array_shift($args);
     $path = ClsNaanalApplication::getLibraryModulePath($module);
     if ($path === false) {
         $success = false;
         self::$arrErrorStatic[] = array("message" => "Library class {$module} not exist");
         return $success;
     }
     $moduleclass = "ClsL" . ucfirst($module);
     $class = "ClsL" . ucfirst($module);
     $path = rtrim($path, "/\\");
     if (file_exists($path . "/config.php")) {
         include $path . "/config.php";
         if (isset($lib_php_dir)) {
             if (file_exists($lib_php_dir)) {
                 $lib_php_dir = rtrim($lib_php_dir, "/\\");
                 if (isset($lib_php_file) && is_array($lib_php_file)) {
                     foreach ($lib_php_file as $tmpArr) {
                         $external_file = $tmpArr["file"];
                         //$external_class=$tmpArr["class"];
                         $external_include_file = "{$lib_php_dir}/{$external_file}";
                         if (!file_exists($external_include_file)) {
                             die("Library {$module} include file '{$external_include_file}' not exist");
                         }
                         include_once $external_include_file;
                     }
                 } else {
                     if (!isset($lib_php_file)) {
                         die("Library {$module}'s include file has to be defined. \n<pre>Ex: \$lib_php_file=array\n(\n'include'=>array('file'=>'include php file','class'=>'php class to include')\n);</pre>");
                     } else {
                         die("Library {$module}'s include file must be an array. \n<pre>Ex: \$lib_php_file=array\n(\n'include'=>array('file'=>'include php file','class'=>'php class to include')\n);</pre>");
                     }
                 }
             } else {
                 die("Library {$module} missing at {$lib_php_dir}");
             }
         }
     }
     if (file_exists($path . "/utils.php")) {
         include_once $path . "/utils.php";
     }
     $include_file = $path . "/" . $class . ".php";
     self::validate($include_file, $class);
     if (self::$arrValidate) {
         print_r(self::$arrValidate);
         exit;
     }
     include_once $include_file;
     if ($args) {
         $arrArg = array();
         foreach ($args as $ind => $arg) {
             $arrArg["key{$ind}"] = $arg;
         }
         extract($arrArg);
         $class = $class . '(';
         foreach ($args as $ind => $arg) {
             if ($ind === 0) {
                 $class = $class . "\$key{$ind}";
             } else {
                 $class = $class . ",\$key{$ind}";
             }
         }
         $class = $class . ')';
     }
     eval('$obj=new ' . $class . ';');
     return $obj;
 }
 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;
 }
Beispiel #6
0
function getCurrentModuleController()
{
    $module = isset($_REQUEST["m"]) ? $_REQUEST["m"] : "home";
    return ClsNaanalApplication::loadController($module);
}