82 if(!$this->document_srl)
return;
84 $document_item =
false;
87 $this->columnList = array();
91 if($oCacheHandler->isSupport())
94 $document_item = $oCacheHandler->get($cache_key);
95 if($document_item !==
false)
97 $columnList = array(
'readed_count',
'voted_count',
'blamed_count',
'comment_count',
'trackback_count');
101 $args =
new stdClass();
105 if($document_item ===
false)
107 $document_item =
$output->data;
110 if($document_item && $oCacheHandler->isSupport())
112 $oCacheHandler->put($cache_key, $document_item);
117 $document_item->readed_count =
$output->data->readed_count;
118 $document_item->voted_count =
$output->data->voted_count;
119 $document_item->blamed_count =
$output->data->blamed_count;
120 $document_item->comment_count =
$output->data->comment_count;
121 $document_item->trackback_count =
$output->data->trackback_count;
129 if(!$attribute->document_srl)
131 $this->document_srl = null;
134 $this->document_srl = $attribute->document_srl;
135 $this->lang_code = $attribute->lang_code;
136 $this->
adds($attribute);
139 if($this->
get(
'tags'))
141 $tag_list = explode(
',', $this->
get(
'tags'));
142 $tag_list = array_map(
'trim', $tag_list);
143 $this->
add(
'tag_list', $tag_list);
149 $GLOBALS[
'XE_DOCUMENT_LIST'][$attribute->document_srl] = $this;
157 return $this->document_srl ?
true :
false;
162 if($_SESSION[
'own_document'][$this->document_srl])
return $this->grant_cache =
true;
164 if($this->grant_cache !== null)
169 if(!
Context::get(
'is_logged'))
return $this->grant_cache =
false;
172 if(
$logged_info->is_admin ==
'Y')
return $this->grant_cache =
true;
176 if($grant->manager)
return $this->grant_cache =
true;
178 if($this->
get(
'member_srl') && abs($this->
get(
'member_srl')) ==
$logged_info->member_srl)
180 return $this->grant_cache =
true;
183 return $this->grant_cache =
false;
189 $this->grant_cache =
true;
202 return $this->
get(
'comment_status') ==
'ALLOW' ?
true :
false;
220 $trackback_config =
$oModuleModel->getModuleConfig(
'trackback');
222 if(!$trackback_config)
224 $trackback_config =
new stdClass();
227 if(!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback =
'Y';
244 if(!$this->
isExists())
return false;
246 return $this->
get(
'comment_status') ==
'ALLOW' ?
false :
true;
251 if($this->
isGranted() || !$this->
get(
'member_srl'))
return true;
258 return $this->
get(
'status') ==
$oDocumentModel->getConfigStatus(
'secret') ?
true :
false;
263 return $this->
get(
'is_notice') ==
'Y' ?
true :
false;
268 return $this->
get(
'notify_message')==
'Y' ?
true :
false;
273 if(!$this->document_srl)
return false;
285 unset($_SESSION[
'document_management'][$this->document_srl]);
301 if(!$this->document_srl)
return;
305 if(!$this->
get(
'member_srl'))
return;
308 if(
$logged_info->member_srl == $this->get(
'member_srl'))
return;
310 if($type) $title =
"[".$type.
"] ";
311 $title .=
cut_str(strip_tags($content), 10,
'...');
312 $content = sprintf(
'%s<br /><br />from : <a href="%s" target="_blank">%s</a>',$content,
getFullUrl(
'',
'document_srl',$this->document_srl),
getFullUrl(
'',
'document_srl',$this->document_srl));
313 $receiver_srl = $this->
get(
'member_srl');
317 $oCommunicationController->sendMessage($sender_member_srl, $receiver_srl, $title, $content,
false);
322 return $this->
get(
'lang_code');
329 return $this->
get(
'ipaddress');
332 return '*' . strstr($this->
get(
'ipaddress'),
'.');
337 if(trim($this->
get(
'homepage')))
return true;
343 $url = trim($this->
get(
'homepage'));
346 if(strncasecmp(
'http://', $url, 7) !== 0 && strncasecmp(
'https://', $url, 8) !== 0) $url =
'http://' . $url;
353 return $this->
get(
'member_srl');
358 return htmlspecialchars($this->
get(
'user_id'), ENT_COMPAT | ENT_HTML401,
'UTF-8',
false);
363 return htmlspecialchars($this->
get(
'user_name'), ENT_COMPAT | ENT_HTML401,
'UTF-8',
false);
368 return htmlspecialchars($this->
get(
'nick_name'), ENT_COMPAT | ENT_HTML401,
'UTF-8',
false);
373 return htmlspecialchars($this->
get(
'last_updater'), ENT_COMPAT | ENT_HTML401,
'UTF-8',
false);
378 if(!$this->document_srl)
return;
380 if($cut_size) $title =
cut_str($this->
get(
'title'), $cut_size, $tail);
381 else $title = $this->
get(
'title');
388 if(!$this->document_srl)
return;
393 $this->
add(
'title_color', trim($this->
get(
'title_color')));
394 if($this->
get(
'title_bold')==
'Y') $attrs[] =
"font-weight:bold;";
395 if($this->
get(
'title_color') && $this->
get(
'title_color') !=
'N') $attrs[] =
"color:#".$this->get(
'title_color');
397 if(count($attrs))
return sprintf(
"<span style=\"%s\">%s</span>", implode(
';',$attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401,
'UTF-8',
false));
398 else return htmlspecialchars($title, ENT_COMPAT | ENT_HTML401,
'UTF-8',
false);
403 if(!$this->document_srl)
return;
410 $content = $this->
get(
'content');
411 $content = preg_replace_callback(
'/<(object|param|embed)[^>]*/is', array($this,
'_checkAllowScriptAccess'), $content);
412 $content = preg_replace_callback(
'/<object[^>]*>/is', array($this,
'_addAllowScriptAccess'), $content);
414 if($strlen)
return cut_str(strip_tags($content),$strlen,
'...');
416 return htmlspecialchars($content);
421 if($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1)
423 $m[0] = $m[0].
'<param name="allowscriptaccess" value="never"></param>';
425 $this->allowscriptaccessKey++;
431 if($m[1] ==
'object')
433 $this->allowscriptaccessList[] = 1;
438 if(stripos($m[0],
'allowscriptaccess'))
440 $m[0] =
'<param name="allowscriptaccess" value="never"';
441 if(substr($m[0], -1) ==
'/')
445 $this->allowscriptaccessList[count($this->allowscriptaccessList)-1]--;
448 else if($m[1] ==
'embed')
450 if(stripos($m[0],
'allowscriptaccess'))
452 $m[0] = preg_replace(
'/always|samedomain/i',
'never', $m[0]);
456 $m[0] = preg_replace(
'/<embed/i',
'<embed allowscriptaccess="never"', $m[0]);
462 function getContent($add_popup_menu =
true, $add_content_info =
true, $resource_realpath =
false, $add_xe_content_class =
true, $stripEmbedTagException =
false)
464 if(!$this->document_srl)
return;
471 $content = $this->
get(
'content');
478 $content = preg_replace(
'/<a([ \t]+)href=("|\')\.\/\?/i',
"<a href=\\2".
Context::getRequestUri() .
"?", $content);
484 '%s<div class="document_popup_menu"><a href="#popup_menu_area" class="document_%d" onclick="return false">%s</a></div>',
490 if($add_content_info)
492 $memberSrl = $this->
get(
'member_srl');
498 '<!--BeforeDocument(%d,%d)--><div class="document_%d_%d xe_content">%s</div><!--AfterDocument(%d,%d)-->',
499 $this->document_srl, $memberSrl,
500 $this->document_srl, $memberSrl,
502 $this->document_srl, $memberSrl,
503 $this->document_srl, $memberSrl
509 if($add_xe_content_class) $content = sprintf(
'<div class="xe_content">%s</div>', $content);
512 if($resource_realpath)
514 $content = preg_replace_callback(
'/<img([^>]+)>/i',array($this,
'replaceResourceRealPath'), $content);
528 function getTransContent($add_popup_menu =
true, $add_content_info =
true, $resource_realpath =
false, $add_xe_content_class =
true)
532 $content = $this->
getContent($add_popup_menu, $add_content_info, $resource_realpath, $add_xe_content_class);
533 $content = $oEditorController->transComponent($content);
542 $content = nl2br($content);
545 $content = preg_replace(
'!(<br[\s]*/{0,1}>[\s]*)+!is',
' ', $content);
548 $content = str_replace(array(
'</p>',
'</div>',
'</li>',
'-->'),
' ', $content);
551 $content = preg_replace(
'!<([^>]*?)>!is',
'', $content);
554 $content = str_replace(array(
'<',
'>',
'"',
' '), array(
'<',
'>',
'"',
' '), $content);
557 $content = preg_replace(
'/ ( +)/is',
' ', $content);
560 $content = trim(
cut_str($content, $str_size, $tail));
563 $content = str_replace(array(
'<',
'>',
'"'),array(
'<',
'>',
'"'), $content);
570 return zdate($this->
get(
'regdate'), $format);
575 $regdate = $this->
get(
'regdate');
576 $year = substr($regdate,0,4);
577 $month = substr($regdate,4,2);
578 $day = substr($regdate,6,2);
579 $hour = substr($regdate,8,2);
580 $min = substr($regdate,10,2);
581 $sec = substr($regdate,12,2);
582 return mktime($hour,$min,$sec,$month,$day,$year);
597 return zdate($this->
get(
'last_update'), $format);
602 $year = substr($this->
get(
'last_update'),0,4);
603 $month = substr($this->
get(
'last_update'),4,2);
604 $day = substr($this->
get(
'last_update'),6,2);
605 $hour = substr($this->
get(
'last_update'),8,2);
606 $min = substr($this->
get(
'last_update'),10,2);
607 $sec = substr($this->
get(
'last_update'),12,2);
608 return mktime($hour,$min,$sec,$month,$day,$year);
628 if(!$this->document_srl)
return;
631 $oTrackbackModel =
getModel(
'trackback');
632 if($oTrackbackModel)
return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->
getDocumentMid());
644 $readed_count = $this->
get(
'readed_count');
645 $this->
add(
'readed_count', $readed_count+1);
651 if(!$this->
get(
'module_srl'))
return false;
654 return count($extra_keys)?
true:
false;
659 if(!$this->
get(
'module_srl') || !$this->document_srl)
return null;
662 return $oDocumentModel->getExtraVars($this->
get(
'module_srl'), $this->document_srl);
700 $extra_eid[$key->eid] = $key;
704 if(is_array($extra_eid) && array_key_exists($eid,$extra_eid))
706 return $extra_eid[$eid]->getValue();
720 $extra_eid[$key->eid] = $key;
723 if(is_array($extra_eid) && array_key_exists($eid,$extra_eid))
725 return $extra_eid[$eid]->getValueHTML();
735 $extra_vals = unserialize($this->
get(
'extra_vars'));
736 $val = $extra_vals->$key;
742 return $this->
get(
'comment_count');
750 $cpageStr = sprintf(
'%d_cpage', $this->document_srl);
759 $oCommentModel =
getModel(
'comment');
760 $output = $oCommentModel->getCommentList($this->document_srl, $cpage, $is_admin);
764 $accessible = array();
765 $comment_list = array();
766 foreach(
$output->data as $key => $val)
769 $oCommentItem->setAttribute($val);
771 if($oCommentItem->isGranted()) $accessible[$val->comment_srl] =
true;
773 if($val->parent_srl>0 && $val->is_secret ==
'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl]===
true)
775 $oCommentItem->setAccessible();
777 $comment_list[$val->comment_srl] = $oCommentItem;
782 if(
$output->total_page>1) $this->comment_page_navigation =
$output->page_navigation;
787 return $comment_list;
792 return $this->
get(
'trackback_count');
797 if(!$this->document_srl)
return;
799 if(!$this->
allowTrackback() || !$this->
get(
'trackback_count'))
return;
801 $oTrackbackModel =
getModel(
'trackback');
802 return $oTrackbackModel->getTrackbackList($this->document_srl, $is_admin);
807 if(!$this->document_srl)
return false;
808 if(!$this->
getThumbnail($width, $height, $type))
return false;
815 if(!$this->document_srl)
return;
823 if(!$height) $height = $width;
826 $content = $this->
get(
'content');
827 if(!$this->
get(
'uploaded_count'))
831 $args =
new stdClass();
836 $content =
$output->data->content;
837 $this->
add(
'content', $content);
841 if(!preg_match(
"!<img!is", $content))
return;
844 if(!in_array($thumbnail_type, array(
'crop',
'ratio')))
846 $config =
$GLOBALS[
'__document_config__'];
851 $GLOBALS[
'__document_config__'] = $config;
853 $thumbnail_type = $config->thumbnail_type;
857 $thumbnail_path = sprintf(
'files/thumbnails/%s',
getNumberingPath($this->document_srl, 3));
858 $thumbnail_file = sprintf(
'%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type);
859 $thumbnail_lockfile = sprintf(
'%s%dx%d.%s.lock', $thumbnail_path, $width, $height, $thumbnail_type);
863 if(file_exists($thumbnail_file) || file_exists($thumbnail_lockfile))
865 if(filesize($thumbnail_file) < 1)
871 return $thumbnail_url .
'?' . date(
'YmdHis', filemtime($thumbnail_file));
880 $is_tmp_file =
false;
888 foreach($file_list as $file)
890 if($file->direct_download !==
'Y')
continue;
892 if($file->cover_image ===
'Y' && file_exists($file->uploaded_filename))
894 $source_file = $file->uploaded_filename;
898 if($first_image)
continue;
900 if(preg_match(
"/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
902 if(file_exists($file->uploaded_filename))
904 $first_image = $file->uploaded_filename;
909 if(!$source_file && $first_image)
911 $source_file = $first_image;
915 $is_tmp_file =
false;
920 preg_match_all(
"!<img[^>]*src=(?:\"|\')([^\"\']*?)(?:\"|\')!is", $content, $matches, PREG_SET_ORDER);
922 foreach($matches as $target_image)
924 $target_src = trim($target_image[1]);
925 if(preg_match(
'/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src))
continue;
927 if(!preg_match(
'/^(http|https):\/\//i',$target_src))
932 $target_src = htmlspecialchars_decode($target_src);
934 $tmp_file =
_XE_PATH_ .
'files/cache/tmp/' . $random->createSecureSalt(32,
'hex');
936 if(!file_exists($tmp_file))
continue;
938 $imageinfo = getimagesize($tmp_file);
939 list($_w, $_h) = $imageinfo;
940 if($imageinfo ===
false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) {
945 $source_file = $tmp_file;
971 return $thumbnail_url .
'?' . date(
'YmdHis', filemtime($thumbnail_file));
982 if(!$this->document_srl)
return;
986 $check_files =
false;
989 if($this->
isSecret()) $buffs[] =
"secret";
992 $time_check = date(
"YmdHis", $_SERVER[
'REQUEST_TIME']-$time_interval);
995 if($this->
get(
'regdate')>$time_check) $buffs[] =
"new";
996 else if($this->
get(
'last_update')>$time_check) $buffs[] =
"update";
1026 if(!$this->
get(
'status')) {
1027 $oDocumentClass =
getClass(
'document');
1028 return $oDocumentClass->getDefaultStatus();
1030 return $this->
get(
'status');
1040 if(!$this->document_srl)
return;
1046 $iconSkin = $documentConfig->micons;
1050 $iconSkin = $documentConfig->icons;
1052 $path = sprintf(
'%s%s',
getUrl(),
"modules/document/tpl/icons/$iconSkin/");
1055 if(!count($buffs))
return;
1058 foreach($buffs as $key => $val)
1060 $buff[] = sprintf(
'<img src="%s%s.gif" alt="%s" title="%s" style="margin-right:2px;" />', $path, $val, $val, $val);
1062 return implode(
'', $buff);
1067 if(!$this->document_srl)
return;
1070 return $this->
get(
'uploaded_count')?
true :
false;
1075 if(!$this->document_srl)
return;
1078 if(!$this->
get(
'uploaded_count'))
return;
1080 if(!$this->uploadedFiles[$sortIndex])
1083 $this->uploadedFiles[$sortIndex] = $oFileModel->getFiles($this->document_srl, array(), $sortIndex,
true);
1086 return $this->uploadedFiles[$sortIndex];
1098 $oEditorModel =
getModel(
'editor');
1099 return $oEditorModel->getModuleEditor(
'document',
$module_srl, $this->document_srl,
'document_srl',
'content');
1124 $oEditorModel =
getModel(
'editor');
1125 return $oEditorModel->getModuleEditor(
'comment', $this->
get(
'module_srl'), $comment_srl,
'comment_srl',
'content');
1134 if(!$this->
isExists() || !$this->
get(
'member_srl'))
return;
1135 $oMemberModel =
getModel(
'member');
1136 $profile_info = $oMemberModel->getProfileImage($this->
get(
'member_srl'));
1137 if(!$profile_info)
return;
1139 return $profile_info->src;
1149 if(!$this->
isExists() || !$this->
get(
'member_srl'))
return;
1151 $oMemberModel =
getModel(
'member');
1152 $signature = $oMemberModel->getSignature($this->
get(
'member_srl'));
1154 if(!isset(
$GLOBALS[
'__member_signature_max_height']))
1158 $GLOBALS[
'__member_signature_max_height'] = $member_config->signature_max_height;
1162 $max_signature_height =
$GLOBALS[
'__member_signature_max_height'];
1163 if($max_signature_height) $signature = sprintf(
'<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature);
1189 $status = $this->
get(
'status');
1190 if(empty($status))
return false;
1195 if($status == $configStatusList[
'public'] || $status == $configStatusList[
'publish'])
1197 else if($status == $configStatusList[
'private'] || $status == $configStatusList[
'secret'])
1199 if($this->
get(
'member_srl') ==
$logged_info->member_srl)
1207 $obj =
new stdClass;
1218 $origLangCode =
new stdClass;
1220 $output->data[] = $origLangCode;
1233 $module = $model->getModuleInfoByModuleSrl($this->
get(
'module_srl'));
1234 return $module->mid;
1244 $module = $model->getModuleInfoByModuleSrl($this->
get(
'module_srl'));
1245 return $module->module;
1265 $module = $model->getModuleInfoByModuleSrl($this->
get(
'module_srl'));
1266 return $module->browser_title;
getController($module_name)
getNumberingPath($no, $size=3)
getTitleText($cut_size=0, $tail='...')
zdate($str, $format= 'Y-m-d H:i:s', $conversion=TRUE)
getTranslationLangCodes()
stripEmbedTagForAdmin(&$content, $writer_member_srl)
getThumbnail($width=80, $height=0, $thumbnail_type= '')
if(file_exists(_XE_PATH_. 'config/config.user.inc.php')) if(!defined('__DEBUG__')) if(!defined('__DEBUG_OUTPUT__')) if(!defined('__DEBUG_PROTECT__')) if(!defined('__DEBUG_PROTECT_IP__')) if(!defined('__DEBUG_DB_OUTPUT__')) if(!defined('__LOG_SLOW_QUERY__')) if(!defined('__LOG_SLOW_TRIGGER__')) if(!defined('__LOG_SLOW_ADDON__')) if(!defined('__LOG_SLOW_WIDGET__')) if(!defined('__DEBUG_QUERY__')) if(!defined('__OB_GZHANDLER_ENABLE__')) if(!defined('__ENABLE_PHPUNIT_TEST__')) if(!defined('__PROXY_SERVER__')) if(!defined('__ERROR_LOG__')) if(!defined('__DISABLE_DEFAULT_CSS__')) if(!defined('__AUTO_OPCACHE_INVALIDATE__')) if((__DEBUG_OUTPUT__==2)&&version_compare(PHP_VERSION, '6.0.0')===-1) if(version_compare(PHP_VERSION, '5.3.0') >=0) $GLOBALS['__xe_autoload_file_map']
getContent($add_popup_menu=true, $add_content_info=true, $resource_realpath=false, $add_xe_content_class=true, $stripEmbedTagException=false)
& getInstance($target= 'object', $info=null, $always_use_file=false)
setAttribute($attribute, $load_extra_vars=true)
_loadFromDB($load_extra_vars=true)
foreach($sitemap as $id=> &$val) $extra_vars
set($key, $val, $set_to_get_vars=0)
printExtraImages($time_check=43200)
writeFile($filename, $buff, $mode="w")
getExtraEidValueHTML($eid)
$oContext
Include the necessary configuration files.
getRegdate($format= 'Y.m.d H:i:s')
getRemoteFile($url, $target_filename, $body=null, $timeout=3, $method= 'GET', $content_type=null, $headers=array(), $cookies=array(), $post_data=array(), $request_config=array())
thumbnailExists($width=80, $height=0, $type= '')
__construct($document_srl=0, $load_extra_vars=true, $columnList=array())
getTransContent($add_popup_menu=true, $add_content_info=true, $resource_realpath=false, $add_xe_content_class=true)
_checkAllowScriptAccess($m)
getSummary($str_size=50, $tail= '...')
_checkAccessibleFromStatus()
createImageFile($source_file, $target_file, $resize_width=0, $resize_height=0, $target_type= '', $thumbnail_type= 'crop', $thumbnail_transparent=FALSE)
getRequestUri($ssl_mode=FOLLOW_REQUEST_SSL, $domain=null)
getUploadedFiles($sortIndex= 'file_srl')
setDocument($document_srl, $load_extra_vars=true)
getUpdate($format= 'Y.m.d H:i:s')
getContentText($strlen=0)
getExtraImages($time_interval=43200)
executeQueryArray($query_id, $args=NULL, $arg_columns=NULL)
_addAllowScriptAccess($m)
cut_str($string, $cut_size=0, $tail= '...')
executeQuery($query_id, $args=NULL, $arg_columns=NULL)
getTitle($cut_size=0, $tail='...')
triggerCall($trigger_name, $called_position, &$obj)
replaceResourceRealPath($matches)