/**
  * @brief inserts virtual account numbers into the paypal DB table, called by dispPaypalAdminInsert
  */
 function procPaypalAdminInsert()
 {
     $count = 0;
     // count for inserting records
     $bank = Context::get('bank');
     $van_list = explode("\n", Context::get('van_list'));
     foreach ($van_list as $van) {
         if (!$van) {
             continue;
         }
         // check if $van is empty
         $args = new stdClass();
         $args->bank = $bank;
         $args->van = trim($van);
         $output = executeQuery('paypal.insertAccount', $args);
         if (!$output->toBool()) {
             return $output;
         }
         $count++;
     }
     $this->setMessage(sprintf(Context::getLang('msg_regist_count'), $count));
     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', 'dispPaypalAdminInsert');
         $this->setRedirectUrl($returnUrl);
     }
 }
 /**
  * @brief 관리자 페이지에서 선택된 설문조사들을 삭제
  **/
 function procPollAdminDeleteChecked()
 {
     // 선택된 글이 없으면 오류 표시
     $cart = Context::get('cart');
     if (!$cart) {
         return $this->stop('msg_cart_is_null');
     }
     $poll_srl_list = explode('|@|', $cart);
     $poll_count = count($poll_srl_list);
     if (!$poll_count) {
         return $this->stop('msg_cart_is_null');
     }
     // 글삭제
     for ($i = 0; $i < $poll_count; $i++) {
         $poll_index_srl = trim($poll_srl_list[$i]);
         if (!$poll_index_srl) {
             continue;
         }
         $output = $this->deletePollTitle($poll_index_srl, true);
         if (!$output->toBool()) {
             return $output;
         }
     }
     $this->setMessage(sprintf(Context::getLang('msg_checked_poll_is_deleted'), $poll_count));
 }
Example #3
0
 /**
  * @brief Execute a method of the component when the component requests ajax
  **/
 function procEditorCall()
 {
     $component = Context::get('component');
     $method = Context::get('method');
     if (!$component) {
         return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
     }
     $oEditorModel =& getModel('editor');
     $oComponent =& $oEditorModel->getComponentObject($component);
     if (!$oComponent->toBool()) {
         return $oComponent;
     }
     if (!method_exists($oComponent, $method)) {
         return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
     }
     //$output = call_user_method($method, $oComponent);
     //$output = call_user_func(array($oComponent, $method));
     if (method_exists($oComponent, $method)) {
         $output = $oComponent->{$method}();
     } else {
         return new Object(-1, sprintf('%s method is not exists', $method));
     }
     if ((is_a($output, 'Object') || is_subclass_of($output, 'Object')) && !$output->toBool()) {
         return $output;
     }
     $this->setError($oComponent->getError());
     $this->setMessage($oComponent->getMessage());
     $vars = $oComponent->getVariables();
     if (count($vars)) {
         foreach ($vars as $key => $val) {
             $this->add($key, $val);
         }
     }
 }
Example #4
0
 /**
  * Get the board module admin simple setting page
  * @return void
  */
 public function getBoardAdminSimpleSetup($moduleSrl, $setupUrl)
 {
     if (!$moduleSrl) {
         return;
     }
     Context::set('module_srl', $moduleSrl);
     // default module info setting
     $oModuleModel = getModel('module');
     $moduleInfo = $oModuleModel->getModuleInfoByModuleSrl($moduleSrl);
     $moduleInfo->use_status = explode('|@|', $moduleInfo->use_status);
     if ($moduleInfo) {
         Context::set('module_info', $moduleInfo);
     }
     // get document status list
     $oDocumentModel = getModel('document');
     $documentStatusList = $oDocumentModel->getStatusNameList();
     Context::set('document_status_list', $documentStatusList);
     // set order target list
     foreach ($this->order_target as $key) {
         $order_target[$key] = Context::getLang($key);
     }
     $order_target['list_order'] = Context::getLang('document_srl');
     $order_target['update_order'] = Context::getLang('last_update');
     Context::set('order_target', $order_target);
     // for advanced language & url
     $oAdmin = getClass('admin');
     Context::set('setupUrl', $setupUrl);
     // Extract admin ID set in the current module
     $admin_member = $oModuleModel->getAdminId($moduleSrl);
     Context::set('admin_member', $admin_member);
     $oTemplate =& TemplateHandler::getInstance();
     $html = $oTemplate->compile($this->module_path . 'tpl/', 'board_setup_basic');
     return $html;
 }
Example #5
0
 /**
  * @brief 컴포넌트의 팝업 출력을 요청을 받는 action
  **/
 function dispEditorPopup()
 {
     // css 파일 추가
     Context::addCssFile($this->module_path . "tpl/css/editor.css");
     // 변수 정리
     $editor_sequence = Context::get('editor_sequence');
     $component = Context::get('component');
     $site_module_info = Context::get('site_module_info');
     $site_srl = (int) $site_module_info->site_srl;
     // component 객체를 받음
     $oEditorModel =& getModel('editor');
     $oComponent =& $oEditorModel->getComponentObject($component, $editor_sequence, $site_srl);
     if (!$oComponent->toBool()) {
         Context::set('message', sprintf(Context::getLang('msg_component_is_not_founded'), $component));
         $this->setTemplatePath($this->module_path . 'tpl');
         $this->setTemplateFile('component_not_founded');
     } else {
         // 컴포넌트의 popup url을 출력하는 method실행후 결과를 받음
         $popup_content = $oComponent->getPopupContent();
         Context::set('popup_content', $popup_content);
         // 레이아웃을 popup_layout으로 설정
         $this->setLayoutFile('popup_layout');
         // 템플릿 지정
         $this->setTemplatePath($this->module_path . 'tpl');
         $this->setTemplateFile('popup');
     }
 }
Example #6
0
 /**
  * @brief Action to get a request to display compoenet pop-up
  */
 function dispEditorPopup()
 {
     // add a css file
     Context::loadFile($this->module_path . "tpl/css/editor.css", true);
     // List variables
     $editor_sequence = Context::get('editor_sequence');
     $component = Context::get('component');
     $site_module_info = Context::get('site_module_info');
     $site_srl = (int) $site_module_info->site_srl;
     // Get compoenet object
     $oEditorModel = getModel('editor');
     $oComponent =& $oEditorModel->getComponentObject($component, $editor_sequence, $site_srl);
     if (!$oComponent->toBool()) {
         Context::set('message', sprintf(Context::getLang('msg_component_is_not_founded'), $component));
         $this->setTemplatePath($this->module_path . 'tpl');
         $this->setTemplateFile('component_not_founded');
     } else {
         // Get the result after executing a method to display popup url of the component
         $popup_content = $oComponent->getPopupContent();
         Context::set('popup_content', $popup_content);
         // Set layout to popup_layout
         $this->setLayoutFile('popup_layout');
         // Set a template
         $this->setTemplatePath($this->module_path . 'tpl');
         $this->setTemplateFile('popup');
     }
 }
Example #7
0
 /**
  * @brief Button to output
  **/
 function printBtn()
 {
     if ($this->nextUrl) {
         $url = $this->nextUrl;
         printf('<a href="%s">%s</a><br>%s', $url->url, $url->text, "\n");
     }
     if ($this->prevUrl) {
         $url = $this->prevUrl;
         printf('<a href="%s">%s</a><br>%s', $url->url, $url->text, "\n");
     }
     // Select Language
     if (!parent::isLangChange()) {
         $url = getUrl('', 'lcm', '1', 'sel_lang', Context::getLangType(), 'return_uri', Context::get('current_url'));
         printf('<a href="%s">%s</a><br>%s', $url, 'Language : ' . Context::getLang('select_lang'), "\n");
     } else {
         printf('<a href="%s">%s</a><br>%s', Context::get('return_uri'), Context::getLang('lang_return'), "\n");
     }
     if ($this->upperUrl) {
         $url = $this->upperUrl;
         printf('<btn href="%s" name="%s">%s', $url->url, $url->text, "\n");
     }
     if ($this->homeUrl) {
         $url = $this->homeUrl;
         printf('<a btn="%s" href="%s">%s</a><br>%s', $url->text, $url->url, $url->text, "\n");
     }
 }
 /**
  * Trackbacks delete selected in admin page
  * @return void|Object
  */
 function procTrackbackAdminDeleteChecked()
 {
     // An error appears if no document is selected
     $cart = Context::get('cart');
     if (!is_array($cart)) {
         $trackback_srl_list = explode('|@|', $cart);
     } else {
         $trackback_srl_list = $cart;
     }
     $trackback_count = count($trackback_srl_list);
     if (!$trackback_count) {
         return $this->stop('msg_cart_is_null');
     }
     $oTrackbackController =& getController('trackback');
     // Delete the post
     for ($i = 0; $i < $trackback_count; $i++) {
         $trackback_srl = trim($trackback_srl_list[$i]);
         if (!$trackback_srl) {
             continue;
         }
         $oTrackbackController->deleteTrackback($trackback_srl, true);
     }
     $this->setMessage(sprintf(Context::getLang('msg_checked_trackback_is_deleted'), $trackback_count));
     $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispTrackbackAdminList');
     $this->setRedirectUrl($returnUrl);
 }
Example #9
0
 /**
  * @brief Delete the polls selected in the administrator's page
  **/
 function procPollAdminDeleteChecked()
 {
     // Display an error no post is selected
     $cart = Context::get('cart');
     if (is_array($cart)) {
         $poll_srl_list = $cart;
     } else {
         $poll_srl_list = explode('|@|', $cart);
     }
     $poll_count = count($poll_srl_list);
     if (!$poll_count) {
         return $this->stop('msg_cart_is_null');
     }
     // Delete the post
     for ($i = 0; $i < $poll_count; $i++) {
         $poll_index_srl = trim($poll_srl_list[$i]);
         if (!$poll_index_srl) {
             continue;
         }
         $output = $this->deletePollTitle($poll_index_srl, true);
         if (!$output->toBool()) {
             return $output;
         }
     }
     $this->setMessage(sprintf(Context::getLang('msg_checked_poll_is_deleted'), $poll_count));
     $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispPollAdminList');
     $this->setRedirectUrl($returnUrl);
 }
Example #10
0
 function triggerGetManagerMenu(&$manager_menu)
 {
     $oModuleModel = getModel('module');
     $logged_info = Context::get('logged_info');
     $output = executeQueryArray('cympusadmin.getModInstList');
     if (!$output->toBool()) {
         return $output;
     }
     $list = $output->data;
     $menu = new stdClass();
     $menu->title = Context::getLang('site_management');
     $menu->icon = 'dashboard';
     $menu->module = 'cympusadmin';
     $menu->submenu = array();
     foreach ($list as $key => $val) {
         $grant = $oModuleModel->getGrant($val, $logged_info);
         if ($grant->manager) {
             $submenu = new stdClass();
             $submenu->action = array('dispCympusadminAdminIndex');
             $submenu->mid = $val->mid;
             $submenu->title = Context::getLang('site_status');
             $submenu->module = 'cympusadmin';
             $menu->submenu[] = $submenu;
         }
     }
     if (count($menu->submenu)) {
         $manager_menu['cympusadmin'] = $menu;
     }
 }
Example #11
0
 /**
  * @brief 위젯의 실행 부분
  *
  * ./widgets/위젯/conf/info.xml 에 선언한 extra_vars를 args로 받는다
  * 결과를 만든후 print가 아니라 return 해주어야 한다
  **/
 function proc($args)
 {
     // 위젯 자체적으로 설정한 변수들을 체크
     $title = $args->title;
     $PAGE_LIMIT = $args->page_limit ? $args->page_limit : 10;
     // 날짜 형태
     $DATE_FORMAT = $args->date_format ? $args->date_format : "Y-m-d H:i:s";
     $buff = $this->rss_request($args->rss_url);
     if (!is_string($buff) or !$buff) {
         return Context::getLang('msg_fail_to_request_open');
     }
     $encoding = preg_match("/<\\?xml.*encoding=\"(.+)\".*\\?>/i", $buff, $matches);
     if ($encoding && !preg_match("/UTF-8/i", $matches[1])) {
         $buff = trim(iconv($matches[1] == "ks_c_5601-1987" ? "EUC-KR" : $matches[1], "UTF-8", $buff));
     }
     $buff = preg_replace("/<\\?xml.*\\?>/i", "", $buff);
     $oXmlParser = new XmlParser();
     $xml_doc = $oXmlParser->parse($buff);
     $rss->title = $xml_doc->rss->channel->title->body;
     $rss->link = $xml_doc->rss->channel->link->body;
     $items = $xml_doc->rss->channel->item;
     if (!$items) {
         return Context::getLang('msg_invalid_format');
     }
     if ($items && !is_array($items)) {
         $items = array($items);
     }
     $rss_list = array();
     foreach ($items as $key => $value) {
         if ($key >= $PAGE_LIMIT) {
             break;
         }
         unset($item);
         foreach ($value as $key2 => $value2) {
             if (is_array($value2)) {
                 $value2 = array_shift($value2);
             }
             $item->{$key2} = $value2->body;
         }
         $date = $item->pubdate;
         $item->date = $date ? date($DATE_FORMAT, strtotime($date)) : '';
         $array_date[$key] = strtotime($date);
         $item->description = preg_replace('!<a href=!is', '<a onclick="window.open(this.href);return false" href=', $item->description);
         $rss_list[$key] = $item;
     }
     array_multisort($array_date, SORT_DESC, $rss_list);
     $widget_info->rss = $rss;
     $widget_info->rss_list = $rss_list;
     $widget_info->title = $title;
     $widget_info->rss_height = $args->rss_height ? $args->rss_height : 200;
     $widget_info->subject_cut_size = $args->subject_cut_size;
     Context::set('widget_info', $widget_info);
     // 템플릿의 스킨 경로를 지정 (skin, colorset에 따른 값을 설정)
     $tpl_path = sprintf('%sskins/%s', $this->widget_path, $args->skin);
     Context::set('colorset', $args->colorset);
     // 템플릿 컴파일
     $oTemplate =& TemplateHandler::getInstance();
     $output = $oTemplate->compile($tpl_path, 'list');
     return $output;
 }
 /**
  * @brief 목록 출력 (관리자용)
  **/
 function dispDocumentAdminList()
 {
     // 목록을 구하기 위한 옵션
     $args->page = Context::get('page');
     ///< 페이지
     $args->list_count = 30;
     ///< 한페이지에 보여줄 글 수
     $args->page_count = 10;
     ///< 페이지 네비게이션에 나타날 페이지의 수
     $args->search_target = Context::get('search_target');
     ///< 검색 대상 (title, contents...)
     $args->search_keyword = Context::get('search_keyword');
     ///< 검색어
     $args->sort_index = 'list_order';
     ///< 소팅 값
     $args->module_srl = Context::get('module_srl');
     // 목록 구함, document->getDocumentList 에서 걍 알아서 다 해버리는 구조이다... (아.. 이거 나쁜 버릇인데.. ㅡ.ㅜ 어쩔수 없다)
     $oDocumentModel =& getModel('document');
     $output = $oDocumentModel->getDocumentList($args);
     // 템플릿에 쓰기 위해서 document_model::getDocumentList() 의 return object에 있는 값들을 세팅
     Context::set('total_count', $output->total_count);
     Context::set('total_page', $output->total_page);
     Context::set('page', $output->page);
     Context::set('document_list', $output->data);
     Context::set('page_navigation', $output->page_navigation);
     // 템플릿에서 사용할 검색옵션 세팅
     $count_search_option = count($this->search_option);
     for ($i = 0; $i < $count_search_option; $i++) {
         $search_option[$this->search_option[$i]] = Context::getLang($this->search_option[$i]);
     }
     Context::set('search_option', $search_option);
     // 템플릿 지정
     $this->setTemplatePath($this->module_path . 'tpl');
     $this->setTemplateFile('document_list');
 }
 /**
  * @brief 관리자 페이지에서 선택된 댓글들을 삭제
  **/
 function procCommentAdminDeleteChecked()
 {
     // 선택된 글이 없으면 오류 표시
     $cart = Context::get('cart');
     if (!$cart) {
         return $this->stop('msg_cart_is_null');
     }
     $comment_srl_list = explode('|@|', $cart);
     $comment_count = count($comment_srl_list);
     if (!$comment_count) {
         return $this->stop('msg_cart_is_null');
     }
     $oCommentController =& getController('comment');
     $deleted_count = 0;
     // 글삭제
     for ($i = 0; $i < $comment_count; $i++) {
         $comment_srl = trim($comment_srl_list[$i]);
         if (!$comment_srl) {
             continue;
         }
         $output = $oCommentController->deleteComment($comment_srl, true);
         if (!$output->toBool()) {
             continue;
         }
         $deleted_count++;
     }
     $this->setMessage(sprintf(Context::getLang('msg_checked_comment_is_deleted'), $deleted_count));
 }
 /**
  * Display a list(administrative)
  * @return void
  */
 function dispDocumentAdminList()
 {
     // option to get a list
     $args = new stdClass();
     $args->page = Context::get('page');
     // /< Page
     $args->list_count = 30;
     // /< the number of posts to display on a single page
     $args->page_count = 5;
     // /< the number of pages that appear in the page navigation
     $args->search_target = Context::get('search_target');
     // /< search (title, contents ...)
     $args->search_keyword = Context::get('search_keyword');
     // /< keyword to search
     $args->sort_index = 'list_order';
     // /< sorting value
     $args->module_srl = Context::get('module_srl');
     // get a list
     $oDocumentModel = getModel('document');
     $columnList = array('document_srl', 'module_srl', 'title', 'member_srl', 'nick_name', 'readed_count', 'voted_count', 'blamed_count', 'regdate', 'ipaddress', 'status');
     $output = $oDocumentModel->getDocumentList($args, false, true, $columnList);
     // get Status name list
     $statusNameList = $oDocumentModel->getStatusNameList();
     // Set values of document_model::getDocumentList() objects for a template
     Context::set('total_count', $output->total_count);
     Context::set('total_page', $output->total_page);
     Context::set('page', $output->page);
     Context::set('document_list', $output->data);
     Context::set('status_name_list', $statusNameList);
     Context::set('page_navigation', $output->page_navigation);
     // set a search option used in the template
     $count_search_option = count($this->search_option);
     for ($i = 0; $i < $count_search_option; $i++) {
         $search_option[$this->search_option[$i]] = Context::getLang($this->search_option[$i]);
     }
     Context::set('search_option', $search_option);
     $oModuleModel = getModel('module');
     $module_list = array();
     $mod_srls = array();
     foreach ($output->data as $oDocument) {
         $mod_srls[] = $oDocument->get('module_srl');
     }
     $mod_srls = array_unique($mod_srls);
     // Module List
     $mod_srls_count = count($mod_srls);
     if ($mod_srls_count) {
         $columnList = array('module_srl', 'mid', 'browser_title');
         $module_output = $oModuleModel->getModulesInfo($mod_srls, $columnList);
         if ($module_output && is_array($module_output)) {
             foreach ($module_output as $module) {
                 $module_list[$module->module_srl] = $module;
             }
         }
     }
     Context::set('module_list', $module_list);
     // Specify a template
     $this->setTemplatePath($this->module_path . 'tpl');
     $this->setTemplateFile('document_list');
 }
 /**
  * @brief RSS 전체피드 설정
  **/
 function procRssAdminInsertConfig()
 {
     $oModuleModel =& getModel('module');
     $total_config = $oModuleModel->getModuleConfig('rss');
     $config_vars = Context::getRequestVars();
     $config_vars->feed_document_count = (int) $config_vars->feed_document_count;
     if (!$config_vars->use_total_feed) {
         $alt_message = 'msg_invalid_request';
     }
     if (!in_array($config_vars->use_total_feed, array('Y', 'N'))) {
         $config_vars->open_rss = 'Y';
     }
     if ($config_vars->image || $config_vars->del_image) {
         $image_obj = $config_vars->image;
         $config_vars->image = $total_config->image;
         // 삭제 요청에 대한 변수를 구함
         if ($config_vars->del_image == 'Y' || $image_obj) {
             FileHandler::removeFile($config_vars->image);
             $config_vars->image = '';
             $total_config->image = '';
         }
         // 정상적으로 업로드된 파일이 아니면 무시
         if ($image_obj['tmp_name'] && is_uploaded_file($image_obj['tmp_name'])) {
             // 이미지 파일이 아니어도 무시 (swf는 패스~)
             $image_obj['name'] = Context::convertEncodingStr($image_obj['name']);
             if (!preg_match("/\\.(jpg|jpeg|gif|png)\$/i", $image_obj['name'])) {
                 $alt_message = 'msg_rss_invalid_image_format';
             } else {
                 // 경로를 정해서 업로드
                 $path = './files/attach/images/rss/';
                 // 디렉토리 생성
                 if (!FileHandler::makeDir($path)) {
                     $alt_message = 'msg_error_occured';
                 } else {
                     $filename = $path . $image_obj['name'];
                     // 파일 이동
                     if (!move_uploaded_file($image_obj['tmp_name'], $filename)) {
                         $alt_message = 'msg_error_occured';
                     } else {
                         $config_vars->image = $filename;
                     }
                 }
             }
         }
     }
     if (!$config_vars->image && $config_vars->del_image != 'Y') {
         $config_vars->image = $total_config->image;
     }
     $output = $this->setFeedConfig($config_vars);
     if (!$alt_message) {
         $alt_message = 'success_updated';
     }
     $alt_message = Context::getLang($alt_message);
     Context::set('msg', $alt_message);
     $this->setLayoutPath('./common/tpl');
     $this->setLayoutFile('default_layout.html');
     $this->setTemplatePath($this->module_path . 'tpl');
     $this->setTemplateFile("top_refresh.html");
 }
Example #16
0
 /**
  * @brief 에러 메세지 지정
  **/
 function setMessage($message = 'success')
 {
     if (Context::getLang($message)) {
         $message = Context::getLang($message);
     }
     $this->message = $message;
     return true;
 }
Example #17
0
 /**
  * @brief 에디터 컴포넌트가 별도의 고유 코드를 이용한다면 그 코드를 html로 변경하여 주는 method
  *
  * 이미지나 멀티미디어, 설문등 고유 코드가 필요한 에디터 컴포넌트는 고유코드를 내용에 추가하고 나서
  * DocumentModule::transContent() 에서 해당 컴포넌트의 transHtml() method를 호출하여 고유코드를 html로 변경
  **/
 function transHTML($xml_obj)
 {
     // 지정된 옵션을 구함
     $ccl_title = $xml_obj->attrs->ccl_title;
     $ccl_use_mark = $xml_obj->attrs->ccl_use_mark;
     $ccl_allow_commercial = $xml_obj->attrs->ccl_allow_commercial;
     $ccl_allow_modification = $xml_obj->attrs->ccl_allow_modification;
     // 가로/ 세로 크기를 구함
     preg_match_all('/(width|height)([^[:digit:]]+)([^;^"^\']*)/i', $xml_obj->attrs->style, $matches);
     $width = trim($matches[3][0]);
     if (!$width) {
         $width = "90%";
     }
     $height = trim($matches[3][1]);
     if (!$height) {
         $height = "50";
     }
     // 언어파일을 읽음
     Context::loadLang($this->component_path . '/lang');
     $default_title = Context::getLang('ccl_default_title');
     if (!$ccl_title) {
         $ccl_title = $default_title;
     }
     $default_message = Context::getLang('ccl_default_message');
     $option = Context::getLang('ccl_options');
     // 영리 이용 체크
     if ($ccl_allow_commercial == 'N') {
         $opt1 = '-nc';
     } else {
         $opt1 = '';
     }
     // 수정 표시 체크
     if ($ccl_allow_modification == 'N') {
         $opt2 = '-nd';
     } elseif ($ccl_allow_modification == 'SA') {
         $opt2 = '-sa';
     } else {
         $opt2 = '';
     }
     // 버전
     $version = '/3.0';
     // 언어에 따른 설정
     $lang_type = Context::getLangType();
     if ($lang_type != 'en') {
         $lang_file = 'deed.' . strtolower($lang_file);
     }
     // 마크 이용시
     $ccl_image = '';
     if ($ccl_use_mark == "Y") {
         $ccl_image = sprintf('
                     <a rel="license" href="http://creativecommons.org/licenses/by%s%s%s" onclick="window.open(this.href); return false;"><img src="http://i.creativecommons.org/l/by%s%s%s/88x31.png" alt="Creative Commons License" style="margin-bottom:5px;border:0;" /></a><br />', $opt1, $opt2, $version, $opt1, $opt2, $version);
     }
     // 결과물 생성
     $text = $ccl_image . sprintf($default_message, $opt1, $opt2, $version, '', $ccl_title, $option['ccl_allow_commercial'][$ccl_allow_commercial], $option['ccl_allow_modification'][$ccl_allow_modification], $version);
     $style = sprintf('<style type="text/css">.cc_license { clear:both; margin:20px auto 20px auto; padding:8px; width:%s;border:1px solid #c0c0c0; color:#808080; text-align:center; } .cc_license legend { font-weight:bold; } .cc_license a { color:#404040; text-decoration:none; } .cc_license a:hover { text-decoration:underline; </style>', $width);
     $output = sprintf('%s<fieldset class="cc_license"><legend>%s</legend>%s</fieldset>', $style, $ccl_title, $text);
     return $output;
 }
Example #18
0
 /**
  * display the pop-up menu of the post
  * Print, scrap, vote-up(recommen), vote-down(non-recommend), report features added
  * @return void
  */
 function getCommentMenu()
 {
     // get the post's id number and the current login information
     $comment_srl = Context::get('target_srl');
     $mid = Context::get('cur_mid');
     $logged_info = Context::get('logged_info');
     $act = Context::get('cur_act');
     // array values for menu_list, "comment post, target, url"
     $menu_list = array();
     // call a trigger
     ModuleHandler::triggerCall('comment.getCommentMenu', 'before', $menu_list);
     $oCommentController =& getController('comment');
     // feature that only member can do
     if ($logged_info->member_srl) {
         $oCommentModel =& getModel('comment');
         $columnList = array('comment_srl', 'module_srl', 'member_srl', 'ipaddress');
         $oComment = $oCommentModel->getComment($comment_srl, false, $columnList);
         $module_srl = $oComment->get('module_srl');
         $member_srl = $oComment->get('member_srl');
         $oModuleModel =& getModel('module');
         $comment_config = $oModuleModel->getModulePartConfig('document', $module_srl);
         if ($comment_config->use_vote_up != 'N' && $member_srl != $logged_info->member_srl) {
             // Add a vote-up button for positive feedback
             $url = sprintf("doCallModuleAction('comment','procCommentVoteUp','%s')", $comment_srl);
             $oCommentController->addCommentPopupMenu($url, 'cmd_vote', '', 'javascript');
         }
         if ($comment_config->use_vote_down != 'N' && $member_srl != $logged_info->member_srl) {
             // Add a vote-down button for negative feedback
             $url = sprintf("doCallModuleAction('comment','procCommentVoteDown','%s')", $comment_srl);
             $oCommentController->addCommentPopupMenu($url, 'cmd_vote_down', '', 'javascript');
         }
         // Add the report feature against abused posts
         $url = sprintf("doCallModuleAction('comment','procCommentDeclare','%s')", $comment_srl);
         $oCommentController->addCommentPopupMenu($url, 'cmd_declare', '', 'javascript');
     }
     // call a trigger (after)
     ModuleHandler::triggerCall('comment.getCommentMenu', 'after', $menu_list);
     // find a comment by IP matching if an administrator.
     if ($logged_info->is_admin == 'Y') {
         $oCommentModel =& getModel('comment');
         $oComment = $oCommentModel->getComment($comment_srl);
         if ($oComment->isExists()) {
             // Find a post of the corresponding ip address
             $url = getUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_target', 'ipaddress', 'search_keyword', $oComment->getIpAddress());
             $oCommentController->addCommentPopupMenu($url, 'cmd_search_by_ipaddress', $icon_path, 'TraceByIpaddress');
             $url = sprintf("var params = new Array(); params['ipaddress_list']='%s'; exec_xml('spamfilter', 'procSpamfilterAdminInsertDeniedIP', params, completeCallModuleAction)", $oComment->getIpAddress());
             $oCommentController->addCommentPopupMenu($url, 'cmd_add_ip_to_spamfilter', '', 'javascript');
         }
     }
     // Changing a language of pop-up menu
     $menus = Context::get('comment_popup_menu_list');
     $menus_count = count($menus);
     for ($i = 0; $i < $menus_count; $i++) {
         $menus[$i]->str = Context::getLang($menus[$i]->str);
     }
     // get a list of final organized pop-up menus
     $this->add('menus', $menus);
 }
 function _insertClient($member_srl = null)
 {
     $client_srl = Context::get('client_srl');
     $domain = Context::get('domain');
     // 도메인 확인
     $oSocialxeserverModel =& getModel('socialxeserver');
     $domain_array = explode(',', $domain);
     $domain_array2 = array();
     foreach ($domain_array as $name => $val) {
         // http:// 를 일부러 붙여서 url 형식으로 만들어 준다
         if (strpos($val, 'http') !== 0) {
             $val = 'http://' . $val;
         }
         // parse_url()을 이용하여 분석한다.
         $url_info = parse_url($val);
         // 우리가 필요한 건 오직! 도메인이다!!
         if (!$url_info['host']) {
             continue;
         }
         // www 따위는 버려라!
         $domain = trim(str_replace('www.', '', $url_info['host']));
         // 이미 추가된 도메인인지 확인
         $output = $oSocialxeserverModel->isExsistDomain($domain, $client_srl);
         if (!$output->toBool()) {
             return $output;
         }
         if ($output->get('result')) {
             return $this->stop(Context::getLang('msg_exsist_domain') . '(' . $domain . ')');
         }
         // 결과 배열
         $domain_array2[] = $domain;
     }
     // 배열 중복값을 없앤다.
     $domain_array2 = array_unique($domain_array2);
     // 개수가 0이면 오류!
     if (!count($domain_array2)) {
         return $this->stop('msg_check_input_domain');
     }
     // 다시 붙인다.
     $domain = implode(',', $domain_array2);
     // 수정
     if ($client_srl) {
         $args->client_srl = $client_srl;
         $args->domain = $domain;
         $output = executeQuery('socialxeserver.updateClient', $args);
     } else {
         // 클라이언트 토큰
         $token = md5($domain);
         // DB 입력
         $args->client_srl = getNextSequence();
         $args->domain = $domain;
         $args->client_token = $token;
         $args->member_srl = $member_srl;
         $output = executeQuery('socialxeserver.insertClient', $args);
     }
     return $output;
 }
 /**
  * @brief 공통 :: 모듈의 모듈 권한 출력 페이지
  * 모듈의 모듈 권한 출력은 모든 모듈에서 module instance를 이용할때 사용할 수 있음
  **/
 function getModuleGrantHTML($module_srl, $source_grant_list)
 {
     $oModuleModel =& getModel('module');
     $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
     // access, manager 권한은 가상 권한으로 설정
     $grant_list->access->title = Context::getLang('grant_access');
     $grant_list->access->default = 'guest';
     if (count($source_grant_list)) {
         foreach ($source_grant_list as $key => $val) {
             if (!$val->default) {
                 $val->default = 'guest';
             }
             if ($val->default == 'root') {
                 $val->default = 'manager';
             }
             $grant_list->{$key} = $val;
         }
     }
     $grant_list->manager->title = Context::getLang('grant_manager');
     $grant_list->manager->default = 'manager';
     Context::set('grant_list', $grant_list);
     // 현재 모듈에 설정된 권한 그룹을 가져옴
     $default_grant = array();
     $args->module_srl = $module_srl;
     $output = executeQueryArray('module.getModuleGrants', $args);
     if ($output->data) {
         foreach ($output->data as $val) {
             if ($val->group_srl == 0) {
                 $default_grant[$val->name] = 'all';
             } else {
                 if ($val->group_srl == -1) {
                     $default_grant[$val->name] = 'member';
                 } else {
                     if ($val->group_srl == -2) {
                         $default_grant[$val->name] = 'site';
                     } else {
                         $selected_group[$val->name][] = $val->group_srl;
                         $default_grant[$val->name] = 'group';
                     }
                 }
             }
         }
     }
     Context::set('selected_group', $selected_group);
     Context::set('default_grant', $default_grant);
     // 현재 모듈에 설정된 관리자 아이디를 추출
     $admin_member = $oModuleModel->getAdminId($module_srl);
     Context::set('admin_member', $admin_member);
     // 그룹을 가져옴
     $oMemberModel =& getModel('member');
     $group_list = $oMemberModel->getGroups($module_info->site_srl);
     Context::set('group_list', $group_list);
     // grant 정보를 추출
     $oTemplate =& TemplateHandler::getInstance();
     return $oTemplate->compile($this->module_path . 'tpl', 'module_grants');
 }
 function dispBoardMessage($msg_code)
 {
     $msg = Context::getLang($msg_code);
     $oMessageObject =& ModuleHandler::getModuleInstance('message', 'mobile');
     $oMessageObject->setError(-1);
     $oMessageObject->setMessage($msg);
     $oMessageObject->dispMessage();
     $this->setTemplatePath($oMessageObject->getTemplatePath());
     $this->setTemplateFile($oMessageObject->getTemplateFile());
 }
Example #22
0
 function getInstallFTPList()
 {
     $ftp_info = Context::getRequestVars();
     if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) {
         return new Object(-1, 'msg_ftp_invalid_auth_info');
     }
     $this->pwd = $ftp_info->ftp_root_path;
     if (!$ftp_info->ftp_host) {
         $ftp_info->ftp_host = "127.0.0.1";
     }
     if ($ftp_info->sftp == 'Y') {
         return $this->getSFTPList();
     }
     if (function_exists(ftp_connect)) {
         $connection = ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port);
         if (!$connection) {
             return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), $ftp_info->ftp_host));
         }
         $login_result = @ftp_login($connection, $ftp_info->ftp_user, $ftp_info->ftp_password);
         if (!$login_result) {
             ftp_close($connection);
             return new Object(-1, 'msg_ftp_invalid_auth_info');
         }
         if ($ftp_info->ftp_pasv != "N") {
             ftp_pasv($connection, true);
         }
         $_list = ftp_rawlist($connection, $this->pwd);
         ftp_close($connection);
     } else {
         require_once _XE_PATH_ . 'libs/ftp.class.php';
         $oFtp = new ftp();
         if ($oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) {
             if ($oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) {
                 $_list = $oFtp->ftp_rawlist($this->pwd);
                 $oFtp->ftp_quit();
             } else {
                 $oFtp->ftp_quit();
                 return new Object(-1, 'msg_ftp_invalid_auth_info');
             }
         }
     }
     $list = array();
     if ($_list) {
         foreach ($_list as $k => $v) {
             $src = null;
             $src->data = $v;
             $res = Context::convertEncoding($src);
             $v = $res->data;
             if (strpos($v, 'd') === 0 || strpos($v, '<DIR>')) {
                 $list[] = substr(strrchr($v, ' '), 1) . '/';
             }
         }
     }
     $this->add('list', $list);
 }
Example #23
0
 /**
  * @brief wap procedure method
  *
  * 페이지 모듈은 형식이 정해져 있지 않기에 전체 컨텐츠를 mobile class에서 제어해서 출력함
  **/
 function procWAP(&$oMobile)
 {
     // 권한 체크
     if (!$this->grant->access) {
         return $oMobile->setContent(Context::getLang('msg_not_permitted'));
     }
     // 위젯의 내용을 추출함
     $oWidgetController =& getController('widget');
     $content = $oWidgetController->transWidgetCode($this->module_info->content);
     $oMobile->setContent($content);
 }
Example #24
0
 /**
  * @brief wap procedure method
  *
  * Page module does not include the following items on the full content control and output from the mobile class
  **/
 function procWAP(&$oMobile)
 {
     // Check permissions
     if (!$this->grant->access) {
         return $oMobile->setContent(Context::getLang('msg_not_permitted'));
     }
     // The contents of the widget chuchulham
     $oWidgetController =& getController('widget');
     $content = $oWidgetController->transWidgetCode($this->module_info->content);
     $oMobile->setContent($content);
 }
 /**
  * @brief constructor
  *
  * ModuleHandler에서 사용할 변수를 미리 세팅
  * 인자를 넘겨주지 않으면 현 페이지 요청받은 Request Arguments를 이용하여
  * 변수를 세팅한다.
  **/
 function ModuleHandler($module = '', $act = '', $mid = '', $document_srl = '', $module_srl = '')
 {
     // 설치가 안되어 있다면 install module을 지정
     if (!Context::isInstalled()) {
         $this->module = 'install';
         $this->act = Context::get('act');
         return;
     }
     // Request Argument중 모듈을 찾을 수 있는 변수를 구함
     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::get('entry');
     // 기본 변수들의 검사 (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"));
     }
     // 애드온 실행 (모듈 실행 전)
     $called_position = 'before_module_init';
     $oAddonController =& getController('addon');
     $addon_file = $oAddonController->getCacheFilePath();
     if (file_exists($addon_file)) {
         @(include $addon_file);
     }
 }
/**
 * @brief Function to change point icon.
 */
function pointLevelIconTrans($matches)
{
    $member_srl = $matches[3];
    // If anonymous or not member_srl go to Hide Point Icon
    if ($member_srl < 1 || !$member_srl) {
        return $matches[0];
    }
    $orig_text = preg_replace('/' . preg_quote($matches[5], '/') . '<\\/' . $matches[6] . '>$/', '', $matches[0]);
    $oMemberModel = getModel('member');
    // Check Group Image Mark
    if ($oMemberModel->getGroupImageMark($member_srl)) {
        return $orig_text . $matches[5] . '</' . $matches[6] . '>';
    }
    if (!isset($GLOBALS['_pointLevelIcon'][$member_srl])) {
        // Get point configuration
        if (!$GLOBALS['_pointConfig']) {
            $oModuleModel = getModel('module');
            $GLOBALS['_pointConfig'] = $oModuleModel->getModuleConfig('point');
        }
        $config = $GLOBALS['_pointConfig'];
        // Get point model
        if (!$GLOBALS['_pointModel']) {
            $GLOBALS['_pointModel'] = getModel('point');
        }
        $oPointModel =& $GLOBALS['_pointModel'];
        // Get points
        if (!$oPointModel->isExistsPoint($member_srl)) {
            return $matches[0];
        }
        $point = $oPointModel->getPoint($member_srl);
        // Get level
        $level = $oPointModel->getLevel($point, $config->level_step);
        $text = $matches[5];
        // Get a path where level icon is
        $level_icon = sprintf('%smodules/point/icons/%s/%d.gif', Context::getRequestUri(), $config->level_icon, $level);
        // Get per to go to the next level if not a top level
        $per = NULL;
        if ($level < $config->max_level) {
            $next_point = $config->level_step[$level + 1];
            $present_point = $config->level_step[$level];
            if ($next_point > 0) {
                $per = (int) (($point - $present_point) / ($next_point - $present_point) * 100);
                $per = $per . '%';
            }
        }
        $title = sprintf('%s:%s%s%s, %s:%s/%s', Context::getLang('point'), $point, $config->point_name, $per ? ' (' . $per . ')' : '', Context::getLang('level'), $level, $config->max_level);
        $alt = sprintf('[%s:%s]', Context::getLang('level'), $level);
        $GLOBALS['_pointLevelIcon'][$member_srl] = sprintf('<img src="%s" alt="%s" title="%s" class="xe_point_level_icon" style="vertical-align:middle;margin-right:3px;" />', $level_icon, $alt, $title);
    }
    $text = $GLOBALS['_pointLevelIcon'][$member_srl];
    return $orig_text . $text . $matches[5] . '</' . $matches[6] . '>';
}
Example #27
0
 /**
  * @brief Output information
  * hasChilds() if there is a list of content types, otherwise output
  **/
 function printContent()
 {
     if ($this->hasChilds()) {
         foreach ($this->getChilds() as $key => $val) {
             if (!$val['link']) {
                 continue;
             }
             printf('<ce task=go label="%s" dest="%s">%s%s', Context::getLang('cmd_select'), $val['href'], $val['text'], "\n");
         }
     } else {
         printf('<wrap>%s<br>%s', $this->getContent(), "\n");
     }
 }
Example #28
0
 /**
  * @brief 위젯의 실행 부분
  *
  * ./widgets/위젯/conf/info.xml 에 선언한 extra_vars를 args로 받는다
  * 결과를 만든후 print가 아니라 return 해주어야 한다
  **/
 function proc($args)
 {
     $oModuleModel =& getModel('module');
     // 대상 모듈 (mid_list는 기존 위젯의 호환을 위해서 처리하는 루틴을 유지. module_srl로 위젯에서 변경)
     if ($args->mid_list) {
         $tmp_mid = explode(",", $args->mid_list);
         $args->mid = $tmp_mid[0];
     }
     if ($args->mid) {
         $args->srl = $oModuleModel->getModuleSrlByMid($args->mid);
         if (is_array($args->srl)) {
             $args->srl = $args->srl[0];
         }
     }
     $obj->module_srl = $args->srl;
     // 선택된 모듈이 없으면 실행 취소
     if (!$obj->module_srl) {
         return Context::getLang('msg_not_founded');
     }
     // 모듈의 정보를 구함
     $module_info = $oModuleModel->getModuleInfoByModuleSrl($obj->module_srl);
     // 대상 모듈의 카테고리 파일을 불러옴
     $oDocumentModel =& getModel('document');
     $category_list = $oDocumentModel->getCategoryList($obj->module_srl);
     // 전체 개수를 구함
     $widget_info->total_document_count = $oDocumentModel->getDocumentCount($obj->module_srl);
     $widget_info->module_info = $module_info;
     $widget_info->mid = $module_info->mid;
     $widget_info->document_category = $document_category;
     $widget_info->category_list = $category_list;
     $widget_info->total_title = $args->total_title;
     if ($module_info->site_srl) {
         $site_module_info = Context::get('site_module_info');
         if ($site_module_info->site_srl == $module_info->site_srl) {
             $widget_info->domain = $site_module_info->domain;
         } else {
             $site_info = $oModuleModel->getSiteInfo($module_info->site_srl);
             $widget_info->domain = $site_info->domain;
         }
     } else {
         $widget_info->domain = Context::getDefaultUrl();
     }
     Context::set('colorset', $args->colorset);
     Context::set('widget_info', $widget_info);
     // 템플릿 컴파일
     $tpl_path = sprintf('%sskins/%s', $this->widget_path, $args->skin);
     $tpl_file = 'category';
     $oTemplate =& TemplateHandler::getInstance();
     return $oTemplate->compile($tpl_path, $tpl_file);
 }
Example #29
0
 function getPaymentMethods()
 {
     static $trans_flag = FALSE;
     if ($trans_flag) {
         return $this->payment_method;
     }
     foreach ($this->payment_method as $key => $val) {
         if (Context::getLang($val)) {
             $this->payment_method[$key] = Context::getLang($val);
         }
     }
     $trans_flag = TRUE;
     return $this->payment_method;
 }
Example #30
0
 /**
  * @brief check spam interval
  **/
 function checkLimited($interval)
 {
     if (!$interval) {
         return new Object();
     }
     $oSpamModel =& getModel('spamfilter');
     $count = $oSpamModel->getLogCount($interval);
     if ($count) {
         $message = sprintf(Context::getLang('msg_alert_limited_by_config_mail'), $interval / 60);
         $oSpamFilterController =& getController('spamfilter');
         $oSpamFilterController->insertLog();
         return new Object(-1, $message);
     }
     return new Object();
 }