diff --git a/README.md b/README.md
index 4219054..a7ba59e 100644
--- a/README.md
+++ b/README.md
@@ -34,13 +34,14 @@ https://techs.b0.upaiyun.com/videos/cdnpage/Discuz.html
2. 安装时提示文件已经被修改,请手动安装
- 由于插件需要修改以下六个系统原文件
+ 由于插件需要修改以下七个系统原文件
* source/module/forum/forum_attachment.php
* source/module/portal/portal_attachment.php
* source/class/discuz/discuz_ftp.php
* source/function/function_attachment.php
* source/function/function_home.php
* source/function/function_post.php
+ * source/module/forum/forum_image.php
在安装时,插件会提前检查这个六个文件是否被修改,防止覆盖您的自定义修改。建议您将自定义修改的系统文件先备份,然后使用 Discuz 相应版本的原文件暂时代替完成安装(例如 Discuz 3.1 版本的原文件可以通过 source/plugin/upyun/discuz_3_1/uninstall/ 目录下获取。 uninstall 目录保存了各个版本的系统原文件)。文件还原后,重新安装即可。安装完成后,可以将您的自定义修改再追加到新的文件中。(如果卸载插件,该文件会被还原为 Discuz 原文件,所以卸载完成后需要重新追加本地修改)。
diff --git a/discuz_3_4/install/discuz_ftp.php b/discuz_3_4/install/discuz_ftp.php
new file mode 100755
index 0000000..0fd3eda
--- /dev/null
+++ b/discuz_3_4/install/discuz_ftp.php
@@ -0,0 +1,164 @@
+set_error(0);
+ loadcache('plugin');
+ $this->upyun_config = getglobal('cache/plugin/upyun');
+ $this->config = !$config ? getglobal('setting/ftp') : $config;
+ $this->enabled = false;
+ $this->config['host'] = discuz_ftp::clear($this->config['host']);
+ $this->config['port'] = intval($this->config['port']);
+ $this->config['ssl'] = intval($this->config['ssl']);
+ $this->config['bucketname'] = $this->config['host'];
+ $this->config['username'] = discuz_ftp::clear($this->config['username']);
+ $this->config['password'] = authcode($this->config['password'], 'DECODE', md5(getglobal('config/security/authkey')));
+ $this->config['timeout'] = intval($this->config['timeout']);
+ $this->config['api_access'] = $this->api_access[$this->config['port']];
+ $this->connectid = true;
+ $this->enabled = true;
+ }
+
+ function upload($source, $target) {
+ $file = new UpyunMultiPartFile($source);
+ if($file->getSize() > 1024 * 1024 && $this->upyun_config['form_api_key']) {
+ $sign = new UpyunMultipartSignature($this->upyun_config['form_api_key']);
+ $upload = new UpyunMultipartUpload($sign);
+ $upload->setBucketName($this->upyun_config['bucket_name']);
+ $upload->setBlockSize($upload->getBlockSizeAdaptive($file));
+ try {
+ $result = $upload->upload($file, array(
+ 'path' => '/' . ltrim($target, '/')
+ ));
+ return $result;
+ } catch(Exception $e) {
+ return 0;
+ }
+ } else {
+ $fh = fopen($source, 'rb');
+ if(!$fh) {
+ return 0;
+ }
+ $upyun = new UpYun(
+ $this->upyun_config['bucket_name'],
+ $this->upyun_config['operator_name'],
+ $this->upyun_config['operator_pwd']
+ );
+ $rsp = $upyun->writeFile('/'. ltrim($target, '/'), $fh, true);
+ return $rsp;
+ }
+ }
+
+ function connect() {
+ return 1;
+ }
+
+ function set_error($code = 0) {
+ $this->_error = $code;
+ }
+
+ function error() {
+ return $this->_error;
+ }
+
+ function clear($str) {
+ return str_replace(array( "\n", "\r", '..'), '', $str);
+ }
+
+ function ftp_rmdir($directory) {
+ return 1;
+ }
+
+ function ftp_size($remote_file) {
+ $upyun = new UpYun(
+ $this->upyun_config['bucket_name'],
+ $this->upyun_config['operator_name'],
+ $this->upyun_config['operator_pwd']
+ );
+ $remote_file = discuz_ftp::clear($remote_file);
+ try{
+ $rsp = $upyun->getFileInfo('/' . ltrim($remote_file, '/'));
+ return $rsp['x-upyun-file-size'];
+ }
+ catch(Exception $e){
+ return -1;
+ }
+ }
+
+ function ftp_close() {
+ return 1;
+ }
+
+ function ftp_delete($path) {
+ $upyun = new UpYun(
+ $this->upyun_config['bucket_name'],
+ $this->upyun_config['operator_name'],
+ $this->upyun_config['operator_pwd']
+ );
+ $path = discuz_ftp::clear($path);
+ try{
+ $rsp = $upyun->delete('/' . ltrim($path, '/'));
+ return $rsp;
+ }
+ catch(Exception $e){
+ return 0;
+ }
+ }
+
+ function ftp_get($local_file, $remote_file, $mode, $resumepos = 0) {
+ $upyun = new UpYun(
+ $this->upyun_config['bucket_name'],
+ $this->upyun_config['operator_name'],
+ $this->upyun_config['operator_pwd']
+ );
+ $remote_file = discuz_ftp::clear($remote_file);
+ $local_file = discuz_ftp::clear($local_file);
+ try{
+ if($fh = fopen($local_file,'wb')){
+ $rsp = $upyun->readFile('/'. ltrim($remote_file, '/'), $fh);
+ fclose($fh);
+ return $rsp;
+ }else{
+ return 0;
+ }
+ }
+ catch(Exception $e){
+ return 0;
+ }
+ }
+
+}
diff --git a/discuz_3_4/install/forum_attachment.php b/discuz_3_4/install/forum_attachment.php
new file mode 100644
index 0000000..232b576
--- /dev/null
+++ b/discuz_3_4/install/forum_attachment.php
@@ -0,0 +1,346 @@
+fetch($aid))) {
+ dheader('location: forum.php?mod=redirect&goto=findpost&pid='.$attach['pid'].'&ptid='.$attach['tid']);
+}
+
+if($_GET['uid'] != $_G['uid'] && $_GET['uid']) {
+ $_G['uid'] = $_GET['uid'] = intval($_GET['uid']);
+ $member = getuserbyuid($_GET['uid']);
+ loadcache('usergroup_'.$member['groupid']);
+ $_G['group'] = $_G['cache']['usergroup_'.$member['groupid']];
+ $_G['group']['grouptitle'] = $_G['cache']['usergroup_'.$_G['groupid']]['grouptitle'];
+ $_G['group']['color'] = $_G['cache']['usergroup_'.$_G['groupid']]['color'];
+}
+
+
+$tableid = 'aid:'.$aid;
+
+if($_G['setting']['attachexpire']) {
+
+ if(TIMESTAMP - $t > $_G['setting']['attachexpire'] * 3600) {
+ $aid = intval($aid);
+ if($attach = C::t('forum_attachment_n')->fetch($tableid, $aid)) {
+ if($attach['isimage']) {
+ dheader('location: '.$_G['siteurl'].'static/image/common/none.gif');
+ } else {
+ if(!$requestmode) {
+ showmessage('attachment_expired', '', array('aid' => aidencode($aid, 0, $attach['tid']), 'pid' => $attach['pid'], 'tid' => $attach['tid']));
+ } else {
+ exit;
+ }
+ }
+ } else {
+ if(!$requestmode) {
+ showmessage('attachment_nonexistence');
+ } else {
+ exit;
+ }
+ }
+ }
+}
+
+$readmod = getglobal('config/download/readmod');
+$readmod = $readmod > 0 && $readmod < 5 ? $readmod : 2;
+
+$refererhost = parse_url($_SERVER['HTTP_REFERER']);
+$serverhost = $_SERVER['HTTP_HOST'];
+if(($pos = strpos($serverhost, ':')) !== FALSE) {
+ $serverhost = substr($serverhost, 0, $pos);
+}
+
+if(!$requestmode && $_G['setting']['attachrefcheck'] && $_SERVER['HTTP_REFERER'] && !($refererhost['host'] == $serverhost)) {
+ showmessage('attachment_referer_invalid', NULL);
+}
+
+periodscheck('attachbanperiods');
+
+loadcache('threadtableids');
+$threadtableids = !empty($_G['cache']['threadtableids']) ? $_G['cache']['threadtableids'] : array();
+if(!in_array(0, $threadtableids)) {
+ $threadtableids = array_merge(array(0), $threadtableids);
+}
+$archiveid = in_array($_GET['archiveid'], $threadtableids) ? intval($_GET['archiveid']) : 0;
+
+
+$attachexists = FALSE;
+if(!empty($aid) && is_numeric($aid)) {
+ $attach = C::t('forum_attachment_n')->fetch($tableid, $aid);
+ $thread = C::t('forum_thread')->fetch_by_tid_displayorder($attach['tid'], 0, '>=', null, $archiveid);
+ if($_G['uid'] && $attach['uid'] != $_G['uid']) {
+ if($attach) {
+ $attachpost = C::t('forum_post')->fetch($thread['posttableid'], $attach['pid'], false);
+ $attach['invisible'] = $attachpost['invisible'];
+ unset($attachpost);
+ }
+ if($attach && $attach['invisible'] == 0) {
+ $thread && $attachexists = TRUE;
+ }
+ } else {
+ $attachexists = TRUE;
+ }
+}
+
+if(!$attachexists) {
+ if(!$requestmode) {
+ showmessage('attachment_nonexistence');
+ } else {
+ exit;
+ }
+}
+
+if(!$requestmode) {
+ $forum = C::t('forum_forumfield')->fetch_info_for_attach($thread['fid'], $_G['uid']);
+
+ $_GET['fid'] = $forum['fid'];
+
+ if($attach['isimage']) {
+ $allowgetattach = !empty($forum['allowgetimage']) || (($_G['group']['allowgetimage'] || $_G['uid'] == $attach['uid']) && !$forum['getattachperm']) || forumperm($forum['getattachperm']);
+ } else {
+ $allowgetattach = !empty($forum['allowgetattach']) || (($_G['group']['allowgetattach'] || $_G['uid'] == $attach['uid']) && !$forum['getattachperm']) || forumperm($forum['getattachperm']);
+ }
+ if($allowgetattach && ($attach['readperm'] && $attach['readperm'] > $_G['group']['readaccess']) && $_G['adminid'] <= 0 && !($_G['uid'] && $_G['uid'] == $attach['uid'])) {
+ showmessage('attachment_forum_nopermission', NULL, array(), array('login' => 1));
+ }
+
+ $ismoderator = in_array($_G['adminid'], array(1, 2)) ? 1 : ($_G['adminid'] == 3 ? C::t('forum_moderator')->fetch_uid_by_tid($attach['tid'], $_G['uid'], $archiveid) : 0);
+
+ $ispaid = FALSE;
+ $exemptvalue = $ismoderator ? 128 : 16;
+ if(!$thread['special'] && $thread['price'] > 0 && (!$_G['uid'] || ($_G['uid'] != $attach['uid'] && !($_G['group']['exempt'] & $exemptvalue)))) {
+ if(!$_G['uid'] || $_G['uid'] && !($ispaid = C::t('common_credit_log')->count_by_uid_operation_relatedid($_G['uid'], 'BTC', $attach['tid']))) {
+ showmessage('attachment_payto', 'forum.php?mod=viewthread&tid='.$attach['tid']);
+ }
+ }
+
+ $exemptvalue = $ismoderator ? 64 : 8;
+ if($attach['price'] && (!$_G['uid'] || ($_G['uid'] != $attach['uid'] && !($_G['group']['exempt'] & $exemptvalue)))) {
+ $payrequired = $_G['uid'] ? !C::t('common_credit_log')->count_by_uid_operation_relatedid($_G['uid'], 'BAC', $attach['aid']) : 1;
+ $payrequired && showmessage('attachement_payto_attach', 'forum.php?mod=misc&action=attachpay&aid='.$attach['aid'].'&tid='.$attach['tid']);
+ }
+}
+
+$isimage = $attach['isimage'];
+$_G['setting']['ftp']['hideurl'] = $_G['setting']['ftp']['hideurl'] || ($isimage && !empty($_GET['noupdate']) && $_G['setting']['attachimgpost'] && strtolower(substr($_G['setting']['ftp']['attachurl'], 0, 3)) == 'ftp');
+
+if(empty($_GET['nothumb']) && $attach['isimage'] && $attach['thumb']) {
+ $db = DB::object();
+ $db->close();
+ !$_G['config']['output']['gzip'] && ob_end_clean();
+ dheader('Content-Disposition: inline; filename='.getimgthumbname($attach['filename']));
+ dheader('Content-Type: image/pjpeg');
+ if($attach['remote']) {
+ $_G['setting']['ftp']['hideurl'] ? getremotefile(getimgthumbname($attach['attachment'])) : dheader('location:'.$_G['setting']['ftp']['attachurl'].'forum/'.getimgthumbname($attach['attachment']));
+ } else {
+ getlocalfile($_G['setting']['attachdir'].'/forum/'.getimgthumbname($attach['attachment']));
+ }
+ exit();
+}
+
+$filename = $_G['setting']['attachdir'].'/forum/'.$attach['attachment'];
+if(!$attach['remote'] && !is_readable($filename)) {
+ if(!$requestmode) {
+ showmessage('attachment_nonexistence');
+ } else {
+ exit;
+ }
+}
+
+
+if(!$requestmode) {
+ if(!$ispaid && !$forum['allowgetattach']) {
+ if(!$forum['getattachperm'] && !$allowgetattach) {
+ showmessage('getattachperm_none_nopermission', NULL, array(), array('login' => 1));
+ } elseif(($forum['getattachperm'] && !forumperm($forum['getattachperm'])) || ($forum['viewperm'] && !forumperm($forum['viewperm']))) {
+ showmessagenoperm('getattachperm', $forum['fid']);
+ }
+ }
+
+ $exemptvalue = $ismoderator ? 32 : 4;
+ if(!$isimage && !($_G['group']['exempt'] & $exemptvalue)) {
+ $creditlog = updatecreditbyaction('getattach', $_G['uid'], array(), '', 1, 0, $thread['fid']);
+ if($creditlog['updatecredit']) {
+ if($_G['uid']) {
+ $k = $_GET['ck'];
+ $t = $_GET['t'];
+ if(empty($k) || empty($t) || $k != substr(md5($aid.$t.md5($_G['config']['security']['authkey'])), 0, 8) || TIMESTAMP - $t > 3600) {
+ dheader('location: forum.php?mod=misc&action=attachcredit&aid='.$attach['aid'].'&formhash='.FORMHASH);
+ exit();
+ }
+ } else {
+ showmessage('attachment_forum_nopermission', NULL, array(), array('login' => 1));
+ }
+ }
+ }
+
+}
+
+$range = 0;
+if($readmod == 4 && !empty($_SERVER['HTTP_RANGE'])) {
+ list($range) = explode('-',(str_replace('bytes=', '', $_SERVER['HTTP_RANGE'])));
+}
+
+if(!$requestmode && !$range && empty($_GET['noupdate'])) {
+ if($_G['setting']['delayviewcount']) {
+ $_G['forum_logfile'] = './data/cache/forum_attachviews_'.intval(getglobal('config/server/id')).'.log';
+ if(substr(TIMESTAMP, -1) == '0') {
+ attachment_updateviews($_G['forum_logfile']);
+ }
+
+ if(@$fp = fopen(DISCUZ_ROOT.$_G['forum_logfile'], 'a')) {
+ fwrite($fp, "$aid\n");
+ fclose($fp);
+ } elseif($_G['adminid'] == 1) {
+ showmessage('view_log_invalid', '', array('logfile' => $_G['forum_logfile']));
+ }
+ } else {
+ C::t('forum_attachment')->update_download($aid);
+ }
+}
+
+$db = DB::object();
+$db->close();
+!$_G['config']['output']['gzip'] && ob_end_clean();
+
+
+//Begin Of Upyun Insert Code
+include_once DISCUZ_ROOT . 'source/plugin/upyun/function_upyun.php';
+upyun_attachment_download($attach, 'forum');
+//End Of Upyun Insert Code
+
+if($attach['remote'] && !$_G['setting']['ftp']['hideurl'] && $isimage) {
+ dheader('location:'.$_G['setting']['ftp']['attachurl'].'forum/'.$attach['attachment']);
+}
+
+$filesize = !$attach['remote'] ? filesize($filename) : $attach['filesize'];
+$attach['filename'] = '"'.(strtolower(CHARSET) == 'utf-8' && strexists($_SERVER['HTTP_USER_AGENT'], 'MSIE') ? urlencode($attach['filename']) : $attach['filename']).'"';
+
+dheader('Date: '.gmdate('D, d M Y H:i:s', $attach['dateline']).' GMT');
+dheader('Last-Modified: '.gmdate('D, d M Y H:i:s', $attach['dateline']).' GMT');
+dheader('Content-Encoding: none');
+
+if($isimage && !empty($_GET['noupdate']) || !empty($_GET['request'])) {
+ dheader('Content-Disposition: inline; filename='.$attach['filename']);
+} else {
+ dheader('Content-Disposition: attachment; filename='.$attach['filename']);
+}
+if($isimage) {
+ dheader('Content-Type: image');
+} else {
+ dheader('Content-Type: application/octet-stream');
+}
+
+dheader('Content-Length: '.$filesize);
+
+$xsendfile = getglobal('config/download/xsendfile');
+if(!empty($xsendfile)) {
+ $type = intval($xsendfile['type']);
+ if($isimage){
+ $type = 0;
+ }
+ $cmd = '';
+ switch ($type) {
+ case 1: $cmd = 'X-Accel-Redirect'; $url = $xsendfile['dir'].$attach['attachment']; break;
+ case 2: $cmd = $_SERVER['SERVER_SOFTWARE'] <'lighttpd/1.5' ? 'X-LIGHTTPD-send-file' : 'X-Sendfile'; $url = $filename; break;
+ case 3: $cmd = 'X-Sendfile'; $url = $filename; break;
+ }
+ if($cmd) {
+ dheader("$cmd: $url");
+ exit();
+ }
+}
+
+if($readmod == 4) {
+ dheader('Accept-Ranges: bytes');
+ if(!empty($_SERVER['HTTP_RANGE'])) {
+ $rangesize = ($filesize - $range) > 0 ? ($filesize - $range) : 0;
+ dheader('Content-Length: '.$rangesize);
+ dheader('HTTP/1.1 206 Partial Content');
+ dheader('Content-Range: bytes='.$range.'-'.($filesize-1).'/'.($filesize));
+ }
+}
+
+$attach['remote'] ? getremotefile($attach['attachment']) : getlocalfile($filename, $readmod, $range);
+
+function getremotefile($file) {
+ global $_G;
+ @set_time_limit(0);
+ if(!@readfile($_G['setting']['ftp']['attachurl'].'forum/'.$file)) {
+ $ftp = ftpcmd('object');
+ $tmpfile = @tempnam($_G['setting']['attachdir'], '');
+ if($ftp->ftp_get($tmpfile, 'forum/'.$file, FTP_BINARY)) {
+ @readfile($tmpfile);
+ @unlink($tmpfile);
+ } else {
+ @unlink($tmpfile);
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+function getlocalfile($filename, $readmod = 2, $range = 0) {
+ if($readmod == 1 || $readmod == 3 || $readmod == 4) {
+ if($fp = @fopen($filename, 'rb')) {
+ @fseek($fp, $range);
+ if(function_exists('fpassthru') && ($readmod == 3 || $readmod == 4)) {
+ @fpassthru($fp);
+ } else {
+ echo @fread($fp, filesize($filename));
+ }
+ }
+ @fclose($fp);
+ } else {
+ @readfile($filename);
+ }
+ @flush(); @ob_flush();
+}
+
+function attachment_updateviews($logfile) {
+ $viewlog = $viewarray = array();
+ $newlog = DISCUZ_ROOT.$logfile.random(6);
+ if(@rename(DISCUZ_ROOT.$logfile, $newlog)) {
+ $viewlog = file($newlog);
+ unlink($newlog);
+ if(is_array($viewlog) && !empty($viewlog)) {
+ $viewlog = array_count_values($viewlog);
+ foreach($viewlog as $id => $views) {
+ if($id > 0) {
+ $viewarray[$views][] = intval($id);
+ }
+ }
+ foreach($viewarray as $views => $ids) {
+ C::t('forum_attachment')->update_download($ids, $views);
+ }
+ }
+ }
+}
+
+?>
diff --git a/discuz_3_4/install/forum_image.php b/discuz_3_4/install/forum_image.php
new file mode 100755
index 0000000..feafd0f
--- /dev/null
+++ b/discuz_3_4/install/forum_image.php
@@ -0,0 +1,62 @@
+fetch('aid:'.$daid, $daid, array(1, -1))) {
+ if(!$dw && !$dh && $attach['tid'] != $id) {
+ dheader('location: '.$_G['siteurl'].'static/image/common/none.gif');
+ }
+ dheader('Expires: '.gmdate('D, d M Y H:i:s', TIMESTAMP + 3600).' GMT');
+ if($attach['remote']) {
+ $sign = upyun_gen_sign('/forum/'.$attach['attachment']);
+ $filename = $_G['setting']['ftp']['attachurl'].'forum/'.$attach['attachment'] . '?_upt=' . $sign;
+ } else {
+ $filename = $_G['setting']['attachdir'].'forum/'.$attach['attachment'];
+ }
+ require_once libfile('class/image');
+ $img = new image;
+ if($img->Thumb($filename, $thumbfile, $w, $h, $type)) {
+ if($nocache) {
+ dheader('Content-Type: image');
+ @readfile($_G['setting']['attachdir'].$thumbfile);
+ @unlink($_G['setting']['attachdir'].$thumbfile);
+ } else {
+ dheader('location: '.$attachurl.$thumbfile);
+ }
+ } else {
+ dheader('Content-Type: image');
+ @readfile($filename);
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/discuz_3_4/install/function_attachment.php b/discuz_3_4/install/function_attachment.php
new file mode 100755
index 0000000..251a757
--- /dev/null
+++ b/discuz_3_4/install/function_attachment.php
@@ -0,0 +1,246 @@
+ 'unknown.gif',
+ 2 => 'binary.gif',
+ 3 => 'zip.gif',
+ 4 => 'rar.gif',
+ 5 => 'msoffice.gif',
+ 6 => 'text.gif',
+ 7 => 'html.gif',
+ 8 => 'real.gif',
+ 9 => 'av.gif',
+ 10 => 'flash.gif',
+ 11 => 'image.gif',
+ 12 => 'pdf.gif',
+ 13 => 'torrent.gif'
+ );
+
+ if(is_numeric($type)) {
+ $typeid = $type;
+ } else {
+ if(preg_match("/bittorrent|^torrent\t/", $type)) {
+ $typeid = 13;
+ } elseif(preg_match("/pdf|^pdf\t/", $type)) {
+ $typeid = 12;
+ } elseif(preg_match("/image|^(jpg|gif|png|bmp)\t/", $type)) {
+ $typeid = 11;
+ } elseif(preg_match("/flash|^(swf|fla|flv|swi)\t/", $type)) {
+ $typeid = 10;
+ } elseif(preg_match("/audio|video|^(wav|mid|mp3|m3u|wma|asf|asx|vqf|mpg|mpeg|avi|wmv)\t/", $type)) {
+ $typeid = 9;
+ } elseif(preg_match("/real|^(ra|rm|rv)\t/", $type)) {
+ $typeid = 8;
+ } elseif(preg_match("/htm|^(php|js|pl|cgi|asp)\t/", $type)) {
+ $typeid = 7;
+ } elseif(preg_match("/text|^(txt|rtf|wri|chm)\t/", $type)) {
+ $typeid = 6;
+ } elseif(preg_match("/word|powerpoint|^(doc|ppt)\t/", $type)) {
+ $typeid = 5;
+ } elseif(preg_match("/^rar\t/", $type)) {
+ $typeid = 4;
+ } elseif(preg_match("/compressed|^(zip|arj|arc|cab|lzh|lha|tar|gz)\t/", $type)) {
+ $typeid = 3;
+ } elseif(preg_match("/octet-stream|^(exe|com|bat|dll)\t/", $type)) {
+ $typeid = 2;
+ } elseif($type) {
+ $typeid = 1;
+ } else {
+ $typeid = 0;
+ }
+ }
+ if($returnval == 'html') {
+ return '';
+ } elseif($returnval == 'id') {
+ return $typeid;
+ }
+}
+
+function parseattach($attachpids, $attachtags, &$postlist, $skipaids = array()) {
+ global $_G;
+ if(!$attachpids) {
+ return;
+ }
+ $attachpids = is_array($attachpids) ? $attachpids : array($attachpids);
+ $attachexists = FALSE;
+ $skipattachcode = $aids = $payaids = $findattach = array();
+ foreach(C::t('forum_attachment_n')->fetch_all_by_id('tid:'.$_G['tid'], 'pid', $attachpids) as $attach) {
+ $attachexists = TRUE;
+ if($skipaids && in_array($attach['aid'], $skipaids)) {
+ $skipattachcode[$attach[pid]][] = "/\[attach\]$attach[aid]\[\/attach\]/i";
+ continue;
+ }
+ $attached = 0;
+ $extension = strtolower(fileext($attach['filename']));
+ $attach['ext'] = $extension;
+ $attach['imgalt'] = $attach['isimage'] ? strip_tags(str_replace('"', '\"', $attach['description'] ? $attach['description'] : $attach['filename'])) : '';
+ $attach['attachicon'] = attachtype($extension."\t".$attach['filetype']);
+ $attach['attachsize'] = sizecount($attach['filesize']);
+ if($attach['isimage'] && !$_G['setting']['attachimgpost']) {
+ $attach['isimage'] = 0;
+ }
+ $attach['attachimg'] = $attach['isimage'] && (!$attach['readperm'] || $_G['group']['readaccess'] >= $attach['readperm']) ? 1 : 0;
+ if($attach['attachimg']) {
+ $GLOBALS['aimgs'][$attach['pid']][] = $attach['aid'];
+ }
+ if($attach['price']) {
+ if($_G['setting']['maxchargespan'] && TIMESTAMP - $attach['dateline'] >= $_G['setting']['maxchargespan'] * 3600) {
+ C::t('forum_attachment_n')->update('tid:'.$_G['tid'], $attach['aid'], array('price' => 0));
+ $attach['price'] = 0;
+ } elseif(!$_G['forum_attachmentdown'] && $_G['uid'] != $attach['uid']) {
+ $payaids[$attach['aid']] = $attach['pid'];
+ }
+ }
+ $attach['payed'] = $_G['forum_attachmentdown'] || $_G['uid'] == $attach['uid'] ? 1 : 0;
+ // comment by UPYUN
+ //$attach['url'] = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']).'forum/';
+ //Begin Of Upyun Insert Code
+ $upyun_url_prefix =rtrim($_G['cache']['plugin']['upyun']['url'], '/') . '/';
+ $attach['url'] = ($attach['remote'] ? $upyun_url_prefix : $_G['setting']['attachurl']).'forum/';
+ //End Of Upyun Insert Code
+
+ $attach['dbdateline'] = $attach['dateline'];
+ $attach['dateline'] = dgmdate($attach['dateline'], 'u');
+ $hideattachs = $_G['adminid'] != 1 && $_G['setting']['bannedmessages'] & 1 && (($postlist[$attach['pid']]['authorid'] && !$postlist[$attach['pid']]['username'])
+ || ($postlist[$attach['pid']]['groupid'] == 4 || $postlist[$attach['pid']]['groupid'] == 5) || $postlist[$attach['pid']]['status'] == -1 || $postlist[$attach['pid']]['memberstatus'])
+ || $_G['adminid'] != 1 && $postlist[$attach['pid']]['status'] & 1 || $postlist[$attach['pid']]['first'] && $_G['forum_threadpay'];
+ if(!$hideattachs) {
+ $postlist[$attach['pid']]['attachments'][$attach['aid']] = $attach;
+ }
+ if(!defined('IN_MOBILE_API') && !empty($attachtags[$attach['pid']]) && is_array($attachtags[$attach['pid']]) && in_array($attach['aid'], $attachtags[$attach['pid']])) {
+ $findattach[$attach['pid']][$attach['aid']] = "/\[attach\]$attach[aid]\[\/attach\]/i";
+ $attached = 1;
+ }
+
+ if(!$attached) {
+ if($attach['isimage']) {
+ if(!$hideattachs) {
+ $postlist[$attach['pid']]['imagelist'][] = $attach['aid'];
+ $postlist[$attach['pid']]['imagelistcount']++;
+ }
+ if($postlist[$attach['pid']]['first']) {
+ $GLOBALS['firstimgs'][] = $attach['aid'];
+ }
+ } else {
+ if(!$hideattachs && (!$_G['forum_skipaidlist'] || !in_array($attach['aid'], $_G['forum_skipaidlist']))) {
+ $postlist[$attach['pid']]['attachlist'][] = $attach['aid'];
+ }
+ }
+ }
+ $aids[] = $attach['aid'];
+ }
+ if($aids) {
+ $attachs = C::t('forum_attachment')->fetch_all($aids);
+ foreach($attachs as $aid => $attach) {
+ if($postlist[$attach['pid']]) {
+ $postlist[$attach['pid']]['attachments'][$attach['aid']]['downloads'] = $attach['downloads'];
+ }
+ }
+ }
+ if($payaids) {
+ foreach(C::t('common_credit_log')->fetch_all_by_uid_operation_relatedid($_G['uid'], 'BAC', array_keys($payaids)) as $creditlog) {
+ $postlist[$payaids[$creditlog['relatedid']]]['attachments'][$creditlog['relatedid']]['payed'] = 1;
+ }
+ }
+ if(!empty($skipattachcode)) {
+ foreach($skipattachcode as $pid => $findskipattach) {
+ foreach($findskipattach as $findskip) {
+ $postlist[$pid]['message'] = preg_replace($findskip, '', $postlist[$pid]['message']);
+ }
+ }
+ }
+
+ if($attachexists) {
+ foreach($attachtags as $pid => $aids) {
+ if($findattach[$pid]) {
+ foreach($findattach[$pid] as $aid => $find) {
+ $postlist[$pid]['message'] = preg_replace($find, attachinpost($postlist[$pid]['attachments'][$aid], $postlist[$pid]), $postlist[$pid]['message'], 1);
+ $postlist[$pid]['message'] = preg_replace($find, '', $postlist[$pid]['message']);
+ }
+ }
+ }
+ } else {
+ loadcache('posttableids');
+ $posttableids = $_G['cache']['posttableids'] ? $_G['cache']['posttableids'] : array('0');
+ foreach($posttableids as $id) {
+ C::t('forum_post')->update($id, $attachpids, array('attachment' => '0'), true);
+ }
+ }
+}
+
+function attachwidth($width) {
+ global $_G;
+ if($_G['setting']['imagemaxwidth'] && $width) {
+ return 'class="zoom" onclick="zoom(this, this.src, 0, 0, '.($_G['setting']['showexif'] ? 1 : 0).')" width="'.($width > $_G['setting']['imagemaxwidth'] ? $_G['setting']['imagemaxwidth'] : $width).'"';
+ } else {
+ return 'thumbImg="1"';
+ }
+}
+
+function packaids($attach) {
+ global $_G;
+ return aidencode($attach['aid'], 0, $_G['tid']);
+}
+
+function showattach($post, $type = 0) {
+ $type = !$type ? 'attachlist' : 'imagelist';
+ $return = '';
+ if(!empty($post[$type]) && is_array($post[$type])) {
+ foreach($post[$type] as $aid) {
+ if(!empty($post['attachments'][$aid])) {
+ $return .= $type($post['attachments'][$aid], $post['first']);
+ }
+ }
+ }
+ return $return;
+}
+
+function getattachexif($aid, $path = '') {
+ global $_G;
+ $return = $filename = '';
+ if(!$path) {
+ if($attach = C::t('forum_attachment_n')->fetch('aid:'.$aid, $aid, array(1, -1))) {
+ if($attach['remote']) {
+ $filename = $_G['setting']['ftp']['attachurl'].'forum/'.$attach['attachment'];
+ } else {
+ $filename = $_G['setting']['attachdir'].'forum/'.$attach['attachment'];
+ }
+ }
+ } else {
+ $filename = $path;
+ }
+ if($filename) {
+ require_once libfile('function/exif');
+ $exif = getexif($filename);
+ $keys = array(
+ exif_lang('Model'),
+ exif_lang('ShutterSpeedValue'),
+ exif_lang('ApertureValue'),
+ exif_lang('FocalLength'),
+ exif_lang('ExposureTime'),
+ exif_lang('DateTimeOriginal'),
+ exif_lang('ISOSpeedRatings'),
+ );
+ foreach($exif as $key => $value) {
+ if(in_array($key, $keys)) {
+ $return .= "$key : $value
";
+ }
+ }
+ }
+ return $return;
+}
+
+?>
diff --git a/discuz_3_4/install/function_home.php b/discuz_3_4/install/function_home.php
new file mode 100644
index 0000000..7127793
--- /dev/null
+++ b/discuz_3_4/install/function_home.php
@@ -0,0 +1,610 @@
+|\r|\n|\s|\[.+?\])/is", ' ', $string);
+ } elseif ($html == 0) {
+ $string = dhtmlspecialchars($string);
+ }
+
+ if($length) {
+ $string = cutstr($string, $length);
+ }
+
+ if($bbcode) {
+ require_once DISCUZ_ROOT.'./source/class/class_bbcode.php';
+ $bb = & bbcode::instance();
+ $string = $bb->bbcode2html($string, $bbcode);
+ }
+ if($out_slashes) {
+ $string = daddslashes($string);
+ }
+ return trim($string);
+}
+
+function obclean() {
+ ob_end_clean();
+ if (getglobal('config/output/gzip') && function_exists('ob_gzhandler')) {
+ ob_start('ob_gzhandler');
+ } else {
+ ob_start();
+ }
+}
+
+function dreaddir($dir, $extarr=array()) {
+ $dirs = array();
+ if($dh = opendir($dir)) {
+ while (($file = readdir($dh)) !== false) {
+ if(!empty($extarr) && is_array($extarr)) {
+ if(in_array(strtolower(fileext($file)), $extarr)) {
+ $dirs[] = $file;
+ }
+ } else if($file != '.' && $file != '..') {
+ $dirs[] = $file;
+ }
+ }
+ closedir($dh);
+ }
+ return $dirs;
+}
+
+function url_implode($gets) {
+ $arr = array();
+ foreach ($gets as $key => $value) {
+ if($value) {
+ $arr[] = $key.'='.urlencode($value);
+ }
+ }
+ return implode('&', $arr);
+}
+
+function ckstart($start, $perpage) {
+ global $_G;
+
+ $_G['setting']['maxpage'] = $_G['setting']['maxpage'] ? $_G['setting']['maxpage'] : 100;
+ $maxstart = $perpage*intval($_G['setting']['maxpage']);
+ if($start < 0 || ($maxstart > 0 && $start >= $maxstart)) {
+ showmessage('length_is_not_within_the_scope_of');
+ }
+}
+
+
+function get_my_app() {
+}
+
+function get_my_userapp() {
+}
+
+function getspace($uid) {
+ return getuserbyuid($uid);
+}
+
+function ckprivacy($key, $privace_type) {
+ global $_G, $space;
+
+ $var = "home_ckprivacy_{$key}_{$privace_type}";
+ if(isset($_G[$var])) {
+ return $_G[$var];
+ }
+ space_merge($space, 'field_home');
+ $result = false;
+ if($_G['adminid'] == 1) {
+ $result = true;
+ } else {
+ if($privace_type == 'feed') {
+ if(!empty($space['privacy'][$privace_type][$key])) {
+ $result = true;
+ }
+ } elseif($space['self']){
+ $result = true;
+ } else {
+ if(empty($space['privacy'][$privace_type][$key])) {
+ $result = true;
+ } elseif ($space['privacy'][$privace_type][$key] == 1) {
+ include_once libfile('function/friend');
+ if(friend_check($space['uid'])) {
+ $result = true;
+ }
+ } elseif ($space['privacy'][$privace_type][$key] == 3) {
+ $result = in_array($_G['groupid'], array(4, 5, 6, 7)) ? false : true;
+ }
+ }
+ }
+ $_G[$var] = $result;
+ return $result;
+}
+
+function app_ckprivacy($privacy) {
+ global $_G, $space;
+
+ $var = "home_app_ckprivacy_{$privacy}";
+ if(isset($_G[$var])) {
+ return $_G[$var];
+ }
+ $result = false;
+ switch ($privacy) {
+ case 0:
+ $result = true;
+ break;
+ case 1:
+ include_once libfile('function/friend');
+ if(friend_check($space['uid'])) {
+ $result = true;
+ }
+ break;
+ case 2:
+ break;
+ case 3:
+ if($space['self']) {
+ $result = true;
+ }
+ break;
+ case 4:
+ break;
+ case 5:
+ break;
+ default:
+ $result = true;
+ break;
+ }
+ $_G[$var] = $result;
+ return $result;
+}
+
+function formatsize($size) {
+ $prec=3;
+ $size = round(abs($size));
+ $units = array(0=>" B ", 1=>" KB", 2=>" MB", 3=>" GB", 4=>" TB");
+ if ($size==0) return str_repeat(" ", $prec)."0$units[0]";
+ $unit = min(4, floor(log($size)/log(2)/10));
+ $size = $size * pow(2, -10*$unit);
+ $digi = $prec - 1 - floor(log($size)/log(10));
+ $size = round($size * pow(10, $digi)) * pow(10, -$digi);
+ return $size.$units[$unit];
+}
+
+function ckfriend($touid, $friend, $target_ids='') {
+ global $_G;
+
+ if(empty($_G['uid'])) return $friend?false:true;
+ if($touid == $_G['uid'] || $_G['adminid'] == 1) return true;
+
+ $var = 'home_ckfriend_'.md5($touid.'_'.$friend.'_'.$target_ids);
+ if(isset($_G[$var])) return $_G[$var];
+
+ $_G[$var] = false;
+ switch ($friend) {
+ case 0:
+ $_G[$var] = true;
+ break;
+ case 1:
+ include_once libfile('function/friend');
+ if(friend_check($touid)) {
+ $_G[$var] = true;
+ }
+ break;
+ case 2:
+ if($target_ids) {
+ $target_ids = explode(',', $target_ids);
+ if(in_array($_G['uid'], $target_ids)) $_G[$var] = true;
+ }
+ break;
+ case 3:
+ break;
+ case 4:
+ $_G[$var] = true;
+ break;
+ default:
+ break;
+ }
+ return $_G[$var];
+}
+function ckfollow($followuid) {
+ global $_G;
+
+ if(empty($_G['uid'])) return false;
+
+ $var = 'home_follow_'.$_G['uid'].'_'.$followuid;
+ if(isset($_G[$var])) return $_G[$var];
+
+ $_G[$var] = false;
+ $follow = C::t('home_follow')->fetch_status_by_uid_followuid($_G['uid'], $followuid);
+ if(isset($follow[$_G['uid']])) {
+ $_G[$var] = true;
+ }
+ return $_G[$var];
+}
+
+function sub_url($url, $length) {
+ if(strlen($url) > $length) {
+ $url = str_replace(array('%3A', '%2F'), array(':', '/'), rawurlencode($url));
+ $url = substr($url, 0, intval($length * 0.5)).' ... '.substr($url, - intval($length * 0.3));
+ }
+ return $url;
+}
+
+function space_domain($space) {
+ global $_G;
+
+ if($_G['setting']['allowspacedomain'] && $_G['setting']['domain']['root']['home']) {
+ space_merge($space, 'field_home');
+ if($space['domain']) {
+ $space['domainurl'] = 'http://'.$space['domain'].'.'.$_G['setting']['domain']['root']['home'];
+ }
+ }
+ if(!empty($_G['setting']['domain']['app']['home'])) {
+ $space['domainurl'] = 'http://'.$_G['setting']['domain']['app']['home'].'/?'.$space['uid'];
+ } elseif(empty($space['domainurl'])) {
+ $space['domainurl'] = $_G['siteurl'].'?'.$space['uid'];
+ }
+ return $space['domainurl'];
+}
+
+function g_name($groupid) {
+ global $_G;
+ echo $_G['cache']['usergroups'][$groupid]['grouptitle'];
+}
+
+function g_color($groupid) {
+ global $_G;
+ if(empty($_G['cache']['usergroups'][$groupid]['color'])) {
+ echo '';
+ } else {
+ echo ' style="color:'.$_G['cache']['usergroups'][$groupid]['color'].';"';
+ }
+}
+
+function mob_perpage($perpage) {
+ global $_G;
+
+ $newperpage = isset($_GET['perpage'])?intval($_GET['perpage']):0;
+ if($_G['mobile'] && $newperpage>0 && $newperpage<500) {
+ $perpage = $newperpage;
+ }
+ return $perpage;
+}
+
+function ckicon_uid($feed) {
+ global $_G, $space;
+
+ space_merge($space, 'field_home');
+ $filter_icon = empty($space['privacy']['filter_icon'])?array():array_keys($space['privacy']['filter_icon']);
+ if($filter_icon && (in_array($feed['icon'].'|0', $filter_icon) || in_array($feed['icon'].'|'.$feed['uid'], $filter_icon))) {
+ return false;
+ }
+ return true;
+}
+
+function sarray_rand($arr, $num=1) {
+ $r_values = array();
+ if($arr && count($arr) > $num) {
+ if($num > 1) {
+ $r_keys = array_rand($arr, $num);
+ foreach ($r_keys as $key) {
+ $r_values[$key] = $arr[$key];
+ }
+ } else {
+ $r_key = array_rand($arr, 1);
+ $r_values[$r_key] = $arr[$r_key];
+ }
+ } else {
+ $r_values = $arr;
+ }
+ return $r_values;
+}
+
+function my_showgift() {
+ global $_G, $space;
+ if($_G['setting']['my_showgift'] && $_G['my_userapp'][$_G['home_gift_appid']]) {
+ echo '';
+ }
+}
+
+function getsiteurl() {
+ global $_G;
+ return $_G['siteurl'];
+}
+
+function pic_get($filepath, $type, $thumb, $remote, $return_thumb=1, $hastype = '') {
+ global $_G;
+
+ $url = $filepath;
+ if($return_thumb && $thumb) $url = getimgthumbname($url);
+ if($remote > 1 && $type == 'album') {
+ $remote -= 2;
+ $type = 'forum';
+ }
+ $type = $hastype ? '' : $type.'/';
+ //comment by UPYUN
+ //return ($remote?$_G['setting']['ftp']['attachurl']:$_G['setting']['attachurl']).$type.$url;
+ //Begin Insert of UPYUN code
+ if(! $remote) {
+ return $_G['setting']['attachurl'] . $type . $url;
+ }
+ $upyun_url_prefix = rtrim($_G['cache']['plugin']['upyun']['url'], '/') . '/';
+ return $upyun_url_prefix . $type . $url;
+ //End Insert of UPYUN code
+}
+
+function pic_cover_get($pic, $picflag) {
+ global $_G;
+
+ $type = 'album';
+ if($picflag > 2) {
+ $picflag = $picflag - 2;
+ $type = 'forum';
+ }
+ if($picflag == 1) {
+ $url = $_G['setting']['attachurl'].$type.'/'.$pic;
+ } elseif ($picflag == 2) {
+ //comment by UPYUN
+ //$url = $_G['setting']['ftp']['attachurl'].$type.'/'.$pic;
+ //Begin Insert of UPYUN code
+ $upyun_url_prefix =rtrim($_G['cache']['plugin']['upyun']['url'], '/') . '/';
+ $url = $upyun_url_prefix . $type.'/'.$pic;
+ //End Insert of UPYUN code
+ } else {
+ $url = $pic;
+ }
+ return $url;
+}
+
+function pic_delete($pic, $type, $thumb, $remote) {
+ global $_G;
+
+ if($remote > 1 && $type == 'album') {
+ $remote -= 2;
+ $type = 'forum';
+ return true;
+ }
+
+ if($remote) {
+ ftpcmd('delete', $type.'/'.$pic);
+ if($thumb) {
+ ftpcmd('delete', $type.'/'.getimgthumbname($pic));
+ }
+ ftpcmd('close');
+ } else {
+ @unlink($_G['setting']['attachdir'].'/'.$type.'/'.$pic);
+ if($thumb) {
+ @unlink($_G['setting']['attachdir'].'/'.$type.'/'.getimgthumbname($pic));
+ }
+ }
+ return true;
+}
+
+function pic_upload($FILES, $type='album', $thumb_width=0, $thumb_height=0, $thumb_type=2) {
+ $upload = new discuz_upload();
+
+ $result = array('pic'=>'', 'thumb'=>0, 'remote'=>0);
+
+ $upload->init($FILES, $type);
+ if($upload->error()) {
+ return array();
+ }
+
+ $upload->save();
+ if($upload->error()) {
+ return array();
+ }
+
+ $result['pic'] = $upload->attach['attachment'];
+
+ if($thumb_width && $thumb_height) {
+ require_once libfile('class/image');
+ $image = new image();
+ if($image->Thumb($upload->attach['target'], '', $thumb_width, $thumb_height, $thumb_type)) {
+ $result['thumb'] = 1;
+ }
+ }
+
+ if(getglobal('setting/ftp/on')) {
+ if(ftpcmd('upload', $type.'/'.$upload->attach['attachment'])) {
+ if($result['thumb']) {
+ ftpcmd('upload', $type.'/'.getimgthumbname($upload->attach['attachment']));
+ }
+ ftpcmd('close');
+ $result['remote'] = 1;
+ } else {
+ if(getglobal('setting/ftp/mirror')) {
+ @unlink($upload->attach['target']);
+ @unlink(getimgthumbname($upload->attach['target']));
+ return array();
+ }
+ }
+ }
+
+ return $result;
+}
+
+function member_count_update($uid, $counts) {
+ global $_G;
+
+ $setsqls = array();
+ foreach ($counts as $key => $value) {
+ if($key == 'credit') {
+ if($_G['setting']['creditstransextra'][6]) {
+ $key = 'extcredits'.intval($_G['setting']['creditstransextra'][6]);
+ } elseif ($_G['setting']['creditstrans']) {
+ $key = 'extcredits'.intval($_G['setting']['creditstrans']);
+ } else {
+ continue;
+ }
+ }
+ $setsqls[$key] = $value;
+ }
+ if($setsqls) {
+ updatemembercount($uid, $setsqls);
+ }
+}
+
+
+function getdefaultdoing() {
+ global $_G;
+
+ $result = array();
+ $key = 0;
+
+ if(($result = C::t('common_setting')->fetch('defaultdoing'))) {
+ $_G['setting']['defaultdoing'] = explode("\r\n", $result);
+ $key = rand(0, count($_G['setting']['defaultdoing'])-1);
+ } else {
+ $_G['setting']['defaultdoing'] = array(lang('space', 'doing_you_can'));
+ }
+ return $_G['setting']['defaultdoing'][$key];
+}
+
+function getuserdiydata($space) {
+ global $_G;
+ if(empty($_G['blockposition'])) {
+ $userdiy = getuserdefaultdiy();
+ if (!empty($space['blockposition'])) {
+ $blockdata = dunserialize($space['blockposition']);
+ foreach ((array)$blockdata as $key => $value) {
+ if ($key == 'parameters') {
+ foreach ((array)$value as $k=>$v) {
+ if (!empty($v)) $userdiy[$key][$k] = $v;
+ }
+ } else {
+ if (!empty($value)) $userdiy[$key] = $value;
+ }
+ }
+ }
+ $_G['blockposition'] = $userdiy;
+ }
+ return $_G['blockposition'];
+}
+
+
+function getuserdefaultdiy() {
+ $defaultdiy = array(
+ 'currentlayout' => '1:2:1',
+ 'block' => array(
+ 'frame`frame1' => array(
+ 'attr' => array('name'=>'frame1'),
+ 'column`frame1_left' => array(
+ 'block`profile' => array('attr' => array('name'=>'profile')),
+ 'block`statistic' => array('attr' => array('name'=>'statistic')),
+ 'block`album' => array('attr' => array('name'=>'album')),
+ 'block`doing' => array('attr' => array('name'=>'doing'))
+ ),
+ 'column`frame1_center' => array(
+ 'block`personalinfo' => array('attr' => array('name'=>'personalinfo')),
+ 'block`feed' => array('attr' => array('name'=>'feed')),
+ 'block`share' => array('attr' => array('name'=>'share')),
+ 'block`blog' => array('attr' => array('name'=>'blog')),
+ 'block`thread' => array('attr' => array('name'=>'thread')),
+ 'block`wall' => array('attr' => array('name'=>'wall'))
+ ),
+ 'column`frame1_right' => array(
+ 'block`myapp' => array('attr' => array('name'=>'myapp')),
+ 'block`friend' => array('attr' => array('name'=>'friend')),
+ 'block`visitor' => array('attr' => array('name'=>'visitor')),
+ 'block`group' => array('attr' => array('name'=>'group'))
+ )
+ )
+ ),
+ 'parameters' => array(
+ 'blog' => array('showmessage' => 150, 'shownum' => 6),
+ 'doing' => array('shownum' => 15),
+ 'album' => array('shownum' => 8),
+ 'thread' => array('shownum' => 10),
+ 'share' => array('shownum' => 10),
+ 'friend' => array('shownum' => 18),
+ 'group' => array('shownum' => 12),
+ 'visitor' => array('shownum' => 18),
+ 'wall' => array('shownum' => 16),
+ 'feed' => array('shownum' => 16),
+ 'myapp' => array('shownum' => 9, 'logotype'=> 'logo'),
+ ),
+ 'nv' => array(
+ 'nvhidden' => 0,
+ 'items' => array(),
+ 'banitems' => array(),
+ ),
+ );
+ return $defaultdiy;
+}
+
+function getonlinemember($uids) {
+ global $_G;
+ if ($uids && is_array($uids) && empty($_G['ols'])) {
+ $_G['ols'] = array();
+ foreach(C::app()->session->fetch_all_by_uid($uids) as $value) {
+ if(!$value['invisible']) {
+ $_G['ols'][$value['uid']] = $value['lastactivity'];
+ }
+ }
+ }
+}
+function getfollowfeed($uid, $viewtype, $archiver = false, $start = 0, $perpage = 0) {
+ global $_G;
+
+ $list = array();
+ if(isset($_G['follwusers'][$uid])) {
+ $list['user'] = $_G['follwusers'][$uid];
+ } else {
+ if($viewtype == 'follow') {
+ $list['user'] = C::t('home_follow')->fetch_all_following_by_uid($uid);
+ $list['user'][$uid] = array('uid' => $uid);
+ } elseif($viewtype == 'special') {
+ $list['user'] = C::t('home_follow')->fetch_all_following_by_uid($uid, 1);
+ }
+ if(!empty($list['user'])) {
+ $_G['follwusers'][$uid] = $list['user'];
+ }
+ }
+ $uids = in_array($viewtype, array('other', 'self')) ? $uid : array_keys($list['user']);
+ if(!empty($uids) || in_array($viewtype, array('other', 'self'))) {
+ $list['feed'] = C::t('home_follow_feed')->fetch_all_by_uid($uids, $archiver, $start, $perpage);
+ if($list['feed']) {
+ $list['content'] = C::t('forum_threadpreview')->fetch_all(C::t('home_follow_feed')->get_tids());
+ if(!$_G['group']['allowgetattach'] || !$_G['group']['allowgetimage']) {
+ foreach($list['content'] as $key => $feed) {
+ if(!$_G['group']['allowgetimage']) {
+ $list['content'][$key]['content'] = preg_replace("/[ \t]*\
\[ \t]*\<\/li\>/is", '', $feed['content']);
+ }
+ if(!$_G['group']['allowgetattach']) {
+ $list['content'][$key]['content'] = preg_replace("/[ \t]*\\.*?\<\/a\>[ \t]*\<\/li\>/is", '', $feed['content']);
+ }
+ }
+ }
+ $list['threads'] = C::t('forum_thread')->fetch_all_by_tid(C::t('home_follow_feed')->get_tids());
+ }
+ }
+ return $list;
+}
+
+function getthread() {
+ $threads = array();
+ foreach(C::t('home_follow_feed')->get_ids() as $idtype => $ids) {
+ if($idtype == 'thread') {
+ $threads = C::t('forum_thread')->fetch_all_by_tid($ids);
+ }
+ }
+ return $threads;
+}
+
+?>
diff --git a/discuz_3_4/install/function_post.php b/discuz_3_4/install/function_post.php
new file mode 100644
index 0000000..74620b8
--- /dev/null
+++ b/discuz_3_4/install/function_post.php
@@ -0,0 +1,681 @@
+ 0 ? "AND af.dateline>'$posttime'" : '';
+ if(!empty($_G['fid']) && $_G['forum']['attachextensions']) {
+ $allowext = str_replace(' ', '', strtolower($_G['forum']['attachextensions']));
+ $allowext = explode(',', $allowext);
+ } else {
+ $allowext = '';
+ }
+ foreach(C::t('forum_attachment')->fetch_all_unused_attachment($_G['uid'], empty($aidsnew) ? null : $aidsnew, $posttime > 0 ? $posttime : null) as $attach) {
+ $attach['filenametitle'] = $attach['filename'];
+ $attach['ext'] = fileext($attach['filename']);
+ if($allowext && !in_array($attach['ext'], $allowext)) {
+ continue;
+ }
+ getattach_row($attach, $attachs, $imgattachs);
+ }
+ if($pid > 0) {
+ $attachmentns = C::t('forum_attachment_n')->fetch_all_by_id('tid:'.$_G['tid'], 'pid', $pid);
+ foreach(C::t('forum_attachment')->fetch_all_by_id('pid', $pid, 'aid') as $attach) {
+ $attach = array_merge($attach, $attachmentns[$attach['aid']]);
+ $attach['filenametitle'] = $attach['filename'];
+ $attach['ext'] = fileext($attach['filename']);
+ if($allowext && !in_array($attach['ext'], $allowext)) {
+ continue;
+ }
+ getattach_row($attach, $attachs, $imgattachs);
+ }
+ }
+ return array('attachs' => $attachs, 'imgattachs' => $imgattachs);
+}
+
+function getattach_row($attach, &$attachs, &$imgattachs) {
+ global $_G;
+ $attach['filename'] = cutstr($attach['filename'], $_G['setting']['allowattachurl'] ? 25 : 30);
+ $attach['attachsize'] = sizecount($attach['filesize']);
+ $attach['dateline'] = dgmdate($attach['dateline']);
+ $attach['filetype'] = attachtype($attach['ext']."\t".$attach['filetype']);
+ if($attach['isimage'] < 1) {
+ if($attach['isimage']) {
+ $attach['url'] = $attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl'];
+ $attach['width'] = $attach['width'] > 300 ? 300 : $attach['width'];
+ }
+ if($attach['pid']) {
+ $attachs['used'][] = $attach;
+ } else {
+ $attachs['unused'][] = $attach;
+ }
+ } else {
+ $attach['url'] = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']).'/forum';
+ $attach['width'] = $attach['width'] > 300 ? 300 : $attach['width'];
+ if($attach['pid']) {
+ $imgattachs['used'][] = $attach;
+ } else {
+ $imgattachs['unused'][] = $attach;
+ }
+ }
+}
+
+function parseattachmedia($attach) {
+ $attachurl = 'attach://'.$attach['aid'].'.'.$attach['ext'];
+ switch(strtolower($attach['ext'])) {
+ case 'mp3':
+ case 'wma':
+ case 'ra':
+ case 'ram':
+ case 'wav':
+ case 'mid':
+ return '[audio]'.$attachurl.'[/audio]';
+ case 'wmv':
+ case 'rm':
+ case 'rmvb':
+ case 'avi':
+ case 'asf':
+ case 'mpg':
+ case 'mpeg':
+ case 'mov':
+ case 'flv':
+ case 'swf':
+ return '[media='.$attach['ext'].',400,300]'.$attachurl.'[/media]';
+ default:
+ return;
+ }
+}
+
+function ftpupload($aids, $uid = 0) {
+ global $_G;
+ $uid = $uid ? $uid : $_G['uid'];
+
+ if(!$aids || !$_G['setting']['ftp']['on']) {
+ return;
+ }
+ $attachtables = $pics = array();
+ foreach(C::t('forum_attachment')->fetch_all($aids) as $attach) {
+ if($uid != $attach['uid'] && !$_G['forum']['ismoderator']) {
+ continue;
+ }
+ $attachtables[$attach['tableid']][] = $attach['aid'];
+ }
+ foreach($attachtables as $attachtable => $aids) {
+ $remoteaids = array();
+ foreach(C::t('forum_attachment_n')->fetch_all($attachtable, $aids, 0) as $attach) {
+ $attach['ext'] = fileext($attach['filename']);
+ if(((!$_G['setting']['ftp']['allowedexts'] && !$_G['setting']['ftp']['disallowedexts']) || ($_G['setting']['ftp']['allowedexts'] && in_array($attach['ext'], $_G['setting']['ftp']['allowedexts'])) || ($_G['setting']['ftp']['disallowedexts'] && !in_array($attach['ext'], $_G['setting']['ftp']['disallowedexts']) && (!$_G['setting']['ftp']['allowedexts'] || $_G['setting']['ftp']['allowedexts'] && in_array($attach['ext'], $_G['setting']['ftp']['allowedexts'])) )) && (!$_G['setting']['ftp']['minsize'] || $attach['filesize'] >= $_G['setting']['ftp']['minsize'] * 1024)) {
+ if(ftpcmd('upload', 'forum/'.$attach['attachment']) && (!$attach['thumb'] || ftpcmd('upload', 'forum/'.getimgthumbname($attach['attachment'])))) {
+ if(!$_G['cache']['plugin']['upyun']['local_backup']) {
+ dunlink($attach);
+ }
+ $remoteaids[$attach['aid']] = $attach['aid'];
+ if($attach['picid']) {
+ $pics[] = $attach['picid'];
+ }
+ }
+ }
+ }
+
+ if($remoteaids) {
+ C::t('forum_attachment_n')->update($attachtable, $remoteaids, array('remote' => 1));
+ }
+ }
+ if($pics) {
+ C::t('home_pic')->update($pics, array('remote' => 3));
+ }
+}
+
+function updateattach($modnewthreads, $tid, $pid, $attachnew, $attachupdate = array(), $uid = 0) {
+ global $_G;
+ $thread = C::t('forum_thread')->fetch($tid);
+ $uid = $uid ? $uid : $_G['uid'];
+ if($attachnew) {
+ $newaids = array_keys($attachnew);
+ $newattach = $newattachfile = $albumattach = array();
+ foreach(C::t('forum_attachment_unused')->fetch_all($newaids) as $attach) {
+ if($attach['uid'] != $uid && !$_G['forum']['ismoderator']) {
+ continue;
+ }
+ $attach['uid'] = $uid;
+ $newattach[$attach['aid']] = daddslashes($attach);
+ if($attach['isimage']) {
+ $newattachfile[$attach['aid']] = $attach['attachment'];
+ }
+ }
+ if($_G['setting']['watermarkstatus'] && empty($_G['forum']['disablewatermark']) || !$_G['setting']['thumbdisabledmobile']) {
+ require_once libfile('class/image');
+ $image = new image;
+ }
+ if(!empty($_GET['albumaid'])) {
+ array_unshift($_GET['albumaid'], '');
+ $_GET['albumaid'] = array_unique($_GET['albumaid']);
+ unset($_GET['albumaid'][0]);
+ foreach($_GET['albumaid'] as $aid) {
+ if(isset($newattach[$aid])) {
+ $albumattach[$aid] = $newattach[$aid];
+ }
+ }
+ }
+ foreach($attachnew as $aid => $attach) {
+ $update = array();
+ $update['readperm'] = $_G['group']['allowsetattachperm'] ? $attach['readperm'] : 0;
+ $update['price'] = $_G['group']['maxprice'] ? (intval($attach['price']) <= $_G['group']['maxprice'] ? intval($attach['price']) : $_G['group']['maxprice']) : 0;
+ $update['tid'] = $tid;
+ $update['pid'] = $pid;
+ $update['uid'] = $uid;
+ $update['description'] = censor(cutstr(dhtmlspecialchars($attach['description']), 100));
+ C::t('forum_attachment_n')->update('tid:'.$tid, $aid, $update);
+ if(!$newattach[$aid]) {
+ continue;
+ }
+ $update = array_merge($update, $newattach[$aid]);
+ if(!empty($newattachfile[$aid])) {
+ if($_G['setting']['thumbstatus'] && $_G['forum']['disablethumb']) {
+ $update['thumb'] = 0;
+ @unlink($_G['setting']['attachdir'].'/forum/'.getimgthumbname($newattachfile[$aid]));
+ if(!empty($albumattach[$aid])) {
+ $albumattach[$aid]['thumb'] = 0;
+ }
+ } elseif(!$_G['setting']['thumbdisabledmobile']) {
+ $_daid = sprintf("%09d", $aid);
+ $dir1 = substr($_daid, 0, 3);
+ $dir2 = substr($_daid, 3, 2);
+ $dir3 = substr($_daid, 5, 2);
+ $dw = 320;
+ $dh = 320;
+ $thumbfile = 'image/'.$dir1.'/'.$dir2.'/'.$dir3.'/'.substr($_daid, -2).'_'.$dw.'_'.$dh.'.jpg';
+ $image->Thumb($_G['setting']['attachdir'].'/forum/'.$newattachfile[$aid], $thumbfile, $dw, $dh, 'fixwr');
+ $dw = 720;
+ $dh = 720;
+ $thumbfile = 'image/'.$dir1.'/'.$dir2.'/'.$dir3.'/'.substr($_daid, -2).'_'.$dw.'_'.$dh.'.jpg';
+ $image->Thumb($_G['setting']['attachdir'].'/forum/'.$newattachfile[$aid], $thumbfile, $dw, $dh, 'fixwr');
+ }
+ if($_G['setting']['watermarkstatus'] && empty($_G['forum']['disablewatermark'])) {
+ $image->Watermark($_G['setting']['attachdir'].'/forum/'.$newattachfile[$aid], '', 'forum');
+ $update['filesize'] = $image->imginfo['size'];
+ }
+ }
+ if(!empty($_GET['albumaid']) && isset($albumattach[$aid])) {
+ $newalbum = 0;
+ if(!$_GET['uploadalbum']) {
+ require_once libfile('function/spacecp');
+ $_GET['uploadalbum'] = album_creat(array('albumname' => $_GET['newalbum']));
+ $newalbum = 1;
+ }
+ $picdata = array(
+ 'albumid' => $_GET['uploadalbum'],
+ 'uid' => $uid,
+ 'username' => $_G['username'],
+ 'dateline' => $albumattach[$aid]['dateline'],
+ 'postip' => $_G['clientip'],
+ 'filename' => censor($albumattach[$aid]['filename']),
+ 'title' => censor(cutstr(dhtmlspecialchars($attach['description']), 100)),
+ 'type' => fileext($albumattach[$aid]['attachment']),
+ 'size' => $albumattach[$aid]['filesize'],
+ 'filepath' => $albumattach[$aid]['attachment'],
+ 'thumb' => $albumattach[$aid]['thumb'],
+ 'remote' => $albumattach[$aid]['remote'] + 2,
+ );
+
+ $update['picid'] = C::t('home_pic')->insert($picdata, 1);
+
+ if($newalbum) {
+ require_once libfile('function/home');
+ require_once libfile('function/spacecp');
+ album_update_pic($_GET['uploadalbum']);
+ }
+ }
+ C::t('forum_attachment_n')->insert('tid:'.$tid, $update, false, true);
+ C::t('forum_attachment')->update($aid, array('tid' => $tid, 'pid' => $pid, 'tableid' => getattachtableid($tid)));
+ C::t('forum_attachment_unused')->delete($aid);
+ }
+
+ if(!empty($_GET['albumaid'])) {
+ $albumdata = array(
+ 'picnum' => C::t('home_pic')->check_albumpic($_GET['uploadalbum']),
+ 'updatetime' => $_G['timestamp'],
+ );
+ C::t('home_album')->update($_GET['uploadalbum'], $albumdata);
+ require_once libfile('function/home');
+ require_once libfile('function/spacecp');
+ album_update_pic($_GET['uploadalbum']);
+ }
+ if($newattach) {
+ ftpupload($newaids, $uid);
+ }
+ }
+
+ if(!$modnewthreads && $newattach && $uid == $_G['uid']) {
+ updatecreditbyaction('postattach', $uid, array(), '', count($newattach), 1, $_G['fid']);
+ }
+
+ if($attachupdate) {
+ $attachs = C::t('forum_attachment_n')->fetch_all_by_id('tid:'.$tid, 'aid', array_keys($attachupdate));
+ foreach($attachs as $attach) {
+ if(array_key_exists($attach['aid'], $attachupdate) && $attachupdate[$attach['aid']]) {
+ dunlink($attach);
+ }
+ }
+ $unusedattachs = C::t('forum_attachment_unused')->fetch_all($attachupdate);
+ $attachupdate = array_flip($attachupdate);
+ $unusedaids = array();
+ foreach($unusedattachs as $attach) {
+ if($attach['uid'] != $uid && !$_G['forum']['ismoderator']) {
+ continue;
+ }
+ $unusedaids[] = $attach['aid'];
+ $update = $attach;
+ $update['dateline'] = TIMESTAMP;
+ $update['remote'] = 0;
+ unset($update['aid']);
+ if($attach['isimage'] && $_G['setting']['watermarkstatus'] && empty($_G['forum']['disablewatermark'])) {
+ $image->Watermark($_G['setting']['attachdir'].'/forum/'.$attach['attachment'], '', 'forum');
+ $update['filesize'] = $image->imginfo['size'];
+ }
+ C::t('forum_attachment_n')->update('tid:'.$tid, $attachupdate[$attach['aid']], $update);
+ @unlink($_G['setting']['attachdir'].'image/'.$attach['aid'].'_100_100.jpg');
+ C::t('forum_attachment_exif')->delete($attachupdate[$attach['aid']]);
+ C::t('forum_attachment_exif')->update($attach['aid'], array('aid' => $attachupdate[$attach['aid']]));
+ ftpupload(array($attachupdate[$attach['aid']]), $uid);
+ }
+ if($unusedaids) {
+ C::t('forum_attachment_unused')->delete($unusedaids);
+ }
+ }
+
+ $attachcount = C::t('forum_attachment_n')->count_by_id('tid:'.$tid, $pid ? 'pid' : 'tid', $pid ? $pid : $tid);
+ $attachment = 0;
+ if($attachcount) {
+ if(C::t('forum_attachment_n')->count_image_by_id('tid:'.$tid, $pid ? 'pid' : 'tid', $pid ? $pid : $tid)) {
+ $attachment = 2;
+ } else {
+ $attachment = 1;
+ }
+ } else {
+ $attachment = 0;
+ }
+ C::t('forum_thread')->update($tid, array('attachment'=>$attachment));
+ C::t('forum_post')->update('tid:'.$tid, $pid, array('attachment' => $attachment), true);
+
+ if(!$attachment) {
+ C::t('forum_threadimage')->delete_by_tid($tid);
+ }
+ $_G['forum_attachexist'] = $attachment;
+}
+
+function checkflood() {
+ global $_G;
+ if(!$_G['group']['disablepostctrl'] && $_G['uid']) {
+ if($_G['setting']['floodctrl'] && discuz_process::islocked("post_lock_".$_G['uid'], $_G['setting']['floodctrl'])) {
+ return true;
+ }
+ return false;
+
+
+ }
+ return FALSE;
+}
+
+function checkmaxperhour($type) {
+ global $_G;
+ $morenumperhour = false;
+ if(!$_G['group']['disablepostctrl'] && $_G['uid']) {
+ if($_G['group']['max'.($type == 'pid' ? 'posts' : 'threads').'perhour']) {
+ $usernum = C::t('common_member_action_log')->count_per_hour($_G['uid'], $type);
+ $var = $type === 'tid' ? 'maxthreadsperhour' : 'maxpostsperhour';
+ $isflood = $usernum && ($usernum >= $_G['group'][$var]);
+ if($isflood) {
+ $morenumperhour = true;
+ }
+ }
+ }
+ return $morenumperhour;
+}
+
+function checkpost($subject, $message, $special = 0) {
+ global $_G;
+ if(dstrlen($subject) > 80) {
+ return 'post_subject_toolong';
+ }
+ if(!$_G['group']['disablepostctrl'] && !$special) {
+ if($_G['setting']['maxpostsize'] && strlen($message) > $_G['setting']['maxpostsize']) {
+ return 'post_message_toolong';
+ } elseif($_G['setting']['minpostsize']) {
+ $minpostsize = !IN_MOBILE || !$_G['setting']['minpostsize_mobile'] ? $_G['setting']['minpostsize'] : $_G['setting']['minpostsize_mobile'];
+ if(strlen(preg_replace("/\[quote\].+?\[\/quote\]/is", '', $message)) < $minpostsize || strlen(preg_replace("/\[postbg\].+?\[\/postbg\]/is", '', $message)) < $minpostsize) {
+ return 'post_message_tooshort';
+ }
+ }
+ }
+ return FALSE;
+}
+
+function checkbbcodes($message, $bbcodeoff) {
+ return !$bbcodeoff && (!strpos($message, '[/') && !strpos($message, '[hr]')) ? -1 : $bbcodeoff;
+}
+
+function checksmilies($message, $smileyoff) {
+ global $_G;
+
+ if($smileyoff) {
+ return 1;
+ } else {
+ if(!empty($_G['cache']['smileycodes']) && is_array($_G['cache']['smileycodes'])) {
+ foreach($_G['cache']['smileycodes'] as $id => $code) {
+ if(strpos($message, $code) !== FALSE) {
+ return 0;
+ }
+ }
+ }
+ return -1;
+ }
+}
+
+function updatepostcredits($operator, $uidarray, $action, $fid = 0) {
+ global $_G;
+ $val = $operator == '+' ? 1 : -1;
+ $extsql = array();
+ if(empty($uidarray)) {
+ return false;
+ }
+ $uidarray = (array)$uidarray;
+ $uidarr = array();
+ foreach($uidarray as $uid) {
+ $uidarr[$uid] = !isset($uidarr[$uid]) ? 1 : $uidarr[$uid]+1;
+ }
+ foreach($uidarr as $uid => $coef) {
+ $opnum = $val*$coef;
+ if($action == 'reply') {
+ $extsql = array('posts' => $opnum);
+ } elseif($action == 'post') {
+ $extsql = array('threads' => $opnum, 'posts' => $opnum);
+ }
+ if($uid == $_G['uid']) {
+ updatecreditbyaction($action, $uid, $extsql, '', $opnum, 1, $fid);
+ } elseif(empty($uid)) {
+ continue;
+ } else {
+ batchupdatecredit($action, $uid, $extsql, $opnum, $fid);
+ }
+ }
+ if($operator == '+' && ($action == 'reply' || $action == 'post')) {
+ C::t('common_member_status')->update(array_keys($uidarr), array('lastpost' => TIMESTAMP), 'UNBUFFERED');
+ }
+}
+
+function updateattachcredits($operator, $uidarray) {
+ global $_G;
+ foreach($uidarray as $uid => $attachs) {
+ updatecreditbyaction('postattach', $uid, array(), '', $operator == '-' ? -$attachs : $attachs, 1, $_G['fid']);
+ }
+}
+
+function updateforumcount($fid) {
+
+ extract(C::t('forum_thread')->count_posts_by_fid($fid));
+
+ $thread = C::t('forum_thread')->fetch_by_fid_displayorder($fid, 0, '=');
+
+ $thread['subject'] = addslashes($thread['subject']);
+ $thread['lastposter'] = $thread['author'] ? addslashes($thread['lastposter']) : lang('forum/misc', 'anonymous');
+ $tid = $thread['closed'] > 1 ? $thread['closed'] : $thread['tid'];
+ $setarr = array('posts' => $posts, 'threads' => $threads, 'lastpost' => "$tid\t$thread[subject]\t$thread[lastpost]\t$thread[lastposter]");
+ C::t('forum_forum')->update($fid, $setarr);
+}
+
+function updatethreadcount($tid, $updateattach = 0) {
+ $replycount = C::t('forum_post')->count_visiblepost_by_tid($tid) - 1;
+ $lastpost = C::t('forum_post')->fetch_visiblepost_by_tid('tid:'.$tid, $tid, 0, 1);
+
+ $lastpost['author'] = $lastpost['anonymous'] ? lang('forum/misc', 'anonymous') : addslashes($lastpost['author']);
+ $lastpost['dateline'] = !empty($lastpost['dateline']) ? $lastpost['dateline'] : TIMESTAMP;
+
+ $data = array('replies'=>$replycount, 'lastposter'=>$lastpost['author'], 'lastpost'=>$lastpost['dateline']);
+ if($updateattach) {
+ $attach = C::t('forum_post')->fetch_attachment_by_tid($tid);
+ $data['attachment'] = $attach ? 1 : 0;
+ }
+ C::t('forum_thread')->update($tid, $data);
+}
+
+function updatemodlog($tids, $action, $expiration = 0, $iscron = 0, $reason = '', $stamp = 0) {
+ global $_G;
+
+ $uid = empty($iscron) ? $_G['uid'] : 0;
+ $username = empty($iscron) ? $_G['member']['username'] : 0;
+ $expiration = empty($expiration) ? 0 : intval($expiration);
+
+ $data = $comma = '';
+ $stampadd = $stampaddvalue = '';
+ if($stamp) {
+ $stampadd = ', stamp';
+ $stampaddvalue = ", '$stamp'";
+ }
+ foreach(explode(',', str_replace(array('\'', ' '), array('', ''), $tids)) as $tid) {
+ if($tid) {
+
+ $data = array(
+ 'tid' => $tid,
+ 'uid' => $uid,
+ 'username' => $username,
+ 'dateline' => $_G['timestamp'],
+ 'action' => $action,
+ 'expiration' => $expiration,
+ 'status' => 1,
+ 'reason' => $reason
+ );
+ if($stamp) {
+ $data['stamp'] = $stamp;
+ }
+ C::t('forum_threadmod')->insert($data);
+ }
+ }
+
+
+}
+
+function isopera() {
+ $useragent = strtolower($_SERVER['HTTP_USER_AGENT']);
+ if(strpos($useragent, 'opera') !== false) {
+ preg_match('/opera(\/| )([0-9\.]+)/', $useragent, $regs);
+ return $regs[2];
+ }
+ return FALSE;
+}
+
+function deletethreadcaches($tids) {
+ global $_G;
+ if(!$_G['setting']['cachethreadon']) {
+ return FALSE;
+ }
+ require_once libfile('function/forumlist');
+ if(!empty($tids)) {
+ foreach(explode(',', $tids) as $tid) {
+ $fileinfo = getcacheinfo($tid);
+ @unlink($fileinfo['filename']);
+ }
+ }
+ return TRUE;
+}
+
+
+function disuploadedfile($file) {
+ return function_exists('is_uploaded_file') && (is_uploaded_file($file) || is_uploaded_file(str_replace('\\\\', '\\', $file)));
+}
+
+function postfeed($feed) {
+ global $_G;
+ if($feed) {
+ require_once libfile('function/feed');
+ feed_add($feed['icon'], $feed['title_template'], $feed['title_data'], $feed['body_template'], $feed['body_data'], '', $feed['images'], $feed['image_links'], '', '', '', 0, $feed['id'], $feed['idtype']);
+ }
+}
+
+function messagesafeclear($message) {
+ if(strpos($message, '[/password]') !== FALSE) {
+ $message = '';
+ }
+ if(strpos($message, '[/postbg]') !== FALSE) {
+ $message = preg_replace("/\s?\[postbg\]\s*([^\[\<\r\n;'\"\?\(\)]+?)\s*\[\/postbg\]\s?/is", '', $message);
+ }
+ if(strpos($message, '[/begin]') !== FALSE) {
+ $message = preg_replace("/\[begin(=\s*([^\[\<\r\n]*?)\s*,(\d*),(\d*),(\d*),(\d*))?\]\s*([^\[\<\r\n]+?)\s*\[\/begin\]/is", '', $message);
+ }
+ if(strpos($message, '[page]') !== FALSE) {
+ $message = preg_replace("/\s?\[page\]\s?/is", '', $message);
+ }
+ if(strpos($message, '[/index]') !== FALSE) {
+ $message = preg_replace("/\s?\[index\](.+?)\[\/index\]\s?/is", '', $message);
+ }
+ if(strpos($message, '[/begin]') !== FALSE) {
+ $message = preg_replace("/\[begin(=\s*([^\[\<\r\n]*?)\s*,(\d*),(\d*),(\d*),(\d*))?\]\s*([^\[\<\r\n]+?)\s*\[\/begin\]/is", '', $message);
+ }
+ if(strpos($message, '[/groupid]') !== FALSE) {
+ $message = preg_replace("/\[groupid=\d+\].*\[\/groupid\]/i", '', $message);
+ }
+ $language = lang('forum/misc');
+ $message = preg_replace(array($language['post_edithtml_regexp'],$language['post_editnobbcode_regexp'],$language['post_edit_regexp']), '', $message);
+ return $message;
+}
+
+function messagecutstr($str, $length = 0, $dot = ' ...') {
+ global $_G;
+ $str = messagesafeclear($str);
+ $sppos = strpos($str, chr(0).chr(0).chr(0));
+ if($sppos !== false) {
+ $str = substr($str, 0, $sppos);
+ }
+ $language = lang('forum/misc');
+ loadcache(array('bbcodes_display', 'bbcodes', 'smileycodes', 'smilies', 'smileytypes', 'domainwhitelist'));
+ $bbcodes = 'b|i|u|p|color|size|font|align|list|indent|float';
+ $bbcodesclear = 'email|code|free|table|tr|td|img|swf|flash|attach|media|audio|groupid|payto'.($_G['cache']['bbcodes_display'][$_G['groupid']] ? '|'.implode('|', array_keys($_G['cache']['bbcodes_display'][$_G['groupid']])) : '');
+ $str = strip_tags(preg_replace(array(
+ "/\[hide=?\d*\](.*?)\[\/hide\]/is",
+ "/\[quote](.*?)\[\/quote]/si",
+ $language['post_edit_regexp'],
+ "/\[url=?.*?\](.+?)\[\/url\]/si",
+ "/\[($bbcodesclear)=?.*?\].+?\[\/\\1\]/si",
+ "/\[($bbcodes)=?.*?\]/i",
+ "/\[\/($bbcodes)\]/i",
+ "/\\\\u/i"
+ ), array(
+ "[b]$language[post_hidden][/b]",
+ '',
+ '',
+ '\\1',
+ '',
+ '',
+ '',
+ '%u'
+ ), $str));
+ if($length) {
+ $str = cutstr($str, $length, $dot);
+ }
+ $str = preg_replace($_G['cache']['smilies']['searcharray'], '', $str);
+ if($_G['setting']['plugins']['func'][HOOKTYPE]['discuzcode']) {
+ $_G['discuzcodemessage'] = & $str;
+ $param = func_get_args();
+ hookscript('discuzcode', 'global', 'funcs', array('param' => $param, 'caller' => 'messagecutstr'), 'discuzcode');
+ }
+ return trim($str);
+}
+
+
+function setthreadcover($pid, $tid = 0, $aid = 0, $countimg = 0, $imgurl = '') {
+ global $_G;
+ $cover = 0;
+ if(empty($_G['uid']) || !intval($_G['setting']['forumpicstyle']['thumbheight']) || !intval($_G['setting']['forumpicstyle']['thumbwidth'])) {
+ return false;
+ }
+
+ if(($pid || $aid) && empty($countimg)) {
+ if(empty($imgurl)) {
+ if($aid) {
+ $attachtable = 'aid:'.$aid;
+ $attach = C::t('forum_attachment_n')->fetch('aid:'.$aid, $aid, array(1, -1));
+ } else {
+ $attachtable = 'pid:'.$pid;
+ $attach = C::t('forum_attachment_n')->fetch_max_image('pid:'.$pid, 'pid', $pid);
+ }
+ if(!$attach) {
+ return false;
+ }
+ if(empty($_G['forum']['ismoderator']) && $_G['uid'] != $attach['uid']) {
+ return false;
+ }
+ $pid = empty($pid) ? $attach['pid'] : $pid;
+ $tid = empty($tid) ? $attach['tid'] : $tid;
+ $sign = upyun_gen_sign('/forum/'.$attach['attachment']);
+ $picsource = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl'])
+ .'forum/'.$attach['attachment'] . '?_upt=' . $sign;
+ } else {
+ $attachtable = 'pid:'.$pid;
+ $picsource = $imgurl;
+ }
+
+ $basedir = !$_G['setting']['attachdir'] ? (DISCUZ_ROOT.'./data/attachment/') : $_G['setting']['attachdir'];
+ $coverdir = 'threadcover/'.substr(md5($tid), 0, 2).'/'.substr(md5($tid), 2, 2).'/';
+ dmkdir($basedir.'./forum/'.$coverdir);
+
+ require_once libfile('class/image');
+ $image = new image();
+ if($image->Thumb($picsource, 'forum/'.$coverdir.$tid.'.jpg', $_G['setting']['forumpicstyle']['thumbwidth'], $_G['setting']['forumpicstyle']['thumbheight'], 2)) {
+ $remote = '';
+ if(getglobal('setting/ftp/on')) {
+ if(ftpcmd('upload', 'forum/'.$coverdir.$tid.'.jpg')) {
+ $remote = '-';
+ }
+ }
+ $cover = C::t('forum_attachment_n')->count_image_by_id($attachtable, 'pid', $pid);
+ if($imgurl && empty($cover)) {
+ $cover = 1;
+ }
+ $cover = $remote.$cover;
+ } else {
+ return false;
+ }
+ }
+ if($countimg) {
+ if(empty($cover)) {
+ $thread = C::t('forum_thread')->fetch($tid);
+ $oldcover = $thread['cover'];
+
+ $cover = C::t('forum_attachment_n')->count_image_by_id('tid:'.$tid, 'pid', $pid);
+ if($cover) {
+ $cover = $oldcover < 0 ? '-'.$cover : $cover;
+ }
+ }
+ }
+ if($cover) {
+ C::t('forum_thread')->update($tid, array('cover' => $cover));
+ return true;
+ }
+}
+
+?>
diff --git a/discuz_3_4/install/portal_attachment.php b/discuz_3_4/install/portal_attachment.php
new file mode 100755
index 0000000..43f2a54
--- /dev/null
+++ b/discuz_3_4/install/portal_attachment.php
@@ -0,0 +1,126 @@
+fetch($id);
+if(empty($attach)) {
+ showmessage('portal_attachment_noexist');
+}
+
+if($operation == 'delete') {
+ if(!$_G['group']['allowmanagearticle'] && $_G['uid'] != $attach['uid']) {
+ showmessage('portal_attachment_nopermission_delete');
+ }
+ if($aid) {
+ C::t('portal_article_title')->update($aid, array('pic' => ''));
+ }
+ C::t('portal_attachment')->delete($id);
+ pic_delete($attach['attachment'], 'portal', $attach['thumb'], $attach['remote']);
+ showmessage('portal_image_noexist');
+
+} elseif($operation == 'getattach') {
+
+ require_once libfile('function/attachment');
+ if($attach['isimage']) {
+ require_once libfile('function/home');
+ $smallimg = pic_get($attach['attachment'], 'portal', $attach['thumb'], $attach['remote']);
+ $bigimg = pic_get($attach['attachment'], 'portal', 0, $attach['remote']);
+ $coverstr = addslashes(serialize(array('pic'=>'portal/'.$attach['attachment'], 'thumb'=>$attach['thumb'], 'remote'=>$attach['remote'])));
+ }
+ $attach['filetype'] = attachtype($attach['filetype']."\t".$attach['filetype']);
+ $attach['filesize'] = sizecount($attach['filesize']);
+ include template('portal/portal_attachment');
+
+ exit;
+
+} else {
+ $filename = $_G['setting']['attachdir'].'/portal/'.$attach['attachment'];
+ if(!$attach['remote'] && !is_readable($filename)) {
+ showmessage('attachment_nonexistence');
+ }
+
+ $readmod = 2;//read local file's function: 1=fread 2=readfile 3=fpassthru 4=fpassthru+multiple
+ $range = 0;
+ if($readmod == 4 && !empty($_SERVER['HTTP_RANGE'])) {
+ list($range) = explode('-',(str_replace('bytes=', '', $_SERVER['HTTP_RANGE'])));
+ }
+
+//Begin Of Upyun Insert Code
+ include_once DISCUZ_ROOT . 'source/plugin/upyun/function_upyun.php';
+ upyun_attachment_download($attach, 'portal');
+//End Of Upyun Insert Code
+
+ $filesize = $attach['filesize'];
+ $attach['filename'] = '"'.(strtolower(CHARSET) == 'utf-8' && strexists($_SERVER['HTTP_USER_AGENT'], 'MSIE') ? urlencode($attach['filename']) : $attach['filename']).'"';
+
+ dheader('Date: '.gmdate('D, d M Y H:i:s', $attach['dateline']).' GMT');
+ dheader('Last-Modified: '.gmdate('D, d M Y H:i:s', $attach['dateline']).' GMT');
+ dheader('Content-Encoding: none');
+ dheader('Content-Disposition: attachment; filename='.$attach['filename']);
+ dheader('Content-Type: '.$attach['filetype']);
+ dheader('Content-Length: '.$filesize);
+
+ if($readmod == 4) {
+ dheader('Accept-Ranges: bytes');
+ if(!empty($_SERVER['HTTP_RANGE'])) {
+ $rangesize = ($filesize - $range) > 0 ? ($filesize - $range) : 0;
+ dheader('Content-Length: '.$rangesize);
+ dheader('HTTP/1.1 206 Partial Content');
+ dheader('Content-Range: bytes='.$range.'-'.($filesize-1).'/'.($filesize));
+ }
+ }
+
+ $attach['remote'] ? getremotefile($attach['attachment']) : getlocalfile($filename, $readmod, $range);
+}
+function getremotefile($file) {
+ global $_G;
+ @set_time_limit(0);
+ if(!@readfile($_G['setting']['ftp']['attachurl'].'portal/'.$file)) {
+
+ $ftp = new discuz_ftp();
+ if(!($_G['setting']['ftp']['connid'] = $ftp->connect())) {
+ return FALSE;
+ }
+ $tmpfile = @tempnam($_G['setting']['attachdir'], '');
+ if($ftp->ftp_get($_G['setting']['ftp']['connid'], $tmpfile, $file, FTP_BINARY)) {
+ @readfile($tmpfile);
+ @unlink($tmpfile);
+ } else {
+ @unlink($tmpfile);
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+function getlocalfile($filename, $readmod = 2, $range = 0) {
+ if($readmod == 1 || $readmod == 3 || $readmod == 4) {
+ if($fp = @fopen($filename, 'rb')) {
+ @fseek($fp, $range);
+ if(function_exists('fpassthru') && ($readmod == 3 || $readmod == 4)) {
+ @fpassthru($fp);
+ } else {
+ echo @fread($fp, filesize($filename));
+ }
+ }
+ @fclose($fp);
+ } else {
+ @readfile($filename);
+ }
+ @flush();
+ @ob_flush();
+}
+
+?>
\ No newline at end of file
diff --git a/discuz_3_4/uninstall/discuz_ftp.php b/discuz_3_4/uninstall/discuz_ftp.php
new file mode 100755
index 0000000..8be6265
--- /dev/null
+++ b/discuz_3_4/uninstall/discuz_ftp.php
@@ -0,0 +1,258 @@
+set_error(0);
+ $this->config = !$config ? getglobal('setting/ftp') : $config;
+ $this->enabled = false;
+ if(empty($this->config['on']) || empty($this->config['host'])) {
+ $this->set_error(FTP_ERR_CONFIG_OFF);
+ } else {
+ $this->func = $this->config['ssl'] && function_exists('ftp_ssl_connect') ? 'ftp_ssl_connect' : 'ftp_connect';
+ if($this->func == 'ftp_connect' && !function_exists('ftp_connect')) {
+ $this->set_error(FTP_ERR_SERVER_DISABLED);
+ } else {
+ $this->config['host'] = discuz_ftp::clear($this->config['host']);
+ $this->config['port'] = intval($this->config['port']);
+ $this->config['ssl'] = intval($this->config['ssl']);
+ $this->config['username'] = discuz_ftp::clear($this->config['username']);
+ $this->config['password'] = authcode($this->config['password'], 'DECODE', md5(getglobal('config/security/authkey')));
+ $this->config['timeout'] = intval($this->config['timeout']);
+ $this->enabled = true;
+ }
+ }
+ }
+
+ function upload($source, $target) {
+ if($this->error()) {
+ return 0;
+ }
+ $old_dir = $this->ftp_pwd();
+ $dirname = dirname($target);
+ $filename = basename($target);
+ if(!$this->ftp_chdir($dirname)) {
+ if($this->ftp_mkdir($dirname)) {
+ $this->ftp_chmod($dirname);
+ if(!$this->ftp_chdir($dirname)) {
+ $this->set_error(FTP_ERR_CHDIR);
+ }
+ $this->ftp_put('index.htm', getglobal('setting/attachdir').'/index.htm', FTP_BINARY);
+ } else {
+ $this->set_error(FTP_ERR_MKDIR);
+ }
+ }
+
+ $res = 0;
+ if(!$this->error()) {
+ if($fp = @fopen($source, 'rb')) {
+ $res = $this->ftp_fput($filename, $fp, FTP_BINARY);
+ @fclose($fp);
+ !$res && $this->set_error(FTP_ERR_TARGET_WRITE);
+ } else {
+ $this->set_error(FTP_ERR_SOURCE_READ);
+ }
+ }
+
+ $this->ftp_chdir($old_dir);
+
+ return $res ? 1 : 0;
+ }
+
+ function connect() {
+ if(!$this->enabled || empty($this->config)) {
+ return 0;
+ } else {
+ return $this->ftp_connect(
+ $this->config['host'],
+ $this->config['username'],
+ $this->config['password'],
+ $this->config['attachdir'],
+ $this->config['port'],
+ $this->config['timeout'],
+ $this->config['ssl'],
+ $this->config['pasv']
+ );
+ }
+
+ }
+
+ function ftp_connect($ftphost, $username, $password, $ftppath, $ftpport = 21, $timeout = 30, $ftpssl = 0, $ftppasv = 0) {
+ $res = 0;
+ $fun = $this->func;
+ if($this->connectid = $fun($ftphost, $ftpport, 20)) {
+
+ $timeout && $this->set_option(FTP_TIMEOUT_SEC, $timeout);
+ if($this->ftp_login($username, $password)) {
+ $this->ftp_pasv($ftppasv);
+ if($this->ftp_chdir($ftppath)) {
+ $res = $this->connectid;
+ } else {
+ $this->set_error(FTP_ERR_CHDIR);
+ }
+ } else {
+ $this->set_error(FTP_ERR_USER_NO_LOGGIN);
+ }
+
+ } else {
+ $this->set_error(FTP_ERR_CONNECT_TO_SERVER);
+ }
+
+ if($res > 0) {
+ $this->set_error();
+ $this->enabled = 1;
+ } else {
+ $this->enabled = 0;
+ $this->ftp_close();
+ }
+
+ return $res;
+
+ }
+
+ function set_error($code = 0) {
+ $this->_error = $code;
+ }
+
+ function error() {
+ return $this->_error;
+ }
+
+ function clear($str) {
+ return str_replace(array( "\n", "\r", '..'), '', $str);
+ }
+
+
+ function set_option($cmd, $value) {
+ if(function_exists('ftp_set_option')) {
+ return @ftp_set_option($this->connectid, $cmd, $value);
+ }
+ }
+
+ function ftp_mkdir($directory) {
+ $directory = discuz_ftp::clear($directory);
+ $epath = explode('/', $directory);
+ $dir = '';$comma = '';
+ foreach($epath as $path) {
+ $dir .= $comma.$path;
+ $comma = '/';
+ $return = @ftp_mkdir($this->connectid, $dir);
+ $this->ftp_chmod($dir);
+ }
+ return $return;
+ }
+
+ function ftp_rmdir($directory) {
+ $directory = discuz_ftp::clear($directory);
+ return @ftp_rmdir($this->connectid, $directory);
+ }
+
+ function ftp_put($remote_file, $local_file, $mode = FTP_BINARY) {
+ $remote_file = discuz_ftp::clear($remote_file);
+ $local_file = discuz_ftp::clear($local_file);
+ $mode = intval($mode);
+ return @ftp_put($this->connectid, $remote_file, $local_file, $mode);
+ }
+
+ function ftp_fput($remote_file, $sourcefp, $mode = FTP_BINARY) {
+ $remote_file = discuz_ftp::clear($remote_file);
+ $mode = intval($mode);
+ return @ftp_fput($this->connectid, $remote_file, $sourcefp, $mode);
+ }
+
+ function ftp_size($remote_file) {
+ $remote_file = discuz_ftp::clear($remote_file);
+ return @ftp_size($this->connectid, $remote_file);
+ }
+
+ function ftp_close() {
+ return @ftp_close($this->connectid);
+ }
+
+ function ftp_delete($path) {
+ $path = discuz_ftp::clear($path);
+ return @ftp_delete($this->connectid, $path);
+ }
+
+ function ftp_get($local_file, $remote_file, $mode, $resumepos = 0) {
+ $remote_file = discuz_ftp::clear($remote_file);
+ $local_file = discuz_ftp::clear($local_file);
+ $mode = intval($mode);
+ $resumepos = intval($resumepos);
+ return @ftp_get($this->connectid, $local_file, $remote_file, $mode, $resumepos);
+ }
+
+ function ftp_login($username, $password) {
+ $username = $this->clear($username);
+ $password = str_replace(array("\n", "\r"), array('', ''), $password);
+ return @ftp_login($this->connectid, $username, $password);
+ }
+
+ function ftp_pasv($pasv) {
+ return @ftp_pasv($this->connectid, $pasv ? true : false);
+ }
+
+ function ftp_chdir($directory) {
+ $directory = discuz_ftp::clear($directory);
+ return @ftp_chdir($this->connectid, $directory);
+ }
+
+ function ftp_site($cmd) {
+ $cmd = discuz_ftp::clear($cmd);
+ return @ftp_site($this->connectid, $cmd);
+ }
+
+ function ftp_chmod($filename, $mod = 0777) {
+ $filename = discuz_ftp::clear($filename);
+ if(function_exists('ftp_chmod')) {
+ return @ftp_chmod($this->connectid, $mod, $filename);
+ } else {
+ return @ftp_site($this->connectid, 'CHMOD '.$mod.' '.$filename);
+ }
+ }
+
+ function ftp_pwd() {
+ return @ftp_pwd($this->connectid);
+ }
+
+}
\ No newline at end of file
diff --git a/discuz_3_4/uninstall/forum_attachment.php b/discuz_3_4/uninstall/forum_attachment.php
new file mode 100755
index 0000000..5101704
--- /dev/null
+++ b/discuz_3_4/uninstall/forum_attachment.php
@@ -0,0 +1,341 @@
+fetch($aid))) {
+ dheader('location: forum.php?mod=redirect&goto=findpost&pid='.$attach['pid'].'&ptid='.$attach['tid']);
+}
+
+if($_GET['uid'] != $_G['uid'] && $_GET['uid']) {
+ $_G['uid'] = $_GET['uid'] = intval($_GET['uid']);
+ $member = getuserbyuid($_GET['uid']);
+ loadcache('usergroup_'.$member['groupid']);
+ $_G['group'] = $_G['cache']['usergroup_'.$member['groupid']];
+ $_G['group']['grouptitle'] = $_G['cache']['usergroup_'.$_G['groupid']]['grouptitle'];
+ $_G['group']['color'] = $_G['cache']['usergroup_'.$_G['groupid']]['color'];
+}
+
+
+$tableid = 'aid:'.$aid;
+
+if($_G['setting']['attachexpire']) {
+
+ if(TIMESTAMP - $t > $_G['setting']['attachexpire'] * 3600) {
+ $aid = intval($aid);
+ if($attach = C::t('forum_attachment_n')->fetch($tableid, $aid)) {
+ if($attach['isimage']) {
+ dheader('location: '.$_G['siteurl'].'static/image/common/none.gif');
+ } else {
+ if(!$requestmode) {
+ showmessage('attachment_expired', '', array('aid' => aidencode($aid, 0, $attach['tid']), 'pid' => $attach['pid'], 'tid' => $attach['tid']));
+ } else {
+ exit;
+ }
+ }
+ } else {
+ if(!$requestmode) {
+ showmessage('attachment_nonexistence');
+ } else {
+ exit;
+ }
+ }
+ }
+}
+
+$readmod = getglobal('config/download/readmod');
+$readmod = $readmod > 0 && $readmod < 5 ? $readmod : 2;
+
+$refererhost = parse_url($_SERVER['HTTP_REFERER']);
+$serverhost = $_SERVER['HTTP_HOST'];
+if(($pos = strpos($serverhost, ':')) !== FALSE) {
+ $serverhost = substr($serverhost, 0, $pos);
+}
+
+if(!$requestmode && $_G['setting']['attachrefcheck'] && $_SERVER['HTTP_REFERER'] && !($refererhost['host'] == $serverhost)) {
+ showmessage('attachment_referer_invalid', NULL);
+}
+
+periodscheck('attachbanperiods');
+
+loadcache('threadtableids');
+$threadtableids = !empty($_G['cache']['threadtableids']) ? $_G['cache']['threadtableids'] : array();
+if(!in_array(0, $threadtableids)) {
+ $threadtableids = array_merge(array(0), $threadtableids);
+}
+$archiveid = in_array($_GET['archiveid'], $threadtableids) ? intval($_GET['archiveid']) : 0;
+
+
+$attachexists = FALSE;
+if(!empty($aid) && is_numeric($aid)) {
+ $attach = C::t('forum_attachment_n')->fetch($tableid, $aid);
+ $thread = C::t('forum_thread')->fetch_by_tid_displayorder($attach['tid'], 0, '>=', null, $archiveid);
+ if($_G['uid'] && $attach['uid'] != $_G['uid']) {
+ if($attach) {
+ $attachpost = C::t('forum_post')->fetch($thread['posttableid'], $attach['pid'], false);
+ $attach['invisible'] = $attachpost['invisible'];
+ unset($attachpost);
+ }
+ if($attach && $attach['invisible'] == 0) {
+ $thread && $attachexists = TRUE;
+ }
+ } else {
+ $attachexists = TRUE;
+ }
+}
+
+if(!$attachexists) {
+ if(!$requestmode) {
+ showmessage('attachment_nonexistence');
+ } else {
+ exit;
+ }
+}
+
+if(!$requestmode) {
+ $forum = C::t('forum_forumfield')->fetch_info_for_attach($thread['fid'], $_G['uid']);
+
+ $_GET['fid'] = $forum['fid'];
+
+ if($attach['isimage']) {
+ $allowgetattach = !empty($forum['allowgetimage']) || (($_G['group']['allowgetimage'] || $_G['uid'] == $attach['uid']) && !$forum['getattachperm']) || forumperm($forum['getattachperm']);
+ } else {
+ $allowgetattach = !empty($forum['allowgetattach']) || (($_G['group']['allowgetattach'] || $_G['uid'] == $attach['uid']) && !$forum['getattachperm']) || forumperm($forum['getattachperm']);
+ }
+ if($allowgetattach && ($attach['readperm'] && $attach['readperm'] > $_G['group']['readaccess']) && $_G['adminid'] <= 0 && !($_G['uid'] && $_G['uid'] == $attach['uid'])) {
+ showmessage('attachment_forum_nopermission', NULL, array(), array('login' => 1));
+ }
+
+ $ismoderator = in_array($_G['adminid'], array(1, 2)) ? 1 : ($_G['adminid'] == 3 ? C::t('forum_moderator')->fetch_uid_by_tid($attach['tid'], $_G['uid'], $archiveid) : 0);
+
+ $ispaid = FALSE;
+ $exemptvalue = $ismoderator ? 128 : 16;
+ if(!$thread['special'] && $thread['price'] > 0 && (!$_G['uid'] || ($_G['uid'] != $attach['uid'] && !($_G['group']['exempt'] & $exemptvalue)))) {
+ if(!$_G['uid'] || $_G['uid'] && !($ispaid = C::t('common_credit_log')->count_by_uid_operation_relatedid($_G['uid'], 'BTC', $attach['tid']))) {
+ showmessage('attachment_payto', 'forum.php?mod=viewthread&tid='.$attach['tid']);
+ }
+ }
+
+ $exemptvalue = $ismoderator ? 64 : 8;
+ if($attach['price'] && (!$_G['uid'] || ($_G['uid'] != $attach['uid'] && !($_G['group']['exempt'] & $exemptvalue)))) {
+ $payrequired = $_G['uid'] ? !C::t('common_credit_log')->count_by_uid_operation_relatedid($_G['uid'], 'BAC', $attach['aid']) : 1;
+ $payrequired && showmessage('attachement_payto_attach', 'forum.php?mod=misc&action=attachpay&aid='.$attach['aid'].'&tid='.$attach['tid']);
+ }
+}
+
+$isimage = $attach['isimage'];
+$_G['setting']['ftp']['hideurl'] = $_G['setting']['ftp']['hideurl'] || ($isimage && !empty($_GET['noupdate']) && $_G['setting']['attachimgpost'] && strtolower(substr($_G['setting']['ftp']['attachurl'], 0, 3)) == 'ftp');
+
+if(empty($_GET['nothumb']) && $attach['isimage'] && $attach['thumb']) {
+ $db = DB::object();
+ $db->close();
+ !$_G['config']['output']['gzip'] && ob_end_clean();
+ dheader('Content-Disposition: inline; filename='.getimgthumbname($attach['filename']));
+ dheader('Content-Type: image/pjpeg');
+ if($attach['remote']) {
+ $_G['setting']['ftp']['hideurl'] ? getremotefile(getimgthumbname($attach['attachment'])) : dheader('location:'.$_G['setting']['ftp']['attachurl'].'forum/'.getimgthumbname($attach['attachment']));
+ } else {
+ getlocalfile($_G['setting']['attachdir'].'/forum/'.getimgthumbname($attach['attachment']));
+ }
+ exit();
+}
+
+$filename = $_G['setting']['attachdir'].'/forum/'.$attach['attachment'];
+if(!$attach['remote'] && !is_readable($filename)) {
+ if(!$requestmode) {
+ showmessage('attachment_nonexistence');
+ } else {
+ exit;
+ }
+}
+
+
+if(!$requestmode) {
+ if(!$ispaid && !$forum['allowgetattach']) {
+ if(!$forum['getattachperm'] && !$allowgetattach) {
+ showmessage('getattachperm_none_nopermission', NULL, array(), array('login' => 1));
+ } elseif(($forum['getattachperm'] && !forumperm($forum['getattachperm'])) || ($forum['viewperm'] && !forumperm($forum['viewperm']))) {
+ showmessagenoperm('getattachperm', $forum['fid']);
+ }
+ }
+
+ $exemptvalue = $ismoderator ? 32 : 4;
+ if(!$isimage && !($_G['group']['exempt'] & $exemptvalue)) {
+ $creditlog = updatecreditbyaction('getattach', $_G['uid'], array(), '', 1, 0, $thread['fid']);
+ if($creditlog['updatecredit']) {
+ if($_G['uid']) {
+ $k = $_GET['ck'];
+ $t = $_GET['t'];
+ if(empty($k) || empty($t) || $k != substr(md5($aid.$t.md5($_G['config']['security']['authkey'])), 0, 8) || TIMESTAMP - $t > 3600) {
+ dheader('location: forum.php?mod=misc&action=attachcredit&aid='.$attach['aid'].'&formhash='.FORMHASH);
+ exit();
+ }
+ } else {
+ showmessage('attachment_forum_nopermission', NULL, array(), array('login' => 1));
+ }
+ }
+ }
+
+}
+
+$range = 0;
+if($readmod == 4 && !empty($_SERVER['HTTP_RANGE'])) {
+ list($range) = explode('-',(str_replace('bytes=', '', $_SERVER['HTTP_RANGE'])));
+}
+
+if(!$requestmode && !$range && empty($_GET['noupdate'])) {
+ if($_G['setting']['delayviewcount']) {
+ $_G['forum_logfile'] = './data/cache/forum_attachviews_'.intval(getglobal('config/server/id')).'.log';
+ if(substr(TIMESTAMP, -1) == '0') {
+ attachment_updateviews($_G['forum_logfile']);
+ }
+
+ if(@$fp = fopen(DISCUZ_ROOT.$_G['forum_logfile'], 'a')) {
+ fwrite($fp, "$aid\n");
+ fclose($fp);
+ } elseif($_G['adminid'] == 1) {
+ showmessage('view_log_invalid', '', array('logfile' => $_G['forum_logfile']));
+ }
+ } else {
+ C::t('forum_attachment')->update_download($aid);
+ }
+}
+
+$db = DB::object();
+$db->close();
+!$_G['config']['output']['gzip'] && ob_end_clean();
+
+
+if($attach['remote'] && !$_G['setting']['ftp']['hideurl'] && $isimage) {
+ dheader('location:'.$_G['setting']['ftp']['attachurl'].'forum/'.$attach['attachment']);
+}
+
+$filesize = !$attach['remote'] ? filesize($filename) : $attach['filesize'];
+$attach['filename'] = '"'.(strtolower(CHARSET) == 'utf-8' && strexists($_SERVER['HTTP_USER_AGENT'], 'MSIE') ? urlencode($attach['filename']) : $attach['filename']).'"';
+
+dheader('Date: '.gmdate('D, d M Y H:i:s', $attach['dateline']).' GMT');
+dheader('Last-Modified: '.gmdate('D, d M Y H:i:s', $attach['dateline']).' GMT');
+dheader('Content-Encoding: none');
+
+if($isimage && !empty($_GET['noupdate']) || !empty($_GET['request'])) {
+ dheader('Content-Disposition: inline; filename='.$attach['filename']);
+} else {
+ dheader('Content-Disposition: attachment; filename='.$attach['filename']);
+}
+if($isimage) {
+ dheader('Content-Type: image');
+} else {
+ dheader('Content-Type: application/octet-stream');
+}
+
+dheader('Content-Length: '.$filesize);
+
+$xsendfile = getglobal('config/download/xsendfile');
+if(!empty($xsendfile)) {
+ $type = intval($xsendfile['type']);
+ if($isimage){
+ $type = 0;
+ }
+ $cmd = '';
+ switch ($type) {
+ case 1: $cmd = 'X-Accel-Redirect'; $url = $xsendfile['dir'].$attach['attachment']; break;
+ case 2: $cmd = $_SERVER['SERVER_SOFTWARE'] <'lighttpd/1.5' ? 'X-LIGHTTPD-send-file' : 'X-Sendfile'; $url = $filename; break;
+ case 3: $cmd = 'X-Sendfile'; $url = $filename; break;
+ }
+ if($cmd) {
+ dheader("$cmd: $url");
+ exit();
+ }
+}
+
+if($readmod == 4) {
+ dheader('Accept-Ranges: bytes');
+ if(!empty($_SERVER['HTTP_RANGE'])) {
+ $rangesize = ($filesize - $range) > 0 ? ($filesize - $range) : 0;
+ dheader('Content-Length: '.$rangesize);
+ dheader('HTTP/1.1 206 Partial Content');
+ dheader('Content-Range: bytes='.$range.'-'.($filesize-1).'/'.($filesize));
+ }
+}
+
+$attach['remote'] ? getremotefile($attach['attachment']) : getlocalfile($filename, $readmod, $range);
+
+function getremotefile($file) {
+ global $_G;
+ @set_time_limit(0);
+ if(!@readfile($_G['setting']['ftp']['attachurl'].'forum/'.$file)) {
+ $ftp = ftpcmd('object');
+ $tmpfile = @tempnam($_G['setting']['attachdir'], '');
+ if($ftp->ftp_get($tmpfile, 'forum/'.$file, FTP_BINARY)) {
+ @readfile($tmpfile);
+ @unlink($tmpfile);
+ } else {
+ @unlink($tmpfile);
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+function getlocalfile($filename, $readmod = 2, $range = 0) {
+ if($readmod == 1 || $readmod == 3 || $readmod == 4) {
+ if($fp = @fopen($filename, 'rb')) {
+ @fseek($fp, $range);
+ if(function_exists('fpassthru') && ($readmod == 3 || $readmod == 4)) {
+ @fpassthru($fp);
+ } else {
+ echo @fread($fp, filesize($filename));
+ }
+ }
+ @fclose($fp);
+ } else {
+ @readfile($filename);
+ }
+ @flush(); @ob_flush();
+}
+
+function attachment_updateviews($logfile) {
+ $viewlog = $viewarray = array();
+ $newlog = DISCUZ_ROOT.$logfile.random(6);
+ if(@rename(DISCUZ_ROOT.$logfile, $newlog)) {
+ $viewlog = file($newlog);
+ unlink($newlog);
+ if(is_array($viewlog) && !empty($viewlog)) {
+ $viewlog = array_count_values($viewlog);
+ foreach($viewlog as $id => $views) {
+ if($id > 0) {
+ $viewarray[$views][] = intval($id);
+ }
+ }
+ foreach($viewarray as $views => $ids) {
+ C::t('forum_attachment')->update_download($ids, $views);
+ }
+ }
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/discuz_3_4/uninstall/forum_image.php b/discuz_3_4/uninstall/forum_image.php
new file mode 100755
index 0000000..8eb4647
--- /dev/null
+++ b/discuz_3_4/uninstall/forum_image.php
@@ -0,0 +1,61 @@
+fetch('aid:'.$daid, $daid, array(1, -1))) {
+ if(!$dw && !$dh && $attach['tid'] != $id) {
+ dheader('location: '.$_G['siteurl'].'static/image/common/none.gif');
+ }
+ dheader('Expires: '.gmdate('D, d M Y H:i:s', TIMESTAMP + 3600).' GMT');
+ if($attach['remote']) {
+ $filename = $_G['setting']['ftp']['attachurl'].'forum/'.$attach['attachment'];
+ } else {
+ $filename = $_G['setting']['attachdir'].'forum/'.$attach['attachment'];
+ }
+ require_once libfile('class/image');
+ $img = new image;
+ if($img->Thumb($filename, $thumbfile, $w, $h, $type)) {
+ if($nocache) {
+ dheader('Content-Type: image');
+ @readfile($_G['setting']['attachdir'].$thumbfile);
+ @unlink($_G['setting']['attachdir'].$thumbfile);
+ } else {
+ dheader('location: '.$attachurl.$thumbfile);
+ }
+ } else {
+ dheader('Content-Type: image');
+ @readfile($filename);
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/discuz_3_4/uninstall/function_attachment.php b/discuz_3_4/uninstall/function_attachment.php
new file mode 100644
index 0000000..65cd4fc
--- /dev/null
+++ b/discuz_3_4/uninstall/function_attachment.php
@@ -0,0 +1,240 @@
+ 'unknown.gif',
+ 2 => 'binary.gif',
+ 3 => 'zip.gif',
+ 4 => 'rar.gif',
+ 5 => 'msoffice.gif',
+ 6 => 'text.gif',
+ 7 => 'html.gif',
+ 8 => 'real.gif',
+ 9 => 'av.gif',
+ 10 => 'flash.gif',
+ 11 => 'image.gif',
+ 12 => 'pdf.gif',
+ 13 => 'torrent.gif'
+ );
+
+ if(is_numeric($type)) {
+ $typeid = $type;
+ } else {
+ if(preg_match("/bittorrent|^torrent\t/", $type)) {
+ $typeid = 13;
+ } elseif(preg_match("/pdf|^pdf\t/", $type)) {
+ $typeid = 12;
+ } elseif(preg_match("/image|^(jpg|gif|png|bmp)\t/", $type)) {
+ $typeid = 11;
+ } elseif(preg_match("/flash|^(swf|fla|flv|swi)\t/", $type)) {
+ $typeid = 10;
+ } elseif(preg_match("/audio|video|^(wav|mid|mp3|m3u|wma|asf|asx|vqf|mpg|mpeg|avi|wmv)\t/", $type)) {
+ $typeid = 9;
+ } elseif(preg_match("/real|^(ra|rm|rv)\t/", $type)) {
+ $typeid = 8;
+ } elseif(preg_match("/htm|^(php|js|pl|cgi|asp)\t/", $type)) {
+ $typeid = 7;
+ } elseif(preg_match("/text|^(txt|rtf|wri|chm)\t/", $type)) {
+ $typeid = 6;
+ } elseif(preg_match("/word|powerpoint|^(doc|ppt)\t/", $type)) {
+ $typeid = 5;
+ } elseif(preg_match("/^rar\t/", $type)) {
+ $typeid = 4;
+ } elseif(preg_match("/compressed|^(zip|arj|arc|cab|lzh|lha|tar|gz)\t/", $type)) {
+ $typeid = 3;
+ } elseif(preg_match("/octet-stream|^(exe|com|bat|dll)\t/", $type)) {
+ $typeid = 2;
+ } elseif($type) {
+ $typeid = 1;
+ } else {
+ $typeid = 0;
+ }
+ }
+ if($returnval == 'html') {
+ return '';
+ } elseif($returnval == 'id') {
+ return $typeid;
+ }
+}
+
+function parseattach($attachpids, $attachtags, &$postlist, $skipaids = array()) {
+ global $_G;
+ if(!$attachpids) {
+ return;
+ }
+ $attachpids = is_array($attachpids) ? $attachpids : array($attachpids);
+ $attachexists = FALSE;
+ $skipattachcode = $aids = $payaids = $findattach = array();
+ foreach(C::t('forum_attachment_n')->fetch_all_by_id('tid:'.$_G['tid'], 'pid', $attachpids) as $attach) {
+ $attachexists = TRUE;
+ if($skipaids && in_array($attach['aid'], $skipaids)) {
+ $skipattachcode[$attach[pid]][] = "/\[attach\]$attach[aid]\[\/attach\]/i";
+ continue;
+ }
+ $attached = 0;
+ $extension = strtolower(fileext($attach['filename']));
+ $attach['ext'] = $extension;
+ $attach['imgalt'] = $attach['isimage'] ? strip_tags(str_replace('"', '\"', $attach['description'] ? $attach['description'] : $attach['filename'])) : '';
+ $attach['attachicon'] = attachtype($extension."\t".$attach['filetype']);
+ $attach['attachsize'] = sizecount($attach['filesize']);
+ if($attach['isimage'] && !$_G['setting']['attachimgpost']) {
+ $attach['isimage'] = 0;
+ }
+ $attach['attachimg'] = $attach['isimage'] && (!$attach['readperm'] || $_G['group']['readaccess'] >= $attach['readperm']) ? 1 : 0;
+ if($attach['attachimg']) {
+ $GLOBALS['aimgs'][$attach['pid']][] = $attach['aid'];
+ }
+ if($attach['price']) {
+ if($_G['setting']['maxchargespan'] && TIMESTAMP - $attach['dateline'] >= $_G['setting']['maxchargespan'] * 3600) {
+ C::t('forum_attachment_n')->update('tid:'.$_G['tid'], $attach['aid'], array('price' => 0));
+ $attach['price'] = 0;
+ } elseif(!$_G['forum_attachmentdown'] && $_G['uid'] != $attach['uid']) {
+ $payaids[$attach['aid']] = $attach['pid'];
+ }
+ }
+ $attach['payed'] = $_G['forum_attachmentdown'] || $_G['uid'] == $attach['uid'] ? 1 : 0;
+ $attach['url'] = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']).'forum/';
+ $attach['dbdateline'] = $attach['dateline'];
+ $attach['dateline'] = dgmdate($attach['dateline'], 'u');
+ $hideattachs = $_G['adminid'] != 1 && $_G['setting']['bannedmessages'] & 1 && (($postlist[$attach['pid']]['authorid'] && !$postlist[$attach['pid']]['username'])
+ || ($postlist[$attach['pid']]['groupid'] == 4 || $postlist[$attach['pid']]['groupid'] == 5) || $postlist[$attach['pid']]['status'] == -1 || $postlist[$attach['pid']]['memberstatus'])
+ || $_G['adminid'] != 1 && $postlist[$attach['pid']]['status'] & 1 || $postlist[$attach['pid']]['first'] && $_G['forum_threadpay'];
+ if(!$hideattachs) {
+ $postlist[$attach['pid']]['attachments'][$attach['aid']] = $attach;
+ }
+ if(!defined('IN_MOBILE_API') && !empty($attachtags[$attach['pid']]) && is_array($attachtags[$attach['pid']]) && in_array($attach['aid'], $attachtags[$attach['pid']])) {
+ $findattach[$attach['pid']][$attach['aid']] = "/\[attach\]$attach[aid]\[\/attach\]/i";
+ $attached = 1;
+ }
+
+ if(!$attached) {
+ if($attach['isimage']) {
+ if(!$hideattachs) {
+ $postlist[$attach['pid']]['imagelist'][] = $attach['aid'];
+ $postlist[$attach['pid']]['imagelistcount']++;
+ }
+ if($postlist[$attach['pid']]['first']) {
+ $GLOBALS['firstimgs'][] = $attach['aid'];
+ }
+ } else {
+ if(!$hideattachs && (!$_G['forum_skipaidlist'] || !in_array($attach['aid'], $_G['forum_skipaidlist']))) {
+ $postlist[$attach['pid']]['attachlist'][] = $attach['aid'];
+ }
+ }
+ }
+ $aids[] = $attach['aid'];
+ }
+ if($aids) {
+ $attachs = C::t('forum_attachment')->fetch_all($aids);
+ foreach($attachs as $aid => $attach) {
+ if($postlist[$attach['pid']]) {
+ $postlist[$attach['pid']]['attachments'][$attach['aid']]['downloads'] = $attach['downloads'];
+ }
+ }
+ }
+ if($payaids) {
+ foreach(C::t('common_credit_log')->fetch_all_by_uid_operation_relatedid($_G['uid'], 'BAC', array_keys($payaids)) as $creditlog) {
+ $postlist[$payaids[$creditlog['relatedid']]]['attachments'][$creditlog['relatedid']]['payed'] = 1;
+ }
+ }
+ if(!empty($skipattachcode)) {
+ foreach($skipattachcode as $pid => $findskipattach) {
+ foreach($findskipattach as $findskip) {
+ $postlist[$pid]['message'] = preg_replace($findskip, '', $postlist[$pid]['message']);
+ }
+ }
+ }
+
+ if($attachexists) {
+ foreach($attachtags as $pid => $aids) {
+ if($findattach[$pid]) {
+ foreach($findattach[$pid] as $aid => $find) {
+ $postlist[$pid]['message'] = preg_replace($find, attachinpost($postlist[$pid]['attachments'][$aid], $postlist[$pid]), $postlist[$pid]['message'], 1);
+ $postlist[$pid]['message'] = preg_replace($find, '', $postlist[$pid]['message']);
+ }
+ }
+ }
+ } else {
+ loadcache('posttableids');
+ $posttableids = $_G['cache']['posttableids'] ? $_G['cache']['posttableids'] : array('0');
+ foreach($posttableids as $id) {
+ C::t('forum_post')->update($id, $attachpids, array('attachment' => '0'), true);
+ }
+ }
+}
+
+function attachwidth($width) {
+ global $_G;
+ if($_G['setting']['imagemaxwidth'] && $width) {
+ return 'class="zoom" onclick="zoom(this, this.src, 0, 0, '.($_G['setting']['showexif'] ? 1 : 0).')" width="'.($width > $_G['setting']['imagemaxwidth'] ? $_G['setting']['imagemaxwidth'] : $width).'"';
+ } else {
+ return 'thumbImg="1"';
+ }
+}
+
+function packaids($attach) {
+ global $_G;
+ return aidencode($attach['aid'], 0, $_G['tid']);
+}
+
+function showattach($post, $type = 0) {
+ $type = !$type ? 'attachlist' : 'imagelist';
+ $return = '';
+ if(!empty($post[$type]) && is_array($post[$type])) {
+ foreach($post[$type] as $aid) {
+ if(!empty($post['attachments'][$aid])) {
+ $return .= $type($post['attachments'][$aid], $post['first']);
+ }
+ }
+ }
+ return $return;
+}
+
+function getattachexif($aid, $path = '') {
+ global $_G;
+ $return = $filename = '';
+ if(!$path) {
+ if($attach = C::t('forum_attachment_n')->fetch('aid:'.$aid, $aid, array(1, -1))) {
+ if($attach['remote']) {
+ $filename = $_G['setting']['ftp']['attachurl'].'forum/'.$attach['attachment'];
+ } else {
+ $filename = $_G['setting']['attachdir'].'forum/'.$attach['attachment'];
+ }
+ }
+ } else {
+ $filename = $path;
+ }
+ if($filename) {
+ require_once libfile('function/exif');
+ $exif = getexif($filename);
+ $keys = array(
+ exif_lang('Model'),
+ exif_lang('ShutterSpeedValue'),
+ exif_lang('ApertureValue'),
+ exif_lang('FocalLength'),
+ exif_lang('ExposureTime'),
+ exif_lang('DateTimeOriginal'),
+ exif_lang('ISOSpeedRatings'),
+ );
+ foreach($exif as $key => $value) {
+ if(in_array($key, $keys)) {
+ $return .= "$key : $value
";
+ }
+ }
+ }
+ return $return;
+}
+
+?>
\ No newline at end of file
diff --git a/discuz_3_4/uninstall/function_home.php b/discuz_3_4/uninstall/function_home.php
new file mode 100755
index 0000000..6b9d589
--- /dev/null
+++ b/discuz_3_4/uninstall/function_home.php
@@ -0,0 +1,597 @@
+|\r|\n|\s|\[.+?\])/is", ' ', $string);
+ } elseif ($html == 0) {
+ $string = dhtmlspecialchars($string);
+ }
+
+ if($length) {
+ $string = cutstr($string, $length);
+ }
+
+ if($bbcode) {
+ require_once DISCUZ_ROOT.'./source/class/class_bbcode.php';
+ $bb = & bbcode::instance();
+ $string = $bb->bbcode2html($string, $bbcode);
+ }
+ if($out_slashes) {
+ $string = daddslashes($string);
+ }
+ return trim($string);
+}
+
+function obclean() {
+ ob_end_clean();
+ if (getglobal('config/output/gzip') && function_exists('ob_gzhandler')) {
+ ob_start('ob_gzhandler');
+ } else {
+ ob_start();
+ }
+}
+
+function dreaddir($dir, $extarr=array()) {
+ $dirs = array();
+ if($dh = opendir($dir)) {
+ while (($file = readdir($dh)) !== false) {
+ if(!empty($extarr) && is_array($extarr)) {
+ if(in_array(strtolower(fileext($file)), $extarr)) {
+ $dirs[] = $file;
+ }
+ } else if($file != '.' && $file != '..') {
+ $dirs[] = $file;
+ }
+ }
+ closedir($dh);
+ }
+ return $dirs;
+}
+
+function url_implode($gets) {
+ $arr = array();
+ foreach ($gets as $key => $value) {
+ if($value) {
+ $arr[] = $key.'='.urlencode($value);
+ }
+ }
+ return implode('&', $arr);
+}
+
+function ckstart($start, $perpage) {
+ global $_G;
+
+ $_G['setting']['maxpage'] = $_G['setting']['maxpage'] ? $_G['setting']['maxpage'] : 100;
+ $maxstart = $perpage*intval($_G['setting']['maxpage']);
+ if($start < 0 || ($maxstart > 0 && $start >= $maxstart)) {
+ showmessage('length_is_not_within_the_scope_of');
+ }
+}
+
+
+function get_my_app() {
+}
+
+function get_my_userapp() {
+}
+
+function getspace($uid) {
+ return getuserbyuid($uid);
+}
+
+function ckprivacy($key, $privace_type) {
+ global $_G, $space;
+
+ $var = "home_ckprivacy_{$key}_{$privace_type}";
+ if(isset($_G[$var])) {
+ return $_G[$var];
+ }
+ space_merge($space, 'field_home');
+ $result = false;
+ if($_G['adminid'] == 1) {
+ $result = true;
+ } else {
+ if($privace_type == 'feed') {
+ if(!empty($space['privacy'][$privace_type][$key])) {
+ $result = true;
+ }
+ } elseif($space['self']){
+ $result = true;
+ } else {
+ if(empty($space['privacy'][$privace_type][$key])) {
+ $result = true;
+ } elseif ($space['privacy'][$privace_type][$key] == 1) {
+ include_once libfile('function/friend');
+ if(friend_check($space['uid'])) {
+ $result = true;
+ }
+ } elseif ($space['privacy'][$privace_type][$key] == 3) {
+ $result = in_array($_G['groupid'], array(4, 5, 6, 7)) ? false : true;
+ }
+ }
+ }
+ $_G[$var] = $result;
+ return $result;
+}
+
+function app_ckprivacy($privacy) {
+ global $_G, $space;
+
+ $var = "home_app_ckprivacy_{$privacy}";
+ if(isset($_G[$var])) {
+ return $_G[$var];
+ }
+ $result = false;
+ switch ($privacy) {
+ case 0:
+ $result = true;
+ break;
+ case 1:
+ include_once libfile('function/friend');
+ if(friend_check($space['uid'])) {
+ $result = true;
+ }
+ break;
+ case 2:
+ break;
+ case 3:
+ if($space['self']) {
+ $result = true;
+ }
+ break;
+ case 4:
+ break;
+ case 5:
+ break;
+ default:
+ $result = true;
+ break;
+ }
+ $_G[$var] = $result;
+ return $result;
+}
+
+function formatsize($size) {
+ $prec=3;
+ $size = round(abs($size));
+ $units = array(0=>" B ", 1=>" KB", 2=>" MB", 3=>" GB", 4=>" TB");
+ if ($size==0) return str_repeat(" ", $prec)."0$units[0]";
+ $unit = min(4, floor(log($size)/log(2)/10));
+ $size = $size * pow(2, -10*$unit);
+ $digi = $prec - 1 - floor(log($size)/log(10));
+ $size = round($size * pow(10, $digi)) * pow(10, -$digi);
+ return $size.$units[$unit];
+}
+
+function ckfriend($touid, $friend, $target_ids='') {
+ global $_G;
+
+ if(empty($_G['uid'])) return $friend?false:true;
+ if($touid == $_G['uid'] || $_G['adminid'] == 1) return true;
+
+ $var = 'home_ckfriend_'.md5($touid.'_'.$friend.'_'.$target_ids);
+ if(isset($_G[$var])) return $_G[$var];
+
+ $_G[$var] = false;
+ switch ($friend) {
+ case 0:
+ $_G[$var] = true;
+ break;
+ case 1:
+ include_once libfile('function/friend');
+ if(friend_check($touid)) {
+ $_G[$var] = true;
+ }
+ break;
+ case 2:
+ if($target_ids) {
+ $target_ids = explode(',', $target_ids);
+ if(in_array($_G['uid'], $target_ids)) $_G[$var] = true;
+ }
+ break;
+ case 3:
+ break;
+ case 4:
+ $_G[$var] = true;
+ break;
+ default:
+ break;
+ }
+ return $_G[$var];
+}
+function ckfollow($followuid) {
+ global $_G;
+
+ if(empty($_G['uid'])) return false;
+
+ $var = 'home_follow_'.$_G['uid'].'_'.$followuid;
+ if(isset($_G[$var])) return $_G[$var];
+
+ $_G[$var] = false;
+ $follow = C::t('home_follow')->fetch_status_by_uid_followuid($_G['uid'], $followuid);
+ if(isset($follow[$_G['uid']])) {
+ $_G[$var] = true;
+ }
+ return $_G[$var];
+}
+
+function sub_url($url, $length) {
+ if(strlen($url) > $length) {
+ $url = str_replace(array('%3A', '%2F'), array(':', '/'), rawurlencode($url));
+ $url = substr($url, 0, intval($length * 0.5)).' ... '.substr($url, - intval($length * 0.3));
+ }
+ return $url;
+}
+
+function space_domain($space) {
+ global $_G;
+
+ if($_G['setting']['allowspacedomain'] && $_G['setting']['domain']['root']['home']) {
+ space_merge($space, 'field_home');
+ if($space['domain']) {
+ $space['domainurl'] = 'http://'.$space['domain'].'.'.$_G['setting']['domain']['root']['home'];
+ }
+ }
+ if(!empty($_G['setting']['domain']['app']['home'])) {
+ $space['domainurl'] = 'http://'.$_G['setting']['domain']['app']['home'].'/?'.$space['uid'];
+ } elseif(empty($space['domainurl'])) {
+ $space['domainurl'] = $_G['siteurl'].'?'.$space['uid'];
+ }
+ return $space['domainurl'];
+}
+
+function g_name($groupid) {
+ global $_G;
+ echo $_G['cache']['usergroups'][$groupid]['grouptitle'];
+}
+
+function g_color($groupid) {
+ global $_G;
+ if(empty($_G['cache']['usergroups'][$groupid]['color'])) {
+ echo '';
+ } else {
+ echo ' style="color:'.$_G['cache']['usergroups'][$groupid]['color'].';"';
+ }
+}
+
+function mob_perpage($perpage) {
+ global $_G;
+
+ $newperpage = isset($_GET['perpage'])?intval($_GET['perpage']):0;
+ if($_G['mobile'] && $newperpage>0 && $newperpage<500) {
+ $perpage = $newperpage;
+ }
+ return $perpage;
+}
+
+function ckicon_uid($feed) {
+ global $_G, $space;
+
+ space_merge($space, 'field_home');
+ $filter_icon = empty($space['privacy']['filter_icon'])?array():array_keys($space['privacy']['filter_icon']);
+ if($filter_icon && (in_array($feed['icon'].'|0', $filter_icon) || in_array($feed['icon'].'|'.$feed['uid'], $filter_icon))) {
+ return false;
+ }
+ return true;
+}
+
+function sarray_rand($arr, $num=1) {
+ $r_values = array();
+ if($arr && count($arr) > $num) {
+ if($num > 1) {
+ $r_keys = array_rand($arr, $num);
+ foreach ($r_keys as $key) {
+ $r_values[$key] = $arr[$key];
+ }
+ } else {
+ $r_key = array_rand($arr, 1);
+ $r_values[$r_key] = $arr[$r_key];
+ }
+ } else {
+ $r_values = $arr;
+ }
+ return $r_values;
+}
+
+function my_showgift() {
+ global $_G, $space;
+ if($_G['setting']['my_showgift'] && $_G['my_userapp'][$_G['home_gift_appid']]) {
+ echo '';
+ }
+}
+
+function getsiteurl() {
+ global $_G;
+ return $_G['siteurl'];
+}
+
+function pic_get($filepath, $type, $thumb, $remote, $return_thumb=1, $hastype = '') {
+ global $_G;
+
+ $url = $filepath;
+ if($return_thumb && $thumb) $url = getimgthumbname($url);
+ if($remote > 1 && $type == 'album') {
+ $remote -= 2;
+ $type = 'forum';
+ }
+ $type = $hastype ? '' : $type.'/';
+ return ($remote?$_G['setting']['ftp']['attachurl']:$_G['setting']['attachurl']).$type.$url;
+}
+
+function pic_cover_get($pic, $picflag) {
+ global $_G;
+
+ $type = 'album';
+ if($picflag > 2) {
+ $picflag = $picflag - 2;
+ $type = 'forum';
+ }
+ if($picflag == 1) {
+ $url = $_G['setting']['attachurl'].$type.'/'.$pic;
+ } elseif ($picflag == 2) {
+ $url = $_G['setting']['ftp']['attachurl'].$type.'/'.$pic;
+ } else {
+ $url = $pic;
+ }
+ return $url;
+}
+
+function pic_delete($pic, $type, $thumb, $remote) {
+ global $_G;
+
+ if($remote > 1 && $type == 'album') {
+ $remote -= 2;
+ $type = 'forum';
+ return true;
+ }
+
+ if($remote) {
+ ftpcmd('delete', $type.'/'.$pic);
+ if($thumb) {
+ ftpcmd('delete', $type.'/'.getimgthumbname($pic));
+ }
+ ftpcmd('close');
+ } else {
+ @unlink($_G['setting']['attachdir'].'/'.$type.'/'.$pic);
+ if($thumb) {
+ @unlink($_G['setting']['attachdir'].'/'.$type.'/'.getimgthumbname($pic));
+ }
+ }
+ return true;
+}
+
+function pic_upload($FILES, $type='album', $thumb_width=0, $thumb_height=0, $thumb_type=2) {
+ $upload = new discuz_upload();
+
+ $result = array('pic'=>'', 'thumb'=>0, 'remote'=>0);
+
+ $upload->init($FILES, $type);
+ if($upload->error()) {
+ return array();
+ }
+
+ $upload->save();
+ if($upload->error()) {
+ return array();
+ }
+
+ $result['pic'] = $upload->attach['attachment'];
+
+ if($thumb_width && $thumb_height) {
+ require_once libfile('class/image');
+ $image = new image();
+ if($image->Thumb($upload->attach['target'], '', $thumb_width, $thumb_height, $thumb_type)) {
+ $result['thumb'] = 1;
+ }
+ }
+
+ if(getglobal('setting/ftp/on')) {
+ if(ftpcmd('upload', $type.'/'.$upload->attach['attachment'])) {
+ if($result['thumb']) {
+ ftpcmd('upload', $type.'/'.getimgthumbname($upload->attach['attachment']));
+ }
+ ftpcmd('close');
+ $result['remote'] = 1;
+ } else {
+ if(getglobal('setting/ftp/mirror')) {
+ @unlink($upload->attach['target']);
+ @unlink(getimgthumbname($upload->attach['target']));
+ return array();
+ }
+ }
+ }
+
+ return $result;
+}
+
+function member_count_update($uid, $counts) {
+ global $_G;
+
+ $setsqls = array();
+ foreach ($counts as $key => $value) {
+ if($key == 'credit') {
+ if($_G['setting']['creditstransextra'][6]) {
+ $key = 'extcredits'.intval($_G['setting']['creditstransextra'][6]);
+ } elseif ($_G['setting']['creditstrans']) {
+ $key = 'extcredits'.intval($_G['setting']['creditstrans']);
+ } else {
+ continue;
+ }
+ }
+ $setsqls[$key] = $value;
+ }
+ if($setsqls) {
+ updatemembercount($uid, $setsqls);
+ }
+}
+
+
+function getdefaultdoing() {
+ global $_G;
+
+ $result = array();
+ $key = 0;
+
+ if(($result = C::t('common_setting')->fetch('defaultdoing'))) {
+ $_G['setting']['defaultdoing'] = explode("\r\n", $result);
+ $key = rand(0, count($_G['setting']['defaultdoing'])-1);
+ } else {
+ $_G['setting']['defaultdoing'] = array(lang('space', 'doing_you_can'));
+ }
+ return $_G['setting']['defaultdoing'][$key];
+}
+
+function getuserdiydata($space) {
+ global $_G;
+ if(empty($_G['blockposition'])) {
+ $userdiy = getuserdefaultdiy();
+ if (!empty($space['blockposition'])) {
+ $blockdata = dunserialize($space['blockposition']);
+ foreach ((array)$blockdata as $key => $value) {
+ if ($key == 'parameters') {
+ foreach ((array)$value as $k=>$v) {
+ if (!empty($v)) $userdiy[$key][$k] = $v;
+ }
+ } else {
+ if (!empty($value)) $userdiy[$key] = $value;
+ }
+ }
+ }
+ $_G['blockposition'] = $userdiy;
+ }
+ return $_G['blockposition'];
+}
+
+
+function getuserdefaultdiy() {
+ $defaultdiy = array(
+ 'currentlayout' => '1:2:1',
+ 'block' => array(
+ 'frame`frame1' => array(
+ 'attr' => array('name'=>'frame1'),
+ 'column`frame1_left' => array(
+ 'block`profile' => array('attr' => array('name'=>'profile')),
+ 'block`statistic' => array('attr' => array('name'=>'statistic')),
+ 'block`album' => array('attr' => array('name'=>'album')),
+ 'block`doing' => array('attr' => array('name'=>'doing'))
+ ),
+ 'column`frame1_center' => array(
+ 'block`personalinfo' => array('attr' => array('name'=>'personalinfo')),
+ 'block`feed' => array('attr' => array('name'=>'feed')),
+ 'block`share' => array('attr' => array('name'=>'share')),
+ 'block`blog' => array('attr' => array('name'=>'blog')),
+ 'block`thread' => array('attr' => array('name'=>'thread')),
+ 'block`wall' => array('attr' => array('name'=>'wall'))
+ ),
+ 'column`frame1_right' => array(
+ 'block`myapp' => array('attr' => array('name'=>'myapp')),
+ 'block`friend' => array('attr' => array('name'=>'friend')),
+ 'block`visitor' => array('attr' => array('name'=>'visitor')),
+ 'block`group' => array('attr' => array('name'=>'group'))
+ )
+ )
+ ),
+ 'parameters' => array(
+ 'blog' => array('showmessage' => 150, 'shownum' => 6),
+ 'doing' => array('shownum' => 15),
+ 'album' => array('shownum' => 8),
+ 'thread' => array('shownum' => 10),
+ 'share' => array('shownum' => 10),
+ 'friend' => array('shownum' => 18),
+ 'group' => array('shownum' => 12),
+ 'visitor' => array('shownum' => 18),
+ 'wall' => array('shownum' => 16),
+ 'feed' => array('shownum' => 16),
+ 'myapp' => array('shownum' => 9, 'logotype'=> 'logo'),
+ ),
+ 'nv' => array(
+ 'nvhidden' => 0,
+ 'items' => array(),
+ 'banitems' => array(),
+ ),
+ );
+ return $defaultdiy;
+}
+
+function getonlinemember($uids) {
+ global $_G;
+ if ($uids && is_array($uids) && empty($_G['ols'])) {
+ $_G['ols'] = array();
+ foreach(C::app()->session->fetch_all_by_uid($uids) as $value) {
+ if(!$value['invisible']) {
+ $_G['ols'][$value['uid']] = $value['lastactivity'];
+ }
+ }
+ }
+}
+function getfollowfeed($uid, $viewtype, $archiver = false, $start = 0, $perpage = 0) {
+ global $_G;
+
+ $list = array();
+ if(isset($_G['follwusers'][$uid])) {
+ $list['user'] = $_G['follwusers'][$uid];
+ } else {
+ if($viewtype == 'follow') {
+ $list['user'] = C::t('home_follow')->fetch_all_following_by_uid($uid);
+ $list['user'][$uid] = array('uid' => $uid);
+ } elseif($viewtype == 'special') {
+ $list['user'] = C::t('home_follow')->fetch_all_following_by_uid($uid, 1);
+ }
+ if(!empty($list['user'])) {
+ $_G['follwusers'][$uid] = $list['user'];
+ }
+ }
+ $uids = in_array($viewtype, array('other', 'self')) ? $uid : array_keys($list['user']);
+ if(!empty($uids) || in_array($viewtype, array('other', 'self'))) {
+ $list['feed'] = C::t('home_follow_feed')->fetch_all_by_uid($uids, $archiver, $start, $perpage);
+ if($list['feed']) {
+ $list['content'] = C::t('forum_threadpreview')->fetch_all(C::t('home_follow_feed')->get_tids());
+ if(!$_G['group']['allowgetattach'] || !$_G['group']['allowgetimage']) {
+ foreach($list['content'] as $key => $feed) {
+ if(!$_G['group']['allowgetimage']) {
+ $list['content'][$key]['content'] = preg_replace("/[ \t]*\\[ \t]*\<\/li\>/is", '', $feed['content']);
+ }
+ if(!$_G['group']['allowgetattach']) {
+ $list['content'][$key]['content'] = preg_replace("/[ \t]*\\.*?\<\/a\>[ \t]*\<\/li\>/is", '', $feed['content']);
+ }
+ }
+ }
+ $list['threads'] = C::t('forum_thread')->fetch_all_by_tid(C::t('home_follow_feed')->get_tids());
+ }
+ }
+ return $list;
+}
+
+function getthread() {
+ $threads = array();
+ foreach(C::t('home_follow_feed')->get_ids() as $idtype => $ids) {
+ if($idtype == 'thread') {
+ $threads = C::t('forum_thread')->fetch_all_by_tid($ids);
+ }
+ }
+ return $threads;
+}
+
+?>
\ No newline at end of file
diff --git a/discuz_3_4/uninstall/function_post.php b/discuz_3_4/uninstall/function_post.php
new file mode 100644
index 0000000..acd8302
--- /dev/null
+++ b/discuz_3_4/uninstall/function_post.php
@@ -0,0 +1,677 @@
+ 0 ? "AND af.dateline>'$posttime'" : '';
+ if(!empty($_G['fid']) && $_G['forum']['attachextensions']) {
+ $allowext = str_replace(' ', '', strtolower($_G['forum']['attachextensions']));
+ $allowext = explode(',', $allowext);
+ } else {
+ $allowext = '';
+ }
+ foreach(C::t('forum_attachment')->fetch_all_unused_attachment($_G['uid'], empty($aidsnew) ? null : $aidsnew, $posttime > 0 ? $posttime : null) as $attach) {
+ $attach['filenametitle'] = $attach['filename'];
+ $attach['ext'] = fileext($attach['filename']);
+ if($allowext && !in_array($attach['ext'], $allowext)) {
+ continue;
+ }
+ getattach_row($attach, $attachs, $imgattachs);
+ }
+ if($pid > 0) {
+ $attachmentns = C::t('forum_attachment_n')->fetch_all_by_id('tid:'.$_G['tid'], 'pid', $pid);
+ foreach(C::t('forum_attachment')->fetch_all_by_id('pid', $pid, 'aid') as $attach) {
+ $attach = array_merge($attach, $attachmentns[$attach['aid']]);
+ $attach['filenametitle'] = $attach['filename'];
+ $attach['ext'] = fileext($attach['filename']);
+ if($allowext && !in_array($attach['ext'], $allowext)) {
+ continue;
+ }
+ getattach_row($attach, $attachs, $imgattachs);
+ }
+ }
+ return array('attachs' => $attachs, 'imgattachs' => $imgattachs);
+}
+
+function getattach_row($attach, &$attachs, &$imgattachs) {
+ global $_G;
+ $attach['filename'] = cutstr($attach['filename'], $_G['setting']['allowattachurl'] ? 25 : 30);
+ $attach['attachsize'] = sizecount($attach['filesize']);
+ $attach['dateline'] = dgmdate($attach['dateline']);
+ $attach['filetype'] = attachtype($attach['ext']."\t".$attach['filetype']);
+ if($attach['isimage'] < 1) {
+ if($attach['isimage']) {
+ $attach['url'] = $attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl'];
+ $attach['width'] = $attach['width'] > 300 ? 300 : $attach['width'];
+ }
+ if($attach['pid']) {
+ $attachs['used'][] = $attach;
+ } else {
+ $attachs['unused'][] = $attach;
+ }
+ } else {
+ $attach['url'] = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']).'/forum';
+ $attach['width'] = $attach['width'] > 300 ? 300 : $attach['width'];
+ if($attach['pid']) {
+ $imgattachs['used'][] = $attach;
+ } else {
+ $imgattachs['unused'][] = $attach;
+ }
+ }
+}
+
+function parseattachmedia($attach) {
+ $attachurl = 'attach://'.$attach['aid'].'.'.$attach['ext'];
+ switch(strtolower($attach['ext'])) {
+ case 'mp3':
+ case 'wma':
+ case 'ra':
+ case 'ram':
+ case 'wav':
+ case 'mid':
+ return '[audio]'.$attachurl.'[/audio]';
+ case 'wmv':
+ case 'rm':
+ case 'rmvb':
+ case 'avi':
+ case 'asf':
+ case 'mpg':
+ case 'mpeg':
+ case 'mov':
+ case 'flv':
+ case 'swf':
+ return '[media='.$attach['ext'].',400,300]'.$attachurl.'[/media]';
+ default:
+ return;
+ }
+}
+
+function ftpupload($aids, $uid = 0) {
+ global $_G;
+ $uid = $uid ? $uid : $_G['uid'];
+
+ if(!$aids || !$_G['setting']['ftp']['on']) {
+ return;
+ }
+ $attachtables = $pics = array();
+ foreach(C::t('forum_attachment')->fetch_all($aids) as $attach) {
+ if($uid != $attach['uid'] && !$_G['forum']['ismoderator']) {
+ continue;
+ }
+ $attachtables[$attach['tableid']][] = $attach['aid'];
+ }
+ foreach($attachtables as $attachtable => $aids) {
+ $remoteaids = array();
+ foreach(C::t('forum_attachment_n')->fetch_all($attachtable, $aids, 0) as $attach) {
+ $attach['ext'] = fileext($attach['filename']);
+ if(((!$_G['setting']['ftp']['allowedexts'] && !$_G['setting']['ftp']['disallowedexts']) || ($_G['setting']['ftp']['allowedexts'] && in_array($attach['ext'], $_G['setting']['ftp']['allowedexts'])) || ($_G['setting']['ftp']['disallowedexts'] && !in_array($attach['ext'], $_G['setting']['ftp']['disallowedexts']) && (!$_G['setting']['ftp']['allowedexts'] || $_G['setting']['ftp']['allowedexts'] && in_array($attach['ext'], $_G['setting']['ftp']['allowedexts'])) )) && (!$_G['setting']['ftp']['minsize'] || $attach['filesize'] >= $_G['setting']['ftp']['minsize'] * 1024)) {
+ if(ftpcmd('upload', 'forum/'.$attach['attachment']) && (!$attach['thumb'] || ftpcmd('upload', 'forum/'.getimgthumbname($attach['attachment'])))) {
+ dunlink($attach);
+ $remoteaids[$attach['aid']] = $attach['aid'];
+ if($attach['picid']) {
+ $pics[] = $attach['picid'];
+ }
+ }
+ }
+ }
+
+ if($remoteaids) {
+ C::t('forum_attachment_n')->update($attachtable, $remoteaids, array('remote' => 1));
+ }
+ }
+ if($pics) {
+ C::t('home_pic')->update($pics, array('remote' => 3));
+ }
+}
+
+function updateattach($modnewthreads, $tid, $pid, $attachnew, $attachupdate = array(), $uid = 0) {
+ global $_G;
+ $thread = C::t('forum_thread')->fetch($tid);
+ $uid = $uid ? $uid : $_G['uid'];
+ if($attachnew) {
+ $newaids = array_keys($attachnew);
+ $newattach = $newattachfile = $albumattach = array();
+ foreach(C::t('forum_attachment_unused')->fetch_all($newaids) as $attach) {
+ if($attach['uid'] != $uid && !$_G['forum']['ismoderator']) {
+ continue;
+ }
+ $attach['uid'] = $uid;
+ $newattach[$attach['aid']] = daddslashes($attach);
+ if($attach['isimage']) {
+ $newattachfile[$attach['aid']] = $attach['attachment'];
+ }
+ }
+ if($_G['setting']['watermarkstatus'] && empty($_G['forum']['disablewatermark']) || !$_G['setting']['thumbdisabledmobile']) {
+ require_once libfile('class/image');
+ $image = new image;
+ }
+ if(!empty($_GET['albumaid'])) {
+ array_unshift($_GET['albumaid'], '');
+ $_GET['albumaid'] = array_unique($_GET['albumaid']);
+ unset($_GET['albumaid'][0]);
+ foreach($_GET['albumaid'] as $aid) {
+ if(isset($newattach[$aid])) {
+ $albumattach[$aid] = $newattach[$aid];
+ }
+ }
+ }
+ foreach($attachnew as $aid => $attach) {
+ $update = array();
+ $update['readperm'] = $_G['group']['allowsetattachperm'] ? $attach['readperm'] : 0;
+ $update['price'] = $_G['group']['maxprice'] ? (intval($attach['price']) <= $_G['group']['maxprice'] ? intval($attach['price']) : $_G['group']['maxprice']) : 0;
+ $update['tid'] = $tid;
+ $update['pid'] = $pid;
+ $update['uid'] = $uid;
+ $update['description'] = censor(cutstr(dhtmlspecialchars($attach['description']), 100));
+ C::t('forum_attachment_n')->update('tid:'.$tid, $aid, $update);
+ if(!$newattach[$aid]) {
+ continue;
+ }
+ $update = array_merge($update, $newattach[$aid]);
+ if(!empty($newattachfile[$aid])) {
+ if($_G['setting']['thumbstatus'] && $_G['forum']['disablethumb']) {
+ $update['thumb'] = 0;
+ @unlink($_G['setting']['attachdir'].'/forum/'.getimgthumbname($newattachfile[$aid]));
+ if(!empty($albumattach[$aid])) {
+ $albumattach[$aid]['thumb'] = 0;
+ }
+ } elseif(!$_G['setting']['thumbdisabledmobile']) {
+ $_daid = sprintf("%09d", $aid);
+ $dir1 = substr($_daid, 0, 3);
+ $dir2 = substr($_daid, 3, 2);
+ $dir3 = substr($_daid, 5, 2);
+ $dw = 320;
+ $dh = 320;
+ $thumbfile = 'image/'.$dir1.'/'.$dir2.'/'.$dir3.'/'.substr($_daid, -2).'_'.$dw.'_'.$dh.'.jpg';
+ $image->Thumb($_G['setting']['attachdir'].'/forum/'.$newattachfile[$aid], $thumbfile, $dw, $dh, 'fixwr');
+ $dw = 720;
+ $dh = 720;
+ $thumbfile = 'image/'.$dir1.'/'.$dir2.'/'.$dir3.'/'.substr($_daid, -2).'_'.$dw.'_'.$dh.'.jpg';
+ $image->Thumb($_G['setting']['attachdir'].'/forum/'.$newattachfile[$aid], $thumbfile, $dw, $dh, 'fixwr');
+ }
+ if($_G['setting']['watermarkstatus'] && empty($_G['forum']['disablewatermark'])) {
+ $image->Watermark($_G['setting']['attachdir'].'/forum/'.$newattachfile[$aid], '', 'forum');
+ $update['filesize'] = $image->imginfo['size'];
+ }
+ }
+ if(!empty($_GET['albumaid']) && isset($albumattach[$aid])) {
+ $newalbum = 0;
+ if(!$_GET['uploadalbum']) {
+ require_once libfile('function/spacecp');
+ $_GET['uploadalbum'] = album_creat(array('albumname' => $_GET['newalbum']));
+ $newalbum = 1;
+ }
+ $picdata = array(
+ 'albumid' => $_GET['uploadalbum'],
+ 'uid' => $uid,
+ 'username' => $_G['username'],
+ 'dateline' => $albumattach[$aid]['dateline'],
+ 'postip' => $_G['clientip'],
+ 'filename' => censor($albumattach[$aid]['filename']),
+ 'title' => censor(cutstr(dhtmlspecialchars($attach['description']), 100)),
+ 'type' => fileext($albumattach[$aid]['attachment']),
+ 'size' => $albumattach[$aid]['filesize'],
+ 'filepath' => $albumattach[$aid]['attachment'],
+ 'thumb' => $albumattach[$aid]['thumb'],
+ 'remote' => $albumattach[$aid]['remote'] + 2,
+ );
+
+ $update['picid'] = C::t('home_pic')->insert($picdata, 1);
+
+ if($newalbum) {
+ require_once libfile('function/home');
+ require_once libfile('function/spacecp');
+ album_update_pic($_GET['uploadalbum']);
+ }
+ }
+ C::t('forum_attachment_n')->insert('tid:'.$tid, $update, false, true);
+ C::t('forum_attachment')->update($aid, array('tid' => $tid, 'pid' => $pid, 'tableid' => getattachtableid($tid)));
+ C::t('forum_attachment_unused')->delete($aid);
+ }
+
+ if(!empty($_GET['albumaid'])) {
+ $albumdata = array(
+ 'picnum' => C::t('home_pic')->check_albumpic($_GET['uploadalbum']),
+ 'updatetime' => $_G['timestamp'],
+ );
+ C::t('home_album')->update($_GET['uploadalbum'], $albumdata);
+ require_once libfile('function/home');
+ require_once libfile('function/spacecp');
+ album_update_pic($_GET['uploadalbum']);
+ }
+ if($newattach) {
+ ftpupload($newaids, $uid);
+ }
+ }
+
+ if(!$modnewthreads && $newattach && $uid == $_G['uid']) {
+ updatecreditbyaction('postattach', $uid, array(), '', count($newattach), 1, $_G['fid']);
+ }
+
+ if($attachupdate) {
+ $attachs = C::t('forum_attachment_n')->fetch_all_by_id('tid:'.$tid, 'aid', array_keys($attachupdate));
+ foreach($attachs as $attach) {
+ if(array_key_exists($attach['aid'], $attachupdate) && $attachupdate[$attach['aid']]) {
+ dunlink($attach);
+ }
+ }
+ $unusedattachs = C::t('forum_attachment_unused')->fetch_all($attachupdate);
+ $attachupdate = array_flip($attachupdate);
+ $unusedaids = array();
+ foreach($unusedattachs as $attach) {
+ if($attach['uid'] != $uid && !$_G['forum']['ismoderator']) {
+ continue;
+ }
+ $unusedaids[] = $attach['aid'];
+ $update = $attach;
+ $update['dateline'] = TIMESTAMP;
+ $update['remote'] = 0;
+ unset($update['aid']);
+ if($attach['isimage'] && $_G['setting']['watermarkstatus'] && empty($_G['forum']['disablewatermark'])) {
+ $image->Watermark($_G['setting']['attachdir'].'/forum/'.$attach['attachment'], '', 'forum');
+ $update['filesize'] = $image->imginfo['size'];
+ }
+ C::t('forum_attachment_n')->update('tid:'.$tid, $attachupdate[$attach['aid']], $update);
+ @unlink($_G['setting']['attachdir'].'image/'.$attach['aid'].'_100_100.jpg');
+ C::t('forum_attachment_exif')->delete($attachupdate[$attach['aid']]);
+ C::t('forum_attachment_exif')->update($attach['aid'], array('aid' => $attachupdate[$attach['aid']]));
+ ftpupload(array($attachupdate[$attach['aid']]), $uid);
+ }
+ if($unusedaids) {
+ C::t('forum_attachment_unused')->delete($unusedaids);
+ }
+ }
+
+ $attachcount = C::t('forum_attachment_n')->count_by_id('tid:'.$tid, $pid ? 'pid' : 'tid', $pid ? $pid : $tid);
+ $attachment = 0;
+ if($attachcount) {
+ if(C::t('forum_attachment_n')->count_image_by_id('tid:'.$tid, $pid ? 'pid' : 'tid', $pid ? $pid : $tid)) {
+ $attachment = 2;
+ } else {
+ $attachment = 1;
+ }
+ } else {
+ $attachment = 0;
+ }
+ C::t('forum_thread')->update($tid, array('attachment'=>$attachment));
+ C::t('forum_post')->update('tid:'.$tid, $pid, array('attachment' => $attachment), true);
+
+ if(!$attachment) {
+ C::t('forum_threadimage')->delete_by_tid($tid);
+ }
+ $_G['forum_attachexist'] = $attachment;
+}
+
+function checkflood() {
+ global $_G;
+ if(!$_G['group']['disablepostctrl'] && $_G['uid']) {
+ if($_G['setting']['floodctrl'] && discuz_process::islocked("post_lock_".$_G['uid'], $_G['setting']['floodctrl'])) {
+ return true;
+ }
+ return false;
+
+
+ }
+ return FALSE;
+}
+
+function checkmaxperhour($type) {
+ global $_G;
+ $morenumperhour = false;
+ if(!$_G['group']['disablepostctrl'] && $_G['uid']) {
+ if($_G['group']['max'.($type == 'pid' ? 'posts' : 'threads').'perhour']) {
+ $usernum = C::t('common_member_action_log')->count_per_hour($_G['uid'], $type);
+ $var = $type === 'tid' ? 'maxthreadsperhour' : 'maxpostsperhour';
+ $isflood = $usernum && ($usernum >= $_G['group'][$var]);
+ if($isflood) {
+ $morenumperhour = true;
+ }
+ }
+ }
+ return $morenumperhour;
+}
+
+function checkpost($subject, $message, $special = 0) {
+ global $_G;
+ if(dstrlen($subject) > 80) {
+ return 'post_subject_toolong';
+ }
+ if(!$_G['group']['disablepostctrl'] && !$special) {
+ if($_G['setting']['maxpostsize'] && strlen($message) > $_G['setting']['maxpostsize']) {
+ return 'post_message_toolong';
+ } elseif($_G['setting']['minpostsize']) {
+ $minpostsize = !IN_MOBILE || !$_G['setting']['minpostsize_mobile'] ? $_G['setting']['minpostsize'] : $_G['setting']['minpostsize_mobile'];
+ if(strlen(preg_replace("/\[quote\].+?\[\/quote\]/is", '', $message)) < $minpostsize || strlen(preg_replace("/\[postbg\].+?\[\/postbg\]/is", '', $message)) < $minpostsize) {
+ return 'post_message_tooshort';
+ }
+ }
+ }
+ return FALSE;
+}
+
+function checkbbcodes($message, $bbcodeoff) {
+ return !$bbcodeoff && (!strpos($message, '[/') && !strpos($message, '[hr]')) ? -1 : $bbcodeoff;
+}
+
+function checksmilies($message, $smileyoff) {
+ global $_G;
+
+ if($smileyoff) {
+ return 1;
+ } else {
+ if(!empty($_G['cache']['smileycodes']) && is_array($_G['cache']['smileycodes'])) {
+ foreach($_G['cache']['smileycodes'] as $id => $code) {
+ if(strpos($message, $code) !== FALSE) {
+ return 0;
+ }
+ }
+ }
+ return -1;
+ }
+}
+
+function updatepostcredits($operator, $uidarray, $action, $fid = 0) {
+ global $_G;
+ $val = $operator == '+' ? 1 : -1;
+ $extsql = array();
+ if(empty($uidarray)) {
+ return false;
+ }
+ $uidarray = (array)$uidarray;
+ $uidarr = array();
+ foreach($uidarray as $uid) {
+ $uidarr[$uid] = !isset($uidarr[$uid]) ? 1 : $uidarr[$uid]+1;
+ }
+ foreach($uidarr as $uid => $coef) {
+ $opnum = $val*$coef;
+ if($action == 'reply') {
+ $extsql = array('posts' => $opnum);
+ } elseif($action == 'post') {
+ $extsql = array('threads' => $opnum, 'posts' => $opnum);
+ }
+ if($uid == $_G['uid']) {
+ updatecreditbyaction($action, $uid, $extsql, '', $opnum, 1, $fid);
+ } elseif(empty($uid)) {
+ continue;
+ } else {
+ batchupdatecredit($action, $uid, $extsql, $opnum, $fid);
+ }
+ }
+ if($operator == '+' && ($action == 'reply' || $action == 'post')) {
+ C::t('common_member_status')->update(array_keys($uidarr), array('lastpost' => TIMESTAMP), 'UNBUFFERED');
+ }
+}
+
+function updateattachcredits($operator, $uidarray) {
+ global $_G;
+ foreach($uidarray as $uid => $attachs) {
+ updatecreditbyaction('postattach', $uid, array(), '', $operator == '-' ? -$attachs : $attachs, 1, $_G['fid']);
+ }
+}
+
+function updateforumcount($fid) {
+
+ extract(C::t('forum_thread')->count_posts_by_fid($fid));
+
+ $thread = C::t('forum_thread')->fetch_by_fid_displayorder($fid, 0, '=');
+
+ $thread['subject'] = addslashes($thread['subject']);
+ $thread['lastposter'] = $thread['author'] ? addslashes($thread['lastposter']) : lang('forum/misc', 'anonymous');
+ $tid = $thread['closed'] > 1 ? $thread['closed'] : $thread['tid'];
+ $setarr = array('posts' => $posts, 'threads' => $threads, 'lastpost' => "$tid\t$thread[subject]\t$thread[lastpost]\t$thread[lastposter]");
+ C::t('forum_forum')->update($fid, $setarr);
+}
+
+function updatethreadcount($tid, $updateattach = 0) {
+ $replycount = C::t('forum_post')->count_visiblepost_by_tid($tid) - 1;
+ $lastpost = C::t('forum_post')->fetch_visiblepost_by_tid('tid:'.$tid, $tid, 0, 1);
+
+ $lastpost['author'] = $lastpost['anonymous'] ? lang('forum/misc', 'anonymous') : addslashes($lastpost['author']);
+ $lastpost['dateline'] = !empty($lastpost['dateline']) ? $lastpost['dateline'] : TIMESTAMP;
+
+ $data = array('replies'=>$replycount, 'lastposter'=>$lastpost['author'], 'lastpost'=>$lastpost['dateline']);
+ if($updateattach) {
+ $attach = C::t('forum_post')->fetch_attachment_by_tid($tid);
+ $data['attachment'] = $attach ? 1 : 0;
+ }
+ C::t('forum_thread')->update($tid, $data);
+}
+
+function updatemodlog($tids, $action, $expiration = 0, $iscron = 0, $reason = '', $stamp = 0) {
+ global $_G;
+
+ $uid = empty($iscron) ? $_G['uid'] : 0;
+ $username = empty($iscron) ? $_G['member']['username'] : 0;
+ $expiration = empty($expiration) ? 0 : intval($expiration);
+
+ $data = $comma = '';
+ $stampadd = $stampaddvalue = '';
+ if($stamp) {
+ $stampadd = ', stamp';
+ $stampaddvalue = ", '$stamp'";
+ }
+ foreach(explode(',', str_replace(array('\'', ' '), array('', ''), $tids)) as $tid) {
+ if($tid) {
+
+ $data = array(
+ 'tid' => $tid,
+ 'uid' => $uid,
+ 'username' => $username,
+ 'dateline' => $_G['timestamp'],
+ 'action' => $action,
+ 'expiration' => $expiration,
+ 'status' => 1,
+ 'reason' => $reason
+ );
+ if($stamp) {
+ $data['stamp'] = $stamp;
+ }
+ C::t('forum_threadmod')->insert($data);
+ }
+ }
+
+
+}
+
+function isopera() {
+ $useragent = strtolower($_SERVER['HTTP_USER_AGENT']);
+ if(strpos($useragent, 'opera') !== false) {
+ preg_match('/opera(\/| )([0-9\.]+)/', $useragent, $regs);
+ return $regs[2];
+ }
+ return FALSE;
+}
+
+function deletethreadcaches($tids) {
+ global $_G;
+ if(!$_G['setting']['cachethreadon']) {
+ return FALSE;
+ }
+ require_once libfile('function/forumlist');
+ if(!empty($tids)) {
+ foreach(explode(',', $tids) as $tid) {
+ $fileinfo = getcacheinfo($tid);
+ @unlink($fileinfo['filename']);
+ }
+ }
+ return TRUE;
+}
+
+
+function disuploadedfile($file) {
+ return function_exists('is_uploaded_file') && (is_uploaded_file($file) || is_uploaded_file(str_replace('\\\\', '\\', $file)));
+}
+
+function postfeed($feed) {
+ global $_G;
+ if($feed) {
+ require_once libfile('function/feed');
+ feed_add($feed['icon'], $feed['title_template'], $feed['title_data'], $feed['body_template'], $feed['body_data'], '', $feed['images'], $feed['image_links'], '', '', '', 0, $feed['id'], $feed['idtype']);
+ }
+}
+
+function messagesafeclear($message) {
+ if(strpos($message, '[/password]') !== FALSE) {
+ $message = '';
+ }
+ if(strpos($message, '[/postbg]') !== FALSE) {
+ $message = preg_replace("/\s?\[postbg\]\s*([^\[\<\r\n;'\"\?\(\)]+?)\s*\[\/postbg\]\s?/is", '', $message);
+ }
+ if(strpos($message, '[/begin]') !== FALSE) {
+ $message = preg_replace("/\[begin(=\s*([^\[\<\r\n]*?)\s*,(\d*),(\d*),(\d*),(\d*))?\]\s*([^\[\<\r\n]+?)\s*\[\/begin\]/is", '', $message);
+ }
+ if(strpos($message, '[page]') !== FALSE) {
+ $message = preg_replace("/\s?\[page\]\s?/is", '', $message);
+ }
+ if(strpos($message, '[/index]') !== FALSE) {
+ $message = preg_replace("/\s?\[index\](.+?)\[\/index\]\s?/is", '', $message);
+ }
+ if(strpos($message, '[/begin]') !== FALSE) {
+ $message = preg_replace("/\[begin(=\s*([^\[\<\r\n]*?)\s*,(\d*),(\d*),(\d*),(\d*))?\]\s*([^\[\<\r\n]+?)\s*\[\/begin\]/is", '', $message);
+ }
+ if(strpos($message, '[/groupid]') !== FALSE) {
+ $message = preg_replace("/\[groupid=\d+\].*\[\/groupid\]/i", '', $message);
+ }
+ $language = lang('forum/misc');
+ $message = preg_replace(array($language['post_edithtml_regexp'],$language['post_editnobbcode_regexp'],$language['post_edit_regexp']), '', $message);
+ return $message;
+}
+
+function messagecutstr($str, $length = 0, $dot = ' ...') {
+ global $_G;
+ $str = messagesafeclear($str);
+ $sppos = strpos($str, chr(0).chr(0).chr(0));
+ if($sppos !== false) {
+ $str = substr($str, 0, $sppos);
+ }
+ $language = lang('forum/misc');
+ loadcache(array('bbcodes_display', 'bbcodes', 'smileycodes', 'smilies', 'smileytypes', 'domainwhitelist'));
+ $bbcodes = 'b|i|u|p|color|size|font|align|list|indent|float';
+ $bbcodesclear = 'email|code|free|table|tr|td|img|swf|flash|attach|media|audio|groupid|payto'.($_G['cache']['bbcodes_display'][$_G['groupid']] ? '|'.implode('|', array_keys($_G['cache']['bbcodes_display'][$_G['groupid']])) : '');
+ $str = strip_tags(preg_replace(array(
+ "/\[hide=?\d*\](.*?)\[\/hide\]/is",
+ "/\[quote](.*?)\[\/quote]/si",
+ $language['post_edit_regexp'],
+ "/\[url=?.*?\](.+?)\[\/url\]/si",
+ "/\[($bbcodesclear)=?.*?\].+?\[\/\\1\]/si",
+ "/\[($bbcodes)=?.*?\]/i",
+ "/\[\/($bbcodes)\]/i",
+ "/\\\\u/i"
+ ), array(
+ "[b]$language[post_hidden][/b]",
+ '',
+ '',
+ '\\1',
+ '',
+ '',
+ '',
+ '%u'
+ ), $str));
+ if($length) {
+ $str = cutstr($str, $length, $dot);
+ }
+ $str = preg_replace($_G['cache']['smilies']['searcharray'], '', $str);
+ if($_G['setting']['plugins']['func'][HOOKTYPE]['discuzcode']) {
+ $_G['discuzcodemessage'] = & $str;
+ $param = func_get_args();
+ hookscript('discuzcode', 'global', 'funcs', array('param' => $param, 'caller' => 'messagecutstr'), 'discuzcode');
+ }
+ return trim($str);
+}
+
+
+function setthreadcover($pid, $tid = 0, $aid = 0, $countimg = 0, $imgurl = '') {
+ global $_G;
+ $cover = 0;
+ if(empty($_G['uid']) || !intval($_G['setting']['forumpicstyle']['thumbheight']) || !intval($_G['setting']['forumpicstyle']['thumbwidth'])) {
+ return false;
+ }
+
+ if(($pid || $aid) && empty($countimg)) {
+ if(empty($imgurl)) {
+ if($aid) {
+ $attachtable = 'aid:'.$aid;
+ $attach = C::t('forum_attachment_n')->fetch('aid:'.$aid, $aid, array(1, -1));
+ } else {
+ $attachtable = 'pid:'.$pid;
+ $attach = C::t('forum_attachment_n')->fetch_max_image('pid:'.$pid, 'pid', $pid);
+ }
+ if(!$attach) {
+ return false;
+ }
+ if(empty($_G['forum']['ismoderator']) && $_G['uid'] != $attach['uid']) {
+ return false;
+ }
+ $pid = empty($pid) ? $attach['pid'] : $pid;
+ $tid = empty($tid) ? $attach['tid'] : $tid;
+ $picsource = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']).'forum/'.$attach['attachment'];
+ } else {
+ $attachtable = 'pid:'.$pid;
+ $picsource = $imgurl;
+ }
+
+ $basedir = !$_G['setting']['attachdir'] ? (DISCUZ_ROOT.'./data/attachment/') : $_G['setting']['attachdir'];
+ $coverdir = 'threadcover/'.substr(md5($tid), 0, 2).'/'.substr(md5($tid), 2, 2).'/';
+ dmkdir($basedir.'./forum/'.$coverdir);
+
+ require_once libfile('class/image');
+ $image = new image();
+ if($image->Thumb($picsource, 'forum/'.$coverdir.$tid.'.jpg', $_G['setting']['forumpicstyle']['thumbwidth'], $_G['setting']['forumpicstyle']['thumbheight'], 2)) {
+ $remote = '';
+ if(getglobal('setting/ftp/on')) {
+ if(ftpcmd('upload', 'forum/'.$coverdir.$tid.'.jpg')) {
+ $remote = '-';
+ }
+ }
+ $cover = C::t('forum_attachment_n')->count_image_by_id($attachtable, 'pid', $pid);
+ if($imgurl && empty($cover)) {
+ $cover = 1;
+ }
+ $cover = $remote.$cover;
+ } else {
+ return false;
+ }
+ }
+ if($countimg) {
+ if(empty($cover)) {
+ $thread = C::t('forum_thread')->fetch($tid);
+ $oldcover = $thread['cover'];
+
+ $cover = C::t('forum_attachment_n')->count_image_by_id('tid:'.$tid, 'pid', $pid);
+ if($cover) {
+ $cover = $oldcover < 0 ? '-'.$cover : $cover;
+ }
+ }
+ }
+ if($cover) {
+ C::t('forum_thread')->update($tid, array('cover' => $cover));
+ return true;
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/discuz_plugin_upyun_SC_GBK.xml b/discuz_plugin_upyun_SC_GBK.xml
index c543ba4..a216255 100644
--- a/discuz_plugin_upyun_SC_GBK.xml
+++ b/discuz_plugin_upyun_SC_GBK.xml
@@ -1,8 +1,8 @@
-
-
+
+
-
-
diff --git a/discuz_plugin_upyun_SC_UTF8.xml b/discuz_plugin_upyun_SC_UTF8.xml
index 582763f..34f1506 100644
--- a/discuz_plugin_upyun_SC_UTF8.xml
+++ b/discuz_plugin_upyun_SC_UTF8.xml
@@ -1,8 +1,8 @@
-
-
+
+
-
-
diff --git a/discuz_plugin_upyun_TC_BIG5.xml b/discuz_plugin_upyun_TC_BIG5.xml
index 211e897..65261a4 100644
--- a/discuz_plugin_upyun_TC_BIG5.xml
+++ b/discuz_plugin_upyun_TC_BIG5.xml
@@ -1,8 +1,8 @@
-
-
+
+
-
-
diff --git a/discuz_plugin_upyun_TC_UTF8.xml b/discuz_plugin_upyun_TC_UTF8.xml
index f076180..24bcd1d 100644
--- a/discuz_plugin_upyun_TC_UTF8.xml
+++ b/discuz_plugin_upyun_TC_UTF8.xml
@@ -1,8 +1,8 @@
-
-
+
+
-
-
diff --git a/function_upyun.php b/function_upyun.php
index c0833a8..cad914e 100644
--- a/function_upyun.php
+++ b/function_upyun.php
@@ -32,6 +32,9 @@ function upyun_get_discuz_version() {
case 'X3.3':
$version = 'discuz_3_3';
break;
+ case 'X3.4':
+ $version = 'discuz_3_4';
+ break;
default:
$version = false;
}
@@ -169,6 +172,17 @@ function upyun_get_file_md5() {
'portal_attachment.php' => 'e5fc1bbd71d087e81243f45e61219d50',
);
break;
+ case 'X3.4':
+ return array(
+ 'discuz_ftp.php' => 'd2343fb3bea0e16b574a1ea601a9f871',
+ 'forum_attachment.php' => '016a8b55f747a5855ed60b0bb0ba908a',
+ 'forum_image.php' => '044aabe6823ceff3bd01b082776d5fe5',
+ 'function_attachment.php' => '9d5abc171193da52e2cebcf12f17500a',
+ 'function_home.php' => '7785b5a8a332617b6f929b17f6bb7250',
+ 'function_post.php' => '21f02c43de97c3685e774fd8b7f7ac9e',
+ 'portal_attachment.php' => 'e5fc1bbd71d087e81243f45e61219d50',
+ );
+ break;
default:
return array();
}