/** * save configurations of the communication module * @return void|Object (success : void, fail : Object) */ function procCommunicationAdminInsertConfig() { // get the default information $args = Context::gets('skin', 'colorset', 'editor_skin', 'sel_editor_colorset', 'mskin', 'mcolorset', 'layout_srl', 'mlayout_srl', 'grant_write_default', 'grant_write_group'); $args->editor_colorset = $args->sel_editor_colorset; unset($args->sel_editor_colorset); if (!$args->skin) { $args->skin = 'default'; } if (!$args->colorset) { $args->colorset = 'white'; } if (!$args->editor_skin) { $args->editor_skin = 'default'; } if (!$args->mskin) { $args->mskin = 'default'; } if (!$args->layout_srl) { $args->layout_srl = NULL; } $oCommunicationModel = getModel('communication'); $args->grant_write = $oCommunicationModel->getGrantArray($args->grant_write_default, $args->grant_write_group); unset($args->grant_write_default); unset($args->grant_write_group); // create the module module Controller object $oModuleController = getController('module'); $output = $oModuleController->insertModuleConfig('communication', $args); $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispCommunicationAdminConfig'); return $this->setRedirectUrl($returnUrl, $output); }
/** * @brief 기본설정 module config 에 저장 **/ function procTextmessageAdminInsertConfig() { $oTextmessageModel =& getModel('textmessage'); $args = Context::gets('api_key', 'api_secret', 'callback_url', 'encode_utf16'); // save module configuration. $oModuleControll = getController('module'); $output = $oModuleControll->insertModuleConfig('textmessage', $args); $this->setMessage('success_saved'); $redirectUrl = getNotEncodedUrl('', 'module', 'admin', 'act', 'dispTextmessageAdminConfig'); $this->setRedirectUrl($redirectUrl); }
/** * @brief 스팸필터 설정 **/ function procSpamfilterAdminInsertConfig() { // 기본 정보를 받음 $args = Context::gets('interval', 'limit_count', 'check_trackback'); if ($args->check_trackback != 'Y') { $args->check_trackback = 'N'; } // module Controller 객체 생성하여 입력 $oModuleController =& getController('module'); $output = $oModuleController->insertModuleConfig('spamfilter', $args); return $output; }
/** * @brief notification append **/ function procNotificationAdminInsert() { $params = Context::gets('content', 'mail_content', 'module_srls', 'msgtype', 'sending_method', 'cellphone_fieldname', 'use_authdata'); $extra_vars = new StdClass(); $extra_vars->sender_phone = Context::get('sender_phone'); $extra_vars->admin_phones = Context::get('admin_phones'); $extra_vars->admin_emails = Context::get('admin_emails'); $extra_vars->cellphone_fieldname = Context::get('cellphone_fieldname'); $extra_vars->use_authdata = Context::get('use_authdata'); $extra_vars->reverse_notify = Context::get('reverse_notify'); $extra_vars->use_extravar = Context::get('use_extravar'); $extra_vars->use_extravar_email = Context::get('use_extravar_email'); $extra_vars->force_notify = Context::get('force_notify'); $extra_vars->email_sender_name = Context::get('email_sender_name'); $extra_vars->email_sender_address = Context::get('email_sender_address'); $params->notification_srl = Context::get('noti_srl'); if ($params->notification_srl) { // delete existences $args->notification_srl = $params->notification_srl; $output = executeQuery('notification.deleteNotiCom', $args); if (!$output->toBool()) { return $output; } $output = executeQuery('notification.deleteNotificationModuleSrl', $args); if (!$output->toBool()) { return $output; } } else { // new sequence $params->notification_srl = getNextSequence(); } // insert module srls $module_srls = explode(',', $params->module_srls); foreach ($module_srls as $srl) { unset($args); $args->notification_srl = $params->notification_srl; $args->module_srl = $srl; $output = executeQuery('notification.insertNotificationModuleSrl', $args); if (!$output->toBool()) { return $output; } } $params->extra_vars = serialize($extra_vars); // insert notification $output = executeQuery('notification.insertNotiCom', $params); if (!$output->toBool()) { return $output; } $redirectUrl = getNotEncodedUrl('', 'module', 'admin', 'act', 'dispNotificationAdminModify', 'notification_srl', $params->notification_srl); $this->setRedirectUrl($redirectUrl); }
/** * @brief Configuration */ function procMessageAdminInsertConfig() { // Get information $args = Context::gets('skin', 'mskin', 'colorset', 'mcolorset'); // Create a module Controller object $oModuleController = getController('module'); $output = $oModuleController->insertModuleConfig('message', $args); if (!$output->toBool()) { return $output; } $this->setMessage('success_updated'); $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispMessageAdminConfig'); $this->setRedirectUrl($returnUrl); }
/** * @brief LDAP 인증 연동 설정 **/ function procLdapAdminInsertConfig() { // 기본 정보를 받음 $args = Context::gets('use_ldap', 'ldap_server', 'ldap_port', 'ldap_userdn_prefix', 'ldap_userdn_suffix', 'ldap_basedn', 'ldap_email_entry', 'ldap_nickname_entry', 'ldap_username_entry', 'ldap_group_entry'); if ($args->use_ldap != 'Y') { $args->use_ldap = 'N'; } if (!$args->ldap_port) { $args->ldap_port = 389; } // module Controller 객체 생성하여 입력 $oModuleController =& getController('module'); $output = $oModuleController->insertModuleConfig('ldap', $args); return $output; }
public function testSetGetVars() { $this->assertSame(Context::get('var1'), null); Context::set('var1', 'val1'); $this->assertSame(Context::get('var1'), 'val1'); Context::set('var2', 'val2'); $this->assertSame(Context::get('var2'), 'val2'); Context::set('var3', 'val3'); $data = new stdClass(); $data->var1 = 'val1'; $data->var2 = 'val2'; $this->assertEquals(Context::gets('var1', 'var2'), $data); $data->var3 = 'val3'; $this->assertEquals(Context::getAll(), $data); }
/** * @brief saving config values. **/ function procPaynotyAdminInsert() { $params = Context::gets('admin_phones','admin_emails','sender_name','sender_email','content','mail_content','module_srls','msgtype','sending_method'); $params->config_srl = Context::get('config_srl'); if ($params->config_srl) { // delete existences $args->config_srl = $params->config_srl; $output = executeQuery('paynoty.deleteConfig', $args); if (!$output->toBool()) return $output; $output = executeQuery('paynoty.deleteModule', $args); if (!$output->toBool()) return $output; } else { // new sequence $params->config_srl = getNextSequence(); } // insert module srls $module_srls = explode(',', $params->module_srls); foreach ($module_srls as $srl) { unset($args); $args->config_srl = $params->config_srl; $args->module_srl = $srl; $output = executeQuery('paynoty.insertModuleSrl', $args); if (!$output->toBool()) return $output; } //$params->extra_vars = serialize($extra_vars); debugPrint('params : ' . serialize($params)); // insert paynoty $output = executeQuery('paynoty.insertConfig', $params); debugPrint('insertConfig : ' . serialize($output)); if (!$output->toBool()) { return $output; } $redirectUrl = getNotEncodedUrl('', 'module', 'admin', 'act', 'dispPaynotyAdminModify','config_srl',$params->config_srl); $this->setRedirectUrl($redirectUrl); }
/** * @brief 설정 **/ function procKrzipAdminInsertConfig() { // 기본 정보를 받음 $args = Context::gets('krzip_server_hostname', 'krzip_server_port', 'krzip_server_query'); if (!$args->krzip_server_hostname) { $args->krzip_server_hostname = $this->hostname; } if (!$args->krzip_server_port) { $args->krzip_server_port = $this->port; } if (!$args->krzip_server_query) { $args->krzip_server_query = $this->query; } // module Controller 객체 생성하여 입력 $oModuleController =& getController('module'); $output = $oModuleController->insertModuleConfig('krzip', $args); return $output; }
/** * @brief communication 모듈 설정 저장 **/ function procCommunicationAdminInsertConfig() { // 기본 정보를 받음 $args = Context::gets('skin', 'colorset', 'editor_skin', 'editor_colorset'); if (!$args->skin) { $args->skin = "default"; } if (!$args->colorset) { $args->colorset = "white"; } if (!$args->editor_skin) { $args->editor_skin = "default"; } // module Controller 객체 생성하여 입력 $oModuleController =& getController('module'); $output = $oModuleController->insertModuleConfig('communication', $args); return $output; }
function procSpamfilterAdminInsertConfig() { // Get the default information $argsConfig = Context::gets('limits', 'check_trackback'); $flag = Context::get('flag'); //interval, limit_count if ($argsConfig->check_trackback != 'Y') { $argsConfig->check_trackback = 'N'; } if ($argsConfig->limits != 'Y') { $argsConfig->limits = 'N'; } // Create and insert the module Controller object $oModuleController =& getController('module'); $moduleConfigOutput = $oModuleController->insertModuleConfig('spamfilter', $argsConfig); if (!$moduleConfigOutput->toBool()) { return $moduleConfigOutput; } $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminSetting'); $this->setRedirectUrl($returnUrl); }
/** * save configurations of the communication module * @return void|Object (success : void, fail : Object) **/ function procCommunicationAdminInsertConfig() { // get the default information $args = Context::gets('skin', 'colorset', 'editor_skin', 'editor_colorset', 'mskin'); if (!$args->skin) { $args->skin = 'default'; } if (!$args->colorset) { $args->colorset = 'white'; } if (!$args->editor_skin) { $args->editor_skin = 'default'; } if (!$args->mskin) { $args->mskin = 'default'; } // create the module module Controller object $oModuleController =& getController('module'); $output = $oModuleController->insertModuleConfig('communication', $args); $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispCommunicationAdminConfig'); return $this->setRedirectUrl($returnUrl, $output); }
/** * @brief Configuration **/ function procKrzipAdminInsertConfig() { // Get the basic information $args = Context::gets('krzip_server_hostname', 'krzip_server_query'); if (!$args->krzip_server_hostname) { $args->krzip_server_hostname = $this->hostname; } if (!$args->krzip_server_query) { $args->krzip_server_query = $this->query; } // Insert by creating the module Controller object $oModuleController = getController('module'); $output = $oModuleController->insertModuleConfig('krzip', $args); if (!$output->toBool()) { return $output; } $this->setMessage('success_registed'); if (Context::get('success_return_url')) { $this->setRedirectUrl(Context::get('success_return_url')); } else { $this->setRedirectUrl(getNotEncodedUrl('', 'module', 'krzip', 'act', 'dispKrzipAdminConfig')); } }
/** * Update user group information * @return void|Object (void : success, Object : fail) */ function procMemberAdminUpdateGroup() { $group_srl = Context::get('group_srl'); $args = Context::gets('group_srl', 'title', 'description', 'is_default', 'image_mark'); $args->site_srl = 0; $output = $this->updateGroup($args); if (!$output->toBool()) { return $output; } $this->add('group_srl', ''); $this->add('page', Context::get('page')); $this->setMessage('success_updated'); $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispMemberAdminGroupList'); $this->setRedirectUrl($returnUrl); }
function procInstallCheckFtp() { $ftp_info = Context::gets('ftp_user', 'ftp_password', 'ftp_port', 'sftp'); $ftp_info->ftp_port = (int) $ftp_info->ftp_port; if (!$ftp_info->ftp_port) { $ftp_info->ftp_port = 21; } if (!$ftp_info->sftp) { $ftp_info->sftp = 'N'; } if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) { return new Object(-1, 'msg_safe_mode_ftp_needed'); } if ($ftp_info->sftp == 'Y') { $connection = ssh2_connect('localhost', $ftp_info->ftp_port); if (!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) { return new Object(-1, 'msg_ftp_invalid_auth_info'); } } else { require_once _XE_PATH_ . 'libs/ftp.class.php'; $oFtp = new ftp(); if (!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) { return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost')); } if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) { $oFtp->ftp_quit(); return new Object(-1, 'msg_ftp_invalid_auth_info'); } $oFtp->ftp_quit(); } $this->setMessage('msg_ftp_connect_success'); }
/** * @brief update plugin info. (it will be deleted in the future) */ function procEpayAdminUpdatePlugin() { $oEpayModel =& getModel('epay'); // module, act, layout_srl, layout, title을 제외하면 확장변수로 판단.. 좀 구리다.. $extra_vars = Context::getRequestVars(); unset($extra_vars->module); unset($extra_vars->act); unset($extra_vars->plugin_srl); unset($extra_vars->plugin); unset($extra_vars->title); $args = Context::gets('plugin_srl', 'title'); $plugin_info = $oEpayModel->getPluginInfo($args->plugin_srl); // extra_vars의 type이 image일 경우 별도 처리를 해줌 if ($plugin_info->extra_var) { foreach ($plugin_info->extra_var as $name => $vars) { if ($vars->type != 'image') { continue; } $image_obj = $extra_vars->{$name}; $extra_vars->{$name} = $plugin_info->extra_var->{$name}->value; // 삭제 요청에 대한 변수를 구함 $del_var = $extra_vars->{"del_" . $name}; unset($extra_vars->{"del_" . $name}); // 삭제 요청이 있거나, 새로운 파일이 업로드 되면, 기존 파일 삭제 if ($del_var == 'Y' || $image_obj['tmp_name']) { FileHandler::removeFile($extra_vars->{$name}); $extra_vars->{$name} = ''; if ($del_var == 'Y' && !$image_obj['tmp_name']) { continue; } } // 정상적으로 업로드된 파일이 아니면 무시 if (!$image_obj['tmp_name'] || !is_uploaded_file($image_obj['tmp_name'])) { continue; } // 이미지 파일이 아니어도 무시 (swf는 패스~) if (!preg_match("/\\.(jpg|jpeg|gif|png|swf|enc|pem)\$/i", $image_obj['name'])) { continue; } // 경로를 정해서 업로드 if ($vars->location) { $location = $this->mergeKeywords($vars->location, $extra_vars); $path = sprintf("./files/epay/%s/%s/", $args->plugin_srl, $location); } else { $path = sprintf("./files/attach/images/%s/", $args->plugin_srl); } // 디렉토리 생성 if (!FileHandler::makeDir($path)) { continue; } $filename = $path . $image_obj['name']; // 파일 이동 if (!move_uploaded_file($image_obj['tmp_name'], $filename)) { continue; } $extra_vars->{$name} = $filename; } } // DB에 입력하기 위한 변수 설정 $args->extra_vars = serialize($extra_vars); $output = executeQuery('epay.updatePlugin', $args); if (!$output->toBool()) { return $output; } $this->setLayoutPath('./common/tpl'); $this->setLayoutFile('default_layout.html'); $this->setTemplatePath($this->module_path . 'tpl'); $this->setTemplateFile("top_refresh.html"); }
/** * @brief writes module instance configuration. */ function procCashpayAdminInsertModInst() { // get the instance of the model and controller of the module. $oModuleController =& getController('module'); $oModuleModel =& getModel('module'); // get all requested vars $args = Context::getRequestVars(); unset($args->keypass); unset($args->mcert); unset($args->mpriv); // set module name $args->module = 'cashpay'; // check if the module instance already exists if ($args->module_srl) { $module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl); if ($module_info->module_srl != $args->module_srl) { // unset the module_srl to be reallocated if the module instance already exists unset($args->module_srl); } } $args->keypass = $module_info->keypass; $args->mcert = $module_info->mcert; $args->mpriv = $module_info->mpriv; // save inicis key files $path = sprintf("./files/epay/%s/key/%s/", $args->module_srl, $args->inicis_id); if (!FileHandler::makeDir($path)) { return new Object(-1, 'could not create a directory'); } $key_files = Context::gets('keypass', 'mcert', 'mpriv'); foreach ($key_files as $key => $file) { if (!$file) { continue; } $filename = $path . $file['name']; $args->{$key} = $filename; if (!move_uploaded_file($file['tmp_name'], $filename)) { return new Object(-1, 'could not move the file uploaded'); } } // pgcert $pgcert_src = sprintf("%s/modules/cashpay/key/pgcert.pem", _XE_PATH_); $pgcert_path = sprintf("./files/epay/%s/key/pgcert.pem", $args->module_srl); copy($pgcert_src, $pgcert_path); // insert or update depending on the module_srl existence if (!$args->module_srl) { $output = $oModuleController->insertModule($args); if (!$output->toBool()) { return $output; } $msg_code = 'success_registed'; } else { $output = $oModuleController->updateModule($args); if (!$output->toBool()) { return $output; } $msg_code = 'success_updated'; } $this->add('module_srl', $output->get('module_srl')); $this->setMessage($msg_code); $returnUrl = getNotEncodedUrl('', 'module', Context::get('module'), 'act', 'dispCashpayAdminInsertModInst', 'module_srl', $output->get('module_srl')); $this->setRedirectUrl($returnUrl); }
/** * Save layout configuration * save in "ini" format for faceoff * @deprecated * @return void|Object (void : success, Object : fail) */ function procLayoutAdminUserValueInsert() { $oModuleModel = getModel('module'); $mid = Context::get('mid'); if (!$mid) { return new Object(-1, 'msg_invalid_request'); } $site_module_info = Context::get('site_module_info'); $columnList = array('layout_srl'); $module_info = $oModuleModel->getModuleInfoByMid($mid, $site_module_info->site_srl, $columnList); $layout_srl = $module_info->layout_srl; if (!$layout_srl) { return new Object(-1, 'msg_invalid_request'); } $oLayoutModel = getModel('layout'); // save tmp? $temp = Context::get('saveTemp'); if ($temp == 'Y') { $oLayoutModel->setUseUserLayoutTemp(); } else { // delete temp files $this->deleteUserLayoutTempFile($layout_srl); } $this->add('saveTemp', $temp); // write user layout $extension_obj = Context::gets('e1', 'e2', 'neck', 'knee'); $file = $oLayoutModel->getUserLayoutHtml($layout_srl); $content = FileHandler::readFile($file); $content = $this->addExtension($layout_srl, $extension_obj, $content); FileHandler::writeFile($file, $content); // write faceoff.css $css = stripslashes(Context::get('css')); $css_file = $oLayoutModel->getUserLayoutFaceOffCss($layout_srl); FileHandler::writeFile($css_file, $css); // write ini $obj = Context::gets('type', 'align', 'column'); $obj = (array) $obj; $src = $oLayoutModel->getUserLayoutIniConfig($layout_srl); foreach ($obj as $key => $val) { $src[$key] = $val; } $this->insertUserLayoutValue($layout_srl, $src); }
/** * Implement if additional tasks are necessary when installing * * @return Object */ function moduleInstall() { // Register action forward (to use in administrator mode) $oModuleController = getController('module'); $oDB =& DB::getInstance(); $oDB->addIndex("member_group", "idx_site_title", array("site_srl", "title"), true); $oModuleModel = getModel('module'); $config = $oModuleModel->getModuleConfig('member'); if (empty($config)) { $isNotInstall = true; $config = new stdClass(); } // Set the basic information $config->enable_join = 'Y'; $config->enable_openid = 'N'; if (!$config->enable_auth_mail) { $config->enable_auth_mail = 'N'; } if (!$config->image_name) { $config->image_name = 'Y'; } if (!$config->image_mark) { $config->image_mark = 'Y'; } if (!$config->profile_image) { $config->profile_image = 'Y'; } if (!$config->image_name_max_width) { $config->image_name_max_width = '90'; } if (!$config->image_name_max_height) { $config->image_name_max_height = '20'; } if (!$config->image_mark_max_width) { $config->image_mark_max_width = '20'; } if (!$config->image_mark_max_height) { $config->image_mark_max_height = '20'; } if (!$config->profile_image_max_width) { $config->profile_image_max_width = '90'; } if (!$config->profile_image_max_height) { $config->profile_image_max_height = '90'; } if ($config->group_image_mark != 'Y') { $config->group_image_mark = 'N'; } if (!$config->password_strength) { $config->password_strength = 'normal'; } if (!$config->password_hashing_algorithm) { $oPassword = new Password(); $config->password_hashing_algorithm = $oPassword->getBestAlgorithm(); } if (!$config->password_hashing_work_factor) { $config->password_hashing_work_factor = 8; } if (!$config->password_hashing_auto_upgrade) { $config->password_hashing_auto_upgrade = 'Y'; } global $lang; $oMemberModel = getModel('member'); // Create a member controller object $oMemberController = getController('member'); $oMemberAdminController = getAdminController('member'); if (!$config->signupForm || !is_array($config->signupForm)) { $identifier = $isNotInstall ? 'email_address' : 'user_id'; $config->signupForm = $oMemberAdminController->createSignupForm($identifier); $config->identifier = $identifier; // Create Ruleset File FileHandler::makeDir('./files/ruleset'); $oMemberAdminController->_createSignupRuleset($config->signupForm); $oMemberAdminController->_createLoginRuleset($config->identifier); $oMemberAdminController->_createFindAccountByQuestion($config->identifier); } $oModuleController->insertModuleConfig('member', $config); $groups = $oMemberModel->getGroups(); if (!count($groups)) { // Set an administrator, regular member(group1), and associate member(group2) $group_args = new stdClass(); $group_args->title = Context::getLang('admin_group'); $group_args->is_default = 'N'; $group_args->is_admin = 'Y'; $output = $oMemberAdminController->insertGroup($group_args); $group_args = new stdClass(); $group_args->title = Context::getLang('default_group_1'); $group_args->is_default = 'Y'; $group_args->is_admin = 'N'; $output = $oMemberAdminController->insertGroup($group_args); $group_args = new stdClass(); $group_args->title = Context::getLang('default_group_2'); $group_args->is_default = 'N'; $group_args->is_admin = 'N'; $oMemberAdminController->insertGroup($group_args); } // Configure administrator information $admin_args = new stdClass(); $admin_args->is_admin = 'Y'; $output = executeQuery('member.getMemberList', $admin_args); if (!$output->data) { $admin_info = Context::gets('password', 'nick_name', 'email_address', 'user_id'); if ($admin_info->email_address) { $admin_info->user_name = 'admin'; // Insert admin information $oMemberAdminController->insertAdmin($admin_info); // Log-in Processing $output = $oMemberController->doLogin($admin_info->email_address); } } // Register denied ID(default + module name) $oModuleModel = getModel('module'); $module_list = $oModuleModel->getModuleList(); foreach ($module_list as $key => $val) { $oMemberAdminController->insertDeniedID($val->module, ''); } $oMemberAdminController->insertDeniedID('www', ''); $oMemberAdminController->insertDeniedID('root', ''); $oMemberAdminController->insertDeniedID('administrator', ''); $oMemberAdminController->insertDeniedID('telnet', ''); $oMemberAdminController->insertDeniedID('ftp', ''); $oMemberAdminController->insertDeniedID('http', ''); // Create cache directory to use in the member module FileHandler::makeDir('./files/member_extra_info/image_name'); FileHandler::makeDir('./files/member_extra_info/image_mark'); FileHandler::makeDir('./files/member_extra_info/profile_image'); FileHandler::makeDir('./files/member_extra_info/signature'); // 2013. 11. 22 add menu when popup document menu called $oModuleController->insertTrigger('document.getDocumentMenu', 'member', 'controller', 'triggerGetDocumentMenu', 'after'); $oModuleController->insertTrigger('comment.getCommentMenu', 'member', 'controller', 'triggerGetCommentMenu', 'after'); return new Object(); }
function procNproductDeleteComment() { $oCommentModel =& getModel('comment'); $oCommentController =& getController('comment'); if (!$this->grant->write_comment) { return new Object(-1, 'msg_not_permitted'); } if (!$this->module_srl) { return new Object(-1, 'msg_invalid_request'); } $args = Context::gets('item_srl', 'comment_srl'); $args->module_srl = $this->module_srl; $comment_srl = Context::get('comment_srl'); $oComment = $oCommentModel->getComment($comment_srl); if (!$oComment->isExists() || !$oComment->isGranted()) { return new Object(-1, 'msg_invalid_request'); } $output = $oCommentController->deleteComment($oComment->comment_srl); if (!$output->toBool()) { return $output; } $this->setRedirectUrl(getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', '', 'item_srl', Context::get('item_srl'))); }
/** * @brief 설치시 추가 작업이 필요할시 구현 **/ function moduleInstall() { // action forward에 등록 (관리자 모드에서 사용하기 위함) $oModuleController =& getController('module'); $oDB =& DB::getInstance(); $oDB->addIndex("member_group", "idx_site_title", array("site_srl", "title"), true); $oModuleModel =& getModel('module'); $args = $oModuleModel->getModuleConfig('member'); // 기본 정보를 세팅 $args->enable_join = 'Y'; if (!$args->enable_openid) { $args->enable_openid = 'N'; } if (!$args->enable_auth_mail) { $args->enable_auth_mail = 'N'; } if (!$args->image_name) { $args->image_name = 'Y'; } if (!$args->image_mark) { $args->image_mark = 'Y'; } if (!$args->profile_image) { $args->profile_image = 'Y'; } if (!$args->image_name_max_width) { $args->image_name_max_width = '90'; } if (!$args->image_name_max_height) { $args->image_name_max_height = '20'; } if (!$args->image_mark_max_width) { $args->image_mark_max_width = '20'; } if (!$args->image_mark_max_height) { $args->image_mark_max_height = '20'; } if (!$args->profile_image_max_width) { $args->profile_image_max_width = '80'; } if (!$args->profile_image_max_height) { $args->profile_image_max_height = '80'; } if ($args->group_image_mark != 'Y') { $args->group_image_mark = 'N'; } $oModuleController->insertModuleConfig('member', $args); // 멤버 컨트롤러 객체 생성 $oMemberModel =& getModel('member'); $oMemberController =& getController('member'); $oMemberAdminController =& getAdminController('member'); $groups = $oMemberModel->getGroups(); if (!count($groups)) { // 관리자, 정회원, 준회원 그룹을 입력 $group_args->title = Context::getLang('admin_group'); $group_args->is_default = 'N'; $group_args->is_admin = 'Y'; $output = $oMemberAdminController->insertGroup($group_args); unset($group_args); $group_args->title = Context::getLang('default_group_1'); $group_args->is_default = 'Y'; $group_args->is_admin = 'N'; $output = $oMemberAdminController->insertGroup($group_args); unset($group_args); $group_args->title = Context::getLang('default_group_2'); $group_args->is_default = 'N'; $group_args->is_admin = 'N'; $oMemberAdminController->insertGroup($group_args); } // 관리자 정보 세팅 $admin_args->is_admin = 'Y'; $output = executeQuery('member.getMemberList', $admin_args); if (!$output->data) { $admin_info = Context::gets('user_id', 'password', 'nick_name', 'user_name', 'email_address'); if ($admin_info->user_id) { // 관리자 정보 입력 $oMemberAdminController->insertAdmin($admin_info); // 로그인 처리시킴 $output = $oMemberController->doLogin($admin_info->user_id); } } // 금지 아이디 등록 (기본 + 모듈명) $oModuleModel =& getModel('module'); $module_list = $oModuleModel->getModuleList(); foreach ($module_list as $key => $val) { $oMemberAdminController->insertDeniedID($val->module, ''); } $oMemberAdminController->insertDeniedID('www', ''); $oMemberAdminController->insertDeniedID('root', ''); $oMemberAdminController->insertDeniedID('administrator', ''); $oMemberAdminController->insertDeniedID('telnet', ''); $oMemberAdminController->insertDeniedID('ftp', ''); $oMemberAdminController->insertDeniedID('http', ''); // member 에서 사용할 cache디렉토리 생성 FileHandler::makeDir('./files/member_extra_info/image_name'); FileHandler::makeDir('./files/member_extra_info/image_mark'); FileHandler::makeDir('./files/member_extra_info/profile_image'); FileHandler::makeDir('./files/member_extra_info/signature'); return new Object(); }
/** * @brief 메뉴 메뉴 삭제 **/ function procMenuAdminDeleteItem() { // 변수 정리 $args = Context::gets('menu_srl', 'menu_item_srl'); $oMenuAdminModel =& getAdminModel('menu'); // 원정보를 가져옴 $item_info = $oMenuAdminModel->getMenuItemInfo($args->menu_item_srl); if ($item_info->parent_srl) { $parent_srl = $item_info->parent_srl; } // 자식 노드가 있는지 체크하여 있으면 삭제 못한다는 에러 출력 $output = executeQuery('menu.getChildMenuCount', $args); if (!$output->toBool()) { return $output; } if ($output->data->count > 0) { return new Object(-1, 'msg_cannot_delete_for_child'); } // DB에서 삭제 $output = executeQuery("menu.deleteMenuItem", $args); if (!$output->toBool()) { return $output; } // 해당 메뉴의 정보를 구함 $menu_info = $oMenuAdminModel->getMenu($args->menu_srl); $menu_title = $menu_info->title; // XML 파일을 갱신하고 위치을 넘겨 받음 $xml_file = $this->makeXmlFile($args->menu_srl); // 이미지 버튼 모두 삭제 if ($item_info->normal_btn) { FileHandler::removeFile($item_info->normal_btn); } if ($item_info->hover_btn) { FileHandler::removeFile($item_info->hover_btn); } if ($item_info->active_btn) { FileHandler::removeFile($item_info->active_btn); } $this->add('xml_file', $xml_file); $this->add('menu_title', $menu_title); $this->add('menu_item_srl', $parent_srl); $this->setMessage('success_deleted'); }
/** * Delete a category * @return void */ function procDocumentDeleteCategory() { // List variables $args = Context::gets('module_srl', 'category_srl'); $oDB =& DB::getInstance(); $oDB->begin(); // Check permissions $oModuleModel = getModel('module'); $columnList = array('module_srl', 'module'); $module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl, $columnList); $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); if (!$grant->manager) { return new Object(-1, 'msg_not_permitted'); } $oDocumentModel = getModel('document'); // Get original information $category_info = $oDocumentModel->getCategory($args->category_srl); if ($category_info->parent_srl) { $parent_srl = $category_info->parent_srl; } // Display an error that the category cannot be deleted if it has a child node if ($oDocumentModel->getCategoryChlidCount($args->category_srl)) { return new Object(-1, 'msg_cannot_delete_for_child'); } // Remove from the DB $output = $this->deleteCategory($args->category_srl); if (!$output->toBool()) { $oDB->rollback(); return $output; } // Update the xml file and get its location $xml_file = $this->makeCategoryFile($args->module_srl); $oDB->commit(); $this->add('xml_file', $xml_file); $this->add('category_srl', $parent_srl); $this->setMessage('success_deleted'); }
/** * @brief Add and update a file into the file box **/ function procModuleFileBoxAdd() { $ajax = Context::get('ajax'); if ($ajax) { Context::setRequestMethod('JSON'); } $logged_info = Context::get('logged_info'); if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) { return new Object(-1, 'msg_not_permitted'); } $vars = Context::gets('addfile', 'filter'); $attributes = Context::getRequestVars(); foreach ($attributes as $key => $value) { if (!(strpos($key, 'attribute_name') === false)) { $vars->comment = $vars->comment . ';' . $value; } if (!(strpos($key, 'attribute_value') === false)) { $vars->comment = $vars->comment . ':' . $value; } } $vars->comment = substr($vars->comment, 1); $module_filebox_srl = Context::get('module_filebox_srl'); $ext = strtolower(substr(strrchr($vars->addfile['name'], '.'), 1)); $vars->ext = $ext; if ($vars->filter) { $filter = explode(',', $vars->filter); } else { $filter = array('jpg', 'jpeg', 'gif', 'png'); } if (!in_array($ext, $filter)) { return new Object(-1, 'msg_error_occured'); } $vars->member_srl = $logged_info->member_srl; // update if ($module_filebox_srl > 0) { $vars->module_filebox_srl = $module_filebox_srl; $output = $this->updateModuleFileBox($vars); // insert } else { if (!Context::isUploaded()) { return new Object(-1, 'msg_error_occured'); } $addfile = Context::get('addfile'); if (!is_uploaded_file($addfile['tmp_name'])) { return new Object(-1, 'msg_error_occured'); } if ($vars->addfile['error'] != 0) { return new Object(-1, 'msg_error_occured'); } $output = $this->insertModuleFileBox($vars); } $this->setTemplatePath($this->module_path . 'tpl'); if (!$ajax) { $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispModuleAdminFileBox'); $this->setRedirectUrl($returnUrl); return; } else { $this->add('save_filename', $output->get('save_filename')); } }
function procInstallCheckFtp() { $ftp_info = Context::gets('ftp_user', 'ftp_password', 'ftp_port'); $ftp_info->ftp_port = (int) $ftp_info->ftp_port; if (!$ftp_info->ftp_port) { $ftp_info->ftp_port = 21; } if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) { return new Object(-1, 'msg_safe_mode_ftp_needed'); } require_once _XE_PATH_ . 'libs/ftp.class.php'; $oFtp = new ftp(); if (!$oFtp->ftp_connect('localhost', $ftp_info->ftp_port)) { return new Object(-1, 'msg_ftp_not_connected'); } if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) { $oFtp->ftp_quit(); return new Object(-1, 'msg_ftp_invalid_auth_info'); } $oFtp->ftp_quit(); $this->setMessage('msg_ftp_connect_success'); }
/** * Update sitelock configuration. */ function procAdminUpdateSitelock() { $vars = Context::gets('sitelock_locked', 'sitelock_allowed_ip', 'sitelock_title', 'sitelock_message'); $allowed_ip = array_map('trim', preg_split('/[\\r\\n]/', $vars->sitelock_allowed_ip)); $allowed_ip = array_unique(array_filter($allowed_ip, function ($item) { return $item !== ''; })); if ($vars->sitelock_locked === 'Y') { if (!Rhymix\Framework\Filters\IpFilter::inRanges('127.0.0.1', $allowed_ip)) { array_unshift($allowed_ip, '127.0.0.1'); } if (!Rhymix\Framework\Filters\IpFilter::inRanges(RX_CLIENT_IP, $allowed_ip)) { array_unshift($allowed_ip, RX_CLIENT_IP); } } if (!Rhymix\Framework\Filters\IpFilter::validateRanges($allowed_ip)) { return new Object(-1, 'msg_invalid_ip'); } Rhymix\Framework\Config::set('lock.locked', $vars->sitelock_locked === 'Y'); Rhymix\Framework\Config::set('lock.title', trim($vars->sitelock_title)); Rhymix\Framework\Config::set('lock.message', trim($vars->sitelock_message)); Rhymix\Framework\Config::set('lock.allow', array_values($allowed_ip)); Rhymix\Framework\Config::save(); $this->setMessage('success_updated'); $this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigSitelock')); }
/** * Insert alias for document * @return void|object */ function procDocumentAdminInsertAlias() { $args = Context::gets('module_srl', 'document_srl', 'alias_title'); $alias_srl = Context::get('alias_srl'); if (!$alias_srl) { $args->alias_srl = getNextSequence(); $query = "document.insertAlias"; } else { $args->alias_srl = $alias_srl; $query = "document.updateAlias"; } $output = executeQuery($query, $args); $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispDocumentAdminAlias', 'document_srl', $args->document_srl); return $this->setRedirectUrl($returnUrl, $output); }
/** * @brief 사용자 그룹 정보 수정 **/ function procMemberAdminUpdateGroup() { $group_srl = Context::get('group_srl'); $mode = Context::get('mode'); switch ($mode) { case 'delete': $output = $this->deleteGroup($group_srl); if (!$output->toBool()) { return $output; } $msg_code = 'success_deleted'; break; case 'update': $args = Context::gets('group_srl', 'title', 'description', 'is_default', 'image_mark'); $args->site_srl = 0; $output = $this->updateGroup($args); if (!$output->toBool()) { return $output; } $msg_code = 'success_updated'; break; } $this->add('group_srl', ''); $this->add('page', Context::get('page')); $this->setMessage($msg_code); }
/** * @brief insert item **/ function procNproductAdminInsertItem() { $oFileController =& getController('file'); $oNproductController =& getController('nproduct'); $oNproductModel =& getModel('nproduct'); $args = Context::getRequestVars(); $args_check = $args; // before $output = ModuleHandler::triggerCall('nproduct.insertItem', 'before', $args); if (!$output->toBool()) { return $output; } /* * save item info , get item_srl */ $output = $oNproductController->insertItem($args); if (!$output->toBool()) { return $output; } $item_srl = $output->get('item_srl'); $this->add('item_srl', $item_srl); if ($item_stock > 0) { $args->item_stock = $iem_stock; } /* * save file */ $args = Context::gets('module_srl', 'thumbnail_image', 'contents_file'); $args->item_srl = $item_srl; if (is_uploaded_file($args->thumbnail_image['tmp_name'])) { $output = $oFileController->insertFile($args->thumbnail_image, $args->module_srl, $args->item_srl); if (!$output || !$output->toBool()) { return $output; } $args->thumb_file_srl = $output->get('file_srl'); } if (is_uploaded_file($args->contents_file['tmp_name'])) { $output = $oFileController->insertFile($args->contents_file, $args->module_srl, $item_srl); if (!$output || !$output->toBool()) { return $output; } $args->file_srl = $output->get('file_srl'); } if ($args->file_srl || $args->thumb_file_srl) { $output = executeQuery('nproduct.updateItemFile', $args); if (!$output->toBool()) { return $output; } } $oFileController->setFilesValid($item_srl); /* * extra_vars insert */ // extras $extra_vars = $oNproductModel->getExtraVars($args->module_srl); $extra_vars = delObjectVars($extra_vars, $args); unset($args); foreach ($extra_vars as $k => $v) { $ex_args->item_srl = $item_srl; $ex_args->name = $k; $ex_args->value = $v->getValuePlain(); $output = executeQuery('nproduct.deleteNproductExtraVars', $ex_args); if (!$output->toBool()) { return $output; } $output = executeQuery('nproduct.insertNproductExtraVars', $ex_args); if (!$output->toBool()) { return $output; } } // before $output = ModuleHandler::triggerCall('nproduct.insertItem', 'after', $args); if (!$output->toBool()) { return $output; } $this->setMessage('success_registed'); if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) { $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', Context::get('module'), 'act', 'dispNproductAdminUpdateItem', 'module_srl', Context::get('module_srl'), 'item_srl', $item_srl); $this->setRedirectUrl($returnUrl); return; } }
function procIssuetrackerAdminManageCheckedIssue() { $module_srl = Context::get('module_srl'); $cart = Context::get('cart'); if ($cart) { $document_srl_list = explode('|@|', $cart); } else { $document_srl_list = array(); } $document_srl_count = count($document_srl_list); $objs = Context::gets('priority_srl', 'component_srl', 'type_srl', 'milestone_srl'); $oController =& getController('issuetracker'); foreach ($document_srl_list as $target_srl) { $output = $oController->insertHistory($target_srl, $objs, $module_srl, true); if (!$output->toBool()) { return $output; } } $_SESSION['document_management'] = array(); $this->setMessage('success_updated'); }