mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-28 07:39:55 +09:00
Merge branch 'develop' into pr/multidomain
This commit is contained in:
commit
8d53304e71
30 changed files with 971 additions and 806 deletions
81
README.md
81
README.md
|
|
@ -1,3 +1,4 @@
|
||||||
|
# 한국어
|
||||||
[](https://www.rhymix.org)
|
[](https://www.rhymix.org)
|
||||||
|
|
||||||
Rhymix(라이믹스)는 누구든지 쉽고 자유롭게 독립적인 홈페이지를 만들어
|
Rhymix(라이믹스)는 누구든지 쉽고 자유롭게 독립적인 홈페이지를 만들어
|
||||||
|
|
@ -21,7 +22,7 @@ Rhymix는 개발자와 사용자가 서로의 권리와 책임을 존중하는
|
||||||
개발자 위주, 서비스 제공자 위주로 나아가는 현대의 IT 동향을 무차별적으로 받아들이기보다는
|
개발자 위주, 서비스 제공자 위주로 나아가는 현대의 IT 동향을 무차별적으로 받아들이기보다는
|
||||||
사용자의 주권과 열린 인터넷 환경을 보호하는 기술을 집중적으로 발굴하며,
|
사용자의 주권과 열린 인터넷 환경을 보호하는 기술을 집중적으로 발굴하며,
|
||||||
우리나라 인터넷 커뮤니티의 성장을 이끌었던 90년대 제로보드와 2000년대 XE의 정신을 이어받아
|
우리나라 인터넷 커뮤니티의 성장을 이끌었던 90년대 제로보드와 2000년대 XE의 정신을 이어받아
|
||||||
2016년 현재 위기에 처한 오픈 웹을 지키고 회복시키는 일에 앞장서고자 합니다.
|
2010년대 후반 현재 위기에 처한 오픈 웹을 지키고 회복시키는 일에 앞장서고자 합니다.
|
||||||
|
|
||||||
그러기 위해서는 다른 어떤 CMS보다도 일반 사용자를 위한 편리성이 가장 뛰어나야 합니다.
|
그러기 위해서는 다른 어떤 CMS보다도 일반 사용자를 위한 편리성이 가장 뛰어나야 합니다.
|
||||||
|
|
||||||
|
|
@ -72,13 +73,13 @@ Rhymix는 [GNU GPL v2](http://korea.gnu.org/documents/copyleft/gpl.ko.html)
|
||||||
개발자와 사용자의 자유와 권리, 참여와 책임을 강조하는 프로그램으로
|
개발자와 사용자의 자유와 권리, 참여와 책임을 강조하는 프로그램으로
|
||||||
누구나 무료로 사용할 수 있고 개발에 참여할 수도 있습니다.
|
누구나 무료로 사용할 수 있고 개발에 참여할 수도 있습니다.
|
||||||
|
|
||||||
Rhymix는 [NAVER](https://www.navercorp.com/)가 저작권을 가진
|
Rhymix는 [NAVER](https://www.navercorp.com/)가 일부 저작권을 가진
|
||||||
[XpressEngine](https://www.xpressengine.com)의 소스코드에 바탕을 두고 있습니다.
|
[XpressEngine](https://www.xpressengine.com)의 소스코드에 바탕을 두고 있습니다.
|
||||||
Rhymix 개발자들이 추가 및 변경한 부분의 저작권은 해당 개발자들에게 있습니다.
|
Rhymix 개발자들이 추가 및 변경한 부분의 저작권은 해당 개발자들에게 있습니다.
|
||||||
|
|
||||||
XpressEngine은 초창기에 GPL을 사용하다가 버전 1.4.0부터 LGPL로 전환했지만,
|
XpressEngine은 초창기에 GPL을 사용하다가 버전 1.4.0부터 LGPL로 전환했지만,
|
||||||
Rhymix는 사용자의 권리를 더욱 보호하고 자유 소프트웨어 본연의 정신에 충실하기 위해 라이선스를 GPL로 되돌렸습니다.
|
Rhymix는 사용자의 권리를 더욱 보호하고 자유 소프트웨어 본연의 정신에 충실하기 위해 라이선스를 GPL로 되돌렸습니다.
|
||||||
(라이선스 전환은 [LGPL v2.1 제3조](http://korea.gnu.org/people/chsong/copyleft/lgpl.ko.html#term3)에서 허용하고 있습니다.)
|
(라이선스 전환은 [LGPL v2.1 제3조](http://korea.gnu.org/documents/copyleft/lgpl.ko.html#term3)에서 허용하고 있습니다.)
|
||||||
|
|
||||||
GPL은 WordPress, Drupal, Joomla 등 세계적인 CMS들이 공통으로 채택하고 있는 라이선스이므로
|
GPL은 WordPress, Drupal, Joomla 등 세계적인 CMS들이 공통으로 채택하고 있는 라이선스이므로
|
||||||
사용자 및 개발자의 권리와 의무도 이러한 CMS들의 경우와 동일합니다.
|
사용자 및 개발자의 권리와 의무도 이러한 CMS들의 경우와 동일합니다.
|
||||||
|
|
@ -87,3 +88,77 @@ GPL은 WordPress, Drupal, Joomla 등 세계적인 CMS들이 공통으로 채택
|
||||||
Rhymix의 소스코드를 수정하거나 확장 기능을 직접 개발하여 사용하더라도 마찬가지입니다.
|
Rhymix의 소스코드를 수정하거나 확장 기능을 직접 개발하여 사용하더라도 마찬가지입니다.
|
||||||
그러나 직접 개발한 확장 기능을 제3자에게 배포 또는 판매할 경우에는 반드시 소스코드를 제공해야 하며,
|
그러나 직접 개발한 확장 기능을 제3자에게 배포 또는 판매할 경우에는 반드시 소스코드를 제공해야 하며,
|
||||||
이러한 소스코드는 모두 GPL 라이선스의 적용을 받습니다.
|
이러한 소스코드는 모두 GPL 라이선스의 적용을 받습니다.
|
||||||
|
|
||||||
|
# English
|
||||||
|
[](https://www.rhymix.org)
|
||||||
|
|
||||||
|
Rhymix is a content management system (CMS) for anyone who wants to create independent homepages to express themselves and grow their communities easily and freely.
|
||||||
|
|
||||||
|
Rhymix is a project to fork [XpressEngine](https://www.xpressengine.com) version 1.8 and is free software that anyone can use for free and participate in.
|
||||||
|
|
||||||
|
Rhymix is a combination of "rhyme" in the sense of "making a poem, adjusting the sound", and "remix" in the sense of "combining, changing".
|
||||||
|
Rhymix cheers everyone who freely creates and/or assembles new things in the Internet space by combining various software and contents.
|
||||||
|
|
||||||
|
### Development Direction
|
||||||
|
|
||||||
|
Rhymix developers want an Internet ecosystem where developers and users respect each other's rights and responsibilities,
|
||||||
|
a world where everyone can voice their voice without relying on a centralized SNS platform,
|
||||||
|
a future where ordinary bloggers, students, the disabled and others as well as developers of startups can build a home in cyberspace and communicate with each other.
|
||||||
|
|
||||||
|
Rather than indiscriminately accepting modern IT trends that are centered on developers and service providers,
|
||||||
|
we focused on technologies that protect users' sovereignty and open Internet environment. Taking the spirit of ZeroBoard and XpressEngine, which led the growth of the Korean Internet communities in the 1990s and 2000s respectively, Rhymix wants to take the lead in recovering and restoring the open web in the crisis of late 2010s.
|
||||||
|
|
||||||
|
|
||||||
|
This requires the most convenience for the average user over any other CMS.
|
||||||
|
|
||||||
|
- CMS that is convenient enough for beginners to easily create the website with a few clicks
|
||||||
|
- CMS that is actively using the latest technology, fast and secure
|
||||||
|
- CMS to help users and developers communicate well through community
|
||||||
|
- We try to ensure maximum compatibility with existing XpressEngine third-party materials such as add-ons, modules and widgets.
|
||||||
|
|
||||||
|
### Installation Environment
|
||||||
|
|
||||||
|
To use Rhymix, you must have a web hosting or server that meets the following requirements.
|
||||||
|
|
||||||
|
- PHP 5.5.9 or higher (PHP 7 recommended)
|
||||||
|
- MySQL 5.0.7 or higher (MariaDB recommended)
|
||||||
|
- Required PHP module
|
||||||
|
- curl
|
||||||
|
- gd
|
||||||
|
- iconv or mbstring
|
||||||
|
- json
|
||||||
|
- mcrypt or openssl
|
||||||
|
- simplexml
|
||||||
|
- In php.ini, session.auto_start = Off should be set.
|
||||||
|
- The installation folder or the files folder must have write permission.
|
||||||
|
|
||||||
|
### Participation in Development
|
||||||
|
|
||||||
|
Rhymix welcomes developers, designers, translators, and bugs to the public.
|
||||||
|
If you would like to participate, please read [CONTRIBUTING.md](./CONTRIBUTING.md) first to ensure efficient and orderly project management.
|
||||||
|
|
||||||
|
If you have found a security vulnerability, please let us know at devops@rhymix.org so that we can create a patch before it is exploited.
|
||||||
|
|
||||||
|
### Official Website
|
||||||
|
|
||||||
|
- Rhymix : https://www.rhymix.org
|
||||||
|
|
||||||
|
### Community
|
||||||
|
|
||||||
|
- XETOWN (Korean) : https://www.xetown.com
|
||||||
|
|
||||||
|
### Copyright and License
|
||||||
|
|
||||||
|
Rhymix is a free software licensed under the [GNU GPL v2](http://korea.gnu.org/documents/copyleft/gpl.ko.html) or later.
|
||||||
|
Free software, also known as "open source" or "open", is a program that emphasizes the freedom and rights of developers and users, their participation and responsibilities, and is free to use and participate in development.
|
||||||
|
|
||||||
|
Rhymix is based on the source code of [XpressEngine](https://www.xpressengine.com), which [NAVER](https://www.navercorp.com/) is partly copyrighted free software.
|
||||||
|
Rhymix developers have copyrights on the added and modified code.
|
||||||
|
|
||||||
|
XpressEngine had used the GPL in its early days and switched from version 1.4.0 to LGPL, but Rhymix has reverted its licenses to the GPL to further protect its rights and adhere to the spirit of free software.
|
||||||
|
(License conversion is allowed in [LGPL v2.1 Section 3](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html).)
|
||||||
|
|
||||||
|
GPL is a license that is commonly adopted by global CMSs such as WordPress, Drupal, and Joomla, so the rights and obligations of users and developers are the same as those of CMS.
|
||||||
|
|
||||||
|
The use of Rhymix on the homepage does not oblige you to release the source code, even if you modify the Rhymix source code or develop the extension yourself.
|
||||||
|
However, if you distribute or sell your own extensions to a third party, you must provide the source code, which is subject to the GPL license.
|
||||||
|
|
|
||||||
|
|
@ -698,9 +698,10 @@ class Session
|
||||||
*
|
*
|
||||||
* This method returns an object, or false if nobody is logged in.
|
* This method returns an object, or false if nobody is logged in.
|
||||||
*
|
*
|
||||||
|
* @param bool $refresh
|
||||||
* @return object|false
|
* @return object|false
|
||||||
*/
|
*/
|
||||||
public static function getMemberInfo()
|
public static function getMemberInfo($refresh = false)
|
||||||
{
|
{
|
||||||
// Return false if the current user is not logged in.
|
// Return false if the current user is not logged in.
|
||||||
$member_srl = self::getMemberSrl();
|
$member_srl = self::getMemberSrl();
|
||||||
|
|
@ -710,7 +711,7 @@ class Session
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a member info object.
|
// Create a member info object.
|
||||||
if (!self::$_member_info || self::$_member_info->member_srl != $member_srl)
|
if (!self::$_member_info || self::$_member_info->member_srl != $member_srl || $refresh)
|
||||||
{
|
{
|
||||||
self::$_member_info = new Helpers\SessionHelper($member_srl);
|
self::$_member_info = new Helpers\SessionHelper($member_srl);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ body {
|
||||||
/* Layout */
|
/* Layout */
|
||||||
.layout_canvas {
|
.layout_canvas {
|
||||||
position: relative;
|
position: relative;
|
||||||
max-width:960px;
|
max-width:1050px;
|
||||||
width:100%;
|
width:100%;
|
||||||
margin:0 auto;
|
margin:0 auto;
|
||||||
}
|
}
|
||||||
|
|
@ -189,7 +189,7 @@ header.layout_frame {
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
max-width:960px;
|
max-width:1050px;
|
||||||
margin:0 auto;
|
margin:0 auto;
|
||||||
}
|
}
|
||||||
.layout_menu>ul{
|
.layout_menu>ul{
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ class boardController extends board
|
||||||
$obj->update_log_setting = 'Y';
|
$obj->update_log_setting = 'Y';
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the document if it is existed
|
// UPDATE if the document already exists.
|
||||||
if($is_update)
|
if($is_update)
|
||||||
{
|
{
|
||||||
if(!$oDocument->isGranted())
|
if(!$oDocument->isGranted())
|
||||||
|
|
@ -163,14 +163,20 @@ class boardController extends board
|
||||||
$obj->reason_update = escape($obj->reason_update);
|
$obj->reason_update = escape($obj->reason_update);
|
||||||
$output = $oDocumentController->updateDocument($oDocument, $obj, $bAnonymous);
|
$output = $oDocumentController->updateDocument($oDocument, $obj, $bAnonymous);
|
||||||
$msg_code = 'success_updated';
|
$msg_code = 'success_updated';
|
||||||
|
|
||||||
// insert a new document otherwise
|
|
||||||
}
|
}
|
||||||
|
// INSERT a new document.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$output = $oDocumentController->insertDocument($obj, $bAnonymous);
|
$output = $oDocumentController->insertDocument($obj, $bAnonymous);
|
||||||
$msg_code = 'success_registed';
|
$msg_code = 'success_registed';
|
||||||
$obj->document_srl = $output->get('document_srl');
|
$obj->document_srl = $output->get('document_srl');
|
||||||
|
|
||||||
|
// Set grant for the new document.
|
||||||
|
if ($output->toBool())
|
||||||
|
{
|
||||||
|
$oDocument = $oDocumentModel->getDocument($output->get('document_srl'));
|
||||||
|
$oDocument->setGrantForSession();
|
||||||
|
}
|
||||||
|
|
||||||
// send an email to admin user
|
// send an email to admin user
|
||||||
if($output->toBool() && $this->module_info->admin_mail)
|
if($output->toBool() && $this->module_info->admin_mail)
|
||||||
|
|
@ -421,11 +427,10 @@ class boardController extends board
|
||||||
return new Object(-1, 'msg_admin_comment_no_modify');
|
return new Object(-1, 'msg_admin_comment_no_modify');
|
||||||
}
|
}
|
||||||
|
|
||||||
// if comment_srl is not existed, then insert the comment
|
// INSERT if comment_srl does not exist.
|
||||||
if($comment->comment_srl != $obj->comment_srl)
|
if($comment->comment_srl != $obj->comment_srl)
|
||||||
{
|
{
|
||||||
|
// Parent exists.
|
||||||
// parent_srl is existed
|
|
||||||
if($obj->parent_srl)
|
if($obj->parent_srl)
|
||||||
{
|
{
|
||||||
$parent_comment = $oCommentModel->getComment($obj->parent_srl);
|
$parent_comment = $oCommentModel->getComment($obj->parent_srl);
|
||||||
|
|
@ -433,17 +438,21 @@ class boardController extends board
|
||||||
{
|
{
|
||||||
return new Object(-1, 'msg_invalid_request');
|
return new Object(-1, 'msg_invalid_request');
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = $oCommentController->insertComment($obj, $bAnonymous);
|
$output = $oCommentController->insertComment($obj, $bAnonymous);
|
||||||
|
|
||||||
// parent_srl is not existed
|
|
||||||
}
|
}
|
||||||
|
// Parent does not exist.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$output = $oCommentController->insertComment($obj, $bAnonymous);
|
$output = $oCommentController->insertComment($obj, $bAnonymous);
|
||||||
}
|
}
|
||||||
// update the comment if it is not existed
|
// Set grant for the new comment.
|
||||||
|
if ($output->toBool())
|
||||||
|
{
|
||||||
|
$comment = $oCommentModel->getComment($output->get('comment_srl'));
|
||||||
|
$comment->setGrantForSession();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// UPDATE if comment_srl already exists.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if($this->module_info->protect_comment_regdate > 0 && $this->grant->manager == false)
|
if($this->module_info->protect_comment_regdate > 0 && $this->grant->manager == false)
|
||||||
|
|
@ -460,7 +469,6 @@ class boardController extends board
|
||||||
{
|
{
|
||||||
return new Object(-1,'msg_not_permitted');
|
return new Object(-1,'msg_not_permitted');
|
||||||
}
|
}
|
||||||
|
|
||||||
$obj->parent_srl = $comment->parent_srl;
|
$obj->parent_srl = $comment->parent_srl;
|
||||||
$output = $oCommentController->updateComment($obj, $this->grant->manager);
|
$output = $oCommentController->updateComment($obj, $this->grant->manager);
|
||||||
}
|
}
|
||||||
|
|
@ -609,7 +617,7 @@ class boardController extends board
|
||||||
return new Object(-1, 'msg_invalid_password');
|
return new Object(-1, 'msg_invalid_password');
|
||||||
}
|
}
|
||||||
|
|
||||||
$oComment->setGrant();
|
$oComment->setGrantForSession();
|
||||||
} else {
|
} else {
|
||||||
// get the document information
|
// get the document information
|
||||||
$oDocumentModel = getModel('document');
|
$oDocumentModel = getModel('document');
|
||||||
|
|
@ -625,7 +633,7 @@ class boardController extends board
|
||||||
return new Object(-1, 'msg_invalid_password');
|
return new Object(-1, 'msg_invalid_password');
|
||||||
}
|
}
|
||||||
|
|
||||||
$oDocument->setGrant();
|
$oDocument->setGrantForSession();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -255,7 +255,11 @@ class commentController extends comment
|
||||||
*/
|
*/
|
||||||
function addGrant($comment_srl)
|
function addGrant($comment_srl)
|
||||||
{
|
{
|
||||||
$_SESSION['own_comment'][$comment_srl] = TRUE;
|
$comment = getModel('comment')->getComment($comment_srl);
|
||||||
|
if ($comment->isExists())
|
||||||
|
{
|
||||||
|
$comment->setGrant();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -568,18 +572,18 @@ class commentController extends comment
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// grant autority of the comment
|
|
||||||
if(!$manual_inserted)
|
|
||||||
{
|
|
||||||
$this->addGrant($obj->comment_srl);
|
|
||||||
}
|
|
||||||
|
|
||||||
// call a trigger(after)
|
// call a trigger(after)
|
||||||
ModuleHandler::triggerCall('comment.insertComment', 'after', $obj);
|
ModuleHandler::triggerCall('comment.insertComment', 'after', $obj);
|
||||||
|
|
||||||
// commit
|
// commit
|
||||||
$oDB->commit();
|
$oDB->commit();
|
||||||
|
|
||||||
|
// grant autority of the comment
|
||||||
|
if(!$manual_inserted)
|
||||||
|
{
|
||||||
|
$this->addGrant($obj->comment_srl);
|
||||||
|
}
|
||||||
|
|
||||||
if(!$manual_inserted)
|
if(!$manual_inserted)
|
||||||
{
|
{
|
||||||
// send a message if notify_message option in enabled in the original article
|
// send a message if notify_message option in enabled in the original article
|
||||||
|
|
@ -1525,14 +1529,28 @@ class commentController extends comment
|
||||||
*/
|
*/
|
||||||
function procCommentInsertModuleConfig()
|
function procCommentInsertModuleConfig()
|
||||||
{
|
{
|
||||||
$module_srl = Context::get('target_module_srl');
|
$target_module_srl = Context::get('target_module_srl');
|
||||||
if(preg_match('/^([0-9,]+)$/', $module_srl))
|
$target_module_srl = array_map('trim', explode(',', $target_module_srl));
|
||||||
|
$logged_info = Context::get('logged_info');
|
||||||
|
$module_srl = array();
|
||||||
|
$oModuleModel = getModel('module');
|
||||||
|
foreach ($target_module_srl as $srl)
|
||||||
{
|
{
|
||||||
$module_srl = explode(',', $module_srl);
|
if (!$srl) continue;
|
||||||
}
|
|
||||||
else
|
$module_info = $oModuleModel->getModuleInfoByModuleSrl($srl);
|
||||||
{
|
if (!$module_info->module_srl)
|
||||||
$module_srl = array($module_srl);
|
{
|
||||||
|
return new Object(-1, 'msg_invalid_request');
|
||||||
|
}
|
||||||
|
|
||||||
|
$module_grant = $oModuleModel->getGrant($module_info, $logged_info);
|
||||||
|
if (!$module_grant->manager)
|
||||||
|
{
|
||||||
|
return new Object(-1, 'msg_not_permitted');
|
||||||
|
}
|
||||||
|
|
||||||
|
$module_srl[] = $srl;
|
||||||
}
|
}
|
||||||
|
|
||||||
$comment_config = new stdClass();
|
$comment_config = new stdClass();
|
||||||
|
|
@ -1560,14 +1578,8 @@ class commentController extends comment
|
||||||
$comment_config->use_comment_validation = 'N';
|
$comment_config->use_comment_validation = 'N';
|
||||||
}
|
}
|
||||||
|
|
||||||
for($i = 0; $i < count($module_srl); $i++)
|
foreach ($module_srl as $srl)
|
||||||
{
|
{
|
||||||
$srl = trim($module_srl[$i]);
|
|
||||||
if(!$srl)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$output = $this->setCommentModuleConfig($srl, $comment_config);
|
$output = $this->setCommentModuleConfig($srl, $comment_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ class commentItem extends Object
|
||||||
|
|
||||||
function isGranted()
|
function isGranted()
|
||||||
{
|
{
|
||||||
if($_SESSION['own_comment'][$this->comment_srl])
|
if($_SESSION['granted_comment'][$this->comment_srl])
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
@ -125,10 +125,15 @@ class commentItem extends Object
|
||||||
|
|
||||||
function setGrant()
|
function setGrant()
|
||||||
{
|
{
|
||||||
$_SESSION['own_comment'][$this->comment_srl] = TRUE;
|
|
||||||
$this->is_granted = TRUE;
|
$this->is_granted = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setGrantForSession()
|
||||||
|
{
|
||||||
|
$_SESSION['granted_comment'][$this->comment_srl] = true;
|
||||||
|
$this->setGrant();
|
||||||
|
}
|
||||||
|
|
||||||
function setAccessible()
|
function setAccessible()
|
||||||
{
|
{
|
||||||
if(Context::getSessionStatus())
|
if(Context::getSessionStatus())
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ class commentModel extends comment
|
||||||
*/
|
*/
|
||||||
function isGranted($comment_srl)
|
function isGranted($comment_srl)
|
||||||
{
|
{
|
||||||
return $_SESSION['own_comment'][$comment_srl];
|
return $_SESSION['granted_comment'][$comment_srl];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -331,7 +331,11 @@ class documentController extends document
|
||||||
*/
|
*/
|
||||||
function addGrant($document_srl)
|
function addGrant($document_srl)
|
||||||
{
|
{
|
||||||
$_SESSION['own_document'][$document_srl] = true;
|
$oDocument = getModel('document')->getDocument($document_srl);
|
||||||
|
if ($oDocument->isExists())
|
||||||
|
{
|
||||||
|
$oDocument->setGrant();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -2480,22 +2484,20 @@ class documentController extends document
|
||||||
{
|
{
|
||||||
@set_time_limit(0);
|
@set_time_limit(0);
|
||||||
if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
|
if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
|
||||||
|
$logged_info = Context::get('logged_info');
|
||||||
|
|
||||||
if(!checkCSRF())
|
// Get request parameters.
|
||||||
{
|
$cart = Context::get('cart');
|
||||||
return new Object(-1, 'msg_invalid_request');
|
if(!is_array($cart)) $cart = explode('|@|', $cart);
|
||||||
}
|
$cart = array_unique(array_map('intval', $cart));
|
||||||
|
|
||||||
$type = Context::get('type');
|
$type = Context::get('type');
|
||||||
$target_module = Context::get('target_module');
|
$target_module_srl = intval(Context::get('module_srl') ?: Context::get('target_module'));
|
||||||
$module_srl = Context::get('module_srl');
|
$target_category_srl = Context::get('target_category');
|
||||||
if($target_module && !$module_srl) $module_srl = $target_module;
|
|
||||||
$category_srl = Context::get('target_category');
|
|
||||||
// send default message - misol 2015-07-23
|
// send default message - misol 2015-07-23
|
||||||
$send_default_message = Context::get('send_default_message');
|
$send_default_message = Context::get('send_default_message');
|
||||||
if($send_default_message === 'Y')
|
if($send_default_message === 'Y')
|
||||||
{
|
{
|
||||||
$logged_info = Context::get('logged_info');
|
|
||||||
$message_content = '';
|
$message_content = '';
|
||||||
$default_message_verbs = lang('default_message_verbs');
|
$default_message_verbs = lang('default_message_verbs');
|
||||||
if(isset($default_message_verbs[$type]) && is_string($default_message_verbs[$type]))
|
if(isset($default_message_verbs[$type]) && is_string($default_message_verbs[$type]))
|
||||||
|
|
@ -2509,31 +2511,54 @@ class documentController extends document
|
||||||
if($message_content) $message_content = nl2br($message_content);
|
if($message_content) $message_content = nl2br($message_content);
|
||||||
}
|
}
|
||||||
|
|
||||||
$cart = Context::get('cart');
|
// Check permissions on all documents.
|
||||||
if(!is_array($cart)) $document_srl_list = explode('|@|', $cart);
|
|
||||||
else $document_srl_list = $cart;
|
|
||||||
|
|
||||||
$document_srl_count = count($document_srl_list);
|
|
||||||
|
|
||||||
$oDocumentModel = getModel('document');
|
|
||||||
$document_items = array();
|
$document_items = array();
|
||||||
foreach($document_srl_list as $document_srl)
|
$document_srl_list = array();
|
||||||
|
$module_srl_list = array();
|
||||||
|
$oDocumentModel = getModel('document');
|
||||||
|
foreach ($cart as $document_srl)
|
||||||
{
|
{
|
||||||
$oDocument = $oDocumentModel->getDocument($document_srl);
|
$oDocument = $oDocumentModel->getDocument($document_srl);
|
||||||
$document_items[] = $oDocument;
|
$document_items[] = $oDocument;
|
||||||
if(!$oDocument->isGranted()) return $this->stop('msg_not_permitted');
|
$document_srl_list[] = $document_srl;
|
||||||
|
$module_srl_list[] = $oDocument->get('module_srl');
|
||||||
|
if (!$oDocument->isGranted())
|
||||||
|
{
|
||||||
|
return $this->stop('msg_not_permitted');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check permissions on all modules.
|
||||||
|
$oModuleModel = getModel('module');
|
||||||
|
if ($target_module_srl && !in_array($target_module_srl, $module_srl_list))
|
||||||
|
{
|
||||||
|
$module_srl_list[] = $target_module_srl;
|
||||||
|
}
|
||||||
|
foreach ($module_srl_list as $module_srl)
|
||||||
|
{
|
||||||
|
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
|
||||||
|
if (!$module_info->module_srl)
|
||||||
|
{
|
||||||
|
return new Object(-1, 'msg_invalid_request');
|
||||||
|
}
|
||||||
|
|
||||||
|
$module_grant = $oModuleModel->getGrant($module_info, $logged_info);
|
||||||
|
if (!$module_grant->manager)
|
||||||
|
{
|
||||||
|
return new Object(-1, 'msg_not_permitted');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Set a spam-filer not to be filtered to spams
|
// Set a spam-filer not to be filtered to spams
|
||||||
$oSpamController = getController('spamfilter');
|
$oSpamController = getController('spamfilter');
|
||||||
$oSpamController->setAvoidLog();
|
$oSpamController->setAvoidLog();
|
||||||
|
|
||||||
$oDocumentAdminController = getAdminController('document');
|
|
||||||
if($type == 'move')
|
if($type == 'move')
|
||||||
{
|
{
|
||||||
if(!$module_srl) return new Object(-1, 'fail_to_move');
|
if(!$target_module_srl) return new Object(-1, 'fail_to_move');
|
||||||
|
|
||||||
$output = $oDocumentAdminController->moveDocumentModule($document_srl_list, $module_srl, $category_srl);
|
$oDocumentAdminController = getAdminController('document');
|
||||||
|
$output = $oDocumentAdminController->moveDocumentModule($document_srl_list, $target_module_srl, $target_category_srl);
|
||||||
if(!$output->toBool()) return new Object(-1, 'fail_to_move');
|
if(!$output->toBool()) return new Object(-1, 'fail_to_move');
|
||||||
|
|
||||||
$msg_code = 'success_moved';
|
$msg_code = 'success_moved';
|
||||||
|
|
@ -2541,9 +2566,10 @@ class documentController extends document
|
||||||
}
|
}
|
||||||
else if($type == 'copy')
|
else if($type == 'copy')
|
||||||
{
|
{
|
||||||
if(!$module_srl) return new Object(-1, 'fail_to_move');
|
if(!$target_module_srl) return new Object(-1, 'fail_to_move');
|
||||||
|
|
||||||
$output = $oDocumentAdminController->copyDocumentModule($document_srl_list, $module_srl, $category_srl);
|
$oDocumentAdminController = getAdminController('document');
|
||||||
|
$output = $oDocumentAdminController->copyDocumentModule($document_srl_list, $target_module_srl, $target_category_srl);
|
||||||
if(!$output->toBool()) return new Object(-1, 'fail_to_move');
|
if(!$output->toBool()) return new Object(-1, 'fail_to_move');
|
||||||
|
|
||||||
$msg_code = 'success_copied';
|
$msg_code = 'success_copied';
|
||||||
|
|
@ -2552,9 +2578,8 @@ class documentController extends document
|
||||||
{
|
{
|
||||||
$oDB = &DB::getInstance();
|
$oDB = &DB::getInstance();
|
||||||
$oDB->begin();
|
$oDB->begin();
|
||||||
for($i=0;$i<$document_srl_count;$i++)
|
foreach ($document_srl_list as $document_srl)
|
||||||
{
|
{
|
||||||
$document_srl = $document_srl_list[$i];
|
|
||||||
$output = $this->deleteDocument($document_srl, true);
|
$output = $this->deleteDocument($document_srl, true);
|
||||||
if(!$output->toBool()) return new Object(-1, 'fail_to_delete');
|
if(!$output->toBool()) return new Object(-1, 'fail_to_delete');
|
||||||
}
|
}
|
||||||
|
|
@ -2568,8 +2593,9 @@ class documentController extends document
|
||||||
|
|
||||||
$oDB = &DB::getInstance();
|
$oDB = &DB::getInstance();
|
||||||
$oDB->begin();
|
$oDB->begin();
|
||||||
for($i=0;$i<$document_srl_count;$i++) {
|
foreach ($document_srl_list as $document_srl)
|
||||||
$args->document_srl = $document_srl_list[$i];
|
{
|
||||||
|
$args->document_srl = $document_srl;
|
||||||
$output = $this->moveDocumentToTrash($args);
|
$output = $this->moveDocumentToTrash($args);
|
||||||
if(!$output || !$output->toBool()) return new Object(-1, 'fail_to_trash');
|
if(!$output || !$output->toBool()) return new Object(-1, 'fail_to_trash');
|
||||||
}
|
}
|
||||||
|
|
@ -2587,11 +2613,7 @@ class documentController extends document
|
||||||
// Send a message
|
// Send a message
|
||||||
if($message_content)
|
if($message_content)
|
||||||
{
|
{
|
||||||
|
|
||||||
$oCommunicationController = getController('communication');
|
$oCommunicationController = getController('communication');
|
||||||
|
|
||||||
$logged_info = Context::get('logged_info');
|
|
||||||
|
|
||||||
$title = cut_str($message_content,10,'...');
|
$title = cut_str($message_content,10,'...');
|
||||||
$sender_member_srl = $logged_info->member_srl;
|
$sender_member_srl = $logged_info->member_srl;
|
||||||
|
|
||||||
|
|
@ -2621,9 +2643,29 @@ class documentController extends document
|
||||||
*/
|
*/
|
||||||
function procDocumentInsertModuleConfig()
|
function procDocumentInsertModuleConfig()
|
||||||
{
|
{
|
||||||
$module_srl = Context::get('target_module_srl');
|
$target_module_srl = Context::get('target_module_srl');
|
||||||
if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl);
|
$target_module_srl = array_map('trim', explode(',', $target_module_srl));
|
||||||
else $module_srl = array($module_srl);
|
$logged_info = Context::get('logged_info');
|
||||||
|
$module_srl = array();
|
||||||
|
$oModuleModel = getModel('module');
|
||||||
|
foreach ($target_module_srl as $srl)
|
||||||
|
{
|
||||||
|
if (!$srl) continue;
|
||||||
|
|
||||||
|
$module_info = $oModuleModel->getModuleInfoByModuleSrl($srl);
|
||||||
|
if (!$module_info->module_srl)
|
||||||
|
{
|
||||||
|
return new Object(-1, 'msg_invalid_request');
|
||||||
|
}
|
||||||
|
|
||||||
|
$module_grant = $oModuleModel->getGrant($module_info, $logged_info);
|
||||||
|
if (!$module_grant->manager)
|
||||||
|
{
|
||||||
|
return new Object(-1, 'msg_not_permitted');
|
||||||
|
}
|
||||||
|
|
||||||
|
$module_srl[] = $srl;
|
||||||
|
}
|
||||||
|
|
||||||
$document_config = new stdClass();
|
$document_config = new stdClass();
|
||||||
$document_config->use_history = Context::get('use_history');
|
$document_config->use_history = Context::get('use_history');
|
||||||
|
|
@ -2638,12 +2680,11 @@ class documentController extends document
|
||||||
$document_config->use_status = Context::get('use_status');
|
$document_config->use_status = Context::get('use_status');
|
||||||
|
|
||||||
$oModuleController = getController('module');
|
$oModuleController = getController('module');
|
||||||
for($i=0;$i<count($module_srl);$i++)
|
foreach ($module_srl as $srl)
|
||||||
{
|
{
|
||||||
$srl = trim($module_srl[$i]);
|
|
||||||
if(!$srl) continue;
|
|
||||||
$output = $oModuleController->insertModulePartConfig('document',$srl,$document_config);
|
$output = $oModuleController->insertModulePartConfig('document',$srl,$document_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setError(-1);
|
$this->setError(-1);
|
||||||
$this->setMessage('success_updated', 'info');
|
$this->setMessage('success_updated', 'info');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,7 @@ class documentItem extends Object
|
||||||
|
|
||||||
function isGranted()
|
function isGranted()
|
||||||
{
|
{
|
||||||
if ($_SESSION['own_document'][$this->document_srl])
|
if ($_SESSION['granted_document'][$this->document_srl])
|
||||||
{
|
{
|
||||||
return $this->grant_cache = true;
|
return $this->grant_cache = true;
|
||||||
}
|
}
|
||||||
|
|
@ -198,9 +198,14 @@ class documentItem extends Object
|
||||||
|
|
||||||
function setGrant()
|
function setGrant()
|
||||||
{
|
{
|
||||||
$_SESSION['own_document'][$this->document_srl] = true;
|
|
||||||
$this->grant_cache = true;
|
$this->grant_cache = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setGrantForSession()
|
||||||
|
{
|
||||||
|
$_SESSION['granted_document'][$this->document_srl] = true;
|
||||||
|
$this->setGrant();
|
||||||
|
}
|
||||||
|
|
||||||
function isAccessible()
|
function isAccessible()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ class documentModel extends document
|
||||||
*/
|
*/
|
||||||
function isGranted($document_srl)
|
function isGranted($document_srl)
|
||||||
{
|
{
|
||||||
return $_SESSION['own_document'][$document_srl];
|
return $_SESSION['granted_document'][$document_srl];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ class layoutView extends layout
|
||||||
if($module == 'ARTICLE' && !$mid)
|
if($module == 'ARTICLE' && !$mid)
|
||||||
{
|
{
|
||||||
$oDocumentModel = getModel('document');
|
$oDocumentModel = getModel('document');
|
||||||
$oDocument = $oDocumentModel->getDocument(0, true);
|
$oDocument = $oDocumentModel->getDocument(0);
|
||||||
|
|
||||||
$t = lang('article_preview_title');
|
$t = lang('article_preview_title');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ $lang->cmd_manage_nick_name = '금지 닉네임 관리';
|
||||||
$lang->cmd_manage_form = '가입 폼 관리';
|
$lang->cmd_manage_form = '가입 폼 관리';
|
||||||
$lang->cmd_view_own_document = '작성 글 보기';
|
$lang->cmd_view_own_document = '작성 글 보기';
|
||||||
$lang->cmd_view_own_comment = '작성 댓글 보기';
|
$lang->cmd_view_own_comment = '작성 댓글 보기';
|
||||||
$lang->cmd_view_active_logins = '로그인 관리';
|
$lang->cmd_view_active_logins = '자동 로그인 관리';
|
||||||
$lang->cmd_manage_member_info = '회원 정보 관리';
|
$lang->cmd_manage_member_info = '회원 정보 관리';
|
||||||
$lang->cmd_trace_document = '작성글 추적';
|
$lang->cmd_trace_document = '작성글 추적';
|
||||||
$lang->cmd_trace_comment = '작성 댓글 추적';
|
$lang->cmd_trace_comment = '작성 댓글 추적';
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,6 @@
|
||||||
*/
|
*/
|
||||||
class memberController extends member
|
class memberController extends member
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Info of selected member
|
|
||||||
*
|
|
||||||
* @var object
|
|
||||||
*/
|
|
||||||
var $memberInfo;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialization
|
* Initialization
|
||||||
*
|
*
|
||||||
|
|
@ -57,6 +50,7 @@ class memberController extends member
|
||||||
|
|
||||||
$oModuleModel = getModel('module');
|
$oModuleModel = getModel('module');
|
||||||
$config = $oModuleModel->getModuleConfig('member');
|
$config = $oModuleModel->getModuleConfig('member');
|
||||||
|
$member_info = Context::get('logged_info');
|
||||||
|
|
||||||
// Check change_password_date
|
// Check change_password_date
|
||||||
$limit_date = $config->change_password_date;
|
$limit_date = $config->change_password_date;
|
||||||
|
|
@ -65,7 +59,7 @@ class memberController extends member
|
||||||
if($limit_date > 0)
|
if($limit_date > 0)
|
||||||
{
|
{
|
||||||
$oMemberModel = getModel('member');
|
$oMemberModel = getModel('member');
|
||||||
if($this->memberInfo->change_password_date < date ('YmdHis', strtotime ('-' . $limit_date . ' day')))
|
if($member_info->change_password_date < date ('YmdHis', strtotime ('-' . $limit_date . ' day')))
|
||||||
{
|
{
|
||||||
$msg = sprintf(lang('msg_change_password_date'), $limit_date);
|
$msg = sprintf(lang('msg_change_password_date'), $limit_date);
|
||||||
return $this->setRedirectUrl(getNotEncodedUrl('','vid',Context::get('vid'),'mid',Context::get('mid'),'act','dispMemberModifyPassword'), new Object(-1, $msg));
|
return $this->setRedirectUrl(getNotEncodedUrl('','vid',Context::get('vid'),'mid',Context::get('mid'),'act','dispMemberModifyPassword'), new Object(-1, $msg));
|
||||||
|
|
@ -74,7 +68,7 @@ class memberController extends member
|
||||||
|
|
||||||
// Delete all previous authmail if login is successful
|
// Delete all previous authmail if login is successful
|
||||||
$args = new stdClass();
|
$args = new stdClass();
|
||||||
$args->member_srl = $this->memberInfo->member_srl;
|
$args->member_srl = $member_info->member_srl;
|
||||||
executeQuery('member.deleteAuthMail', $args);
|
executeQuery('member.deleteAuthMail', $args);
|
||||||
|
|
||||||
if(!$config->after_login_url)
|
if(!$config->after_login_url)
|
||||||
|
|
@ -545,18 +539,14 @@ class memberController extends member
|
||||||
|
|
||||||
$oMemberModel = getModel('member');
|
$oMemberModel = getModel('member');
|
||||||
|
|
||||||
if(!$this->memberInfo->password)
|
// Get information of logged-in user
|
||||||
{
|
$logged_info = Context::get('logged_info');
|
||||||
// Get information of logged-in user
|
$member_srl = $logged_info->member_srl;
|
||||||
$logged_info = Context::get('logged_info');
|
$columnList = array('member_srl', 'password');
|
||||||
$member_srl = $logged_info->member_srl;
|
$member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList);
|
||||||
|
|
||||||
$columnList = array('member_srl', 'password');
|
|
||||||
$memberInfo = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList);
|
|
||||||
$this->memberInfo->password = $memberInfo->password;
|
|
||||||
}
|
|
||||||
// Verify the current password
|
// Verify the current password
|
||||||
if(!$oMemberModel->isValidPassword($this->memberInfo->password, $password))
|
if(!$oMemberModel->isValidPassword($member_info->password, $password))
|
||||||
{
|
{
|
||||||
return new Object(-1, 'invalid_password');
|
return new Object(-1, 'invalid_password');
|
||||||
}
|
}
|
||||||
|
|
@ -698,10 +688,10 @@ class memberController extends member
|
||||||
$this->putSignature($args->member_srl, $signature);
|
$this->putSignature($args->member_srl, $signature);
|
||||||
|
|
||||||
// Get user_id information
|
// Get user_id information
|
||||||
$this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl);
|
$member_info = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl);
|
||||||
|
|
||||||
// Call a trigger after successfully modified (after)
|
// Call a trigger after successfully modified (after)
|
||||||
ModuleHandler::triggerCall('member.procMemberModifyInfo', 'after', $this->memberInfo);
|
ModuleHandler::triggerCall('member.procMemberModifyInfo', 'after', $member_info);
|
||||||
$this->setSessionInfo();
|
$this->setSessionInfo();
|
||||||
|
|
||||||
// Return result
|
// Return result
|
||||||
|
|
@ -779,14 +769,10 @@ class memberController extends member
|
||||||
// Create a member model object
|
// Create a member model object
|
||||||
$oMemberModel = getModel('member');
|
$oMemberModel = getModel('member');
|
||||||
// Get information of member_srl
|
// Get information of member_srl
|
||||||
if(!$this->memberInfo->password)
|
$columnList = array('member_srl', 'password');
|
||||||
{
|
$member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList);
|
||||||
$columnList = array('member_srl', 'password');
|
|
||||||
$memberInfo = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList);
|
|
||||||
$this->memberInfo->password = $memberInfo->password;
|
|
||||||
}
|
|
||||||
// Verify the cuttent password
|
// Verify the cuttent password
|
||||||
if(!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) return new Object(-1, 'invalid_password');
|
if(!$oMemberModel->isValidPassword($member_info->password, $password)) return new Object(-1, 'invalid_password');
|
||||||
|
|
||||||
$output = $this->deleteMember($member_srl);
|
$output = $this->deleteMember($member_srl);
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
|
|
@ -1739,7 +1725,7 @@ class memberController extends member
|
||||||
$new_security_key = Rhymix\Framework\Security::getRandom(24, 'alnum');
|
$new_security_key = Rhymix\Framework\Security::getRandom(24, 'alnum');
|
||||||
$args = new stdClass;
|
$args = new stdClass;
|
||||||
$args->autologin_key = $autologin_key;
|
$args->autologin_key = $autologin_key;
|
||||||
$args->security_key = base64_encode(hash_hmac('sha256', $security_key, $autologin_key, true));
|
$args->security_key = base64_encode(hash_hmac('sha256', $new_security_key, $autologin_key, true));
|
||||||
$update_output = executeQuery('member.updateAutologin', $args);
|
$update_output = executeQuery('member.updateAutologin', $args);
|
||||||
if ($update_output->toBool())
|
if ($update_output->toBool())
|
||||||
{
|
{
|
||||||
|
|
@ -1781,17 +1767,17 @@ class memberController extends member
|
||||||
if($config->identifier == 'email_address' || strpos($user_id, '@') !== false)
|
if($config->identifier == 'email_address' || strpos($user_id, '@') !== false)
|
||||||
{
|
{
|
||||||
// Get user_id information
|
// Get user_id information
|
||||||
$this->memberInfo = $oMemberModel->getMemberInfoByEmailAddress($user_id);
|
$member_info = $oMemberModel->getMemberInfoByEmailAddress($user_id);
|
||||||
// Set an invalid user if no value returned
|
// Set an invalid user if no value returned
|
||||||
if(!$user_id || strtolower($this->memberInfo->email_address) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_email_address');
|
if(!$user_id || strtolower($member_info->email_address) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_email_address');
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Get user_id information
|
// Get user_id information
|
||||||
$this->memberInfo = $oMemberModel->getMemberInfoByUserID($user_id);
|
$member_info = $oMemberModel->getMemberInfoByUserID($user_id);
|
||||||
// Set an invalid user if no value returned
|
// Set an invalid user if no value returned
|
||||||
if(!$user_id || strtolower($this->memberInfo->user_id) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_user_id');
|
if(!$user_id || strtolower($member_info->user_id) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_user_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = executeQuery('member.getLoginCountByIp', $args);
|
$output = executeQuery('member.getLoginCountByIp', $args);
|
||||||
|
|
@ -1818,36 +1804,36 @@ class memberController extends member
|
||||||
}
|
}
|
||||||
|
|
||||||
// Password Check
|
// Password Check
|
||||||
if($password && !$oMemberModel->isValidPassword($this->memberInfo->password, $password, $this->memberInfo->member_srl))
|
if($password && !$oMemberModel->isValidPassword($member_info->password, $password, $member_info->member_srl))
|
||||||
{
|
{
|
||||||
return $this->recordMemberLoginError(-1, 'invalid_password',$this->memberInfo);
|
return $this->recordMemberLoginError(-1, 'invalid_password', $member_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If denied == 'Y', notify
|
// If denied == 'Y', notify
|
||||||
if($this->memberInfo->denied == 'Y')
|
if($member_info->denied == 'Y')
|
||||||
{
|
{
|
||||||
$args->member_srl = $this->memberInfo->member_srl;
|
$args->member_srl = $member_info->member_srl;
|
||||||
$output = executeQuery('member.chkAuthMail', $args);
|
$output = executeQuery('member.chkAuthMail', $args);
|
||||||
if ($output->toBool() && $output->data->count != '0')
|
if ($output->toBool() && $output->data->count != '0')
|
||||||
{
|
{
|
||||||
$_SESSION['auth_member_srl'] = $this->memberInfo->member_srl;
|
$_SESSION['auth_member_srl'] = $member_info->member_srl;
|
||||||
$redirectUrl = getUrl('', 'act', 'dispMemberResendAuthMail');
|
$redirectUrl = getUrl('', 'act', 'dispMemberResendAuthMail');
|
||||||
return $this->setRedirectUrl($redirectUrl, new Object(-1,'msg_user_not_confirmed'));
|
return $this->setRedirectUrl($redirectUrl, new Object(-1,'msg_user_not_confirmed'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$refused_reason = $this->memberInfo->refused_reason ? ('<br>' . lang('refused_reason') . ': ' . $this->memberInfo->refused_reason) : '';
|
$refused_reason = $member_info->refused_reason ? ('<br>' . lang('refused_reason') . ': ' . $member_info->refused_reason) : '';
|
||||||
return new Object(-1, lang('msg_user_denied') . $refused_reason);
|
return new Object(-1, lang('msg_user_denied') . $refused_reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Notify if user is limited
|
// Notify if user is limited
|
||||||
if($this->memberInfo->limit_date && substr($this->memberInfo->limit_date,0,8) >= date("Ymd"))
|
if($member_info->limit_date && substr($member_info->limit_date,0,8) >= date("Ymd"))
|
||||||
{
|
{
|
||||||
$limited_reason = $this->memberInfo->limited_reason ? ('<br>' . lang('refused_reason') . ': ' . $this->memberInfo->limited_reason) : '';
|
$limited_reason = $member_info->limited_reason ? ('<br>' . lang('refused_reason') . ': ' . $member_info->limited_reason) : '';
|
||||||
return new Object(-9, sprintf(lang('msg_user_limited'), zdate($this->memberInfo->limit_date,"Y-m-d")) . $limited_reason);
|
return new Object(-9, sprintf(lang('msg_user_limited'), zdate($member_info->limit_date,"Y-m-d")) . $limited_reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not allow login as admin if not in allowed IP list
|
// Do not allow login as admin if not in allowed IP list
|
||||||
if($this->memberInfo->is_admin === 'Y' && $this->act === 'procMemberLogin')
|
if($member_info->is_admin === 'Y' && $this->act === 'procMemberLogin')
|
||||||
{
|
{
|
||||||
$oMemberAdminModel = getAdminModel('member');
|
$oMemberAdminModel = getAdminModel('member');
|
||||||
if(!$oMemberAdminModel->getMemberAdminIPCheck())
|
if(!$oMemberAdminModel->getMemberAdminIPCheck())
|
||||||
|
|
@ -1857,7 +1843,7 @@ class memberController extends member
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the latest login time
|
// Update the latest login time
|
||||||
$args->member_srl = $this->memberInfo->member_srl;
|
$args->member_srl = $member_info->member_srl;
|
||||||
$output = executeQuery('member.updateLastLogin', $args);
|
$output = executeQuery('member.updateLastLogin', $args);
|
||||||
|
|
||||||
$site_module_info = Context::get('site_module_info');
|
$site_module_info = Context::get('site_module_info');
|
||||||
|
|
@ -1887,15 +1873,15 @@ class memberController extends member
|
||||||
$oCommunicationController = getController('communication');
|
$oCommunicationController = getController('communication');
|
||||||
$oCommunicationController->sendMessage($args->member_srl, $args->member_srl, $title, $content, true);
|
$oCommunicationController->sendMessage($args->member_srl, $args->member_srl, $title, $content, true);
|
||||||
|
|
||||||
if($this->memberInfo->email_address && $this->memberInfo->allow_mailing == 'Y')
|
if($member_info->email_address && $member_info->allow_mailing == 'Y')
|
||||||
{
|
{
|
||||||
$view_url = Context::getRequestUri();
|
$view_url = Context::getRequestUri();
|
||||||
$content = sprintf("%s<hr /><p>From: <a href=\"%s\" target=\"_blank\">%s</a><br />To: %s(%s)</p>",$content, $view_url, $view_url, $this->memberInfo->nick_name, $this->memberInfo->email_id);
|
$content = sprintf("%s<hr /><p>From: <a href=\"%s\" target=\"_blank\">%s</a><br />To: %s(%s)</p>",$content, $view_url, $view_url, $member_info->nick_name, $member_info->email_id);
|
||||||
$oMail = new Mail();
|
$oMail = new Mail();
|
||||||
$oMail->setTitle($title);
|
$oMail->setTitle($title);
|
||||||
$oMail->setContent($content);
|
$oMail->setContent($content);
|
||||||
$oMail->setSender($config->webmaster_name?$config->webmaster_name:'webmaster', $config->webmaster_email);
|
$oMail->setSender($config->webmaster_name?$config->webmaster_name:'webmaster', $config->webmaster_email);
|
||||||
$oMail->setReceiptor($this->memberInfo->email_id.'('.$this->memberInfo->nick_name.')', $this->memberInfo->email_address);
|
$oMail->setReceiptor($member_info->email_id.'('.$member_info->nick_name.')', $member_info->email_address);
|
||||||
$oMail->send();
|
$oMail->send();
|
||||||
}
|
}
|
||||||
$output = executeQuery('member.deleteLoginCountHistoryByMemberSrl', $args);
|
$output = executeQuery('member.deleteLoginCountHistoryByMemberSrl', $args);
|
||||||
|
|
@ -1904,7 +1890,7 @@ class memberController extends member
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call a trigger after successfully log-in (after)
|
// Call a trigger after successfully log-in (after)
|
||||||
ModuleHandler::triggerCall('member.doLogin', 'after', $this->memberInfo);
|
ModuleHandler::triggerCall('member.doLogin', 'after', $member_info);
|
||||||
|
|
||||||
// When user checked to use auto-login
|
// When user checked to use auto-login
|
||||||
if($keep_signed)
|
if($keep_signed)
|
||||||
|
|
@ -1913,7 +1899,7 @@ class memberController extends member
|
||||||
$autologin_args = new stdClass;
|
$autologin_args = new stdClass;
|
||||||
$autologin_args->autologin_key = substr($random_key, 0, 24);
|
$autologin_args->autologin_key = substr($random_key, 0, 24);
|
||||||
$autologin_args->security_key = base64_encode(hash_hmac('sha256', substr($random_key, 24, 24), $autologin_args->autologin_key, true));
|
$autologin_args->security_key = base64_encode(hash_hmac('sha256', substr($random_key, 24, 24), $autologin_args->autologin_key, true));
|
||||||
$autologin_args->member_srl = $this->memberInfo->member_srl;
|
$autologin_args->member_srl = $member_info->member_srl;
|
||||||
$autologin_args->user_agent = json_encode(Rhymix\Framework\UA::getBrowserInfo());
|
$autologin_args->user_agent = json_encode(Rhymix\Framework\UA::getBrowserInfo());
|
||||||
$autologin_output = executeQuery('member.insertAutologin', $autologin_args);
|
$autologin_output = executeQuery('member.insertAutologin', $autologin_args);
|
||||||
if ($autologin_output->toBool())
|
if ($autologin_output->toBool())
|
||||||
|
|
@ -1922,7 +1908,7 @@ class memberController extends member
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rhymix\Framework\Session::login($this->memberInfo->member_srl);
|
Rhymix\Framework\Session::login($member_info->member_srl);
|
||||||
$this->setSessionInfo();
|
$this->setSessionInfo();
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
@ -1933,38 +1919,15 @@ class memberController extends member
|
||||||
function setSessionInfo()
|
function setSessionInfo()
|
||||||
{
|
{
|
||||||
// If your information came through the current session information to extract information from the users
|
// If your information came through the current session information to extract information from the users
|
||||||
if(!$this->memberInfo && Rhymix\Framework\Session::getMemberSrl())
|
$member_info = Rhymix\Framework\Session::getMemberInfo(true);
|
||||||
{
|
if (!$member_info->member_srl)
|
||||||
$this->memberInfo = Rhymix\Framework\Session::getMemberInfo();
|
|
||||||
}
|
|
||||||
if(!$this->memberInfo->member_srl)
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log in for treatment sessions set
|
|
||||||
/*
|
|
||||||
$_SESSION['is_logged'] = true;
|
|
||||||
$_SESSION['member_srl'] = $_SESSION['RHYMIX']['login'] = $this->memberInfo->member_srl;
|
|
||||||
$_SESSION['is_admin'] = '';
|
|
||||||
*/
|
|
||||||
// Do not save your password in the session jiwojum;;
|
|
||||||
//unset($this->memberInfo->password);
|
|
||||||
// User Group Settings
|
|
||||||
/*
|
|
||||||
if($this->memberInfo->group_list) {
|
|
||||||
$group_srl_list = array_keys($this->memberInfo->group_list);
|
|
||||||
$_SESSION['group_srls'] = $group_srl_list;
|
|
||||||
// If the group is designated as an administrator administrator
|
|
||||||
$oMemberModel = getModel('member');
|
|
||||||
$admin_group = $oMemberModel->getAdminGroup();
|
|
||||||
if($admin_group->group_srl && in_array($admin_group->group_srl, $group_srl_list)) $_SESSION['is_admin'] = 'Y';
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Information stored in the session login user
|
// Information stored in the session login user
|
||||||
Context::set('is_logged', true);
|
Context::set('is_logged', true);
|
||||||
Context::set('logged_info', $this->memberInfo);
|
Context::set('logged_info', $member_info);
|
||||||
|
|
||||||
// Only the menu configuration of the user (such as an add-on to the menu can be changed)
|
// Only the menu configuration of the user (such as an add-on to the menu can be changed)
|
||||||
$config = getModel('member')->getMemberConfig();
|
$config = getModel('member')->getMemberConfig();
|
||||||
|
|
@ -2297,8 +2260,10 @@ class memberController extends member
|
||||||
$config = $oMemberModel->getMemberConfig();
|
$config = $oMemberModel->getMemberConfig();
|
||||||
|
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
|
|
||||||
// Get what you want to modify the original information
|
// Get what you want to modify the original information
|
||||||
if(!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl);
|
$orgMemberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl);
|
||||||
|
|
||||||
// Control of essential parameters
|
// Control of essential parameters
|
||||||
if($args->allow_mailing!='Y') $args->allow_mailing = 'N';
|
if($args->allow_mailing!='Y') $args->allow_mailing = 'N';
|
||||||
if($args->allow_message && !in_array($args->allow_message, array('Y','N','F'))) $args->allow_message = 'Y';
|
if($args->allow_message && !in_array($args->allow_message, array('Y','N','F'))) $args->allow_message = 'Y';
|
||||||
|
|
@ -2386,9 +2351,6 @@ class memberController extends member
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = executeQuery('member.getMemberInfoByMemberSrl', $args);
|
|
||||||
$orgMemberInfo = $output->data;
|
|
||||||
|
|
||||||
// Check managed Email Host
|
// Check managed Email Host
|
||||||
if($logged_info->is_admin !== 'Y' && $oMemberModel->isDeniedEmailHost($args->email_address))
|
if($logged_info->is_admin !== 'Y' && $oMemberModel->isDeniedEmailHost($args->email_address))
|
||||||
{
|
{
|
||||||
|
|
@ -2537,13 +2499,9 @@ class memberController extends member
|
||||||
|
|
||||||
$oDB->commit();
|
$oDB->commit();
|
||||||
|
|
||||||
//remove from cache
|
// Remove from cache
|
||||||
$this->_clearMemberCache($args->member_srl, $args->site_srl);
|
$this->_clearMemberCache($args->member_srl, $args->site_srl);
|
||||||
|
|
||||||
// Save Session
|
|
||||||
if(!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl);
|
|
||||||
$logged_info = Context::get('logged_info');
|
|
||||||
|
|
||||||
$output->add('member_srl', $args->member_srl);
|
$output->add('member_srl', $args->member_srl);
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
@ -2555,7 +2513,6 @@ class memberController extends member
|
||||||
{
|
{
|
||||||
if($args->password)
|
if($args->password)
|
||||||
{
|
{
|
||||||
|
|
||||||
// check password strength
|
// check password strength
|
||||||
$oMemberModel = getModel('member');
|
$oMemberModel = getModel('member');
|
||||||
$config = $oMemberModel->getMemberConfig();
|
$config = $oMemberModel->getMemberConfig();
|
||||||
|
|
@ -2597,14 +2554,11 @@ class memberController extends member
|
||||||
// Create a model object
|
// Create a model object
|
||||||
$oMemberModel = getModel('member');
|
$oMemberModel = getModel('member');
|
||||||
// Bringing the user's information
|
// Bringing the user's information
|
||||||
if(!$this->memberInfo || $this->memberInfo->member_srl != $member_srl || !isset($this->memberInfo->is_admin))
|
$columnList = array('member_srl', 'is_admin');
|
||||||
{
|
$member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList);
|
||||||
$columnList = array('member_srl', 'is_admin');
|
if(!$member_info) return new Object(-1, 'msg_not_exists_member');
|
||||||
$this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList);
|
|
||||||
}
|
|
||||||
if(!$this->memberInfo) return new Object(-1, 'msg_not_exists_member');
|
|
||||||
// If managers can not be deleted
|
// If managers can not be deleted
|
||||||
if($this->memberInfo->is_admin == 'Y') return new Object(-1, 'msg_cannot_delete_admin');
|
if($member_info->is_admin == 'Y') return new Object(-1, 'msg_cannot_delete_admin');
|
||||||
|
|
||||||
$oDB = &DB::getInstance();
|
$oDB = &DB::getInstance();
|
||||||
$oDB->begin();
|
$oDB->begin();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,18 @@
|
||||||
<load target="js/member.js" />
|
<load target="js/member.js" />
|
||||||
<!--// Check layout. If it is Simple World, select layout primary colors as a primary color of this skin -->
|
<!--// Check layout. If it is Simple World, select layout primary colors as a primary color of this skin -->
|
||||||
|
<block cond="$layout_info->extra_var->primary_color->type === 'select' || $layout_info->extra_var->customized_primary_color->type === 'colorpicker'">
|
||||||
|
{@
|
||||||
|
if(!$layout_info->primary_color)
|
||||||
|
$layout_info->primary_color = 'red';
|
||||||
|
if(!$layout_info->primary_color && $layout_info->customized_primary_color)
|
||||||
|
$layout_info->primary_color = 'customized';
|
||||||
|
if(!$layout_info->customized_primary_color)
|
||||||
|
$layout_info->customized_primary_color = '#f44336';
|
||||||
|
}
|
||||||
|
</block>
|
||||||
|
<block cond="$layout_info->extra_var->primary_color->type !== 'select' && $layout_info->extra_var->customized_primary_color->type !== 'colorpicker'">
|
||||||
|
{@$layout_info->primary_color = 'red';}
|
||||||
|
</block>
|
||||||
{@
|
{@
|
||||||
$material_colors = array(
|
$material_colors = array(
|
||||||
'red' => '#f44336',
|
'red' => '#f44336',
|
||||||
|
|
@ -28,24 +41,21 @@
|
||||||
'customized' => $layout_info->customized_primary_color,
|
'customized' => $layout_info->customized_primary_color,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
<block cond="$layout_info->extra_var->primary_color->type === 'select' || $layout_info->extra_var->customized_primary_color->type === 'colorpicker'">
|
|
||||||
{@
|
|
||||||
if(!$layout_info->primary_color && $layout_info->customized_primary_color)
|
|
||||||
$layout_info->primary_color = 'customized';
|
|
||||||
if(!$layout_info->primary_color)
|
|
||||||
$layout_info->primary_color = 'red';
|
|
||||||
if(!$layout_info->customized_primary_color)
|
|
||||||
$layout_info->customized_primary_color = '#f44336';
|
|
||||||
}
|
|
||||||
</block>
|
|
||||||
<block cond="$layout_info->extra_var->primary_color->type !== 'select' && $layout_info->extra_var->customized_primary_color->type !== 'colorpicker'">
|
|
||||||
{@$layout_info->primary_color = 'blue';}
|
|
||||||
</block>
|
|
||||||
<!--// Load styles -->
|
<!--// Load styles -->
|
||||||
{@$colorset = $material_colors[$member_config->colorset];}
|
{@$colorset = $material_colors[$member_config->colorset];}
|
||||||
{@$skin_color = $material_colors[$layout_info->primary_color];}
|
{@$skin_color = $material_colors[$layout_info->primary_color];}
|
||||||
|
<block cond="$colorset">
|
||||||
|
<!--@if(preg_match("/#([a-f0-9]{3}){1,2}/i", trim($colorset)) && in_array(strlen(trim($colorset)), array(4, 7)))-->
|
||||||
|
{@$skin_color = trim($colorset)}
|
||||||
|
<!--@if(strlen(trim($colorset)) === 4)-->
|
||||||
|
{@$skin_color = trim($colorset)[1].trim($colorset)[1].trim($colorset)[2].trim($colorset)[2].trim($colorset)[3].trim($colorset)[3]}
|
||||||
|
<!--@endif-->
|
||||||
|
<!--@else-->
|
||||||
|
{@$skin_color = '#f44336'}
|
||||||
|
<!--@endif-->
|
||||||
|
</block>
|
||||||
<block cond="!$skin_color">
|
<block cond="!$skin_color">
|
||||||
<!--@if(preg_match("/#([a-f0-9]{3}){1,2}/i", $layout_info->primary_color))-->
|
<!--@if(preg_match("/#([a-f0-9]{3}){1,2}/i", $layout_info->primary_color) && in_array(strlen(trim($colorset)), array(4, 7)))-->
|
||||||
{@$skin_color = $layout_info->primary_color}
|
{@$skin_color = $layout_info->primary_color}
|
||||||
<!--@if(strlen($layout_info->primary_color) === 4)-->
|
<!--@if(strlen($layout_info->primary_color) === 4)-->
|
||||||
{@$skin_color = $layout_info->primary_color[1].$layout_info->primary_color[1].$layout_info->primary_color[2].$layout_info->primary_color[2].$layout_info->primary_color[3].$layout_info->primary_color[3]}
|
{@$skin_color = $layout_info->primary_color[1].$layout_info->primary_color[1].$layout_info->primary_color[2].$layout_info->primary_color[2].$layout_info->primary_color[3].$layout_info->primary_color[3]}
|
||||||
|
|
@ -54,9 +64,6 @@
|
||||||
{@$skin_color = '#f44336'}
|
{@$skin_color = '#f44336'}
|
||||||
<!--@endif-->
|
<!--@endif-->
|
||||||
</block>
|
</block>
|
||||||
<block cond="$colorset">
|
|
||||||
{@$skin_color = $colorset}
|
|
||||||
</block>
|
|
||||||
{@Context::set('simple_less_value', array('red' => hexdec(substr($skin_color, 1, 2)), 'green' => hexdec(substr($skin_color, 3, 2)), 'blue' => hexdec(substr($skin_color, 5, 2)) ))}
|
{@Context::set('simple_less_value', array('red' => hexdec(substr($skin_color, 1, 2)), 'green' => hexdec(substr($skin_color, 3, 2)), 'blue' => hexdec(substr($skin_color, 5, 2)) ))}
|
||||||
<load target="css/css.less" vars="$simple_less_value" />
|
<load target="css/css.less" vars="$simple_less_value" />
|
||||||
<section class="rx_simple_member">
|
<section class="rx_simple_member">
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ script, style
|
||||||
|
|
||||||
.rx_simple_member a
|
.rx_simple_member a
|
||||||
{
|
{
|
||||||
color: @color;
|
.text-contrast(#fff; darken(@color,5%); lighten(@color,5%));
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
/* Horizontal align */
|
/* Horizontal align */
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
<input type="hidden" name="xe_validator_id" value="modules/member/skins/simple_world/reset_mail/2" />
|
<input type="hidden" name="xe_validator_id" value="modules/member/skins/simple_world/reset_mail/2" />
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label for="email_address">
|
<label for="email_address">
|
||||||
{lang('common.cmd_modify_new_auth_email_address')}
|
{lang('member.cmd_modify_new_auth_email_address')}
|
||||||
</label>
|
</label>
|
||||||
<input type="text" id="email_address" name="email_address" value="" title="{lang('member.cmd_modify_new_auth_email_address')}" />
|
<input type="text" id="email_address" name="email_address" value="" title="{lang('member.cmd_modify_new_auth_email_address')}" />
|
||||||
<input type="submit" value="{$lang->cmd_send_auth_new_emaill_address}" class="btn btn-inverse" />
|
<input type="submit" value="{$lang->cmd_send_auth_new_emaill_address}" class="btn btn-inverse" />
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,19 @@
|
||||||
<!--// responsible layout -->
|
<!--// responsible layout -->
|
||||||
{@Context::addMetaTag("viewport", "width=device-width, user-scalable=yes")}
|
{@Context::addMetaTag("viewport", "width=device-width, user-scalable=yes")}
|
||||||
|
|
||||||
<!--// Check layout. If it is Simple World, select layout primary colors as a primary color of this skin -->
|
<!--// Check layout. If it is Simple World, select layout primary colors as a primary color of this skin -->
|
||||||
|
<block cond="$layout_info->extra_var->primary_color->type === 'select' || $layout_info->extra_var->customized_primary_color->type === 'colorpicker'">
|
||||||
|
{@
|
||||||
|
if(!$layout_info->primary_color)
|
||||||
|
$layout_info->primary_color = 'red';
|
||||||
|
if(!$layout_info->primary_color && $layout_info->customized_primary_color)
|
||||||
|
$layout_info->primary_color = 'customized';
|
||||||
|
if(!$layout_info->customized_primary_color)
|
||||||
|
$layout_info->customized_primary_color = '#f44336';
|
||||||
|
}
|
||||||
|
</block>
|
||||||
|
<block cond="$layout_info->extra_var->primary_color->type !== 'select' && $layout_info->extra_var->customized_primary_color->type !== 'colorpicker'">
|
||||||
|
{@$layout_info->primary_color = 'red';}
|
||||||
|
</block>
|
||||||
{@
|
{@
|
||||||
$material_colors = array(
|
$material_colors = array(
|
||||||
'red' => '#f44336',
|
'red' => '#f44336',
|
||||||
|
|
@ -30,25 +42,21 @@
|
||||||
'customized' => $layout_info->customized_primary_color,
|
'customized' => $layout_info->customized_primary_color,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
<block cond="$layout_info->extra_var->primary_color->type === 'select' || $layout_info->extra_var->customized_primary_color->type === 'colorpicker'">
|
|
||||||
{@
|
|
||||||
if(!$layout_info->primary_color && $layout_info->customized_primary_color)
|
|
||||||
$layout_info->primary_color = 'customized';
|
|
||||||
if(!$layout_info->primary_color)
|
|
||||||
$layout_info->primary_color = 'red';
|
|
||||||
if(!$layout_info->customized_primary_color)
|
|
||||||
$layout_info->customized_primary_color = '#f44336';
|
|
||||||
}
|
|
||||||
|
|
||||||
</block>
|
|
||||||
<block cond="$layout_info->extra_var->primary_color->type !== 'select' && $layout_info->extra_var->customized_primary_color->type !== 'colorpicker'">
|
|
||||||
{@$layout_info->primary_color = 'blue';}
|
|
||||||
</block>
|
|
||||||
|
|
||||||
<!--// Load styles -->
|
<!--// Load styles -->
|
||||||
|
{@$colorset = $material_colors[$member_config->colorset];}
|
||||||
{@$skin_color = $material_colors[$layout_info->primary_color];}
|
{@$skin_color = $material_colors[$layout_info->primary_color];}
|
||||||
|
<block cond="$colorset">
|
||||||
|
<!--@if(preg_match("/#([a-f0-9]{3}){1,2}/i", trim($colorset)) && in_array(strlen(trim($colorset)), array(4, 7)))-->
|
||||||
|
{@$skin_color = trim($colorset)}
|
||||||
|
<!--@if(strlen(trim($colorset)) === 4)-->
|
||||||
|
{@$skin_color = trim($colorset)[1].trim($colorset)[1].trim($colorset)[2].trim($colorset)[2].trim($colorset)[3].trim($colorset)[3]}
|
||||||
|
<!--@endif-->
|
||||||
|
<!--@else-->
|
||||||
|
{@$skin_color = '#f44336'}
|
||||||
|
<!--@endif-->
|
||||||
|
</block>
|
||||||
<block cond="!$skin_color">
|
<block cond="!$skin_color">
|
||||||
<!--@if(preg_match("/#([a-f0-9]{3}){1,2}/i", $layout_info->primary_color))-->
|
<!--@if(preg_match("/#([a-f0-9]{3}){1,2}/i", $layout_info->primary_color) && in_array(strlen(trim($colorset)), array(4, 7)))-->
|
||||||
{@$skin_color = $layout_info->primary_color}
|
{@$skin_color = $layout_info->primary_color}
|
||||||
<!--@if(strlen($layout_info->primary_color) === 4)-->
|
<!--@if(strlen($layout_info->primary_color) === 4)-->
|
||||||
{@$skin_color = $layout_info->primary_color[1].$layout_info->primary_color[1].$layout_info->primary_color[2].$layout_info->primary_color[2].$layout_info->primary_color[3].$layout_info->primary_color[3]}
|
{@$skin_color = $layout_info->primary_color[1].$layout_info->primary_color[1].$layout_info->primary_color[2].$layout_info->primary_color[2].$layout_info->primary_color[3].$layout_info->primary_color[3]}
|
||||||
|
|
|
||||||
|
|
@ -316,7 +316,7 @@ class pageAdminController extends page
|
||||||
$document_srl = $obj->document_srl;
|
$document_srl = $obj->document_srl;
|
||||||
|
|
||||||
// 이미 존재하는 글인지 체크
|
// 이미 존재하는 글인지 체크
|
||||||
$oDocument = $oDocumentModel->getDocument($obj->document_srl, true);
|
$oDocument = $oDocumentModel->getDocument($obj->document_srl);
|
||||||
|
|
||||||
$bAnonymous = false;
|
$bAnonymous = false;
|
||||||
$target = ($obj->ismobile == 'Y') ? 'mdocument_srl' : 'document_srl';
|
$target = ($obj->ismobile == 'Y') ? 'mdocument_srl' : 'document_srl';
|
||||||
|
|
|
||||||
|
|
@ -265,7 +265,7 @@ class pageAdminView extends page
|
||||||
function _setArticleTypeContentModify($isMobile = false)
|
function _setArticleTypeContentModify($isMobile = false)
|
||||||
{
|
{
|
||||||
$oDocumentModel = getModel('document');
|
$oDocumentModel = getModel('document');
|
||||||
$oDocument = $oDocumentModel->getDocument(0, true);
|
$oDocument = $oDocumentModel->getDocument(0);
|
||||||
|
|
||||||
if($isMobile)
|
if($isMobile)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ class pageMobile extends pageView
|
||||||
$oTemplate = &TemplateHandler::getInstance();
|
$oTemplate = &TemplateHandler::getInstance();
|
||||||
|
|
||||||
$oDocumentModel = getModel('document');
|
$oDocumentModel = getModel('document');
|
||||||
$oDocument = $oDocumentModel->getDocument(0, true);
|
$oDocument = $oDocumentModel->getDocument(0);
|
||||||
|
|
||||||
if($this->module_info->mdocument_srl)
|
if($this->module_info->mdocument_srl)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ class pageView extends page
|
||||||
$oTemplate = &TemplateHandler::getInstance();
|
$oTemplate = &TemplateHandler::getInstance();
|
||||||
|
|
||||||
$oDocumentModel = getModel('document');
|
$oDocumentModel = getModel('document');
|
||||||
$oDocument = $oDocumentModel->getDocument(0, true);
|
$oDocument = $oDocumentModel->getDocument(0);
|
||||||
|
|
||||||
if($this->module_info->document_srl)
|
if($this->module_info->document_srl)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,12 @@ $lang->cmd_point_recal = 'Reset Point';
|
||||||
$lang->about_cmd_point_recal = 'All point will be initialized only with articles/comments/attachments/join points. Only members who do website activities will get signup points after reset. Please use this function when complete initialization is required in case of data transferring or other situations.';
|
$lang->about_cmd_point_recal = 'All point will be initialized only with articles/comments/attachments/join points. Only members who do website activities will get signup points after reset. Please use this function when complete initialization is required in case of data transferring or other situations.';
|
||||||
$lang->default_group = 'Default Group';
|
$lang->default_group = 'Default Group';
|
||||||
$lang->point_link_group = 'Group Change by Level';
|
$lang->point_link_group = 'Group Change by Level';
|
||||||
$lang->point_group_reset_and_add = 'Reset adjusted groups and add new groups';
|
$lang->point_group_reset_type = 'Change Type';
|
||||||
$lang->point_group_add_only = 'Only to new groups';
|
$lang->point_group_reset_and_add = 'Remove from other groups and add new group';
|
||||||
|
$lang->point_group_add_only = 'Keep other groups and add new group';
|
||||||
|
$lang->point_group_ratchet = 'Change on Point Reduction';
|
||||||
|
$lang->point_group_ratchet_yes = 'Maintain current group if point is reduced';
|
||||||
|
$lang->point_group_ratchet_no = 'Move to lower group if point is reduced';
|
||||||
$lang->about_point_link_group = 'If you specify level for a specific group, users are assigned into the group when they advance to the level by getting points.';
|
$lang->about_point_link_group = 'If you specify level for a specific group, users are assigned into the group when they advance to the level by getting points.';
|
||||||
$lang->about_module_point = 'You can set point for each module, and modules which don\'t have any value will use the default point. All points will be restored on acting reverse.';
|
$lang->about_module_point = 'You can set point for each module, and modules which don\'t have any value will use the default point. All points will be restored on acting reverse.';
|
||||||
$lang->point_signup = 'Sign up';
|
$lang->point_signup = 'Sign up';
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,12 @@ $lang->cmd_point_recal = '포인트 초기화';
|
||||||
$lang->about_cmd_point_recal = '게시글/댓글/첨부파일/회원가입 점수만 이용하여 모든 포인트 점수를 초기화합니다. 회원 가입 점수는 초기화 후 해당 회원이 활동을 하면 부여되고 그 전에는 부여되지 않습니다. 데이터 이전 등을 하여 포인트를 완전히 초기화해야 할 경우에만 사용하세요.';
|
$lang->about_cmd_point_recal = '게시글/댓글/첨부파일/회원가입 점수만 이용하여 모든 포인트 점수를 초기화합니다. 회원 가입 점수는 초기화 후 해당 회원이 활동을 하면 부여되고 그 전에는 부여되지 않습니다. 데이터 이전 등을 하여 포인트를 완전히 초기화해야 할 경우에만 사용하세요.';
|
||||||
$lang->default_group = '기본 그룹';
|
$lang->default_group = '기본 그룹';
|
||||||
$lang->point_link_group = '그룹 연동';
|
$lang->point_link_group = '그룹 연동';
|
||||||
$lang->point_group_reset_and_add = '설정된 그룹 초기화 후 새 그룹 부여';
|
$lang->point_group_reset_type = '그룹 연동 방식';
|
||||||
$lang->point_group_add_only = '새 그룹만 부여';
|
$lang->point_group_reset_and_add = '예전 그룹을 제거하고 새 그룹을 추가';
|
||||||
|
$lang->point_group_add_only = '예전 그룹을 유지하며 새 그룹을 추가';
|
||||||
|
$lang->point_group_ratchet = '포인트 감소 처리 방식';
|
||||||
|
$lang->point_group_ratchet_yes = '포인트가 감소하더라도 기존 그룹을 유지';
|
||||||
|
$lang->point_group_ratchet_no = '포인트가 감소하면 하위 그룹으로 이동';
|
||||||
$lang->about_point_link_group = '그룹에 원하는 레벨을 지정하면, 회원의 포인트가 해당 레벨의 포인트에 도달할 때 그룹이 변경됩니다.';
|
$lang->about_point_link_group = '그룹에 원하는 레벨을 지정하면, 회원의 포인트가 해당 레벨의 포인트에 도달할 때 그룹이 변경됩니다.';
|
||||||
$lang->about_module_point = '모듈별 포인트를 지정할 수 있으며 지정되지 않은 모듈은 기본 포인트를 이용합니다. 모든 점수는 반대 행동을 하였을 경우 원상복구 됩니다.';
|
$lang->about_module_point = '모듈별 포인트를 지정할 수 있으며 지정되지 않은 모듈은 기본 포인트를 이용합니다. 모든 점수는 반대 행동을 하였을 경우 원상복구 됩니다.';
|
||||||
$lang->point_signup = '가입';
|
$lang->point_signup = '가입';
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,7 @@ class pointAdminController extends point
|
||||||
}
|
}
|
||||||
|
|
||||||
$config->group_reset = $args->group_reset;
|
$config->group_reset = $args->group_reset;
|
||||||
|
$config->group_ratchet = $args->group_ratchet;
|
||||||
// Per-level point configurations
|
// Per-level point configurations
|
||||||
unset($config->level_step);
|
unset($config->level_step);
|
||||||
for($i=1;$i<=$config->max_level;$i++)
|
for($i=1;$i<=$config->max_level;$i++)
|
||||||
|
|
|
||||||
|
|
@ -7,95 +7,158 @@
|
||||||
*/
|
*/
|
||||||
class point extends ModuleObject
|
class point extends ModuleObject
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Cache for the point module's own configuration.
|
||||||
|
*/
|
||||||
|
protected static $_config = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache for other modules' point configuration.
|
||||||
|
*/
|
||||||
|
protected static $_module_config_cache = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache for member points.
|
||||||
|
*/
|
||||||
|
protected static $_member_point_cache = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Triggers to insert.
|
||||||
|
*/
|
||||||
|
protected static $_insert_triggers = array(
|
||||||
|
array('member.insertMember', 'after', 'controller', 'triggerInsertMember'),
|
||||||
|
array('member.doLogin', 'after', 'controller', 'triggerAfterLogin'),
|
||||||
|
array('member.deleteGroup', 'after', 'controller', 'triggerDeleteGroup'),
|
||||||
|
array('document.insertDocument', 'after', 'controller', 'triggerInsertDocument'),
|
||||||
|
array('document.updateDocument', 'before', 'controller', 'triggerUpdateDocument'),
|
||||||
|
array('document.deleteDocument', 'after', 'controller', 'triggerDeleteDocument'),
|
||||||
|
array('comment.insertComment', 'after', 'controller', 'triggerInsertComment'),
|
||||||
|
array('comment.updateComment', 'after', 'controller', 'triggerUpdateComment'),
|
||||||
|
array('comment.deleteComment', 'after', 'controller', 'triggerDeleteComment'),
|
||||||
|
array('file.deleteFile', 'after', 'controller', 'triggerDeleteFile'),
|
||||||
|
array('file.downloadFile', 'before', 'controller', 'triggerBeforeDownloadFile'),
|
||||||
|
array('file.downloadFile', 'after', 'controller', 'triggerDownloadFile'),
|
||||||
|
array('document.updateReadedCount', 'after', 'controller', 'triggerUpdateReadedCount'),
|
||||||
|
array('document.updateVotedCount', 'after', 'controller', 'triggerUpdateVotedCount'),
|
||||||
|
array('document.updateVotedCountCancel', 'after', 'controller', 'triggerUpdateVotedCount'),
|
||||||
|
array('comment.updateVotedCount', 'after', 'controller', 'triggerUpdateVotedCount'),
|
||||||
|
array('comment.updateVotedCountCancel', 'after', 'controller', 'triggerUpdateVotedCount'),
|
||||||
|
array('module.procModuleAdminCopyModule', 'after', 'controller', 'triggerCopyModule'),
|
||||||
|
array('module.dispAdditionSetup', 'after', 'view', 'triggerDispPointAdditionSetup'),
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Triggers to delete.
|
||||||
|
*/
|
||||||
|
protected static $_delete_triggers = array(
|
||||||
|
array('document.deleteDocument', 'before', 'controller', 'triggerBeforeDeleteDocument'),
|
||||||
|
array('file.insertFile', 'after', 'controller', 'triggerInsertFile'),
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Shortcut to getting module configuration
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
if (self::$_config === null)
|
||||||
|
{
|
||||||
|
self::$_config = getModel('module')->getModuleConfig('point');
|
||||||
|
}
|
||||||
|
return self::$_config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check triggers.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function checkTriggers()
|
||||||
|
{
|
||||||
|
$oModuleModel = getModel('module');
|
||||||
|
foreach (self::$_insert_triggers as $trigger)
|
||||||
|
{
|
||||||
|
if (!$oModuleModel->getTrigger($trigger[0], $this->module, $trigger[2], $trigger[3], $trigger[1]))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach (self::$_delete_triggers as $trigger)
|
||||||
|
{
|
||||||
|
if ($oModuleModel->getTrigger($trigger[0], $this->module, $trigger[2], $trigger[3], $trigger[1]))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register triggers.
|
||||||
|
*
|
||||||
|
* @return object
|
||||||
|
*/
|
||||||
|
public function registerTriggers()
|
||||||
|
{
|
||||||
|
$oModuleModel = getModel('module');
|
||||||
|
$oModuleController = getController('module');
|
||||||
|
foreach (self::$_insert_triggers as $trigger)
|
||||||
|
{
|
||||||
|
if (!$oModuleModel->getTrigger($trigger[0], $this->module, $trigger[2], $trigger[3], $trigger[1]))
|
||||||
|
{
|
||||||
|
$oModuleController->insertTrigger($trigger[0], $this->module, $trigger[2], $trigger[3], $trigger[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach (self::$_delete_triggers as $trigger)
|
||||||
|
{
|
||||||
|
if ($oModuleModel->getTrigger($trigger[0], $this->module, $trigger[2], $trigger[3], $trigger[1]))
|
||||||
|
{
|
||||||
|
$oModuleController->deleteTrigger($trigger[0], $this->module, $trigger[2], $trigger[3], $trigger[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new Object(0, 'success_updated');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Additional tasks required to accomplish during the installation
|
* @brief Additional tasks required to accomplish during the installation
|
||||||
*/
|
*/
|
||||||
function moduleInstall()
|
function moduleInstall()
|
||||||
{
|
{
|
||||||
// Registration in action forward (for using in the administrator mode)
|
// Define default configuration.
|
||||||
$oModuleController = getController('module');
|
|
||||||
// Create a directory to store points information
|
|
||||||
FileHandler::makeDir('./files/member_extra_info/point');
|
|
||||||
|
|
||||||
$oModuleController = getController('module');
|
|
||||||
// The highest level
|
|
||||||
$config = new stdClass;
|
$config = new stdClass;
|
||||||
// default, point module is OFF
|
|
||||||
$config->able_module = 'N';
|
$config->able_module = 'N';
|
||||||
$config->max_level = 30;
|
|
||||||
// Per-level score
|
|
||||||
for($i=1;$i<=30;$i++)
|
|
||||||
{
|
|
||||||
$config->level_step[$i] = pow($i,2)*90;
|
|
||||||
}
|
|
||||||
// Points for registration
|
|
||||||
$config->signup_point = 10;
|
|
||||||
// Login points
|
|
||||||
$config->login_point = 5;
|
|
||||||
// Point's name
|
|
||||||
$config->point_name = 'point';
|
$config->point_name = 'point';
|
||||||
// Level icon directory
|
$config->level_icon = 'default';
|
||||||
$config->level_icon = "default";
|
$config->disable_read_document = 'N';
|
||||||
// Prevent downloads if there are no scores
|
$config->disable_download = 'N';
|
||||||
$config->disable_download = false;
|
$config->group_reset = 'Y';
|
||||||
|
$config->group_ratchet = 'N';
|
||||||
/**
|
$config->max_level = 30;
|
||||||
* Define the default points per module as well as all actions (as we do not know if it is forum or blogs, specify "act")
|
for ($i = 1; $i <= 30; $i++)
|
||||||
*/
|
{
|
||||||
// Insert document
|
$config->level_step[$i] = pow($i, 2) * 90;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Define default points.
|
||||||
|
$config->signup_point = 10;
|
||||||
|
$config->login_point = 5;
|
||||||
$config->insert_document = 10;
|
$config->insert_document = 10;
|
||||||
|
|
||||||
$config->insert_document_act = 'procBoardInsertDocument';
|
|
||||||
$config->delete_document_act = 'procBoardDeleteDocument';
|
|
||||||
// Insert comment
|
|
||||||
$config->insert_comment = 5;
|
$config->insert_comment = 5;
|
||||||
|
|
||||||
$config->insert_comment_act = 'procBoardInsertComment,procBlogInsertComment';
|
|
||||||
$config->delete_comment_act = 'procBoardDeleteComment,procBlogDeleteComment';
|
|
||||||
// Upload
|
|
||||||
$config->upload_file = 5;
|
$config->upload_file = 5;
|
||||||
|
|
||||||
$config->upload_file_act = 'procFileUpload';
|
|
||||||
$config->delete_file_act = 'procFileDelete';
|
|
||||||
// Download
|
|
||||||
$config->download_file = -5;
|
$config->download_file = -5;
|
||||||
$config->download_file_act = 'procFileDownload';
|
|
||||||
// View
|
|
||||||
$config->read_document = 0;
|
$config->read_document = 0;
|
||||||
// Vote up / Vote down
|
|
||||||
$config->voted = 0;
|
$config->voted = 0;
|
||||||
$config->blamed = 0;
|
$config->blamed = 0;
|
||||||
// Comment Vote up / Comment Vote down
|
|
||||||
$config->voted_comment = 0;
|
$config->voted_comment = 0;
|
||||||
$config->blamed_comment = 0;
|
$config->blamed_comment = 0;
|
||||||
// Save configurations
|
|
||||||
$oModuleController->insertModuleConfig('point', $config);
|
// Save module config.
|
||||||
// Cash act list for faster execution
|
getController('module')->insertModuleConfig('point', $config);
|
||||||
$oPointController = getAdminController('point');
|
|
||||||
$oPointController->cacheActList();
|
// Create a directory to store points information.
|
||||||
// Add a trigger for registration/insert document/insert comment/upload a file/download
|
FileHandler::makeDir('./files/member_extra_info/point');
|
||||||
$oModuleController->insertTrigger('member.insertMember', 'point', 'controller', 'triggerInsertMember', 'after');
|
|
||||||
$oModuleController->insertTrigger('document.insertDocument', 'point', 'controller', 'triggerInsertDocument', 'after');
|
// Register triggers.
|
||||||
$oModuleController->insertTrigger('document.deleteDocument', 'point', 'controller', 'triggerBeforeDeleteDocument', 'before');
|
return $this->registerTriggers();
|
||||||
$oModuleController->insertTrigger('document.deleteDocument', 'point', 'controller', 'triggerDeleteDocument', 'after');
|
|
||||||
$oModuleController->insertTrigger('comment.insertComment', 'point', 'controller', 'triggerInsertComment', 'after');
|
|
||||||
$oModuleController->insertTrigger('comment.deleteComment', 'point', 'controller', 'triggerDeleteComment', 'after');
|
|
||||||
$oModuleController->insertTrigger('file.insertFile', 'point', 'controller', 'triggerInsertFile', 'after');
|
|
||||||
$oModuleController->insertTrigger('file.deleteFile', 'point', 'controller', 'triggerDeleteFile', 'after');
|
|
||||||
$oModuleController->insertTrigger('file.downloadFile', 'point', 'controller', 'triggerBeforeDownloadFile', 'before');
|
|
||||||
$oModuleController->insertTrigger('file.downloadFile', 'point', 'controller', 'triggerDownloadFile', 'after');
|
|
||||||
$oModuleController->insertTrigger('member.doLogin', 'point', 'controller', 'triggerAfterLogin', 'after');
|
|
||||||
$oModuleController->insertTrigger('member.deleteGroup', 'point', 'controller', 'triggerDeleteGroup', 'after');
|
|
||||||
$oModuleController->insertTrigger('module.dispAdditionSetup', 'point', 'view', 'triggerDispPointAdditionSetup', 'after');
|
|
||||||
$oModuleController->insertTrigger('document.updateReadedCount', 'point', 'controller', 'triggerUpdateReadedCount', 'after');
|
|
||||||
// Add a trigger for voting up and down 2008.05.13 haneul
|
|
||||||
$oModuleController->insertTrigger('document.updateVotedCount', 'point', 'controller', 'triggerUpdateVotedCount', 'after');
|
|
||||||
// Add a trigger for using points for permanent saving of a temporarily saved document 2009.05.19 zero
|
|
||||||
$oModuleController->insertTrigger('document.updateDocument', 'point', 'controller', 'triggerUpdateDocument', 'before');
|
|
||||||
// Add a trigger for comment voting up and down 2014.08.30 sejin7940
|
|
||||||
$oModuleController->insertTrigger('comment.updateVotedCount', 'point', 'controller', 'triggerUpdateVotedCount', 'after');
|
|
||||||
$oModuleController->insertTrigger('document.updateVotedCountCancel', 'point', 'controller', 'triggerUpdateVotedCount', 'after');
|
|
||||||
return new Object();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -103,41 +166,11 @@ class point extends ModuleObject
|
||||||
*/
|
*/
|
||||||
function checkUpdate()
|
function checkUpdate()
|
||||||
{
|
{
|
||||||
// Get the information of the point module
|
$config = $this->getConfig();
|
||||||
$oModuleModel = getModel('module');
|
if ($config->able_module === 'Y')
|
||||||
|
|
||||||
$config = $oModuleModel->getModuleConfig('point');
|
|
||||||
// check if module is abled
|
|
||||||
if($config->able_module != 'N')
|
|
||||||
{
|
{
|
||||||
// Add a trigger for registration/insert document/insert comment/upload a file/download
|
return $this->checkTriggers();
|
||||||
if(!$oModuleModel->getTrigger('member.insertMember', 'point', 'controller', 'triggerInsertMember', 'after')) return true;
|
|
||||||
if(!$oModuleModel->getTrigger('document.insertDocument', 'point', 'controller', 'triggerInsertDocument', 'after')) return true;
|
|
||||||
if(!$oModuleModel->getTrigger('document.deleteDocument', 'point', 'controller', 'triggerBeforeDeleteDocument', 'before')) return true;
|
|
||||||
if(!$oModuleModel->getTrigger('document.deleteDocument', 'point', 'controller', 'triggerDeleteDocument', 'after')) return true;
|
|
||||||
if(!$oModuleModel->getTrigger('comment.insertComment', 'point', 'controller', 'triggerInsertComment', 'after')) return true;
|
|
||||||
if(!$oModuleModel->getTrigger('comment.deleteComment', 'point', 'controller', 'triggerDeleteComment', 'after')) return true;
|
|
||||||
if(!$oModuleModel->getTrigger('file.insertFile', 'point', 'controller', 'triggerInsertFile', 'after')) return true;
|
|
||||||
if(!$oModuleModel->getTrigger('file.deleteFile', 'point', 'controller', 'triggerDeleteFile', 'after')) return true;
|
|
||||||
if(!$oModuleModel->getTrigger('file.downloadFile', 'point', 'controller', 'triggerBeforeDownloadFile', 'before')) return true;
|
|
||||||
if(!$oModuleModel->getTrigger('file.downloadFile', 'point', 'controller', 'triggerDownloadFile', 'after')) return true;
|
|
||||||
if(!$oModuleModel->getTrigger('member.doLogin', 'point', 'controller', 'triggerAfterLogin', 'after')) return true;
|
|
||||||
if(!$oModuleModel->getTrigger('member.deleteGroup', 'point', 'controller', 'triggerDeleteGroup', 'after')) return true;
|
|
||||||
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'point', 'view', 'triggerDispPointAdditionSetup', 'after')) return true;
|
|
||||||
if(!$oModuleModel->getTrigger('document.updateReadedCount', 'point', 'controller', 'triggerUpdateReadedCount', 'after')) return true;
|
|
||||||
// Add a trigger for voting up and down 2008.05.13 haneul
|
|
||||||
if(!$oModuleModel->getTrigger('document.updateVotedCount', 'point', 'controller', 'triggerUpdateVotedCount', 'after')) return true;
|
|
||||||
// Add a trigger for using points for permanent saving of a temporarily saved document 2009.05.19 zero
|
|
||||||
if(!$oModuleModel->getTrigger('document.updateDocument', 'point', 'controller', 'triggerUpdateDocument', 'before')) return true;
|
|
||||||
|
|
||||||
// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
|
|
||||||
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'point', 'controller', 'triggerCopyModule', 'after')) return true;
|
|
||||||
|
|
||||||
// Add a trigger for comment voting up and down 2014.08.30 sejin7940
|
|
||||||
if(!$oModuleModel->getTrigger('comment.updateVotedCount', 'point', 'controller', 'triggerUpdateVotedCount', 'after')) return true;
|
|
||||||
if(!$oModuleModel->getTrigger('document.updateVotedCountCancel', 'point', 'controller', 'triggerUpdateVotedCount', 'after')) return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -145,62 +178,7 @@ class point extends ModuleObject
|
||||||
*/
|
*/
|
||||||
function moduleUpdate()
|
function moduleUpdate()
|
||||||
{
|
{
|
||||||
// Get the information of the point module
|
return $this->registerTriggers();
|
||||||
$oModuleModel = getModel('module');
|
|
||||||
$oModuleController = getController('module');
|
|
||||||
// Add a trigger for registration/insert document/insert comment/upload a file/download
|
|
||||||
if(!$oModuleModel->getTrigger('member.insertMember', 'point', 'controller', 'triggerInsertMember', 'after'))
|
|
||||||
$oModuleController->insertTrigger('member.insertMember', 'point', 'controller', 'triggerInsertMember', 'after');
|
|
||||||
if(!$oModuleModel->getTrigger('document.insertDocument', 'point', 'controller', 'triggerInsertDocument', 'after'))
|
|
||||||
$oModuleController->insertTrigger('document.insertDocument', 'point', 'controller', 'triggerInsertDocument', 'after');
|
|
||||||
if(!$oModuleModel->getTrigger('document.deleteDocument', 'point', 'controller', 'triggerBeforeDeleteDocument', 'before'))
|
|
||||||
$oModuleController->insertTrigger('document.deleteDocument', 'point', 'controller', 'triggerBeforeDeleteDocument', 'before');
|
|
||||||
if(!$oModuleModel->getTrigger('document.deleteDocument', 'point', 'controller', 'triggerDeleteDocument', 'after'))
|
|
||||||
$oModuleController->insertTrigger('document.deleteDocument', 'point', 'controller', 'triggerDeleteDocument', 'after');
|
|
||||||
if(!$oModuleModel->getTrigger('comment.insertComment', 'point', 'controller', 'triggerInsertComment', 'after'))
|
|
||||||
$oModuleController->insertTrigger('comment.insertComment', 'point', 'controller', 'triggerInsertComment', 'after');
|
|
||||||
if(!$oModuleModel->getTrigger('comment.deleteComment', 'point', 'controller', 'triggerDeleteComment', 'after'))
|
|
||||||
$oModuleController->insertTrigger('comment.deleteComment', 'point', 'controller', 'triggerDeleteComment', 'after');
|
|
||||||
if(!$oModuleModel->getTrigger('file.insertFile', 'point', 'controller', 'triggerInsertFile', 'after'))
|
|
||||||
$oModuleController->insertTrigger('file.insertFile', 'point', 'controller', 'triggerInsertFile', 'after');
|
|
||||||
if(!$oModuleModel->getTrigger('file.deleteFile', 'point', 'controller', 'triggerDeleteFile', 'after'))
|
|
||||||
$oModuleController->insertTrigger('file.deleteFile', 'point', 'controller', 'triggerDeleteFile', 'after');
|
|
||||||
if(!$oModuleModel->getTrigger('file.downloadFile', 'point', 'controller', 'triggerBeforeDownloadFile', 'before'))
|
|
||||||
$oModuleController->insertTrigger('file.downloadFile', 'point', 'controller', 'triggerBeforeDownloadFile', 'before');
|
|
||||||
if(!$oModuleModel->getTrigger('file.downloadFile', 'point', 'controller', 'triggerDownloadFile', 'after'))
|
|
||||||
$oModuleController->insertTrigger('file.downloadFile', 'point', 'controller', 'triggerDownloadFile', 'after');
|
|
||||||
if(!$oModuleModel->getTrigger('member.doLogin', 'point', 'controller', 'triggerAfterLogin', 'after'))
|
|
||||||
$oModuleController->insertTrigger('member.doLogin', 'point', 'controller', 'triggerAfterLogin', 'after');
|
|
||||||
if(!$oModuleModel->getTrigger('member.deleteGroup', 'point', 'controller', 'triggerDeleteGroup', 'after'))
|
|
||||||
$oModuleController->insertTrigger('member.deleteGroup', 'point', 'controller', 'triggerDeleteGroup', 'after');
|
|
||||||
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'point', 'view', 'triggerDispPointAdditionSetup', 'after'))
|
|
||||||
$oModuleController->insertTrigger('module.dispAdditionSetup', 'point', 'view', 'triggerDispPointAdditionSetup', 'after');
|
|
||||||
if(!$oModuleModel->getTrigger('document.updateReadedCount', 'point', 'controller', 'triggerUpdateReadedCount', 'after'))
|
|
||||||
$oModuleController->insertTrigger('document.updateReadedCount', 'point', 'controller', 'triggerUpdateReadedCount', 'after');
|
|
||||||
// Add a trigger for voting up and down 2008.05.13 haneul
|
|
||||||
if(!$oModuleModel->getTrigger('document.updateVotedCount', 'point', 'controller', 'triggerUpdateVotedCount', 'after'))
|
|
||||||
$oModuleController->insertTrigger('document.updateVotedCount', 'point', 'controller', 'triggerUpdateVotedCount', 'after');
|
|
||||||
if(!$oModuleModel->getTrigger('document.updateVotedCountCancel', 'point', 'controller', 'triggerUpdateVotedCount', 'after'))
|
|
||||||
$oModuleController->insertTrigger('document.updateVotedCountCancel', 'point', 'controller', 'triggerUpdateVotedCount', 'after');
|
|
||||||
// Add a trigger for using points for permanent saving of a temporarily saved document 2009.05.19 zero
|
|
||||||
if(!$oModuleModel->getTrigger('document.updateDocument', 'point', 'controller', 'triggerUpdateDocument', 'before'))
|
|
||||||
$oModuleController->insertTrigger('document.updateDocument', 'point', 'controller', 'triggerUpdateDocument', 'before');
|
|
||||||
// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
|
|
||||||
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'point', 'controller', 'triggerCopyModule', 'after'))
|
|
||||||
{
|
|
||||||
$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'point', 'controller', 'triggerCopyModule', 'after');
|
|
||||||
}
|
|
||||||
// Add a trigger for comment voting up and down 2014.08.30 sejin7940
|
|
||||||
if(!$oModuleModel->getTrigger('comment.updateVotedCount', 'point', 'controller', 'triggerUpdateVotedCount', 'after'))
|
|
||||||
{
|
|
||||||
$config = $oModuleModel->getModuleConfig('point');
|
|
||||||
$config->voted_comment = 0;
|
|
||||||
$config->blamed_comment = 0;
|
|
||||||
$oModuleController->insertModuleConfig('point', $config);
|
|
||||||
$oModuleController->insertTrigger('comment.updateVotedCount', 'point', 'controller', 'triggerUpdateVotedCount', 'after');
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Object(0, 'success_updated');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -208,9 +186,7 @@ class point extends ModuleObject
|
||||||
*/
|
*/
|
||||||
function recompileCache()
|
function recompileCache()
|
||||||
{
|
{
|
||||||
// redefine point action file
|
|
||||||
$oPointAdminController = getAdminController('point');
|
|
||||||
$oPointAdminController->cacheActList();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* End of file point.class.php */
|
/* End of file point.class.php */
|
||||||
|
|
|
||||||
|
|
@ -10,65 +10,72 @@ class pointController extends point
|
||||||
/**
|
/**
|
||||||
* @brief Initialization
|
* @brief Initialization
|
||||||
*/
|
*/
|
||||||
function init()
|
public function init()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Membership point application trigger
|
* @brief Membership point application trigger
|
||||||
*/
|
*/
|
||||||
function triggerInsertMember(&$obj)
|
public function triggerInsertMember($obj)
|
||||||
{
|
{
|
||||||
// Get the point module information
|
|
||||||
$oModuleModel = getModel('module');
|
|
||||||
$config = $oModuleModel->getModuleConfig('point');
|
|
||||||
// Get the member_srl of the newly registered member
|
|
||||||
$member_srl = $obj->member_srl;
|
$member_srl = $obj->member_srl;
|
||||||
// Get the points of the member
|
if (!$member_srl)
|
||||||
$oPointModel = getModel('point');
|
{
|
||||||
$cur_point = $oPointModel->getPoint($member_srl, true);
|
return new Object();
|
||||||
|
}
|
||||||
$point = $config->signup_point;
|
|
||||||
// Increase the point
|
$config = $this->getConfig();
|
||||||
$cur_point += $point;
|
$point = intval($config->signup_point);
|
||||||
$this->setPoint($member_srl,$cur_point, 'signup');
|
if (!$point)
|
||||||
|
{
|
||||||
|
return new Object();
|
||||||
|
}
|
||||||
|
|
||||||
|
$cur_point = getModel('point')->getPoint($member_srl, true);
|
||||||
|
$this->setPoint($member_srl, $cur_point + $point, 'signup');
|
||||||
|
|
||||||
return new Object();
|
return new Object();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A trigger to add points to the member for login
|
* @brief A trigger to add points to the member for login
|
||||||
*/
|
*/
|
||||||
function triggerAfterLogin(&$obj)
|
public function triggerAfterLogin($obj)
|
||||||
{
|
{
|
||||||
$member_srl = $obj->member_srl;
|
$member_srl = $obj->member_srl;
|
||||||
if(!$member_srl) return new Object();
|
if (!$member_srl)
|
||||||
// If the last login is not today, give the points
|
{
|
||||||
if(substr($obj->last_login,0,8)==date("Ymd")) return new Object();
|
return new Object();
|
||||||
// Get the point module information
|
}
|
||||||
$oModuleModel = getModel('module');
|
|
||||||
$config = $oModuleModel->getModuleConfig('point');
|
// Points are given only once a day.
|
||||||
// Get the points of the member
|
if (substr($obj->last_login, 0, 8) === date('Ymd'))
|
||||||
$oPointModel = getModel('point');
|
{
|
||||||
$cur_point = $oPointModel->getPoint($member_srl, true);
|
return new Object();
|
||||||
|
}
|
||||||
$point = $config->login_point;
|
|
||||||
// Increase the point
|
$config = $this->getConfig();
|
||||||
$cur_point += $point;
|
$point = intval($config->login_point);
|
||||||
$this->setPoint($member_srl,$cur_point);
|
if (!$point)
|
||||||
|
{
|
||||||
|
return new Object();
|
||||||
|
}
|
||||||
|
|
||||||
|
$cur_point = getModel('point')->getPoint($member_srl, true);
|
||||||
|
$this->setPoint($member_srl, $cur_point + $point);
|
||||||
|
|
||||||
return new Object();
|
return new Object();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Member group deletion trigger
|
* @brief Member group deletion trigger
|
||||||
*/
|
*/
|
||||||
function triggerDeleteGroup(&$obj)
|
public function triggerDeleteGroup($obj)
|
||||||
{
|
{
|
||||||
// Get the point module config
|
|
||||||
$config = getModel('module')->getModuleConfig('point');
|
|
||||||
// Get the group_srl of the deleted group
|
|
||||||
$group_srl = $obj->group_srl;
|
$group_srl = $obj->group_srl;
|
||||||
|
$config = $this->getConfig();
|
||||||
|
|
||||||
// Exclude deleted group from point/level/group integration
|
// Exclude deleted group from point/level/group integration
|
||||||
if($config->point_group && isset($config->point_group[$group_srl]))
|
if($config->point_group && isset($config->point_group[$group_srl]))
|
||||||
{
|
{
|
||||||
|
|
@ -82,35 +89,41 @@ class pointController extends point
|
||||||
/**
|
/**
|
||||||
* @brief A trigger to add points to the member for creating a post
|
* @brief A trigger to add points to the member for creating a post
|
||||||
*/
|
*/
|
||||||
function triggerInsertDocument(&$obj)
|
public function triggerInsertDocument($obj)
|
||||||
{
|
{
|
||||||
$oDocumentModel = getModel('document');
|
$module_srl = $obj->module_srl;
|
||||||
if($obj->status != $oDocumentModel->getConfigStatus('temp'))
|
$member_srl = abs($obj->member_srl);
|
||||||
|
if (!$module_srl || !$member_srl)
|
||||||
{
|
{
|
||||||
$module_srl = $obj->module_srl;
|
return new Object();
|
||||||
$member_srl = $obj->member_srl;
|
|
||||||
if(!$module_srl || !$member_srl) return new Object();
|
|
||||||
// The fix to disable giving points for saving the document temporarily
|
|
||||||
if($module_srl == $member_srl) return new Object();
|
|
||||||
// Get the point module information
|
|
||||||
$oModuleModel = getModel('module');
|
|
||||||
$config = $oModuleModel->getModuleConfig('point');
|
|
||||||
$module_config = $oModuleModel->getModulePartConfig('point',$module_srl);
|
|
||||||
// Get the points of the member
|
|
||||||
$oPointModel = getModel('point');
|
|
||||||
$cur_point = $oPointModel->getPoint($member_srl, true);
|
|
||||||
|
|
||||||
$point = $module_config['insert_document'];
|
|
||||||
if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document;
|
|
||||||
$cur_point += $point;
|
|
||||||
// Add points for attaching a file
|
|
||||||
$point = $module_config['upload_file'];
|
|
||||||
if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
|
|
||||||
if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count;
|
|
||||||
// Increase the point
|
|
||||||
$this->setPoint($member_srl,$cur_point);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The fix to disable giving points for saving the document temporarily
|
||||||
|
if ($module_srl == $member_srl)
|
||||||
|
{
|
||||||
|
return new Object();
|
||||||
|
}
|
||||||
|
if ($obj->status === getModel('document')->getConfigStatus('temp'))
|
||||||
|
{
|
||||||
|
return new Object();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the points of the member
|
||||||
|
$cur_point = getModel('point')->getPoint($member_srl, true);
|
||||||
|
|
||||||
|
// Add points for the document.
|
||||||
|
$document_point = $this->_getModulePointConfig($module_srl, 'insert_document');
|
||||||
|
$cur_point += $document_point;
|
||||||
|
|
||||||
|
// Add points for attached files.
|
||||||
|
if ($obj->uploaded_count > 0)
|
||||||
|
{
|
||||||
|
$attached_files_point = $this->_getModulePointConfig($module_srl, 'upload_file');
|
||||||
|
$cur_point += $attached_files_point * $obj->uploaded_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Increase the point.
|
||||||
|
$this->setPoint($member_srl, $cur_point);
|
||||||
return new Object();
|
return new Object();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -118,198 +131,183 @@ class pointController extends point
|
||||||
* @brief The trigger to give points for normal saving the temporarily saved document
|
* @brief The trigger to give points for normal saving the temporarily saved document
|
||||||
* Temporary storage at the point in 1.2.3 changed to avoid payment
|
* Temporary storage at the point in 1.2.3 changed to avoid payment
|
||||||
*/
|
*/
|
||||||
function triggerUpdateDocument(&$obj)
|
public function triggerUpdateDocument($obj)
|
||||||
{
|
{
|
||||||
$oDocumentModel = getModel('document');
|
$oDocumentModel = getModel('document');
|
||||||
$document_srl = $obj->document_srl;
|
$oDocument = $oDocumentModel->getDocument($obj->document_srl);
|
||||||
$oDocument = $oDocumentModel->getDocument($document_srl);
|
|
||||||
|
$module_srl = $oDocument->get('module_srl');
|
||||||
// if status is TEMP or PUBLIC... give not point, only status is empty
|
$member_srl = abs($oDocument->get('member_srl'));
|
||||||
if($oDocument->get('status') == $oDocumentModel->getConfigStatus('temp') && $obj->status != $oDocumentModel->getConfigStatus('temp'))
|
if (!$module_srl || !$member_srl)
|
||||||
{
|
{
|
||||||
$oModuleModel = getModel('module');
|
return new Object();
|
||||||
|
}
|
||||||
// Get the point module information
|
|
||||||
$config = $oModuleModel->getModuleConfig('point');
|
// Only give points if the document is being updated from TEMP to another status such as PUBLIC.
|
||||||
$module_config = $oModuleModel->getModulePartConfig('point',$obj->module_srl);
|
if ($obj->status === $oDocumentModel->getConfigStatus('temp') || $oDocument->get('status') !== $oDocumentModel->getConfigStatus('temp'))
|
||||||
// Get the points of the member
|
{
|
||||||
$oPointModel = getModel('point');
|
if ($obj->uploaded_count > $oDocument->get('uploaded_count'))
|
||||||
$cur_point = $oPointModel->getPoint($oDocument->get('member_srl'), true);
|
{
|
||||||
|
$cur_point = getModel('point')->getPoint($member_srl, true);
|
||||||
$point = $module_config['insert_document'];
|
$attached_files_point = $this->_getModulePointConfig($module_srl, 'upload_file');
|
||||||
if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document;
|
$cur_point += $attached_files_point * ($obj->uploaded_count - $oDocument->get('uploaded_count'));
|
||||||
$cur_point += $point;
|
$this->setPoint($member_srl, $cur_point);
|
||||||
// Add points for attaching a file
|
}
|
||||||
$point = $module_config['upload_file'];
|
return new Object();
|
||||||
if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
|
|
||||||
if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count;
|
|
||||||
// Increase the point
|
|
||||||
$this->setPoint($oDocument->get('member_srl'), $cur_point);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get the points of the member
|
||||||
|
$cur_point = getModel('point')->getPoint($member_srl, true);
|
||||||
|
|
||||||
|
// Add points for the document.
|
||||||
|
$document_point = $this->_getModulePointConfig($module_srl, 'insert_document');
|
||||||
|
$cur_point += $document_point;
|
||||||
|
|
||||||
|
// Add points for attached files.
|
||||||
|
if ($obj->uploaded_count > 0)
|
||||||
|
{
|
||||||
|
$attached_files_point = $this->_getModulePointConfig($module_srl, 'upload_file');
|
||||||
|
$cur_point += $attached_files_point * $obj->uploaded_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Increase the point.
|
||||||
|
$this->setPoint($member_srl, $cur_point);
|
||||||
return new Object();
|
return new Object();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The trigger which deducts the points related to post comments before deleting the post itself
|
* @brief The trigger which deducts the points related to post comments before deleting the post itself
|
||||||
*/
|
*/
|
||||||
function triggerBeforeDeleteDocument(&$obj)
|
public function triggerBeforeDeleteDocument($obj)
|
||||||
{
|
{
|
||||||
$document_srl = $obj->document_srl;
|
|
||||||
$member_srl = $obj->member_srl;
|
|
||||||
|
|
||||||
$oDocumentModel = getModel('document');
|
|
||||||
$oDocument = $oDocumentModel->getDocument($document_srl);
|
|
||||||
if(!$oDocument->isExists()) return new Object();
|
|
||||||
// Get the point module information
|
|
||||||
$oModuleModel = getModel('module');
|
|
||||||
$config = $oModuleModel->getModuleConfig('point');
|
|
||||||
$module_config = $oModuleModel->getModulePartConfig('point',$oDocument->get('module_srl'));
|
|
||||||
// The process related to clearing the post comments
|
|
||||||
$comment_point = $module_config['insert_comment'];
|
|
||||||
if(strlen($comment_point) == 0 && !is_int($comment_point)) $comment_point = $config->insert_comment;
|
|
||||||
// If there are comment points, attempt to deduct
|
|
||||||
if($comment_point>0) return new Object();
|
|
||||||
// Get all the comments related to this post
|
|
||||||
$cp_args = new stdClass();
|
|
||||||
$cp_args->document_srl = $document_srl;
|
|
||||||
$output = executeQueryArray('point.getCommentUsers', $cp_args);
|
|
||||||
// Return if there is no object
|
|
||||||
if(!$output->data) return new Object();
|
|
||||||
// Organize the member number
|
|
||||||
$member_srls = array();
|
|
||||||
$cnt = count($output->data);
|
|
||||||
for($i=0;$i<$cnt;$i++)
|
|
||||||
{
|
|
||||||
if($output->data[$i]->member_srl<1) continue;
|
|
||||||
$member_srls[abs($output->data[$i]->member_srl)] = $output->data[$i]->count;
|
|
||||||
}
|
|
||||||
// Remove the member number who has written the original post
|
|
||||||
if($member_srl) unset($member_srls[abs($member_srl)]);
|
|
||||||
if(!count($member_srls)) return new Object();
|
|
||||||
// Remove all the points for each member
|
|
||||||
$oPointModel = getModel('point');
|
|
||||||
// Get the points
|
|
||||||
$point = $module_config['download_file'];
|
|
||||||
foreach($member_srls as $member_srl => $cnt)
|
|
||||||
{
|
|
||||||
$cur_point = $oPointModel->getPoint($member_srl, true);
|
|
||||||
$cur_point -= $cnt * $comment_point;
|
|
||||||
$this->setPoint($member_srl,$cur_point);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Object();
|
return new Object();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A trigger to give points for deleting the post
|
* @brief A trigger to give points for deleting the post
|
||||||
*/
|
*/
|
||||||
function triggerDeleteDocument(&$obj)
|
public function triggerDeleteDocument($obj)
|
||||||
{
|
{
|
||||||
$oDocumentModel = getModel('document');
|
$module_srl = $obj->module_srl;
|
||||||
|
$member_srl = abs($obj->member_srl);
|
||||||
if($obj->status != $oDocumentModel->getConfigStatus('temp'))
|
if (!$module_srl || !$member_srl)
|
||||||
{
|
{
|
||||||
$module_srl = $obj->module_srl;
|
return new Object();
|
||||||
$member_srl = $obj->member_srl;
|
|
||||||
// The process related to clearing the post object
|
|
||||||
if(!$module_srl || !$member_srl) return new Object();
|
|
||||||
// Run only when logged in
|
|
||||||
$logged_info = Context::get('logged_info');
|
|
||||||
if(!$logged_info->member_srl) return new Object();
|
|
||||||
// Get the points of the member
|
|
||||||
$oPointModel = getModel('point');
|
|
||||||
$cur_point = $oPointModel->getPoint($member_srl, true);
|
|
||||||
// Get the point module information
|
|
||||||
$oModuleModel = getModel('module');
|
|
||||||
$config = $oModuleModel->getModuleConfig('point');
|
|
||||||
$module_config = $oModuleModel->getModulePartConfig('point', $module_srl);
|
|
||||||
|
|
||||||
$point = $module_config['insert_document'];
|
|
||||||
if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document;
|
|
||||||
// if the point is set to decrease when writing a document, make sure it does not increase the points when deleting an article
|
|
||||||
if($point < 0) return new Object();
|
|
||||||
$cur_point -= $point;
|
|
||||||
// Add points related to deleting an attachment
|
|
||||||
$point = $module_config['upload_file'];
|
|
||||||
if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
|
|
||||||
if($obj->uploaded_count) $cur_point -= $point * $obj->uploaded_count;
|
|
||||||
// Increase the point
|
|
||||||
$this->setPoint($member_srl,$cur_point);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The fix to disable giving points for saving the document temporarily
|
||||||
|
if ($module_srl == $member_srl)
|
||||||
|
{
|
||||||
|
return new Object();
|
||||||
|
}
|
||||||
|
if ($obj->status === getModel('document')->getConfigStatus('temp'))
|
||||||
|
{
|
||||||
|
return new Object();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the points of the member
|
||||||
|
$cur_point = getModel('point')->getPoint($member_srl, true);
|
||||||
|
|
||||||
|
// Subtract points for the document.
|
||||||
|
$document_point = $this->_getModulePointConfig($module_srl, 'insert_document');
|
||||||
|
if ($document_point > 0)
|
||||||
|
{
|
||||||
|
$cur_point -= $document_point;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Increase the point.
|
||||||
|
$this->setPoint($member_srl, $cur_point);
|
||||||
return new Object();
|
return new Object();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A trigger which gives points for entering a comment
|
* @brief A trigger which gives points for entering a comment
|
||||||
*/
|
*/
|
||||||
function triggerInsertComment(&$obj)
|
public function triggerInsertComment($obj)
|
||||||
{
|
{
|
||||||
$module_srl = $obj->module_srl;
|
$module_srl = $obj->module_srl;
|
||||||
$member_srl = $obj->member_srl;
|
$member_srl = abs($obj->member_srl);
|
||||||
if(!$module_srl || !$member_srl) return new Object();
|
if (!$module_srl || !$member_srl)
|
||||||
// Do not increase the points if the member is the author of the post
|
|
||||||
$document_srl = $obj->document_srl;
|
|
||||||
$oDocumentModel = getModel('document');
|
|
||||||
$oDocument = $oDocumentModel->getDocument($document_srl);
|
|
||||||
// Get the point module information
|
|
||||||
$oModuleModel = getModel('module');
|
|
||||||
$config = $oModuleModel->getModuleConfig('point');
|
|
||||||
if($config->no_point_date > 0)
|
|
||||||
{
|
{
|
||||||
if($oDocument->get('regdate') < date('YmdHis', strtotime('-'.$config->no_point_date.' day')))
|
return new Object();
|
||||||
{
|
|
||||||
return new Object();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) return new Object();
|
|
||||||
|
// Abort if the comment and the document have the same author.
|
||||||
$module_config = $oModuleModel->getModulePartConfig('point', $module_srl);
|
$oDocument = getModel('document')->getDocument($obj->document_srl);
|
||||||
|
if (!$oDocument->isExists() || abs($oDocument->get('member_srl')) == $member_srl)
|
||||||
|
{
|
||||||
|
return new Object();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 Object();
|
||||||
|
}
|
||||||
|
|
||||||
// Get the points of the member
|
// Get the points of the member
|
||||||
$oPointModel = getModel('point');
|
$cur_point = getModel('point')->getPoint($member_srl, true);
|
||||||
$cur_point = $oPointModel->getPoint($member_srl, true);
|
|
||||||
|
|
||||||
$point = $module_config['insert_comment'];
|
|
||||||
if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment;
|
|
||||||
// Increase the point
|
|
||||||
$cur_point += $point;
|
|
||||||
$this->setPoint($member_srl,$cur_point);
|
|
||||||
|
|
||||||
|
// Add points for the comment.
|
||||||
|
$comment_point = $this->_getModulePointConfig($module_srl, 'insert_comment');
|
||||||
|
$cur_point += $comment_point;
|
||||||
|
|
||||||
|
// Add points for attached files.
|
||||||
|
if ($obj->uploaded_count > 0)
|
||||||
|
{
|
||||||
|
$attached_files_point = $this->_getModulePointConfig($module_srl, 'upload_file');
|
||||||
|
$cur_point += $attached_files_point * $obj->uploaded_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Increase the point.
|
||||||
|
$this->setPoint($member_srl, $cur_point);
|
||||||
return new Object();
|
return new Object();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief A trigger which gives points for uploaded file changes to a comment
|
||||||
|
*/
|
||||||
|
public function triggerUpdateComment($obj)
|
||||||
|
{
|
||||||
|
return new Object();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A trigger which gives points for deleting a comment
|
* @brief A trigger which gives points for deleting a comment
|
||||||
*/
|
*/
|
||||||
function triggerDeleteComment(&$obj)
|
public function triggerDeleteComment($obj)
|
||||||
{
|
{
|
||||||
$oModuleModel = getModel('module');
|
|
||||||
$oPointModel = getModel('point');
|
|
||||||
$oDocumentModel = getModel('document');
|
|
||||||
|
|
||||||
$module_srl = $obj->module_srl;
|
$module_srl = $obj->module_srl;
|
||||||
$member_srl = abs($obj->member_srl);
|
$member_srl = abs($obj->member_srl);
|
||||||
$document_srl = $obj->document_srl;
|
if (!$module_srl || !$member_srl)
|
||||||
if(!$module_srl || !$member_srl) return new Object();
|
{
|
||||||
// Get the original article (if the original article is missing or if the member is its author, do not apply the points)
|
return new Object();
|
||||||
$oDocument = $oDocumentModel->getDocument($document_srl);
|
}
|
||||||
if(!$oDocument->isExists()) return new Object();
|
|
||||||
if($oDocument->get('member_srl')==$member_srl) return new Object();
|
// Abort if the comment and the document have the same author.
|
||||||
// Get the point module information
|
$oDocument = getModel('document')->getDocument($obj->document_srl);
|
||||||
$config = $oModuleModel->getModuleConfig('point');
|
if (!$oDocument->isExists() || abs($oDocument->get('member_srl')) == $member_srl)
|
||||||
$module_config = $oModuleModel->getModulePartConfig('point', $module_srl);
|
{
|
||||||
|
return new Object();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 Object();
|
||||||
|
}
|
||||||
|
|
||||||
// Get the points of the member
|
// Get the points of the member
|
||||||
$cur_point = $oPointModel->getPoint($member_srl, true);
|
$cur_point = getModel('point')->getPoint($member_srl, true);
|
||||||
|
|
||||||
$point = $module_config['insert_comment'];
|
|
||||||
if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment;
|
|
||||||
// if the point is set to decrease when writing a comment, make sure it does not increase the points when deleting a comment
|
|
||||||
if($point < 0) return new Object();
|
|
||||||
// Increase the point
|
|
||||||
$cur_point -= $point;
|
|
||||||
$this->setPoint($member_srl,$cur_point);
|
|
||||||
|
|
||||||
|
// Add points for the comment.
|
||||||
|
$comment_point = $this->_getModulePointConfig($module_srl, 'insert_comment');
|
||||||
|
$cur_point -= $comment_point;
|
||||||
|
|
||||||
|
// Increase the point.
|
||||||
|
$this->setPoint($member_srl, $cur_point);
|
||||||
return new Object();
|
return new Object();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -317,7 +315,7 @@ class pointController extends point
|
||||||
* @brief Add the file registration trigger
|
* @brief Add the file registration trigger
|
||||||
* To prevent taking points for invalid file registration this method wlil return a null object
|
* To prevent taking points for invalid file registration this method wlil return a null object
|
||||||
*/
|
*/
|
||||||
function triggerInsertFile(&$obj)
|
public function triggerInsertFile($obj)
|
||||||
{
|
{
|
||||||
return new Object();
|
return new Object();
|
||||||
}
|
}
|
||||||
|
|
@ -326,90 +324,84 @@ class pointController extends point
|
||||||
* @brief A trigger to give points for deleting a file
|
* @brief A trigger to give points for deleting a file
|
||||||
* Remove points only in case an invalid file is being deleted
|
* Remove points only in case an invalid file is being deleted
|
||||||
*/
|
*/
|
||||||
function triggerDeleteFile(&$obj)
|
public function triggerDeleteFile($obj)
|
||||||
{
|
{
|
||||||
if($obj->isvalid != 'Y') return new Object();
|
|
||||||
|
|
||||||
$module_srl = $obj->module_srl;
|
$module_srl = $obj->module_srl;
|
||||||
$member_srl = $obj->member_srl;
|
$member_srl = abs($obj->member_srl);
|
||||||
if(!$module_srl || !$member_srl) return new Object();
|
if (!$module_srl || !$member_srl || $obj->isvalid !== 'Y')
|
||||||
// Get the point module information
|
{
|
||||||
$oModuleModel = getModel('module');
|
return new Object();
|
||||||
$config = $oModuleModel->getModuleConfig('point');
|
}
|
||||||
$module_config = $oModuleModel->getModulePartConfig('point', $module_srl);
|
|
||||||
// Get the points of the member
|
// Get the points of the member
|
||||||
$oPointModel = getModel('point');
|
$cur_point = getModel('point')->getPoint($member_srl, true);
|
||||||
$cur_point = $oPointModel->getPoint($member_srl, true);
|
|
||||||
|
|
||||||
$point = $module_config['upload_file'];
|
|
||||||
if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
|
|
||||||
// Increase the point
|
|
||||||
$cur_point -= $point;
|
|
||||||
$this->setPoint($member_srl,$cur_point);
|
|
||||||
|
|
||||||
|
// Subtract points for the file.
|
||||||
|
$file_point = $this->_getModulePointConfig($module_srl, 'upload_file');
|
||||||
|
$cur_point -= $file_point;
|
||||||
|
|
||||||
|
// Update the point.
|
||||||
|
$this->setPoint($member_srl, $cur_point);
|
||||||
return new Object();
|
return new Object();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The trigger called before a file is downloaded
|
* @brief The trigger called before a file is downloaded
|
||||||
*/
|
*/
|
||||||
function triggerBeforeDownloadFile(&$obj)
|
public function triggerBeforeDownloadFile($obj)
|
||||||
{
|
{
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
$member_srl = $logged_info->member_srl;
|
$member_srl = $logged_info->member_srl;
|
||||||
$module_srl = $obj->module_srl;
|
$module_srl = $obj->module_srl;
|
||||||
if(!$module_srl) return new Object();
|
|
||||||
// Pass if it is your file
|
if ($member_srl && abs($obj->member_srl) == $member_srl)
|
||||||
if(abs($obj->member_srl) == abs($member_srl)) return new Object();
|
|
||||||
|
|
||||||
$oModuleModel = getModel('module');
|
|
||||||
$config = $oModuleModel->getModuleConfig('point');
|
|
||||||
$module_config = $oModuleModel->getModulePartConfig('point', $module_srl);
|
|
||||||
// If it is set not to allow downloading for non-logged in users, do not permit
|
|
||||||
if(!Context::get('is_logged'))
|
|
||||||
{
|
{
|
||||||
if($config->disable_download == 'Y' && strlen($module_config['download_file']) == 0 && !is_int($module_config['download_file'])) return new Object(-1,'msg_not_permitted_download');
|
return new Object();
|
||||||
else return new Object();
|
|
||||||
}
|
}
|
||||||
// Get the points of the member
|
|
||||||
$oPointModel = getModel('point');
|
$point = $this->_getModulePointConfig($module_srl, 'download_file');
|
||||||
$cur_point = $oPointModel->getPoint($member_srl, true);
|
if (!$point)
|
||||||
// Get the points
|
{
|
||||||
$point = $module_config['download_file'];
|
return new Object();
|
||||||
if(strlen($point) == 0 && !is_int($point)) $point = $config->download_file;
|
}
|
||||||
// If points are less than 0, and if downloading a file is not allowed in this case, give an errors
|
|
||||||
if($cur_point + $point < 0 && $config->disable_download == 'Y') return new Object(-1,'msg_cannot_download');
|
// Get current points.
|
||||||
|
$cur_point = $member_srl ? getModel('point')->getPoint($member_srl, true) : 0;
|
||||||
|
|
||||||
|
// If the user (member or guest) does not have enough points, deny access.
|
||||||
|
$config = $this->getConfig();
|
||||||
|
if ($config->disable_download == 'Y' && $cur_point + $point < 0)
|
||||||
|
{
|
||||||
|
return new Object(-1, 'msg_cannot_download');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Points will be adjusted after downloading (triggerDownloadFile).
|
||||||
return new Object();
|
return new Object();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The trigger to give points for downloading the file
|
* @brief The trigger to give or take points for downloading the file
|
||||||
*/
|
*/
|
||||||
function triggerDownloadFile(&$obj)
|
public function triggerDownloadFile($obj)
|
||||||
{
|
{
|
||||||
// Run only when logged in
|
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
if(!$logged_info->member_srl) return new Object();
|
|
||||||
$module_srl = $obj->module_srl;
|
|
||||||
$member_srl = $logged_info->member_srl;
|
$member_srl = $logged_info->member_srl;
|
||||||
if(!$module_srl) return new Object();
|
$module_srl = $obj->module_srl;
|
||||||
// Pass if it is your file
|
|
||||||
if(abs($obj->member_srl) == abs($member_srl)) return new Object();
|
if (!$member_srl || abs($obj->member_srl) == $member_srl)
|
||||||
// Get the point module information
|
{
|
||||||
$oModuleModel = getModel('module');
|
return new Object();
|
||||||
$config = $oModuleModel->getModuleConfig('point');
|
}
|
||||||
$module_config = $oModuleModel->getModulePartConfig('point', $module_srl);
|
|
||||||
// Get the points of the member
|
$point = $this->_getModulePointConfig($module_srl, 'download_file');
|
||||||
$oPointModel = getModel('point');
|
if (!$point)
|
||||||
$cur_point = $oPointModel->getPoint($member_srl, true);
|
{
|
||||||
// Get the points
|
return new Object();
|
||||||
$point = $module_config['download_file'];
|
}
|
||||||
if(strlen($point) == 0 && !is_int($point)) $point = $config->download_file;
|
|
||||||
// Increase the point
|
$cur_point = getModel('point')->getPoint($member_srl, true);
|
||||||
$cur_point += $point;
|
$this->setPoint($member_srl, $cur_point + $point);
|
||||||
$this->setPoint($member_srl,$cur_point);
|
|
||||||
|
|
||||||
return new Object();
|
return new Object();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -417,130 +409,135 @@ class pointController extends point
|
||||||
* @brief Give points for hits increase
|
* @brief Give points for hits increase
|
||||||
* Run it even if there are no points
|
* Run it even if there are no points
|
||||||
*/
|
*/
|
||||||
function triggerUpdateReadedCount(&$obj)
|
public function triggerUpdateReadedCount($obj)
|
||||||
{
|
{
|
||||||
$oModuleModel = getModel('module');
|
|
||||||
$oPointModel = getModel('point');
|
|
||||||
// Get visitor information
|
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
$member_srl = $logged_info->member_srl;
|
$member_srl = $logged_info->member_srl;
|
||||||
// Get the original author number
|
$module_srl = $obj->get('module_srl');
|
||||||
$target_member_srl = abs($obj->get('member_srl'));
|
$target_member_srl = abs($obj->get('member_srl'));
|
||||||
// Pass without increasing the hits if the viewer is the same as the author
|
if ($member_srl && $target_member_srl == $member_srl)
|
||||||
if($target_member_srl == $member_srl) return new Object();
|
|
||||||
// Get the point information for each module
|
|
||||||
$config = $oModuleModel->getModuleConfig('point');
|
|
||||||
$module_config = $oModuleModel->getModulePartConfig('point', $obj->get('module_srl'));
|
|
||||||
// Get hits points
|
|
||||||
$point = $module_config['read_document'];
|
|
||||||
if(strlen($point) == 0 && !is_int($point)) $point = $config->read_document;
|
|
||||||
// Pass if there are no requested points
|
|
||||||
if(!$point) return new Object();
|
|
||||||
// In case of a registered member, if it is read but cannot just pass, then get the current points
|
|
||||||
$args = new stdClass();
|
|
||||||
if($member_srl)
|
|
||||||
{
|
{
|
||||||
|
return new Object();
|
||||||
|
}
|
||||||
|
|
||||||
|
$point = $this->_getModulePointConfig($module_srl, 'read_document');
|
||||||
|
if (!$point)
|
||||||
|
{
|
||||||
|
return new Object();
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the current member has already read this document, do not adjust points again.
|
||||||
|
if ($member_srl)
|
||||||
|
{
|
||||||
|
$args = new stdClass();
|
||||||
$args->member_srl = $member_srl;
|
$args->member_srl = $member_srl;
|
||||||
$args->document_srl = $obj->document_srl;
|
$args->document_srl = $obj->document_srl;
|
||||||
$output = executeQuery('document.getDocumentReadedLogInfo', $args);
|
$output = executeQuery('document.getDocumentReadedLogInfo', $args);
|
||||||
if($output->data->count) return new Object();
|
if ($output->data->count)
|
||||||
$cur_point = $oPointModel->getPoint($member_srl, true);
|
{
|
||||||
|
return new Object();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
// Get current points.
|
||||||
$cur_point = 0;
|
$cur_point = $member_srl ? getModel('point')->getPoint($member_srl, true) : 0;
|
||||||
}
|
|
||||||
// Get the defaul configurations of the Point Module
|
// If the user (member or guest) does not have enough points, deny access.
|
||||||
$config = $oModuleModel->getModuleConfig('point');
|
$config = $this->getConfig();
|
||||||
// When the requested points are negative, compared it with the current point
|
if($config->disable_read_document == 'Y' && $cur_point + $point < 0)
|
||||||
$_SESSION['banned_document'][$obj->document_srl] = false;
|
|
||||||
if($config->disable_read_document == 'Y' && $point < 0 && abs($point)>$cur_point)
|
|
||||||
{
|
{
|
||||||
$message = sprintf(lang('msg_disallow_by_point'), abs($point), $cur_point);
|
$message = sprintf(lang('msg_disallow_by_point'), abs($point), $cur_point);
|
||||||
$obj->add('content', $message);
|
$obj->add('content', $message);
|
||||||
$_SESSION['banned_document'][$obj->document_srl] = true;
|
$_SESSION['banned_document'][$obj->document_srl] = true;
|
||||||
return new Object(-1, $message);
|
return new Object(-1, $message);
|
||||||
}
|
}
|
||||||
// If not logged in, pass
|
else
|
||||||
if(!$logged_info->member_srl) return new Object();
|
{
|
||||||
// Pass, if there are no requested points
|
$_SESSION['banned_document'][$obj->document_srl] = false;
|
||||||
if(!$point) return new Object();
|
}
|
||||||
// If the read record is missing, leave it
|
|
||||||
$output = executeQuery('document.insertDocumentReadedLog', $args);
|
// Adjust points for member.
|
||||||
// Increase the point
|
if ($member_srl)
|
||||||
$cur_point += $point;
|
{
|
||||||
$this->setPoint($member_srl,$cur_point);
|
$args = new stdClass();
|
||||||
|
$args->member_srl = $member_srl;
|
||||||
|
$args->document_srl = $obj->document_srl;
|
||||||
|
$output = executeQuery('document.insertDocumentReadedLog', $args);
|
||||||
|
$this->setPoint($member_srl, $cur_point + $point);
|
||||||
|
}
|
||||||
|
|
||||||
return new Object();
|
return new Object();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Points for voting up or down
|
* @brief Points for voting up or down
|
||||||
*/
|
*/
|
||||||
function triggerUpdateVotedCount(&$obj)
|
public function triggerUpdateVotedCount($obj)
|
||||||
{
|
{
|
||||||
|
$logged_info = Context::get('logged_info');
|
||||||
|
$logged_member_srl = $logged_info->member_srl;
|
||||||
$module_srl = $obj->module_srl;
|
$module_srl = $obj->module_srl;
|
||||||
$member_srl = $obj->member_srl;
|
$member_srl = abs($obj->member_srl);
|
||||||
if(!$module_srl || !$member_srl) return new Object();
|
if ($logged_member_srl && $logged_member_srl == $member_srl)
|
||||||
|
|
||||||
$oModuleModel = getModel('module');
|
|
||||||
$config = $oModuleModel->getModuleConfig('point');
|
|
||||||
$module_config = $oModuleModel->getModulePartConfig('point', $module_srl);
|
|
||||||
|
|
||||||
$oPointModel = getModel('point');
|
|
||||||
$cur_point = $oPointModel->getPoint($member_srl, true);
|
|
||||||
|
|
||||||
if( $obj->point > 0 )
|
|
||||||
{
|
{
|
||||||
if($obj->comment_srl)
|
return new Object();
|
||||||
{
|
}
|
||||||
$point = $module_config['voted_comment'];
|
elseif (!$member_srl)
|
||||||
if(strlen($point) == 0 && !is_int($point)) $point = $config->voted_comment;
|
{
|
||||||
}
|
return new Object();
|
||||||
else
|
}
|
||||||
{
|
|
||||||
$point = $module_config['voted'];
|
// Get current points.
|
||||||
if(strlen($point) == 0 && !is_int($point)) $point = $config->voted;
|
$cur_point = getModel('point')->getPoint($member_srl, true);
|
||||||
}
|
|
||||||
|
// Get adjustment amount.
|
||||||
|
if ($obj->point > 0)
|
||||||
|
{
|
||||||
|
$config_key = (isset($obj->comment_srl) && $obj->comment_srl) ? 'voted_comment' : 'voted';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if($obj->comment_srl)
|
$config_key = (isset($obj->comment_srl) && $obj->comment_srl) ? 'blamed_comment' : 'blamed';
|
||||||
{
|
|
||||||
$point = $module_config['blamed_comment'];
|
|
||||||
if(strlen($point) == 0 && !is_int($point)) $point = $config->blamed_comment;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$point = $module_config['blamed'];
|
|
||||||
if(strlen($point) == 0 && !is_int($point)) $point = $config->blamed;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$point = $this->_getModulePointConfig($module_srl, $config_key);
|
||||||
if(!$point) return new Object();
|
if (!$point)
|
||||||
// Increase the point
|
|
||||||
if($obj->cancel > 0)
|
|
||||||
{
|
{
|
||||||
$cur_point -= $point;
|
return new Object();
|
||||||
}
|
}
|
||||||
else if($obj->cancel == null)
|
|
||||||
|
if (isset($obj->cancel) && $obj->cancel)
|
||||||
{
|
{
|
||||||
$cur_point += $point;
|
$point = -1 * $point;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
$this->setPoint($member_srl, $cur_point + $point);
|
||||||
$cur_point += $point;
|
|
||||||
}
|
|
||||||
$this->setPoint($member_srl,$cur_point);
|
|
||||||
|
|
||||||
return new Object();
|
return new Object();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Copy point settings when copying module
|
||||||
|
*/
|
||||||
|
public function triggerCopyModule($obj)
|
||||||
|
{
|
||||||
|
$oModuleModel = getModel('module');
|
||||||
|
$pointConfig = $oModuleModel->getModulePartConfig('point', $obj->originModuleSrl);
|
||||||
|
|
||||||
|
$oModuleController = getController('module');
|
||||||
|
if(is_array($obj->moduleSrlList))
|
||||||
|
{
|
||||||
|
foreach($obj->moduleSrlList AS $key=>$moduleSrl)
|
||||||
|
{
|
||||||
|
$oModuleController->insertModulePartConfig('point', $moduleSrl, $pointConfig);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set points
|
* @brief Set points
|
||||||
*/
|
*/
|
||||||
function setPoint($member_srl, $point, $mode = null)
|
public function setPoint($member_srl, $point, $mode = null)
|
||||||
{
|
{
|
||||||
$member_srl = abs($member_srl);
|
$member_srl = abs($member_srl);
|
||||||
$mode_arr = array('add', 'minus', 'update', 'signup');
|
$mode_arr = array('add', 'minus', 'update', 'signup');
|
||||||
|
|
@ -603,7 +600,18 @@ class pointController extends point
|
||||||
$level = $oPointModel->getLevel($point, $config->level_step);
|
$level = $oPointModel->getLevel($point, $config->level_step);
|
||||||
|
|
||||||
// If existing level and a new one are different attempt to set a point group
|
// If existing level and a new one are different attempt to set a point group
|
||||||
if($level != $current_level)
|
$new_group_list = array();
|
||||||
|
$del_group_list = array();
|
||||||
|
if ($config->group_ratchet === 'Y')
|
||||||
|
{
|
||||||
|
$change_group = ($level > $current_level);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$change_group = ($level != $current_level);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($change_group)
|
||||||
{
|
{
|
||||||
// Check if the level, for which the current points are prepared, is calculate and set the correct group
|
// Check if the level, for which the current points are prepared, is calculate and set the correct group
|
||||||
$point_group = $config->point_group;
|
$point_group = $config->point_group;
|
||||||
|
|
@ -612,11 +620,8 @@ class pointController extends point
|
||||||
{
|
{
|
||||||
// Get the default group
|
// Get the default group
|
||||||
$default_group = $oMemberModel->getDefaultGroup();
|
$default_group = $oMemberModel->getDefaultGroup();
|
||||||
// Get the removed group and the newly granted group
|
|
||||||
$del_group_list = array();
|
|
||||||
$new_group_list = array();
|
|
||||||
|
|
||||||
asort($point_group);
|
asort($point_group);
|
||||||
|
|
||||||
// Reset group after initialization
|
// Reset group after initialization
|
||||||
if($config->group_reset != 'N')
|
if($config->group_reset != 'N')
|
||||||
{
|
{
|
||||||
|
|
@ -704,23 +709,53 @@ class pointController extends point
|
||||||
FileHandler::writeFile($cache_filename, $point);
|
FileHandler::writeFile($cache_filename, $point);
|
||||||
|
|
||||||
getController('member')->_clearMemberCache($member_srl);
|
getController('member')->_clearMemberCache($member_srl);
|
||||||
|
unset(self::$_member_point_cache[$member_srl]);
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
function triggerCopyModule(&$obj)
|
/**
|
||||||
|
* Get point configuration for module, falling back to defaults if not set.
|
||||||
|
*
|
||||||
|
* @param int $module_srl
|
||||||
|
* @param string $config_key
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
protected function _getModulePointConfig($module_srl, $config_key)
|
||||||
{
|
{
|
||||||
$oModuleModel = getModel('module');
|
$module_srl = intval($module_srl);
|
||||||
$pointConfig = $oModuleModel->getModulePartConfig('point', $obj->originModuleSrl);
|
$config_key = strval($config_key);
|
||||||
|
if (!$config_key)
|
||||||
$oModuleController = getController('module');
|
|
||||||
if(is_array($obj->moduleSrlList))
|
|
||||||
{
|
{
|
||||||
foreach($obj->moduleSrlList AS $key=>$moduleSrl)
|
return 0;
|
||||||
{
|
|
||||||
$oModuleController->insertModulePartConfig('point', $moduleSrl, $pointConfig);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$oModuleModel = getModel('module');
|
||||||
|
|
||||||
|
if ($module_srl)
|
||||||
|
{
|
||||||
|
if (!isset(self::$_module_config_cache[$module_srl]))
|
||||||
|
{
|
||||||
|
self::$_module_config_cache[$module_srl] = $oModuleModel->getModulePartConfig('point', $module_srl);
|
||||||
|
}
|
||||||
|
$module_config = self::$_module_config_cache[$module_srl];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$module_config = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($module_config[$config_key]) && $module_config[$config_key] !== '')
|
||||||
|
{
|
||||||
|
$point = $module_config[$config_key];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$default_config = $this->getConfig();
|
||||||
|
$point = $default_config->{$config_key};
|
||||||
|
}
|
||||||
|
|
||||||
|
return intval($point);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* End of file point.controller.php */
|
/* End of file point.controller.php */
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,6 @@
|
||||||
*/
|
*/
|
||||||
class pointModel extends point
|
class pointModel extends point
|
||||||
{
|
{
|
||||||
var $pointList = array();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialization
|
* @brief Initialization
|
||||||
*/
|
*/
|
||||||
|
|
@ -36,29 +34,34 @@ class pointModel extends point
|
||||||
$member_srl = abs($member_srl);
|
$member_srl = abs($member_srl);
|
||||||
|
|
||||||
// Get from instance memory
|
// Get from instance memory
|
||||||
if(!$from_db && $this->pointList[$member_srl]) return $this->pointList[$member_srl];
|
if (!$from_db && isset(self::$_member_point_cache[$member_srl]))
|
||||||
|
{
|
||||||
|
return self::$_member_point_cache[$member_srl];
|
||||||
|
}
|
||||||
|
|
||||||
// Get from file cache
|
// Get from file cache
|
||||||
$path = sprintf(_XE_PATH_ . 'files/member_extra_info/point/%s',getNumberingPath($member_srl));
|
$cache_path = sprintf(_XE_PATH_ . 'files/member_extra_info/point/%s', getNumberingPath($member_srl));
|
||||||
$cache_filename = sprintf('%s%d.cache.txt', $path, $member_srl);
|
$cache_filename = sprintf('%s%d.cache.txt', $cache_path, $member_srl);
|
||||||
|
if (!$from_db && file_exists($cache_filename))
|
||||||
if(!$from_db && file_exists($cache_filename))
|
{
|
||||||
return $this->pointList[$member_srl] = trim(FileHandler::readFile($cache_filename));
|
return self::$_member_point_cache[$member_srl] = trim(FileHandler::readFile($cache_filename));
|
||||||
|
}
|
||||||
|
|
||||||
// Get from the DB
|
// Get from the DB
|
||||||
$args = new stdClass;
|
$args = new stdClass;
|
||||||
$args->member_srl = $member_srl;
|
$args->member_srl = $member_srl;
|
||||||
$output = executeQuery('point.getPoint', $args);
|
$output = executeQuery('point.getPoint', $args);
|
||||||
|
if (isset($output->data->member_srl))
|
||||||
if(isset($output->data->member_srl))
|
|
||||||
{
|
{
|
||||||
$point = (int)$output->data->point;
|
$point = intval($output->data->point);
|
||||||
$this->pointList[$member_srl] = $point;
|
self::$_member_point_cache[$member_srl] = $point;
|
||||||
if(!is_dir($path)) FileHandler::makeDir($path);
|
|
||||||
FileHandler::writeFile($cache_filename, $point);
|
FileHandler::writeFile($cache_filename, $point);
|
||||||
return $point;
|
return $point;
|
||||||
}
|
}
|
||||||
return 0;
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -67,11 +70,19 @@ class pointModel extends point
|
||||||
function getLevel($point, $level_step)
|
function getLevel($point, $level_step)
|
||||||
{
|
{
|
||||||
$level_count = count($level_step);
|
$level_count = count($level_step);
|
||||||
for($level=0;$level<=$level_count;$level++) if($point < $level_step[$level]) break;
|
for ($level = 0; $level <= $level_count; $level++)
|
||||||
$level --;
|
{
|
||||||
return $level;
|
if ($point < $level_step[$level])
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $level - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
function getMembersPointInfo()
|
function getMembersPointInfo()
|
||||||
{
|
{
|
||||||
$member_srls = Context::get('member_srls');
|
$member_srls = Context::get('member_srls');
|
||||||
|
|
@ -111,7 +122,6 @@ class pointModel extends point
|
||||||
$this->add('point_info',$info);
|
$this->add('point_info',$info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get a list of points members list
|
* @brief Get a list of points members list
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -105,11 +105,23 @@
|
||||||
|
|
||||||
<section class="section">
|
<section class="section">
|
||||||
<h1>{$lang->point_link_group}</h1>
|
<h1>{$lang->point_link_group}</h1>
|
||||||
<div class="x_clearfix" style="margin-bottom:-10px">
|
<p>{$lang->about_point_link_group}</p>
|
||||||
<p class="x_pull-left">{$lang->about_point_link_group}</p>
|
<div class="x_control-group">
|
||||||
<div class="x_pull-right">
|
<label for="group_reset" class="x_control-label">{$lang->point_group_reset_type}</label>
|
||||||
<label for="group_reset_y" class="x_inline"><input type="radio" name="group_reset" id="group_reset_y" value="Y" checked="checked"|cond="$config->group_reset != 'N'" /> {$lang->point_group_reset_and_add}</label>
|
<div class="x_controls">
|
||||||
<label for="group_reset_n" class="x_inline"><input type="radio" name="group_reset" id="group_reset_n" value="N" checked="checked"|cond="$config->group_reset == 'N'" /> {$lang->point_group_add_only}</label>
|
<select name="group_reset" id="group_reset">
|
||||||
|
<option value="Y" selected="selected"|cond="$config->group_reset != 'N'" />{$lang->point_group_reset_and_add}</option>
|
||||||
|
<option value="N" selected="selected"|cond="$config->group_reset == 'N'" />{$lang->point_group_add_only}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="x_control-group">
|
||||||
|
<label for="group_ratchet" class="x_control-label">{$lang->point_group_ratchet}</label>
|
||||||
|
<div class="x_controls">
|
||||||
|
<select name="group_ratchet" id="group_ratchet">
|
||||||
|
<option value="Y" selected="selected"|cond="$config->group_ratchet == 'Y'" />{$lang->point_group_ratchet_yes}</option>
|
||||||
|
<option value="N" selected="selected"|cond="$config->group_ratchet != 'Y'" />{$lang->point_group_ratchet_no}</option>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="x_control-group" loop="$group_list => $key,$val">
|
<div class="x_control-group" loop="$group_list => $key,$val">
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ class widgetController extends widget
|
||||||
$obj->content = $content;
|
$obj->content = $content;
|
||||||
$obj->document_srl = $document_srl;
|
$obj->document_srl = $document_srl;
|
||||||
|
|
||||||
$oDocument = $oDocumentModel->getDocument($obj->document_srl, true);
|
$oDocument = $oDocumentModel->getDocument($obj->document_srl);
|
||||||
if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl)
|
if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl)
|
||||||
{
|
{
|
||||||
$output = $oDocumentController->updateDocument($oDocument, $obj);
|
$output = $oDocumentController->updateDocument($oDocument, $obj);
|
||||||
|
|
@ -165,7 +165,7 @@ class widgetController extends widget
|
||||||
$oDocumentController = getController('document');
|
$oDocumentController = getController('document');
|
||||||
$oDocumentAdminController = getAdminController('document');
|
$oDocumentAdminController = getAdminController('document');
|
||||||
|
|
||||||
$oDocument = $oDocumentModel->getDocument($document_srl, true);
|
$oDocument = $oDocumentModel->getDocument($document_srl);
|
||||||
if(!$oDocument->isExists()) return new Object(-1,'msg_invalid_request');
|
if(!$oDocument->isExists()) return new Object(-1,'msg_invalid_request');
|
||||||
$module_srl = $oDocument->get('module_srl');
|
$module_srl = $oDocument->get('module_srl');
|
||||||
|
|
||||||
|
|
@ -206,7 +206,7 @@ class widgetController extends widget
|
||||||
$oDocumentModel = getModel('document');
|
$oDocumentModel = getModel('document');
|
||||||
$oDocumentController = getController('document');
|
$oDocumentController = getController('document');
|
||||||
|
|
||||||
$oDocument = $oDocumentModel->getDocument($document_srl, true);
|
$oDocument = $oDocumentModel->getDocument($document_srl);
|
||||||
if(!$oDocument->isExists()) return new Object();
|
if(!$oDocument->isExists()) return new Object();
|
||||||
$module_srl = $oDocument->get('module_srl');
|
$module_srl = $oDocument->get('module_srl');
|
||||||
|
|
||||||
|
|
@ -227,7 +227,7 @@ class widgetController extends widget
|
||||||
return new Object(-1,'msg_not_permitted');
|
return new Object(-1,'msg_not_permitted');
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = $oDocumentController->deleteDocument($oDocument->get('document_srl'), true);
|
$output = $oDocumentController->deleteDocument($oDocument->get('document_srl'));
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,19 @@
|
||||||
<load target="./js/content_widget.js" cond="$widget_info->page_count || count($widget_info->tab)" />
|
<load target="./js/content_widget.js" cond="$widget_info->page_count || count($widget_info->tab)" />
|
||||||
<!--// Check layout. If it is Simple World, select layout primary colors as a primary color of this skin -->
|
<!--// Check layout. If it is Simple World, select layout primary colors as a primary color of this skin -->
|
||||||
{@$layout_info = Context::get('layout_info')}
|
{@$layout_info = Context::get('layout_info')}
|
||||||
|
<block cond="$layout_info->extra_var->primary_color->type === 'select' || $layout_info->extra_var->customized_primary_color->type === 'colorpicker'">
|
||||||
|
{@
|
||||||
|
if(!$layout_info->primary_color)
|
||||||
|
$layout_info->primary_color = 'red';
|
||||||
|
if(!$layout_info->primary_color && $layout_info->customized_primary_color)
|
||||||
|
$layout_info->primary_color = 'customized';
|
||||||
|
if(!$layout_info->customized_primary_color)
|
||||||
|
$layout_info->customized_primary_color = '#f44336';
|
||||||
|
}
|
||||||
|
</block>
|
||||||
|
<block cond="$layout_info->extra_var->primary_color->type !== 'select' && $layout_info->extra_var->customized_primary_color->type !== 'colorpicker'">
|
||||||
|
{@$layout_info->primary_color = 'red';}
|
||||||
|
</block>
|
||||||
{@
|
{@
|
||||||
$material_colors = array(
|
$material_colors = array(
|
||||||
'red' => '#f44336',
|
'red' => '#f44336',
|
||||||
|
|
@ -29,24 +42,21 @@
|
||||||
'customized' => $layout_info->customized_primary_color,
|
'customized' => $layout_info->customized_primary_color,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
<block cond="$layout_info->extra_var->primary_color->type === 'select' || $layout_info->extra_var->customized_primary_color->type === 'colorpicker'">
|
|
||||||
{@
|
|
||||||
if(!$layout_info->primary_color && $layout_info->customized_primary_color)
|
|
||||||
$layout_info->primary_color = 'customized';
|
|
||||||
if(!$layout_info->primary_color)
|
|
||||||
$layout_info->primary_color = 'red';
|
|
||||||
if(!$layout_info->customized_primary_color)
|
|
||||||
$layout_info->customized_primary_color = '#f44336';
|
|
||||||
}
|
|
||||||
</block>
|
|
||||||
<block cond="$layout_info->extra_var->primary_color->type !== 'select' && $layout_info->extra_var->customized_primary_color->type !== 'colorpicker'">
|
|
||||||
{@$layout_info->primary_color = 'blue';}
|
|
||||||
</block>
|
|
||||||
<!--// Load styles -->
|
<!--// Load styles -->
|
||||||
{@$colorset = $material_colors[$colorset];}
|
{@$colorset = $material_colors[$member_config->colorset];}
|
||||||
{@$skin_color = $material_colors[$layout_info->primary_color];}
|
{@$skin_color = $material_colors[$layout_info->primary_color];}
|
||||||
|
<block cond="$colorset">
|
||||||
|
<!--@if(preg_match("/#([a-f0-9]{3}){1,2}/i", trim($colorset)) && in_array(strlen(trim($colorset)), array(4, 7)))-->
|
||||||
|
{@$skin_color = trim($colorset)}
|
||||||
|
<!--@if(strlen(trim($colorset)) === 4)-->
|
||||||
|
{@$skin_color = trim($colorset)[1].trim($colorset)[1].trim($colorset)[2].trim($colorset)[2].trim($colorset)[3].trim($colorset)[3]}
|
||||||
|
<!--@endif-->
|
||||||
|
<!--@else-->
|
||||||
|
{@$skin_color = '#f44336'}
|
||||||
|
<!--@endif-->
|
||||||
|
</block>
|
||||||
<block cond="!$skin_color">
|
<block cond="!$skin_color">
|
||||||
<!--@if(preg_match("/#([a-f0-9]{3}){1,2}/i", $layout_info->primary_color))-->
|
<!--@if(preg_match("/#([a-f0-9]{3}){1,2}/i", $layout_info->primary_color) && in_array(strlen(trim($colorset)), array(4, 7)))-->
|
||||||
{@$skin_color = $layout_info->primary_color}
|
{@$skin_color = $layout_info->primary_color}
|
||||||
<!--@if(strlen($layout_info->primary_color) === 4)-->
|
<!--@if(strlen($layout_info->primary_color) === 4)-->
|
||||||
{@$skin_color = $layout_info->primary_color[1].$layout_info->primary_color[1].$layout_info->primary_color[2].$layout_info->primary_color[2].$layout_info->primary_color[3].$layout_info->primary_color[3]}
|
{@$skin_color = $layout_info->primary_color[1].$layout_info->primary_color[1].$layout_info->primary_color[2].$layout_info->primary_color[2].$layout_info->primary_color[3].$layout_info->primary_color[3]}
|
||||||
|
|
@ -55,9 +65,6 @@
|
||||||
{@$skin_color = '#f44336'}
|
{@$skin_color = '#f44336'}
|
||||||
<!--@endif-->
|
<!--@endif-->
|
||||||
</block>
|
</block>
|
||||||
<block cond="$colorset">
|
|
||||||
{@$skin_color = $colorset}
|
|
||||||
</block>
|
|
||||||
{@Context::set('less_color', array('red' => hexdec(substr($skin_color, 1, 2)), 'green' => hexdec(substr($skin_color, 3, 2)), 'blue' => hexdec(substr($skin_color, 5, 2)), 'thumbnail_height' => intval($widget_info->thumbnail_height), 'thumbnail_width' => intval($widget_info->thumbnail_width)))}
|
{@Context::set('less_color', array('red' => hexdec(substr($skin_color, 1, 2)), 'green' => hexdec(substr($skin_color, 3, 2)), 'blue' => hexdec(substr($skin_color, 5, 2)), 'thumbnail_height' => intval($widget_info->thumbnail_height), 'thumbnail_width' => intval($widget_info->thumbnail_width)))}
|
||||||
<load target="css/css.less" vars="$less_color" />
|
<load target="css/css.less" vars="$less_color" />
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue