묻고답하기

http://www.xeweb.co.kr/xe/?mid=search&act=IS&search_target=title_content&is_keyword=11&cx=partner-pub-8278444203493355%3Ably7cgcmpo4&cof=FORID%3A10&ie=UTF-8&q=11&sa=%EA%B2%80%EC%83%89 Fatal error: Call to a member function setAct() on a non-object in /web/home/lamborghini/html/xe/classes/module/ModuleHandler.class.php on line 304
  •  <?php
        /**
        * @class ModuleHandler
        * @author NHN (developers@xpressengine.com)
        * @brief Handling modules
        *
        * @remarks This class is to excute actions of modules.
        *          Constructing an instance without any parameterconstructor, it finds the target module based on Context.
        *          If there is no act on the found module, excute an action referencing action_forward.
        **/
  •     class ModuleHandler extends Handler {
  •         var $oModule = NULL; ///< Module Instance
  •         var $module = NULL; ///< Module
            var $act = NULL; ///< action
            var $mid = NULL; ///< Module ID
            var $document_srl = NULL; ///< Document Number
            var $module_srl = NULL; ///< Module Number
  •         var $module_info = NULL; ///< Module Info. Object
  •         var $error = NULL; ///< an error code.
  •         /**
             * @brief constructor
             * @remarks it prepares variables to use in moduleHandler
             **/
            function ModuleHandler($module = '', $act = '', $mid = '', $document_srl = '', $module_srl = '') {
                // If XE has not installed yet, set module as install
                if(!Context::isInstalled()) {
                    $this->module = 'install';
                    $this->act = Context::get('act');
                    return;
                }
  •             // Set variables from request arguments
                if(!$module) $this->module = Context::get('module');
                else $this->module = $module;
  •             if(!$act) $this->act = Context::get('act');
                else $this->act = $act;
  •             if(!$mid) $this->mid = Context::get('mid');
                else $this->mid = $mid;
  •             if(!$document_srl) $this->document_srl = (int)Context::get('document_srl');
                else $this->document_srl = (int)$document_srl;
  •             if(!$module_srl) $this->module_srl = (int)Context::get('module_srl');
                else $this->module_srl = (int)$module_srl;
  •             $this->entry = Context::convertEncodingStr(Context::get('entry'));
  •             // Validate variables to prevent XSS
                if($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i",$this->module)) die(Context::getLang("msg_invalid_request"));
                if($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i",$this->mid)) die(Context::getLang("msg_invalid_request"));
                if($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i",$this->act)) die(Context::getLang("msg_invalid_request"));
  •             // execute addon (before module initialization)
                $called_position = 'before_module_init';
                $oAddonController = &getController('addon');
                $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone()?"mobile":"pc");
                @include($addon_file);
            }
  •         /**
             * @brief Initialization. It finds the target module based on module, mid, document_srl, and prepares to execute an action
             * @return true: OK, false: redirected
             **/
            function init() {
       $oModuleModel = &getModel('module');
                $site_module_info = Context::get('site_module_info');
  •             if(!$this->document_srl && $this->mid && $this->entry) {
                    $oDocumentModel = &getModel('document');
                    $this->document_srl = $oDocumentModel->getDocumentSrlByAlias($this->mid, $this->entry);
                    if($this->document_srl) Context::set('document_srl', $this->document_srl);
                }
  •             // Get module's information based on document_srl, if it's specified
                if($this->document_srl && !$this->module) {
                    $module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl);
  •                 // If the document does not exist, remove document_srl
                    if(!$module_info) {
                        unset($this->document_srl);
                    } else {
                        // If it exists, compare mid based on the module information
                        // if mids are not matching, set it as the document's mid
                        if($this->mid != $module_info->mid) {
                            $this->mid = $module_info->mid;
                            Context::set('mid', $module_info->mid, true);
                        }
                    }
                    // if requested module is different from one of the document, remove the module information retrieved based on the document number
                    if($this->module && $module_info->module != $this->module) unset($module_info);
                }
  •             // If module_info is not set yet, and there exists mid information, get module information based on the mid
                if(!$module_info && $this->mid) {
                    $module_info = $oModuleModel->getModuleInfoByMid($this->mid, $site_module_info->site_srl);
                    //if($this->module && $module_info->module != $this->module) unset($module_info);
                }
  •             // redirect, if module_site_srl and site_srl are different
                if(!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0) {
                    $site_info = $oModuleModel->getSiteInfo($site_module_info->module_site_srl);
                    header("location:".getNotEncodedSiteUrl($site_info->domain,'mid',$site_module_info->mid));
                    return false;
                }
  •             // If module_info is not set still, and $module does not exist, find the default module
                if(!$module_info && !$this->module) $module_info = $site_module_info;
  •             if(!$module_info && !$this->module && $site_module_info->module_site_srl) $module_info = $site_module_info;
  •             // redirect, if site_srl of module_info is different from one of site's module_info
                if($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler()) {
                    // If the module is of virtual site
                    if($module_info->site_srl) {
                        $site_info = $oModuleModel->getSiteInfo($module_info->site_srl);
                        $redirect_url = getNotEncodedSiteUrl($site_info->domain, 'mid',Context::get('mid'),'document_srl',Context::get('document_srl'),'module_srl',Context::get('module_srl'),'entry',Context::get('entry'));
                    // If it's called from a virtual site, though it's not a module of the virtual site
                    } else {
                        $db_info = Context::getDBInfo();
                        if(!$db_info->default_url) return Context::getLang('msg_default_url_is_not_defined');
                        else $redirect_url = getNotEncodedSiteUrl($db_info->default_url, 'mid',Context::get('mid'),'document_srl',Context::get('document_srl'),'module_srl',Context::get('module_srl'),'entry',Context::get('entry'));
                    }
                    header("location:".$redirect_url);
                    return false;
                }
  •             // If module info was set, retrieve variables from the module information
                if($module_info) {
                    $this->module = $module_info->module;
                    $this->mid = $module_info->mid;
                    $this->module_info = $module_info;
                    Context::setBrowserTitle($module_info->browser_title);
                    $part_config= $oModuleModel->getModulePartConfig('layout',$module_info->layout_srl);
                    Context::addHtmlHeader($part_config->header_script);
                }
  •             // Set module and mid into module_info
                $this->module_info->module = $this->module;
                $this->module_info->mid = $this->mid;
  •             // Still no module? it's an error
                if(!$this->module) $this->error = 'msg_module_is_not_exists';
  •             // If mid exists, set mid into context
                if($this->mid) Context::set('mid', $this->mid, true);
                   
                // Call a trigger after moduleHandler init
                $output = ModuleHandler::triggerCall('moduleHandler.init', 'after', $this->module_info);
                if(!$output->toBool()) {
                    $this->error = $output->getMessage();
                    return false;
                }
  •             // Set current module info into context
                Context::set('current_module_info', $this->module_info);
  •             return true;
            }
  •         /**
             * @brief get a module instance and execute an action
             * @return executed module instance
             **/
            function procModule() {
                // If error occurred while preparation, return a message instance
                if($this->error) {
        $type = Mobile::isFromMobilePhone() ? 'mobile' : 'view';
                    $oMessageObject = &ModuleHandler::getModuleInstance('message',$type);
                    $oMessageObject->setError(-1);
                    $oMessageObject->setMessage($this->error);
                    $oMessageObject->dispMessage();
                    return $oMessageObject;
                }
  •             $oModuleModel = &getModel('module');
  •             // Get action information with conf/action.xml
                $xml_info = $oModuleModel->getModuleActionXml($this->module);
  •             // If not installed yet, modify act
                if($this->module=="install") {
                    if(!$this->act || !$xml_info->action->{$this->act}) $this->act = $xml_info->default_index_act;
                } 
  •             // if act exists, find type of the action, if not use default index act
                if(!$this->act) $this->act = $xml_info->default_index_act;
  •             // still no act means error
                if(!$this->act) {
                    $this->error = 'msg_module_is_not_exists';
                    return;
                }
  •             // get type, kind
                $type = $xml_info->action->{$this->act}->type;
                $kind = strpos(strtolower($this->act),'admin')!==false?'admin':'';
                if(!$kind && $this->module == 'admin') $kind = 'admin';
       if($this->module_info->use_mobile != "Y") Mobile::setMobile(false);
  •    // if(type == view, and case for using mobilephone)
       if($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled())
       {
        $orig_type = "view";
        $type = "mobile";
        // create a module instance
        $oModule = &$this->getModuleInstance($this->module, $type, $kind);
        if(!is_object($oModule) || !method_exists($oModule, $this->act)) {
         $type = $orig_type;
         Mobile::setMobile(false);
         $oModule = &$this->getModuleInstance($this->module, $type, $kind);
        }
       }
       else
       {
        // create a module instance
        $oModule = &$this->getModuleInstance($this->module, $type, $kind);
       }
  •    if(!is_object($oModule)) {
        $this->error = 'msg_module_is_not_exists';
        return;
       }
  •    // If there is no such action in the module object
       if(!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act))
       {
        if(!Context::isInstalled())
        {
         $this->error = 'msg_invalid_request';
         return;
        }
  •                 $forward = null;
        // 1. Look for the module with action name
                    if(preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches)) {
                        $module = strtolower($matches[2].$matches[3]);
                        $xml_info = $oModuleModel->getModuleActionXml($module);
                        if($xml_info->action->{$this->act}) {
                            $forward->module = $module;
                            $forward->type = $xml_info->action->{$this->act}->type;
                            $forward->act = $this->act;
                        }
                    }
  •     if(!$forward)
        {
         $forward = $oModuleModel->getActionForward($this->act);
        }
  •                 if($forward->module && $forward->type && $forward->act && $forward->act == $this->act) {
                        $kind = strpos(strtolower($forward->act),'admin')!==false?'admin':'';
         $type = $forward->type;
         $tpl_path = $oModule->getTemplatePath();
         $orig_module = $oModule;
  •      if($type == "view" && Mobile::isFromMobilePhone())
         {
          $orig_type = "view";
          $type = "mobile";
          // create a module instance
          $oModule = &$this->getModuleInstance($forward->module, $type, $kind);
          if(!is_object($oModule) || !method_exists($oModule, $this->act)) {
           $type = $orig_type;
           Mobile::setMobile(false);
           $oModule = &$this->getModuleInstance($forward->module, $type, $kind);
          }
         }
         else
         {
          $oModule = &$this->getModuleInstance($forward->module, $type, $kind);
         }
                        $xml_info = $oModuleModel->getModuleActionXml($forward->module);
         if($this->module == "admin" && $type == "view")
         {
          $oMemberModel = &getModel('member');
  •       $logged_info = $oMemberModel->getLoggedInfo();
          if($logged_info->is_admin=='Y') {
           $orig_module->loadSideBar();
           $oModule->setLayoutPath("./modules/admin/tpl");
           $oModule->setLayoutFile("layout.html");
          }
         }
        }
        else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
        {
         $this->act = $xml_info->default_index_act;
        }
        else
        {
         $this->error = 'msg_invalid_request';
         return;
        }
       }
  •             $oModule->setAct($this->act);
  •             $this->module_info->module_type = $type;
                $oModule->setModuleInfo($this->module_info, $xml_info);
  •             // execute the action, and if failed, set error
                if(!$oModule->proc()) $this->error = $oModule->getMessage();
  •             return $oModule;
            }
  •         /**
             * @brief display contents from executed module
             * @param[in] $oModule module instance
             * @return none
             **/
            function displayContent($oModule = NULL) {
                // If the module is not set or not an object, set error
                if(!$oModule || !is_object($oModule)) {
                    $this->error = 'msg_module_is_not_exists';
                }
  •             // If connection to DB has a problem even though it's not install module, set error
                if($this->module != 'install' && $GLOBALS['__DB__'][Context::getDBType()]->is_connected == false) {
                    $this->error = 'msg_dbconnect_failed';
                }
  •             // Call trigger after moduleHandler proc
                $output = ModuleHandler::triggerCall('moduleHandler.proc', 'after', $oModule);
                if(!$output->toBool()) $this->error = $output->getMessage();
  •             // Use message view object, if HTML call
                if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
                    // If error occurred, handle it
                    if($this->error) {
                        // display content with message module instance
         $type = Mobile::isFromMobilePhone() ? 'mobile' : 'view'+
     ';
         $oMessageObject = &ModuleHandler::getModuleInstance('message',$type);
         $oMessageObject->setError(-1);
         $oMessageObject->setMessage($this->error);
         $oMessageObject->dispMessage();
  •                     // If module was called normally, change the templates of the module into ones of the message view module
                        if($oModule) {
                            $oModule->setTemplatePath($oMessageObject->getTemplatePath());
                            $oModule->setTemplateFile($oMessageObject->getTemplateFile());
  •                     // Otherwise, set message instance as the target module
                        } else {
                            $oModule = $oMessageObject;
                        }
                    }
  •                 // Check if layout_srl exists for the module
        if(Mobile::isFromMobilePhone())
        {
         $layout_srl = $oModule->module_info->mlayout_srl;
        }
        else
        {
         $layout_srl = $oModule->module_info->layout_srl;
        }
  •                 if($layout_srl && !$oModule->getLayoutFile()) {
  •                     // If layout_srl exists, get information of the layout, and set the location of layout_path/ layout_file
                        $oLayoutModel = &getModel('layout');
                        $layout_info = $oLayoutModel->getLayout($layout_srl);
                        if($layout_info) {
  •                         // Input extra_vars into $layout_info
                            if($layout_info->extra_var_count) {
  •                             foreach($layout_info->extra_var as $var_id => $val) {
                                    if($val->type == 'image') {
                                        if(preg_match('/^\.\/files\/attach\/images\/(.+)/i',$val->value)) $val->value = Context::getRequestUri().substr($val->value,2);
                                    }
                                    $layout_info->{$var_id} = $val->value;
                                }
                            }
                            // Set menus into context
                            if($layout_info->menu_count) {
                                foreach($layout_info->menu as $menu_id => $menu) {
                                    if(file_exists($menu->php_file)) @include($menu->php_file);
                                    Context::set($menu_id, $menu);
                                }
                            }
  •                         // Set layout information into context
                            Context::set('layout_info', $layout_info);
  •                         $oModule->setLayoutPath($layout_info->path);
                            $oModule->setLayoutFile('layout');
  •                         // If layout was modified, use the modified version
                            $edited_layout = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl);
                            if(file_exists($edited_layout)) $oModule->setEditedLayoutFile($edited_layout);
                        }
                    }
                }
  •             // Display contents
                $oDisplayHandler = new DisplayHandler();
                $oDisplayHandler->printContent($oModule);
            }
  •         /**
             * @brief returns module's path
             * @param[in] $module module name
             * @return path of the module
             **/
            function getModulePath($module) {
                return sprintf('./modules/%s/', $module);
            }
  •         /**
             * @brief It creates a module instance
             * @param[in] $module module name
             * @param[in] $type instance type, (e.g., view, controller, model)
             * @param[in] $kind admin or svc
             * @return module instance (if failed it returns null)
             * @remarks if there exists a module instance created before, returns it.
             **/
            function &getModuleInstance($module, $type = 'view', $kind = '') {
  •    $parent_module = $module;
                if(__DEBUG__==3) $start_time = getMicroTime();
  •    $key = $module.'.'.($kind!='admin'?'':'+
     'admin').'.'.$type;
       if(is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__'])) {
        $module = $extend_module = $GLOBALS['__MODULE_EXTEND__'][$key];
       }else{
        unset($parent_module);
       }
  •             $class_path = ModuleHandler::getModulePath($module);
                if(!is_dir(FileHandler::getRealPath($class_path))) return NULL;
  •             // if there is no instance of the module in global variable, create a new one
                if(!$GLOBALS['_loaded_module'][$module][$type][$kind]) {
                    // Get base class name and load the file contains it
                    if(!class_exists($module)) {
                        $high_class_file = sprintf('%s%s%s.class.php', _XE_PATH_,$class_path, $module);
                        if(!file_exists($high_class_file)) return NULL;
                        require_once($high_class_file);
                    }
  •                 // Get the object's name
                    switch($type) {
                        case 'controller' :
                                if($kind == 'admin') {
                                    $instance_name = sprintf("%sAdmin%s",$module,"Controller");
                                    $class_file = sprintf('%s%s.admin.%s.php', $class_path, $module, $type);
                                } else {
                                    $instance_name = sprintf("%s%s",$module,"Controller");
                                    $class_file = sprintf('%s%s.%s.php', $class_path, $module, $type);
                                }
                            break;
                        case 'model' :
                                if($kind == 'admin') {
                                    $instance_name = sprintf("%sAdmin%s",$module,"Model");
                                    $class_file = sprintf('%s%s.admin.%s.php', $class_path, $module, $type);
                                } else {
                                    $instance_name = sprintf("%s%s",$module,"Model");
                                    $class_file = sprintf('%s%s.%s.php', $class_path, $module, $type);
                                }
                            break;
                        case 'api' :
                                $instance_name = sprintf("%s%s",$module,"API");
                                $class_file = sprintf('%s%s.api.php', $class_path, $module);
                            break;
                        case 'wap' :
                                $instance_name = sprintf("%s%s",$module,"WAP");
                                $class_file = sprintf('%s%s.wap.php', $class_path, $module);
                            break;
         case 'mobile' :
           $instance_name = sprintf("%s%s",$module,"Mobile");
           $class_file = sprintf("%s%s.mobile.php", $class_path, $module);
          break;
                        case 'class' :
                                $instance_name = $module;
                                $class_file = sprintf('%s%s.class.php', $class_path, $module);
                            break;
                        default :
                                $type = 'view';
                                if($kind == 'admin') {
                                    $instance_name = sprintf("%sAdmin%s",$module,"View");
                                    $class_file = sprintf('%s%s.admin.view.php', $class_path, $module, $type);
                                } else {
                                    $instance_name = sprintf("%s%s",$module,"View");
                                    $class_file = sprintf('%s%s.view.php', $class_path, $module, $type);
                                }
                            break;
                    }
  •     $class_file = FileHandler::getRealPath($class_file);
  •                 // Get the name of the class file
                    if(!file_exists($class_file)) return NULL;
  •                 // Create an instance with eval function
                    require_once($class_file);
                    if(!class_exists($instance_name)) return NULL;
                    $eval_str = sprintf('+
     '$oModule = new %s();', $instance_name);
                    @eval($eval_str);
                    if(!is_object($oModule)) return NULL;
  •                 // Load language files for the class
                    Context::loadLang($class_path.'lang');
        if($extend_module) {
         Context::loadLang(ModuleHandler::getModulePath($parent_module).'lang');
        }
  •                 // Set variables to the instance
                    $oModule->setModule($module);
                    $oModule->setModulePath($class_path);
  •                 // If the module has a constructor, run it.
                    if(!isset($GLOBALS['_called_constructor'][$instance_name])) {
                        $GLOBALS['_called_constructor'][$instance_name] = true;
                        if(@method_exists($oModule, $instance_name)) $oModule->{$instance_name}();
                    }
  •                 // Store the created instance into GLOBALS variable
                    $GLOBALS['_loaded_module'][$module][$type][$kind] = $oModule;
                }
  •             if(__DEBUG__==3) $GLOBALS['+
     '__elapsed_class_load__'] += getMicroTime() - $start_time;
  •             // return the instance
                return $GLOBALS['_loaded_module'][$module][$type][$kind];
            }
  •         /**
             * @brief call a trigger
             * @param[in] $trigger_name trigger's name to call
             * @param[in] $called_position called position
             * @param[in] $obj an object as a parameter to trigger
             * @return Object
             **/
            function triggerCall($trigger_name, $called_position, &$obj) {
                // skip if not installed
                if(!Context::isInstalled()) return new Object();
  •             $oModuleModel = &getModel('module');
                $triggers = $oModuleModel->getTriggers($trigger_name, $called_position);
                if(!$triggers || !count($triggers)) return new Object();
  •             foreach($triggers as $item) {
                    $module = $item->module;
                    $type = $item->type;
                    $called_method = $item->called_method;
  •                 $oModule = null;
                    $oModule = &getModule($module, $type);
                    if(!$oModule || !method_exists($oModule, $called_method)) continue;
  •                 $output = $oModule->{$called_method}($obj);
                    if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool()) return $output;
                    unset($oModule);
                }
  •             return new Object();
            }
        }
    ?>
    
     <?php
        /**
        * @class ModuleObject
        * @author NHN (developers@xpressengine.com)
        * @brief base class of ModuleHandler
        **/
  •     class ModuleObject extends Object {
  •         var $mid = NULL; ///< string to represent run-time instance of Module (XE Module)
            var $module = NULL; ///< Class name of Xe Module that is identified by mid
            var $module_srl = NULL; ///< integer value to represent a run-time instance of Module (XE Module)
            var $module_info = NULL; ///< an object containing the module information
            var $xml_info = NULL; ///< an object containing the module description extracted from XML file
  •         var $module_path = NULL; ///< a path to directory where module source code resides
  •         var $act = NULL; ///< a string value to contain the action name
  •         var $template_path = NULL; ///< a path of directory where template files reside
            var $template_file = NULL; ///< name of template file
  •         var $layout_path = ''; ///< a path of directory where layout files reside
            var $layout_file = '+
     ''; ///< name of layout file
            var $edited_layout_file = ''; ///< name of temporary layout files that is modified in an admin mode
  •         var $stop_proc = false; ///< a flag to indicating whether to stop the execution of code.
  •         /**
             * @brief setter to set the name of module
             * @param name of module
             **/
            function setModule($module) {
                $this->module = $module;
            }
  •         /**
             * @brief setter to set the name of module path
             * @param the directory path to a module directory
             **/
            function setModulePath($path) {
                if(substr($path,-1)!='/') $path.='/';
                $this->module_path = $path;
            }
  •         /**
             * @brief setter to set an url for redirection
             * @param $url url for redirection
             * @remark redirect_url is used only for ajax requests
             **/
            function setRedirectUrl($url='./') {
                $this->add('redirect_url', $url);
            }
  •         /**
             * @brief sett to set the template path for refresh.html
             * @remark refresh.html is executed as a result of method execution
             * 공통 tpl중 refresh.html을 실행할 뿐..
             **/
            function setRefreshPage() {
                $this->setTemplatePath('./common/tpl');
                $this->setTemplateFile('refresh');
            }
  •         /**
             * @brief sett to set the action name
             **/
            function setAct($act) {
                $this->act = $act;
            }
  •         /**
             * @brief sett to set module information
             * @param[in] $module_info object containing module information
             * @param[in] $xml_info object containing module description
            **/
            function setModuleInfo($module_info, $xml_info) {
                // 기본 변수 설정
                $this->mid = $module_info->mid;
                $this->module_srl = $module_info->module_srl;
                $this->module_info = $module_info;
                $this->xml_info = $xml_info;
                $this->skin_vars = $module_info->skin_vars;
  •             // 웹서비스에서 꼭 필요한 인증 정보와 권한 설정 체크
                $is_logged = Context::get('is_logged');
                $logged_info = Context::get('logged_info');
  •             // module model 객체 생성
                $oModuleModel = &getModel('module');
  •             // XE에서 access, manager (== is_admin) 는 고정된 권한명이며 이와 관련된 권한 설정
                $module_srl = Context::get('module_srl');
                if(!$module_info->mid && preg_match('/^([0-9]+)$/',$module_srl)) {
                    $request_module = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
                    if($request_module->module_srl == $module_srl) {
                        $grant = $oModuleModel->getGrant($request_module, $logged_info);
                    }
                } else {
                    $grant = $oModuleModel->getGrant($module_info, $logged_info, $xml_info);
                }
  •             // 현재 모듈의 access 권한이 없으면 권한 없음 표시
                //if(!$grant->access) return $this->stop("msg_not_permitted");
  •             // 관리 권한이 없으면 permision, action 확인
                if(!$grant->manager) {
                    // 현재 요청된 action의 퍼미션 type(guest, member, manager, root)를 구함
                    $permission_target = $xml_info->permission->{$this->act};
  •                 // module.xml에 명시된 퍼미션이 없을때 action명에 Admin이 있으면 manager로 체크
                    if(!$permission_target && substr_count($this->act, 'Admin')) $permission_target = 'manager';
  •                 // 권한 체크
                    switch($permission_target) {
                        case 'root' :
                                $this->stop('msg_not_permitted_act');
                            break;
                        case 'manager' :
                                if(!$grant->manager) $this->stop('msg_not_permitted_act');
                            break;
                        case 'member' :
                                if(!$is_logged) $this->stop('msg_not_permitted_act');
                            break;
                    }
                }
  •             // 권한변수 설정
                $this->grant = $grant;
                Context::set('grant', $grant);
  •             if(method_exists($this, 'init')) $this->init();
            }
  •         /**
             * @brief set the stop_proc and approprate message for msg_code
             * @param $msg_code an error code
             **/
            function stop($msg_code) {
                // proc 수행을 중지 시키기 위한 플래그 세팅
                $this->stop_proc = true;
  •             // 에러 처리
                $this->setError(-1);
                $this->setMessage($msg_code);
  •             // message 모듈의 에러 표시
       $type = Mobile::isFromMobilePhone() ? 'mobile' : 'view';
       $oMessageObject = &ModuleHandler::getModuleInstance('message',$type);
       $oMessageObject->setError(-1);
       $oMessageObject->setMessage($msg_code);
       $oMessageObject->dispMessage();
  •             $this->setTemplatePath($oMessageObject->getTemplatePath());
                $this->setTemplateFile($oMessageObject->getTemplateFile());
  •             return $this;
            }
  •         /**
             * @brief set the file name of the template file
             **/
            function setTemplateFile($filename) {
                if(substr($filename,-5)!='.html') $filename .= '.html';
                $this->template_file = $filename;
            }
  •         /**
             * @brief retrieve the directory path of the template directory
             **/
            function getTemplateFile() {
                return $this->template_file;
            }
  •         /**
             * @brief set the directory path of the template directory
             **/
            function setTemplatePath($path) {
                if(substr($path,0,1)!='/' && substr($path,0,2)!='./') $path = './'.$path;
                if(substr($path,-1)!='/') $path .= '/';
                $this->template_path = $path;
            }
  •         /**
  •          * @brief retrieve the directory path of the template directory
             **/
            function getTemplatePath() {
                return $this->template_path;
            }
  •         /**
             * @brief set the file name of the temporarily modified by admin
             **/
            function setEditedLayoutFile($filename) {
                if(substr($filename,-5)!='.html') $filename .= '.html';
                $this->edited_layout_file = $filename;
            }
  •         /**
             * @brief retreived the file name of edited_layout_file
             **/
            function getEditedLayoutFile() {
                return $this->edited_layout_file;
            }
  •         /**
             * @brief set the file name of the layout file
             **/
            function setLayoutFile($filename) {
                if(substr($filename,-5)!='.html') $filename .= '.html';
                $this->layout_file = $filename;
            }
  •         /**
             * @brief get the file name of the layout file
             **/
            function getLayoutFile() {
                return $this->layout_file;
            }
  •         /**
             * @brief set the directory path of the layout directory
             **/
            function setLayoutPath($path) {
                if(substr($path,0,1)!='/' && substr($path,0,2)!='./') $path = './'.$path;
                if(substr($path,-1)!='/') $path .= '/';
                $this->layout_path = $path;
            }
  •         /**
             * @brief set the directory path of the layout directory
             **/
            function getLayoutPath() {
                return $this->layout_path;
            }
  •         /**
             * @brief excute the member method specified by $act variable
             *
             **/
            function proc() {
                // stop_proc==true이면 그냥 패스
                if($this->stop_proc) return false;
  •             // trigger call
                $triggerOutput = ModuleHandler::triggerCall('moduleObject.proc', 'before', $this);
                if(!$triggerOutput->toBool()) {
                    $this->setError($triggerOutput->getError());
                    $this->setMessage($triggerOutput->getMessage());
                    return false;
                }
  •             // addon 실행(called_position 를 before_module_proc로 하여 호출)
                $called_position = 'before_module_proc';
                $oAddonController = &getController('addon');
                $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone()?"mobile":"pc");
                @include($addon_file);
  •             if(isset($this->xml_info->action->{$this->act}) && method_exists($this, $this->act)) {
  •                 // 권한 체크
                    if(!$this->grant->access) return $this->stop("msg_not_permitted_act");
  •                 // 모듈의 스킨 정보를 연동 (스킨 정보의 테이블 분리로 동작대상 모듈에만 스킨 정보를 싱크시키도록 변경)
                    $oModuleModel = &getModel('module');
                    $oModuleModel->syncSkinInfoToModuleInfo($this->module_info);
                    Context::set('module_info', $this->module_info);
  •                 // 실행
                    $output = $this->{$this->act}();
                }
       else {
        return false;
       }
  •             // trigger call
                $triggerOutput = ModuleHandler::triggerCall('moduleObject.proc', 'after', $this);
                if(!$triggerOutput->toBool()) {
                    $this->setError($triggerOutput->getError());
                    $this->setMessage($triggerOutput->getMessage());
                    return false;
                }
       
                // addon 실행(called_position 를 after_module_proc로 하여 호출)
                $called_position = 'after_module_proc';
                $oAddonController = &getController('addon');
                $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone()?"mobile":"pc");
                @include($addon_file);
  •             if(is_a($output, 'Object') || is_subclass_of($output, '+
     'Object')) {
                    $this->setError($output->getError());
                    $this->setMessage($output->getMessage());
                    return false;
                }
  •             // view action이고 결과 출력이 XMLRPC 또는 JSON일 경우 해당 모듈의 api method를 실행
                if($this->module_info->module_type == 'view'){
                    if(Context::getResponseMethod() == 'XMLRPC' || Context::getResponseMethod() == 'JSON') {
                        $oAPI = getAPI($this->module_info->module, 'api');
                        if(method_exists($oAPI, $this->act)) {
                            $oAPI->{$this->act}($this);
                        }
                    }
                }
  •             return true;
            }
        }
    ?>
    
    www.xeweb.co.kr 제 홈페이지인데요... 통합검색이 안되네요.
  • 글쓴이 제목 최종 글
    XE 공지 글 쓰기,삭제 운영방식 변경 공지 [16] 2019.03.05 by 남기남
    유승현765 동영상게시판 질문  
    최대원478 초보인데요 게시판에 메뉴글 어캐나오게해요.. [1] 2011.02.22 by 데시
    Eris 프로필 사진을 구매할수 있는 게시판 같은거 ㅋㅋ [1] 2011.02.22 by 데시
    서현보 도메인에 xe 연결을 어떻게 하면 좋을가요. .ㅠ [2] 2011.02.22 by RainDrop+
    윤씨 4->xe이전 후 관리자 페이지에서 가입일 문제  
    오실롯 7일 이상 지난 글에 댓글 작성시 포인트 지급 않하기  
    권오남529 회원 가입시에 회원 ID와 비밀번호를 다른 DB에 저장할 수 있을까요?  
    sweetday 노프레임 연결  
    지니맨 카페24에서 서버호스팅으로 이전을 했는데 라이센스 동의창 수시로 뜹니다. [1] 2011.02.22 by ezi
    야호z 글쓴이의 게시판에 쓴 글갯수와 댓글수를 출력하는 방법좀..  
    쫑아 XE 에서 갤러리 게시판 사용시 화면 밀리는 현상 [1] file 2011.02.22 by 아아악내눈
    kynizz 한 줄 메모장의 텍스트필드 질문입니다.  
    노력중 페이지 위젯 수동생성방법 알려주세요^*^  
    김용수647 페이지 수정에서 수정단추를 누르면  
    야호z 회원 가입일 마지막 로그인 일 출력하는방법?? [2] 2011.02.22 by 야호z
    숭어냥 ftp에 이상한 파일이 있어요!! [1] 2011.02.22 by 아아악내눈
    젠트 사용자가 본문글읽을시 웹페이지를 표시할수없습니다 [1] 2011.02.22 by 공듀
    카이420 게시판 글쓰기,댓글쓰기 기본 글씨색 변경 질문드립니다. [1] 2011.02.21 by SeklutZ
    무실 보드 글씨체를 변경하는 방법.  
    이재연493 모듈을 찾을수 없다고 나옵니다.. [1] 2011.02.21 by SeklutZ
    유승현765 제로보드 스킨 xe에도 [1] 2011.02.21 by SeklutZ
    김한수156 설치후 게시판이나 페이지 생성이 안되어 질문합니다. [2] 2011.02.21 by 김한수156
    pricky 제가 APM 이 아닌 xampp 를 쓰는데요. xampp 는 ftp 못쓰나요? [1] 2011.02.21 by hhgyu
    로얄1004 레이아웃 상단 좌측에 "/> 이런테그가 나옴니다 [1] 2011.02.21
    CrowTM 비회원 게시글 작성질문  
    박자경704 우측 퀵메뉴 적용할때요  
    gc00 갑자기 관리자에서 Fatal error: Call to a member function getNextPage() on a non-object 이런 오류가 나옵니다.  
    노력중 웹진형태최근문서출력에 대한 문제입니다. [2] 2011.02.21 by 노력중
    운호 제로보드 도메인 설정 질문 입니다. [2] 2011.02.21 by 공듀
    원피스799 도메인질문입니다. [2] 2011.02.21 by 공듀