function getNewsFromAgency() { //Retrieve recent news and set them into context $newest_news_url = sprintf("http://www.xeshoppingmall.com/?module=newsagency&act=getNewsagencyArticle&inst=notice&top=6&loc=%s", _XE_LOCATION_); $cache_file = sprintf("%sfiles/cache/nstore_news.%s.cache.php", _XE_PATH_, _XE_LOCATION_); if (!file_exists($cache_file) || filemtime($cache_file) + 60 * 60 < time()) { // Considering if data cannot be retrieved due to network problem, modify filemtime to prevent trying to reload again when refreshing textmessageistration page // Ensure to access the textmessageistration page even though news cannot be displayed FileHandler::writeFile($cache_file, ''); FileHandler::getRemoteFile($newest_news_url, $cache_file, null, 1, 'GET', 'text/html', array('REQUESTURL' => getFullUrl(''))); } if (file_exists($cache_file)) { $oXml = new XmlParser(); $buff = $oXml->parse(FileHandler::readFile($cache_file)); $item = $buff->zbxe_news->item; if ($item) { if (!is_array($item)) { $item = array($item); } foreach ($item as $key => $val) { $obj = null; $obj->title = $val->body; $obj->date = $val->attrs->date; $obj->url = $val->attrs->url; $news[] = $obj; } return $news; } } }
/** * @brief xe 게시판 템플릿(입력,수정폼,보기)에 주변지도모듈을 삽입한다. * @param $content 삽입할 게시판의 컨텐츠 * @return */ function triggerAroundmapInsert(&$content) { // 현재의 액션/모듈번호 값 가져오기 $act = Context::get('act'); $module_info = Context::get("module_info"); $module_srl = $module_info->module_srl; $oModuleModel =& getModel('module'); $this->module_config = $oModuleModel->getModuleConfig('aroundmap'); // aroundmap모듈이 사용가능한 상태 인지 확인 if (!$this->isAroundmapEnable($act, $module_srl)) { return new Object(); } // aroundmap모듈에 필요한 값 저장 $document_srl = Context::get('document_srl'); $output = $this->setAroundmapValues($document_srl); // 템플릿 파일에 aroundmap 모듈 삽입 if ($act == 'dispBoardWrite') { // 쓰기/수정 페이지 $content = preg_replace_callback('(<!-- 파일 업로드 영역 -->)', 'aroundmapController::insertWriteMap', $content); } else { // 보기 페이지 // Use Sphinx if useSphinx is checked, or use mysql. if (strcmp($this->module_config->useSphinx, 'true') == 0) { $aroundmapList = $this->getAroundmapListSphinx($document_srl, $output->data->lat, $output->data->lon); } else { $aroundmapList = $this->getAroundmapListMysql($document_srl, $output->data->lat, $output->data->lon); } Context::set('aroundmapList', $aroundmapList); Context::Set('full_url', getFullUrl('')); $content = preg_replace_callback('/<\\!--AfterDocument\\(([0-9]*),([0-9\\-]*)\\)-->/i', 'aroundmapController::insertViewMap', $content); } return new Object(); }
function processPaynoty(&$config,&$obj,&$sender,&$module_info) { // message content $sms_message = $this->mergeKeywords($config->content, $obj); $sms_message = $this->mergeKeywords($sms_message, $module_info); $sms_message = str_replace(" ", "", strip_tags($sms_message)); // mail content $mail_content = $this->mergeKeywords($config->mail_content, $obj); $mail_content = $this->mergeKeywords($mail_content, $module_info); /* // get document info. $oDocumentModel = &getModel('document'); $oDocument = $oDocumentModel->getDocument($obj->document_srl); debugPrint('oDocument : ' . serialize($oDocument)); */ $tmp_obj->article_url = getFullUrl('','document_srl', $obj->document_srl); $tmp_content = $this->mergeKeywords($mail_content, $tmp_obj); $tmp_message = $this->mergeKeywords($sms_message, $tmp_obj); $output = $this->sendMessages($tmp_message, $tmp_content, $obj->order_title, $sender, $config); if (!$output->toBool()) return $output; return new Object(); }
function dispGgmailingRequest() { $args = Context::getRequestVars(); $oModuleModel =& getModel('module'); $config = $oModuleModel->getModuleConfig('ggmailing'); $this->config = $config; Context::set('config', $config); $dmn = getFullUrl(''); $dmn = parse_url($dmn); $domain = substr($dmn['host'] . $dmn['path'], 0, -1); $domain = str_replace('www.', '', $domain); $ggmailing_serv_url = $config->ggmailing_serv_url; if ($config->ggmailing_ssl == 'N' || !$config->ggmailing_ssl) { $ggmailing_ssl = 'http://'; $ggmailing_ssl_port = ''; } elseif ($config->ggmailing_ssl == 'Y') { $ggmailing_ssl = 'https://'; $ggmailing_ssl_port = ':' . $config->ggmailing_ssl_port; } $url = $ggmailing_ssl . $ggmailing_serv_url . $ggmailing_ssl_port . '/index.php'; // 헤더, 공지, 전송완료값 모두 처리 $post_data = array('act' => 'dispWwapimanagerRequest', 'authkey' => $config->ggmailing_authkey, 'mid' => 'auth_woorimail', 'domain' => $domain, 'type' => 'ggmailing', 'notice_mid' => $args->notice_mid, 'ggmailing_document_srl' => $args->ggmailing_document_srl, 'ggmailing_send_srl' => $args->ggmailing_send_srl); // 비동기 $response = $this->curl_request_async($url, $post_data, $type = 'POST', $output = 'json'); Context::set('args', $args); Context::set('response', $response); $this->setTemplateFile('request'); }
/** * Create the Feed url. * * @param string $vid Vid * @param string $mid mid * @param string $format Feed format. rss | atom * @param bool $absolute_url * @return string */ function getModuleFeedUrl($vid, $mid, $format = 'rss', $absolute_url = false) { if ($absolute_url) { return getFullUrl('', 'vid', $vid, 'mid', $mid, 'act', $format); } else { return getUrl('', 'vid', $vid, 'mid', $mid, 'act', $format); } }
function checkLicense($prodid, $user_id, $serial_number, $force = FALSE) { $hostinfo = array($_SERVER['SERVER_ADDR'], $_SERVER['SERVER_NAME'], $_SERVER['HTTP_HOST']); $agency_url = sprintf("http://www.xeshoppingmall.com/?module=drmagency&act=getDrmagencyLicense&prodid=%s&hostinfo=%s&user=%s&serial=%s", $prodid, implode(',', $hostinfo), $user_id, $serial_number); $cache_file = sprintf("%sfiles/cache/license_%s.cache.php", _XE_PATH_, $prodid); if (!file_exists($cache_file) || filemtime($cache_file) + 60 * 60 < time() || $force == TRUE) { FileHandler::writeFile($cache_file, ''); FileHandler::getRemoteFile($agency_url, $cache_file, null, 1, 'GET', 'text/html', array('REQUESTURL' => getFullUrl(''))); } return $cache_file; }
/** * @brief Display Super Admin Dashboard **/ function dispTextmessageAdminIndex() { $oTextmessageModel = getModel('textmessage'); $config = $oTextmessageModel->getConfig(); if (!$config) { Context::set('isSetupCompleted', false); } else { Context::set('isSetupCompleted', true); } Context::set('config', $config); //Retrieve recent news and set them into context $newest_news_url = sprintf("http://www.coolsms.co.kr/?module=newsagency&act=getNewsagencyArticle&inst=notice&loc=%s", _XE_LOCATION_); $cache_file = sprintf("%sfiles/cache/cool_news.%s.cache.php", _XE_PATH_, _XE_LOCATION_); if (!file_exists($cache_file) || filemtime($cache_file) + 60 * 60 < time()) { // Considering if data cannot be retrieved due to network problem, modify filemtime to prevent trying to reload again when refreshing textmessageistration page // Ensure to access the textmessage registration page even though news cannot be displayed FileHandler::writeFile($cache_file, ''); FileHandler::getRemoteFile($newest_news_url, $cache_file, null, 1, 'GET', 'text/html', array('REQUESTURL' => getFullUrl(''))); } if (file_exists($cache_file)) { $oXml = new XmlParser(); $buff = $oXml->parse(FileHandler::readFile($cache_file)); $item = $buff->zbxe_news->item; if ($item) { if (!is_array($item)) { $item = array($item); } foreach ($item as $key => $val) { $obj = new stdClass(); $obj->title = $val->body; $obj->date = $val->attrs->date; $obj->url = $val->attrs->url; $news[] = $obj; } Context::set('news', $news); } Context::set('released_version', $buff->zbxe_news->attrs->released_version); Context::set('download_link', $buff->zbxe_news->attrs->download_link); } $this->setTemplateFile('index'); }
public function dispSyndicationAdminConfig() { $oModuleModel = getModel('module'); $module_config = $oModuleModel->getModuleConfig('syndication'); if (!$module_config->target_services) { $module_config->target_services = array(); } foreach ($this->services as $key => $val) { unset($obj); $obj = new stdClass(); $obj->service = $key; $obj->ping = $val; $obj->selected = in_array($key, $module_config->target_services) ? true : false; $services[] = $obj; } Context::set('services', $services); if (!$module_config->site_url) { $module_config->site_url = Context::getDefaultUrl() ? Context::getDefaultUrl() : getFullUrl(); } Context::set('site_url', preg_replace('/^(http|https):\\/\\//i', '', $module_config->site_url)); if (!$module_config->year) { $module_config->year = date("Y"); } Context::set('year', $module_config->year); $output = executeQueryArray('syndication.getExceptModules'); $except_module_list = array(); if ($output->data && count($output->data) > 0) { foreach ($output->data as $item) { $except_module_list[] = $item; } } Context::set('except_module', $except_module_list); //Security $security = new Security(); $security->encodeHTML('services..service', 'except_module..ping'); $security->encodeHTML('except_module..mid', 'except_module..browser_title'); $this->setTemplatePath($this->module_path . 'tpl'); $this->setTemplateFile('config'); }
public function dispSyndicationAdminConfig() { $oModuleModel = getModel('module'); $module_config = $oModuleModel->getModuleConfig('syndication'); $oSyndicationModel = getModel('syndication'); Context::set('ping_log', $oSyndicationModel->getResentPingLog()); if (!$module_config->syndication_use) { $module_config->syndication_use = 'Y'; } if (!$module_config->site_url) { $module_config->site_url = Context::getDefaultUrl() ? Context::getDefaultUrl() : getFullUrl(); } if (!$module_config->year) { $module_config->year = date("Y"); } if (!isset($module_config->syndication_password)) { $module_config->syndication_password = uniqid(); } Context::set('syndication_use', $module_config->syndication_use); Context::set('site_url', preg_replace('/^(http|https):\\/\\//i', '', $module_config->site_url)); Context::set('year', $module_config->year); Context::set('syndication_token', $module_config->syndication_token); Context::set('syndication_password', $module_config->syndication_password); $output = executeQueryArray('syndication.getExceptModules'); $except_module_list = array(); if ($output->data && count($output->data) > 0) { foreach ($output->data as $item) { $except_module_list[] = $item; } } Context::set('except_module', $except_module_list); //Security $security = new Security(); $security->encodeHTML('services..service', 'except_module..ping'); $security->encodeHTML('except_module..mid', 'except_module..browser_title'); $this->setTemplatePath($this->module_path . 'tpl'); $this->setTemplateFile('config'); }
function procMemberModifyEmailAddress() { if (!Context::get('is_logged')) { return $this->stop('msg_not_logged'); } $member_info = Context::get('logged_info'); $newEmail = Context::get('email_address'); if (!$newEmail) { return $this->stop('msg_invalid_request'); } $oMemberModel = getModel('member'); $member_srl = $oMemberModel->getMemberSrlByEmailAddress($newEmail); if ($member_srl) { return new Object(-1, 'msg_exists_email_address'); } if ($_SESSION['rechecked_password_step'] != 'INPUT_DATA') { return $this->stop('msg_invalid_request'); } unset($_SESSION['rechecked_password_step']); $auth_args = new stdClass(); $auth_args->user_id = $newEmail; $auth_args->member_srl = $member_info->member_srl; $auth_args->auth_key = md5(rand(0, 999999)); $auth_args->new_password = '******'; $output = executeQuery('member.insertAuthMail', $auth_args); if (!$output->toBool()) { $oDB->rollback(); return $output; } $oModuleModel = getModel('module'); $member_config = $oModuleModel->getModuleConfig('member'); $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); if (!is_dir($tpl_path)) { $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); } global $lang; $memberInfo = array(); $memberInfo[$lang->email_address] = $member_info->email_address; $memberInfo[$lang->nick_name] = $member_info->nick_name; Context::set('memberInfo', $memberInfo); Context::set('newEmail', $newEmail); $auth_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthEmailAddress', 'member_srl', $member_info->member_srl, 'auth_key', $auth_args->auth_key); Context::set('auth_url', $auth_url); $oTemplate =& TemplateHandler::getInstance(); $content = $oTemplate->compile($tpl_path, 'confirm_member_new_email'); $oMail = new Mail(); $oMail->setTitle(Context::getLang('title_modify_email_address')); $oMail->setContent($content); $oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email); $oMail->setReceiptor($member_info->nick_name, $newEmail); $result = $oMail->send(); $msg = sprintf(Context::getLang('msg_confirm_mail_sent'), $newEmail); $this->setMessage($msg); $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', ''); $this->setRedirectUrl($returnUrl); }
/** * send to upper repliers */ function sendToUpperReplier($upperComment, $mobileContent, $mailContent, $title, &$commentInfo, &$config) { // get the references of module MVC instances. $oMemberModel =& getModel('member'); // get member_info $member_info = $oMemberModel->getMemberInfoByMemberSrl($upperComment->member_srl); $upperReplier = $this->getCommentMemberInfo($upperComment); $recipientNumber = $this->getRecipientNumberForUpperReplier($member_info, $config); $senderNumber = $config->sender_phone; $recipientEmailAddress = $upperReplier->email_address; $recipientName = $upperReplier->nick_name; if (!$senderEmailAddress) { $senderEmailAddress = $commentInfo->email_address; } if (!$senderName) { $senderName = $commentInfo->nick_name; } $senderEmailAddress = $config->email_sender_address; $senderName = $config->email_sender_name; if (!$senderEmailAddress) { $senderEmailAddress = $recipientEmailAddress; } if (!$senderName) { $senderName = $recipientName; } $tmpObj->article_url = getFullUrl('', 'document_srl', $commentInfo->document_srl) . '#comment_' . $commentInfo->parent_srl; $tmpContent = $this->mergeKeywords($mailContent, $tmpObj); $tmpMessage = $this->mergeKeywords($mobileContent, $tmpObj); $this->sendMessages($recipientNumber, $senderNumber, $recipientEmailAddress, $recipientName, $senderEmailAddress, $senderName, $tmpMessage, $tmpContent, $title, $config, $commentInfo); }
function triggerBeforeDisplay(&$output_content) { if (Context::getResponseMethod() != 'HTML') { return; } if (Context::get('module') == 'admin') { return; } $oModuleModel = getModel('module'); $config = $this->getConfig(); $logged_info = Context::get('logged_info'); $current_module_info = Context::get('current_module_info'); $site_module_info = Context::get('site_module_info'); $document_srl = Context::get('document_srl'); $is_article = false; $is_index = $current_module_info->module_srl == $site_module_info->module_srl ? true : false; $piece = new stdClass(); $piece->document_title = null; $piece->type = 'website'; $piece->url = getFullUrl(''); $piece->title = Context::getBrowserTitle(); $piece->description = $config->site_description; $piece->keywords = $config->site_keywords; $piece->image = array(); $piece->author = null; if ($document_srl) { $oDocument = Context::get('oDocument'); if (!is_a($oDocument, 'documentItem')) { $oDocumentModel = getModel('document'); $oDocument = $oDocumentModel->getDocument($document_srl); } if (is_a($oDocument, 'documentItem') && $document_srl == $oDocument->document_srl) { $is_article = true; } } // 문서 데이터 수집 if ($is_article) { if (!$oDocument->isSecret()) { $piece->document_title = $oDocument->getTitleText(); $piece->url = getFullUrl('', 'mid', $current_module_info->mid, 'document_srl', $document_srl); $piece->type = 'article'; $piece->description = trim(str_replace(' ', ' ', $oDocument->getContentText(400))); $piece->author = $oDocument->getNickName(); if (count($oDocument->get('tag_list'))) { $tags = implode(',', $oDocument->get('tag_list')); if ($tags) { $piece->keywords = $tags; } } if ($oDocument->hasUploadedFiles()) { $image_ext = array('bmp', 'gif', 'jpg', 'jpeg', 'png'); foreach ($oDocument->getUploadedFiles() as $file) { if ($file->isvalid != 'Y') { continue; } $ext = array_pop(explode('.', $file->uploaded_filename)); if (!in_array(strtolower($ext), $image_ext)) { continue; } $piece->image[] = Context::get('request_uri') . $file->uploaded_filename; } } } else { $piece->url = getFullUrl('', 'mid', $current_module_info->mid); } } else { if (!$is_index) { $page = Context::get('page') > 1 ? Context::get('page') : null; $piece->url = getNotEncodedFullUrl('mid', $current_module_info->mid, 'page', $page); } } $piece->title = $this->getBrowserTitle($piece->document_title); if ($config->site_image_url) { $piece->image[] = $config->site_image_url; } $this->addLink('canonical', $piece->url); $this->addMeta('keywords', $piece->keywords); $this->addMeta('description', $piece->description); // Open Graph $this->addMeta('og:type', $piece->type); $this->addMeta('og:url', $piece->url); $this->addMeta('og:site_name', $config->site_name); $this->addMeta('og:title', $piece->title); $this->addMeta('og:description', $piece->description); $this->addMeta('og:article:author', $piece->author); foreach ($piece->image as $img) { $this->addMeta('og:image', $img); } $this->canonical_url = $piece->url; $this->applySEO(); if ($config->use_optimize_title == 'Y') { Context::setBrowserTitle($piece->title); } }
function notify($type, $content) { // useNotify가 아니면 return if (!$this->useNotify()) { return; } // 글쓴이가 로그인 유저가 아니면 패스~ if (!$this->get('member_srl')) { return; } // 현재 로그인한 사용자와 글을 쓴 사용자를 비교하여 동일하면 return $logged_info = Context::get('logged_info'); if ($logged_info->member_srl == $this->get('member_srl')) { return; } // 원본글의 주소를 구함 $oDocumentModel =& getModel('document'); $oDocument = $oDocumentModel->getDocument($this->get('document_srl')); // 변수 정리 if ($type) { $title = "[" . $type . "] "; } $title .= cut_str(strip_tags($content), 30, '...'); $content = sprintf('%s<br /><br />from : <a href="%s#comment_%s" onclick="window.open(this.href);return false;">%s</a>', $content, getFullUrl('', 'document_srl', $this->get('document_srl')), $this->get('comment_srl'), getFullUrl('', 'document_srl', $this->get('document_srl'))); $receiver_srl = $this->get('member_srl'); $sender_member_srl = $logged_info->member_srl; // 쪽지 발송 $oCommunicationController =& getController('communication'); $oCommunicationController->sendMessage($sender_member_srl, $receiver_srl, $title, $content, false); }
/** * Include admin menu php file and make menu url * Setting admin logo, newest news setting * @return void */ function makeGnbUrl($module = 'admin') { global $lang; // Check is_shortcut column $oDB = DB::getInstance(); if (!$oDB->isColumnExists('menu_item', 'is_shortcut')) { return; } $oAdminAdminModel = getAdminModel('admin'); $lang->menu_gnb_sub = $oAdminAdminModel->getAdminMenuLang(); $result = $oAdminAdminModel->checkAdminMenu(); include $result->php_file; $oModuleModel = getModel('module'); // get current menu's subMenuTitle $moduleActionInfo = $oModuleModel->getModuleActionXml($module); $currentAct = Context::get('act'); $subMenuTitle = ''; foreach ((array) $moduleActionInfo->menu as $key => $value) { if (isset($value->acts) && is_array($value->acts) && in_array($currentAct, $value->acts)) { $subMenuTitle = $value->title; break; } } // get current menu's srl(=parentSrl) $parentSrl = 0; $oMenuAdminConroller = getAdminController('menu'); foreach ((array) $menu->list as $parentKey => $parentMenu) { if (!is_array($parentMenu['list']) || !count($parentMenu['list'])) { continue; } if ($parentMenu['href'] == '#' && count($parentMenu['list'])) { $firstChild = current($parentMenu['list']); $menu->list[$parentKey]['href'] = $firstChild['href']; } foreach ($parentMenu['list'] as $childKey => $childMenu) { if ($subMenuTitle == $childMenu['text'] && $parentSrl == 0) { $parentSrl = $childMenu['parent_srl']; } } } // Admin logo, title setup $objConfig = $oModuleModel->getModuleConfig('admin'); $gnbTitleInfo = new stdClass(); $gnbTitleInfo->adminTitle = $objConfig->adminTitle ? $objConfig->adminTitle : 'XE Admin'; $gnbTitleInfo->adminLogo = $objConfig->adminLogo ? $objConfig->adminLogo : 'modules/admin/tpl/img/xe.h1.png'; $browserTitle = ($subMenuTitle ? $subMenuTitle : 'Dashboard') . ' - ' . $gnbTitleInfo->adminTitle; // Get list of favorite $oAdminAdminModel = getAdminModel('admin'); $output = $oAdminAdminModel->getFavoriteList(0, true); Context::set('favorite_list', $output->get('favoriteList')); // Retrieve recent news and set them into context, // move from index method, because use in admin footer $newest_news_url = sprintf("http://news.xpressengine.com/%s/news.php?version=%s&package=%s", _XE_LOCATION_, __XE_VERSION__, _XE_PACKAGE_); $cache_file = sprintf("%sfiles/cache/newest_news.%s.cache.php", _XE_PATH_, _XE_LOCATION_); if (!file_exists($cache_file) || filemtime($cache_file) + 60 * 60 < $_SERVER['REQUEST_TIME']) { // Considering if data cannot be retrieved due to network problem, modify filemtime to prevent trying to reload again when refreshing administration page // Ensure to access the administration page even though news cannot be displayed FileHandler::writeFile($cache_file, ''); FileHandler::getRemoteFile($newest_news_url, $cache_file, null, 1, 'GET', 'text/html', array('REQUESTURL' => getFullUrl(''))); } if (file_exists($cache_file)) { $oXml = new XmlParser(); $buff = $oXml->parse(FileHandler::readFile($cache_file)); $item = $buff->zbxe_news->item; if ($item) { if (!is_array($item)) { $item = array($item); } foreach ($item as $key => $val) { $obj = new stdClass(); $obj->title = $val->body; $obj->date = $val->attrs->date; $obj->url = $val->attrs->url; $news[] = $obj; } Context::set('news', $news); if (isset($news) && is_array($news)) { Context::set('latestVersion', array_shift($news)); } } Context::set('released_version', $buff->zbxe_news->attrs->released_version); Context::set('download_link', $buff->zbxe_news->attrs->download_link); } Context::set('subMenuTitle', $subMenuTitle); Context::set('gnbUrlList', $menu->list); Context::set('parentSrl', $parentSrl); Context::set('gnb_title_info', $gnbTitleInfo); Context::setBrowserTitle($browserTitle); }
/** * @brief display item detail info */ function dispNproductItemDetail() { if ($_COOKIE['mobile'] == "true") { Context::set('is_mobile', 'true'); } $oDocumentModel =& getModel('document'); $oFileModel =& getModel('file'); $oNproductModel =& getModel('nproduct'); $oStoreReviewModel =& getModel('store_review'); $item_srl = Context::get('item_srl'); $document_srl = Context::get('document_srl'); Context::set('list_config', $oNproductModel->getDetailListConfig($this->module_info->module_srl)); // get config $config = $oNproductModel->getModuleConfig(); Context::set('config', $config); // item info if ($item_srl) { $args->item_srl = $item_srl; } else { if ($document_srl) { $args->document_srl = $document_srl; } else { return new Object(-1, 'Item Not Found.'); } } $output = executeQuery('nproduct.getItemInfo', $args); if (!$output->toBool()) { return $output; } $item_info = $output->data; // thumbnail if ($item_info->thumb_file_srl) { $file = $oFileModel->getFile($item_info->thumb_file_srl); if ($file) { $item_info->thumbnail_url = getFullUrl() . $file->download_url; } } $item_info = new nproductItem($item_info, $config->currency, $config->as_sign, $config->decimals); // category $this->getCategoryTree($this->module_info->module_srl); // document $oDocument = $oDocumentModel->getDocument($item_info->document_srl); Context::set('oDocument', $oDocument); if ($item_info->item_srl) { $review_list = $oNproductModel->getReviews($item_info); Context::set('review_list', $review_list); } $output = $oNproductModel->discountItem($item_info); $item_info->discounted_price = $output->discounted_price; $item_info->discount_amount = $output->discount_amount; $item_info->discount_info = $output->discount_info; Context::set('discounted_price', $output->discounted_price); Context::set('discount_amount', $output->discount_amount); Context::set('discount_info', $output->discount_info); // get options $args->item_srl = $item_info->item_srl; $output = executeQueryArray('nproduct.getOptions', $args); Context::set('options', $output->data); // set browser title Context::setBrowserTitle(strip_tags($item_info->item_name) . ' - ' . Context::getBrowserTitle()); // get related items information if ($item_info->related_items) { if (!$this->isJson($item_info->related_items)) { $item_info->related_items = $this->convertCsvToJson($item_info->related_items); } $relatedItems = json_decode($item_info->related_items); $relatedItemSrls = array(); foreach ($relatedItems as $key => $val) { $relatedItemSrls[] = $val->item_srl; } if (count($relatedItemSrls)) { $item_info->related_items = $oNproductModel->getItemList(implode(',', $relatedItemSrls), 999); } } $trigger_output = ModuleHandler::triggerCall('nproduct.dispNproductItemDetail', 'before', $item_info); if (!$trigger_output->toBool()) { return $trigger_output; } // pass variables to html template Context::set('category', $item_info->category_id); Context::set('item_srl', $item_info->item_srl); Context::set('item_info', $item_info); $extra_vars = NExtraItemList::getList($item_info); Context::set('extra_vars', $extra_vars); $this->setTemplateFile('itemdetail'); }
function getPermanentUrl() { return getFullUrl('', 'document_srl', $this->get('document_srl')); }
function publish() { $oTextyleModel =& getModel('textyle'); $oTrackbackController =& getController('trackback'); if (!$this->oDocument->isExists()) { return; } $oTextyle = $oTextyleModel->getTextyle($this->module_srl); if (count($this->trackbacks)) { foreach ($this->trackbacks as $trackback_url => $val) { $output = $oTrackbackController->sendTrackback($this->oDocument, $trackback_url, $val->charset); if ($output->toBool()) { $this->trackbacks[$trackback_url]->log = Context::getLang('published') . ' (' . date("Y-m-d H:i") . ')'; } else { $this->trackbacks[$trackback_url]->log = $output->getMessage() . ' (' . date("Y-m-d H:i") . ')'; } } } // fixed link $original_content = $this->oDocument->get('content'); $original_content = preg_replace('/href="(\\.\\/)([^"]*)"/i', 'href="' . getFullUrl() . '$2"', $original_content); if (count($this->blogapis)) { $apis = $this->getApis(); foreach ($this->blogapis as $api_srl => $val) { if (!$apis[$api_srl] || !$val->reserve) { continue; } $this->oDocument->add('content', $original_content); if ($val->postid) { $output = $this->modifyBlogApi($apis[$api_srl], $val->postid, $val->category); } else { $output = $this->sendBlogApi($apis[$api_srl], $val->category); } if ($output->toBool()) { $this->blogapis[$api_srl]->postid = $output->get('postid'); $this->blogapis[$api_srl]->log = Context::getLang('published') . ' (' . date("Y-m-d H:i") . ')'; } else { $this->blogapis[$api_srl]->postid = null; $this->blogapis[$api_srl]->log = $output->getMessage() . ' (' . date("Y-m-d H:i") . ')'; } $this->blogapis[$api_srl]->reserve = false; } } if ($this->publish_me2day && $oTextyle->getEnableMe2day()) { $this->sendMe2day($oTextyle->getMe2dayUserID(), $oTextyle->getMe2dayUserKey()); } if ($this->publish_twitter && $oTextyle->getEnableTwitter()) { $this->sendTwitter($oTextyle->getTwitterConsumerKey(), $oTextyle->getTwitterConsumerSecret(), $oTextyle->getTwitterOauthToken(), $oTextyle->getTwitterOauthTokenSecret()); } $this->save(); }
/** * Add OpenGraph metadata tags. * * @param string $output * @return void */ function _addOpenGraphMetadata() { // Get information about the current request. $page_type = 'website'; $current_module_info = Context::get('current_module_info'); $site_module_info = Context::get('site_module_info'); $document_srl = Context::get('document_srl'); if ($document_srl) { $oDocument = Context::get('oDocument') ?: getModel('document')->getDocument($document_srl, false, false); if ($oDocument instanceof documentItem && $oDocument->document_srl == $document_srl && !$oDocument->isSecret()) { $page_type = 'article'; } } // Add basic metadata. Context::addOpenGraphData('og:title', Context::getBrowserTitle()); Context::addOpenGraphData('og:site_name', Context::getSiteTitle()); if ($page_type === 'article' && config('seo.og_extract_description')) { $description = trim(utf8_normalize_spaces($oDocument->getContentText(200))); } else { $description = Context::getMetaTag('description'); } Context::addOpenGraphData('og:description', $description); Context::addMetaTag('description', $description); // Add metadata about this page. Context::addOpenGraphData('og:type', $page_type); if ($page_type === 'article') { $canonical_url = getFullUrl('', 'mid', $current_module_info->mid, 'document_srl', $document_srl); } elseif (($page = Context::get('page')) > 1) { $canonical_url = getFullUrl('', 'mid', $current_module_info->mid, 'page', $page); } elseif ($current_module_info->module_srl == $site_module_info->module_srl) { $canonical_url = getFullUrl(''); } else { $canonical_url = getFullUrl('', 'mid', $current_module_info->mid); } Context::addOpenGraphData('og:url', $canonical_url); Context::setCanonicalURL($canonical_url); // Add metadata about the locale. $lang_type = Context::getLangType(); $locales = (include \RX_BASEDIR . 'common/defaults/locales.php'); if (isset($locales[$lang_type])) { Context::addOpenGraphData('og:locale', $locales[$lang_type]['locale']); } if ($page_type === 'article' && $oDocument->getLangCode() !== $lang_type && isset($locales[$oDocument->getLangCode()])) { Context::addOpenGraphData('og:locale:alternate', $locales[$oDocument->getLangCode()]); } // Add image. if ($page_type === 'article' && config('seo.og_extract_images')) { if (($document_images = Rhymix\Framework\Cache::get("seo:document_images:{$document_srl}")) === null) { $document_images = array(); if ($oDocument->hasUploadedFiles()) { foreach ($oDocument->getUploadedFiles() as $file) { if ($file->isvalid !== 'Y' || !preg_match('/\\.(?:bmp|gif|jpe?g|png)$/i', $file->uploaded_filename)) { continue; } list($width, $height) = @getimagesize($file->uploaded_filename); if ($width < 100 && $height < 100) { continue; } $image = array('filepath' => $file->uploaded_filename, 'width' => $width, 'height' => $height); if ($file->cover_image === 'Y') { array_unshift($document_images, $image); } else { $document_images[] = $image; } if (count($document_images) >= 1) { break; } } } Rhymix\Framework\Cache::set("seo:document_images:{$document_srl}", $document_images, 0, true); } } else { $document_images = null; } if ($document_images) { $first_image = reset($document_images); $first_image['filepath'] = preg_replace('/^.\\/files\\//', \RX_BASEURL . 'files/', $first_image['filepath']); Context::addOpenGraphData('og:image', Rhymix\Framework\URL::getCurrentDomainURL($first_image['filepath'])); Context::addOpenGraphData('og:image:width', $first_image['width']); Context::addOpenGraphData('og:image:height', $first_image['height']); } elseif ($default_image = getAdminModel('admin')->getSiteDefaultImageUrl($width, $height)) { Context::addOpenGraphData('og:image', Rhymix\Framework\URL::getCurrentDomainURL($default_image)); if ($width && $height) { Context::addOpenGraphData('og:image:width', $width); Context::addOpenGraphData('og:image:height', $height); } } // Add datetime for articles. if ($page_type === 'article' && config('seo.og_use_timestamps')) { Context::addOpenGraphData('article:published_time', $oDocument->getRegdate('c')); Context::addOpenGraphData('article:modified_time', $oDocument->getUpdate('c')); } }
/** * @brief insert document **/ function procBoardInsertDocument() { // check grant if ($this->module_info->module != "board") { return new Object(-1, "msg_invalid_request"); } if (!$this->grant->write_document) { return new Object(-1, 'msg_not_permitted'); } $logged_info = Context::get('logged_info'); // setup variables $obj = Context::getRequestVars(); $obj->module_srl = $this->module_srl; if ($obj->is_notice != 'Y' || !$this->grant->manager) { $obj->is_notice = 'N'; } $obj->commentStatus = $obj->comment_status; settype($obj->title, "string"); if ($obj->title == '') { $obj->title = cut_str(trim(strip_tags(nl2br($obj->content))), 20, '...'); } //setup dpcument title tp 'Untitled' if ($obj->title == '') { $obj->title = 'Untitled'; } // unset document style if the user is not the document manager if (!$this->grant->manager) { unset($obj->title_color); unset($obj->title_bold); } // generate document module model object $oDocumentModel = getModel('document'); // generate document module의 controller object $oDocumentController = getController('document'); // check if the document is existed $oDocument = $oDocumentModel->getDocument($obj->document_srl, $this->grant->manager); // update the document if it is existed $is_update = false; if ($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) { $is_update = true; } $oMemberModel = getModel('member'); $member_info = $oMemberModel->getMemberInfoByMemberSrl($oDocument->get('member_srl')); if ($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y') { return new Object(-1, 'msg_admin_document_no_modify'); } // if use anonymous is true if ($this->module_info->use_anonymous == 'Y') { $this->module_info->admin_mail = ''; $obj->notify_message = 'N'; if ($is_update === false) { $obj->member_srl = -1 * $logged_info->member_srl; } $obj->email_address = $obj->homepage = $obj->user_id = ''; $obj->user_name = $obj->nick_name = 'anonymous'; $bAnonymous = true; if ($is_update === false) { $oDocument->add('member_srl', $obj->member_srl); } } else { $bAnonymous = false; } if ($obj->is_secret == 'Y' || strtoupper($obj->status == 'SECRET')) { $use_status = explode('|@|', $this->module_info->use_status); if (!is_array($use_status) || !in_array('SECRET', $use_status)) { unset($obj->is_secret); $obj->status = 'PUBLIC'; } } // update the document if it is existed if ($is_update) { if (!$oDocument->isGranted()) { return new Object(-1, 'msg_not_permitted'); } if ($this->module_info->protect_content == "Y" && $oDocument->get('comment_count') > 0 && $this->grant->manager == false) { return new Object(-1, 'msg_protect_content'); } if (!$this->grant->manager) { // notice & document style same as before if not manager $obj->is_notice = $oDocument->get('is_notice'); $obj->title_color = $oDocument->get('title_color'); $obj->title_bold = $oDocument->get('title_bold'); } // modify list_order if document status is temp if ($oDocument->get('status') == 'TEMP') { $obj->last_update = $obj->regdate = date('YmdHis'); $obj->update_order = $obj->list_order = getNextSequence() * -1; } $output = $oDocumentController->updateDocument($oDocument, $obj); $msg_code = 'success_updated'; // insert a new document otherwise } else { $output = $oDocumentController->insertDocument($obj, $bAnonymous); $msg_code = 'success_registed'; $obj->document_srl = $output->get('document_srl'); // send an email to admin user if ($output->toBool() && $this->module_info->admin_mail) { $oModuleModel = getModel('module'); $member_config = $oModuleModel->getModuleConfig('member'); $is_logged = Context::get('is_logged'); if (!$is_logged && !$member_config->webmaster_email) { $obj->email_address = $this->module_info->admin_mail; } $oMail = new Mail(); $oMail->setTitle($obj->title); $oMail->setContent(sprintf("From : <a href=\"%s\">%s</a><br/>\r\n%s", getFullUrl('', 'document_srl', $obj->document_srl), getFullUrl('', 'document_srl', $obj->document_srl), $obj->content)); $oMail->setSender($obj->user_name ? $obj->user_name : 'anonymous', $obj->email_address ? $obj->email_address : $member_config->webmaster_email); $target_mail = explode(',', $this->module_info->admin_mail); for ($i = 0; $i < count($target_mail); $i++) { $email_address = trim($target_mail[$i]); if (!$email_address) { continue; } $oMail->setReceiptor($email_address, $email_address); $oMail->send(); } } } // if there is an error if (!$output->toBool()) { return $output; } // return the results $this->add('mid', Context::get('mid')); $this->add('document_srl', $output->get('document_srl')); // alert a message $this->setMessage($msg_code); }
function editPost($postid, $oDocument, $category = null) { $oXmlParser = new XmlParser(); $output = $this->getUsersBlogs(); if (!$output->toBool()) { return $output; } $this->blogid = $output->get('blogid'); if ($oDocument->hasUploadedFiles()) { $file_list = $oDocument->getUploadedFiles(); if (count($file_list)) { $content = $oDocument->get('content'); $content = preg_replace('/src="(files\\/)([^"]*)"/i', 'src="./files/$2"', $content); foreach ($file_list as $file) { $output = $this->newMediaObject($file->source_filename, $file->uploaded_filename); $target_file = $output->get('target_file'); if (!$target_file) { continue; } preg_match('/(.+)\\/' . preg_quote($file->source_filename) . '$/', $file->uploaded_filename, $m); $path = $m[1] . '/'; $encoded_filename = $path . str_replace('+', '%20', urlencode($file->source_filename)); $uploaded_filename = $file->uploaded_filename; $extension = strrchr($uploaded_filename, '.'); $extension = '.resized' . $extension; if (strpos($content, $uploaded_filename . $extension) !== false) { $content = str_replace($uploaded_filename . $extension, $uploaded_filename, $content); } if (strpos($content, $encoded_filename . $extension) !== false) { $content = str_replace($encoded_filename . $extension, $encoded_filename, $content); } if (strpos($content, $uploaded_filename) !== false) { $content = str_replace($uploaded_filename, $target_file, $content); } if (strpos($content, $encoded_filename) !== false) { $content = str_replace($encoded_filename, $target_file, $content); } $uploaded_filename = preg_replace('/^\\.\\//', '', $file->uploaded_filename); $encoded_filename = preg_replace('/^\\.\\//', '', $path . str_replace('+', '%20', urlencode($file->source_filename))); if (strpos($content, $uploaded_filename . $extension) !== false) { $content = str_replace($uploaded_filename . $extension, $uploaded_filename, $content); } if (strpos($content, $encoded_filename . $extension) !== false) { $content = str_replace($encoded_filename . $extension, $encoded_filename, $content); } if (strpos($content, $uploaded_filename) !== false) { $content = str_replace($uploaded_filename, $target_file, $content); } if (strpos($content, $encoded_filename) !== false) { $content = str_replace($encoded_filename, $target_file, $content); } } $oDocument->add('content', $content); } } $content = $oDocument->get('content'); $content = preg_replace('/src="(\\.\\/)([^"]*)"/i', 'src="' . getFullUrl() . '$2"', $content); $oDocument->add('content', $content); $input = sprintf('<?xml version="1.0" encoding="utf-8"?><methodCall><methodName>metaWeblog.editPost</methodName><params><param><value>%s</value></param><param><value><string>%s</string></value></param><param><value><string>%s</string></value></param><param><value><struct><member><name>title</name><value><string>%s</string></value></member><member><name>description</name><value><string>%s</string></value></member><member><name>categories</name><value><array><data><value><string>%s</string></value></data></array></value></member><member><name>tagwords</name><value><array><data><value><string>%s</string></value></data></array></value></member></struct></value></param><param><value><boolean>1</boolean></value></param></params></methodCall>', $postid, $this->user_id, $this->password, str_replace(array('&', '<', '>'), array('&', '<', '>'), $oDocument->get('title')), str_replace(array('&', '<', '>'), array('&', '<', '>'), $oDocument->get('content')), str_replace(array('&', '<', '>'), array('&', '<', '>'), $category), str_replace(array('&', '<', '>'), array('&', '<', '>'), $oDocument->get('tags'))); $output = $this->_request($this->url, $input, 'application/octet-stream', 'POST'); $xmlDoc = $oXmlParser->parse($output); if (isset($xmlDoc->methodresponse->fault)) { $code = $xmlDoc->methodresponse->fault->value->struct->member[0]->value->int->body; $message = $xmlDoc->methodresponse->fault->value->struct->member[1]->value->string->body; return new Object($code, $message); } $output = new Object(); $output->add('postid', $postid); return $output; }
/** * @brief member 테이블에 사용자 추가 **/ function insertMember(&$args, $password_is_hashed = false) { // trigger 호출 (before) $output = ModuleHandler::triggerCall('member.insertMember', 'before', $args); if (!$output->toBool()) { return $output; } // 멤버 설정 정보에서 가입약관 부분을 재확인 $oModuleModel =& getModel('module'); $config = $oModuleModel->getModuleConfig('member'); $logged_info = Context::get('logged_info'); // 임시 제한 일자가 있을 경우 제한 일자에 내용 추가 if ($config->limit_day) { $args->limit_date = date("YmdHis", time() + $config->limit_day * 60 * 60 * 24); } // 입력할 사용자의 아이디를 소문자로 변경 $args->user_id = strtolower($args->user_id); // 필수 변수들의 조절 if ($args->allow_mailing != 'Y') { $args->allow_mailing = 'N'; } if ($args->denied != 'Y') { $args->denied = 'N'; } $args->allow_message = 'Y'; if ($logged_info->is_admin == 'Y') { if ($args->is_admin != 'Y') { $args->is_admin = 'N'; } } else { unset($args->is_admin); } list($args->email_id, $args->email_host) = explode('@', $args->email_address); // 홈페이지, 블로그의 주소 검사 if ($args->homepage && !preg_match("/^[a-z]+:\\/\\//i", $args->homepage)) { $args->homepage = 'http://' . $args->homepage; } if ($args->blog && !preg_match("/^[a-z]+:\\/\\//i", $args->blog)) { $args->blog = 'http://' . $args->blog; } // 모델 객체 생성 $oMemberModel =& getModel('member'); // 금지 아이디인지 체크 if ($oMemberModel->isDeniedID($args->user_id)) { return new Object(-1, 'denied_user_id'); } // 아이디, 닉네임, email address 의 중복 체크 $member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id); if ($member_srl) { return new Object(-1, 'msg_exists_user_id'); } $member_srl = $oMemberModel->getMemberSrlByNickName($args->nick_name); if ($member_srl) { return new Object(-1, 'msg_exists_nick_name'); } $member_srl = $oMemberModel->getMemberSrlByEmailAddress($args->email_address); if ($member_srl) { return new Object(-1, 'msg_exists_email_address'); } $oDB =& DB::getInstance(); $oDB->begin(); // DB에 입력 $args->member_srl = getNextSequence(); if ($args->password && !$password_is_hashed) { $args->password = md5($args->password); } elseif (!$args->password) { unset($args->password); } $output = executeQuery('member.insertMember', $args); if (!$output->toBool()) { $oDB->rollback(); return $output; } // 입력된 그룹 값이 없으면 기본 그룹의 값을 등록 if (!$args->group_srl_list) { $default_group = $oMemberModel->getDefaultGroup(0); // 기본 그룹에 추가 $output = $this->addMemberToGroup($args->member_srl, $default_group->group_srl); if (!$output->toBool()) { $oDB->rollback(); return $output; } // 입력된 그룹 값이 있으면 해당 그룹의 값을 등록 } else { $group_srl_list = explode('|@|', $args->group_srl_list); for ($i = 0; $i < count($group_srl_list); $i++) { $output = $this->addMemberToGroup($args->member_srl, $group_srl_list[$i]); if (!$output->toBool()) { $oDB->rollback(); return $output; } } } // 메일 인증 모드 사용시(가입된 회원이 denied일 때) 인증 메일 발송 if ($args->denied == 'Y') { // 인증 DB에 데이터를 넣음 $auth_args->user_id = $args->user_id; $auth_args->member_srl = $args->member_srl; $auth_args->new_password = $args->password; $auth_args->auth_key = md5(rand(0, 999999)); $auth_args->is_register = 'Y'; $output = executeQuery('member.insertAuthMail', $auth_args); if (!$output->toBool()) { $oDB->rollback(); return $output; } // 메일 내용을 구함 Context::set('auth_args', $auth_args); Context::set('member_info', $args); $member_config = $oModuleModel->getModuleConfig('member'); if (!$member_config->skin) { $this->member_config->skin = "default"; } if (!$member_config->colorset) { $this->member_config->colorset = "white"; } Context::set('member_config', $member_config); $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); if (!is_dir($tpl_path)) { $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); } $auth_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $args->member_srl, 'auth_key', $auth_args->auth_key); Context::set('auth_url', $auth_url); $oTemplate =& TemplateHandler::getInstance(); $content = $oTemplate->compile($tpl_path, 'confirm_member_account_mail'); // 사이트 웹마스터 정보를 구함 $oModuleModel =& getModel('module'); $member_config = $oModuleModel->getModuleConfig('member'); // 메일 발송 $oMail = new Mail(); $oMail->setTitle(Context::getLang('msg_confirm_account_title')); $oMail->setContent($content); $oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email); $oMail->setReceiptor($args->user_name, $args->email_address); $oMail->send(); } // trigger 호출 (after) if ($output->toBool()) { $trigger_output = ModuleHandler::triggerCall('member.insertMember', 'after', $args); if (!$trigger_output->toBool()) { $oDB->rollback(); return $trigger_output; } } $oDB->commit(true); $output->add('member_srl', $args->member_srl); return $output; }
$logged_info = Context::get('logged_info'); $args->search_target = 'member_srl'; $args->search_keyword = $logged_info->member_srl; $output = $oDocumentModel->getDocumentList($args); if (!$output->toBool() || !$output->data) { $content = getXmlRpcFailure(1, 'post not founded'); printContent($content); } else { $oEditorController =& getController('editor'); $posts = array(); foreach ($output->data as $key => $oDocument) { $post = null; $post->categories = array(); $post->dateCreated = date("Ymd", $oDocument->getRegdateTime()) . 'T' . date("H:i:s", $oDocument->getRegdateTime()); $post->description = htmlspecialchars($oEditorController->transComponent($oDocument->getContent(false, false, true, false))); $post->link = $post->permaLink = getFullUrl('', 'document_srl', $oDocument->document_srl); $post->postid = $oDocument->document_srl; $post->title = htmlspecialchars($oDocument->get('title')); $post->publish = 1; $post->userid = $oDocument->get('user_id'); $post->mt_allow_pings = 0; $post->mt_allow_comments = $oDocument->allowComment() ? 1 : 0; $posts[] = $post; } $content = getXmlRpcResponse($posts); printContent($content); } break; // Display RSD if there is no request // Display RSD if there is no request default:
<?php require_once "awscfg.php"; require_once "db.php"; require_once "utils.php"; $current_url = getFullUrl("atom.php"); $db = new DB($dbServer, $dbName, $dbUser, $dbPassword); $limit = isset($_GET["limit"]) ? $_GET["limit"] : 15; $list = isset($_GET["author"]) ? $db->getBooksByAuthorRSS($_GET["author"], $limit) : $db->getBooks($limit); $last_modified = date(DATE_RFC822, strtotime($list[0]["converted"])); header("Content-Type: application/atom+xml; charset=utf-8"); header("Last-Modified: " . $last_modified); echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n <feed xmlns=\"http://www.w3.org/2005/Atom\">\n <link rel=\"self\" href=\"{$current_url}\"/> \n "; if (isset($_GET["author"])) { $byauthor = $_GET["author"]; echo "<title>FB2PDF. Новые книги {$byauthor}.</title>"; } else { echo "<title>FB2PDF. Новые книги.</title>"; } echo "<link href=\"http://fb2pdf.com/\"/>\n <id>urn:uuid:60a76c80</id>\n <updated>" . date("Y\\-m\\-d\\TH\\:i\\:s\\Z") . "</updated>\n "; if ($limit > count($list)) { $limit = count($list); } for ($i = 0; $i < $limit; $i++) { $title = $list[$i]["title"]; $author = $list[$i]["author"]; $id = $list[$i]["id"]; $date = formatDateIntoAtom($list[$i]["submitted"]); $key = "book.php?key=" . $list[$i]["storage_key"]; if (!$author) { $author = "Автор неизвестен";
info_windows[docu_srl].open(map,markers[docu_srl]); listScroll(docu_srl); }); } count++; }); } //맵리스트 추출 아작스함수 function ajaxMaplist(){ var data_add = ''; if(lat_north) data_add += '&lat_north='+lat_north; if(lng_east) data_add += '&lng_east='+lng_east; if(lat_south) data_add += '&lat_south='+lat_south; if(lng_west) data_add += '&lng_west='+lng_west; var url = "<?php echo getFullUrl(''); ?> index.php"; jQuery.ajax({ type: "POST", url: url, data: "xenara_ajax=y&mid=<?php echo $__Context->mid; ?> "+data_add, success: function(data){ var response = jQuery(data); if(response.filter('.<?php echo $__Context->skin_topdiv_class; ?> .map_list_wrap .map_list').html()){
/** * Send email to module's admins after a new comment was interted successfully * if Comments Approval System is used * @param object $obj * @return void */ function sendEmailToAdminAfterInsertComment($obj) { $using_validation = $this->isModuleUsingPublishValidation($obj->module_srl); $oDocumentModel = getModel('document'); $oDocument = $oDocumentModel->getDocument($obj->document_srl); $oMemberModel = getModel("member"); if (isset($obj->member_srl) && !is_null($obj->member_srl)) { $member_info = $oMemberModel->getMemberInfoByMemberSrl($obj->member_srl); } else { $member_info = new stdClass(); $member_info->is_admin = "N"; $member_info->nick_name = $obj->nick_name; $member_info->user_name = $obj->user_name; $member_info->email_address = $obj->email_address; } $oCommentModel = getModel("comment"); $nr_comments_not_approved = $oCommentModel->getCommentAllCount(NULL, FALSE); $oModuleModel = getModel("module"); $module_info = $oModuleModel->getModuleInfoByDocumentSrl($obj->document_srl); // If there is no problem to register comment then send an email to all admin were set in module admin panel if ($module_info->admin_mail && $member_info->is_admin != 'Y') { $oMail = new Mail(); $oMail->setSender($obj->email_address, $obj->email_address); $mail_title = "[XE - " . Context::get('mid') . "] A new comment was posted on document: \"" . $oDocument->getTitleText() . "\""; $oMail->setTitle($mail_title); $url_comment = getFullUrl('', 'document_srl', $obj->document_srl) . '#comment_' . $obj->comment_srl; if ($using_validation) { $url_approve = getFullUrl('', 'module', 'admin', 'act', 'procCommentAdminChangePublishedStatusChecked', 'cart[]', $obj->comment_srl, 'will_publish', '1', 'search_target', 'is_published', 'search_keyword', 'N'); $url_trash = getFullUrl('', 'module', 'admin', 'act', 'procCommentAdminDeleteChecked', 'cart[]', $obj->comment_srl, 'search_target', 'is_trash', 'search_keyword', 'true'); $mail_content = "\n\t\t\t\t\tA new comment on the document \"" . $oDocument->getTitleText() . "\" is waiting for your approval.\n\t\t\t\t\t<br />\n\t\t\t\t\t<br />\n\t\t\t\t\tAuthor: " . $member_info->nick_name . "\n\t\t\t\t\t<br />Author e-mail: " . $member_info->email_address . "\n\t\t\t\t\t<br />From : <a href=\"" . $url_comment . "\">" . $url_comment . "</a>\n\t\t\t\t\t<br />Comment:\n\t\t\t\t\t<br />\"" . $obj->content . "\"\n\t\t\t\t\t<br />Document:\n\t\t\t\t\t<br />\"" . $oDocument->getContentText() . "\"\n\t\t\t\t\t<br />\n\t\t\t\t\t<br />\n\t\t\t\t\tApprove it: <a href=\"" . $url_approve . "\">" . $url_approve . "</a>\n\t\t\t\t\t<br />Trash it: <a href=\"" . $url_trash . "\">" . $url_trash . "</a>\n\t\t\t\t\t<br />Currently " . $nr_comments_not_approved . " comments on \"" . Context::get('mid') . "\" module are waiting for approval. Please visit the moderation panel:\n\t\t\t\t\t<br /><a href=\"" . getFullUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_target', 'module', 'search_keyword', $obj->module_srl) . "\">" . getFullUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_target', 'module', 'search_keyword', $obj->module_srl) . "</a>\n\t\t\t\t\t"; $oMail->setContent($mail_content); } else { $mail_content = "\n\t\t\t\t\tAuthor: " . $member_info->nick_name . "\n\t\t\t\t\t<br />Author e-mail: " . $member_info->email_address . "\n\t\t\t\t\t<br />From : <a href=\"" . $url_comment . "\">" . $url_comment . "</a>\n\t\t\t\t\t<br />Comment:\n\t\t\t\t\t<br />\"" . $obj->content . "\"\n\t\t\t\t\t<br />Document:\n\t\t\t\t\t<br />\"" . $oDocument->getContentText() . "\"\n\t\t\t\t\t"; $oMail->setContent($mail_content); // get email of thread's author $document_author_email = $oDocument->variables['email_address']; //get admin info $logged_info = Context::get('logged_info'); //mail to author of thread - START /** * @todo Removed code send email to document author. */ /* if($document_author_email != $obj->email_address && $logged_info->email_address != $document_author_email) { $oMail->setReceiptor($document_author_email, $document_author_email); $oMail->send(); } */ // mail to author of thread - STOP } // get all admins emails $admins_emails = $module_info->admin_mail; $target_mail = explode(',', $admins_emails); // send email to all admins - START for ($i = 0; $i < count($target_mail); $i++) { $email_address = trim($target_mail[$i]); if (!$email_address) { continue; } $oMail->setReceiptor($email_address, $email_address); $oMail->send(); } // send email to all admins - STOP } $comment_srl_list = array(0 => $obj->comment_srl); // call a trigger for calling "send mail to subscribers" (for moment just for forum) ModuleHandler::triggerCall("comment.sendEmailToAdminAfterInsertComment", "after", $comment_srl_list); /* // send email to author - START $oMail = new Mail(); $mail_title = "[XE - ".Context::get('mid')."] your comment on document: \"".$oDocument->getTitleText()."\" have to be approved"; $oMail->setTitle($mail_title); //$mail_content = sprintf("From : <a href=\"%s?document_srl=%s&comment_srl=%s#comment_%d\">%s?document_srl=%s&comment_srl=%s#comment_%d</a><br/>\r\n%s ", getFullUrl(''),$comment->document_srl,$comment->comment_srl,$comment->comment_srl, getFullUrl(''),$comment->document_srl,$comment->comment_srl,$comment->comment_srl,$comment>content); $mail_content = " Your comment #".$obj->comment_srl." on document \"".$oDocument->getTitleText()."\" have to be approved by admin of <strong><i>". strtoupper($module_info->mid)."</i></strong> module before to be publish. <br /> <br />Comment content: ".$obj->content." <br /> "; $oMail->setContent($mail_content); $oMail->setSender($obj->email_address, $obj->email_address); $oMail->setReceiptor($obj->email_address, $obj->email_address); $oMail->send(); // send email to author - START */ return; }
function getLicenseFromAgency() { $hostinfo = array($_SERVER['SERVER_ADDR'], $_SERVER['SERVER_NAME'], $_SERVER['HTTP_HOST']); $agency_url = sprintf("http://store.nurigo.net/?module=drmagency&act=getDrmagencyLicense&prodid=%s&hostinfo=%s", $this->getExtMod(), implode(',', $hostinfo)); $cache_file = sprintf("%sfiles/cache/ncart_drm.%s.cache.php", _XE_PATH_, _XE_LOCATION_); if (!file_exists($cache_file) || filemtime($cache_file) + 60 * 60 < time()) { FileHandler::writeFile($cache_file, ''); FileHandler::getRemoteFile($agency_url, $cache_file, null, 1, 'GET', 'text/html', array('REQUESTURL' => getFullUrl(''))); } }
function procMemberModifyEmailAddress() { if (!Context::get('is_logged')) { return $this->stop('msg_not_logged'); } $member_info = Context::get('logged_info'); $newEmail = Context::get('email_address'); if (!$newEmail) { return $this->stop('msg_invalid_request'); } $oMemberModel = getModel('member'); // Check managed Email Host if ($oMemberModel->isDeniedEmailHost($newEmail)) { $config = $oMemberModel->getMemberConfig(); $emailhost_check = $config->emailhost_check; $managed_email_host = lang('managed_email_host'); $email_hosts = $oMemberModel->getManagedEmailHosts(); foreach ($email_hosts as $host) { $hosts[] = $host->email_host; } $message = sprintf($managed_email_host[$emailhost_check], implode(', ', $hosts), 'id@' . implode(', id@', $hosts)); return new Object(-1, $message); } // Check if the e-mail address is already registered $member_srl = $oMemberModel->getMemberSrlByEmailAddress($newEmail); if ($member_srl) { return new Object(-1, 'msg_exists_email_address'); } if ($_SESSION['rechecked_password_step'] != 'INPUT_DATA') { return $this->stop('msg_invalid_request'); } unset($_SESSION['rechecked_password_step']); $auth_args = new stdClass(); $auth_args->user_id = $newEmail; $auth_args->member_srl = $member_info->member_srl; $auth_args->auth_key = Rhymix\Framework\Security::getRandom(40, 'hex'); $auth_args->new_password = '******'; $oDB =& DB::getInstance(); $oDB->begin(); $output = executeQuery('member.insertAuthMail', $auth_args); if (!$output->toBool()) { $oDB->rollback(); return $output; } $oModuleModel = getModel('module'); $member_config = $oModuleModel->getModuleConfig('member'); $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); if (!is_dir($tpl_path)) { $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); } global $lang; $memberInfo = array(); $memberInfo[$lang->email_address] = $member_info->email_address; $memberInfo[$lang->nick_name] = $member_info->nick_name; Context::set('memberInfo', $memberInfo); Context::set('newEmail', $newEmail); $auth_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthEmailAddress', 'member_srl', $member_info->member_srl, 'auth_key', $auth_args->auth_key); Context::set('auth_url', $auth_url); $oTemplate =& TemplateHandler::getInstance(); $content = $oTemplate->compile($tpl_path, 'confirm_member_new_email'); $oMail = new Mail(); $oMail->setTitle(lang('title_modify_email_address')); $oMail->setContent($content); $oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email); $oMail->setReceiptor($member_info->nick_name, $newEmail); $result = $oMail->send(); $msg = sprintf(lang('msg_confirm_mail_sent'), $newEmail); $this->setMessage($msg); $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', ''); $this->setRedirectUrl($returnUrl); }
/** * Parameter arrange for send to XE collect server * @param string $type 'WORKING', 'INSTALL' * @return string */ function getEnv($type = 'WORKING') { $skip = array('ext' => array('pcre', 'json', 'hash', 'dom', 'session', 'spl', 'standard', 'date', 'ctype', 'tokenizer', 'apache2handler', 'filter', 'posix', 'reflection', 'pdo'), 'module' => array('addon', 'admin', 'autoinstall', 'comment', 'communication', 'counter', 'document', 'editor', 'file', 'importer', 'install', 'integration_search', 'layout', 'member', 'menu', 'message', 'module', 'opage', 'page', 'point', 'poll', 'rss', 'session', 'spamfilter', 'tag', 'trackback', 'trash', 'widget'), 'addon' => array('autolink', 'blogapi', 'captcha', 'counter', 'member_communication', 'member_extra_info', 'mobile', 'openid_delegation_id', 'point_level_icon', 'resize_image'), 'layout' => array('default'), 'widget' => array('content', 'language_select', 'login_info', 'mcontent'), 'widgetstyle' => array()); $info = array(); $db_info = Context::getDBInfo(); $info['type'] = $type != 'INSTALL' ? 'WORKING' : 'INSTALL'; $info['location'] = _XE_LOCATION_; $info['package'] = _XE_PACKAGE_; $info['host'] = $db_type->default_url ? $db_type->default_url : getFullUrl(); $info['app'] = $_SERVER['SERVER_SOFTWARE']; $info['xe_version'] = __XE_VERSION__; $info['php'] = phpversion(); $info['db_type'] = Context::getDBType(); $info['use_rewrite'] = $db_info->use_rewrite; $info['use_db_session'] = $db_info->use_db_session == 'Y' ? 'Y' : 'N'; $info['use_ssl'] = $db_info->use_ssl; $info['phpext'] = ''; foreach (get_loaded_extensions() as $ext) { $ext = strtolower($ext); if (in_array($ext, $skip['ext'])) { continue; } $info['phpext'] .= '|' . $ext; } $info['phpext'] = substr($info['phpext'], 1); $info['module'] = ''; $oModuleModel = getModel('module'); $module_list = $oModuleModel->getModuleList(); if ($module_list) { foreach ($module_list as $module) { if (in_array($module->module, $skip['module'])) { continue; } $info['module'] .= '|' . $module->module; } } $info['module'] = substr($info['module'], 1); $info['addon'] = ''; $oAddonAdminModel = getAdminModel('addon'); $addon_list = $oAddonAdminModel->getAddonList(); if ($addon_list) { foreach ($addon_list as $addon) { if (in_array($addon->addon, $skip['addon'])) { continue; } $info['addon'] .= '|' . $addon->addon; } } $info['addon'] = substr($info['addon'], 1); $info['layout'] = ""; $oLayoutModel = getModel('layout'); $layout_list = $oLayoutModel->getDownloadedLayoutList(); if ($layout_list) { foreach ($layout_list as $layout) { if (in_array($layout->layout, $skip['layout'])) { continue; } $info['layout'] .= '|' . $layout->layout; } } $info['layout'] = substr($info['layout'], 1); $info['widget'] = ""; $oWidgetModel = getModel('widget'); $widget_list = $oWidgetModel->getDownloadedWidgetList(); if ($widget_list) { foreach ($widget_list as $widget) { if (in_array($widget->widget, $skip['widget'])) { continue; } $info['widget'] .= '|' . $widget->widget; } } $info['widget'] = substr($info['widget'], 1); $info['widgetstyle'] = ""; $oWidgetModel = getModel('widget'); $widgetstyle_list = $oWidgetModel->getDownloadedWidgetStyleList(); if ($widgetstyle_list) { foreach ($widgetstyle_list as $widgetstyle) { if (in_array($widgetstyle->widgetStyle, $skip['widgetstyle'])) { continue; } $info['widgetstyle'] .= '|' . $widgetstyle->widgetStyle; } } $info['widgetstyle'] = substr($info['widgetstyle'], 1); $param = ''; foreach ($info as $k => $v) { if ($v) { $param .= sprintf('&%s=%s', $k, urlencode($v)); } } $param = substr($param, 1); return $param; }
function getUrlContent($url, $postvars = false, $gethdr = false) { $url = getFullUrl($url); global $ch, $need_log_requests, $scrape_options; if (!$ch) { $ch = curl_init($url); } else { curl_setopt($ch, CURLOPT_URL, $url); } global $last_http_code; global $last_http_headers; $last_http_headers = array(); if ($scrape_options["debug"]) { echo '>>> getting url ' . $url . ($postvars ? " with postvars=" . json_encode($postvars) : ""); } if ($postvars) { curl_setopt($ch, CURLOPT_POST, count($postvars)); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postvars)); } if ($gethdr) { curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_HEADERFUNCTION, 'readHeader'); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Expect:")); } else { curl_setopt($ch, CURLOPT_HEADERFUNCTION, 'readHeaderBulk'); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Expect:")); } $header[0] = "Accept: text/xml,application/xml,application/xhtml+xml,application/a-gzip,"; $header[0] .= "text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"; $header[] = "Cache-Control: max-age=0"; $header[] = "Connection: keep-alive"; $header[] = "Keep-Alive: 300"; $header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7"; $header[] = "Accept-Language: en-us,en;q=0.5"; $header[] = "Pragma: "; // browsers keep this blank. curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.220 Safari/535.1'); curl_setopt($ch, CURLOPT_HTTPHEADER, $header); curl_setopt($ch, CURLOPT_REFERER, 'https://itunesconnect.apple.com'); curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate'); curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); global $cookiefile; curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiefile); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiefile); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); $cont = curl_exec($ch); $last_http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($cont && $last_http_code == 200) { if ($scrape_options["debug"]) { echo " url got\n"; } $last_http_headers = array_merge($last_http_headers, curl_getinfo($ch)); } else { if ($scrape_options["debug"]) { echo " url failed. http_status={$last_http_code}\n"; } $cont = false; } return $cont; }
function procGgmailingXeSend($obj) { $oModuleModel = getModel('module'); $config = $oModuleModel->getModuleConfig('ggmailing'); // XE 코어 연동 사용 여부 체크 if (!$config->type_xe_send || $config->type_xe_send == 'F') { return false; } $obj->is_sendok = 'N'; $args->ggmailing_module_srl = $obj->module_srl; $dmn = getFullUrl(''); $dmn = parse_url($dmn); $domain = substr($dmn['host'] . $dmn['path'], 0, -1); $domain = str_replace('www.', '', $domain); $ggmailing_serv_url = $config->ggmailing_serv_url; if ($config->ggmailing_ssl == 'N' || !$config->ggmailing_ssl) { $ggmailing_ssl = 'http://'; $ggmailing_ssl_port = ''; } elseif ($config->ggmailing_ssl == 'Y') { $ggmailing_ssl = 'https://'; $ggmailing_ssl_port = ':' . $config->ggmailing_ssl_port; } $url = $ggmailing_ssl . $ggmailing_serv_url . $ggmailing_ssl_port . '/index.php'; $post_data = array('act' => 'dispWwapimanagerRequest', 'authkey' => $config->ggmailing_authkey, 'mid' => 'auth_woorimail', 'domain' => $domain, 'type' => 'ggmailing'); // 비동기 $curl = $this->curl_request_async($url, $post_data, $type = 'POST', $output = 'json'); $authcheck = json_decode($curl); $obj->sender_nickname = $config->type_xe_send_nick ? $config->type_xe_send_nick : $domain; $obj->sender_email = '*****@*****.**'; $obj->document_srl = getNextSequence(); //$obj->title = ''; //$obj->content = ''; //수신거부 제외 $ggoutput = executeQueryArray('ggmailing.getDonotsend', $obj); if (!$ggoutput->data) { // 받는닉네임 세팅 $obj->receive_nickname = str_replace(',', '', $obj->ggmailing_nickname ? $obj->ggmailing_nickname : 'NoName') . ','; // 받는이메일 세팅 $obj->receive_email = str_replace(',', '', $obj->ggmailing_email) . ','; // 회원등록일 세팅 $obj->receive_member_regdate = str_replace(',', '', $obj->ggmailing_member_regdate) . ','; } //endif if ($authcheck->ggauth_check == 'OK') { $is_Amount = $authcheck->event_point + $authcheck->free_point + $authcheck->etc_point + $authcheck->pay_point; if ($is_Amount >= 1) { if ($obj->receive_nickname != '' && $obj->receive_email != '') { $output = executeQuery('ggmailing.insertGgmailingAdminSend', $obj); } $this->procGgmailingSendOK('N'); } } }