mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-29 07:12:15 +09:00
Remove unnecessary use of BaseObject
- 트리거 등 반환값이 필요하지 않은 곳에서 new BaseObject()를 반환하는 것 삭제 - 모듈 설치, 업데이트 후 무의미한 new BaseObject()를 반환하는 것 삭제 - 사용자에게 에러 메시지를 돌려주는 용도로 new BaseObject(-1, '에러메시지')를 사용하는 경우는 대부분 $this->setError()로 변경함. 언어 변환과 sprintf() 처리까지 한 번에 이루어지므로 이쪽이 더 편리함.
This commit is contained in:
parent
03d74a984f
commit
84e5542d77
103 changed files with 692 additions and 862 deletions
|
|
@ -170,7 +170,7 @@ class pointAdminController extends point
|
|||
function procPointAdminInsertPointModuleConfig()
|
||||
{
|
||||
$module_srl = Context::get('target_module_srl');
|
||||
if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request');
|
||||
if(!$module_srl) return $this->setError('msg_invalid_request');
|
||||
// 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);
|
||||
|
|
@ -341,7 +341,7 @@ class pointAdminController extends point
|
|||
$position = (int)Context::get('position');
|
||||
$total = (int)Context::get('total');
|
||||
|
||||
if(!file_exists('./files/cache/pointRecal.txt')) return new BaseObject(-1, 'msg_invalid_request');
|
||||
if(!file_exists('./files/cache/pointRecal.txt')) return $this->setError('msg_invalid_request');
|
||||
|
||||
$idx = 0;
|
||||
$f = fopen("./files/cache/pointRecal.txt","r");
|
||||
|
|
@ -384,7 +384,7 @@ class pointAdminController extends point
|
|||
function procPointAdminReset()
|
||||
{
|
||||
$module_srl = Context::get('module_srls');
|
||||
if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request');
|
||||
if(!$module_srl) return $this->setError('msg_invalid_request');
|
||||
// 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);
|
||||
|
|
|
|||
|
|
@ -115,7 +115,6 @@ class point extends ModuleObject
|
|||
$oModuleController->deleteTrigger($trigger[0], $this->module, $trigger[2], $trigger[3], $trigger[1]);
|
||||
}
|
||||
}
|
||||
return new BaseObject(0, 'success_updated');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -158,7 +157,7 @@ class point extends ModuleObject
|
|||
FileHandler::makeDir('./files/member_extra_info/point');
|
||||
|
||||
// Register triggers.
|
||||
return $this->registerTriggers();
|
||||
$this->registerTriggers();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -22,20 +22,18 @@ class pointController extends point
|
|||
$member_srl = $obj->member_srl;
|
||||
if (!$member_srl)
|
||||
{
|
||||
return new BaseObject();
|
||||
return;
|
||||
}
|
||||
|
||||
$config = $this->getConfig();
|
||||
$point = intval($config->signup_point);
|
||||
if (!$point)
|
||||
{
|
||||
return new BaseObject();
|
||||
return;
|
||||
}
|
||||
|
||||
$cur_point = getModel('point')->getPoint($member_srl, true);
|
||||
$this->setPoint($member_srl, $cur_point + $point, 'signup');
|
||||
|
||||
return new BaseObject();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -46,26 +44,24 @@ class pointController extends point
|
|||
$member_srl = $obj->member_srl;
|
||||
if (!$member_srl)
|
||||
{
|
||||
return new BaseObject();
|
||||
return;
|
||||
}
|
||||
|
||||
// Points are given only once a day.
|
||||
if (substr($obj->last_login, 0, 8) === date('Ymd'))
|
||||
{
|
||||
return new BaseObject();
|
||||
return;
|
||||
}
|
||||
|
||||
$config = $this->getConfig();
|
||||
$point = intval($config->login_point);
|
||||
if (!$point)
|
||||
{
|
||||
return new BaseObject();
|
||||
return;
|
||||
}
|
||||
|
||||
$cur_point = getModel('point')->getPoint($member_srl, true);
|
||||
$this->setPoint($member_srl, $cur_point + $point);
|
||||
|
||||
return new BaseObject();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -82,8 +78,6 @@ class pointController extends point
|
|||
unset($config->point_group[$group_srl]);
|
||||
getController('module')->insertModuleConfig('point', $config);
|
||||
}
|
||||
|
||||
return new BaseObject();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -95,17 +89,17 @@ class pointController extends point
|
|||
$member_srl = abs($obj->member_srl);
|
||||
if (!$module_srl || !$member_srl)
|
||||
{
|
||||
return new BaseObject();
|
||||
return;
|
||||
}
|
||||
|
||||
// The fix to disable giving points for saving the document temporarily
|
||||
if ($module_srl == $member_srl)
|
||||
{
|
||||
return new BaseObject();
|
||||
return;
|
||||
}
|
||||
if ($obj->status === getModel('document')->getConfigStatus('temp'))
|
||||
{
|
||||
return new BaseObject();
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the points of the member
|
||||
|
|
@ -124,7 +118,6 @@ class pointController extends point
|
|||
|
||||
// Increase the point.
|
||||
$this->setPoint($member_srl, $cur_point);
|
||||
return new BaseObject();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -140,7 +133,7 @@ class pointController extends point
|
|||
$member_srl = abs($oDocument->get('member_srl'));
|
||||
if (!$module_srl || !$member_srl)
|
||||
{
|
||||
return new BaseObject();
|
||||
return;
|
||||
}
|
||||
|
||||
// Only give points if the document is being updated from TEMP to another status such as PUBLIC.
|
||||
|
|
@ -153,7 +146,7 @@ class pointController extends point
|
|||
$cur_point += $attached_files_point * ($obj->uploaded_count - $oDocument->get('uploaded_count'));
|
||||
$this->setPoint($member_srl, $cur_point);
|
||||
}
|
||||
return new BaseObject();
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the points of the member
|
||||
|
|
@ -172,7 +165,6 @@ class pointController extends point
|
|||
|
||||
// Increase the point.
|
||||
$this->setPoint($member_srl, $cur_point);
|
||||
return new BaseObject();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -180,7 +172,7 @@ class pointController extends point
|
|||
*/
|
||||
public function triggerBeforeDeleteDocument($obj)
|
||||
{
|
||||
return new BaseObject();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -192,17 +184,17 @@ class pointController extends point
|
|||
$member_srl = abs($obj->member_srl);
|
||||
if (!$module_srl || !$member_srl)
|
||||
{
|
||||
return new BaseObject();
|
||||
return;
|
||||
}
|
||||
|
||||
// The fix to disable giving points for saving the document temporarily
|
||||
if ($module_srl == $member_srl)
|
||||
{
|
||||
return new BaseObject();
|
||||
return;
|
||||
}
|
||||
if ($obj->status === getModel('document')->getConfigStatus('temp'))
|
||||
{
|
||||
return new BaseObject();
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the points of the member
|
||||
|
|
@ -217,7 +209,6 @@ class pointController extends point
|
|||
|
||||
// Increase the point.
|
||||
$this->setPoint($member_srl, $cur_point);
|
||||
return new BaseObject();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -229,21 +220,21 @@ class pointController extends point
|
|||
$member_srl = abs($obj->member_srl);
|
||||
if (!$module_srl || !$member_srl)
|
||||
{
|
||||
return new BaseObject();
|
||||
return;
|
||||
}
|
||||
|
||||
// Abort if the comment and the document have the same author.
|
||||
$oDocument = getModel('document')->getDocument($obj->document_srl);
|
||||
if (!$oDocument->isExists() || abs($oDocument->get('member_srl')) == $member_srl)
|
||||
{
|
||||
return new BaseObject();
|
||||
return;
|
||||
}
|
||||
|
||||
// Abort if the document is older than a configured limit.
|
||||
$config = $this->getConfig();
|
||||
if ($config->no_point_date > 0 && ztime($oDocument->get('regdate')) < time() - ($config->no_point_date * 86400))
|
||||
{
|
||||
return new BaseObject();
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the points of the member
|
||||
|
|
@ -262,7 +253,6 @@ class pointController extends point
|
|||
|
||||
// Increase the point.
|
||||
$this->setPoint($member_srl, $cur_point);
|
||||
return new BaseObject();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -270,7 +260,7 @@ class pointController extends point
|
|||
*/
|
||||
public function triggerUpdateComment($obj)
|
||||
{
|
||||
return new BaseObject();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -282,21 +272,21 @@ class pointController extends point
|
|||
$member_srl = abs($obj->member_srl);
|
||||
if (!$module_srl || !$member_srl)
|
||||
{
|
||||
return new BaseObject();
|
||||
return;
|
||||
}
|
||||
|
||||
// Abort if the comment and the document have the same author.
|
||||
$oDocument = getModel('document')->getDocument($obj->document_srl);
|
||||
if (!$oDocument->isExists() || abs($oDocument->get('member_srl')) == $member_srl)
|
||||
{
|
||||
return new BaseObject();
|
||||
return;
|
||||
}
|
||||
|
||||
// Abort if the document is older than a configured limit.
|
||||
$config = $this->getConfig();
|
||||
if ($config->no_point_date > 0 && ztime($oDocument->get('regdate')) < ztime($obj->regdate) - ($config->no_point_date * 86400))
|
||||
{
|
||||
return new BaseObject();
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the points of the member
|
||||
|
|
@ -308,7 +298,6 @@ class pointController extends point
|
|||
|
||||
// Increase the point.
|
||||
$this->setPoint($member_srl, $cur_point);
|
||||
return new BaseObject();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -317,7 +306,7 @@ class pointController extends point
|
|||
*/
|
||||
public function triggerInsertFile($obj)
|
||||
{
|
||||
return new BaseObject();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -330,7 +319,7 @@ class pointController extends point
|
|||
$member_srl = abs($obj->member_srl);
|
||||
if (!$module_srl || !$member_srl || $obj->isvalid !== 'Y')
|
||||
{
|
||||
return new BaseObject();
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the points of the member
|
||||
|
|
@ -342,7 +331,6 @@ class pointController extends point
|
|||
|
||||
// Update the point.
|
||||
$this->setPoint($member_srl, $cur_point);
|
||||
return new BaseObject();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -356,13 +344,13 @@ class pointController extends point
|
|||
|
||||
if ($member_srl && abs($obj->member_srl) == $member_srl)
|
||||
{
|
||||
return new BaseObject();
|
||||
return;
|
||||
}
|
||||
|
||||
$point = $this->_getModulePointConfig($module_srl, 'download_file');
|
||||
if (!$point)
|
||||
{
|
||||
return new BaseObject();
|
||||
return;
|
||||
}
|
||||
|
||||
// Get current points.
|
||||
|
|
@ -376,7 +364,6 @@ class pointController extends point
|
|||
}
|
||||
|
||||
// Points will be adjusted after downloading (triggerDownloadFile).
|
||||
return new BaseObject();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -390,19 +377,17 @@ class pointController extends point
|
|||
|
||||
if (!$member_srl || abs($obj->member_srl) == $member_srl)
|
||||
{
|
||||
return new BaseObject();
|
||||
return;
|
||||
}
|
||||
|
||||
$point = $this->_getModulePointConfig($module_srl, 'download_file');
|
||||
if (!$point)
|
||||
{
|
||||
return new BaseObject();
|
||||
return;
|
||||
}
|
||||
|
||||
$cur_point = getModel('point')->getPoint($member_srl, true);
|
||||
$this->setPoint($member_srl, $cur_point + $point);
|
||||
|
||||
return new BaseObject();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -417,13 +402,13 @@ class pointController extends point
|
|||
$target_member_srl = abs($obj->get('member_srl'));
|
||||
if ($member_srl && $target_member_srl == $member_srl)
|
||||
{
|
||||
return new BaseObject();
|
||||
return;
|
||||
}
|
||||
|
||||
$point = $this->_getModulePointConfig($module_srl, 'read_document');
|
||||
if (!$point)
|
||||
{
|
||||
return new BaseObject();
|
||||
return;
|
||||
}
|
||||
|
||||
// If the current member has already read this document, do not adjust points again.
|
||||
|
|
@ -435,7 +420,7 @@ class pointController extends point
|
|||
$output = executeQuery('document.getDocumentReadedLogInfo', $args);
|
||||
if ($output->data->count)
|
||||
{
|
||||
return new BaseObject();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -465,8 +450,6 @@ class pointController extends point
|
|||
$output = executeQuery('document.insertDocumentReadedLog', $args);
|
||||
$this->setPoint($member_srl, $cur_point + $point);
|
||||
}
|
||||
|
||||
return new BaseObject();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -480,11 +463,11 @@ class pointController extends point
|
|||
$member_srl = abs($obj->member_srl);
|
||||
if ($logged_member_srl && $logged_member_srl == $member_srl)
|
||||
{
|
||||
return new BaseObject();
|
||||
return;
|
||||
}
|
||||
elseif (!$member_srl)
|
||||
{
|
||||
return new BaseObject();
|
||||
return;
|
||||
}
|
||||
|
||||
// Get current points.
|
||||
|
|
@ -503,7 +486,7 @@ class pointController extends point
|
|||
$point = $this->_getModulePointConfig($module_srl, $config_key);
|
||||
if (!$point)
|
||||
{
|
||||
return new BaseObject();
|
||||
return;
|
||||
}
|
||||
|
||||
if (isset($obj->cancel) && $obj->cancel)
|
||||
|
|
@ -512,8 +495,6 @@ class pointController extends point
|
|||
}
|
||||
|
||||
$this->setPoint($member_srl, $cur_point + $point);
|
||||
|
||||
return new BaseObject();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class pointView extends point
|
|||
{
|
||||
$current_module_info = Context::get('current_module_info');
|
||||
$current_module_srl = $current_module_info->module_srl;
|
||||
if(!$current_module_srl) return new BaseObject();
|
||||
if(!$current_module_srl) return;
|
||||
}
|
||||
// Get the configuration information
|
||||
$oModuleModel = getModel('module');
|
||||
|
|
@ -60,8 +60,6 @@ class pointView extends point
|
|||
$oTemplate = &TemplateHandler::getInstance();
|
||||
$tpl = $oTemplate->compile($this->module_path.'tpl', 'point_module_config');
|
||||
$obj .= $tpl;
|
||||
|
||||
return new BaseObject();
|
||||
}
|
||||
}
|
||||
/* End of file point.view.php */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue