示例#1
0
 function dispMemberSignUpForm()
 {
     $oMemberModel =& getModel('member');
     if ($oMemberModel->isLogged()) {
         return $this->stop('msg_already_logged');
     }
     $trigger_output = ModuleHandler::triggerCall('member.dispMemberSignUpForm', 'before', $this->member_config);
     if (!$trigger_output->toBool()) {
         return $trigger_output;
     }
     if ($this->member_config->enable_join != 'Y') {
         return $this->stop('msg_signup_disabled');
     }
     $oMemberAdminView =& getAdminView('member');
     $formTags = $oMemberAdminView->_getMemberInputTag($member_info);
     Context::set('formTags', $formTags);
     $member_config = $oMemberModel->getMemberConfig();
     Context::set('member_config', $member_config);
     global $lang;
     $identifierForm->title = $lang->{$member_config->identifier};
     $identifierForm->name = $member_config->identifier;
     $identifierForm->value = $member_info->{$member_config->identifier};
     Context::set('identifierForm', $identifierForm);
     // Set a template file
     $this->setTemplateFile('signup_form');
 }
 function dispMagiccontentSearchDocument()
 {
     $oDocumentAdminView =& getAdminView('document');
     $oDocumentAdminView->dispDocumentAdminList();
     $this->setLayoutFile('default_layout');
     $this->setTemplateFile('search_document');
 }
 /**
  * @brief Display documents written by the member
  */
 function dispMemberOwnDocument()
 {
     $oMemberModel = getModel('member');
     // A message appears if the user is not logged-in
     if (!$oMemberModel->isLogged()) {
         return $this->stop('msg_not_logged');
     }
     $logged_info = Context::get('logged_info');
     $member_srl = $logged_info->member_srl;
     $module_srl = Context::get('module_srl');
     Context::set('module_srl', Context::get('selected_module_srl'));
     Context::set('search_target', 'member_srl');
     Context::set('search_keyword', $member_srl);
     $oDocumentAdminView = getAdminView('document');
     $oDocumentAdminView->dispDocumentAdminList();
     $oSecurity = new Security();
     $oSecurity->encodeHTML('document_list...title', 'search_target', 'search_keyword');
     Context::set('module_srl', $module_srl);
     $this->setTemplateFile('document_list');
 }
 function dispTextyleToolConfigAddon()
 {
     $oAddonModel =& getAdminModel('addon');
     $oAdminView =& getAdminView('admin');
     $addon_list = $oAddonModel->getAddonList($this->site_srl);
     Context::set('addon_list', $addon_list);
 }
示例#5
0
 /**
  * get a module instance and execute an action
  * @return ModuleObject executed module instance
  **/
 function procModule()
 {
     $oModuleModel =& getModel('module');
     // 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();
         if ($this->httpStatusCode) {
             $oMessageObject->setHttpStatusCode($this->httpStatusCode);
         }
         return $oMessageObject;
     }
     // Get action information with conf/module.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';
         $this->httpStatusCode = '404';
         $type = Mobile::isFromMobilePhone() ? 'mobile' : 'view';
         $oMessageObject =& ModuleHandler::getModuleInstance('message', $type);
         $oMessageObject->setError(-1);
         $oMessageObject->setMessage($this->error);
         $oMessageObject->dispMessage();
         if ($this->httpStatusCode) {
             $oMessageObject->setHttpStatusCode($this->httpStatusCode);
         }
         return $oMessageObject;
     }
     // get type, kind
     $type = $xml_info->action->{$this->act}->type;
     $ruleset = $xml_info->action->{$this->act}->ruleset;
     $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);
     }
     // admin menu check
     if (Context::isInstalled()) {
         $oMenuAdminModel =& getAdminModel('menu');
         $output = $oMenuAdminModel->getMenuByTitle('__XE_ADMIN__');
         if (!$output->menu_srl) {
             $oAdminClass =& getClass('admin');
             $oAdminClass->createXeAdminMenu();
         } else {
             if (!is_readable($output->php_file)) {
                 $oMenuAdminController =& getAdminController('menu');
                 $oMenuAdminController->makeXmlFile($output->menu_srl);
             }
         }
     }
     // Admin ip
     $logged_info = Context::get('logged_info');
     if ($kind == 'admin' && $_SESSION['denied_admin'] == 'Y') {
         $this->error = "msg_not_permitted_act";
         $oMessageObject =& ModuleHandler::getModuleInstance('message', $type);
         $oMessageObject->setError(-1);
         $oMessageObject->setMessage($this->error);
         $oMessageObject->dispMessage();
         return $oMessageObject;
     }
     // 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)) {
         $type = Mobile::isFromMobilePhone() ? 'mobile' : 'view';
         $oMessageObject =& ModuleHandler::getModuleInstance('message', $type);
         $oMessageObject->setError(-1);
         $oMessageObject->setMessage($this->error);
         $oMessageObject->dispMessage();
         if ($this->httpStatusCode) {
             $oMessageObject->setHttpStatusCode($this->httpStatusCode);
         }
         return $oMessageObject;
     }
     // 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';
             $oMessageObject =& ModuleHandler::getModuleInstance('message', $type);
             $oMessageObject->setError(-1);
             $oMessageObject->setMessage($this->error);
             $oMessageObject->dispMessage();
             if ($this->httpStatusCode) {
                 $oMessageObject->setHttpStatusCode($this->httpStatusCode);
             }
             return $oMessageObject;
         }
         $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->ruleset = $xml_info->action->{$this->act}->ruleset;
                 $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;
             $ruleset = $forward->ruleset;
             $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);
             $oMemberModel =& getModel('member');
             if ($this->module == "admin" && $type == "view") {
                 if ($logged_info->is_admin == 'Y') {
                     if ($this->act != 'dispLayoutAdminLayoutModify') {
                         $oAdminView =& getAdminView('admin');
                         $oAdminView->makeGnbUrl($forward->module);
                         $oModule->setLayoutPath("./modules/admin/tpl");
                         $oModule->setLayoutFile("layout.html");
                     }
                 } else {
                     $this->error = 'msg_is_not_administrator';
                     $oMessageObject =& ModuleHandler::getModuleInstance('message', $type);
                     $oMessageObject->setError(-1);
                     $oMessageObject->setMessage($this->error);
                     $oMessageObject->dispMessage();
                     return $oMessageObject;
                 }
             }
             if ($kind == 'admin') {
                 $grant = $oModuleModel->getGrant($this->module_info, $logged_info);
                 if (!$grant->is_admin && !$grant->manager) {
                     $this->error = 'msg_is_not_manager';
                     $oMessageObject =& ModuleHandler::getModuleInstance('message', 'view');
                     $oMessageObject->setError(-1);
                     $oMessageObject->setMessage($this->error);
                     $oMessageObject->dispMessage();
                     return $oMessageObject;
                 }
             }
         } 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';
                 $oModule->setError(-1);
                 $oModule->setMessage($this->error);
                 return $oModule;
             }
         }
     }
     // ruleset check...
     if (!empty($ruleset)) {
         $rulesetModule = $forward->module ? $forward->module : $this->module;
         $rulesetFile = $oModuleModel->getValidatorFilePath($rulesetModule, $ruleset, $this->mid);
         if (!empty($rulesetFile)) {
             if ($_SESSION['XE_VALIDATOR_ERROR_LANG']) {
                 $errorLang = $_SESSION['XE_VALIDATOR_ERROR_LANG'];
                 foreach ($errorLang as $key => $val) {
                     Context::setLang($key, $val);
                 }
                 unset($_SESSION['XE_VALIDATOR_ERROR_LANG']);
             }
             $Validator = new Validator($rulesetFile);
             $result = $Validator->validate();
             if (!$result) {
                 $lastError = $Validator->getLastError();
                 $returnUrl = Context::get('error_return_url');
                 $errorMsg = $lastError['msg'] ? $lastError['msg'] : 'validation error';
                 //for xml response
                 $oModule->setError(-1);
                 $oModule->setMessage($errorMsg);
                 //for html redirect
                 $this->error = $errorMsg;
                 $_SESSION['XE_VALIDATOR_ERROR'] = -1;
                 $_SESSION['XE_VALIDATOR_MESSAGE'] = $this->error;
                 $_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = 'error';
                 $_SESSION['XE_VALIDATOR_RETURN_URL'] = $returnUrl;
                 $this->_setInputValueToSession();
                 return $oModule;
             }
         }
     }
     $oModule->setAct($this->act);
     $this->module_info->module_type = $type;
     $oModule->setModuleInfo($this->module_info, $xml_info);
     if ($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent()) {
         global $lang;
         $header = '<style type="text/css">div.xe_mobile{opacity:0.7;margin:1em 0;padding:.5em;background:#333;border:1px solid #666;border-left:0;border-right:0}p.xe_mobile{text-align:center;margin:1em 0}a.xe_mobile{color:#ff0;font-weight:bold;font-size:24px}@media only screen and (min-width:500px){a.xe_mobile{font-size:15px}}</style>';
         $footer = '<div class="xe_mobile"><p class="xe_mobile"><a class="xe_mobile" href="' . getUrl('m', '1') . '">' . $lang->msg_pc_to_mobile . '</a></p></div>';
         Context::addHtmlHeader($header);
         Context::addHtmlFooter($footer);
     }
     if ($type == "view" && $kind != 'admin') {
         $module_config = $oModuleModel->getModuleConfig('module');
         if ($module_config->htmlFooter) {
             Context::addHtmlFooter($module_config->htmlFooter);
         }
     }
     // if failed message exists in session, set context
     $this->_setInputErrorToContext();
     $procResult = $oModule->proc();
     $methodList = array('XMLRPC' => 1, 'JSON' => 1);
     if (!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()])) {
         $error = $oModule->getError();
         $message = $oModule->getMessage();
         $messageType = $oModule->getMessageType();
         $redirectUrl = $oModule->getRedirectUrl();
         if (!$procResult) {
             $this->error = $message;
             if (!$redirectUrl && Context::get('error_return_url')) {
                 $redirectUrl = Context::get('error_return_url');
             }
             $this->_setInputValueToSession();
         } else {
             if (count($_SESSION['INPUT_ERROR'])) {
                 Context::set('INPUT_ERROR', $_SESSION['INPUT_ERROR']);
                 $_SESSION['INPUT_ERROR'] = '';
             }
         }
         $_SESSION['XE_VALIDATOR_ERROR'] = $error;
         if ($message != 'success') {
             $_SESSION['XE_VALIDATOR_MESSAGE'] = $message;
         }
         $_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType;
         if (Context::get('xeVirtualRequestMethod') != 'xml') {
             $_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl;
         }
     }
     unset($logged_info);
     return $oModule;
 }
 /**
  * get a module instance and execute an action
  * @return ModuleObject executed module instance
  * */
 function procModule()
 {
     $oModuleModel = getModel('module');
     $display_mode = Mobile::isFromMobilePhone() ? 'mobile' : 'view';
     // If error occurred while preparation, return a message instance
     if ($this->error) {
         $this->_setInputErrorToContext();
         $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
         $oMessageObject->setError(-1);
         $oMessageObject->setMessage($this->error);
         $oMessageObject->dispMessage();
         if ($this->httpStatusCode) {
             $oMessageObject->setHttpStatusCode($this->httpStatusCode);
         }
         return $oMessageObject;
     }
     // Get action information with conf/module.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';
         $this->httpStatusCode = '404';
         $this->_setInputErrorToContext();
         $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
         $oMessageObject->setError(-1);
         $oMessageObject->setMessage($this->error);
         $oMessageObject->dispMessage();
         if ($this->httpStatusCode) {
             $oMessageObject->setHttpStatusCode($this->httpStatusCode);
         }
         return $oMessageObject;
     }
     // get type, kind
     $type = $xml_info->action->{$this->act}->type;
     $ruleset = $xml_info->action->{$this->act}->ruleset;
     $kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : '';
     if (!$kind && $this->module == 'admin') {
         $kind = 'admin';
     }
     // check REQUEST_METHOD in controller
     if ($type == 'controller') {
         $allowedMethod = $xml_info->action->{$this->act}->method;
         if (!$allowedMethod) {
             $allowedMethodList[0] = 'POST';
         } else {
             $allowedMethodList = explode('|', strtoupper($allowedMethod));
         }
         if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) {
             $this->error = "msg_invalid_request";
             $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
             $oMessageObject->setError(-1);
             $oMessageObject->setMessage($this->error);
             $oMessageObject->dispMessage();
             return $oMessageObject;
         }
     }
     if ($this->module_info->use_mobile != "Y") {
         Mobile::setMobile(FALSE);
     }
     $logged_info = Context::get('logged_info');
     // check CSRF for POST actions
     if (Context::getRequestMethod() === 'POST' && Context::isInstalled() && $this->act !== 'procFileUpload' && !checkCSRF()) {
         $this->error = 'msg_invalid_request';
         $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
         $oMessageObject->setError(-1);
         $oMessageObject->setMessage($this->error);
         $oMessageObject->dispMessage();
         return $oMessageObject;
     }
     // Admin ip
     if ($kind == 'admin' && $_SESSION['denied_admin'] == 'Y') {
         $this->_setInputErrorToContext();
         $this->error = "msg_not_permitted_act";
         $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
         $oMessageObject->setError(-1);
         $oMessageObject->setMessage($this->error);
         $oMessageObject->dispMessage();
         return $oMessageObject;
     }
     // 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->_setInputErrorToContext();
         $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
         $oMessageObject->setError(-1);
         $oMessageObject->setMessage($this->error);
         $oMessageObject->dispMessage();
         if ($this->httpStatusCode) {
             $oMessageObject->setHttpStatusCode($this->httpStatusCode);
         }
         return $oMessageObject;
     }
     // 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->_setInputErrorToContext();
             $this->error = 'msg_invalid_request';
             $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
             $oMessageObject->setError(-1);
             $oMessageObject->setMessage($this->error);
             $oMessageObject->dispMessage();
             if ($this->httpStatusCode) {
                 $oMessageObject->setHttpStatusCode($this->httpStatusCode);
             }
             return $oMessageObject;
         }
         $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} && (stripos($this->act, 'admin') !== FALSE || $xml_info->action->{$this->act}->standalone != 'false')) {
                 $forward = new stdClass();
                 $forward->module = $module;
                 $forward->type = $xml_info->action->{$this->act}->type;
                 $forward->ruleset = $xml_info->action->{$this->act}->ruleset;
                 $forward->act = $this->act;
             } else {
                 $this->error = 'msg_invalid_request';
                 $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
                 $oMessageObject->setError(-1);
                 $oMessageObject->setMessage($this->error);
                 $oMessageObject->dispMessage();
                 return $oMessageObject;
             }
         }
         if (!$forward) {
             $forward = $oModuleModel->getActionForward($this->act);
         }
         if ($forward->module && $forward->type && $forward->act && $forward->act == $this->act) {
             $kind = stripos($forward->act, 'admin') !== FALSE ? 'admin' : '';
             $type = $forward->type;
             $ruleset = $forward->ruleset;
             $tpl_path = $oModule->getTemplatePath();
             $orig_module = $oModule;
             $xml_info = $oModuleModel->getModuleActionXml($forward->module);
             // SECISSUE also check foward act method
             // check REQUEST_METHOD in controller
             if ($type == 'controller') {
                 $allowedMethod = $xml_info->action->{$forward->act}->method;
                 if (!$allowedMethod) {
                     $allowedMethodList[0] = 'POST';
                 } else {
                     $allowedMethodList = explode('|', strtoupper($allowedMethod));
                 }
                 if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) {
                     $this->error = "msg_invalid_request";
                     $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
                     $oMessageObject->setError(-1);
                     $oMessageObject->setMessage($this->error);
                     $oMessageObject->dispMessage();
                     return $oMessageObject;
                 }
             }
             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);
             }
             if (!is_object($oModule)) {
                 $this->_setInputErrorToContext();
                 $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
                 $oMessageObject->setError(-1);
                 $oMessageObject->setMessage('msg_module_is_not_exists');
                 $oMessageObject->dispMessage();
                 if ($this->httpStatusCode) {
                     $oMessageObject->setHttpStatusCode($this->httpStatusCode);
                 }
                 return $oMessageObject;
             }
             if ($this->module == "admin" && $type == "view") {
                 if ($logged_info->is_admin == 'Y') {
                     if ($this->act != 'dispLayoutAdminLayoutModify') {
                         $oAdminView = getAdminView('admin');
                         $oAdminView->makeGnbUrl($forward->module);
                         $oModule->setLayoutPath("./modules/admin/tpl");
                         $oModule->setLayoutFile("layout.html");
                     }
                 } else {
                     $this->_setInputErrorToContext();
                     $this->error = 'msg_is_not_administrator';
                     $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
                     $oMessageObject->setError(-1);
                     $oMessageObject->setMessage($this->error);
                     $oMessageObject->dispMessage();
                     return $oMessageObject;
                 }
             }
             if ($kind == 'admin') {
                 $grant = $oModuleModel->getGrant($this->module_info, $logged_info);
                 if (!$grant->manager) {
                     $this->_setInputErrorToContext();
                     $this->error = 'msg_is_not_manager';
                     $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
                     $oMessageObject->setError(-1);
                     $oMessageObject->setMessage($this->error);
                     $oMessageObject->dispMessage();
                     return $oMessageObject;
                 } else {
                     if (!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager') {
                         $this->_setInputErrorToContext();
                         $this->error = 'msg_is_not_administrator';
                         $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
                         $oMessageObject->setError(-1);
                         $oMessageObject->setMessage($this->error);
                         $oMessageObject->dispMessage();
                         return $oMessageObject;
                     }
                 }
             }
         } 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';
                 $oModule->setError(-1);
                 $oModule->setMessage($this->error);
                 return $oModule;
             }
         }
     }
     // ruleset check...
     if (!empty($ruleset)) {
         $rulesetModule = $forward->module ? $forward->module : $this->module;
         $rulesetFile = $oModuleModel->getValidatorFilePath($rulesetModule, $ruleset, $this->mid);
         if (!empty($rulesetFile)) {
             if ($_SESSION['XE_VALIDATOR_ERROR_LANG']) {
                 $errorLang = $_SESSION['XE_VALIDATOR_ERROR_LANG'];
                 foreach ($errorLang as $key => $val) {
                     Context::setLang($key, $val);
                 }
                 unset($_SESSION['XE_VALIDATOR_ERROR_LANG']);
             }
             $Validator = new Validator($rulesetFile);
             $result = $Validator->validate();
             if (!$result) {
                 $lastError = $Validator->getLastError();
                 $returnUrl = Context::get('error_return_url');
                 $errorMsg = $lastError['msg'] ? $lastError['msg'] : 'validation error';
                 //for xml response
                 $oModule->setError(-1);
                 $oModule->setMessage($errorMsg);
                 //for html redirect
                 $this->error = $errorMsg;
                 $_SESSION['XE_VALIDATOR_ERROR'] = -1;
                 $_SESSION['XE_VALIDATOR_MESSAGE'] = $this->error;
                 $_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = 'error';
                 $_SESSION['XE_VALIDATOR_RETURN_URL'] = $returnUrl;
                 $_SESSION['XE_VALIDATOR_ID'] = Context::get('xe_validator_id');
                 $this->_setInputValueToSession();
                 return $oModule;
             }
         }
     }
     $oModule->setAct($this->act);
     $this->module_info->module_type = $type;
     $oModule->setModuleInfo($this->module_info, $xml_info);
     $skipAct = array('dispEditorConfigPreview' => 1, 'dispLayoutPreviewWithModule' => 1);
     $db_use_mobile = Mobile::isMobileEnabled();
     if ($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true) {
         global $lang;
         $header = '<style>div.xe_mobile{opacity:0.7;margin:1em 0;padding:.5em;background:#333;border:1px solid #666;border-left:0;border-right:0}p.xe_mobile{text-align:center;margin:1em 0}a.xe_mobile{color:#ff0;font-weight:bold;font-size:24px}@media only screen and (min-width:500px){a.xe_mobile{font-size:15px}}</style>';
         $footer = '<div class="xe_mobile"><p class="xe_mobile"><a class="xe_mobile" href="' . getUrl('m', '1') . '">' . $lang->msg_pc_to_mobile . '</a></p></div>';
         Context::addHtmlHeader($header);
         Context::addHtmlFooter($footer);
     }
     if ($type == "view" && $kind != 'admin') {
         $module_config = $oModuleModel->getModuleConfig('module');
         if ($module_config->htmlFooter) {
             Context::addHtmlFooter($module_config->htmlFooter);
         }
         if ($module_config->siteTitle) {
             $siteTitle = Context::getBrowserTitle();
             if (!$siteTitle) {
                 Context::setBrowserTitle($module_config->siteTitle);
             }
         }
     }
     // if failed message exists in session, set context
     $this->_setInputErrorToContext();
     $procResult = $oModule->proc();
     $methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1);
     if (!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()])) {
         $error = $oModule->getError();
         $message = $oModule->getMessage();
         $messageType = $oModule->getMessageType();
         $redirectUrl = $oModule->getRedirectUrl();
         if ($messageType == 'error') {
             debugPrint($message, 'ERROR');
         }
         if (!$procResult) {
             $this->error = $message;
             if (!$redirectUrl && Context::get('error_return_url')) {
                 $redirectUrl = Context::get('error_return_url');
             }
             $this->_setInputValueToSession();
         } else {
         }
         $_SESSION['XE_VALIDATOR_ERROR'] = $error;
         $_SESSION['XE_VALIDATOR_ID'] = Context::get('xe_validator_id');
         if ($message != 'success') {
             $_SESSION['XE_VALIDATOR_MESSAGE'] = $message;
         }
         $_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType;
         if (Context::get('xeVirtualRequestMethod') != 'xml') {
             $_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl;
         }
     }
     unset($logged_info);
     return $oModule;
 }
示例#7
0
 /**
  * @brief 홈페이지 게시판 정보
  **/
 function dispHomepageBoardInfo()
 {
     // 스킨 목록을 구해옴
     $oModuleModel =& getModel('module');
     $skin_path = sprintf('./modules/%s', $this->module_info->module);
     $skin_list = $oModuleModel->getSkins($skin_path);
     Context::set('skin_list', $skin_list);
     $oBoardAdminView =& getAdminView('board');
     $oBoardAdminView->init();
     Context::set('module_info', $this->module_info);
     $this->setTemplateFile('board_insert');
 }
 /**
  * Get Package List
  */
 function getPackageList($type, $order_target = 'newest', $order_type = 'desc', $page = '1', $search_keyword = NULL, $category_srl = NULL, $parent_program = NULL)
 {
     if ($type == 'menu') {
         $params["act"] = "getResourceapiMenuPackageList";
     } elseif ($type == 'skin') {
         $params["act"] = "getResourceapiSkinPackageList";
         $params['parent_program'] = $parent_program;
     } else {
         $params["act"] = "getResourceapiPackagelist";
     }
     $oAdminView = getAdminView('autoinstall');
     $params["order_target"] = $order_target;
     $params["order_type"] = $order_type;
     $params["page"] = $page;
     if ($category_srl) {
         $params["category_srl"] = $category_srl;
     }
     if ($search_keyword) {
         $params["search_keyword"] = $search_keyword;
     }
     $xmlDoc = XmlGenerater::getXmlDoc($params);
     if ($xmlDoc && $xmlDoc->response->packagelist->item) {
         $item_list = $oAdminView->rearranges($xmlDoc->response->packagelist->item);
         $this->add('item_list', $item_list);
         $array = array('total_count', 'total_page', 'cur_page', 'page_count', 'first_page', 'last_page');
         $page_nav = $oAdminView->rearrange($xmlDoc->response->page_navigation, $array);
         $page_navigation = new PageHandler($page_nav->total_count, $page_nav->total_page, $page_nav->cur_page, 5);
         $this->add('page_navigation', $page_navigation);
     }
 }
示例#9
0
 /**
  * @brief 회원 작성글 보기
  **/
 function dispMemberOwnDocument()
 {
     $oMemberModel =& getModel('member');
     // 로그인 되어 있지 않을 경우 로그인 되어 있지 않다는 메세지 출력
     if (!$oMemberModel->isLogged()) {
         return $this->stop('msg_not_logged');
     }
     $logged_info = Context::get('logged_info');
     $member_srl = $logged_info->member_srl;
     $module_srl = Context::get('module_srl');
     Context::set('module_srl', Context::get('selected_module_srl'));
     Context::set('search_target', 'member_srl');
     Context::set('search_keyword', $member_srl);
     $oDocumentAdminView =& getAdminView('document');
     $oDocumentAdminView->dispDocumentAdminList();
     Context::set('module_srl', $module_srl);
     $this->setTemplateFile('document_list');
 }
示例#10
0
    /**
     * Customer add view (Admin)
     */
    public function dispShopToolAddCustomer(){
        $shopModel = getModel('shop');
        $oMemberAdminView = getAdminView('member');
        $oMemberModel = getModel('member');
        $customerRepository = $shopModel->getCustomerRepository();
        $member_srl = Context::get('member_srl');
        if($member_srl){
            $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl);
            $customer = new Customer($member_info);
            if($customer->password) Context::set('password_exists','Y');
            unset($customer->password);
        }

        $oMemberAdminView->dispMemberAdminInsert();
        $default_group = $oMemberModel->getDefaultGroup($this->module_info->site_srl);
        Context::set('customer',$customer);
        Context::set('default_group',$default_group->group_srl);
    }