merge from branch luminous (version 1.5.4.2, ~r12561)

git-svn-id: http://xe-core.googlecode.com/svn/trunk@12611 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
flyskyko 2013-01-30 05:53:14 +00:00
parent 2263200ce4
commit cc47d2b247
196 changed files with 3655 additions and 2033 deletions

View file

@ -267,7 +267,7 @@
}
// Write a post
$output = $oDocumentController->insertDocument($obj, true);
$output = $oDocumentController->insertDocument($obj, true, true);
if(!$output->toBool()) {
$oDB->rollback();
return $output;
@ -361,6 +361,7 @@
}
// Call a trigger (before)
$triggerObj->copied_srls = $copied_srls;
$output = ModuleHandler::triggerCall('document.copyDocumentModule', 'after', $triggerObj);
if(!$output->toBool()) {
$oDB->rollback();
@ -480,7 +481,7 @@
$type = Context::get('type');
$is_required = Context::get('is_required');
$default = Context::get('default');
$desc = Context::get('desc');
$desc = Context::get('desc') ? Context::get('desc') : '';
$search = Context::get('search');
$eid = Context::get('eid');
@ -709,7 +710,7 @@
$oDB->begin();
//DB restore
$output = $oDocumentController->insertDocument($originObject, false, true);
$output = $oDocumentController->insertDocument($originObject, false, true, false);
if(!$output->toBool()) return new Object(-1, $output->getMessage());
//FILE restore

View file

@ -59,6 +59,9 @@
Context::set('status_name_list', $statusNameList);
Context::set('page_navigation', $output->page_navigation);
$oSecurity = new Security();
$oSecurity->encodeHTML('document_list..variables.');
// set a search option used in the template
$count_search_option = count($this->search_option);
for($i=0;$i<$count_search_option;$i++) {

View file

@ -120,6 +120,9 @@ class document extends ModuleObject
// 2012. 02. 27 Add a trigger to copy extra keys when the module is copied
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) return true;
// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) return true;
return false;
}
@ -296,6 +299,12 @@ class document extends ModuleObject
$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after');
}
// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after'))
{
$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after');
}
return new Object(0,'success_updated');
}

View file

@ -174,7 +174,12 @@ class documentController extends document {
* @param bool $isRestore
* @return object
*/
function insertDocument($obj, $manual_inserted = false, $isRestore = false) {
function insertDocument($obj, $manual_inserted = false, $isRestore = false, $isLatest = true) {
if(!checkCSRF())
{
return new Object(-1, 'msg_invalid_request');
}
// begin transaction
$oDB = &DB::getInstance();
$oDB->begin();
@ -212,7 +217,7 @@ class documentController extends document {
}
// Set the read counts and update order.
if(!$obj->readed_count) $obj->readed_count = 0;
if(!$isRestore) $obj->update_order = $obj->list_order = getNextSequence() * -1;
if($isLatest) $obj->update_order = $obj->list_order = getNextSequence() * -1;
else $obj->update_order = $obj->list_order;
// Check the status of password hash for manually inserting. Apply md5 hashing for otherwise.
if($obj->password && !$obj->password_is_hashed) $obj->password = md5($obj->password);
@ -309,6 +314,11 @@ class documentController extends document {
* @return object
*/
function updateDocument($source_obj, $obj) {
if(!checkCSRF())
{
return new Object(-1, 'msg_invalid_request');
}
if(!$source_obj->document_srl || !$obj->document_srl) return new Object(-1,'msg_invalied_request');
if(!$obj->status && $obj->is_secret == 'Y') $obj->status = 'SECRET';
if(!$obj->status) $obj->status = 'PUBLIC';
@ -745,6 +755,8 @@ class documentController extends document {
$cache_key = 'object_document_item:'.$document_srl;
$oCacheHandler->delete($cache_key);
}
return TRUE;
}
/**
@ -1616,6 +1628,7 @@ class documentController extends document {
$xml_buff = sprintf(
'<?php '.
'define(\'__ZBXE__\', true); '.
'define(\'__XE__\', true); '.
'require_once(\''.FileHandler::getRealPath('./config/config.inc.php').'\'); '.
'$oContext = &Context::getInstance(); '.
'$oContext->init(); '.
@ -1862,6 +1875,11 @@ class documentController extends document {
set_time_limit(0);
if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
if(!checkCSRF())
{
return new Object(-1, 'msg_invalid_request');
}
$type = Context::get('type');
$target_module = Context::get('target_module');
$module_srl = Context::get('module_srl');
@ -1918,14 +1936,14 @@ class documentController extends document {
$msg_code = 'success_moved';
}
elseif($type == 'copy') {
elseif($type == 'copy')
{
if(!$module_srl) return new Object(-1, 'fail_to_move');
$output = $oDocumentAdminController->copyDocumentModule($document_srl_list, $module_srl, $category_srl);
if(!$output->toBool()) return new Object(-1, 'fail_to_move');
$msg_code = 'success_copy';
$msg_code = 'success_copied';
}
elseif($type =='delete') {
$oDB = &DB::getInstance();
@ -2130,5 +2148,20 @@ class documentController extends document {
}
}
}
function triggerCopyModule(&$obj)
{
$oModuleModel = &getModel('module');
$documentConfig = $oModuleModel->getModulePartConfig('document', $obj->originModuleSrl);
$oModuleController = &getController('module');
if(is_array($obj->moduleSrlList))
{
foreach($obj->moduleSrlList AS $key=>$moduleSrl)
{
$oModuleController->insertModulePartConfig('document', $moduleSrl, $documentConfig);
}
}
}
}
?>

View file

@ -454,42 +454,52 @@
return $content;
}
function getRegdate($format = 'Y.m.d H:i:s') {
return zdate($this->get('regdate'), $format);
}
function getRegdate($format = 'Y.m.d H:i:s') {
return zdate($this->get('regdate'), $format);
}
function getRegdateTime() {
$regdate = $this->get('regdate');
$year = substr($regdate,0,4);
$month = substr($regdate,4,2);
$day = substr($regdate,6,2);
$hour = substr($regdate,8,2);
$min = substr($regdate,10,2);
$sec = substr($regdate,12,2);
return mktime($hour,$min,$sec,$month,$day,$year);
}
function getRegdateTime() {
$regdate = $this->get('regdate');
$year = substr($regdate,0,4);
$month = substr($regdate,4,2);
$day = substr($regdate,6,2);
$hour = substr($regdate,8,2);
$min = substr($regdate,10,2);
$sec = substr($regdate,12,2);
return mktime($hour,$min,$sec,$month,$day,$year);
}
function getRegdateGM() {
return $this->getRegdate('D, d M Y H:i:s').' '.$GLOBALS['_time_zone'];
}
function getRegdateGM() {
return $this->getRegdate('D, d M Y H:i:s').' '.$GLOBALS['_time_zone'];
}
function getUpdate($format = 'Y.m.d H:i:s') {
return zdate($this->get('last_update'), $format);
}
function getRegdateDT()
{
return $this->getRegdate('Y-m-d').'T'.$this->getRegdate('H:i:s').substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3,2);
}
function getUpdateTime() {
$year = substr($this->get('last_update'),0,4);
$month = substr($this->get('last_update'),4,2);
$day = substr($this->get('last_update'),6,2);
$hour = substr($this->get('last_update'),8,2);
$min = substr($this->get('last_update'),10,2);
$sec = substr($this->get('last_update'),12,2);
return mktime($hour,$min,$sec,$month,$day,$year);
}
function getUpdate($format = 'Y.m.d H:i:s') {
return zdate($this->get('last_update'), $format);
}
function getUpdateGM() {
return gmdate("D, d M Y H:i:s", $this->getUpdateTime());
}
function getUpdateTime() {
$year = substr($this->get('last_update'),0,4);
$month = substr($this->get('last_update'),4,2);
$day = substr($this->get('last_update'),6,2);
$hour = substr($this->get('last_update'),8,2);
$min = substr($this->get('last_update'),10,2);
$sec = substr($this->get('last_update'),12,2);
return mktime($hour,$min,$sec,$month,$day,$year);
}
function getUpdateGM() {
return gmdate("D, d M Y H:i:s", $this->getUpdateTime());
}
function getUpdateDT()
{
return $this->getUpdate('Y-m-d').'T'.$this->getUpdate('H:i:s').substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3,2);
}
function getPermanentUrl() {
return getFullUrl('','document_srl',$this->get('document_srl'));
@ -499,7 +509,7 @@
if(!$this->document_srl) return;
// Generate a key to prevent spams
$oTrackbackModel = &getModel('trackback');
return $oTrackbackModel->getTrackbackUrl($this->document_srl);
return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid());
}
/**
@ -665,7 +675,7 @@
// Find an iamge file among attached files if exists
if($this->get('uploaded_count')) {
$oFileModel = &getModel('file');
$file_list = $oFileModel->getFiles($this->document_srl);
$file_list = $oFileModel->getFiles($this->document_srl, array(), 'file_srl', true);
if(count($file_list)) {
foreach($file_list as $file) {
if($file->direct_download!='Y') continue;
@ -809,7 +819,7 @@
if(!$this->uploadedFiles[$sortIndex])
{
$oFileModel = &getModel('file');
$this->uploadedFiles[$sortIndex] = $oFileModel->getFiles($this->document_srl, array(), $sortIndex);
$this->uploadedFiles[$sortIndex] = $oFileModel->getFiles($this->document_srl, array(), $sortIndex, true);
}
return $this->uploadedFiles[$sortIndex];