issue 2662 poll, rss

git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12257 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ovclas 2012-11-20 01:25:09 +00:00
parent 580222822a
commit ca9a828954
12 changed files with 1536 additions and 1408 deletions

View file

@ -1,159 +1,171 @@
<?php <?php
/** /**
* @class pollAdminController * @class pollAdminController
* @author NHN (developers@xpressengine.com) * @author NHN (developers@xpressengine.com)
* @brief The admin controller class of the poll module * @brief The admin controller class of the poll module
**/ */
class pollAdminController extends poll
{
/**
* @brief Initialization
*/
function init()
{
}
class pollAdminController extends poll { /**
* @brief Save the configurations
*/
function procPollAdminInsertConfig()
{
$config->skin = Context::get('skin');
$config->colorset = Context::get('colorset');
/** $oModuleController = &getController('module');
* @brief Initialization $oModuleController->insertModuleConfig('poll', $config);
**/
function init() {
}
/** $this->setMessage('success_updated');
* @brief Save the configurations
**/
function procPollAdminInsertConfig() {
$config->skin = Context::get('skin');
$config->colorset = Context::get('colorset');
$oModuleController = &getController('module'); $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispPollAdminConfig');
$oModuleController->insertModuleConfig('poll', $config); $this->setRedirectUrl($returnUrl);
}
$this->setMessage('success_updated'); /**
* @brief Delete the polls selected in the administrator's page
*/
function procPollAdminDeleteChecked()
{
// Display an error no post is selected
$cart = Context::get('cart');
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispPollAdminConfig'); if(is_array($cart)) $poll_srl_list = $cart;
$this->setRedirectUrl($returnUrl); else $poll_srl_list= explode('|@|', $cart);
}
/** $poll_count = count($poll_srl_list);
* @brief Delete the polls selected in the administrator's page if(!$poll_count) return $this->stop('msg_cart_is_null');
**/ // Delete the post
function procPollAdminDeleteChecked() { for($i=0;$i<$poll_count;$i++)
// 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);
}
function procPollAdminAddCart()
{ {
$poll_index_srl = (int)Context::get('poll_index_srl'); $poll_index_srl = trim($poll_srl_list[$i]);
if(!$poll_index_srl) continue;
$oPollAdminModel = &getAdminModel('poll'); $output = $this->deletePollTitle($poll_index_srl, true);
//$columnList = array('comment_srl'); if(!$output->toBool()) return $output;
$args->pollIndexSrlList = array($poll_index_srl);
$args->list_count = 100;
$output = $oPollAdminModel->getPollList($args);
if(is_array($output->data))
{
foreach($output->data AS $key=>$value)
{
if($_SESSION['poll_management'][$value->poll_index_srl]) unset($_SESSION['poll_management'][$value->poll_index_srl]);
else $_SESSION['poll_management'][$value->poll_index_srl] = true;
}
}
} }
/** $this->setMessage( sprintf(Context::getLang('msg_checked_poll_is_deleted'), $poll_count) );
* @brief Delete the poll (when several questions are registered in one poll, delete this question)
**/ $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispPollAdminList');
function deletePollTitle($poll_index_srl) $this->setRedirectUrl($returnUrl);
}
function procPollAdminAddCart()
{
$poll_index_srl = (int)Context::get('poll_index_srl');
$oPollAdminModel = &getAdminModel('poll');
//$columnList = array('comment_srl');
$args->pollIndexSrlList = array($poll_index_srl);
$args->list_count = 100;
$output = $oPollAdminModel->getPollList($args);
if(is_array($output->data))
{ {
$args->poll_index_srl = $poll_index_srl; foreach($output->data AS $key=>$value)
$oDB = &DB::getInstance();
$oDB->begin();
$output = executeQueryArray('poll.getPollByDeletePollTitle', $args);
if($output->toBool() && $output->data && $output->data[0]->count == 1)
{ {
$dargs->poll_srl = $output->data[0]->poll_srl; if($_SESSION['poll_management'][$value->poll_index_srl]) unset($_SESSION['poll_management'][$value->poll_index_srl]);
else $_SESSION['poll_management'][$value->poll_index_srl] = true;
}
}
}
/**
* @brief Delete the poll (when several questions are registered in one poll, delete this question)
*/
function deletePollTitle($poll_index_srl)
{
$args->poll_index_srl = $poll_index_srl;
$oDB = &DB::getInstance();
$oDB->begin();
$output = executeQueryArray('poll.getPollByDeletePollTitle', $args);
if($output->toBool() && $output->data && $output->data[0]->count == 1)
{
$dargs->poll_srl = $output->data[0]->poll_srl;
}
$output = $oDB->executeQuery('poll.deletePollTitle', $args);
if(!$output)
{
$oDB->rollback();
return $output;
}
$output = $oDB->executeQuery('poll.deletePollItem', $args);
if(!$output)
{
$oDB->rollback();
return $output;
}
if($dargs->poll_srl)
{
$output = executeQuery('poll.deletePoll', $dargs);
if(!$output)
{
$oDB->rollback();
return $output;
} }
$output = $oDB->executeQuery('poll.deletePollTitle', $args); $output = executeQuery('poll.deletePollLog', $dargs);
if(!$output) { if(!$output)
$oDB->rollback();
return $output;
}
$output = $oDB->executeQuery('poll.deletePollItem', $args);
if(!$output) {
$oDB->rollback();
return $output;
}
if($dargs->poll_srl)
{ {
$output = executeQuery('poll.deletePoll', $dargs); $oDB->rollback();
if(!$output) { return $output;
$oDB->rollback();
return $output;
}
$output = executeQuery('poll.deletePollLog', $dargs);
if(!$output) {
$oDB->rollback();
return $output;
}
} }
$oDB->commit(); }
$oDB->commit();
return new Object(); return new Object();
} }
/** /**
* @brief Delete the poll (delete the entire poll) * @brief Delete the poll (delete the entire poll)
**/ */
function deletePoll($poll_srl) { function deletePoll($poll_srl)
$args->poll_srl = $poll_srl; {
$args->poll_srl = $poll_srl;
$oDB = &DB::getInstance(); $oDB = &DB::getInstance();
$oDB->begin(); $oDB->begin();
$output = $oDB->executeQuery('poll.deletePoll', $args); $output = $oDB->executeQuery('poll.deletePoll', $args);
if(!$output) { if(!$output)
$oDB->rollback(); {
return $output; $oDB->rollback();
} return $output;
}
$output = $oDB->executeQuery('poll.deletePollTitle', $args); $output = $oDB->executeQuery('poll.deletePollTitle', $args);
if(!$output) { if(!$output)
$oDB->rollback(); {
return $output; $oDB->rollback();
} return $output;
}
$output = $oDB->executeQuery('poll.deletePollItem', $args); $output = $oDB->executeQuery('poll.deletePollItem', $args);
if(!$output) { if(!$output)
$oDB->rollback(); {
return $output; $oDB->rollback();
} return $output;
}
$oDB->commit(); $oDB->commit();
return new Object(); return new Object();
} }
} }
?> /* End of file poll.admin.controller.php */
/* Location: ./modules/poll/poll.admin.controller.php */

View file

@ -1,61 +1,67 @@
<?php <?php
/** /**
* @class pollAdminModel * @class pollAdminModel
* @author NHN (developers@xpressengine.com) * @author NHN (developers@xpressengine.com)
* @brief The admin model class of the poll module * @brief The admin model class of the poll module
**/ */
class pollAdminModel extends poll
{
/**
* @brief Initialization
*/
function init()
{
}
class pollAdminModel extends poll { /**
* @brief Get the list of polls
*/
function getPollList($args)
{
$output = executeQueryArray('poll.getPollList', $args);
if(!$output->toBool()) return $output;
/** //if($output->data && !is_array($output->data)) $output->data = array($output->data);
* @brief Initialization return $output;
**/ }
function init() {
}
/** /**
* @brief Get the list of polls * @brief Get the list of polls with member info
**/ */
function getPollList($args) { function getPollListWithMember($args)
$output = executeQueryArray('poll.getPollList', $args); {
if(!$output->toBool()) return $output; $output = executeQueryArray('poll.getPollListWithMember', $args);
if(!$output->toBool()) return $output;
//if($output->data && !is_array($output->data)) $output->data = array($output->data); return $output;
return $output; }
}
/** /**
* @brief Get the list of polls with member info * @brief Get the original poll
**/ */
function getPollListWithMember($args) function getPollAdminTarget()
{
$poll_srl = Context::get('poll_srl');
$upload_target_srl = Context::get('upload_target_srl');
$oDocumentModel = &getModel('document');
$oCommentModel = &getModel('comment');
$oDocument = $oDocumentModel->getDocument($upload_target_srl);
if(!$oDocument->isExists()) $oComment = $oCommentModel->getComment($upload_target_srl);
if($oComment && $oComment->isExists())
{ {
$output = executeQueryArray('poll.getPollListWithMember', $args); $this->add('document_srl', $oComment->get('document_srl'));
if(!$output->toBool()) return $output; $this->add('comment_srl', $oComment->get('comment_srl'));
return $output;
} }
elseif($oDocument->isExists())
/** {
* @brief Get the original poll $this->add('document_srl', $oDocument->get('document_srl'));
**/ }
function getPollAdminTarget() { else return new Object(-1, 'msg_not_founded');
$poll_srl = Context::get('poll_srl'); }
$upload_target_srl = Context::get('upload_target_srl'); }
/* End of file poll.admin.model.php */
$oDocumentModel = &getModel('document'); /* Location: ./modules/poll/poll.admin.model.php */
$oCommentModel = &getModel('comment');
$oDocument = $oDocumentModel->getDocument($upload_target_srl);
if(!$oDocument->isExists()) $oComment = $oCommentModel->getComment($upload_target_srl);
if($oComment && $oComment->isExists()) {
$this->add('document_srl', $oComment->get('document_srl'));
$this->add('comment_srl', $oComment->get('comment_srl'));
} elseif($oDocument->isExists()) {
$this->add('document_srl', $oDocument->get('document_srl'));
} else return new Object(-1, 'msg_not_founded');
}
}
?>

View file

@ -1,160 +1,167 @@
<?php <?php
/** /**
* @class pollAdminView * @class pollAdminView
* @author NHN (developers@xpressengine.com) * @author NHN (developers@xpressengine.com)
* @brief The admin view class of the poll module * @brief The admin view class of the poll module
**/ */
class pollAdminView extends poll
{
/**
* @brief Initialization
*/
function init()
{
}
class pollAdminView extends poll { /**
* @brief Administrator's Page
*/
function dispPollAdminList()
{
// Arrange the search options
$search_target = trim(Context::get('search_target'));
$search_keyword = trim(Context::get('search_keyword'));
/** if($search_target && $search_keyword)
* @brief Initialization {
**/ switch($search_target)
function init() {
}
/**
* @brief Administrator's Page
**/
function dispPollAdminList() {
// Arrange the search options
$search_target = trim(Context::get('search_target'));
$search_keyword = trim(Context::get('search_keyword'));
if($search_target && $search_keyword) {
switch($search_target) {
case 'title' :
if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
$args->s_title= $search_keyword;
break;
case 'regdate' :
$args->s_regdate = $search_keyword;
break;
case 'ipaddress' :
$args->s_ipaddress= $search_keyword;
break;
}
}
// Options to get a list of pages
$args->page = Context::get('page');
$args->list_count = 50; // The number of posts to show on one page
$args->page_count = 10; // The number of pages to display in the page navigation
$args->sort_index = 'P.list_order'; // Sorting value
// Get the list
$oPollAdminModel = &getAdminModel('poll');
$output = $oPollAdminModel->getPollListWithMember($args);
// check poll type. document or comment
if(is_array($output->data))
{ {
$uploadTargetSrlList = array(); case 'title' :
foreach($output->data AS $key=>$value) if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
{ $args->s_title= $search_keyword;
array_push($uploadTargetSrlList, $value->upload_target_srl); break;
} case 'regdate' :
$args->s_regdate = $search_keyword;
break;
case 'ipaddress' :
$args->s_ipaddress= $search_keyword;
break;
}
}
// Options to get a list of pages
$args->page = Context::get('page');
$args->list_count = 50; // The number of posts to show on one page
$args->page_count = 10; // The number of pages to display in the page navigation
$oDocumentModel = &getModel('document'); $args->sort_index = 'P.list_order'; // Sorting value
$targetDocumentOutput = $oDocumentModel->getDocuments($uploadTargetSrlList);
if(!is_array($targetDocumentOutput)) $targetDocumentOutput = array();
$oCommentModel = &getModel('comment'); // Get the list
$columnList = array('comment_srl', 'document_srl'); $oPollAdminModel = &getAdminModel('poll');
$targetCommentOutput = $oCommentModel->getComments($uploadTargetSrlList, $columnList); $output = $oPollAdminModel->getPollListWithMember($args);
if(!is_array($targetCommentOutput)) $targetCommentOutput = array();
foreach($output->data AS $key=>$value) // check poll type. document or comment
{ if(is_array($output->data))
if(array_key_exists($value->upload_target_srl, $targetDocumentOutput)) {
$value->document_srl = $value->upload_target_srl; $uploadTargetSrlList = array();
foreach($output->data AS $key=>$value)
if(array_key_exists($value->upload_target_srl, $targetCommentOutput)) {
{ array_push($uploadTargetSrlList, $value->upload_target_srl);
$value->comment_srl = $value->upload_target_srl;
$value->document_srl = $targetCommentOutput[$value->comment_srl]->document_srl;
}
}
} }
// Configure the template variables $oDocumentModel = &getModel('document');
Context::set('total_count', $output->total_count); $targetDocumentOutput = $oDocumentModel->getDocuments($uploadTargetSrlList);
Context::set('total_page', $output->total_page); if(!is_array($targetDocumentOutput)) $targetDocumentOutput = array();
Context::set('page', $output->page);
Context::set('poll_list', $output->data);
Context::set('page_navigation', $output->page_navigation);
Context::set('module_list', $module_list);
$security = new Security();
$security->encodeHTML('poll_list..title');
// Set a template
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('poll_list');
}
/** $oCommentModel = &getModel('comment');
* @brief Confgure the poll skin and colorset $columnList = array('comment_srl', 'document_srl');
**/ $targetCommentOutput = $oCommentModel->getComments($uploadTargetSrlList, $columnList);
function dispPollAdminConfig() { if(!is_array($targetCommentOutput)) $targetCommentOutput = array();
$oModuleModel = &getModel('module');
// Get the configuration information
$config = $oModuleModel->getModuleConfig('poll');
Context::set('config', $config);
// Get the skin information
$skin_list = $oModuleModel->getSkins($this->module_path);
Context::set('skin_list', $skin_list);
if(!$skin_list[$config->skin]) $config->skin = "default"; foreach($output->data AS $key=>$value)
// Set the skin colorset once the configurations is completed {
Context::set('colorset_list', $skin_list[$config->skin]->colorset); if(array_key_exists($value->upload_target_srl, $targetDocumentOutput))
$value->document_srl = $value->upload_target_srl;
$security = new Security();
$security->encodeHTML('config..');
$security->encodeHTML('skin_list..title');
$security->encodeHTML('colorset_list..name','colorset_list..title');
// Set a template
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('config');
}
/** if(array_key_exists($value->upload_target_srl, $targetCommentOutput))
* @brief Poll Results {
**/ $value->comment_srl = $value->upload_target_srl;
function dispPollAdminResult() { $value->document_srl = $targetCommentOutput[$value->comment_srl]->document_srl;
// Popup layout }
$this->setLayoutFile("popup_layout"); }
// Draw results }
$args->poll_srl = Context::get('poll_srl');
$args->poll_index_srl = Context::get('poll_index_srl');
$output = executeQuery('poll.getPoll', $args); // Configure the template variables
if(!$output->data) return $this->stop('msg_poll_not_exists'); Context::set('total_count', $output->total_count);
$poll->stop_date = $output->data->stop_date; Context::set('total_page', $output->total_page);
$poll->poll_count = $output->data->poll_count; Context::set('page', $output->page);
Context::set('poll_list', $output->data);
Context::set('page_navigation', $output->page_navigation);
Context::set('module_list', $module_list);
$output = executeQuery('poll.getPollTitle', $args); $security = new Security();
if(!$output->data) return $this->stop('msg_poll_not_exists'); $security->encodeHTML('poll_list..title');
// Set a template
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('poll_list');
}
$poll->poll[$args->poll_index_srl]->title = $output->data->title; /**
$poll->poll[$args->poll_index_srl]->checkcount = $output->data->checkcount; * @brief Confgure the poll skin and colorset
$poll->poll[$args->poll_index_srl]->poll_count = $output->data->poll_count; */
function dispPollAdminConfig()
{
$oModuleModel = &getModel('module');
// Get the configuration information
$config = $oModuleModel->getModuleConfig('poll');
Context::set('config', $config);
// Get the skin information
$skin_list = $oModuleModel->getSkins($this->module_path);
Context::set('skin_list', $skin_list);
$output = executeQuery('poll.getPollItem', $args); if(!$skin_list[$config->skin]) $config->skin = "default";
foreach($output->data as $key => $val) { // Set the skin colorset once the configurations is completed
$poll->poll[$val->poll_index_srl]->item[] = $val; Context::set('colorset_list', $skin_list[$config->skin]->colorset);
}
$poll->poll_srl = $poll_srl; $security = new Security();
$security->encodeHTML('config..');
$security->encodeHTML('skin_list..title');
$security->encodeHTML('colorset_list..name','colorset_list..title');
Context::set('poll',$poll); // Set a template
// Configure the skin and the colorset for the default configuration $this->setTemplatePath($this->module_path.'tpl');
$oModuleModel = &getModel('module'); $this->setTemplateFile('config');
$poll_config = $oModuleModel->getModuleConfig('poll'); }
Context::set('poll_config', $poll_config);
$this->setTemplatePath($this->module_path.'tpl'); /**
$this->setTemplateFile('result'); * @brief Poll Results
} */
} function dispPollAdminResult()
?> {
// Popup layout
$this->setLayoutFile("popup_layout");
// Draw results
$args->poll_srl = Context::get('poll_srl');
$args->poll_index_srl = Context::get('poll_index_srl');
$output = executeQuery('poll.getPoll', $args);
if(!$output->data) return $this->stop('msg_poll_not_exists');
$poll->stop_date = $output->data->stop_date;
$poll->poll_count = $output->data->poll_count;
$output = executeQuery('poll.getPollTitle', $args);
if(!$output->data) return $this->stop('msg_poll_not_exists');
$poll->poll[$args->poll_index_srl]->title = $output->data->title;
$poll->poll[$args->poll_index_srl]->checkcount = $output->data->checkcount;
$poll->poll[$args->poll_index_srl]->poll_count = $output->data->poll_count;
$output = executeQuery('poll.getPollItem', $args);
foreach($output->data as $key => $val)
{
$poll->poll[$val->poll_index_srl]->item[] = $val;
}
$poll->poll_srl = $poll_srl;
Context::set('poll',$poll);
// Configure the skin and the colorset for the default configuration
$oModuleModel = &getModel('module');
$poll_config = $oModuleModel->getModuleConfig('poll');
Context::set('poll_config', $poll_config);
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('result');
}
}
/* End of file poll.admin.view.php */
/* Location: ./modules/poll/poll.admin.view.php */

View file

@ -1,78 +1,82 @@
<?php <?php
/** /**
* @class poll * @class poll
* @author NHN (developers@xpressengine.com) * @author NHN (developers@xpressengine.com)
* @brief The parent class of the poll module * @brief The parent class of the poll module
**/ */
class poll extends ModuleObject
{
/**
* @brief Additional tasks required to accomplish during the installation
*/
function moduleInstall()
{
// Register in the action forward (to use in administrator mode)
$oModuleController = &getController('module');
// Set the default skin
$oModuleController = &getController('module');
$config->skin = 'default';
$config->colorset = 'normal';
$oModuleController->insertModuleConfig('poll', $config);
// 2007.10.17 When deleting posts/comments delete the poll as well
$oModuleController->insertTrigger('document.insertDocument', 'poll', 'controller', 'triggerInsertDocumentPoll', 'after');
$oModuleController->insertTrigger('comment.insertComment', 'poll', 'controller', 'triggerInsertCommentPoll', 'after');
$oModuleController->insertTrigger('document.updateDocument', 'poll', 'controller', 'triggerUpdateDocumentPoll', 'after');
$oModuleController->insertTrigger('comment.updateComment', 'poll', 'controller', 'triggerUpdateCommentPoll', 'after');
$oModuleController->insertTrigger('document.deleteDocument', 'poll', 'controller', 'triggerDeleteDocumentPoll', 'after');
$oModuleController->insertTrigger('comment.deleteComment', 'poll', 'controller', 'triggerDeleteCommentPoll', 'after');
class poll extends ModuleObject { return new Object();
}
/** /**
* @brief Additional tasks required to accomplish during the installation * @brief A method to check if the installation has been successful
**/ */
function moduleInstall() { function checkUpdate()
// Register in the action forward (to use in administrator mode) {
$oModuleController = &getController('module'); $oModuleModel = &getModel('module');
// Set the default skin // 2007.10.17 When deleting posts/comments delete the poll as well
$oModuleController = &getController('module'); if(!$oModuleModel->getTrigger('document.insertDocument', 'poll', 'controller', 'triggerInsertDocumentPoll', 'after')) return true;
$config->skin = 'default'; if(!$oModuleModel->getTrigger('comment.insertComment', 'poll', 'controller', 'triggerInsertCommentPoll', 'after')) return true;
$config->colorset = 'normal'; if(!$oModuleModel->getTrigger('document.updateDocument', 'poll', 'controller', 'triggerUpdateDocumentPoll', 'after')) return true;
$oModuleController->insertModuleConfig('poll', $config); if(!$oModuleModel->getTrigger('comment.updateComment', 'poll', 'controller', 'triggerUpdateCommentPoll', 'after')) return true;
// 2007.10.17 When deleting posts/comments delete the poll as well if(!$oModuleModel->getTrigger('document.deleteDocument', 'poll', 'controller', 'triggerDeleteDocumentPoll', 'after')) return true;
$oModuleController->insertTrigger('document.insertDocument', 'poll', 'controller', 'triggerInsertDocumentPoll', 'after'); if(!$oModuleModel->getTrigger('comment.deleteComment', 'poll', 'controller', 'triggerDeleteCommentPoll', 'after')) return true;
$oModuleController->insertTrigger('comment.insertComment', 'poll', 'controller', 'triggerInsertCommentPoll', 'after');
$oModuleController->insertTrigger('document.updateDocument', 'poll', 'controller', 'triggerUpdateDocumentPoll', 'after');
$oModuleController->insertTrigger('comment.updateComment', 'poll', 'controller', 'triggerUpdateCommentPoll', 'after');
$oModuleController->insertTrigger('document.deleteDocument', 'poll', 'controller', 'triggerDeleteDocumentPoll', 'after');
$oModuleController->insertTrigger('comment.deleteComment', 'poll', 'controller', 'triggerDeleteCommentPoll', 'after');
return new Object(); return false;
} }
/** /**
* @brief A method to check if the installation has been successful * @brief Execute update
**/ */
function checkUpdate() { function moduleUpdate()
$oModuleModel = &getModel('module'); {
// 2007.10.17 When deleting posts/comments delete the poll as well $oModuleModel = &getModel('module');
if(!$oModuleModel->getTrigger('document.insertDocument', 'poll', 'controller', 'triggerInsertDocumentPoll', 'after')) return true; $oModuleController = &getController('module');
if(!$oModuleModel->getTrigger('comment.insertComment', 'poll', 'controller', 'triggerInsertCommentPoll', 'after')) return true; // 2007.10.17 When deleting posts/comments delete the poll as well
if(!$oModuleModel->getTrigger('document.updateDocument', 'poll', 'controller', 'triggerUpdateDocumentPoll', 'after')) return true; if(!$oModuleModel->getTrigger('document.deleteDocument', 'poll', 'controller', 'triggerDeleteDocumentPoll', 'after'))
if(!$oModuleModel->getTrigger('comment.updateComment', 'poll', 'controller', 'triggerUpdateCommentPoll', 'after')) return true; $oModuleController->insertTrigger('document.deleteDocument', 'poll', 'controller', 'triggerDeleteDocumentPoll', 'after');
if(!$oModuleModel->getTrigger('document.deleteDocument', 'poll', 'controller', 'triggerDeleteDocumentPoll', 'after')) return true; if(!$oModuleModel->getTrigger('comment.deleteComment', 'poll', 'controller', 'triggerDeleteCommentPoll', 'after'))
if(!$oModuleModel->getTrigger('comment.deleteComment', 'poll', 'controller', 'triggerDeleteCommentPoll', 'after')) return true; $oModuleController->insertTrigger('comment.deleteComment', 'poll', 'controller', 'triggerDeleteCommentPoll', 'after');
// 2008.04.22 A poll connection to add posts/comments
if(!$oModuleModel->getTrigger('document.insertDocument', 'poll', 'controller', 'triggerInsertDocumentPoll', 'after'))
$oModuleController->insertTrigger('document.insertDocument', 'poll', 'controller', 'triggerInsertDocumentPoll', 'after');
if(!$oModuleModel->getTrigger('comment.insertComment', 'poll', 'controller', 'triggerInsertCommentPoll', 'after'))
$oModuleController->insertTrigger('comment.insertComment', 'poll', 'controller', 'triggerInsertCommentPoll', 'after');
if(!$oModuleModel->getTrigger('document.updateDocument', 'poll', 'controller', 'triggerUpdateDocumentPoll', 'after'))
$oModuleController->insertTrigger('document.updateDocument', 'poll', 'controller', 'triggerUpdateDocumentPoll', 'after');
if(!$oModuleModel->getTrigger('comment.updateComment', 'poll', 'controller', 'triggerUpdateCommentPoll', 'after'))
$oModuleController->insertTrigger('comment.updateComment', 'poll', 'controller', 'triggerUpdateCommentPoll', 'after');
return false; return new Object(0, 'success_updated');
} }
/** /**
* @brief Execute update * @brief Re-generate the cache file
**/ */
function moduleUpdate() { function recompileCache()
$oModuleModel = &getModel('module'); {
$oModuleController = &getController('module'); }
// 2007.10.17 When deleting posts/comments delete the poll as well }
if(!$oModuleModel->getTrigger('document.deleteDocument', 'poll', 'controller', 'triggerDeleteDocumentPoll', 'after')) /* End of file poll.class.php */
$oModuleController->insertTrigger('document.deleteDocument', 'poll', 'controller', 'triggerDeleteDocumentPoll', 'after'); /* Location: ./modules/poll/poll.class.php */
if(!$oModuleModel->getTrigger('comment.deleteComment', 'poll', 'controller', 'triggerDeleteCommentPoll', 'after'))
$oModuleController->insertTrigger('comment.deleteComment', 'poll', 'controller', 'triggerDeleteCommentPoll', 'after');
// 2008.04.22 A poll connection to add posts/comments
if(!$oModuleModel->getTrigger('document.insertDocument', 'poll', 'controller', 'triggerInsertDocumentPoll', 'after'))
$oModuleController->insertTrigger('document.insertDocument', 'poll', 'controller', 'triggerInsertDocumentPoll', 'after');
if(!$oModuleModel->getTrigger('comment.insertComment', 'poll', 'controller', 'triggerInsertCommentPoll', 'after'))
$oModuleController->insertTrigger('comment.insertComment', 'poll', 'controller', 'triggerInsertCommentPoll', 'after');
if(!$oModuleModel->getTrigger('document.updateDocument', 'poll', 'controller', 'triggerUpdateDocumentPoll', 'after'))
$oModuleController->insertTrigger('document.updateDocument', 'poll', 'controller', 'triggerUpdateDocumentPoll', 'after');
if(!$oModuleModel->getTrigger('comment.updateComment', 'poll', 'controller', 'triggerUpdateCommentPoll', 'after'))
$oModuleController->insertTrigger('comment.updateComment', 'poll', 'controller', 'triggerUpdateCommentPoll', 'after');
return new Object(0, 'success_updated');
}
/**
* @brief Re-generate the cache file
**/
function recompileCache() {
}
}
?>

View file

@ -1,342 +1,367 @@
<?php <?php
/** /**
* @class pollController * @class pollController
* @author NHN (developers@xpressengine.com) * @author NHN (developers@xpressengine.com)
* @brief Controller class for poll module * @brief Controller class for poll module
**/ */
class pollController extends poll
{
/**
* @brief Initialization
*/
function init()
{
}
class pollController extends poll { /**
* @brief after a qeustion is created in the popup window, register the question during the save time
*/
function procInsert()
{
$stop_date = Context::get('stop_date');
if($stop_date < date("Ymd")) $stop_date = date("YmdHis", time()+60*60*24*365);
/** $vars = Context::getRequestVars();
* @brief Initialization foreach($vars as $key => $val)
**/
function init() {
}
/**
* @brief after a qeustion is created in the popup window, register the question during the save time
**/
function procInsert() {
$stop_date = Context::get('stop_date');
if($stop_date < date("Ymd")) $stop_date = date("YmdHis", time()+60*60*24*365);
$vars = Context::getRequestVars();
foreach($vars as $key => $val) {
if(strpos($key,'tidx')) continue;
if(!preg_match("/^(title|checkcount|item)_/i", $key)) continue;
if(!trim($val)) continue;
$tmp_arr = explode('_',$key);
$poll_index = $tmp_arr[1];
if(Context::get('is_logged')) {
$logged_info = Context::get('logged_info');
// Remove the tag if the it is not the top administrator in the session
if($logged_info->is_admin != 'Y') $val = htmlspecialchars($val);
}
if($tmp_arr[0]=='title') $tmp_args[$poll_index]->title = $val;
else if($tmp_arr[0]=='checkcount') $tmp_args[$poll_index]->checkcount = $val;
else if($tmp_arr[0]=='item') $tmp_args[$poll_index]->item[] = $val;
}
foreach($tmp_args as $key => $val) {
if(!$val->checkcount) $val->checkcount = 1;
if($val->title && count($val->item)) $args->poll[] = $val;
}
if(!count($args->poll)) return new Object(-1, 'cmd_null_item');
$args->stop_date = $stop_date;
// Configure the variables
$poll_srl = getNextSequence();
$logged_info = Context::get('logged_info');
$member_srl = $logged_info->member_srl?$logged_info->member_srl:0;
$oDB = &DB::getInstance();
$oDB->begin();
// Register the poll
unset($poll_args);
$poll_args->poll_srl = $poll_srl;
$poll_args->member_srl = $member_srl;
$poll_args->list_order = $poll_srl*-1;
$poll_args->stop_date = $args->stop_date;
$poll_args->poll_count = 0;
$output = executeQuery('poll.insertPoll', $poll_args);
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// Individual poll registration
foreach($args->poll as $key => $val) {
unset($title_args);
$title_args->poll_srl = $poll_srl;
$title_args->poll_index_srl = getNextSequence();
$title_args->title = $val->title;
$title_args->checkcount = $val->checkcount;
$title_args->poll_count = 0;
$title_args->list_order = $title_args->poll_index_srl * -1;
$title_args->member_srl = $member_srl;
$title_args->upload_target_srl = $upload_target_srl;
$output = executeQuery('poll.insertPollTitle', $title_args);
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// Add the individual survey items
foreach($val->item as $k => $v) {
unset($item_args);
$item_args->poll_srl = $poll_srl;
$item_args->poll_index_srl = $title_args->poll_index_srl;
$item_args->title = $v;
$item_args->poll_count = 0;
$item_args->upload_target_srl = $upload_target_srl;
$output = executeQuery('poll.insertPollItem', $item_args);
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
}
}
$oDB->commit();
$this->add('poll_srl', $poll_srl);
$this->setMessage('success_registed');
}
/**
* @brief Accept the poll
**/
function procPoll() {
$poll_srl = Context::get('poll_srl');
$poll_srl_indexes = Context::get('poll_srl_indexes');
$tmp_item_srls = explode(',',$poll_srl_indexes);
for($i=0;$i<count($tmp_item_srls);$i++) {
$srl = (int)trim($tmp_item_srls[$i]);
if(!$srl) continue;
$item_srls[] = $srl;
}
// If there is no response item, display an error
if(!count($item_srls)) return new Object(-1, 'msg_check_poll_item');
// Make sure is the poll has already been taken
$oPollModel = &getModel('poll');
if($oPollModel->isPolled($poll_srl)) return new Object(-1, 'msg_already_poll');
$oDB = &DB::getInstance();
$oDB->begin();
$args->poll_srl = $poll_srl;
// Update all poll responses related to the post
$output = executeQuery('poll.updatePoll', $args);
$output = executeQuery('poll.updatePollTitle', $args);
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// Record each polls selected items
$args->poll_item_srl = implode(',',$item_srls);
$output = executeQuery('poll.updatePollItems', $args);
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// Log the respondent's information
$log_args->poll_srl = $poll_srl;
$logged_info = Context::get('logged_info');
$member_srl = $logged_info->member_srl?$logged_info->member_srl:0;
$log_args->member_srl = $member_srl;
$log_args->ipaddress = $_SERVER['REMOTE_ADDR'];
$output = executeQuery('poll.insertPollLog', $log_args);
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
$oDB->commit();
$skin = Context::get('skin');
if(!$skin || !is_dir('./modules/poll/skins/'.$skin)) $skin = 'default';
// Get tpl
$tpl = $oPollModel->getPollHtml($poll_srl, '', $skin);
$this->add('poll_srl', $poll_srl);
$this->add('tpl',$tpl);
$this->setMessage('success_poll');
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispPollAdminConfig');
$this->setRedirectUrl($returnUrl);
}
/**
* @brief Preview the results
**/
function procPollViewResult() {
$poll_srl = Context::get('poll_srl');
$skin = Context::get('skin');
if(!$skin || !is_dir('./modules/poll/skins/'.$skin)) $skin = 'default';
$oPollModel = &getModel('poll');
$tpl = $oPollModel->getPollResultHtml($poll_srl, $skin);
$this->add('poll_srl', $poll_srl);
$this->add('tpl',$tpl);
}
/**
* @brief poll list
**/
function procPollGetList()
{ {
if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted'); if(strpos($key,'tidx')) continue;
$pollSrls = Context::get('poll_srls'); if(!preg_match("/^(title|checkcount|item)_/i", $key)) continue;
if($pollSrls) $pollSrlList = explode(',', $pollSrls); if(!trim($val)) continue;
global $lang; $tmp_arr = explode('_',$key);
if(count($pollSrlList) > 0) {
$oPollAdminModel = &getAdminModel('poll');
$args->pollIndexSrlList = $pollSrlList;
$output = $oPollAdminModel->getPollListWithMember($args);
$pollList = $output->data;
if(is_array($pollList)) $poll_index = $tmp_arr[1];
if(Context::get('is_logged'))
{
$logged_info = Context::get('logged_info');
// Remove the tag if the it is not the top administrator in the session
if($logged_info->is_admin != 'Y') $val = htmlspecialchars($val);
}
if($tmp_arr[0]=='title') $tmp_args[$poll_index]->title = $val;
else if($tmp_arr[0]=='checkcount') $tmp_args[$poll_index]->checkcount = $val;
else if($tmp_arr[0]=='item') $tmp_args[$poll_index]->item[] = $val;
}
foreach($tmp_args as $key => $val)
{
if(!$val->checkcount) $val->checkcount = 1;
if($val->title && count($val->item)) $args->poll[] = $val;
}
if(!count($args->poll)) return new Object(-1, 'cmd_null_item');
$args->stop_date = $stop_date;
// Configure the variables
$poll_srl = getNextSequence();
$logged_info = Context::get('logged_info');
$member_srl = $logged_info->member_srl?$logged_info->member_srl:0;
$oDB = &DB::getInstance();
$oDB->begin();
// Register the poll
unset($poll_args);
$poll_args->poll_srl = $poll_srl;
$poll_args->member_srl = $member_srl;
$poll_args->list_order = $poll_srl*-1;
$poll_args->stop_date = $args->stop_date;
$poll_args->poll_count = 0;
$output = executeQuery('poll.insertPoll', $poll_args);
if(!$output->toBool())
{
$oDB->rollback();
return $output;
}
// Individual poll registration
foreach($args->poll as $key => $val)
{
unset($title_args);
$title_args->poll_srl = $poll_srl;
$title_args->poll_index_srl = getNextSequence();
$title_args->title = $val->title;
$title_args->checkcount = $val->checkcount;
$title_args->poll_count = 0;
$title_args->list_order = $title_args->poll_index_srl * -1;
$title_args->member_srl = $member_srl;
$title_args->upload_target_srl = $upload_target_srl;
$output = executeQuery('poll.insertPollTitle', $title_args);
if(!$output->toBool())
{
$oDB->rollback();
return $output;
}
// Add the individual survey items
foreach($val->item as $k => $v)
{
unset($item_args);
$item_args->poll_srl = $poll_srl;
$item_args->poll_index_srl = $title_args->poll_index_srl;
$item_args->title = $v;
$item_args->poll_count = 0;
$item_args->upload_target_srl = $upload_target_srl;
$output = executeQuery('poll.insertPollItem', $item_args);
if(!$output->toBool())
{ {
foreach($pollList AS $key=>$value) $oDB->rollback();
{ return $output;
if($value->checkcount == 1) $value->checkName = $lang->single_check;
else $value->checkName = $lang->multi_check;
}
} }
} }
else }
$oDB->commit();
$this->add('poll_srl', $poll_srl);
$this->setMessage('success_registed');
}
/**
* @brief Accept the poll
*/
function procPoll()
{
$poll_srl = Context::get('poll_srl');
$poll_srl_indexes = Context::get('poll_srl_indexes');
$tmp_item_srls = explode(',',$poll_srl_indexes);
for($i=0;$i<count($tmp_item_srls);$i++)
{
$srl = (int)trim($tmp_item_srls[$i]);
if(!$srl) continue;
$item_srls[] = $srl;
}
// If there is no response item, display an error
if(!count($item_srls)) return new Object(-1, 'msg_check_poll_item');
// Make sure is the poll has already been taken
$oPollModel = &getModel('poll');
if($oPollModel->isPolled($poll_srl)) return new Object(-1, 'msg_already_poll');
$oDB = &DB::getInstance();
$oDB->begin();
$args->poll_srl = $poll_srl;
// Update all poll responses related to the post
$output = executeQuery('poll.updatePoll', $args);
$output = executeQuery('poll.updatePollTitle', $args);
if(!$output->toBool())
{
$oDB->rollback();
return $output;
}
// Record each polls selected items
$args->poll_item_srl = implode(',',$item_srls);
$output = executeQuery('poll.updatePollItems', $args);
if(!$output->toBool())
{
$oDB->rollback();
return $output;
}
// Log the respondent's information
$log_args->poll_srl = $poll_srl;
$logged_info = Context::get('logged_info');
$member_srl = $logged_info->member_srl?$logged_info->member_srl:0;
$log_args->member_srl = $member_srl;
$log_args->ipaddress = $_SERVER['REMOTE_ADDR'];
$output = executeQuery('poll.insertPollLog', $log_args);
if(!$output->toBool())
{
$oDB->rollback();
return $output;
}
$oDB->commit();
$skin = Context::get('skin');
if(!$skin || !is_dir('./modules/poll/skins/'.$skin)) $skin = 'default';
// Get tpl
$tpl = $oPollModel->getPollHtml($poll_srl, '', $skin);
$this->add('poll_srl', $poll_srl);
$this->add('tpl',$tpl);
$this->setMessage('success_poll');
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispPollAdminConfig');
$this->setRedirectUrl($returnUrl);
}
/**
* @brief Preview the results
*/
function procPollViewResult()
{
$poll_srl = Context::get('poll_srl');
$skin = Context::get('skin');
if(!$skin || !is_dir('./modules/poll/skins/'.$skin)) $skin = 'default';
$oPollModel = &getModel('poll');
$tpl = $oPollModel->getPollResultHtml($poll_srl, $skin);
$this->add('poll_srl', $poll_srl);
$this->add('tpl',$tpl);
}
/**
* @brief poll list
*/
function procPollGetList()
{
if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
$pollSrls = Context::get('poll_srls');
if($pollSrls) $pollSrlList = explode(',', $pollSrls);
global $lang;
if(count($pollSrlList) > 0)
{
$oPollAdminModel = &getAdminModel('poll');
$args->pollIndexSrlList = $pollSrlList;
$output = $oPollAdminModel->getPollListWithMember($args);
$pollList = $output->data;
if(is_array($pollList))
{ {
$pollList = array(); foreach($pollList AS $key=>$value)
$this->setMessage($lang->no_documents); {
if($value->checkcount == 1) $value->checkName = $lang->single_check;
else $value->checkName = $lang->multi_check;
}
} }
}
else
{
$pollList = array();
$this->setMessage($lang->no_documents);
}
$this->add('poll_list', $pollList); $this->add('poll_list', $pollList);
} }
/** /**
* @brief A poll synchronization trigger when a new post is registered * @brief A poll synchronization trigger when a new post is registered
**/ */
function triggerInsertDocumentPoll(&$obj) { function triggerInsertDocumentPoll(&$obj)
$this->syncPoll($obj->document_srl, $obj->content); {
return new Object(); $this->syncPoll($obj->document_srl, $obj->content);
} return new Object();
}
/** /**
* @brief A poll synchronization trigger when a new comment is registered * @brief A poll synchronization trigger when a new comment is registered
**/ */
function triggerInsertCommentPoll(&$obj) { function triggerInsertCommentPoll(&$obj)
$this->syncPoll($obj->comment_srl, $obj->content); {
return new Object(); $this->syncPoll($obj->comment_srl, $obj->content);
} return new Object();
}
/** /**
* @brief A poll synchronization trigger when a post is updated * @brief A poll synchronization trigger when a post is updated
**/ */
function triggerUpdateDocumentPoll(&$obj) { function triggerUpdateDocumentPoll(&$obj)
$this->syncPoll($obj->document_srl, $obj->content); {
return new Object(); $this->syncPoll($obj->document_srl, $obj->content);
} return new Object();
}
/** /**
* @brief A poll synchronization trigger when a comment is updated * @brief A poll synchronization trigger when a comment is updated
**/ */
function triggerUpdateCommentPoll(&$obj) { function triggerUpdateCommentPoll(&$obj)
$this->syncPoll($obj->comment_srl, $obj->content); {
return new Object(); $this->syncPoll($obj->comment_srl, $obj->content);
} return new Object();
}
/** /**
* @brief A poll deletion trigger when a post is removed * @brief A poll deletion trigger when a post is removed
**/ */
function triggerDeleteDocumentPoll(&$obj) { function triggerDeleteDocumentPoll(&$obj)
$document_srl = $obj->document_srl; {
if(!$document_srl) return new Object(); $document_srl = $obj->document_srl;
// Get the poll if(!$document_srl) return new Object();
$args->upload_target_srl = $document_srl; // Get the poll
$output = executeQuery('poll.getPollByTargetSrl', $args); $args->upload_target_srl = $document_srl;
if(!$output->data) return new Object(); $output = executeQuery('poll.getPollByTargetSrl', $args);
if(!$output->data) return new Object();
$poll_srl = $output->data->poll_srl; $poll_srl = $output->data->poll_srl;
if(!$poll_srl) return new Object(); if(!$poll_srl) return new Object();
$args->poll_srl = $poll_srl; $args->poll_srl = $poll_srl;
$output = executeQuery('poll.deletePoll', $args); $output = executeQuery('poll.deletePoll', $args);
if(!$output->toBool()) return $output; if(!$output->toBool()) return $output;
$output = executeQuery('poll.deletePollItem', $args); $output = executeQuery('poll.deletePollItem', $args);
if(!$output->toBool()) return $output; if(!$output->toBool()) return $output;
$output = executeQuery('poll.deletePollTitle', $args); $output = executeQuery('poll.deletePollTitle', $args);
if(!$output->toBool()) return $output; if(!$output->toBool()) return $output;
$output = executeQuery('poll.deletePollLog', $args); $output = executeQuery('poll.deletePollLog', $args);
if(!$output->toBool()) return $output; if(!$output->toBool()) return $output;
return new Object(); return new Object();
} }
/** /**
* @brief A poll deletion trigger when a comment is removed * @brief A poll deletion trigger when a comment is removed
**/ */
function triggerDeleteCommentPoll(&$obj) { function triggerDeleteCommentPoll(&$obj)
$comment_srl = $obj->comment_srl; {
if(!$comment_srl) return new Object(); $comment_srl = $obj->comment_srl;
// Get the poll if(!$comment_srl) return new Object();
$args->upload_target_srl = $comment_srl; // Get the poll
$output = executeQuery('poll.getPollByTargetSrl', $args); $args->upload_target_srl = $comment_srl;
if(!$output->data) return new Object(); $output = executeQuery('poll.getPollByTargetSrl', $args);
if(!$output->data) return new Object();
$poll_srl = $output->data->poll_srl; $poll_srl = $output->data->poll_srl;
if(!$poll_srl) return new Object(); if(!$poll_srl) return new Object();
$args->poll_srl = $poll_srl; $args->poll_srl = $poll_srl;
$output = executeQuery('poll.deletePoll', $args); $output = executeQuery('poll.deletePoll', $args);
if(!$output->toBool()) return $output; if(!$output->toBool()) return $output;
$output = executeQuery('poll.deletePollItem', $args); $output = executeQuery('poll.deletePollItem', $args);
if(!$output->toBool()) return $output; if(!$output->toBool()) return $output;
$output = executeQuery('poll.deletePollTitle', $args); $output = executeQuery('poll.deletePollTitle', $args);
if(!$output->toBool()) return $output; if(!$output->toBool()) return $output;
$output = executeQuery('poll.deletePollLog', $args); $output = executeQuery('poll.deletePollLog', $args);
if(!$output->toBool()) return $output; if(!$output->toBool()) return $output;
return new Object(); return new Object();
} }
/** /**
* @brief As post content's poll is obtained, synchronize the poll using the document number * @brief As post content's poll is obtained, synchronize the poll using the document number
**/ */
function syncPoll($upload_target_srl, $content) { function syncPoll($upload_target_srl, $content)
$match_cnt = preg_match_all('!<img([^\>]*)poll_srl=(["\']?)([0-9]*)(["\']?)([^\>]*?)\>!is',$content, $matches); {
for($i=0;$i<$match_cnt;$i++) { $match_cnt = preg_match_all('!<img([^\>]*)poll_srl=(["\']?)([0-9]*)(["\']?)([^\>]*?)\>!is',$content, $matches);
$poll_srl = $matches[3][$i]; for($i=0;$i<$match_cnt;$i++)
{
$poll_srl = $matches[3][$i];
$args = null; $args = null;
$args->poll_srl = $poll_srl; $args->poll_srl = $poll_srl;
$output = executeQuery('poll.getPoll', $args); $output = executeQuery('poll.getPoll', $args);
$poll = $output->data; $poll = $output->data;
if($poll->upload_target_srl) continue; if($poll->upload_target_srl) continue;
$args->upload_target_srl = $upload_target_srl; $args->upload_target_srl = $upload_target_srl;
$output = executeQuery('poll.updatePollTarget', $args); $output = executeQuery('poll.updatePollTarget', $args);
$output = executeQuery('poll.updatePollTitleTarget', $args); $output = executeQuery('poll.updatePollTitleTarget', $args);
$output = executeQuery('poll.updatePollItemTarget', $args); $output = executeQuery('poll.updatePollItemTarget', $args);
} }
} }
} }
?> /* End of file poll.controller.php */
/* Location: ./modules/poll/poll.controller.php */

View file

@ -1,138 +1,154 @@
<?php <?php
/** /**
* @class pollModel * @class pollModel
* @author NHN (developers@xpressengine.com) * @author NHN (developers@xpressengine.com)
* @brief The model class for the poll modules * @brief The model class for the poll modules
**/ */
class pollModel extends poll
{
/**
* @brief Initialization
*/
function init()
{
}
class pollModel extends poll { /**
* @brief The function examines if the user has already been polled
*/
function isPolled($poll_srl)
{
$args->poll_srl = $poll_srl;
/** if(Context::get('is_logged'))
* @brief Initialization {
**/ $logged_info = Context::get('logged_info');
function init() { $args->member_srl = $logged_info->member_srl;
} }
else
{
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
}
$output = executeQuery('poll.getPollLog', $args);
if($output->data->count) return true;
return false;
}
/** /**
* @brief The function examines if the user has already been polled * @brief Return the HTML data of the survey
**/ * Return the result after checking if the poll has responses
function isPolled($poll_srl) { */
$args->poll_srl = $poll_srl; function getPollHtml($poll_srl, $style = '', $skin = 'default')
{
$args->poll_srl = $poll_srl;
// Get the information related to the survey
$columnList = array('poll_count', 'stop_date');
$output = executeQuery('poll.getPoll', $args, $columnList);
if(!$output->data) return '';
if(Context::get('is_logged')) { $poll->style = $style;
$logged_info = Context::get('logged_info'); $poll->poll_count = (int)$output->data->poll_count;
$args->member_srl = $logged_info->member_srl; $poll->stop_date = $output->data->stop_date;
} else {
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
}
$output = executeQuery('poll.getPollLog', $args);
if($output->data->count) return true;
return false;
}
/** $columnList = array('poll_index_srl', 'title', 'checkcount', 'poll_count');
* @brief Return the HTML data of the survey $output = executeQuery('poll.getPollTitle', $args, $columnList);
* Return the result after checking if the poll has responses if(!$output->data) return;
**/ if(!is_array($output->data)) $output->data = array($output->data);
function getPollHtml($poll_srl, $style = '', $skin = 'default') { foreach($output->data as $key => $val)
$args->poll_srl = $poll_srl; {
// Get the information related to the survey $poll->poll[$val->poll_index_srl]->title = $val->title;
$columnList = array('poll_count', 'stop_date'); $poll->poll[$val->poll_index_srl]->checkcount = $val->checkcount;
$output = executeQuery('poll.getPoll', $args, $columnList); $poll->poll[$val->poll_index_srl]->poll_count = $val->poll_count;
if(!$output->data) return ''; }
$poll->style = $style; $output = executeQuery('poll.getPollItem', $args);
$poll->poll_count = (int)$output->data->poll_count; foreach($output->data as $key => $val)
$poll->stop_date = $output->data->stop_date; {
$poll->poll[$val->poll_index_srl]->item[] = $val;
}
$columnList = array('poll_index_srl', 'title', 'checkcount', 'poll_count'); $poll->poll_srl = $poll_srl;
$output = executeQuery('poll.getPollTitle', $args, $columnList); // Only ongoing poll results
if(!$output->data) return; if($poll->stop_date > date("Ymd"))
if(!is_array($output->data)) $output->data = array($output->data); {
foreach($output->data as $key => $val) { if($this->isPolled($poll_srl)) $tpl_file = "result";
$poll->poll[$val->poll_index_srl]->title = $val->title; else $tpl_file = "form";
$poll->poll[$val->poll_index_srl]->checkcount = $val->checkcount; }
$poll->poll[$val->poll_index_srl]->poll_count = $val->poll_count; else
} {
$tpl_file = "result";
}
$output = executeQuery('poll.getPollItem', $args); Context::set('poll',$poll);
foreach($output->data as $key => $val) { Context::set('skin',$skin);
$poll->poll[$val->poll_index_srl]->item[] = $val; // The skin for the default configurations, and the colorset configurations
} $tpl_path = sprintf("%sskins/%s/", $this->module_path, $skin);
$poll->poll_srl = $poll_srl; $oTemplate = &TemplateHandler::getInstance();
// Only ongoing poll results return $oTemplate->compile($tpl_path, $tpl_file);
if($poll->stop_date > date("Ymd")) { }
if($this->isPolled($poll_srl)) $tpl_file = "result";
else $tpl_file = "form";
} else {
$tpl_file = "result";
}
Context::set('poll',$poll); /**
Context::set('skin',$skin); * @brief Return the result's HTML
// The skin for the default configurations, and the colorset configurations */
$tpl_path = sprintf("%sskins/%s/", $this->module_path, $skin); function getPollResultHtml($poll_srl, $skin = 'default')
{
$args->poll_srl = $poll_srl;
// Get the information related to the survey
$output = executeQuery('poll.getPoll', $args);
if(!$output->data) return '';
$oTemplate = &TemplateHandler::getInstance(); $poll->style = $style;
return $oTemplate->compile($tpl_path, $tpl_file); $poll->poll_count = (int)$output->data->poll_count;
} $poll->stop_date = $output->data->stop_date;
/** $columnList = array('poll_index_srl', 'checkcount', 'poll_count');
* @brief Return the result's HTML $output = executeQuery('poll.getPollTitle', $args, $columnList);
**/ if(!$output->data) return;
function getPollResultHtml($poll_srl, $skin = 'default') { if(!is_array($output->data)) $output->data = array($output->data);
$args->poll_srl = $poll_srl; foreach($output->data as $key => $val)
// Get the information related to the survey {
$output = executeQuery('poll.getPoll', $args); $poll->poll[$val->poll_index_srl]->title = $val->title;
if(!$output->data) return ''; $poll->poll[$val->poll_index_srl]->checkcount = $val->checkcount;
$poll->poll[$val->poll_index_srl]->poll_count = $val->poll_count;
}
$poll->style = $style; $output = executeQuery('poll.getPollItem', $args);
$poll->poll_count = (int)$output->data->poll_count; foreach($output->data as $key => $val)
$poll->stop_date = $output->data->stop_date; {
$poll->poll[$val->poll_index_srl]->item[] = $val;
}
$columnList = array('poll_index_srl', 'checkcount', 'poll_count'); $poll->poll_srl = $poll_srl;
$output = executeQuery('poll.getPollTitle', $args, $columnList);
if(!$output->data) return;
if(!is_array($output->data)) $output->data = array($output->data);
foreach($output->data as $key => $val) {
$poll->poll[$val->poll_index_srl]->title = $val->title;
$poll->poll[$val->poll_index_srl]->checkcount = $val->checkcount;
$poll->poll[$val->poll_index_srl]->poll_count = $val->poll_count;
}
$output = executeQuery('poll.getPollItem', $args); $tpl_file = "result";
foreach($output->data as $key => $val) {
$poll->poll[$val->poll_index_srl]->item[] = $val;
}
$poll->poll_srl = $poll_srl; Context::set('poll',$poll);
// The skin for the default configurations, and the colorset configurations
$tpl_path = sprintf("%sskins/%s/", $this->module_path, $skin);
$tpl_file = "result"; $oTemplate = &TemplateHandler::getInstance();
return $oTemplate->compile($tpl_path, $tpl_file);
}
/** [TO REVIEW]
* @brief Selected poll - return the colorset of the skin
*/
function getPollGetColorsetList()
{
$skin = Context::get('skin');
Context::set('poll',$poll); $oModuleModel = &getModel('module');
// The skin for the default configurations, and the colorset configurations $skin_info = $oModuleModel->loadSkinInfo($this->module_path, $skin);
$tpl_path = sprintf("%sskins/%s/", $this->module_path, $skin);
$oTemplate = &TemplateHandler::getInstance(); for($i=0;$i<count($skin_info->colorset);$i++)
return $oTemplate->compile($tpl_path, $tpl_file); {
} $colorset = sprintf('%s|@|%s', $skin_info->colorset[$i]->name, $skin_info->colorset[$i]->title);
/** [TO REVIEW] $colorset_list[] = $colorset;
* @brief Selected poll - return the colorset of the skin }
**/
function getPollGetColorsetList() {
$skin = Context::get('skin');
$oModuleModel = &getModel('module'); if(count($colorset_list)) $colorsets = implode("\n", $colorset_list);
$skin_info = $oModuleModel->loadSkinInfo($this->module_path, $skin); $this->add('colorset_list', $colorsets);
}
for($i=0;$i<count($skin_info->colorset);$i++) { }
$colorset = sprintf('%s|@|%s', $skin_info->colorset[$i]->name, $skin_info->colorset[$i]->title); /* End of file poll.model.php */
$colorset_list[] = $colorset; /* Location: ./modules/poll/poll.model.php */
}
if(count($colorset_list)) $colorsets = implode("\n", $colorset_list);
$this->add('colorset_list', $colorsets);
}
}
?>

View file

@ -1,155 +1,164 @@
<?php <?php
/** /**
* The admin controller class of the rss module * The admin controller class of the rss module
*
* @author NHN (developers@xpressengine.com)
*/
class rssAdminController extends rss
{
/**
* Initialization
* *
* @author NHN (developers@xpressengine.com) * @return void
**/ */
function init()
{
}
class rssAdminController extends rss { /**
* All RSS feeds configurations
*
* @return void
*/
function procRssAdminInsertConfig()
{
$oModuleModel = &getModel('module');
$total_config = $oModuleModel->getModuleConfig('rss');
/** $config_vars = Context::getRequestVars();
* Initialization
*
* @return void
**/
function init() {
}
/** $config_vars->feed_document_count = (int)$config_vars->feed_document_count;
* All RSS feeds configurations
*
* @return void
**/
function procRssAdminInsertConfig() {
$oModuleModel = &getModel('module');
$total_config = $oModuleModel->getModuleConfig('rss');
$config_vars = Context::getRequestVars(); 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';
$config_vars->feed_document_count = (int)$config_vars->feed_document_count; if($config_vars->image || $config_vars->del_image)
{
$image_obj = $config_vars->image;
$config_vars->image = $total_config->image;
// Get a variable for the delete request
if($config_vars->del_image == 'Y' || $image_obj)
{
FileHandler::removeFile($config_vars->image);
$config_vars->image = '';
$total_config->image = '';
}
// Ignore if the file is not the one which has been successfully uploaded
if($image_obj['tmp_name'] && is_uploaded_file($image_obj['tmp_name']))
{
// Ignore if the file is not an image (swf is accepted ~)
$image_obj['name'] = Context::convertEncodingStr($image_obj['name']);
if(!$config_vars->use_total_feed) $alt_message = 'msg_invalid_request'; if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) $alt_message = 'msg_rss_invalid_image_format';
if(!in_array($config_vars->use_total_feed, array('Y','N'))) $config_vars->open_rss = 'Y'; else
{
// Upload the file to a path
$path = './files/attach/images/rss/';
// Create a directory
if(!FileHandler::makeDir($path)) $alt_message = 'msg_error_occured';
else
{
$filename = $path.$image_obj['name'];
// Move the file
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;
if($config_vars->image || $config_vars->del_image) { $output = $this->setFeedConfig($config_vars);
$image_obj = $config_vars->image;
$config_vars->image = $total_config->image;
// Get a variable for the delete request
if($config_vars->del_image == 'Y' || $image_obj) {
FileHandler::removeFile($config_vars->image);
$config_vars->image = '';
$total_config->image = '';
}
// Ignore if the file is not the one which has been successfully uploaded
if($image_obj['tmp_name'] && is_uploaded_file($image_obj['tmp_name'])) {
// Ignore if the file is not an image (swf is accepted ~)
$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'; if(!$alt_message) $alt_message = 'success_updated';
else {
// Upload the file to a path
$path = './files/attach/images/rss/';
// Create a directory
if(!FileHandler::makeDir($path)) $alt_message = 'msg_error_occured';
else{
$filename = $path.$image_obj['name'];
// Move the file
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); $alt_message = Context::getLang($alt_message);
$this->setMessage($alt_message, 'info');
if(!$alt_message) $alt_message = 'success_updated'; //$this->setLayoutPath('./common/tpl');
//$this->setLayoutFile('default_layout.html');
//$this->setTemplatePath($this->module_path.'tpl');
//$this->setTemplateFile("top_refresh.html");
$alt_message = Context::getLang($alt_message); $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispRssAdminIndex');
$this->setMessage($alt_message, 'info'); $this->setRedirectUrl($returnUrl);
}
//$this->setLayoutPath('./common/tpl'); /**
//$this->setLayoutFile('default_layout.html'); * RSS Module configurations
//$this->setTemplatePath($this->module_path.'tpl'); *
//$this->setTemplateFile("top_refresh.html"); * @return void
*/
function procRssAdminInsertModuleConfig()
{
// Get the object
$module_srl = Context::get('target_module_srl');
// In case of batch configuration of several modules
if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl);
else $module_srl = array($module_srl);
if(!is_array($module_srl)) $module_srl[0] = $module_srl;
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispRssAdminIndex'); $config_vars = Context::getRequestVars();
$this->setRedirectUrl($returnUrl);
}
$open_rss = $config_vars->open_rss;
$open_total_feed = $config_vars->open_total_feed;
$feed_description = trim($config_vars->feed_description);
$feed_copyright = trim($config_vars->feed_copyright);
/** if(!$module_srl || !$open_rss) return new Object(-1, 'msg_invalid_request');
* RSS Module configurations
*
* @return void
**/
function procRssAdminInsertModuleConfig() {
// Get the object
$module_srl = Context::get('target_module_srl');
// In case of batch configuration of several modules
if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl);
else $module_srl = array($module_srl);
if(!is_array($module_srl)) $module_srl[0] = $module_srl;
$config_vars = Context::getRequestVars(); if(!in_array($open_rss, array('Y','H','N'))) $open_rss = 'N';
// Save configurations
for($i=0;$i<count($module_srl);$i++)
{
$srl = trim($module_srl[$i]);
if(!$srl) continue;
$output = $this->setRssModuleConfig($srl, $open_rss, $open_total_feed, $feed_description, $feed_copyright);
}
$open_rss = $config_vars->open_rss; //$this->setError(0);
$open_total_feed = $config_vars->open_total_feed; $this->setMessage('success_updated', 'info');
$feed_description = trim($config_vars->feed_description);
$feed_copyright = trim($config_vars->feed_copyright);
if(!$module_srl || !$open_rss) return new Object(-1, 'msg_invalid_request'); $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispBoardAdminContent');
$this->setRedirectUrl($returnUrl);
}
if(!in_array($open_rss, array('Y','H','N'))) $open_rss = 'N'; /**
// Save configurations * A funciton to configure all Feeds of the RSS module
for($i=0;$i<count($module_srl);$i++) { *
$srl = trim($module_srl[$i]); * @param Object $config RSS all feeds config list
if(!$srl) continue; * @return Object
$output = $this->setRssModuleConfig($srl, $open_rss, $open_total_feed, $feed_description, $feed_copyright); */
} function setFeedConfig($config)
{
$oModuleController = &getController('module');
$oModuleController->insertModuleConfig('rss',$config);
return new Object();
}
//$this->setError(0); /**
$this->setMessage('success_updated', 'info'); * A function t configure the RSS module
*
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispBoardAdminContent'); * @param integer $module_srl Module_srl
$this->setRedirectUrl($returnUrl); * @param string $open_rss Choose open rss type. Y : Open all, H : Open summary, N : Not open
} * @param string $open_total_feed N : use open total feed, T_N : not use open total feed
* @param string $feed_description Default value is 'N'
* @param string $feed_copyright Default value is 'N'
/** * @return Object
* A funciton to configure all Feeds of the RSS module */
* function setRssModuleConfig($module_srl, $open_rss, $open_total_feed = 'N', $feed_description = 'N', $feed_copyright = 'N')
* @param Object $config RSS all feeds config list {
* @return Object $oModuleController = &getController('module');
**/ $config->open_rss = $open_rss;
function setFeedConfig($config) { $config->open_total_feed = $open_total_feed;
$oModuleController = &getController('module'); if($feed_description != 'N') { $config->feed_description = $feed_description; }
$oModuleController->insertModuleConfig('rss',$config); if($feed_copyright != 'N') { $config->feed_copyright = $feed_copyright; }
return new Object(); $oModuleController->insertModulePartConfig('rss',$module_srl,$config);
} return new Object();
}
}
/** /* End of file rss.admin.controller.php */
* A function t configure the RSS module /* Location: ./modules/rss/rss.admin.controller.php */
*
* @param integer $module_srl Module_srl
* @param string $open_rss Choose open rss type. Y : Open all, H : Open summary, N : Not open
* @param string $open_total_feed N : use open total feed, T_N : not use open total feed
* @param string $feed_description Default value is 'N'
* @param string $feed_copyright Default value is 'N'
* @return Object
**/
function setRssModuleConfig($module_srl, $open_rss, $open_total_feed = 'N', $feed_description = 'N', $feed_copyright = 'N') {
$oModuleController = &getController('module');
$config->open_rss = $open_rss;
$config->open_total_feed = $open_total_feed;
if($feed_description != 'N') { $config->feed_description = $feed_description; }
if($feed_copyright != 'N') { $config->feed_copyright = $feed_copyright; }
$oModuleController->insertModulePartConfig('rss',$module_srl,$config);
return new Object();
}
}
?>

View file

@ -1,60 +1,65 @@
<?php <?php
/** /**
* The admin view class of the rss module * The admin view class of the rss module
*
* @author NHN (developers@xpressengine.com)
*/
class rssAdminView extends rss
{
/**
* Initialization
* *
* @author NHN (developers@xpressengine.com) * @return void
**/ */
function init()
{
//Set template path
$this->setTemplatePath($this->module_path.'tpl');
}
class rssAdminView extends rss { /**
/** * In case an administrator page has been initialized
* Initialization *
* * @return Object
* @return void */
**/ function dispRssAdminIndex()
function init() { {
//Set template path $oModuleModel = &getModel('module');
$this->setTemplatePath($this->module_path.'tpl'); $rss_config = $oModuleModel->getModulePartConfigs('rss');
} $total_config = $oModuleModel->getModuleConfig('rss');
$oRssModel = &getModel('rss');
if($rss_config)
/** {
* In case an administrator page has been initialized foreach($rss_config as $module_srl => $config)
* {
* @return Object if($config)
**/ {
function dispRssAdminIndex() { $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
$oModuleModel = &getModel('module'); $columnList = array('sites.domain');
$rss_config = $oModuleModel->getModulePartConfigs('rss'); $site = $oModuleModel->getSiteInfo($module_info->site_srl, $columnList);
$total_config = $oModuleModel->getModuleConfig('rss'); if(!strpos($site->domain, '.')) $vid = $site->domain;
$oRssModel = &getModel('rss'); else $site = null;
if($site) $feed_config[$module_srl]['url'] = $oRssModel->getModuleFeedUrl($vid, $module_info->mid, 'rss');
if($rss_config) { $feed_config[$module_srl]['mid'] = $module_info->mid;
foreach($rss_config as $module_srl => $config) { $feed_config[$module_srl]['open_feed'] = $config->open_rss;
if($config) { $feed_config[$module_srl]['open_total_feed'] = $config->open_total_feed;
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); $feed_config[$module_srl]['feed_description'] = $config->feed_description;
$columnList = array('sites.domain');
$site = $oModuleModel->getSiteInfo($module_info->site_srl, $columnList);
if(!strpos($site->domain, '.')) $vid = $site->domain;
else $site = null;
if($site) $feed_config[$module_srl]['url'] = $oRssModel->getModuleFeedUrl($vid, $module_info->mid, 'rss');
$feed_config[$module_srl]['mid'] = $module_info->mid;
$feed_config[$module_srl]['open_feed'] = $config->open_rss;
$feed_config[$module_srl]['open_total_feed'] = $config->open_total_feed;
$feed_config[$module_srl]['feed_description'] = $config->feed_description;
}
} }
} }
if(!$total_config->feed_document_count) $total_config->feed_document_count = 15;
Context::set('feed_config', $feed_config);
Context::set('total_config', $total_config);
$security = new Security();
$security->encodeHTML('feed_config..mid','feed_config..url');
$security->encodeHTML('total_config..');
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('rss_admin_index');
} }
if(!$total_config->feed_document_count) $total_config->feed_document_count = 15;
Context::set('feed_config', $feed_config);
Context::set('total_config', $total_config);
$security = new Security();
$security->encodeHTML('feed_config..mid','feed_config..url');
$security->encodeHTML('total_config..');
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('rss_admin_index');
} }
?> }
/* End of file rss.admin.view.php */
/* Location: ./modules/rss/rss.admin.view.php */

View file

@ -1,88 +1,92 @@
<?php <?php
/** include '../../config/config.inc.php';
* High class of rss module /**
* High class of rss module
*
* @author NHN (developers@xpressengine.com)
*/
class rss extends ModuleObject
{
/**
* Additional tasks required to accomplish during the installation
* *
* @author NHN (developers@xpressengine.com) * @return Object
**/ */
function moduleInstall()
{
// Register in action forward
$oModuleController = &getController('module');
class rss extends ModuleObject { $oModuleController->insertActionForward('rss', 'view', 'rss');
$oModuleController->insertActionForward('rss', 'view', 'atom');
// 2007.10.18 Add a trigger for participating additional configurations of the service module
$oModuleController->insertTrigger('module.dispAdditionSetup', 'rss', 'view', 'triggerDispRssAdditionSetup', 'before');
// 2007. 10. 19 Call the trigger to set RSS URL before outputing
$oModuleController->insertTrigger('moduleHandler.proc', 'rss', 'controller', 'triggerRssUrlInsert', 'after');
/** return new Object();
* Additional tasks required to accomplish during the installation }
*
* @return Object
**/
function moduleInstall() {
// Register in action forward
$oModuleController = &getController('module');
$oModuleController->insertActionForward('rss', 'view', 'rss'); /**
$oModuleController->insertActionForward('rss', 'view', 'atom'); * A method to check if the installation has been successful
// 2007.10.18 Add a trigger for participating additional configurations of the service module * @return bool
$oModuleController->insertTrigger('module.dispAdditionSetup', 'rss', 'view', 'triggerDispRssAdditionSetup', 'before'); */
// 2007. 10. 19 Call the trigger to set RSS URL before outputing function checkUpdate()
$oModuleController->insertTrigger('moduleHandler.proc', 'rss', 'controller', 'triggerRssUrlInsert', 'after'); {
$oModuleModel = &getModel('module');
// Add the Action forward for atom
if(!$oModuleModel->getActionForward('atom')) return true;
// 2007. 10. Add a trigger for participating additional configurations of the service module
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'rss', 'view', 'triggerDispRssAdditionSetup', 'before')) return true;
// 2007. 10. 19 Call the trigger to set RSS URL before outputing
if(!$oModuleModel->getTrigger('moduleHandler.proc', 'rss', 'controller', 'triggerRssUrlInsert', 'after')) return true;
return new Object(); if($oModuleModel->getTrigger('display', 'rss', 'controller', 'triggerRssUrlInsert', 'before')) return true;
}
/** // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
* A method to check if the installation has been successful if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'rss', 'controller', 'triggerCopyModule', 'after')) return true;
* @return bool
**/
function checkUpdate() {
$oModuleModel = &getModel('module');
// Add the Action forward for atom
if(!$oModuleModel->getActionForward('atom')) return true;
// 2007. 10. Add a trigger for participating additional configurations of the service module
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'rss', 'view', 'triggerDispRssAdditionSetup', 'before')) return true;
// 2007. 10. 19 Call the trigger to set RSS URL before outputing
if(!$oModuleModel->getTrigger('moduleHandler.proc', 'rss', 'controller', 'triggerRssUrlInsert', 'after')) return true;
if($oModuleModel->getTrigger('display', 'rss', 'controller', 'triggerRssUrlInsert', 'before')) return true; return false;
}
// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied /**
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'rss', 'controller', 'triggerCopyModule', 'after')) return true; * Execute update
*
* @return Object
*/
function moduleUpdate()
{
$oModuleModel = &getModel('module');
$oModuleController = &getController('module');
// Add atom act
if(!$oModuleModel->getActionForward('atom'))
$oModuleController->insertActionForward('rss', 'view', 'atom');
// 2007. 10. An additional set of 18 to participate in a service module, add a trigger
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'rss', 'view', 'triggerDispRssAdditionSetup', 'before'))
$oModuleController->insertTrigger('module.dispAdditionSetup', 'rss', 'view', 'triggerDispRssAdditionSetup', 'before');
// 2007. 10. 19 outputs the trigger before you call to set up rss url
if(!$oModuleModel->getTrigger('moduleHandler.proc', 'rss', 'controller', 'triggerRssUrlInsert', 'after'))
$oModuleController->insertTrigger('moduleHandler.proc', 'rss', 'controller', 'triggerRssUrlInsert', 'after');
if($oModuleModel->getTrigger('display', 'rss', 'controller', 'triggerRssUrlInsert', 'before'))
$oModuleController->deleteTrigger('display', 'rss', 'controller', 'triggerRssUrlInsert', 'before');
return false; // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
} if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'rss', 'controller', 'triggerCopyModule', 'after'))
{
$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'rss', 'controller', 'triggerCopyModule', 'after');
}
/** return new Object(0, 'success_updated');
* Execute update }
*
* @return Object
**/
function moduleUpdate() {
$oModuleModel = &getModel('module');
$oModuleController = &getController('module');
// Add atom act
if(!$oModuleModel->getActionForward('atom'))
$oModuleController->insertActionForward('rss', 'view', 'atom');
// 2007. 10. An additional set of 18 to participate in a service module, add a trigger
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'rss', 'view', 'triggerDispRssAdditionSetup', 'before'))
$oModuleController->insertTrigger('module.dispAdditionSetup', 'rss', 'view', 'triggerDispRssAdditionSetup', 'before');
// 2007. 10. 19 outputs the trigger before you call to set up rss url
if(!$oModuleModel->getTrigger('moduleHandler.proc', 'rss', 'controller', 'triggerRssUrlInsert', 'after'))
$oModuleController->insertTrigger('moduleHandler.proc', 'rss', 'controller', 'triggerRssUrlInsert', 'after');
if($oModuleModel->getTrigger('display', 'rss', 'controller', 'triggerRssUrlInsert', 'before'))
$oModuleController->deleteTrigger('display', 'rss', 'controller', 'triggerRssUrlInsert', 'before');
// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied /**
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'rss', 'controller', 'triggerCopyModule', 'after')) * Re-generate the cache file
{ *
$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'rss', 'controller', 'triggerCopyModule', 'after'); * @return void
} */
function recompileCache()
return new Object(0, 'success_updated'); {
} }
}
/** /* End of file rss.class.php */
* Re-generate the cache file /* Location: ./modules/rss/rss.class.php */
*
* @return void
**/
function recompileCache() {
}
}
?>

View file

@ -1,77 +1,84 @@
<?php <?php
/** /**
* The controller class of rss module * The controller class of rss module
*
* @author NHN (developers@xpressengine.com)
*/
class rssController extends rss
{
/**
* Initialization
* *
* @author NHN (developers@xpressengine.com) * @return void
**/ */
function init()
{
}
class rssController extends rss { /**
* Check whether to use RSS rss url by adding
*
* @return Object
*/
function triggerRssUrlInsert()
{
$oModuleModel = &getModel('module');
$total_config = $oModuleModel->getModuleConfig('rss');
$current_module_srl = Context::get('module_srl');
$site_module_info = Context::get('site_module_info');
/** if(is_array($current_module_srl))
* Initialization
*
* @return void
**/
function init() {
}
/**
* Check whether to use RSS rss url by adding
*
* @return Object
**/
function triggerRssUrlInsert() {
$oModuleModel = &getModel('module');
$total_config = $oModuleModel->getModuleConfig('rss');
$current_module_srl = Context::get('module_srl');
$site_module_info = Context::get('site_module_info');
if(is_array($current_module_srl))
{
unset($current_module_srl);
}
if(!$current_module_srl) {
$current_module_info = Context::get('current_module_info');
$current_module_srl = $current_module_info->module_srl;
}
if(!$current_module_srl) return new Object();
// Imported rss settings of the selected module
$oRssModel = &getModel('rss');
$rss_config = $oRssModel->getRssModuleConfig($current_module_srl);
if($rss_config->open_rss != 'N') {
Context::set('rss_url', $oRssModel->getModuleFeedUrl(Context::get('vid'), Context::get('mid'), 'rss'));
Context::set('atom_url', $oRssModel->getModuleFeedUrl(Context::get('vid'), Context::get('mid'), 'atom'));
}
if(Context::isInstalled() && $site_module_info->mid == Context::get('mid') && $total_config->use_total_feed != 'N') {
if(Context::isAllowRewrite() && !Context::get('vid')) {
$request_uri = Context::getRequestUri();
Context::set('general_rss_url', $request_uri.'rss');
Context::set('general_atom_url', $request_uri.'atom');
} else {
Context::set('general_rss_url', getUrl('','module','rss','act','rss'));
Context::set('general_atom_url', getUrl('','module','rss','act','atom'));
}
}
return new Object();
}
function triggerCopyModule(&$obj)
{ {
$oModuleModel = &getModel('module'); unset($current_module_srl);
$rssConfig = $oModuleModel->getModulePartConfig('rss', $obj->originModuleSrl); }
if(!$current_module_srl) {
$current_module_info = Context::get('current_module_info');
$current_module_srl = $current_module_info->module_srl;
}
$oModuleController = &getController('module'); if(!$current_module_srl) return new Object();
if(is_array($obj->moduleSrlList)) // Imported rss settings of the selected module
$oRssModel = &getModel('rss');
$rss_config = $oRssModel->getRssModuleConfig($current_module_srl);
if($rss_config->open_rss != 'N')
{
Context::set('rss_url', $oRssModel->getModuleFeedUrl(Context::get('vid'), Context::get('mid'), 'rss'));
Context::set('atom_url', $oRssModel->getModuleFeedUrl(Context::get('vid'), Context::get('mid'), 'atom'));
}
if(Context::isInstalled() && $site_module_info->mid == Context::get('mid') && $total_config->use_total_feed != 'N')
{
if(Context::isAllowRewrite() && !Context::get('vid'))
{ {
foreach($obj->moduleSrlList AS $key=>$moduleSrl) $request_uri = Context::getRequestUri();
{ Context::set('general_rss_url', $request_uri.'rss');
$oModuleController->insertModulePartConfig('rss', $moduleSrl, $rssConfig); Context::set('general_atom_url', $request_uri.'atom');
} }
else
{
Context::set('general_rss_url', getUrl('','module','rss','act','rss'));
Context::set('general_atom_url', getUrl('','module','rss','act','atom'));
} }
} }
}
?> return new Object();
}
function triggerCopyModule(&$obj)
{
$oModuleModel = &getModel('module');
$rssConfig = $oModuleModel->getModulePartConfig('rss', $obj->originModuleSrl);
$oModuleController = &getController('module');
if(is_array($obj->moduleSrlList))
{
foreach($obj->moduleSrlList AS $key=>$moduleSrl)
{
$oModuleController->insertModulePartConfig('rss', $moduleSrl, $rssConfig);
}
}
}
}
/* End of file rss.controller.php */
/* Location: ./modules/rss/rss.controller.php */

View file

@ -1,49 +1,55 @@
<?php <?php
/** /**
* The model class of the rss module * The model class of the rss module
*
* @author NHN (developers@xpressengine.com)
*/
class rssModel extends rss
{
/**
* Create the Feed url.
* *
* @author NHN (developers@xpressengine.com) * @param string $vid Vid
**/ * @param string $mid mid
* @param string $format Feed format. ef)xe, atom, rss1.0
* @return string
*/
function getModuleFeedUrl($vid = null, $mid, $format)
{
if(Context::isAllowRewrite())
{
$request_uri = Context::getRequestUri();
// If the virtual site variable exists and it is different from mid (vid and mid should not be the same)
if($vid && $vid != $mid)
{
return $request_uri.$vid.'/'.$mid.'/'.$format;
}
else
{
return $request_uri.$mid.'/'.$format;
}
}
else
{
return getUrl('','mid',$mid,'act',$format);
}
}
class rssModel extends rss { /**
/** * Return the RSS configurations of the specific modules
* Create the Feed url. *
* * @param integer $module_srl Module_srl
* @param string $vid Vid * @return Object
* @param string $mid mid */
* @param string $format Feed format. ef)xe, atom, rss1.0 function getRssModuleConfig($module_srl)
* @return string {
**/ // Get the configurations of the rss module
function getModuleFeedUrl($vid = null, $mid, $format) { $oModuleModel = &getModel('module');
if(Context::isAllowRewrite()) { $module_rss_config = $oModuleModel->getModulePartConfig('rss', $module_srl);
$request_uri = Context::getRequestUri(); if(!$module_rss_config) $module_rss_config->open_rss = 'N';
// If the virtual site variable exists and it is different from mid (vid and mid should not be the same) $module_rss_config->module_srl = $module_srl;
if($vid && $vid != $mid) { return $module_rss_config;
return $request_uri.$vid.'/'.$mid.'/'.$format; }
} }
else { /* End of file rss.model.php */
return $request_uri.$mid.'/'.$format; /* Location: ./modules/rss/rss.model.php */
}
}
else {
return getUrl('','mid',$mid,'act',$format);
}
}
/**
* Return the RSS configurations of the specific modules
*
* @param integer $module_srl Module_srl
* @return Object
**/
function getRssModuleConfig($module_srl) {
// Get the configurations of the rss module
$oModuleModel = &getModel('module');
$module_rss_config = $oModuleModel->getModulePartConfig('rss', $module_srl);
if(!$module_rss_config) $module_rss_config->open_rss = 'N';
$module_rss_config->module_srl = $module_srl;
return $module_rss_config;
}
}
?>

View file

@ -1,235 +1,262 @@
<?php <?php
/** /**
* The view class of the rss module * The view class of the rss module
*
* @author NHN (developers@xpressengine.com)
*/
class rssView extends rss
{
/**
* Initialization
* *
* @author NHN (developers@xpressengine.com) * @return void
**/ */
function init()
{
}
class rssView extends rss { /**
* Feed output.
* When trying to directly print out the RSS, the results variable can be directly specified through $oRssView->rss($document_list)
*
* @param Object $document_list Document list
* @param string $rss_title Rss title
* @param string $add_description Add description
*/
function rss($document_list = null, $rss_title = null, $add_description = null)
{
$oDocumentModel = &getModel('document');
$oModuleModel = &getModel('module');
$oModuleController = &getController('module');
// Get the content and information for the current requested module if the method is not called from another module
if(!$document_list)
{
$site_module_info = Context::get('site_module_info');
$site_srl = $site_module_info->site_srl;
$mid = Context::get('mid'); // The target module id, if absent, then all
$start_date = (int)Context::get('start_date');
$end_date = (int)Context::get('end_date');
/** $module_srls = array();
* Initialization $rss_config = array();
* $total_config = '';
* @return void $total_config = $oModuleModel->getModuleConfig('rss');
**/ // If one is specified, extract only for this mid
function init() { if($mid)
} {
$module_srl = $this->module_info->module_srl;
$config = $oModuleModel->getModulePartConfig('rss', $module_srl);
if($config->open_rss && $config->open_rss != 'N')
{
$module_srls[] = $module_srl;
$open_rss_config[$module_srl] = $config->open_rss;
}
// If mid is not selected, then get all
}
else
{
if($total_config->use_total_feed != 'N')
{
$rss_config = $oModuleModel->getModulePartConfigs('rss', $site_srl);
if($rss_config)
{
foreach($rss_config as $module_srl => $config)
{
if($config && $config->open_rss != 'N' && $config->open_total_feed != 'T_N')
{
$module_srls[] = $module_srl;
$open_rss_config[$module_srl] = $config->open_rss;
}
}
}
}
}
/** if(!count($module_srls) && !$add_description) return $this->dispError();
* Feed output.
* When trying to directly print out the RSS, the results variable can be directly specified through $oRssView->rss($document_list)
*
* @param Object $document_list Document list
* @param string $rss_title Rss title
* @param string $add_description Add description
**/
function rss($document_list = null, $rss_title = null, $add_description = null) {
$oDocumentModel = &getModel('document');
$oModuleModel = &getModel('module');
$oModuleController = &getController('module');
// Get the content and information for the current requested module if the method is not called from another module
if(!$document_list) {
$site_module_info = Context::get('site_module_info');
$site_srl = $site_module_info->site_srl;
$mid = Context::get('mid'); // The target module id, if absent, then all
$start_date = (int)Context::get('start_date');
$end_date = (int)Context::get('end_date');
$module_srls = array(); if($module_srls)
$rss_config = array(); {
$total_config = ''; $args->module_srl = implode(',',$module_srls);
$total_config = $oModuleModel->getModuleConfig('rss'); //$module_list = $oModuleModel->getMidList($args); //perhaps module_list varialbles not use
// If one is specified, extract only for this mid
if($mid) {
$module_srl = $this->module_info->module_srl;
$config = $oModuleModel->getModulePartConfig('rss', $module_srl);
if($config->open_rss && $config->open_rss != 'N') {
$module_srls[] = $module_srl;
$open_rss_config[$module_srl] = $config->open_rss;
}
// If mid is not selected, then get all
} else {
if($total_config->use_total_feed != 'N') {
$rss_config = $oModuleModel->getModulePartConfigs('rss', $site_srl);
if($rss_config) {
foreach($rss_config as $module_srl => $config) {
if($config && $config->open_rss != 'N' && $config->open_total_feed != 'T_N') {
$module_srls[] = $module_srl;
$open_rss_config[$module_srl] = $config->open_rss;
}
}
}
}
}
if(!count($module_srls) && !$add_description) return $this->dispError(); $args->search_target = 'is_secret';
$args->search_keyword = 'N';
$args->page = (int)Context::get('page');
$args->list_count = 15;
if($total_config->feed_document_count) $args->list_count = $total_config->feed_document_count;
if(!$args->page || $args->page < 1) $args->page = 1;
if($start_date || $start_date != 0) $args->start_date = $start_date;
if($end_date || $end_date != 0) $args->end_date = $end_date;
if($start_date == 0) unset($start_date);
if($end_date == 0) unset($end_date);
if($module_srls) { $args->sort_index = 'list_order';
$args->module_srl = implode(',',$module_srls); $args->order_type = 'asc';
//$module_list = $oModuleModel->getMidList($args); //perhaps module_list varialbles not use $output = $oDocumentModel->getDocumentList($args);
$document_list = $output->data;
// Extract the feed title and information with Context::getBrowserTitle
if($mid)
{
$info->title = Context::getBrowserTitle();
$oModuleController->replaceDefinedLangCode($info->title);
$args->search_target = 'is_secret'; $info->title = str_replace('\'', '&apos;',$info->title);
$args->search_keyword = 'N'; if($config->feed_description)
$args->page = (int)Context::get('page'); {
$args->list_count = 15; $info->description = str_replace('\'', '&apos;', htmlspecialchars($config->feed_description));
if($total_config->feed_document_count) $args->list_count = $total_config->feed_document_count; }
if(!$args->page || $args->page < 1) $args->page = 1; else
if($start_date || $start_date != 0) $args->start_date = $start_date; {
if($end_date || $end_date != 0) $args->end_date = $end_date; $info->description = str_replace('\'', '&apos;', htmlspecialchars($this->module_info->description));
if($start_date == 0) unset($start_date); }
if($end_date == 0) unset($end_date); $info->link = getUrl('','mid',$mid);
$info->feed_copyright = str_replace('\'', '&apos;', htmlspecialchars($feed_config->feed_copyright));
if(!$info->feed_copyright)
{
$info->feed_copyright = str_replace('\'', '&apos;', htmlspecialchars($total_config->feed_copyright));
}
}
}
}
$args->sort_index = 'list_order'; if(!$info->title)
$args->order_type = 'asc'; {
$output = $oDocumentModel->getDocumentList($args); if($rss_title) $info->title = $rss_title;
$document_list = $output->data; else if($total_config->feed_title) $info->title = $total_config->feed_title;
// Extract the feed title and information with Context::getBrowserTitle else
if($mid) { {
$info->title = Context::getBrowserTitle(); $site_module_info = Context::get('site_module_info');
$oModuleController->replaceDefinedLangCode($info->title); $info->title = $site_module_info->browser_title;
}
$info->title = str_replace('\'', '&apos;',$info->title); $oModuleController->replaceDefinedLangCode($info->title);
if($config->feed_description) { $info->title = str_replace('\'', '&apos;', htmlspecialchars($info->title));
$info->description = str_replace('\'', '&apos;', htmlspecialchars($config->feed_description)); $info->description = str_replace('\'', '&apos;', htmlspecialchars($total_config->feed_description));
} $info->link = Context::getRequestUri();
else { $info->feed_copyright = str_replace('\'', '&apos;', htmlspecialchars($total_config->feed_copyright));
$info->description = str_replace('\'', '&apos;', htmlspecialchars($this->module_info->description)); }
} if($add_description) $info->description .= "\r\n".$add_description;
$info->link = getUrl('','mid',$mid);
$info->feed_copyright = str_replace('\'', '&apos;', htmlspecialchars($feed_config->feed_copyright));
if(!$info->feed_copyright) {
$info->feed_copyright = str_replace('\'', '&apos;', htmlspecialchars($total_config->feed_copyright));
}
}
}
}
if(!$info->title) { if($total_config->image) $info->image = Context::getRequestUri().str_replace('\'', '&apos;', htmlspecialchars($total_config->image));
if($rss_title) $info->title = $rss_title; switch(Context::get('format'))
else if($total_config->feed_title) $info->title = $total_config->feed_title; {
else { case 'atom':
$site_module_info = Context::get('site_module_info'); $info->date = date('Y-m-d\TH:i:sP');
$info->title = $site_module_info->browser_title; if($mid) { $info->id = getUrl('','mid',$mid,'act','atom','page',Context::get('page'),'start_date',Context::get('start_date'),'end_date',Context::get('end_date')); }
} else { $info->id = getUrl('','module','rss','act','atom','page',Context::get('page'),'start_date',Context::get('start_date'),'end_date',Context::get('end_date')); }
break;
case 'rss1.0':
$info->date = date('Y-m-d\TH:i:sP');
break;
default:
$info->date = date("D, d M Y H:i:s").' '.$GLOBALS['_time_zone'];
break;
}
$oModuleController->replaceDefinedLangCode($info->title); if($_SERVER['HTTPS']=='on') $proctcl = 'https://';
$info->title = str_replace('\'', '&apos;', htmlspecialchars($info->title)); else $proctcl = 'http://';
$info->description = str_replace('\'', '&apos;', htmlspecialchars($total_config->feed_description));
$info->link = Context::getRequestUri();
$info->feed_copyright = str_replace('\'', '&apos;', htmlspecialchars($total_config->feed_copyright));
}
if($add_description) $info->description .= "\r\n".$add_description;
if($total_config->image) $info->image = Context::getRequestUri().str_replace('\'', '&apos;', htmlspecialchars($total_config->image)); $temp_link = explode('/', $info->link);
switch (Context::get('format')) { if($temp_link[0]=='' && $info->link)
case 'atom': {
$info->date = date('Y-m-d\TH:i:sP'); $info->link = $proctcl.$_SERVER['HTTP_HOST'].$info->link;
if($mid) { $info->id = getUrl('','mid',$mid,'act','atom','page',Context::get('page'),'start_date',Context::get('start_date'),'end_date',Context::get('end_date')); } }
else { $info->id = getUrl('','module','rss','act','atom','page',Context::get('page'),'start_date',Context::get('start_date'),'end_date',Context::get('end_date')); }
break;
case 'rss1.0':
$info->date = date('Y-m-d\TH:i:sP');
break;
default:
$info->date = date("D, d M Y H:i:s").' '.$GLOBALS['_time_zone'];
break;
}
if($_SERVER['HTTPS']=='on') $proctcl = 'https://'; $temp_id = explode('/', $info->id);
else $proctcl = 'http://'; if($temp_id[0]=='' && $info->id)
{
$info->id = $proctcl.$_SERVER['HTTP_HOST'].$info->id;
}
$temp_link = explode('/', $info->link); $info->language = Context::getLangType();
if($temp_link[0]=='' && $info->link) { // Set the variables used in the RSS output
$info->link = $proctcl.$_SERVER['HTTP_HOST'].$info->link; Context::set('info', $info);
} Context::set('feed_config', $config);
Context::set('open_rss_config', $open_rss_config);
Context::set('document_list', $document_list);
// Force the result output to be of XMLRPC
Context::setResponseMethod("XMLRPC");
// Perform the preprocessing function of the editor component as the results are obtained
$path = $this->module_path.'tpl/';
//if($args->start_date || $args->end_date) $file = 'xe_rss';
//else $file = 'rss20';
switch (Context::get('format'))
{
case 'xe':
$file = 'xe_rss';
break;
case 'atom':
$file = 'atom10';
break;
case 'rss1.0':
$file = 'rss10';
break;
default:
$file = 'rss20';
break;
}
$temp_id = explode('/', $info->id); $oTemplate = new TemplateHandler();
if($temp_id[0]=='' && $info->id) {
$info->id = $proctcl.$_SERVER['HTTP_HOST'].$info->id;
}
$info->language = Context::getLangType(); $content = $oTemplate->compile($path, $file);
// Set the variables used in the RSS output Context::set('content', $content);
Context::set('info', $info); // Set the template file
Context::set('feed_config', $config); $this->setTemplatePath($path);
Context::set('open_rss_config', $open_rss_config); $this->setTemplateFile('display');
Context::set('document_list', $document_list); }
// Force the result output to be of XMLRPC
Context::setResponseMethod("XMLRPC");
// Perform the preprocessing function of the editor component as the results are obtained
$path = $this->module_path.'tpl/';
//if($args->start_date || $args->end_date) $file = 'xe_rss';
//else $file = 'rss20';
switch (Context::get('format')) {
case 'xe':
$file = 'xe_rss';
break;
case 'atom':
$file = 'atom10';
break;
case 'rss1.0':
$file = 'rss10';
break;
default:
$file = 'rss20';
break;
}
$oTemplate = new TemplateHandler(); /**
* ATOM output
*
* @return Object
*/
function atom()
{
Context::set('format', 'atom');
$this->rss();
}
$content = $oTemplate->compile($path, $file); /**
Context::set('content', $content); * Error output
// Set the template file *
$this->setTemplatePath($path); * @return Object
$this->setTemplateFile('display'); */
} function dispError()
/** {
* ATOM output // Prepare the output message
* $this->rss(null, null, Context::getLang('msg_rss_is_disabled') );
* @return Object }
**/
function atom() {
Context::set('format', 'atom');
$this->rss();
}
/** /**
* Error output * Additional configurations for a service module
* * Receive the form for the form used by rss
* @return Object *
**/ * @param string $obj Will be inserted content in template
function dispError() { * @return Object
// Prepare the output message */
$this->rss(null, null, Context::getLang('msg_rss_is_disabled') ); function triggerDispRssAdditionSetup(&$obj)
} {
$current_module_srl = Context::get('module_srl');
$current_module_srls = Context::get('module_srls');
/** if(!$current_module_srl && !$current_module_srls)
* Additional configurations for a service module {
* Receive the form for the form used by rss // Get information of the selected module
* $current_module_info = Context::get('current_module_info');
* @param string $obj Will be inserted content in template $current_module_srl = $current_module_info->module_srl;
* @return Object if(!$current_module_srl) return new Object();
**/ }
function triggerDispRssAdditionSetup(&$obj) { // Get teh RSS configurations for the selected module
$current_module_srl = Context::get('module_srl'); $oRssModel = &getModel('rss');
$current_module_srls = Context::get('module_srls'); $rss_config = $oRssModel->getRssModuleConfig($current_module_srl);
Context::set('rss_config', $rss_config);
// Set the template file
$oTemplate = &TemplateHandler::getInstance();
$tpl = $oTemplate->compile($this->module_path.'tpl', 'rss_module_config');
$obj .= $tpl;
if(!$current_module_srl && !$current_module_srls) { return new Object();
// Get information of the selected module }
$current_module_info = Context::get('current_module_info'); }
$current_module_srl = $current_module_info->module_srl; /* End of file rss.view.php */
if(!$current_module_srl) return new Object(); /* Location: ./modules/rss/rss.view.php */
}
// Get teh RSS configurations for the selected module
$oRssModel = &getModel('rss');
$rss_config = $oRssModel->getRssModuleConfig($current_module_srl);
Context::set('rss_config', $rss_config);
// Set the template file
$oTemplate = &TemplateHandler::getInstance();
$tpl = $oTemplate->compile($this->module_path.'tpl', 'rss_module_config');
$obj .= $tpl;
return new Object();
}
}
?>