30 if(!$cart)
return $this->
stop(
'msg_cart_is_null');
31 $document_srl_list= explode(
'|@|', $cart);
32 $document_count = count($document_srl_list);
33 if(!$document_count)
return $this->
stop(
'msg_cart_is_null');
36 for($i=0;$i<$document_count;$i++)
56 if(!count($document_srl_list))
return;
64 $triggerObj =
new stdClass();
65 $triggerObj->document_srls = implode(
',',$document_srl_list);
67 $triggerObj->source_module_srl = array();
68 $triggerObj->category_srl = $category_srl;
78 for($i=count($document_srl_list)-1;$i>=0;$i--)
82 if(!$oDocument->isExists())
continue;
84 $triggerObj->source_module_srl[
$document_srl] = $oDocument->get(
'module_srl');
86 $source_category_srl = $oDocument->get(
'category_srl');
89 $obj = $oDocument->getObjectVars();
93 $output_ori =
executeQuery(
'document.getDocument', $args_doc_origin, array(
'content'));
94 $obj->content = $output_ori->data->content;
101 $files = $oDocument->getUploadedFiles();
102 $delete_file_srls = array();
105 foreach($files as $val)
107 $file_info = array();
108 $file_info[
'tmp_name'] = $val->uploaded_filename;
109 $file_info[
'name'] = $val->source_filename;
110 $inserted_file = $oFileController->insertFile($file_info,
$module_srl,
$obj->document_srl, $val->download_count,
true);
112 if(!$inserted_file->toBool()) {
114 return $inserted_file;
117 if($inserted_file && $inserted_file->toBool())
120 if($val->direct_download ==
'Y')
122 $source_filename = substr($val->uploaded_filename,2);
123 $target_filename = substr($inserted_file->get(
'uploaded_filename'),2);
124 $obj->content = str_replace($source_filename, $target_filename,
$obj->content);
129 $obj->content = str_replace(
'file_srl='.$val->file_srl,
'file_srl='.$inserted_file->get(
'file_srl'),
$obj->content);
130 $obj->content = str_replace(
'sid='.$val->sid,
'sid='.$inserted_file->get(
'sid'),
$obj->content);
133 $delete_file_srls[] = $val->file_srl;
136 $oFileController->deleteFile($delete_file_srls);
139 $oFileController->setFilesValid(
$obj->document_srl);
148 $obj->category_srl = $category_srl;
162 if($source_category_srl != $category_srl)
164 if($source_category_srl)
$oDocumentController->updateCategoryCount($oDocument->get(
'module_srl'), $source_category_srl);
169 $args =
new stdClass();
170 $args->document_srls = implode(
',',$document_srl_list);
216 if($oCacheHandler->isSupport())
221 $oCacheHandler->delete($cache_key_item);
236 if(count($document_srl_list) < 1)
return;
246 $triggerObj =
new stdClass();
247 $triggerObj->document_srls = implode(
',',$document_srl_list);
249 $triggerObj->category_srl = $category_srl;
258 $extraVarsList =
$oDocumentModel->getDocumentExtraVarsFromDB($document_srl_list);
259 $extraVarsListByDocumentSrl = array();
260 if(is_array($extraVarsList->data))
262 foreach($extraVarsList->data as $value)
264 if(!isset($extraVarsListByDocumentSrl[$value->document_srl]))
266 $extraVarsListByDocumentSrl[$value->document_srl] = array();
269 $extraVarsListByDocumentSrl[$value->document_srl][] = $value;
273 for($i=count($document_srl_list)-1;$i>=0;$i--)
277 if(!$oDocument->isExists())
continue;
279 $obj = $oDocument->getObjectVars();
284 if(is_array($extraVars))
286 foreach($extraVars as $extraItem)
288 if($extraItem->var_idx >= 0)
$obj->{
'extra_vars'.$extraItem->var_idx} = $extraItem->value;
294 $obj->category_srl = $category_srl;
295 $obj->password_is_hashed =
true;
296 $obj->comment_count = 0;
297 $obj->trackback_count = 0;
300 if($oDocument->hasUploadedFiles())
302 $files = $oDocument->getUploadedFiles();
303 foreach($files as $val)
305 $file_info = array();
306 $file_info[
'tmp_name'] = $val->uploaded_filename;
307 $file_info[
'name'] = $val->source_filename;
309 $inserted_file = $oFileController->insertFile($file_info,
$module_srl,
$obj->document_srl, 0,
true);
311 if(!$inserted_file->toBool()) {
313 return $inserted_file;
317 if($val->direct_download ==
'Y')
319 $source_filename = substr($val->uploaded_filename,2);
320 $target_filename = substr($inserted_file->get(
'uploaded_filename'),2);
321 $obj->content = str_replace($source_filename, $target_filename,
$obj->content);
326 $obj->content = str_replace(
'file_srl='.$val->file_srl,
'file_srl='.$inserted_file->get(
'file_srl'),
$obj->content);
327 $obj->content = str_replace(
'sid='.$val->sid,
'sid='.$inserted_file->get(
'sid'),
$obj->content);
341 if(is_array($extraVars))
343 foreach($extraVars as $value)
350 if( $value->var_idx < 0 || (
$module_srl == $value->module_srl && $value->var_idx >= 0) )
352 $oDocumentController->insertDocumentExtraVar($value->module_srl,
$obj->document_srl, $value->var_idx, $value->value, $value->eid, $value->lang_code);
358 if($oDocument->getCommentCount())
360 $oCommentModel =
getModel(
'comment');
361 $comment_output = $oCommentModel->getCommentList(
$document_srl, 0,
true, 99999999);
362 $comments = $comment_output->data;
363 if(count($comments) > 0)
367 $p_comment_srl = array();
368 foreach($comments as $comment_obj)
371 $p_comment_srl[$comment_obj->comment_srl] = $comment_srl;
374 if($comment_obj->uploaded_count)
376 $files = $oFileModel->getFiles($comment_obj->comment_srl,
true);
377 foreach($files as $val)
379 $file_info = array();
380 $file_info[
'tmp_name'] = $val->uploaded_filename;
381 $file_info[
'name'] = $val->source_filename;
383 $inserted_file = $oFileController->insertFile($file_info,
$module_srl, $comment_srl, 0,
true);
385 if($val->direct_download ==
'Y')
387 $source_filename = substr($val->uploaded_filename,2);
388 $target_filename = substr($inserted_file->get(
'uploaded_filename'),2);
389 $comment_obj->content = str_replace($source_filename, $target_filename, $comment_obj->content);
394 $comment_obj->content = str_replace(
'file_srl='.$val->file_srl,
'file_srl='.$inserted_file->get(
'file_srl'), $comment_obj->content);
395 $comment_obj->content = str_replace(
'sid='.$val->sid,
'sid='.$inserted_file->get(
'sid'), $comment_obj->content);
400 $comment_obj->module_srl =
$obj->module_srl;
401 $comment_obj->document_srl =
$obj->document_srl;
402 $comment_obj->comment_srl = $comment_srl;
404 if($comment_obj->parent_srl) $comment_obj->parent_srl = $p_comment_srl[$comment_obj->parent_srl];
406 $output = $oCommentController->insertComment($comment_obj,
true);
407 if(
$output->toBool()) $success_count ++;
414 $oTrackbackModel =
getModel(
'trackback');
415 if($oTrackbackModel && $oDocument->getTrackbackCount())
417 $trackbacks = $oTrackbackModel->getTrackbackList($oDocument->document_srl);
418 if(count($trackbacks))
421 foreach($trackbacks as $trackback_obj)
424 $trackback_obj->module_srl =
$obj->module_srl;
425 $trackback_obj->document_srl =
$obj->document_srl;
427 if(
$output->toBool()) $success_count++;
438 $triggerObj->copied_srls = $copied_srls;
449 $output->add(
'copied_srls', $copied_srls);
460 $args =
new stdClass();
465 $documents = $document_list->data;
467 if(is_array($documents))
469 foreach ($documents as $oDocument)
471 $document_srl_list[] = $oDocument->document_srl;
476 if($oCacheHandler->isSupport())
478 if(is_array($document_srl_list))
483 $oCacheHandler->delete($cache_key_item);
498 $config =
getModel(
'document')->getDocumentConfig();
507 $this->setMessage(
'success_updated');
510 $this->setRedirectUrl($returnUrl,
$output);
535 $temp_cache_dir =
'./files/thumbnails_' . $_SERVER[
'REQUEST_TIME'];
541 $this->setMessage(
'success_deleted');
550 $directory = dir($path);
551 while($entry = $directory->read()) {
552 if ($entry !=
"." && $entry !=
"..") {
553 if (is_dir($path.
"/".$entry)) {
554 $this->deleteThumbnailFile($path.
"/".$entry);
556 if(!preg_match(
'/^thumbnail_([^\.]*)\.jpg$/i',$entry))
continue;
579 $obj =
new stdClass();
587 $var_idx =
$output->data->var_idx+1;
592 $obj->var_idx = $var_idx;
597 return new BaseObject(-1,
'msg_extra_name_exists');
605 $this->setMessage(
'success_registed');
608 $this->setRedirectUrl($returnUrl);
625 $this->setMessage(
'success_deleted');
646 if(!$extra_keys[$var_idx])
return new BaseObject(-1,
'msg_invalid_request');
648 if($type ==
'up') $new_idx = $var_idx-1;
649 else $new_idx = $var_idx+1;
650 if($new_idx<1)
return new BaseObject(-1,
'msg_invalid_request');
652 $args =
new stdClass();
654 $args->var_idx = $new_idx;
661 if(!$extra_keys[$new_idx])
663 $args =
new stdClass();
665 $args->var_idx = $var_idx;
666 $args->new_idx = $new_idx;
675 $args =
new stdClass();
677 $args->var_idx = $new_idx;
678 $args->new_idx = -10000;
684 $args->var_idx = $var_idx;
685 $args->new_idx = $new_idx;
691 $args->var_idx = -10000;
692 $args->new_idx = $var_idx;
700 if($oCacheHandler->isSupport())
702 $object_key =
'module_document_extra_keys:'.$module_srl;
703 $cache_key = $oCacheHandler->getGroupKey(
'site_and_module', $object_key);
704 $oCacheHandler->delete($cache_key);
719 $query =
"document.insertAlias";
723 $args->alias_srl = $alias_srl;
724 $query =
"document.updateAlias";
729 return $this->setRedirectUrl($returnUrl,
$output);
740 $args->alias_srl = $alias_srl;
744 return $this->setRedirectUrl($returnUrl,
$output);
759 if(!$oDocument->isGranted())
return $this->stop(
'msg_not_permitted');
764 $args =
new stdClass();
765 $args->description = $message_content;
778 parse_str($arrUrl[
'query'], $arrQuery);
781 if(isset($arrQuery[
'document_srl']))
782 unset($arrQuery[
'document_srl']);
784 $searchArgs =
new stdClass;
785 foreach($arrQuery as $key=>$val)
787 $searchArgs->{$key} = $val;
790 if(!isset($searchArgs->sort_index))
795 if(!isset($searchArgs->{$key}))
796 $searchArgs->{$key} = $val;
803 if(isset($arrQuery[
'page'])) {
804 $cur_page = (int)$arrQuery[
'page'];
808 if($cur_page>1 && count(
$output->data) == 0)
809 $arrQuery[
'page'] = $cur_page - 1;
812 foreach($arrQuery as $key=>$val)
813 $query .= sprintf(
"%s=%s&", $key, $val);
814 $query = substr($query, 0, -1);
816 $returnUrl = $arrUrl[
'path'] . $query;
819 $this->add(
'redirect_url', $returnUrl);
829 $this->restoreTrash($trash_srl);
893 if(is_array($originObject)) $originObject = (object)$originObject;
906 $oDocument =
$oDocumentModel->getDocument($originObject->document_srl);
908 if($oDocument->hasUploadedFiles() && $originObject->member_srl != $originObject->module_srl)
910 $args =
new stdClass();
911 $args->upload_target_srl = $oDocument->document_srl;
912 $args->isvalid =
'Y';
920 if(!$trigger_output->toBool())
923 return $trigger_output;
940 $originObject = unserialize($originObject);
941 if(is_array($originObject)) $originObject = (object) $originObject;
944 $oDocument->setAttribute($originObject);
setMessage($message= 'success', $type=NULL)
getController($module_name)
getNumberingPath($no, $size=3)
deleteThumbnailFile($path)
procDocumentAdminInsertExtraVar()
procDocumentAdminMoveToTrash()
move a document to trash.
& getInstance($target= 'object', $info=null, $always_use_file=false)
procDocumentAdminCancelDeclare()
procDocumentAdminRestoreTrash()
copyDocumentModule($document_srl_list, $module_srl, $category_srl)
procDocumentAdminDeleteAllThumbnail()
procDocumentAdminDeleteExtraVar()
procDocumentAdminInsertConfig()
$module_srl
integer value to represent a run-time instance of Module (XE Module)
procDocumentAdminDeleteChecked()
procDocumentAdminDeleteAlias()
getInstance($db_type=NULL)
document the module's high class {
procDocumentAdminMoveExtraVar()
procDocumentAdminInsertAlias()
executeQuery($query_id, $args=NULL, $arg_columns=NULL)
moveDocumentModule($document_srl_list, $module_srl, $category_srl)
deleteModuleDocument($module_srl)
triggerCall($trigger_name, $called_position, &$obj)
restoreTrash($originObject)
emptyTrash($originObject)